@nmshd/runtime 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/buildInformation.js +5 -5
- package/dist/useCases/transport/challenges/ValidateChallange.d.ts +2 -1
- package/dist/useCases/transport/challenges/ValidateChallange.js +7 -6
- package/dist/useCases/transport/challenges/ValidateChallange.js.map +1 -1
- package/lib-web/nmshd.runtime.js +12 -11
- package/lib-web/nmshd.runtime.js.map +1 -1
- package/lib-web/nmshd.runtime.min.js +1 -1
- package/lib-web/nmshd.runtime.min.js.map +1 -1
- package/package.json +6 -6
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*! For license information please see nmshd.runtime.min.js.LICENSE.txt */
|
|
2
|
-
var NMSHDRuntime;(()=>{var t={6984:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.Runtime=void 0;const i=a(75172),o=a(3850),l=a(19663),c=a(7071),u=a(34086),d=a(42205),p=a(5200),h=a(986),m=a(60485),y=a(32746);r.Runtime=class Runtime{constructor(t){this._isInitialized=!1,this._isStarted=!1,this.runtimeConfig=t,this._eventBus=new i.EventEmitter2EventBus}isLoggedIn(){return!!this._accountController}getAccountController(){if(!this._accountController)throw m.RuntimeErrors.startup.noActiveAccount();return this._accountController}getConsumptionController(){if(!this._consumptionController)throw m.RuntimeErrors.startup.noActiveConsumptionController();return this._consumptionController}getDataViewExpander(){if(!this._expander)throw m.RuntimeErrors.startup.noActiveExpander();return this._expander}login(t,r){return this._accountController=t,this._transportServices=c.Container.get(p.TransportServices),this._consumptionController=r,this._consumptionServices=c.Container.get(p.ConsumptionServices),this._expander=c.Container.get(u.DataViewExpander),this}get modules(){return this._modules}get transportServices(){return this._transportServices}get consumptionServices(){return this._consumptionServices}get anonymousServices(){return this._anonymousServices}get eventBus(){return this._eventBus}get isInitialized(){return this._isInitialized}async init(){if(this._isInitialized)throw m.RuntimeErrors.general.alreadyInitialized();this.eventBus.publish(new d.RuntimeInitializingEvent),this.loggerFactory=await this.createLoggerFactory(),await this.initDIContainer(),await this.initTransportLibrary(),await this.initAccount(),this._modules=new p.RuntimeModuleRegistry,await this.loadModules(),await this.initInfrastructure(),await this.initModules(),this._isInitialized=!0,this.eventBus.publish(new d.RuntimeInitializedEvent)}initInfrastructure(){}async getSupportInformation(){return{health:await this.getHealth(),configuration:JSON.parse(JSON.stringify(this.runtimeConfig))}}async initTransportLibrary(){this.eventBus.publish(new d.TransportLibraryInitializingEvent),this.logger.debug("Initializing Database connection... ");const t=await this.createDatabaseConnection();this.transport=new l.Transport(t,this.runtimeConfig.transportLibrary,this.loggerFactory),this.logger.debug("Initializing Transport Library..."),await this.transport.init(),this.logger.debug("Finished initialization of Transport Library."),this._anonymousServices=c.Container.get(p.AnonymousServices),this.eventBus.publish(new d.TransportLibraryInitializedEvent)}async initDIContainer(){c.Container.bind(i.EventBus).factory((()=>this.eventBus)).scope(c.Scope.Singleton),c.Container.bind(h.RuntimeLoggerFactory).factory((()=>this.loggerFactory)).scope(c.Scope.Singleton),c.Container.bind(l.AccountController).factory((()=>this.getAccountController())).scope(c.Scope.Request),c.Container.bind(l.DevicesController).factory((()=>this.getAccountController().devices)).scope(c.Scope.Request),c.Container.bind(l.DeviceController).factory((()=>this.getAccountController().activeDevice)).scope(c.Scope.Request),c.Container.bind(l.FileController).factory((()=>this.getAccountController().files)).scope(c.Scope.Request),c.Container.bind(l.IdentityController).factory((()=>this.getAccountController().identity)).scope(c.Scope.Request),c.Container.bind(l.MessageController).factory((()=>this.getAccountController().messages)).scope(c.Scope.Request),c.Container.bind(l.RelationshipTemplateController).factory((()=>this.getAccountController().relationshipTemplates)).scope(c.Scope.Request),c.Container.bind(l.RelationshipsController).factory((()=>this.getAccountController().relationships)).scope(c.Scope.Request),c.Container.bind(l.TokenController).factory((()=>this.getAccountController().tokens)).scope(c.Scope.Request),c.Container.bind(l.ChallengeController).factory((()=>this.getAccountController().challenges)).scope(c.Scope.Request),c.Container.bind(o.ConsumptionController).factory((()=>this.getConsumptionController())).scope(c.Scope.Request),c.Container.bind(o.ConsumptionAttributesController).factory((()=>this.getConsumptionController().attributes)).scope(c.Scope.Request),c.Container.bind(o.DraftsController).factory((()=>this.getConsumptionController().drafts)).scope(c.Scope.Request),c.Container.bind(o.RelationshipInfoController).factory((()=>this.getConsumptionController().relationshipInfo)).scope(c.Scope.Request),c.Container.bind(o.RequestsController).factory((()=>this.getConsumptionController().requests)).scope(c.Scope.Request),c.Container.bind(o.SettingsController).factory((()=>this.getConsumptionController().settings)).scope(c.Scope.Request),c.Container.bind(o.SharedItemsController).factory((()=>this.getConsumptionController().sharedItems)).scope(c.Scope.Request),c.Container.bind(l.AnonymousTokenController).factory((()=>new l.AnonymousTokenController(this.transport.config))).scope(c.Scope.Singleton);const t=new y.SchemaRepository;await t.loadSchemas(),c.Container.bind(y.SchemaRepository).factory((()=>t)).scope(c.Scope.Singleton)}async loadModules(){this.logger.info("Loading modules...");for(const t in this.runtimeConfig.modules){const r=this.runtimeConfig.modules[t];r.name=t,r.enabled?r.location?await this.loadModule(r):this.logger.error(`Skip loading module '${this.getModuleName(r)}' because has no location.`):this.logger.info(`Skip loading module '${this.getModuleName(r)}' because it is not enabled.`)}this.eventBus.publish(new d.ModulesLoadedEvent)}async initModules(){this.logger.info("Initializing modules...");for(const t of this.modules.toArray())try{await t.init(),this.logger.info(`Module '${this.getModuleName(t)}' was initialized successfully.`)}catch(r){throw this.logger.error(`Module '${this.getModuleName(t)}' could not be initialized.`,r),r}this.eventBus.publish(new d.ModulesInitializedEvent)}get isStarted(){return this._isStarted}async start(){if(!this._isInitialized)throw m.RuntimeErrors.general.notInitialized();if(this._isStarted)throw m.RuntimeErrors.general.alreadyStarted();await this.startInfrastructure(),await this.startModules(),this._isStarted=!0}startInfrastructure(){}async stop(){var t;if(!this._isInitialized)throw m.RuntimeErrors.general.notInitialized();if(!this._isStarted)throw m.RuntimeErrors.general.notStarted();await this.stopModules(),await this.stopInfrastructure(),this.logger.info("Closing AccountController..."),await(null===(t=this._accountController)||void 0===t?void 0:t.close()),this._accountController=void 0,this.logger.info("AccountController was closed successfully."),this._isInitialized=!1,this._isStarted=!1}stopInfrastructure(){}async stopModules(){this.logger.info("Stopping modules...");for(const t of this.modules.toArray())try{await t.stop(),this.logger.info(`Module '${this.getModuleName(t)}' was stopped successfully.`)}catch(r){this.logger.error(`An Error occured while stopping module '${this.getModuleName(t)}': `,r)}this.logger.info("Stopped all modules.")}async startModules(){this.logger.info("Starting modules...");for(const t of this.modules.toArray())try{await t.start(),this.logger.info(`Module '${this.getModuleName(t)}' was started successfully.`)}catch(r){throw this.logger.error(`Module '${this.getModuleName(t)}' could not be started.`,r),r}this.eventBus.publish(new d.ModulesStartedEvent),this.logger.info("Started all modules.")}getModuleName(t){return t.displayName||t.name||JSON.stringify(t)}}},59757:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},986:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.RuntimeLoggerFactory=void 0;r.RuntimeLoggerFactory=class RuntimeLoggerFactory{}},2500:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.buildInformation=void 0;const i=a(90194),o=a(3850),l=a(25030),c=a(82890),u=a(19663);r.buildInformation={version:"1.3.0",build:"37",date:"2022-02-09T14:46:40+00:00",commit:"6b009ce3a3f401a9faaa3e63211ee6d44c13a821",dependencies:{"@js-soft/docdb-querytranslator":"1.0.1","@js-soft/logging-abstractions":"1.0.0","@js-soft/ts-serval":"1.0.2","@js-soft/ts-utils":"^1.1.1","@nmshd/consumption":"1.0.13","@nmshd/content":"1.1.4","@nmshd/crypto":"1.0.8","@nmshd/transport":"1.1.9",ajv:"^8.10.0","ajv-errors":"^3.0.0","ajv-formats":"^2.1.1","fluent-ts-validator":"3.0.3","json-stringify-safe":"^5.0.1",luxon:"^2.3.0",qrcode:"1.5.0","reflect-metadata":"0.1.13","ts-simple-nameof":"1.3.1","typescript-ioc":"3.2.2"},libraries:{serval:i.buildInformation,consumption:o.buildInformation,content:l.buildInformation,crypto:c.buildInformation,transport:u.buildInformation}}},64869:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DataViewExpander=void 0;const c=a(19663),u=a(7071),d=a(5200),p=a(4629),h=a(60485),m=a(32043),y=a(14700),g=a(82466);let v=class DataViewExpander{constructor(t,r,a){this.transport=t,this.consumption=r,this.identityController=a}async expand(t,r){let a=r;if(t["@type"]&&(a=t["@type"]),t instanceof Array){if(!(t.length>0))return[];a=t[0]["@type"]}if(!a)throw h.RuntimeErrors.general.invalidPayload("No type found.");switch(a){case"Message":return t instanceof Array?await this.expandMessageDTOs(t):await this.expandMessageDTO(t);case"Request":return t instanceof Array?await this.expandUnknownRequests(t):await this.expandUnknownRequest(t);case"AttributesShareRequest":return t instanceof Array?await this.expandAttributesShareRequests(t):await this.expandAttributesShareRequest(t);case"AttributesChangeRequest":return t instanceof Array?await this.expandAttributesChangeRequests(t):await this.expandAttributesChangeRequest(t);case"Attribute":return t instanceof Array?await this.expandAttributes(t):this.expandAttribute(t);case"AttributeName":return t instanceof Array?await this.expandAttributeNames(t):await this.expandAttributeName(t);case"Address":return t instanceof Array?await this.expandAddresses(t):await this.expandAddress(t);case"FileId":return t instanceof Array?await this.expandFileIds(t):await this.expandFileId(t);case"File":return t instanceof Array?await this.expandFileDTOs(t):await this.expandFileDTO(t);case"Recipient":return t instanceof Array?await this.expandRecipients(t):await this.expandAddress(t);case"Relationship":return t instanceof Array?await this.expandRelationshipDTOs(t):await this.expandRelationshipDTO(t);case"ConsumptionAttribute":return t instanceof Array?await this.expandConsumptionAttributes(t):this.expandConsumptionAttribute(t);default:throw h.RuntimeErrors.general.notImplemented()}}async expandMessageDTO(t){const r=await this.expandRecipients(t.recipients),a={};r.forEach((t=>a[t.id]=t));const i=await this.expandAddress(t.createdBy),o=[],l=[];for(const r of t.attachments)"string"==typeof r?(l.push(this.expandFileId(r)),o.push(r)):(l.push(this.expandFileDTO(r)),o.push(r.id));const u=await Promise.all(l),d=this.identityController.isMe(c.CoreAddress.from(t.createdBy));let p,h=y.MessageStatus.Received;if(d){h=t.recipients.every((t=>!!t.receivedAt))?y.MessageStatus.Delivered:y.MessageStatus.Delivering,p={...r[0],type:"IdentityDVO"}}else p=i;const g=m.DataViewTranslateable.transport.messageName,v={id:t.id,name:g,date:t.createdAt,type:"MessageDVO",createdByDevice:t.createdByDevice,createdAt:t.createdAt,createdBy:i,recipients:r,attachments:u,isOwn:d,recipientCount:t.recipients.length,attachmentCount:t.attachments.length,status:h,statusText:`i18n://dvo.message.${h}`,image:"",peer:p};if("Mail"===t.content["@type"]||"RequestMail"===t.content["@type"]){const r=t.content,i=r.to.map((t=>a[t]));let o=[];r.cc&&(o=r.cc.map((t=>a[t])));const l={...v,type:"MailDVO",name:r.subject?r.subject:m.DataViewTranslateable.consumption.mails.mailSubjectFallback,subject:r.subject,body:r.body,to:i,toCount:r.to.length,cc:o,ccCount:o.length};if("RequestMail"===r["@type"]){const r=t.content;return{...l,type:"RequestMailDVO",name:r.subject?r.subject:m.DataViewTranslateable.consumption.mails.requestMailSubjectFallback,requests:await this.expandUnknownRequests(r.requests),requestCount:r.requests.length}}return l}return v}async expandMessageDTOs(t){const r=t.map((t=>this.expandMessageDTO(t)));return await Promise.all(r)}async expandUnknownRequest(t){switch(t["@type"]){case"AttributesRequest":return await this.expandAttributesRequest(t);case"AttributesShareRequest":return await this.expandAttributesShareRequest(t);case"AttributesChangeRequest":return await this.expandAttributesChangeRequest(t)}return{id:t.id?t.id:"",name:`${t["@type"]} ${t.key}`,description:"i18n://dvo.request.unknownType",type:"RequestDVO",date:t.expiresAt,...t}}expandRequest(t){return{id:t.id?t.id:"",name:`${t["@type"]} ${t.key}`,type:"RequestDVO",date:t.expiresAt,...t}}async expandUnknownRequests(t){const r=t.map((t=>this.expandUnknownRequest(t)));return await Promise.all(r)}async expandAttributesShareRequest(t){var r,a;const i=this.expandRequest(t),o=[];let l=0;for(const r of t.recipients){if(this.identityController.isMe(c.CoreAddress.from(r)))continue;const t=await this.expandIdentityForAddress(r);t.hasRelationship&&(o.push(t),l++)}if(0===o.length){i.errorCount=(null!==(r=i.errorCount)&&void 0!==r?r:0)+1;const t={code:"error.dvo.request.AttributeShareRequest.noRelationship",message:"There are no relationships to any of the recipients of this request."};i.errors||(i.errors=[]),i.errors.push(t)}else if(o.length!==l){i.warningCount=(null!==(a=i.warningCount)&&void 0!==a?a:0)+1;const t={code:"warning.dvo.request.AttributeShareRequest.onlyRelationships",message:"Not to every recipient of this request exist a relationship."};i.warnings||(i.warnings=[]),i.warnings.push(t)}const u=[];for(const r of t.attributes){const t=await this.expandAttributeName(r);u.push(t)}let d;return d=u.length>1?m.DataViewTranslateable.consumption.requests.attributesShareRequestNamePlural:m.DataViewTranslateable.consumption.requests.attributesShareRequestName,{...i,name:d,type:"AttributesShareRequestDVO",attributes:u,attributeCount:u.length,recipients:o,recipientCount:o.length,possibleRecipientCount:l}}expandConsumptionAttribute(t){return{type:"StoredAttributeDVO",id:t.id,name:t.content.name,value:t.content.value,date:t.createdAt,isOwn:!0,sharedItems:[],sharedItemCount:0}}async expandConsumptionAttributes(t){const r=t.map((t=>this.expandConsumptionAttribute(t)));return await Promise.all(r)}async expandAttributeName(t){const r=await this.consumption.attributes.getAttributeByName({name:t});let a,i=[];return r.isSuccess&&(i=[this.expandConsumptionAttribute(r.value)]),i.length>0&&(a=i[0]),{type:"MatchedAttributesDVO",id:t,name:t,matches:i,matchCount:i.length,bestMatch:a}}async expandAttributeNames(t){const r=t.map((t=>this.expandAttributeName(t)));return await Promise.all(r)}expandAttribute(t){return{type:"AttributeDVO",id:t.name,name:t.name,value:t.value,isOwn:!1}}async expandAttributes(t){const r=t.map((t=>this.expandAttribute(t)));return await Promise.all(r)}async expandAttributesChangeRequest(t){const r=this.expandRequest(t);let a,i;a=t.applyTo?await this.expandIdentityForAddress(t.applyTo):this.expandSelf();const o=[];for(const r of t.attributes){const t=this.expandAttribute(r);o.push(t)}const l=await this.expandAttributeNames(o.map((t=>t.id)));i=o.length>1?m.DataViewTranslateable.consumption.requests.attributesChangeRequestNamePlural:m.DataViewTranslateable.consumption.requests.attributesChangeRequestName;const c=[];return o.forEach(((t,r)=>{c.push({oldAttribute:l[r],newAttribute:t})})),{...r,type:"AttributesChangeRequestDVO",name:i,newAttributes:o,newAttributeCount:o.length,oldAttributes:l,oldAttributeCount:l.length,applyTo:a,changes:c,changeCount:c.length}}async expandAttributesRequest(t){const r=this.expandRequest(t);let a;const i=await this.expandAttributeNames(t.names);return a=i.length>1?m.DataViewTranslateable.consumption.requests.attributesChangeRequestNamePlural:m.DataViewTranslateable.consumption.requests.attributesChangeRequestName,{...r,type:"AttributesRequestDVO",names:t.names,nameCount:t.names.length,name:a,attributes:i,attributeCount:i.length,required:t.required}}expandSelf(){return{id:this.identityController.address.toString(),type:"IdentityDVO",name:"i18n://dvo.identity.self.name",initials:"i18n://dvo.identity.self.initials",realm:c.Realm.Prod,description:"i18n://dvo.identity.self.description",isSelf:!0,hasRelationship:!1}}expandUnknown(t){var r;const a=t.substring(3,9),i=(null!==(r=a.match(/\b\w/g))&&void 0!==r?r:[]).join("");return{id:this.identityController.address.toString(),type:"IdentityDVO",name:a,initials:i,realm:c.Realm.Prod,description:"i18n://dvo.identity.unknown.description",isSelf:!1,hasRelationship:!1}}async expandAttributesShareRequests(t){const r=t.map((t=>this.expandAttributesShareRequest(t)));return await Promise.all(r)}async expandAttributesChangeRequests(t){const r=t.map((t=>this.expandAttributesChangeRequest(t)));return await Promise.all(r)}async expandAddress(t){if(this.identityController.isMe(c.CoreAddress.from(t)))return this.expandSelf();const r=await this.transport.relationships.getRelationshipByAddress({address:t});return r.isError?this.expandUnknown(t):await this.expandRelationshipDTO(r.value)}async expandAddresses(t){const r=t.map((t=>this.expandAddress(t)));return await Promise.all(r)}async expandRecipient(t){return{...await this.expandAddress(t.address),type:"RecipientDVO",receivedAt:t.receivedAt,receivedByDevice:t.receivedByDevice}}async expandRecipients(t){const r=t.map((t=>this.expandRecipient(t)));return await Promise.all(r)}expandRelationshipChange(t,r){const a=r.response?r.response.createdAt:r.request.createdAt;let i,o=!1;return this.identityController.isMe(c.CoreAddress.from(r.request.createdBy))&&(o=!0),r.response&&(i={...r.response,id:`${r.id}_response`,name:"i18n://dvo.relationshipChange.response.name",type:"RelationshipChangeResponseDVO"}),Promise.resolve({type:"RelationshipChangeDVO",id:r.id,name:"",date:a,status:r.status,statusText:`i18n://dvo.relationshipChange.${r.status}`,changeType:r.type,changeTypeText:`i18n://dvo.relationshipChange.${r.type}`,isOwn:o,request:{...r.request,id:`${r.id}_request`,name:"i18n://dvo.relationshipChange.request.name",type:"RelationshipChangeRequestDVO"},response:i})}async expandRelationshipChanges(t){const r=t.changes.map((r=>this.expandRelationshipChange(t,r)));return await Promise.all(r)}async createRelationshipDVO(t,r){var a,i,o,l;if(!r){r=(await this.consumption.relationshipInfo.getRelationshipInfoByRelationship({relationshipId:t.id})).value}let u=g.RelationshipDirection.Incoming;this.identityController.isMe(c.CoreAddress.from(t.changes[0].request.createdBy))&&(u=g.RelationshipDirection.Outgoing);let d="";t.status===c.RelationshipStatus.Pending&&u===g.RelationshipDirection.Outgoing?d=m.DataViewTranslateable.transport.relationshipOutgoing:t.status===c.RelationshipStatus.Pending?d=m.DataViewTranslateable.transport.relationshipIncoming:t.status===c.RelationshipStatus.Rejected?d=m.DataViewTranslateable.transport.relationshipRejected:t.status===c.RelationshipStatus.Revoked?d=m.DataViewTranslateable.transport.relationshipRevoked:t.status===c.RelationshipStatus.Active&&(d=m.DataViewTranslateable.transport.relationshipActive);const p=await this.expandRelationshipChanges(t);return{id:t.id,name:r.userTitle?r.userTitle:r.title,description:r.userDescription?r.userDescription:r.description,date:t.changes[0].request.createdAt,image:"",type:"RelationshipDVO",status:t.status,statusText:d,direction:u,isPinned:r.isPinned,theme:{image:null===(a=r.theme)||void 0===a?void 0:a.image,headerImage:null===(i=r.theme)||void 0===i?void 0:i.imageBar,backgroundColor:null===(o=r.theme)||void 0===o?void 0:o.backgroundColor,foregroundColor:null===(l=r.theme)||void 0===l?void 0:l.foregroundColor},changes:p,changeCount:p.length}}async expandRelationshipDTO(t){var r;const a=(await this.consumption.relationshipInfo.getRelationshipInfoByRelationship({relationshipId:t.id})).value,i=a.userTitle?a.userTitle:a.title;let o=a.userDescription?a.userDescription:a.description;const l=(null!==(r=i.match(/\b\w/g))&&void 0!==r?r:[]).join(""),c=await this.createRelationshipDVO(t,a);return o||(o=c.statusText),{type:"IdentityDVO",id:t.peer,name:i,date:c.date,description:o,publicKey:t.peerIdentity.publicKey,realm:t.peerIdentity.realm,initials:l,isSelf:!1,hasRelationship:!0,relationship:c}}async expandIdentityForAddress(t){var r;if(t===this.identityController.address.toString())return this.expandSelf();const a=await this.transport.relationships.getRelationshipByAddress({address:t});if(a.isSuccess)return await this.expandRelationshipDTO(a.value);if(a.error.code!==h.RuntimeErrors.general.recordNotFound(c.Relationship).code)throw a.error;const i=t.substring(3,9),o=(null!==(r=i.match(/\b\w/g))&&void 0!==r?r:[]).join("");return{id:t,type:"IdentityDVO",name:i,initials:o,publicKey:"i18n://dvo.identity.publicKey.unknown",realm:this.identityController.realm.toString(),description:"i18n://dvo.identity.unknown",isSelf:!1,hasRelationship:!1}}async expandIdentity(t){return await this.expandIdentityForAddress(t.address)}async expandRelationshipDTOs(t){const r=t.map((t=>this.expandRelationshipDTO(t)));return await Promise.all(r)}async expandFileId(t){const r=await this.transport.files.getFile({id:t});if(r.isError)throw r.error;return await this.expandFileDTO(r.value)}async expandFileIds(t){const r=t.map((t=>this.expandFileId(t)));return await Promise.all(r)}async expandFileDTO(t){return{...t,type:"FileDVO",id:t.id,name:t.title?t.title:t.filename,date:t.createdAt,image:"",filename:t.filename,filesize:t.filesize,createdBy:await this.expandAddress(t.createdBy),deletedBy:t.deletedBy?await this.expandAddress(t.deletedBy):void 0}}async expandFileDTOs(t){const r=t.map((t=>this.expandFileDTO(t)));return await Promise.all(r)}};v=i([l(0,u.Inject),l(1,u.Inject),l(2,u.Inject),o("design:paramtypes",[d.TransportServices,p.ConsumptionServices,c.IdentityController])],v),r.DataViewExpander=v},9121:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},32043:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.DataViewTranslateable=void 0;class DataViewTranslateable{}r.DataViewTranslateable=DataViewTranslateable,DataViewTranslateable.prefix="i18n://dvo.",DataViewTranslateable.transport={messageName:`${DataViewTranslateable.prefix}message.name`,relationshipOutgoing:`${DataViewTranslateable.prefix}relationship.Outgoing`,relationshipIncoming:`${DataViewTranslateable.prefix}relationship.Incoming`,relationshipRejected:`${DataViewTranslateable.prefix}relationship.Rejected`,relationshipRevoked:`${DataViewTranslateable.prefix}relationship.Revoked`,relationshipActive:`${DataViewTranslateable.prefix}relationship.Active`,fileName:`${DataViewTranslateable.prefix}file.name`},DataViewTranslateable.consumption={mails:{mailSubjectFallback:`${DataViewTranslateable.prefix}mails.mailSubjectFallback`,requestMailSubjectFallback:`${DataViewTranslateable.prefix}mails.requestMailSubjectFallback`},attributes:{unknownAttributeName:`${DataViewTranslateable.prefix}attributes.UnknownAttributeName`},requests:{attributesShareRequestName:`${DataViewTranslateable.prefix}requests.AttributesShareRequest.name`,attributesShareRequestNamePlural:`${DataViewTranslateable.prefix}requests.AttributesShareRequest.namePlural`,attributesShareRequestNoRelationship:`${DataViewTranslateable.prefix}requests.AttributesShareRequest.noRelationship`,attributesShareRequestOnlyRelationships:`${DataViewTranslateable.prefix}requests.AttributesShareRequest.onlyRelationships`,attributesChangeRequestName:`${DataViewTranslateable.prefix}requests.AttributesChangeRequest.name`,attributesChangeRequestNamePlural:`${DataViewTranslateable.prefix}requests.AttributesChangeRequest.namePlural`},identities:{self:`${DataViewTranslateable.prefix}identities.self.name`}}},89248:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},18928:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},48306:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(89248),r),o(a(18928),r)},39427:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},89542:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(39427),r)},33112:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},36519:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},63522:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},80166:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(33112),r),o(a(36519),r),o(a(63522),r)},34086:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(48306),r),o(a(89542),r),o(a(80166),r),o(a(64869),r),o(a(9121),r),o(a(32043),r),o(a(56574),r)},84457:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},56342:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},14700:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.MessageStatus=void 0,function(t){t.Received="Received",t.Delivering="Delivering",t.Delivered="Delivered"}(r.MessageStatus||(r.MessageStatus={}))},82466:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.RelationshipDirection=void 0,function(t){t.Outgoing="Outgoing",t.Incoming="Incoming"}(r.RelationshipDirection||(r.RelationshipDirection={}))},49893:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},56574:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(84457),r),o(a(56342),r),o(a(14700),r),o(a(82466),r),o(a(49893),r)},21291:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.DataEvent=void 0;const i=a(44584);class DataEvent extends i.Event{constructor(t,r,a){super(t),this.eventTargetAddress=r,this.data=a}}r.DataEvent=DataEvent},44584:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.Event=void 0;r.Event=class Event{constructor(t){this.namespace=t}}},34209:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.MailReceivedEvent=void 0;const i=a(21291);class MailReceivedEvent extends i.DataEvent{constructor(t,r,a){super(MailReceivedEvent.namespace,t,a),this.mail=r}}r.MailReceivedEvent=MailReceivedEvent,MailReceivedEvent.namespace="consumption.mailReceived"},87834:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.RelationshipEvent=void 0;const i=a(21291);class RelationshipEvent extends i.DataEvent{constructor(t,r,a){super(RelationshipEvent.namespace+a.id,t,a),this.event=r}}r.RelationshipEvent=RelationshipEvent,RelationshipEvent.namespace="consumption.relationshipEvent."},49935:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.RequestMailReceivedEvent=void 0;const i=a(21291);class RequestMailReceivedEvent extends i.DataEvent{constructor(t,r,a){super(RequestMailReceivedEvent.namespace,t,a),this.requestMail=r}}r.RequestMailReceivedEvent=RequestMailReceivedEvent,RequestMailReceivedEvent.namespace="consumption.requestMailReceived"},66589:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.RequestReceivedEvent=void 0;const i=a(21291);class RequestReceivedEvent extends i.DataEvent{constructor(t,r,a){super(RequestReceivedEvent.namespace,t,a),this.request=r}}r.RequestReceivedEvent=RequestReceivedEvent,RequestReceivedEvent.namespace="consumption.requestReceived"},42205:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(21291),r),o(a(44584),r),o(a(76762),r),o(a(188),r),o(a(84737),r),o(a(52866),r),o(a(62937),r),o(a(48994),r),o(a(4769),r),o(a(11690),r),o(a(95049),r),o(a(17194),r)},76762:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.ModulesInitializedEvent=void 0;const i=a(44584);class ModulesInitializedEvent extends i.Event{constructor(){super(ModulesInitializedEvent.namespace)}}r.ModulesInitializedEvent=ModulesInitializedEvent,ModulesInitializedEvent.namespace="runtime.modulesInitialized"},188:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.ModulesLoadedEvent=void 0;const i=a(44584);class ModulesLoadedEvent extends i.Event{constructor(){super(ModulesLoadedEvent.namespace)}}r.ModulesLoadedEvent=ModulesLoadedEvent,ModulesLoadedEvent.namespace="runtime.modulesLoaded"},84737:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.ModulesStartedEvent=void 0;const i=a(44584);class ModulesStartedEvent extends i.Event{constructor(){super(ModulesStartedEvent.namespace)}}r.ModulesStartedEvent=ModulesStartedEvent,ModulesStartedEvent.namespace="runtime.modulesStarted"},52866:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.RuntimeInitializedEvent=void 0;const i=a(44584);class RuntimeInitializedEvent extends i.Event{constructor(){super(RuntimeInitializedEvent.namespace)}}r.RuntimeInitializedEvent=RuntimeInitializedEvent,RuntimeInitializedEvent.namespace="runtime.initialized"},62937:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.RuntimeInitializingEvent=void 0;const i=a(44584);class RuntimeInitializingEvent extends i.Event{constructor(){super(RuntimeInitializingEvent.namespace)}}r.RuntimeInitializingEvent=RuntimeInitializingEvent,RuntimeInitializingEvent.namespace="runtime.initializing"},48994:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.MessageReceivedEvent=void 0;const i=a(21291);class MessageReceivedEvent extends i.DataEvent{constructor(t,r){super(MessageReceivedEvent.namespace,t,r)}}r.MessageReceivedEvent=MessageReceivedEvent,MessageReceivedEvent.namespace="transport.messageReceived"},4769:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.MessageSentEvent=void 0;const i=a(21291);class MessageSentEvent extends i.DataEvent{constructor(t,r){super(MessageSentEvent.namespace,t,r)}}r.MessageSentEvent=MessageSentEvent,MessageSentEvent.namespace="transport.messageSent"},11690:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.RelationshipChangedEvent=void 0;const i=a(21291);class RelationshipChangedEvent extends i.DataEvent{constructor(t,r){super(RelationshipChangedEvent.namespace,t,r)}}r.RelationshipChangedEvent=RelationshipChangedEvent,RelationshipChangedEvent.namespace="transport.relationshipChanged"},95049:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.TransportLibraryInitializedEvent=void 0;const i=a(44584);class TransportLibraryInitializedEvent extends i.Event{constructor(){super(TransportLibraryInitializedEvent.namespace)}}r.TransportLibraryInitializedEvent=TransportLibraryInitializedEvent,TransportLibraryInitializedEvent.namespace="transport.initialized"},17194:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.TransportLibraryInitializingEvent=void 0;const i=a(44584);class TransportLibraryInitializingEvent extends i.Event{constructor(){super(TransportLibraryInitializingEvent.namespace)}}r.TransportLibraryInitializingEvent=TransportLibraryInitializingEvent,TransportLibraryInitializingEvent.namespace="transport.initializing"},27371:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.AnonymousServices=void 0;const c=a(7071),u=a(38346);let d=class AnonymousServices{constructor(t){this.tokens=t}};d=i([l(0,c.Inject),o("design:paramtypes",[u.AnonymousTokensFacade])],d),r.AnonymousServices=d},4629:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.ConsumptionServices=void 0;const c=a(7071),u=a(26013);let d=class ConsumptionServices{constructor(t,r,a,i,o){this.attributes=t,this.drafts=r,this.settings=a,this.sharedItems=i,this.relationshipInfo=o}};d=i([l(0,c.Inject),l(1,c.Inject),l(2,c.Inject),l(3,c.Inject),l(4,c.Inject),o("design:paramtypes",[u.AttributesFacade,u.DraftsFacade,u.SettingsFacade,u.SharedItemsFacade,u.RelationshipInfoFacade])],d),r.ConsumptionServices=d},34164:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.TransportServices=void 0;const c=a(7071),u=a(19728);let d=class TransportServices{constructor(t,r,a,i,o,l,c,u){this.files=t,this.messages=r,this.relationships=a,this.relationshipTemplates=i,this.tokens=o,this.account=l,this.devices=c,this.challenges=u}};d=i([l(0,c.Inject),l(1,c.Inject),l(2,c.Inject),l(3,c.Inject),l(4,c.Inject),l(5,c.Inject),l(6,c.Inject),l(7,c.Inject),o("design:paramtypes",[u.FilesFacade,u.MessagesFacade,u.RelationshipsFacade,u.RelationshipTemplatesFacade,u.TokensFacade,u.AccountFacade,u.DevicesFacade,u.ChallengesFacade])],d),r.TransportServices=d},37306:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.AnonymousTokensFacade=void 0;const c=a(7071),u=a(60485);let d=class AnonymousTokensFacade{constructor(t,r){this.loadPeerTokenByTruncatedReferenceUseCase=t,this.loadPeerTokenByIdAndKeyUseCase=r}async loadPeerTokenByTruncatedReference(t){return await this.loadPeerTokenByTruncatedReferenceUseCase.execute(t)}async loadPeerTokenByIdAndKey(t){return await this.loadPeerTokenByIdAndKeyUseCase.execute(t)}};d=i([l(0,c.Inject),l(1,c.Inject),o("design:paramtypes",[u.LoadPeerTokenAnonymousByTruncatedReferenceUseCase,u.LoadPeerTokenAnonymousByIdAndKeyUseCase])],d),r.AnonymousTokensFacade=d},38346:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(37306),r)},12534:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.AttributesFacade=void 0;const c=a(7071),u=a(60485);let d=class AttributesFacade{constructor(t,r,a,i,o,l,c,u,d,p,h){this.createAttributeUseCase=t,this.deleteAttributeUseCase=r,this.deleteAttributeByNameUseCase=a,this.getAllValidUseCase=i,this.getAttributeUseCase=o,this.getAttributeByNameUseCase=l,this.getAttributesUseCase=c,this.getAttributesByNamesUseCase=u,this.getHistoryByNameUseCase=d,this.succeedAttributeUseCase=p,this.updateAttributeUseCase=h}async createAttribute(t){return await this.createAttributeUseCase.execute(t)}async deleteAttribute(t){return await this.deleteAttributeUseCase.execute(t)}async deleteAttributeByName(t){return await this.deleteAttributeByNameUseCase.execute(t)}async getAllValid(){return await this.getAllValidUseCase.execute()}async getAttribute(t){return await this.getAttributeUseCase.execute(t)}async getAttributeByName(t){return await this.getAttributeByNameUseCase.execute(t)}async getAttributes(t){return await this.getAttributesUseCase.execute(t)}async getAttributesByNames(t){return await this.getAttributesByNamesUseCase.execute(t)}async getHistoryByName(t){return await this.getHistoryByNameUseCase.execute(t)}async succeedAttribute(t){return await this.succeedAttributeUseCase.execute(t)}async updateAttribute(t){return await this.updateAttributeUseCase.execute(t)}};d=i([l(0,c.Inject),l(1,c.Inject),l(2,c.Inject),l(3,c.Inject),l(4,c.Inject),l(5,c.Inject),l(6,c.Inject),l(7,c.Inject),l(8,c.Inject),l(9,c.Inject),l(10,c.Inject),o("design:paramtypes",[u.CreateAttributeUseCase,u.DeleteAttributeUseCase,u.DeleteAttributeByNameUseCase,u.GetAllValidUseCase,u.GetAttributeUseCase,u.GetAttributeByNameUseCase,u.GetAttributesUseCase,u.GetAttributesByNamesUseCase,u.GetHistoryByNameUseCase,u.SucceedAttributeUseCase,u.UpdateAttributeUseCase])],d),r.AttributesFacade=d},13514:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DraftsFacade=void 0;const c=a(7071),u=a(60485);let d=class DraftsFacade{constructor(t,r,a,i,o){this.createDraftUseCase=t,this.deleteDraftUseCase=r,this.getDraftUseCase=a,this.getDraftsUseCase=i,this.updateDraftUseCase=o}async createDraft(t){return await this.createDraftUseCase.execute(t)}async deleteDraft(t){return await this.deleteDraftUseCase.execute(t)}async getDraft(t){return await this.getDraftUseCase.execute(t)}async getDrafts(t){return await this.getDraftsUseCase.execute(t)}async updateDraft(t){return await this.updateDraftUseCase.execute(t)}};d=i([l(0,c.Inject),l(1,c.Inject),l(2,c.Inject),l(3,c.Inject),l(4,c.Inject),o("design:paramtypes",[u.CreateDraftUseCase,u.DeleteDraftUseCase,u.GetDraftUseCase,u.GetDraftsUseCase,u.UpdateDraftUseCase])],d),r.DraftsFacade=d},74786:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.RelationshipInfoFacade=void 0;const c=a(7071),u=a(60485);let d=class RelationshipInfoFacade{constructor(t,r,a,i,o,l){this.createRelationshipInfoUseCase=t,this.deleteRelationshipInfoUseCase=r,this.deleteRelationshipInfoByRelationshipUseCase=a,this.getRelationshipInfoUseCase=i,this.getRelationshipInfoByRelationshipUseCase=o,this.updateRelationshipInfoUseCase=l}async createRelationshipInfo(t){return await this.createRelationshipInfoUseCase.execute(t)}async deleteRelationshipInfo(t){return await this.deleteRelationshipInfoUseCase.execute(t)}async deleteRelationshipInfoByRelationship(t){return await this.deleteRelationshipInfoByRelationshipUseCase.execute(t)}async getRelationshipInfo(t){return await this.getRelationshipInfoUseCase.execute(t)}async getRelationshipInfoByRelationship(t){return await this.getRelationshipInfoByRelationshipUseCase.execute(t)}async updateRelationshipInfo(t){return await this.updateRelationshipInfoUseCase.execute(t)}};d=i([l(0,c.Inject),l(1,c.Inject),l(2,c.Inject),l(3,c.Inject),l(4,c.Inject),l(5,c.Inject),o("design:paramtypes",[u.CreateRelationshipInfoUseCase,u.DeleteRelationshipInfoUseCase,u.DeleteRelationshipInfoByRelationshipUseCase,u.GetRelationshipInfoUseCase,u.GetRelationshipInfoByRelationshipUseCase,u.UpdateRelationshipInfoUseCase])],d),r.RelationshipInfoFacade=d},16615:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.SettingsFacade=void 0;const c=a(7071),u=a(60485);let d=class SettingsFacade{constructor(t,r,a,i,o){this.createSettingUseCase=t,this.updateSettingUseCase=r,this.deleteSettingUseCase=a,this.getSettingsUseCase=i,this.getSettingUseCase=o}async createSetting(t){return await this.createSettingUseCase.execute(t)}async getSetting(t){return await this.getSettingUseCase.execute(t)}async getSettings(t){return await this.getSettingsUseCase.execute(t)}async deleteSetting(t){return await this.deleteSettingUseCase.execute(t)}async updateSetting(t){return await this.updateSettingUseCase.execute(t)}};d=i([l(0,c.Inject),l(1,c.Inject),l(2,c.Inject),l(3,c.Inject),l(4,c.Inject),o("design:paramtypes",[u.CreateSettingUseCase,u.UpdateSettingUseCase,u.DeleteSettingUseCase,u.GetSettingsUseCase,u.GetSettingUseCase])],d),r.SettingsFacade=d},89558:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.SharedItemsFacade=void 0;const c=a(7071),u=a(60485);let d=class SharedItemsFacade{constructor(t,r,a,i,o,l,c,u,d){this.createSharedItemUseCase=t,this.deleteSharedItemUseCase=r,this.getSharedItemUseCase=a,this.getSharedItemsUseCase=i,this.getSharedItemsByAddressUseCase=o,this.getSharedItemsByReferenceUseCase=l,this.getSharedItemsSharedByAddressUseCase=c,this.getSharedItemsSharedWithAddressUseCase=u,this.updateSharedItemUseCase=d}async createSharedItem(t){return await this.createSharedItemUseCase.execute(t)}async deleteSharedItem(t){return await this.deleteSharedItemUseCase.execute(t)}async getSharedItem(t){return await this.getSharedItemUseCase.execute(t)}async getSharedItems(t){return await this.getSharedItemsUseCase.execute(t)}async getSharedItemsByAddress(t){return await this.getSharedItemsByAddressUseCase.execute(t)}async getSharedItemsByReference(t){return await this.getSharedItemsByReferenceUseCase.execute(t)}async getSharedItemsSharedByAddress(t){return await this.getSharedItemsSharedByAddressUseCase.execute(t)}async getSharedItemsSharedWithAddress(t){return await this.getSharedItemsSharedWithAddressUseCase.execute(t)}async updateSharedItem(t){return await this.updateSharedItemUseCase.execute(t)}};d=i([l(0,c.Inject),l(1,c.Inject),l(2,c.Inject),l(3,c.Inject),l(4,c.Inject),l(5,c.Inject),l(6,c.Inject),l(7,c.Inject),l(8,c.Inject),o("design:paramtypes",[u.CreateSharedItemUseCase,u.DeleteSharedItemUseCase,u.GetSharedItemUseCase,u.GetSharedItemsUseCase,u.GetSharedItemsByAddressUseCase,u.GetSharedItemsByReferenceUseCase,u.GetSharedItemsSharedByAddressUseCase,u.GetSharedItemsSharedWithAddressUseCase,u.UpdateSharedItemUseCase])],d),r.SharedItemsFacade=d},26013:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(12534),r),o(a(13514),r),o(a(74786),r),o(a(16615),r),o(a(89558),r)},30941:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.AccountFacade=void 0;const c=a(7071),u=a(60485);let d=class AccountFacade{constructor(t,r,a,i,o,l,c,u){this.getIdentityInfoUseCase=t,this.getDeviceInfoUseCase=r,this.registerPushNotificationTokenUseCase=a,this.syncDatawalletUseCase=i,this.syncEverythingUseCase=o,this.getSyncInfoUseCase=l,this.disableAutoSyncUseCase=c,this.enableAutoSyncUseCase=u}async getIdentityInfo(){return await this.getIdentityInfoUseCase.execute()}async getDeviceInfo(){return await this.getDeviceInfoUseCase.execute()}createDeviceBackup(){throw u.RuntimeErrors.general.notImplemented()}recoverDevice(){throw u.RuntimeErrors.general.notImplemented()}async registerPushNotificationToken(t){return await this.registerPushNotificationTokenUseCase.execute(t)}async syncDatawallet(){return await this.syncDatawalletUseCase.execute()}async syncEverything(){return await this.syncEverythingUseCase.execute()}async getSyncInfo(){return await this.getSyncInfoUseCase.execute()}async enableAutoSync(){return await this.enableAutoSyncUseCase.execute()}async disableAutoSync(){return await this.disableAutoSyncUseCase.execute()}};d=i([l(0,c.Inject),l(1,c.Inject),l(2,c.Inject),l(3,c.Inject),l(4,c.Inject),l(5,c.Inject),l(6,c.Inject),l(7,c.Inject),o("design:paramtypes",[u.GetIdentityInfoUseCase,u.GetDeviceInfoUseCase,u.RegisterPushNotificationTokenUseCase,u.SyncDatawalletUseCase,u.SyncEverythingUseCase,u.GetSyncInfoUseCase,u.DisableAutoSyncUseCase,u.EnableAutoSyncUseCase])],d),r.AccountFacade=d},44213:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.ChallengesFacade=void 0;const c=a(7071),u=a(60485);let d=class ChallengesFacade{constructor(t,r){this.createChallengeUseCase=t,this.validateChallengeUseCase=r}async createChallenge(t){return await this.createChallengeUseCase.execute(t)}async validateChallenge(t){return await this.validateChallengeUseCase.execute(t)}};d=i([l(0,c.Inject),l(1,c.Inject),o("design:paramtypes",[u.CreateChallengeUseCase,u.ValidateChallengeUseCase])],d),r.ChallengesFacade=d},17974:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DevicesFacade=void 0;const c=a(7071),u=a(60485);let d=class DevicesFacade{constructor(t,r,a,i,o,l,c){this.getDeviceUseCase=t,this.getDevicesUseCase=r,this.createDeviceUseCase=a,this.updateDeviceUseCase=i,this.deleteDeviceUseCase=o,this.getDeviceOnboardingInfoUseCase=l,this.getDeviceOnboardingTokenUseCase=c}async getDevice(t){return await this.getDeviceUseCase.execute(t)}async getDevices(){return await this.getDevicesUseCase.execute()}async createDevice(t){return await this.createDeviceUseCase.execute(t)}async getDeviceOnboardingInfo(t){return await this.getDeviceOnboardingInfoUseCase.execute(t)}async getDeviceOnboardingToken(t){return await this.getDeviceOnboardingTokenUseCase.execute(t)}async updateDevice(t){return await this.updateDeviceUseCase.execute(t)}async deleteDevice(t){return await this.deleteDeviceUseCase.execute(t)}};d=i([l(0,c.Inject),l(1,c.Inject),l(2,c.Inject),l(3,c.Inject),l(4,c.Inject),l(5,c.Inject),l(6,c.Inject),o("design:paramtypes",[u.GetDeviceUseCase,u.GetDevicesUseCase,u.CreateDeviceUseCase,u.UpdateDeviceUseCase,u.DeleteDeviceUseCase,u.GetDeviceOnboardingInfoUseCase,u.CreateDeviceOnboardingTokenUseCase])],d),r.DevicesFacade=d},50360:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.FilesFacade=void 0;const c=a(7071),u=a(60485);let d=class FilesFacade{constructor(t,r,a,i,o,l,c){this.uploadOwnFileUseCase=t,this.loadPeerFileUseCase=r,this.getFilesUseCase=a,this.downloadFileUseCase=i,this.getFileUseCase=o,this.createTokenForFileUseCase=l,this.createTokenQrCodeForFileUseCase=c}async getFiles(t){return await this.getFilesUseCase.execute(t)}async loadPeerFile(t){return await this.loadPeerFileUseCase.execute(t)}async downloadFile(t){return await this.downloadFileUseCase.execute(t)}async getFile(t){return await this.getFileUseCase.execute(t)}async uploadOwnFile(t){return await this.uploadOwnFileUseCase.execute(t)}async createTokenForFile(t){return await this.createTokenForFileUseCase.execute(t)}async createTokenQrCodeForFile(t){return await this.createTokenQrCodeForFileUseCase.execute(t)}};d=i([l(0,c.Inject),l(1,c.Inject),l(2,c.Inject),l(3,c.Inject),l(4,c.Inject),l(5,c.Inject),l(6,c.Inject),o("design:paramtypes",[u.UploadOwnFileUseCase,u.LoadPeerFileUseCase,u.GetFilesUseCase,u.DownloadFileUseCase,u.GetFileUseCase,u.CreateTokenForFileUseCase,u.CreateTokenQrCodeForFileUseCase])],d),r.FilesFacade=d},91106:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.IdentityFacade=void 0;const c=a(7071),u=a(60485);let d=class IdentityFacade{constructor(t){this.checkIdentityUseCase=t}async checkIdentity(t){return await this.checkIdentityUseCase.execute(t)}};d=i([l(0,c.Inject),o("design:paramtypes",[u.CheckIdentityUseCase])],d),r.IdentityFacade=d},81532:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.MessagesFacade=void 0;const c=a(7071),u=a(60485);let d=class MessagesFacade{constructor(t,r,a,i,o){this.getMessagesUseCase=t,this.getMessageUseCase=r,this.sendMessageUseCase=a,this.downloadAttachmentUseCase=i,this.getAttachmentMetadataUseCase=o}async sendMessage(t){return await this.sendMessageUseCase.execute(t)}async getMessages(t){return await this.getMessagesUseCase.execute(t)}async getMessage(t){return await this.getMessageUseCase.execute(t)}async downloadAttachment(t){return await this.downloadAttachmentUseCase.execute(t)}async getAttachmentMetadata(t){return await this.getAttachmentMetadataUseCase.execute(t)}};d=i([l(0,c.Inject),l(1,c.Inject),l(2,c.Inject),l(3,c.Inject),l(4,c.Inject),o("design:paramtypes",[u.GetMessagesUseCase,u.GetMessageUseCase,u.SendMessageUseCase,u.DownloadAttachmentUseCase,u.GetAttachmentMetadataUseCase])],d),r.MessagesFacade=d},47349:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.RelationshipTemplatesFacade=void 0;const c=a(7071),u=a(60485);let d=class RelationshipTemplatesFacade{constructor(t,r,a,i,o,l){this.createOwnRelationshipTemplateUseCase=t,this.loadPeerRelationshipTemplateUseCase=r,this.getRealtionshipTemplatesUseCase=a,this.getRelationshipTemplateUseCase=i,this.createTokenQrCodeForOwnTemplateUseCase=o,this.createTokenForOwnTemplateUseCase=l}async createOwnRelationshipTemplate(t){return await this.createOwnRelationshipTemplateUseCase.execute(t)}async loadPeerRelationshipTemplate(t){return await this.loadPeerRelationshipTemplateUseCase.execute(t)}async getRelationshipTemplates(t){return await this.getRealtionshipTemplatesUseCase.execute(t)}async getRelationshipTemplate(t){return await this.getRelationshipTemplateUseCase.execute(t)}async createTokenQrCodeForOwnTemplate(t){return await this.createTokenQrCodeForOwnTemplateUseCase.execute(t)}async createTokenForOwnTemplate(t){return await this.createTokenForOwnTemplateUseCase.execute(t)}};d=i([l(0,c.Inject),l(1,c.Inject),l(2,c.Inject),l(3,c.Inject),l(4,c.Inject),l(5,c.Inject),o("design:paramtypes",[u.CreateOwnRelationshipTemplateUseCase,u.LoadPeerRelationshipTemplateUseCase,u.GetRelationshipTemplatesUseCase,u.GetRelationshipTemplateUseCase,u.CreateTokenQrCodeForOwnTemplateUseCase,u.CreateTokenForOwnTemplateUseCase])],d),r.RelationshipTemplatesFacade=d},98586:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.RelationshipsFacade=void 0;const c=a(7071),u=a(60485);let d=class RelationshipsFacade{constructor(t,r,a,i,o,l,c,u){this.getRelationshipsUseCase=t,this.getRelationshipUseCase=r,this.getRelationshipByAddressUseCase=a,this.createRelationshipUseCase=i,this.createRelationshipChangeUseCase=o,this.acceptRelationshipChangeUseCase=l,this.rejectRelationshipChangeUseCase=c,this.revokeRelationshipChangeUseCase=u}async getRelationships(t){return await this.getRelationshipsUseCase.execute(t)}async getRelationship(t){return await this.getRelationshipUseCase.execute(t)}async getRelationshipByAddress(t){return await this.getRelationshipByAddressUseCase.execute(t)}async createRelationship(t){return await this.createRelationshipUseCase.execute(t)}async createRelationshipChange(t){return await this.createRelationshipChangeUseCase.execute(t)}async acceptRelationshipChange(t){return await this.acceptRelationshipChangeUseCase.execute(t)}async rejectRelationshipChange(t){return await this.rejectRelationshipChangeUseCase.execute(t)}async revokeRelationshipChange(t){return await this.revokeRelationshipChangeUseCase.execute(t)}};d=i([l(0,c.Inject),l(1,c.Inject),l(2,c.Inject),l(3,c.Inject),l(4,c.Inject),l(5,c.Inject),l(6,c.Inject),l(7,c.Inject),o("design:paramtypes",[u.GetRelationshipsUseCase,u.GetRelationshipUseCase,u.GetRelationshipByAddressUseCase,u.CreateRelationshipUseCase,u.CreateRelationshipChangeUseCase,u.AcceptRelationshipChangeUseCase,u.RejectRelationshipChangeUseCase,u.RevokeRelationshipChangeUseCase])],d),r.RelationshipsFacade=d},75392:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.TokensFacade=void 0;const c=a(7071),u=a(60485);let d=class TokensFacade{constructor(t,r,a,i,o){this.createOwnTokenUseCase=t,this.loadPeerTokenUseCase=r,this.getTokensUseCase=a,this.getTokenUseCase=i,this.getQRCodeForTokenUseCase=o}async createOwnToken(t){return await this.createOwnTokenUseCase.execute(t)}async loadPeerToken(t){return await this.loadPeerTokenUseCase.execute(t)}async getTokens(t){return await this.getTokensUseCase.execute(t)}async getToken(t){return await this.getTokenUseCase.execute(t)}async getQRCodeForToken(t){return await this.getQRCodeForTokenUseCase.execute(t)}};d=i([l(0,c.Inject),l(1,c.Inject),l(2,c.Inject),l(3,c.Inject),l(4,c.Inject),o("design:paramtypes",[u.CreateOwnTokenUseCase,u.LoadPeerTokenUseCase,u.GetTokensUseCase,u.GetTokenUseCase,u.GetQRCodeForTokenUseCase])],d),r.TokensFacade=d},19728:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(30941),r),o(a(44213),r),o(a(17974),r),o(a(50360),r),o(a(91106),r),o(a(81532),r),o(a(98586),r),o(a(47349),r),o(a(75392),r)},5200:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(27371),r),o(a(4629),r),o(a(22432),r),o(a(55372),r),o(a(34164),r)},22432:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.RuntimeModule=void 0;r.RuntimeModule=class RuntimeModule{get name(){return this.configuration.name}get displayName(){return this.configuration.displayName}}},55372:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.ModulesIterator=r.RuntimeModuleRegistry=void 0;class RuntimeModuleRegistry{constructor(){this.modules=[]}getByName(t){return this.modules.find((r=>r.name.toLowerCase()===t.toLowerCase()))}add(t){this.modules.push(t)}toArray(){return this.modules.slice()}[Symbol.iterator](){return new ModulesIterator(this.modules)}}r.RuntimeModuleRegistry=RuntimeModuleRegistry;class ModulesIterator{constructor(t){this.items=t,this.currentIndex=0}next(t){return{value:this.items[this.currentIndex++],done:this.currentIndex>this.items.length}}}r.ModulesIterator=ModulesIterator},65590:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(2500),r),o(a(34086),r),o(a(42205),r),o(a(5200),r),o(a(49662),r),o(a(6984),r),o(a(59757),r),o(a(986),r),o(a(83377),r),o(a(60485),r)},86432:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});const i=a(25030),o=a(42205),l=a(34209),c=a(87834),u=a(49935),d=a(66589),p=a(22432);class MessageModule extends p.RuntimeModule{init(){}start(){this.messageReceivedSubscription=this.runtime.eventBus.subscribe(o.MessageReceivedEvent,this.handleMessageReceived)}async handleMessageReceived(t){const r=t.data;this.logger.trace(`Incoming MessageReceivedEvent for ${r.id}`);let a;switch(r.content["@type"]){case"Mail":const o=await i.Mail.from(r.content);a=new l.MailReceivedEvent(t.eventTargetAddress,o,r),this.runtime.eventBus.publish(a),this.logger.trace(`Published MailReceivedEvent for ${r.id}`);break;case"RequestMail":const c=await i.RequestMail.from(r.content);a=new u.RequestMailReceivedEvent(t.eventTargetAddress,c,r),this.runtime.eventBus.publish(a),this.logger.trace(`Published RequestMailReceivedEvent for ${r.id}`);let p=0;for(const a of c.requests)this.runtime.eventBus.publish(new d.RequestReceivedEvent(t.eventTargetAddress,a,r)),this.logger.trace(`Published RequestReceivedEvent request #${p} of RequestMail ${r.id}`),p++;break;default:return}const o=await this.runtime.transportServices.relationships.getRelationshipByAddress({address:r.createdBy});if(!o.isSuccess)return void this.logger.error(`Could not find relationship for address '${r.createdBy}'.`,o.error);const p=o.value;this.runtime.eventBus.publish(new c.RelationshipEvent(t.eventTargetAddress,a,p)),this.logger.trace(`Published RelationshipEvent for ${r.id} to ${p.id}`)}stop(){this.runtime.eventBus.unsubscribe(o.MessageReceivedEvent,this.messageReceivedSubscription)}}r.default=MessageModule},49662:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(86432),r)},25953:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},61776:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},5292:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},58162:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},13899:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},77744:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},17564:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},34009:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},87946:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(61776),r),o(a(5292),r),o(a(58162),r),o(a(13899),r),o(a(77744),r),o(a(17564),r),o(a(34009),r)},83377:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(87946),r),o(a(25953),r),o(a(70450),r)},53456:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},77891:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},59475:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},13462:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},46261:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},86623:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},40641:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},55968:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},82944:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.RelationshipChangeType=r.RelationshipChangeStatus=void 0,function(t){t.Pending="Pending",t.Rejected="Rejected",t.Revoked="Revoked",t.Accepted="Accepted"}(r.RelationshipChangeStatus||(r.RelationshipChangeStatus={})),function(t){t.Creation="Creation",t.Termination="Termination",t.TerminationCancellation="TerminationCancellation"}(r.RelationshipChangeType||(r.RelationshipChangeType={}))},2220:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.RelationshipStatus=void 0,function(t){t.Pending="Pending",t.Active="Active",t.Rejected="Rejected",t.Revoked="Revoked",t.Terminating="Terminating",t.Terminated="Terminated"}(r.RelationshipStatus||(r.RelationshipStatus={}))},16081:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},44561:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},70450:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(53456),r),o(a(77891),r),o(a(59475),r),o(a(13462),r),o(a(46261),r),o(a(86623),r),o(a(40641),r),o(a(55968),r),o(a(82944),r),o(a(2220),r),o(a(16081),r),o(a(44561),r)},49365:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(7771),r)},70807:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.LoadPeerTokenAnonymousByIdAndKeyUseCase=void 0;const c=a(75172),u=a(82890),d=a(19663),p=a(7071),h=a(7049),m=a(57121);class LoadPeerTokenAnonymousByIdAndKeyRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.id)).fulfills(h.IdValidator.required(d.BackboneIds.token)),this.validateIfString((t=>t.secretKey)).isNotNull()}}let y=class LoadPeerTokenAnonymousByIdAndKeyUseCase extends h.UseCase{constructor(t,r){super(r),this.anonymousTokenController=t}async executeInternal(t){const r=await u.CryptoSecretKey.fromBase64(t.secretKey),a=await this.anonymousTokenController.loadPeerToken(d.CoreId.from(t.id),r);return c.Result.ok(await m.TokenMapper.toTokenDTO(a,!0))}};y=i([l(0,p.Inject),l(1,p.Inject),o("design:paramtypes",[d.AnonymousTokenController,LoadPeerTokenAnonymousByIdAndKeyRequestValidator])],y),r.LoadPeerTokenAnonymousByIdAndKeyUseCase=y},86297:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.LoadPeerTokenAnonymousByTruncatedReferenceUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049),h=a(57121);class LoadPeerTokenAnonymousByTruncatedReferenceRequestValidator extends p.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.reference)).isNotNull()}}let m=class LoadPeerTokenAnonymousByTruncatedReferenceUseCase extends p.UseCase{constructor(t,r){super(r),this.anonymousTokenController=t}async executeInternal(t){const r=await this.anonymousTokenController.loadPeerTokenByTruncated(t.reference);return c.Result.ok(await h.TokenMapper.toTokenDTO(r,!0))}};m=i([l(0,d.Inject),l(1,d.Inject),o("design:paramtypes",[u.AnonymousTokenController,LoadPeerTokenAnonymousByTruncatedReferenceRequestValidator])],m),r.LoadPeerTokenAnonymousByTruncatedReferenceUseCase=m},7771:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(70807),r),o(a(86297),r)},56819:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.OwnerRestriction=void 0,function(t){t.Own="o",t.Peer="p"}(r.OwnerRestriction||(r.OwnerRestriction={}))},48728:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.PlatformErrorCodes=void 0;class PlatformErrorCodes{static isNotFoundError(t){return t.code===PlatformErrorCodes.NOT_FOUND}static isValidationError(t){return t.code.startsWith("error.platform.validation")}static isUnexpectedError(t){return t.code.startsWith("error.platform.validation")}}r.PlatformErrorCodes=PlatformErrorCodes,PlatformErrorCodes.NOT_FOUND="error.platform.recordNotFound",PlatformErrorCodes.UNAUTHORIZED="error.platform.unauthorized",PlatformErrorCodes.FORBIDDEN="error.platform.forbidden",PlatformErrorCodes.INVALID_PROPERTY_VALUE="error.platform.invalidPropertyValue",PlatformErrorCodes.UNEXPECTED="error.platform.unexpected"},73832:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__setModuleDefault||(Object.create?function(t,r){Object.defineProperty(t,"default",{enumerable:!0,value:r})}:function(t,r){t.default=r}),l=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var r={};if(null!=t)for(var a in t)"default"!==a&&Object.prototype.hasOwnProperty.call(t,a)&&i(r,t,a);return o(r,t),r};Object.defineProperty(r,"__esModule",{value:!0}),r.QRCode=void 0;const c=l(a(92592));class QRCode{constructor(t){this.base64=t}asBase64(){return this.base64}static async from(t){const r=(await c.toDataURL(`nmshd://qr#${t}`)).split(",")[1];return new QRCode(r)}}r.QRCode=QRCode},6595:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.RuntimeErrors=void 0;const i=a(75172);class RuntimeErrors{}r.RuntimeErrors=RuntimeErrors,RuntimeErrors.general=new class General{unknown(t,r){return new i.ApplicationError("error.runtime.unknown",t,r)}alreadyInitialized(){return new i.ApplicationError("error.runtime.alreadyInitialized","The runtime is already initialized. The init method can only be executed once.")}notInitialized(){return new i.ApplicationError("error.runtime.notInitialized","The runtime is not initialized. You must run init before you can start or stop the runtime.")}alreadyStarted(){return new i.ApplicationError("error.runtime.alreadyStarted","The runtime is already started. You should stop it first for a restart.")}notStarted(){return new i.ApplicationError("error.runtime.notStarted","The runtime is not started. You should start it before stopping.")}recordNotFound(t){return this.recordNotFoundWithMessage(`${t instanceof Function?t.name:t} not found. Make sure the ID exists and the record is not expired.`)}recordNotFoundWithMessage(t){return new i.ApplicationError("error.runtime.recordNotFound",t)}unauthorized(){return new i.ApplicationError("error.runtime.unauthorized","Unauthorized.")}missingRequiredProperty(t){return new i.ApplicationError("error.runtime.validation.missingRequiredProperty",`'${t}' must not be empty.`)}invalidPropertyValue(t,r){return new i.ApplicationError("error.runtime.validation.invalidPropertyValue",null!=r?r:`The value of '${t}' is not valid.`)}invalidPayload(t){return new i.ApplicationError("error.runtime.validation.invalidPayload",null!=t?t:"The given combination of properties in the payload is not supported.")}notImplemented(){return new i.ApplicationError("error.runtime.methodNotImplemented","The requested method is not yet implemented.")}featureNotImplemented(t){return new i.ApplicationError("error.runtime.featureNotImplemented",t)}invalidTokenContent(){return new i.ApplicationError("error.runtime.invalidTokenContent","The given token has an invalid content for this route.")}cacheEmpty(t,r){return new i.ApplicationError("error.runtime.cacheEmpty",`The cache of ${t instanceof Function?t.name:t} with id '${r}' is empty.`)}},RuntimeErrors.serval=new class Serval{unknownType(t){return new i.ApplicationError("error.runtime.unknownType",t)}general(t){return new i.ApplicationError("error.runtime.servalError",t)}requestDeserialization(t){return new i.ApplicationError("error.runtime.requestDeserialization",t)}},RuntimeErrors.startup=new class Startup{noIdentityFound(){return new i.ApplicationError("error.runtime.startup.noIdentityFound","No identity information could be found. Please check your database integrity.")}noActiveAccount(){return new i.ApplicationError("error.runtime.startup.noActiveAccount","No AccountController could be found. You might have to login first.")}noActiveConsumptionController(){return new i.ApplicationError("error.runtime.startup.noActiveConsumptionController","No ConsumptionController could be found. You might have to login first.")}noActiveExpander(){return new i.ApplicationError("error.runtime.startup.noActiveExpander","No DataViewExpander could be found. You might have to login first.")}noDatabaseDefined(){return new i.ApplicationError("error.runtime.startup.noDatabaseDefined","No database is defined. Please check the database configuration.")}noPlatformConnection(){return new i.ApplicationError("error.runtime.startup.noPlatformConnection","No platform connection could be established. Please check you network connectivity.")}privateDeviceKeyInvalid(){return new i.ApplicationError("error.runtime.startup.privateDeviceKeyInvalid","The private key of this device seems to be invalid. You should check your config or database connection.")}},RuntimeErrors.database=new class Database{unknown(){return new i.ApplicationError("error.runtime.database.unknown","An unknown database error occured. Please check the logs.")}connectionError(){return new i.ApplicationError("error.runtime.database.connectionError","Connection to database could not be established. Please check the database credentials.")}quotaExceeded(){return new i.ApplicationError("error.runtime.database.quotaExceeded","It seems that the database quota exceeded. Please increase the database size.")}},RuntimeErrors.relationshipTemplates=new class RelationshipTemplates{cannotCreateTokenForPeerTemplate(){return new i.ApplicationError("error.runtime.relationshipRequests.cannotCreateTokenForPeerTemplate","You cannot create a token for a peer template.")}},RuntimeErrors.messages=new class Messages{fileNotFoundInMessage(t){return new i.ApplicationError("error.runtime.messages.fileNotFoundInMessage",`The requested file '${t}' was not found in the given message.`)}},RuntimeErrors.relationshipInfo=new class RelationshipInfo{relationshipInfoExists(t){return new i.ApplicationError("error.runtime.relationshipInfo.relationshipInfoExists",`RelationshipInfo for RelationshipId ${t} already exists. Try to update the RelationshipInfo instead.`)}},RuntimeErrors.challenges=new class Challenges{invalidSignature(){return new i.ApplicationError("error.runtime.challenges.invalidSignature","The signature is invalid.")}invalidChallenge(){return new i.ApplicationError("error.runtime.challenges.invalidChallenge","The challenge is invalid.")}}},71683:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.RuntimeValidator=void 0;const i=a(63586);class RuntimeValidator extends i.AbstractValidator{constructor(){super(),this.validateIfAny((t=>t)).isDefined().withFailureMessage("request is undefined")}}r.RuntimeValidator=RuntimeValidator},32746:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__setModuleDefault||(Object.create?function(t,r){Object.defineProperty(t,"default",{enumerable:!0,value:r})}:function(t,r){t.default=r}),l=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var r={};if(null!=t)for(var a in t)"default"!==a&&Object.prototype.hasOwnProperty.call(t,a)&&i(r,t,a);return o(r,t),r},c=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:!0}),r.JsonSchema=r.SchemaRepository=void 0;const u=c(a(1581)),d=c(a(33351)),p=c(a(5477)),h={fileId:"FIL[A-z0-9]{17}",relationshipId:"REL[A-z0-9]{17}",messageId:"MSG[A-z0-9]{17}",relationshipTemplateId:"RLT[A-z0-9]{17}",tokenId:"TOK[A-z0-9]{17}",relationshipChangeId:"RCH[A-z0-9]{17}",deviceId:"DVC[A-z0-9]{17}",challengeId:"CHL[A-z0-9]{17}"};r.SchemaRepository=class SchemaRepository{constructor(){this.jsonSchemas=new Map,this.compiler=new u.default({allErrors:!0}),(0,p.default)(this.compiler),(0,d.default)(this.compiler),this.addCustomFormats()}addCustomFormats(){Object.entries(h).forEach((([t,r])=>{this.compiler.addFormat(t,r)}))}async loadSchemas(){this.schemaDefinitions=await Promise.resolve().then((()=>l(a(11873))))}getSchema(t){return this.jsonSchemas.has(t)||this.jsonSchemas.set(t,new JsonSchema(this.getValidationFunction(t))),this.jsonSchemas.get(t)}getValidationFunction(t){return this.compiler.compile(this.getSchemaDefinition(t))}getSchemaDefinition(t){const r=this.schemaDefinitions[t];if(!r)throw new Error(`Schema ${t} not found`);return r}};class JsonSchema{constructor(t){this.validateSchema=t}validate(t){return{isValid:this.validateSchema(t),errors:this.validateSchema.errors?[...this.validateSchema.errors]:void 0}}}r.JsonSchema=JsonSchema},11873:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.GetDeviceOnboardingInfoRequest=r.GetDeviceRequest=r.DeleteDeviceRequest=r.CreateDeviceOnboardingTokenRequest=r.CreateDeviceRequest=r.ValidateChallengeRequest=r.CreateChallengeRequest=r.CreateDeviceChallengeRequest=r.CreateIdentityChallengeRequest=r.CreateRelationshipChallengeRequest=r.DownloadAttachmentRequest=r.DownloadFileRequest=r.RegisterPushNotificationTokenRequest=r.UpdateSharedItemRequest=r.GetSharedItemsSharedWithAddressRequest=r.GetSharedItemsSharedByAddressRequest=r.GetSharedItemsByReferenceRequest=r.GetSharedItemsByAddressRequest=r.GetSharedItemsRequest=r.GetSharedItemRequest=r.DeleteSharedItemRequest=r.CreateSharedItemRequest=r.UpdateSettingRequest=r.GetSettingsRequest=r.GetSettingRequest=r.DeleteSettingRequest=r.CreateSettingRequest=r.UpdateRelationshipInfoRequest=r.GetRelationshipInfoByRelationshipRequest=r.GetRelationshipInfoRequest=r.DeleteRelationshipInfoByRelationshipRequest=r.DeleteRelationshipInfoRequest=r.CreateRelationshipInfoRequest=r.UpdateDraftRequest=r.GetDraftsRequest=r.GetDraftRequest=r.DeleteDraftRequest=r.CreateDraftRequest=r.UpdateAttributeRequest=r.SucceedAttributeRequest=r.GetHistoryByNameRequest=r.GetAttributesRequest=r.GetAttributeByNameRequest=r.GetAttributeRequest=r.DeleteAttributeByNameRequest=r.DeleteAttributeRequest=r.CreateAttributeRequest=r.GetAttributesByNamesRequest=r.LoadPeerTokenAnonymousByTruncatedReferenceRequest=r.LoadPeerTokenAnonymousByIdAndKeyRequest=void 0,r.LoadPeerTokenRequest=r.GetTokensRequest=r.GetTokenRequest=r.GetQRCodeForTokenRequest=r.CreateOwnTokenRequest=r.LoadPeerRelationshipTemplateRequest=r.GetRelationshipTemplatesRequest=r.GetRelationshipTemplateRequest=r.CreateTokenQrCodeForOwnTemplateRequest=r.CreateTokenForOwnTemplateRequest=r.CreateOwnRelationshipTemplateRequest=r.RevokeRelationshipChangeRequest=r.RejectRelationshipChangeRequest=r.GetRelationshipsRequest=r.GetRelationshipByAddressRequest=r.GetRelationshipRequest=r.CreateRelationshipChangeRequest=r.CreateRelationshipRequest=r.AcceptRelationshipChangeRequest=r.SendMessageRequest=r.GetMessagesRequest=r.GetMessageRequest=r.GetAttachmentMetadataRequest=r.CheckIdentityRequest=r.UploadOwnFileRequest=r.LoadPeerFileRequest=r.LoadPeerFileViaReferenceRequest=r.LoadPeerFileViaSecretRequest=r.GetFilesRequest=r.GetFileRequest=r.CreateTokenQrCodeForFileRequest=r.CreateTokenForFileRequest=r.UpdateDeviceRequest=void 0,r.LoadPeerTokenAnonymousByIdAndKeyRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/LoadPeerTokenAnonymousByIdAndKeyRequest",definitions:{LoadPeerTokenAnonymousByIdAndKeyRequest:{type:"object",properties:{id:{type:"string"},secretKey:{type:"string"}},required:["id","secretKey"],additionalProperties:!1}}},r.LoadPeerTokenAnonymousByTruncatedReferenceRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/LoadPeerTokenAnonymousByTruncatedReferenceRequest",definitions:{LoadPeerTokenAnonymousByTruncatedReferenceRequest:{type:"object",properties:{reference:{type:"string"}},required:["reference"],additionalProperties:!1}}},r.GetAttributesByNamesRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetAttributesByNamesRequest",definitions:{GetAttributesByNamesRequest:{type:"object",additionalProperties:!1}}},r.CreateAttributeRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/CreateAttributeRequest",definitions:{CreateAttributeRequest:{type:"object",properties:{attribute:{$ref:"#/definitions/IAttribute"}},required:["attribute"],additionalProperties:!1},IAttribute:{type:"object",properties:{name:{type:"string"},value:{},validFrom:{$ref:"#/definitions/ICoreDate"},validTo:{$ref:"#/definitions/ICoreDate"}},required:["name","value"],additionalProperties:!1},ICoreDate:{type:"object",properties:{date:{type:"string"}},required:["date"],additionalProperties:!1}}},r.DeleteAttributeRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/DeleteAttributeRequest",definitions:{DeleteAttributeRequest:{type:"object",properties:{id:{type:"string"}},required:["id"],additionalProperties:!1}}},r.DeleteAttributeByNameRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/DeleteAttributeByNameRequest",definitions:{DeleteAttributeByNameRequest:{type:"object",properties:{name:{type:"string"}},required:["name"],additionalProperties:!1}}},r.GetAttributeRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetAttributeRequest",definitions:{GetAttributeRequest:{type:"object",properties:{id:{type:"string"}},required:["id"],additionalProperties:!1}}},r.GetAttributeByNameRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetAttributeByNameRequest",definitions:{GetAttributeByNameRequest:{type:"object",properties:{name:{type:"string"}},required:["name"],additionalProperties:!1}}},r.GetAttributesRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetAttributesRequest",definitions:{GetAttributesRequest:{type:"object",additionalProperties:!1}}},r.GetHistoryByNameRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetHistoryByNameRequest",definitions:{GetHistoryByNameRequest:{type:"object",properties:{name:{type:"string"}},required:["name"],additionalProperties:!1}}},r.SucceedAttributeRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/SucceedAttributeRequest",definitions:{SucceedAttributeRequest:{type:"object",properties:{attribute:{$ref:"#/definitions/IAttribute"},validFrom:{type:"string"}},required:["attribute"],additionalProperties:!1},IAttribute:{type:"object",properties:{name:{type:"string"},value:{},validFrom:{$ref:"#/definitions/ICoreDate"},validTo:{$ref:"#/definitions/ICoreDate"}},required:["name","value"],additionalProperties:!1},ICoreDate:{type:"object",properties:{date:{type:"string"}},required:["date"],additionalProperties:!1}}},r.UpdateAttributeRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/UpdateAttributeRequest",definitions:{UpdateAttributeRequest:{type:"object",properties:{id:{type:"string"},attribute:{$ref:"#/definitions/IAttribute"}},required:["id","attribute"],additionalProperties:!1},IAttribute:{type:"object",properties:{name:{type:"string"},value:{},validFrom:{$ref:"#/definitions/ICoreDate"},validTo:{$ref:"#/definitions/ICoreDate"}},required:["name","value"],additionalProperties:!1},ICoreDate:{type:"object",properties:{date:{type:"string"}},required:["date"],additionalProperties:!1}}},r.CreateDraftRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/CreateDraftRequest",definitions:{CreateDraftRequest:{type:"object",properties:{content:{},type:{type:"string"}},required:["content"],additionalProperties:!1}}},r.DeleteDraftRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/DeleteDraftRequest",definitions:{DeleteDraftRequest:{type:"object",properties:{id:{type:"string"}},required:["id"],additionalProperties:!1}}},r.GetDraftRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetDraftRequest",definitions:{GetDraftRequest:{type:"object",properties:{id:{type:"string"}},required:["id"],additionalProperties:!1}}},r.GetDraftsRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetDraftsRequest",definitions:{GetDraftsRequest:{type:"object",properties:{query:{}},additionalProperties:!1}}},r.UpdateDraftRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/UpdateDraftRequest",definitions:{UpdateDraftRequest:{type:"object",properties:{id:{type:"string"},content:{}},required:["id","content"],additionalProperties:!1}}},r.CreateRelationshipInfoRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/CreateRelationshipInfoRequest",definitions:{CreateRelationshipInfoRequest:{type:"object",properties:{relationshipId:{type:"string"},attributes:{type:"array",items:{$ref:"#/definitions/RelationshipAttributeDTO"}},isPinned:{type:"boolean"},title:{type:"string"},description:{type:"string"},userTitle:{type:"string"},userDescription:{type:"string"},theme:{$ref:"#/definitions/RelationshipThemeDTO"}},required:["relationshipId","attributes","isPinned","title"],additionalProperties:!1},RelationshipAttributeDTO:{type:"object",properties:{name:{type:"string"},content:{$ref:"#/definitions/AttributeJSON"},sharedItem:{type:"string"}},required:["name","content","sharedItem"],additionalProperties:!1},AttributeJSON:{type:"object",properties:{"@type":{type:"string"},"@schema":{type:"string"},name:{type:"string"},value:{},validFrom:{type:"string"},validTo:{type:"string"}},required:["@type","name","value"],additionalProperties:!1},RelationshipThemeDTO:{type:"object",properties:{image:{type:"string"},imageBar:{type:"string"},backgroundColor:{type:"string"},foregroundColor:{type:"string"}},required:["image","imageBar","backgroundColor","foregroundColor"],additionalProperties:!1}}},r.DeleteRelationshipInfoRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/DeleteRelationshipInfoRequest",definitions:{DeleteRelationshipInfoRequest:{type:"object",properties:{id:{type:"string"}},required:["id"],additionalProperties:!1}}},r.DeleteRelationshipInfoByRelationshipRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/DeleteRelationshipInfoByRelationshipRequest",definitions:{DeleteRelationshipInfoByRelationshipRequest:{type:"object",properties:{relationshipId:{type:"string"}},required:["relationshipId"],additionalProperties:!1}}},r.GetRelationshipInfoRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetRelationshipInfoRequest",definitions:{GetRelationshipInfoRequest:{type:"object",properties:{id:{type:"string"}},required:["id"],additionalProperties:!1}}},r.GetRelationshipInfoByRelationshipRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetRelationshipInfoByRelationshipRequest",definitions:{GetRelationshipInfoByRelationshipRequest:{type:"object",properties:{relationshipId:{type:"string"}},required:["relationshipId"],additionalProperties:!1}}},r.UpdateRelationshipInfoRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/UpdateRelationshipInfoRequest",definitions:{UpdateRelationshipInfoRequest:{type:"object",properties:{id:{type:"string"},attributes:{type:"array",items:{$ref:"#/definitions/RelationshipAttributeDTO"}},isPinned:{type:"boolean"},title:{type:"string"},description:{type:"string"},userTitle:{type:"string"},userDescription:{type:"string"},theme:{$ref:"#/definitions/RelationshipThemeDTO"}},required:["id"],additionalProperties:!1,description:"Overwrite a RelationshipInfo's attributes with the request's corresponding fields. Undefined fields in the request will leave the corresponding RelationshipInfo's attributes untouched."},RelationshipAttributeDTO:{type:"object",properties:{name:{type:"string"},content:{$ref:"#/definitions/AttributeJSON"},sharedItem:{type:"string"}},required:["name","content","sharedItem"],additionalProperties:!1},AttributeJSON:{type:"object",properties:{"@type":{type:"string"},"@schema":{type:"string"},name:{type:"string"},value:{},validFrom:{type:"string"},validTo:{type:"string"}},required:["@type","name","value"],additionalProperties:!1},RelationshipThemeDTO:{type:"object",properties:{image:{type:"string"},imageBar:{type:"string"},backgroundColor:{type:"string"},foregroundColor:{type:"string"}},required:["image","imageBar","backgroundColor","foregroundColor"],additionalProperties:!1}}},r.CreateSettingRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/CreateSettingRequest",definitions:{CreateSettingRequest:{type:"object",properties:{key:{type:"string"},value:{},reference:{type:"string"},scope:{type:"string"},succeedsAt:{type:"string"},succeedsItem:{type:"string"}},required:["key","value"],additionalProperties:!1}}},r.DeleteSettingRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/DeleteSettingRequest",definitions:{DeleteSettingRequest:{type:"object",properties:{id:{type:"string"}},required:["id"],additionalProperties:!1}}},r.GetSettingRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetSettingRequest",definitions:{GetSettingRequest:{type:"object",properties:{id:{type:"string"}},required:["id"],additionalProperties:!1}}},r.GetSettingsRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetSettingsRequest",definitions:{GetSettingsRequest:{type:"object",properties:{query:{}},additionalProperties:!1}}},r.UpdateSettingRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/UpdateSettingRequest",definitions:{UpdateSettingRequest:{type:"object",properties:{id:{type:"string"},value:{}},required:["id","value"],additionalProperties:!1}}},r.CreateSharedItemRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/CreateSharedItemRequest",definitions:{CreateSharedItemRequest:{type:"object",properties:{tags:{type:"array",items:{type:"string"}},sharedBy:{type:"string"},sharedWith:{type:"string"},sharedAt:{type:"string"},reference:{type:"string"},content:{},succeedsItem:{type:"string"},succeedsAt:{type:"string"},expiresAt:{type:"string"}},required:["sharedBy","sharedWith","sharedAt","content"],additionalProperties:!1}}},r.DeleteSharedItemRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/DeleteSharedItemRequest",definitions:{DeleteSharedItemRequest:{type:"object",properties:{id:{type:"string"}},required:["id"],additionalProperties:!1}}},r.GetSharedItemRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetSharedItemRequest",definitions:{GetSharedItemRequest:{type:"object",properties:{id:{type:"string"}},required:["id"],additionalProperties:!1}}},r.GetSharedItemsRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetSharedItemsRequest",definitions:{GetSharedItemsRequest:{type:"object",properties:{query:{}},additionalProperties:!1}}},r.GetSharedItemsByAddressRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetSharedItemsByAddressRequest",definitions:{GetSharedItemsByAddressRequest:{type:"object",properties:{address:{type:"string"}},required:["address"],additionalProperties:!1}}},r.GetSharedItemsByReferenceRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetSharedItemsByReferenceRequest",definitions:{GetSharedItemsByReferenceRequest:{type:"object",properties:{reference:{type:"string"}},required:["reference"],additionalProperties:!1}}},r.GetSharedItemsSharedByAddressRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetSharedItemsSharedByAddressRequest",definitions:{GetSharedItemsSharedByAddressRequest:{type:"object",properties:{address:{type:"string"}},required:["address"],additionalProperties:!1}}},r.GetSharedItemsSharedWithAddressRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetSharedItemsSharedWithAddressRequest",definitions:{GetSharedItemsSharedWithAddressRequest:{type:"object",properties:{address:{type:"string"}},required:["address"],additionalProperties:!1}}},r.UpdateSharedItemRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/UpdateSharedItemRequest",definitions:{UpdateSharedItemRequest:{type:"object",properties:{id:{type:"string"},content:{}},required:["id","content"],additionalProperties:!1}}},r.RegisterPushNotificationTokenRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/RegisterPushNotificationTokenRequest",definitions:{RegisterPushNotificationTokenRequest:{type:"object",properties:{handle:{type:"string"},installationId:{type:"string"},platform:{type:"string"}},required:["handle","installationId","platform"],additionalProperties:!1}}},r.DownloadFileRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/DownloadFileRequest",definitions:{DownloadFileRequest:{type:"object",properties:{id:{type:"string",format:"fileId"}},required:["id"],additionalProperties:!1}}},r.DownloadAttachmentRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/DownloadAttachmentRequest",definitions:{DownloadAttachmentRequest:{type:"object",properties:{id:{type:"string"},attachmentId:{type:"string"}},required:["id","attachmentId"],additionalProperties:!1}}},r.CreateRelationshipChallengeRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/CreateRelationshipChallengeRequest",definitions:{CreateRelationshipChallengeRequest:{type:"object",properties:{challengeType:{type:"string",const:"Relationship"},relationship:{type:"string",format:"relationshipId"}},required:["challengeType","relationship"],additionalProperties:!1}}},r.CreateIdentityChallengeRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/CreateIdentityChallengeRequest",definitions:{CreateIdentityChallengeRequest:{type:"object",properties:{challengeType:{type:"string",const:"Identity"}},required:["challengeType"],additionalProperties:!1}}},r.CreateDeviceChallengeRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/CreateDeviceChallengeRequest",definitions:{CreateDeviceChallengeRequest:{type:"object",properties:{challengeType:{type:"string",const:"Device"}},required:["challengeType"],additionalProperties:!1}}},r.CreateChallengeRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/CreateChallengeRequest",definitions:{CreateChallengeRequest:{anyOf:[{$ref:"#/definitions/CreateRelationshipChallengeRequest"},{$ref:"#/definitions/CreateIdentityChallengeRequest"},{$ref:"#/definitions/CreateDeviceChallengeRequest"}]},CreateRelationshipChallengeRequest:{type:"object",properties:{challengeType:{type:"string",const:"Relationship"},relationship:{type:"string",format:"relationshipId"}},required:["challengeType","relationship"],additionalProperties:!1},CreateIdentityChallengeRequest:{type:"object",properties:{challengeType:{type:"string",const:"Identity"}},required:["challengeType"],additionalProperties:!1},CreateDeviceChallengeRequest:{type:"object",properties:{challengeType:{type:"string",const:"Device"}},required:["challengeType"],additionalProperties:!1}}},r.ValidateChallengeRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/ValidateChallengeRequest",definitions:{ValidateChallengeRequest:{type:"object",properties:{challenge:{type:"string"},signature:{type:"string"}},required:["challenge","signature"],additionalProperties:!1}}},r.CreateDeviceRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/CreateDeviceRequest",definitions:{CreateDeviceRequest:{type:"object",properties:{name:{type:"string"},description:{type:"string"},isAdmin:{type:"boolean"}},additionalProperties:!1}}},r.CreateDeviceOnboardingTokenRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/CreateDeviceOnboardingTokenRequest",definitions:{CreateDeviceOnboardingTokenRequest:{type:"object",properties:{id:{type:"string"},expiresAt:{type:"string"}},required:["id"],additionalProperties:!1}}},r.DeleteDeviceRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/DeleteDeviceRequest",definitions:{DeleteDeviceRequest:{type:"object",properties:{id:{type:"string"}},required:["id"],additionalProperties:!1}}},r.GetDeviceRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetDeviceRequest",definitions:{GetDeviceRequest:{type:"object",properties:{id:{type:"string"}},required:["id"],additionalProperties:!1}}},r.GetDeviceOnboardingInfoRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetDeviceOnboardingInfoRequest",definitions:{GetDeviceOnboardingInfoRequest:{type:"object",properties:{id:{type:"string"}},required:["id"],additionalProperties:!1}}},r.UpdateDeviceRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/UpdateDeviceRequest",definitions:{UpdateDeviceRequest:{type:"object",properties:{id:{type:"string"},name:{type:"string"},description:{type:"string"}},required:["id"],additionalProperties:!1}}},r.CreateTokenForFileRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/CreateTokenForFileRequest",definitions:{CreateTokenForFileRequest:{type:"object",properties:{fileId:{type:"string",format:"fileId"},expiresAt:{type:"string",format:"date-time"},ephemeral:{type:"boolean"}},required:["fileId"],additionalProperties:!1}}},r.CreateTokenQrCodeForFileRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/CreateTokenQrCodeForFileRequest",definitions:{CreateTokenQrCodeForFileRequest:{type:"object",properties:{fileId:{type:"string",format:"fileId"},expiresAt:{type:"string",format:"date-time"}},required:["fileId"],additionalProperties:!1}}},r.GetFileRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetFileRequest",definitions:{GetFileRequest:{type:"object",properties:{id:{type:"string",format:"fileId"}},required:["id"],additionalProperties:!1}}},r.GetFilesRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetFilesRequest",definitions:{GetFilesRequest:{type:"object",properties:{query:{},ownerRestriction:{$ref:"#/definitions/OwnerRestriction"}},additionalProperties:!1},OwnerRestriction:{type:"string",enum:["o","p"]}}},r.LoadPeerFileViaSecretRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/LoadPeerFileViaSecretRequest",definitions:{LoadPeerFileViaSecretRequest:{type:"object",properties:{id:{type:"string",format:"fileId"},secretKey:{type:"string",minLength:100}},required:["id","secretKey"],additionalProperties:!1}}},r.LoadPeerFileViaReferenceRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/LoadPeerFileViaReferenceRequest",definitions:{LoadPeerFileViaReferenceRequest:{type:"object",properties:{reference:{type:"string",pattern:"VE9L.{84}"}},required:["reference"],additionalProperties:!1,errorMessage:"token reference invalid"}}},r.LoadPeerFileRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/LoadPeerFileRequest",definitions:{LoadPeerFileRequest:{anyOf:[{$ref:"#/definitions/LoadPeerFileViaSecretRequest"},{$ref:"#/definitions/LoadPeerFileViaReferenceRequest"}]},LoadPeerFileViaSecretRequest:{type:"object",properties:{id:{type:"string",format:"fileId"},secretKey:{type:"string",minLength:100}},required:["id","secretKey"],additionalProperties:!1},LoadPeerFileViaReferenceRequest:{type:"object",properties:{reference:{type:"string",pattern:"VE9L.{84}"}},required:["reference"],additionalProperties:!1,errorMessage:"token reference invalid"}}},r.UploadOwnFileRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/UploadOwnFileRequest",definitions:{UploadOwnFileRequest:{type:"object",properties:{content:{type:"object",properties:{BYTES_PER_ELEMENT:{type:"number"},buffer:{type:"object",properties:{byteLength:{type:"number"}},required:["byteLength"],additionalProperties:!1},byteLength:{type:"number"},byteOffset:{type:"number"},length:{type:"number"}},required:["BYTES_PER_ELEMENT","buffer","byteLength","byteOffset","length"],additionalProperties:{type:"number"}},filename:{type:"string"},mimetype:{type:"string"},expiresAt:{type:"string"},title:{type:"string"},description:{type:"string"}},required:["content","filename","mimetype","expiresAt","title"],additionalProperties:!1}}},r.CheckIdentityRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/CheckIdentityRequest",definitions:{CheckIdentityRequest:{type:"object",properties:{address:{type:"string"}},required:["address"],additionalProperties:!1}}},r.GetAttachmentMetadataRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetAttachmentMetadataRequest",definitions:{GetAttachmentMetadataRequest:{type:"object",properties:{id:{type:"string"},attachmentId:{type:"string"}},required:["id","attachmentId"],additionalProperties:!1}}},r.GetMessageRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetMessageRequest",definitions:{GetMessageRequest:{type:"object",properties:{id:{type:"string"}},required:["id"],additionalProperties:!1}}},r.GetMessagesRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetMessagesRequest",definitions:{GetMessagesRequest:{type:"object",properties:{query:{}},additionalProperties:!1}}},r.SendMessageRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/SendMessageRequest",definitions:{SendMessageRequest:{type:"object",properties:{recipients:{type:"array",items:{type:"string"}},content:{},attachments:{type:"array",items:{type:"string"}}},required:["recipients","content"],additionalProperties:!1}}},r.AcceptRelationshipChangeRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/AcceptRelationshipChangeRequest",definitions:{AcceptRelationshipChangeRequest:{type:"object",properties:{relationshipId:{type:"string"},changeId:{type:"string"},content:{}},required:["relationshipId","changeId","content"],additionalProperties:!1}}},r.CreateRelationshipRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/CreateRelationshipRequest",definitions:{CreateRelationshipRequest:{type:"object",properties:{templateId:{type:"string"},content:{}},required:["templateId","content"],additionalProperties:!1}}},r.CreateRelationshipChangeRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/CreateRelationshipChangeRequest",definitions:{CreateRelationshipChangeRequest:{type:"object",properties:{id:{type:"string"},content:{}},required:["id"],additionalProperties:!1}}},r.GetRelationshipRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetRelationshipRequest",definitions:{GetRelationshipRequest:{type:"object",properties:{id:{type:"string"}},required:["id"],additionalProperties:!1}}},r.GetRelationshipByAddressRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetRelationshipByAddressRequest",definitions:{GetRelationshipByAddressRequest:{type:"object",properties:{address:{type:"string"}},required:["address"],additionalProperties:!1}}},r.GetRelationshipsRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetRelationshipsRequest",definitions:{GetRelationshipsRequest:{type:"object",properties:{query:{}},additionalProperties:!1}}},r.RejectRelationshipChangeRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/RejectRelationshipChangeRequest",definitions:{RejectRelationshipChangeRequest:{type:"object",properties:{relationshipId:{type:"string"},changeId:{type:"string"},content:{}},required:["relationshipId","changeId","content"],additionalProperties:!1}}},r.RevokeRelationshipChangeRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/RevokeRelationshipChangeRequest",definitions:{RevokeRelationshipChangeRequest:{type:"object",properties:{relationshipId:{type:"string"},changeId:{type:"string"},content:{}},required:["relationshipId","changeId","content"],additionalProperties:!1}}},r.CreateOwnRelationshipTemplateRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/CreateOwnRelationshipTemplateRequest",definitions:{CreateOwnRelationshipTemplateRequest:{type:"object",properties:{expiresAt:{type:"string"},content:{},maxNumberOfRelationships:{type:"number"}},required:["expiresAt","content"],additionalProperties:!1}}},r.CreateTokenForOwnTemplateRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/CreateTokenForOwnTemplateRequest",definitions:{CreateTokenForOwnTemplateRequest:{type:"object",properties:{templateId:{type:"string"},expiresAt:{type:"string"},ephemeral:{type:"boolean"}},required:["templateId"],additionalProperties:!1}}},r.CreateTokenQrCodeForOwnTemplateRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/CreateTokenQrCodeForOwnTemplateRequest",definitions:{CreateTokenQrCodeForOwnTemplateRequest:{type:"object",properties:{templateId:{type:"string"},expiresAt:{type:"string"}},required:["templateId"],additionalProperties:!1}}},r.GetRelationshipTemplateRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetRelationshipTemplateRequest",definitions:{GetRelationshipTemplateRequest:{type:"object",properties:{id:{type:"string"}},required:["id"],additionalProperties:!1}}},r.GetRelationshipTemplatesRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetRelationshipTemplatesRequest",definitions:{GetRelationshipTemplatesRequest:{type:"object",properties:{query:{},ownerRestriction:{$ref:"#/definitions/OwnerRestriction"}},additionalProperties:!1},OwnerRestriction:{type:"string",enum:["o","p"]}}},r.LoadPeerRelationshipTemplateRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/LoadPeerRelationshipTemplateRequest",definitions:{LoadPeerRelationshipTemplateRequest:{type:"object",properties:{id:{type:"string"},secretKey:{type:"string"},reference:{type:"string"}},additionalProperties:!1}}},r.CreateOwnTokenRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/CreateOwnTokenRequest",definitions:{CreateOwnTokenRequest:{type:"object",properties:{content:{},expiresAt:{type:"string"},ephemeral:{type:"boolean"}},required:["content","expiresAt","ephemeral"],additionalProperties:!1}}},r.GetQRCodeForTokenRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetQRCodeForTokenRequest",definitions:{GetQRCodeForTokenRequest:{type:"object",properties:{id:{type:"string"}},required:["id"],additionalProperties:!1}}},r.GetTokenRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetTokenRequest",definitions:{GetTokenRequest:{type:"object",properties:{id:{type:"string"}},required:["id"],additionalProperties:!1}}},r.GetTokensRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetTokensRequest",definitions:{GetTokensRequest:{type:"object",properties:{query:{},ownerRestriction:{$ref:"#/definitions/OwnerRestriction"}},additionalProperties:!1},OwnerRestriction:{type:"string",enum:["o","p"]}}},r.LoadPeerTokenRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/LoadPeerTokenRequest",definitions:{LoadPeerTokenRequest:{type:"object",properties:{id:{type:"string"},secretKey:{type:"string"},reference:{type:"string"},ephemeral:{type:"boolean"}},required:["ephemeral"],additionalProperties:!1}}}},45420:function(t,r,a){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:!0}),r.UseCase=void 0;const o=a(90194),l=a(75172),c=a(19663),u=i(a(64530)),d=a(48728),p=a(6595);r.UseCase=class UseCase{constructor(t){this.requestValidator=t}async execute(t){if(this.requestValidator){const r=await this.requestValidator.validate(t);if(r.isInvalid())return this.validationFailed(r)}try{return await this.executeInternal(t)}catch(t){return this.failingResultFromUnknownError(t)}}failingResultFromUnknownError(t){return t instanceof Error?t instanceof c.RequestError?this.handleRequestError(t):t instanceof o.ServalError?this.handleServalError(t):t instanceof l.ApplicationError?l.Result.fail(t):l.Result.fail(p.RuntimeErrors.general.unknown(`An error was thrown in a UseCase: ${t.message}`,t)):l.Result.fail(p.RuntimeErrors.general.unknown(`An unknown object was thrown in a UseCase: ${(0,u.default)(t)}`,t))}handleServalError(t){let r;return r=t instanceof o.ParsingError||t instanceof o.ValidationError?p.RuntimeErrors.serval.requestDeserialization(t.message):t.message.match(/Type '.+' was not found within reflection classes. You might have to install a module first./)?p.RuntimeErrors.serval.unknownType(t.message):p.RuntimeErrors.serval.general(t.message),r.stack=t.stack,l.Result.fail(r)}handleRequestError(t){return d.PlatformErrorCodes.isNotFoundError(t)?l.Result.fail(p.RuntimeErrors.general.recordNotFoundWithMessage(t.reason)):d.PlatformErrorCodes.isValidationError(t)||d.PlatformErrorCodes.isUnexpectedError(t)?l.Result.fail(new l.ApplicationError(t.code,t.message)):l.Result.fail(t)}validationFailed(t){var r,a,i;const o=t.getFailures()[0],c=null!==(r=o.code)&&void 0!==r?r:p.RuntimeErrors.general.invalidPropertyValue().code,u=null!==(i=null===(a=o.message)||void 0===a?void 0:a.replace(/\$propertyName/g,o.propertyName))&&void 0!==i?i:p.RuntimeErrors.general.invalidPropertyValue(o.propertyName).message;return l.Result.fail(new l.ApplicationError(c,u))}}},7049:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(56819),r),o(a(73832),r),o(a(6595),r),o(a(71683),r),o(a(32746),r),o(a(45420),r),o(a(20263),r),o(a(43492),r),o(a(43519),r),o(a(96665),r),o(a(53800),r)},20263:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.AddressValidator=void 0;const i=a(63586);class AddressValidator extends i.AbstractValidator{constructor(t){super();let r=this.validateIfString((t=>t));t||(r=r.isNotNull()),r=r.hasLengthBetween(35,36),t&&r.whenNotNull()}static required(){return new AddressValidator(!1)}static optional(){return new AddressValidator(!0)}}r.AddressValidator=AddressValidator},43492:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.DateValidator=void 0;const i=a(63586),o=a(99490);class DateValidator extends i.AbstractValidator{constructor(t){super();let r=this.validateIfString((t=>t));t||(r=r.isNotNull()),r=r.fulfills((t=>o.DateTime.fromISO(t).isValid)),t&&r.whenNotNull()}static required(){return new DateValidator(!1)}static optional(){return new DateValidator(!0)}}r.DateValidator=DateValidator},43519:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.IdValidator=void 0;const i=a(63586);class IdValidator extends i.AbstractValidator{constructor(t,r){super();let a=this.validateIfString((t=>t));t||(a=a.isNotNull()),a=a.fulfills((t=>r.validate(t))),t&&a.whenNotNull()}static required(t){return new IdValidator(!1,t)}static optional(t){return new IdValidator(!0,t)}}r.IdValidator=IdValidator},96665:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.RelationshipAttributeDTOValidator=void 0;const i=a(3850),o=a(63586);class RelationshipAttributeDTOValidator extends o.AbstractValidator{constructor(){super(),this.validateIfString((t=>t.sharedItem)).fulfills((t=>i.ConsumptionIds.sharedItem.validate(t)))}static required(){return new RelationshipAttributeDTOValidator}}r.RelationshipAttributeDTOValidator=RelationshipAttributeDTOValidator},53800:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.SchemaValidator=void 0;const i=a(63586);r.SchemaValidator=class SchemaValidator{constructor(t){this.schema=t}validate(t){const r=this.schema.validate(t);return this.convertValidationResult(r)}convertValidationResult(t){const r=new i.ValidationResult;return t.isValid||r.addFailures(t.errors.map(this.schemaErrorToValidationFailure)),r}schemaErrorToValidationFailure(t){const r=`${t.instancePath} ${t.message}`.replace(/^\//,"").replace(/"/g,"").trim();return new i.ValidationFailure(void 0,t.instancePath,void 0,void 0,r)}}},41192:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.AttributeMapper=void 0;class AttributeMapper{static toAttributeDTO(t){return{id:t.id.toString(),content:t.content.toJSON(),createdAt:t.createdAt.toString()}}static toAttributeDTOList(t){return t.map((t=>this.toAttributeDTO(t)))}static toGetAttributesByNamesResponse(t){const r={};for(const a in t)r[a]=AttributeMapper.toAttributeDTO(t[a]);return r}}r.AttributeMapper=AttributeMapper},17716:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CreateAttributeUseCase=void 0;const c=a(75172),u=a(3850),d=a(19663),p=a(7071),h=a(7049),m=a(41192);class CreateAttributeRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIf((t=>t.attribute)).isDefined(),this.validateIfString((t=>t.attribute.name)).isNotEmpty()}}let y=class CreateAttributeUseCase extends h.UseCase{constructor(t,r,a){super(a),this.attributeController=t,this.accountController=r}async executeInternal(t){const r=await u.ConsumptionAttribute.fromAttribute(t.attribute),a=await this.attributeController.createAttribute(r);return await this.accountController.syncDatawallet(),c.Result.ok(m.AttributeMapper.toAttributeDTO(a))}};y=i([l(0,p.Inject),l(1,p.Inject),l(2,p.Inject),o("design:paramtypes",[u.ConsumptionAttributesController,d.AccountController,CreateAttributeRequestValidator])],y),r.CreateAttributeUseCase=y},24946:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DeleteAttributeUseCase=void 0;const c=a(75172),u=a(3850),d=a(19663),p=a(7071),h=a(7049);class DeleteAttributeRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.id)).fulfills(h.IdValidator.required(u.ConsumptionIds.attribute))}}let m=class DeleteAttributeUseCase extends h.UseCase{constructor(t,r,a){super(a),this.attributeController=t,this.accountController=r}async executeInternal(t){const r=await this.attributeController.getAttribute(d.CoreId.from(t.id));return r?(await this.attributeController.deleteAttribute(r),await this.accountController.syncDatawallet(),c.Result.ok(void 0)):c.Result.fail(h.RuntimeErrors.general.recordNotFound(u.ConsumptionAttribute))}};m=i([l(0,p.Inject),l(1,p.Inject),l(2,p.Inject),o("design:paramtypes",[u.ConsumptionAttributesController,d.AccountController,DeleteAttributeRequestValidator])],m),r.DeleteAttributeUseCase=m},14856:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DeleteAttributeByNameUseCase=void 0;const c=a(75172),u=a(3850),d=a(19663),p=a(7071),h=a(7049);class DeleteAttributeByNameRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.name)).isDefined()}}let m=class DeleteAttributeByNameUseCase extends h.UseCase{constructor(t,r,a){super(a),this.attributeController=t,this.accountController=r}async executeInternal(t){const r=await this.attributeController.getAttributeByName(t.name);return r?(await this.attributeController.deleteAttribute(r),await this.accountController.syncDatawallet(),c.Result.ok(void 0)):c.Result.fail(h.RuntimeErrors.general.recordNotFound(u.ConsumptionAttribute))}};m=i([l(0,p.Inject),l(1,p.Inject),l(2,p.Inject),o("design:paramtypes",[u.ConsumptionAttributesController,d.AccountController,DeleteAttributeByNameRequestValidator])],m),r.DeleteAttributeByNameUseCase=m},14746:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetAllValidUseCase=void 0;const c=a(75172),u=a(3850),d=a(7071),p=a(7049),h=a(41192);let m=class GetAllValidUseCase extends p.UseCase{constructor(t){super(),this.attributeController=t}async executeInternal(){const t=await this.attributeController.getValidAttributes();return c.Result.ok(h.AttributeMapper.toAttributeDTOList(t))}};m=i([l(0,d.Inject),o("design:paramtypes",[u.ConsumptionAttributesController])],m),r.GetAllValidUseCase=m},73421:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetAttributeUseCase=void 0;const c=a(75172),u=a(3850),d=a(25030),p=a(19663),h=a(7071),m=a(7049),y=a(41192);class GetAttributeRequestValidator extends m.RuntimeValidator{constructor(){super(),this.validateIf((t=>t.id)).fulfills(m.IdValidator.required(u.ConsumptionIds.attribute))}}let g=class GetAttributeUseCase extends m.UseCase{constructor(t,r){super(r),this.attributeController=t}async executeInternal(t){const r=await this.attributeController.getAttribute(p.CoreId.from(t.id));return r?c.Result.ok(y.AttributeMapper.toAttributeDTO(r)):c.Result.fail(m.RuntimeErrors.general.recordNotFound(d.Attribute))}};g=i([l(0,h.Inject),l(1,h.Inject),o("design:paramtypes",[u.ConsumptionAttributesController,GetAttributeRequestValidator])],g),r.GetAttributeUseCase=g},5519:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetAttributeByNameUseCase=void 0;const c=a(75172),u=a(3850),d=a(25030),p=a(7071),h=a(7049),m=a(41192);class GetAttributeByNameRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.name)).isNotEmpty()}}let y=class GetAttributeByNameUseCase extends h.UseCase{constructor(t,r){super(r),this.attributeController=t}async executeInternal(t){const r=await this.attributeController.getAttributeByName(t.name);return r?c.Result.ok(m.AttributeMapper.toAttributeDTO(r)):c.Result.fail(h.RuntimeErrors.general.recordNotFound(d.Attribute))}};y=i([l(0,p.Inject),l(1,p.Inject),o("design:paramtypes",[u.ConsumptionAttributesController,GetAttributeByNameRequestValidator])],y),r.GetAttributeByNameUseCase=y},99536:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetAttributesUseCase=void 0;const c=a(75172),u=a(3850),d=a(7071),p=a(7049),h=a(41192);class GetAttributesRequestValidator extends p.RuntimeValidator{constructor(){super()}}let m=class GetAttributesUseCase extends p.UseCase{constructor(t,r){super(r),this.attributeController=t}async executeInternal(t){const r=await this.attributeController.getAttributes();return c.Result.ok(h.AttributeMapper.toAttributeDTOList(r))}};m=i([l(0,d.Inject),l(1,d.Inject),o("design:paramtypes",[u.ConsumptionAttributesController,GetAttributesRequestValidator])],m),r.GetAttributesUseCase=m},18796:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetAttributesByNamesUseCase=void 0;const c=a(75172),u=a(3850),d=a(7071),p=a(7049),h=a(41192);class GetAttributesByNamesRequestValidator extends p.RuntimeValidator{constructor(){super()}}let m=class GetAttributesByNamesUseCase extends p.UseCase{constructor(t,r){super(r),this.attributeController=t}async executeInternal(t){const r=await this.attributeController.getAttributesByName();return c.Result.ok(h.AttributeMapper.toGetAttributesByNamesResponse(r))}};m=i([l(0,d.Inject),l(1,d.Inject),o("design:paramtypes",[u.ConsumptionAttributesController,GetAttributesByNamesRequestValidator])],m),r.GetAttributesByNamesUseCase=m},16932:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetHistoryByNameUseCase=void 0;const c=a(75172),u=a(3850),d=a(25030),p=a(7071),h=a(7049),m=a(41192);class GetHistoryByNameRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.name)).isDefined()}}let y=class GetHistoryByNameUseCase extends h.UseCase{constructor(t,r){super(r),this.attributeController=t}async executeInternal(t){const r=await this.attributeController.getAttributeHistoryByName(t.name);return 0===r.length?c.Result.fail(h.RuntimeErrors.general.recordNotFound(d.Attribute)):c.Result.ok(m.AttributeMapper.toAttributeDTOList(r))}};y=i([l(0,p.Inject),l(1,p.Inject),o("design:paramtypes",[u.ConsumptionAttributesController,GetHistoryByNameRequestValidator])],y),r.GetHistoryByNameUseCase=y},4415:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.SucceedAttributeUseCase=void 0;const c=a(75172),u=a(3850),d=a(19663),p=a(7071),h=a(7049),m=a(41192);class SucceedAttributeRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIf((t=>t.validFrom)).fulfills(h.DateValidator.optional()),this.validateIf((t=>t.attribute)).isDefined(),this.validateIf((t=>t.attribute.name)).isNotEmpty()}}let y=class SucceedAttributeUseCase extends h.UseCase{constructor(t,r,a){super(a),this.attributeController=t,this.accountController=r}async executeInternal(t){const r=await u.ConsumptionAttribute.fromAttribute(t.attribute),a=await this.attributeController.succeedAttribute(r,t.validFrom?d.CoreDate.from(t.validFrom):void 0);return await this.accountController.syncDatawallet(),c.Result.ok(m.AttributeMapper.toAttributeDTO(a))}};y=i([l(0,p.Inject),l(1,p.Inject),l(2,p.Inject),o("design:paramtypes",[u.ConsumptionAttributesController,d.AccountController,SucceedAttributeRequestValidator])],y),r.SucceedAttributeUseCase=y},9660:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.UpdateAttributeUseCase=void 0;const c=a(75172),u=a(3850),d=a(25030),p=a(19663),h=a(7071),m=a(7049),y=a(41192);class UpdateAttributeRequestValidator extends m.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.id)).fulfills(m.IdValidator.required(u.ConsumptionIds.attribute)),this.validateIf((t=>t.attribute)).isDefined(),this.validateIf((t=>t.attribute.name)).isNotEmpty()}}let g=class UpdateAttributeUseCase extends m.UseCase{constructor(t,r,a){super(a),this.attributeController=t,this.accountController=r}async executeInternal(t){const r=await this.attributeController.getAttribute(p.CoreId.from(t.id));if(!r)return c.Result.fail(m.RuntimeErrors.general.recordNotFound(u.ConsumptionAttribute));r.content=d.Attribute.from(t.attribute);const a=await this.attributeController.updateAttribute(r);return await this.accountController.syncDatawallet(),c.Result.ok(y.AttributeMapper.toAttributeDTO(a))}};g=i([l(0,h.Inject),l(1,h.Inject),l(2,h.Inject),o("design:paramtypes",[u.ConsumptionAttributesController,p.AccountController,UpdateAttributeRequestValidator])],g),r.UpdateAttributeUseCase=g},20099:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(41192),r),o(a(17716),r),o(a(24946),r),o(a(14856),r),o(a(14746),r),o(a(73421),r),o(a(5519),r),o(a(99536),r),o(a(18796),r),o(a(16932),r),o(a(4415),r),o(a(9660),r)},37372:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CreateDraftUseCase=void 0;const c=a(75172),u=a(3850),d=a(19663),p=a(7071),h=a(7049),m=a(50660);class CreateDraftRequestValidator extends h.RuntimeValidator{constructor(){super()}}let y=class CreateDraftUseCase extends h.UseCase{constructor(t,r,a){super(a),this.draftController=t,this.accountController=r}async executeInternal(t){const r=await this.draftController.createDraft(t.content,t.type);return await this.accountController.syncDatawallet(),c.Result.ok(m.DraftMapper.toDraftDTO(r))}};y=i([l(0,p.Inject),l(1,p.Inject),l(2,p.Inject),o("design:paramtypes",[u.DraftsController,d.AccountController,CreateDraftRequestValidator])],y),r.CreateDraftUseCase=y},69696:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DeleteDraftUseCase=void 0;const c=a(75172),u=a(3850),d=a(19663),p=a(7071),h=a(7049);class DeleteDraftRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfAny((t=>t.id)).fulfills(h.IdValidator.required(u.ConsumptionIds.draft))}}let m=class DeleteDraftUseCase extends h.UseCase{constructor(t,r,a){super(a),this.draftController=t,this.accountController=r}async executeInternal(t){const r=await this.draftController.getDraft(d.CoreId.from(t.id));return r?(await this.draftController.deleteDraft(r),await this.accountController.syncDatawallet(),c.Result.ok(void 0)):c.Result.fail(h.RuntimeErrors.general.recordNotFound(u.Draft))}};m=i([l(0,p.Inject),l(1,p.Inject),l(2,p.Inject),o("design:paramtypes",[u.DraftsController,d.AccountController,DeleteDraftRequestValidator])],m),r.DeleteDraftUseCase=m},50660:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.DraftMapper=void 0;r.DraftMapper=class DraftMapper{static toDraftDTO(t){return{id:t.id.toString(),type:t.type,createdAt:t.createdAt.toString(),lastModifiedAt:t.lastModifiedAt.toISOString(),content:t.content.toJSON()}}static toDraftDTOList(t){return t.map((t=>this.toDraftDTO(t)))}}},23165:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetDraftUseCase=void 0;const c=a(75172),u=a(3850),d=a(19663),p=a(7071),h=a(7049),m=a(50660);class GetDraftRequestValidator extends h.RuntimeValidator{constructor(){super()}}let y=class GetDraftUseCase extends h.UseCase{constructor(t,r){super(r),this.draftController=t}async executeInternal(t){const r=await this.draftController.getDraft(d.CoreId.from(t.id));return r?c.Result.ok(m.DraftMapper.toDraftDTO(r)):c.Result.fail(h.RuntimeErrors.general.recordNotFound(u.Draft))}};y=i([l(0,p.Inject),l(1,p.Inject),o("design:paramtypes",[u.DraftsController,GetDraftRequestValidator])],y),r.GetDraftUseCase=y},46863:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetDraftsUseCase=void 0;const c=a(92937),u=a(75172),d=a(3850),p=a(94714),h=a(7071),m=a(7049),y=a(50660);let g=class GetDraftsUseCase extends m.UseCase{constructor(t,r){super(r),this.draftController=t}async executeInternal(t){const r=GetDraftsUseCase.queryTranslator.parse(t.query),a=await this.draftController.getDrafts(r);return u.Result.ok(y.DraftMapper.toDraftDTOList(a))}};g.queryTranslator=new c.QueryTranslator({whitelist:{[(0,p.nameof)((t=>t.type))]:!0,[(0,p.nameof)((t=>t.createdAt))]:!0,[(0,p.nameof)((t=>t.lastModifiedAt))]:!0}}),g=i([l(0,h.Inject),l(1,h.Inject),o("design:paramtypes",[d.DraftsController,m.RuntimeValidator])],g),r.GetDraftsUseCase=g},65760:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.UpdateDraftUseCase=void 0;const c=a(90194),u=a(75172),d=a(3850),p=a(19663),h=a(7071),m=a(7049),y=a(50660);class UpdateDraftRequestValidator extends m.RuntimeValidator{constructor(){super()}}let g=class UpdateDraftUseCase extends m.UseCase{constructor(t,r,a){super(a),this.draftController=t,this.accountController=r}async executeInternal(t){const r=await this.draftController.getDraft(p.CoreId.from(t.id));return r?(r.content=await c.SerializableAsync.fromUnknown(t.content),await this.draftController.updateDraft(r),await this.accountController.syncDatawallet(),u.Result.ok(y.DraftMapper.toDraftDTO(r))):u.Result.fail(m.RuntimeErrors.general.recordNotFound(d.Draft))}};g=i([l(0,h.Inject),l(1,h.Inject),l(2,h.Inject),o("design:paramtypes",[d.DraftsController,p.AccountController,UpdateDraftRequestValidator])],g),r.UpdateDraftUseCase=g},75966:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(37372),r),o(a(69696),r),o(a(50660),r),o(a(23165),r),o(a(46863),r),o(a(65760),r)},23742:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(20099),r),o(a(75966),r),o(a(94938),r),o(a(21394),r),o(a(90710),r)},71979:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CreateRelationshipInfoUseCase=void 0;const c=a(75172),u=a(3850),d=a(19663),p=a(7071),h=a(7049),m=a(45420),y=a(56618);class CreateRelationshipInfoRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfAny((t=>t.relationshipId)).fulfills(h.IdValidator.required(d.BackboneIds.relationship)),this.validateIfEach((t=>t.attributes)).fulfills(h.RelationshipAttributeDTOValidator.required())}}let g=class CreateRelationshipInfoUseCase extends m.UseCase{constructor(t,r,a){super(a),this.relationshipInfoController=t,this.accountController=r}async executeInternal(t){const r=d.CoreId.from(t.relationshipId);if(void 0!==await this.relationshipInfoController.getRelationshipInfoByRelationship(r))return c.Result.fail(h.RuntimeErrors.relationshipInfo.relationshipInfoExists(r.toString()));const a=await Promise.all(t.attributes.map((t=>u.RelationshipAttribute.from({name:t.name,content:t.content,sharedItem:d.CoreId.from(t.sharedItem)})))),i=void 0===t.theme?void 0:await u.RelationshipTheme.from(t.theme),o=await u.RelationshipInfo.from({id:await u.ConsumptionIds.relationshipInfo.generate(),relationshipId:r,attributes:a,isPinned:t.isPinned,title:t.title,description:t.description,userTitle:t.userTitle,userDescription:t.userDescription,theme:i});return await this.relationshipInfoController.createRelationshipInfo(o),await this.accountController.syncDatawallet(),c.Result.ok(y.RelationshipInfoMapper.toRelationshipInfoDTO(o))}};g=i([l(0,p.Inject),l(1,p.Inject),l(2,p.Inject),o("design:paramtypes",[u.RelationshipInfoController,d.AccountController,CreateRelationshipInfoRequestValidator])],g),r.CreateRelationshipInfoUseCase=g},11788:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DeleteRelationshipInfoUseCase=void 0;const c=a(75172),u=a(3850),d=a(19663),p=a(7071),h=a(7049),m=a(6595),y=a(45420);class DeleteRelationshipInfoRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfAny((t=>t.id)).fulfills(h.IdValidator.required(u.ConsumptionIds.relationshipInfo))}}let g=class DeleteRelationshipInfoUseCase extends y.UseCase{constructor(t,r,a){super(a),this.relationshipInfoController=t,this.accountController=r}async executeInternal(t){const r=await this.relationshipInfoController.getRelationshipInfo(d.CoreId.from(t.id));return r?(await this.relationshipInfoController.deleteRelationshipInfo(r),await this.accountController.syncDatawallet(),c.Result.ok(void 0)):c.Result.fail(m.RuntimeErrors.general.recordNotFound(u.RelationshipInfo))}};g=i([l(0,p.Inject),l(1,p.Inject),l(2,p.Inject),o("design:paramtypes",[u.RelationshipInfoController,d.AccountController,DeleteRelationshipInfoRequestValidator])],g),r.DeleteRelationshipInfoUseCase=g},42212:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DeleteRelationshipInfoByRelationshipUseCase=void 0;const c=a(75172),u=a(3850),d=a(19663),p=a(7071),h=a(7049),m=a(6595),y=a(45420);class DeleteRelationshipInfoByRelationshipRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfAny((t=>t.relationshipId)).fulfills(h.IdValidator.required(d.BackboneIds.relationship))}}let g=class DeleteRelationshipInfoByRelationshipUseCase extends y.UseCase{constructor(t,r,a){super(a),this.relationshipInfoController=t,this.accountController=r}async executeInternal(t){const r=await this.relationshipInfoController.getRelationshipInfoByRelationship(d.CoreId.from(t.relationshipId));return r?(await this.relationshipInfoController.deleteRelationshipInfo(r),await this.accountController.syncDatawallet(),c.Result.ok(void 0)):c.Result.fail(m.RuntimeErrors.general.recordNotFound(u.RelationshipInfo))}};g=i([l(0,p.Inject),l(1,p.Inject),l(2,p.Inject),o("design:paramtypes",[u.RelationshipInfoController,d.AccountController,DeleteRelationshipInfoByRelationshipRequestValidator])],g),r.DeleteRelationshipInfoByRelationshipUseCase=g},25116:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetRelationshipInfoUseCase=void 0;const c=a(75172),u=a(3850),d=a(19663),p=a(63586),h=a(7071),m=a(7049),y=a(6595),g=a(45420),v=a(56618);class GetRelationshipInfoRequestValidator extends p.AbstractValidator{constructor(){super(),this.validateIfAny((t=>t.id)).fulfills(m.IdValidator.required(u.ConsumptionIds.relationshipInfo))}}let b=class GetRelationshipInfoUseCase extends g.UseCase{constructor(t,r){super(r),this.relationshipInfoController=t}async executeInternal(t){const r=await this.relationshipInfoController.getRelationshipInfo(d.CoreId.from(t.id));return r?c.Result.ok(v.RelationshipInfoMapper.toRelationshipInfoDTO(r)):c.Result.fail(y.RuntimeErrors.general.recordNotFound(u.RelationshipInfo))}};b=i([l(0,h.Inject),l(1,h.Inject),o("design:paramtypes",[u.RelationshipInfoController,GetRelationshipInfoRequestValidator])],b),r.GetRelationshipInfoUseCase=b},27170:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetRelationshipInfoByRelationshipUseCase=void 0;const c=a(75172),u=a(3850),d=a(19663),p=a(7071),h=a(7049),m=a(6595),y=a(45420),g=a(56618);class GetRelationshipInfoRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfAny((t=>t.relationshipId)).fulfills(h.IdValidator.required(d.BackboneIds.relationship))}}let v=class GetRelationshipInfoByRelationshipUseCase extends y.UseCase{constructor(t,r){super(r),this.relationshipInfoController=t}async executeInternal(t){const r=await this.relationshipInfoController.getRelationshipInfoByRelationship(d.CoreId.from(t.relationshipId));return r?c.Result.ok(g.RelationshipInfoMapper.toRelationshipInfoDTO(r)):c.Result.fail(m.RuntimeErrors.general.recordNotFound(u.RelationshipInfo))}};v=i([l(0,p.Inject),l(1,p.Inject),o("design:paramtypes",[u.RelationshipInfoController,GetRelationshipInfoRequestValidator])],v),r.GetRelationshipInfoByRelationshipUseCase=v},16616:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.RelationshipAttributeMapper=void 0;r.RelationshipAttributeMapper=class RelationshipAttributeMapper{static toRelationshipAttributeDTO(t){return{name:t.name,content:t.content.toJSON(),sharedItem:t.sharedItem.toString()}}static toRelationshipAttributeDTOList(t){return t.map((t=>this.toRelationshipAttributeDTO(t)))}}},56618:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.RelationshipInfoMapper=void 0;const i=a(16616),o=a(51711);r.RelationshipInfoMapper=class RelationshipInfoMapper{static toRelationshipInfoDTO(t){return{id:t.id.toString(),relationshipId:t.relationshipId.toString(),attributes:i.RelationshipAttributeMapper.toRelationshipAttributeDTOList(t.attributes),isPinned:t.isPinned,title:t.title,description:t.description,userTitle:t.userTitle,userDescription:t.userDescription,theme:t.theme?o.RelationshipThemeMapper.toRelationshipThemeDTO(t.theme):void 0}}static toRelationshipInfoDTOList(t){return t.map((t=>this.toRelationshipInfoDTO(t)))}}},51711:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.RelationshipThemeMapper=void 0;r.RelationshipThemeMapper=class RelationshipThemeMapper{static toRelationshipThemeDTO(t){return{image:t.image,imageBar:t.imageBar,backgroundColor:t.backgroundColor,foregroundColor:t.foregroundColor}}static toRelationshipThemeDTOList(t){return t.map((t=>this.toRelationshipThemeDTO(t)))}}},75341:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.UpdateRelationshipInfoUseCase=void 0;const c=a(75172),u=a(3850),d=a(19663),p=a(7071),h=a(7049),m=a(6595),y=a(45420),g=a(56618);class UpdateRelationshipInfoRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfAny((t=>t.id)).fulfills(h.IdValidator.required(u.ConsumptionIds.relationshipInfo)),this.validateIfEachAny((t=>t.attributes)).fulfills(h.RelationshipAttributeDTOValidator.required())}}let v=class UpdateRelationshipInfoUseCase extends y.UseCase{constructor(t,r,a){super(a),this.relationshipInfoController=t,this.accountController=r}async executeInternal(t){const r=await this.relationshipInfoController.getRelationshipInfo(d.CoreId.from(t.id));return r?(void 0!==t.attributes&&(r.attributes=await Promise.all(t.attributes.map((t=>u.RelationshipAttribute.from({name:t.name,content:t.content,sharedItem:d.CoreId.from(t.sharedItem)}))))),r.isPinned=void 0===t.isPinned?r.isPinned:t.isPinned,r.title=void 0===t.title?r.title:t.title,r.description=void 0===t.description?r.description:t.description,r.userTitle=void 0===t.userTitle?r.userTitle:t.userTitle,r.userDescription=void 0===t.userDescription?r.userDescription:t.userDescription,r.theme=void 0===t.theme?r.theme:await u.RelationshipTheme.from(t.theme),await this.relationshipInfoController.updateRelationshipInfo(r),await this.accountController.syncDatawallet(),c.Result.ok(g.RelationshipInfoMapper.toRelationshipInfoDTO(r))):c.Result.fail(m.RuntimeErrors.general.recordNotFound(u.RelationshipInfo))}};v=i([l(0,p.Inject),l(1,p.Inject),l(2,p.Inject),o("design:paramtypes",[u.RelationshipInfoController,d.AccountController,UpdateRelationshipInfoRequestValidator])],v),r.UpdateRelationshipInfoUseCase=v},94938:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(71979),r),o(a(11788),r),o(a(42212),r),o(a(25116),r),o(a(27170),r),o(a(75341),r)},83951:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CreateSettingUseCase=void 0;const c=a(75172),u=a(3850),d=a(19663),p=a(7071),h=a(7049),m=a(96950);class CreateSettingRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.key)).isDefined(),this.validateIfAny((t=>t.value)).isDefined(),this.validateIfString((t=>t.reference)).fulfills(h.IdValidator.optional(d.TransportIds.generic)),this.validateIfString((t=>t.scope)).isIn([u.SettingScope.Device,u.SettingScope.Identity,u.SettingScope.Relationship]).whenDefined(),this.validateIfString((t=>t.succeedsAt)).fulfills(h.DateValidator.optional()),this.validateIfString((t=>t.succeedsItem)).fulfills(h.IdValidator.optional(u.ConsumptionIds.setting))}}let y=class CreateSettingUseCase extends h.UseCase{constructor(t,r,a){super(a),this.settingController=t,this.accountController=r}async executeInternal(t){const r=await this.settingController.createSetting({key:t.key,value:t.value,reference:t.reference?d.CoreId.from(t.reference):void 0,scope:t.scope,succeedsAt:t.succeedsAt?d.CoreDate.from(t.succeedsAt):void 0,succeedsItem:t.succeedsItem?d.CoreId.from(t.succeedsItem):void 0});return await this.accountController.syncDatawallet(),c.Result.ok(m.SettingMapper.toSettingDTO(r))}};y=i([l(0,p.Inject),l(1,p.Inject),l(2,p.Inject),o("design:paramtypes",[u.SettingsController,d.AccountController,CreateSettingRequestValidator])],y),r.CreateSettingUseCase=y},80678:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DeleteSettingUseCase=void 0;const c=a(75172),u=a(3850),d=a(19663),p=a(7071),h=a(60485),m=a(7049);class DeleteSettingRequestValidator extends m.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.id)).fulfills(m.IdValidator.required(u.ConsumptionIds.setting))}}let y=class DeleteSettingUseCase extends m.UseCase{constructor(t,r,a){super(a),this.settingController=t,this.accountController=r}async executeInternal(t){const r=await this.settingController.getSetting(d.CoreId.from(t.id));return r?(await this.settingController.deleteSetting(r),await this.accountController.syncDatawallet(),c.Result.ok(void 0)):c.Result.fail(h.RuntimeErrors.general.recordNotFound(u.Setting))}};y=i([l(0,p.Inject),l(1,p.Inject),l(2,p.Inject),o("design:paramtypes",[u.SettingsController,d.AccountController,DeleteSettingRequestValidator])],y),r.DeleteSettingUseCase=y},86798:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetSettingUseCase=void 0;const c=a(75172),u=a(3850),d=a(19663),p=a(7071),h=a(7049),m=a(96950);class GetSettingRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.id)).fulfills(h.IdValidator.required(u.ConsumptionIds.setting))}}let y=class GetSettingUseCase extends h.UseCase{constructor(t,r){super(r),this.settingController=t}async executeInternal(t){const r=await this.settingController.getSetting(d.CoreId.from(t.id));return r?c.Result.ok(m.SettingMapper.toSettingDTO(r)):c.Result.fail(h.RuntimeErrors.general.recordNotFound(u.Setting))}};y=i([l(0,p.Inject),l(1,p.Inject),o("design:paramtypes",[u.SettingsController,GetSettingRequestValidator])],y),r.GetSettingUseCase=y},26101:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetSettingsUseCase=void 0;const c=a(92937),u=a(75172),d=a(3850),p=a(94714),h=a(7071),m=a(7049),y=a(96950);let g=class GetSettingsUseCase extends m.UseCase{constructor(t,r){super(r),this.settingController=t}async executeInternal(t){const r=GetSettingsUseCase.queryTranslator.parse(t.query),a=await this.settingController.getSettings(r);return u.Result.ok(y.SettingMapper.toSettingDTOList(a))}};g.queryTranslator=new c.QueryTranslator({whitelist:{[(0,p.nameof)((t=>t.key))]:!0,[(0,p.nameof)((t=>t.scope))]:!0,[(0,p.nameof)((t=>t.reference))]:!0,[(0,p.nameof)((t=>t.createdAt))]:!0,[(0,p.nameof)((t=>t.deletedAt))]:!0,[(0,p.nameof)((t=>t.succeedsItem))]:!0,[(0,p.nameof)((t=>t.succeedsAt))]:!0}}),g=i([l(0,h.Inject),l(1,h.Inject),o("design:paramtypes",[d.SettingsController,m.RuntimeValidator])],g),r.GetSettingsUseCase=g},96950:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.SettingMapper=void 0;r.SettingMapper=class SettingMapper{static toSettingDTO(t){var r,a,i,o;return{id:t.id.toString(),key:t.key,scope:t.scope.toString(),reference:null===(r=t.reference)||void 0===r?void 0:r.toString(),value:t.value.toJSON(),createdAt:t.createdAt.toISOString(),deletedAt:null===(a=t.deletedAt)||void 0===a?void 0:a.toISOString(),succeedsItem:null===(i=t.succeedsItem)||void 0===i?void 0:i.toString(),succeedsAt:null===(o=t.succeedsAt)||void 0===o?void 0:o.toString()}}static toSettingDTOList(t){return t.map((t=>this.toSettingDTO(t)))}}},1853:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.UpdateSettingUseCase=void 0;const c=a(90194),u=a(75172),d=a(3850),p=a(19663),h=a(7071),m=a(60485),y=a(7049),g=a(96950);class UpdateSettingRequestValidator extends y.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.id)).fulfills(y.IdValidator.required(d.ConsumptionIds.setting)),this.validateIfAny((t=>t.value)).isDefined()}}let v=class UpdateSettingUseCase extends y.UseCase{constructor(t,r,a){super(a),this.settingController=t,this.accountController=r}async executeInternal(t){const r=await this.settingController.getSetting(p.CoreId.from(t.id));return r?(r.value=await c.SerializableAsync.from(t.value),await this.settingController.updateSetting(r),await this.accountController.syncDatawallet(),u.Result.ok(g.SettingMapper.toSettingDTO(r))):u.Result.fail(m.RuntimeErrors.general.recordNotFound(d.Setting))}};v=i([l(0,h.Inject),l(1,h.Inject),l(2,h.Inject),o("design:paramtypes",[d.SettingsController,p.AccountController,UpdateSettingRequestValidator])],v),r.UpdateSettingUseCase=v},21394:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(83951),r),o(a(80678),r),o(a(86798),r),o(a(26101),r),o(a(96950),r),o(a(1853),r)},45382:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CreateSharedItemUseCase=void 0;const c=a(75172),u=a(3850),d=a(19663),p=a(7071),h=a(7049),m=a(99443);class CreateSharedItemRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfEachString((t=>t.tags)).isDefined().whenDefined(),this.validateIfString((t=>t.sharedBy)).fulfills(h.AddressValidator.required()),this.validateIfString((t=>t.sharedWith)).fulfills(h.AddressValidator.required()),this.validateIfString((t=>t.sharedAt)).fulfills(h.DateValidator.required()),this.validateIfString((t=>t.reference)).fulfills(h.IdValidator.optional(d.TransportIds.generic)),this.validateIfString((t=>t.content)).isDefined(),this.validateIfString((t=>t.succeedsItem)).fulfills(h.IdValidator.optional(u.ConsumptionIds.sharedItem)),this.validateIfString((t=>t.succeedsAt)).fulfills(h.DateValidator.optional()),this.validateIfString((t=>t.expiresAt)).fulfills(h.DateValidator.optional())}}let y=class CreateSharedItemUseCase extends h.UseCase{constructor(t,r,a){super(a),this.sharedItemsController=t,this.accountController=r}async executeInternal(t){const r=await u.SharedItem.from({id:await u.ConsumptionIds.sharedItem.generate(),tags:t.tags,sharedBy:d.CoreAddress.from(t.sharedBy),sharedWith:d.CoreAddress.from(t.sharedWith),sharedAt:d.CoreDate.from(t.sharedAt),reference:t.reference?d.CoreId.from(t.reference):void 0,content:t.content,succeedsItem:t.succeedsItem?d.CoreId.from(t.succeedsItem):void 0,succeedsAt:t.succeedsAt?d.CoreDate.from(t.succeedsAt):void 0,expiresAt:t.expiresAt?d.CoreDate.from(t.expiresAt):void 0});return await this.sharedItemsController.createSharedItem(r),await this.accountController.syncDatawallet(),c.Result.ok(m.SharedItemsMapper.toSharedItemDTO(r))}};y=i([l(0,p.Inject),l(1,p.Inject),l(2,p.Inject),o("design:paramtypes",[u.SharedItemsController,d.AccountController,CreateSharedItemRequestValidator])],y),r.CreateSharedItemUseCase=y},71872:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DeleteSharedItemUseCase=void 0;const c=a(75172),u=a(3850),d=a(19663),p=a(7071),h=a(60485),m=a(7049);class DeleteSharedItemRequestValidator extends m.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.id)).fulfills(m.IdValidator.required(u.ConsumptionIds.sharedItem))}}let y=class DeleteSharedItemUseCase extends m.UseCase{constructor(t,r,a){super(a),this.sharedItemsController=t,this.accountController=r}async executeInternal(t){const r=await this.sharedItemsController.getSharedItem(d.CoreId.from(t.id));return r?(await this.sharedItemsController.deleteSharedItem(r),await this.accountController.syncDatawallet(),c.Result.ok(void 0)):c.Result.fail(h.RuntimeErrors.general.recordNotFound(u.SharedItem))}};y=i([l(0,p.Inject),l(1,p.Inject),l(2,p.Inject),o("design:paramtypes",[u.SharedItemsController,d.AccountController,DeleteSharedItemRequestValidator])],y),r.DeleteSharedItemUseCase=y},26081:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetSharedItemUseCase=void 0;const c=a(75172),u=a(3850),d=a(19663),p=a(7071),h=a(7049),m=a(99443);class GetSharedItemRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.id)).fulfills(h.IdValidator.required(u.ConsumptionIds.sharedItem))}}let y=class GetSharedItemUseCase extends h.UseCase{constructor(t,r){super(r),this.sharedItemsController=t}async executeInternal(t){const r=await this.sharedItemsController.getSharedItem(d.CoreId.from(t.id));return r?c.Result.ok(m.SharedItemsMapper.toSharedItemDTO(r)):c.Result.fail(h.RuntimeErrors.general.recordNotFound(u.SharedItem))}};y=i([l(0,p.Inject),l(1,p.Inject),o("design:paramtypes",[u.SharedItemsController,GetSharedItemRequestValidator])],y),r.GetSharedItemUseCase=y},98796:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetSharedItemsUseCase=void 0;const c=a(92937),u=a(75172),d=a(3850),p=a(94714),h=a(7071),m=a(7049),y=a(99443);let g=class GetSharedItemsUseCase extends m.UseCase{constructor(t,r){super(r),this.sharedItemsController=t}async executeInternal(t){const r=GetSharedItemsUseCase.queryTranslator.parse(t.query),a=await this.sharedItemsController.getSharedItems(r);return u.Result.ok(y.SharedItemsMapper.toSharedItemDTOList(a))}};g.queryTranslator=new c.QueryTranslator({whitelist:{[(0,p.nameof)((t=>t.tags))]:!0,[(0,p.nameof)((t=>t.sharedBy))]:!0,[(0,p.nameof)((t=>t.sharedWith))]:!0,[(0,p.nameof)((t=>t.sharedAt))]:!0,[(0,p.nameof)((t=>t.reference))]:!0,[(0,p.nameof)((t=>t.succeedsItem))]:!0,[(0,p.nameof)((t=>t.succeedsAt))]:!0,[(0,p.nameof)((t=>t.expiresAt))]:!0},custom:{tags:(t,r)=>{t.tags={$contains:r}}}}),g=i([l(0,h.Inject),l(1,h.Inject),o("design:paramtypes",[d.SharedItemsController,m.RuntimeValidator])],g),r.GetSharedItemsUseCase=g},4408:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetSharedItemsByAddressUseCase=void 0;const c=a(75172),u=a(3850),d=a(94714),p=a(7071),h=a(7049),m=a(99443);class GetSharedItemsByAddressRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.address)).fulfills(h.AddressValidator.required())}}let y=class GetSharedItemsByAddressUseCase extends h.UseCase{constructor(t,r){super(r),this.sharedItemsController=t}async executeInternal(t){const r=await this.sharedItemsController.getSharedItems({$or:[{[(0,d.nameof)((t=>t.sharedBy))]:t.address},{[(0,d.nameof)((t=>t.sharedWith))]:t.address}]});return c.Result.ok(m.SharedItemsMapper.toSharedItemDTOList(r))}};y=i([l(0,p.Inject),l(1,p.Inject),o("design:paramtypes",[u.SharedItemsController,GetSharedItemsByAddressRequestValidator])],y),r.GetSharedItemsByAddressUseCase=y},14042:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetSharedItemsByReferenceUseCase=void 0;const c=a(75172),u=a(3850),d=a(19663),p=a(94714),h=a(7071),m=a(7049),y=a(99443);class GetSharedItemsByReferenceRequestValidator extends m.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.reference)).fulfills(m.IdValidator.required(d.TransportIds.generic))}}let g=class GetSharedItemsByReferenceUseCase extends m.UseCase{constructor(t,r){super(r),this.sharedItemsController=t}async executeInternal(t){const r=await this.sharedItemsController.getSharedItems({[(0,p.nameof)((t=>t.reference))]:t.reference});return c.Result.ok(y.SharedItemsMapper.toSharedItemDTOList(r))}};g=i([l(0,h.Inject),l(1,h.Inject),o("design:paramtypes",[u.SharedItemsController,GetSharedItemsByReferenceRequestValidator])],g),r.GetSharedItemsByReferenceUseCase=g},55402:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetSharedItemsSharedByAddressUseCase=void 0;const c=a(75172),u=a(3850),d=a(94714),p=a(7071),h=a(7049),m=a(99443);class GetSharedItemsSharedByAddressRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.address)).fulfills(h.AddressValidator.required())}}let y=class GetSharedItemsSharedByAddressUseCase extends h.UseCase{constructor(t,r){super(r),this.sharedItemsController=t}async executeInternal(t){const r=await this.sharedItemsController.getSharedItems({[(0,d.nameof)((t=>t.sharedBy))]:t.address});return c.Result.ok(m.SharedItemsMapper.toSharedItemDTOList(r))}};y=i([l(0,p.Inject),l(1,p.Inject),o("design:paramtypes",[u.SharedItemsController,GetSharedItemsSharedByAddressRequestValidator])],y),r.GetSharedItemsSharedByAddressUseCase=y},6652:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetSharedItemsSharedWithAddressUseCase=void 0;const c=a(75172),u=a(3850),d=a(94714),p=a(7071),h=a(7049),m=a(99443);class GetSharedItemsSharedWithAddressRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.address)).fulfills(h.AddressValidator.required())}}let y=class GetSharedItemsSharedWithAddressUseCase extends h.UseCase{constructor(t,r){super(r),this.sharedItemsController=t}async executeInternal(t){const r=await this.sharedItemsController.getSharedItems({[(0,d.nameof)((t=>t.sharedWith))]:t.address});return c.Result.ok(m.SharedItemsMapper.toSharedItemDTOList(r))}};y=i([l(0,p.Inject),l(1,p.Inject),o("design:paramtypes",[u.SharedItemsController,GetSharedItemsSharedWithAddressRequestValidator])],y),r.GetSharedItemsSharedWithAddressUseCase=y},99443:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.SharedItemsMapper=void 0;r.SharedItemsMapper=class SharedItemsMapper{static toSharedItemDTO(t){var r,a,i,o;return{id:t.id.toString(),tags:t.tags,sharedBy:t.sharedBy.toString(),sharedWith:t.sharedWith.toString(),sharedAt:t.sharedAt.toString(),reference:null===(r=t.reference)||void 0===r?void 0:r.toString(),content:t.content.toJSON(),succeedsItem:null===(a=t.succeedsItem)||void 0===a?void 0:a.toString(),succeedsAt:null===(i=t.succeedsAt)||void 0===i?void 0:i.toString(),expiresAt:null===(o=t.expiresAt)||void 0===o?void 0:o.toString()}}static toSharedItemDTOList(t){return t.map((t=>this.toSharedItemDTO(t)))}}},40466:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.UpdateSharedItemUseCase=void 0;const c=a(90194),u=a(75172),d=a(3850),p=a(19663),h=a(7071),m=a(60485),y=a(7049),g=a(99443);class UpdateSharedItemRequestValidator extends y.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.id)).fulfills(y.IdValidator.required(d.ConsumptionIds.sharedItem)),this.validateIfAny((t=>t.content)).isDefined()}}let v=class UpdateSharedItemUseCase extends y.UseCase{constructor(t,r,a){super(a),this.sharedItemsController=t,this.accountController=r}async executeInternal(t){const r=await this.sharedItemsController.getSharedItem(p.CoreId.from(t.id));return r?(r.content=c.Serializable.fromUnknown(t.content),await this.sharedItemsController.updateSharedItem(r),await this.accountController.syncDatawallet(),u.Result.ok(g.SharedItemsMapper.toSharedItemDTO(r))):u.Result.fail(m.RuntimeErrors.general.recordNotFound(d.SharedItem))}};v=i([l(0,h.Inject),l(1,h.Inject),l(2,h.Inject),o("design:paramtypes",[d.SharedItemsController,p.AccountController,UpdateSharedItemRequestValidator])],v),r.UpdateSharedItemUseCase=v},90710:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(45382),r),o(a(71872),r),o(a(26081),r),o(a(98796),r),o(a(4408),r),o(a(14042),r),o(a(55402),r),o(a(6652),r),o(a(99443),r),o(a(40466),r)},60485:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(49365),r),o(a(56819),r),o(a(6595),r),o(a(23742),r),o(a(29667),r)},72737:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DisableAutoSyncUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049);let h=class DisableAutoSyncUseCase extends p.UseCase{constructor(t){super(),this.accountController=t}executeInternal(){return this.accountController.disableAutoSync(),c.Result.ok(void 0)}};h=i([l(0,d.Inject),o("design:paramtypes",[u.AccountController])],h),r.DisableAutoSyncUseCase=h},89710:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.EnableAutoSyncUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049);let h=class EnableAutoSyncUseCase extends p.UseCase{constructor(t){super(),this.accountController=t}async executeInternal(){return await this.accountController.enableAutoSync(),c.Result.ok(void 0)}};h=i([l(0,d.Inject),o("design:paramtypes",[u.AccountController])],h),r.EnableAutoSyncUseCase=h},60569:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetDeviceInfoUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049),h=a(83067);let m=class GetDeviceInfoUseCase extends p.UseCase{constructor(t){super(),this.deviceController=t}executeInternal(){const t=this.deviceController.device;return c.Result.ok(h.DeviceMapper.toDeviceDTO(t))}};m=i([l(0,d.Inject),o("design:paramtypes",[u.DeviceController])],m),r.GetDeviceInfoUseCase=m},73378:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetIdentityInfoUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049);let h=class GetIdentityInfoUseCase extends p.UseCase{constructor(t){super(),this.identityController=t}executeInternal(){const t=this.identityController.identity;return c.Result.ok({address:t.address.toString(),publicKey:t.publicKey.toString()})}};h=i([l(0,d.Inject),o("design:paramtypes",[u.IdentityController])],h),r.GetIdentityInfoUseCase=h},68562:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetSyncInfoUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049);let h=class GetSyncInfoUseCase extends p.UseCase{constructor(t){super(),this.accountController=t}async executeInternal(){const t=await this.accountController.getLastCompletedSyncTime(),r=await this.accountController.getLastCompletedDatawalletSyncTime();return c.Result.ok({lastSyncRun:t?{completedAt:t.toISOString()}:void 0,lastDatawalletSync:r?{completedAt:r.toISOString()}:void 0})}};h=i([l(0,d.Inject),o("design:paramtypes",[u.AccountController])],h),r.GetSyncInfoUseCase=h},63826:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.RegisterPushNotificationTokenUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049);class Validator extends p.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.handle)).isDefined().isNotEmpty(),this.validateIfString((t=>t.installationId)).isDefined().isNotEmpty(),this.validateIfString((t=>t.platform)).isDefined().isNotEmpty()}}let h=class RegisterPushNotificationTokenUseCase extends p.UseCase{constructor(t,r){super(r),this.accountController=t}async executeInternal(t){return await this.accountController.registerPushNotificationToken({handle:t.handle,installationId:t.installationId,platform:t.platform}),c.Result.ok(void 0)}};h=i([l(0,d.Inject),l(1,d.Inject),o("design:paramtypes",[u.AccountController,Validator])],h),r.RegisterPushNotificationTokenUseCase=h},54204:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.SyncDatawalletUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049);let h=class SyncDatawalletUseCase extends p.UseCase{constructor(t){super(),this.accountController=t}async executeInternal(){return await this.accountController.syncDatawallet(!0),c.Result.ok(void 0)}};h=i([l(0,d.Inject),o("design:paramtypes",[u.AccountController])],h),r.SyncDatawalletUseCase=h},84773:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.SyncEverythingUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(42205),h=a(986),m=a(7049),y=a(76881),g=a(94316);let v=class SyncEverythingUseCase extends m.UseCase{constructor(t,r,a,i){super(),this.accountController=t,this.identityController=r,this.eventBus=a,this.logger=i.getLogger(SyncEverythingUseCase)}async executeInternal(){if(this.currentSync)return await this.currentSync;this.currentSync=this._executeInternal();try{return await this.currentSync}finally{this.currentSync=void 0}}async _executeInternal(){const t=await this.accountController.syncEverything(),r=t.messages.map((t=>y.MessageMapper.toMessageDTO(t))),a=t.relationships.map((t=>g.RelationshipMapper.toRelationshipDTO(t))),i=this.identityController.identity.address.toString();return this.processNewMessages(r,i),this.processNewRelationships(a,i),c.Result.ok({messages:r,relationships:a})}processNewRelationships(t,r){if(0!==t.length){this.logger.debug(`Found ${t.length} relationship(s) with changes. Start publishing on event bus...`);for(const a of t)this.eventBus.publish(new p.RelationshipChangedEvent(r,a));this.logger.debug("Finished publishing relationship changes on event bus.")}}processNewMessages(t,r){if(0!==t.length){this.logger.debug(`Found ${t.length} new message(s). Start publishing on event bus...`);for(const a of t)this.eventBus.publish(new p.MessageReceivedEvent(r,a));this.logger.debug("Finished publishing message changes on event bus.")}}};v=i([l(0,d.Inject),l(1,d.Inject),l(2,d.Inject),l(3,d.Inject),o("design:paramtypes",[u.AccountController,u.IdentityController,c.EventBus,h.RuntimeLoggerFactory])],v),r.SyncEverythingUseCase=v},69276:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(72737),r),o(a(89710),r),o(a(60569),r),o(a(73378),r),o(a(68562),r),o(a(63826),r),o(a(54204),r),o(a(84773),r)},57661:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.ChallengeMapper=void 0;r.ChallengeMapper=class ChallengeMapper{static toChallengeDTO(t){const r=JSON.parse(t.challenge);return{id:r.id,expiresAt:r.expiresAt,createdBy:r.createdBy,createdByDevice:r.createdByDevice,type:r.type,signature:t.signature.toBase64(),challengeString:t.challenge}}}},99936:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CreateChallengeUseCase=void 0;const c=a(75172),u=a(19663),d=a(63586),p=a(7071),h=a(7049),m=a(57661);function isCreateRelationshipChallengeRequest(t){return"Relationship"===t.challengeType&&"string"==typeof t.relationship}let y=class Validator extends h.SchemaValidator{constructor(t){super(t.getSchema("CreateChallengeRequest")),this.relationshipSchema=t.getSchema("CreateRelationshipChallengeRequest"),this.identitySchema=t.getSchema("CreateIdentityChallengeRequest"),this.deviceSchema=t.getSchema("CreateDeviceChallengeRequest")}validate(t){if(this.schema.validate(t).isValid)return new d.ValidationResult;if(isCreateRelationshipChallengeRequest(t))return this.convertValidationResult(this.relationshipSchema.validate(t));if(function isCreateIdentityChallengeRequest(t){return"Identity"===t.challengeType}(t))return this.convertValidationResult(this.identitySchema.validate(t));if(function isCreateDeviceChallengeRequest(t){return"Device"===t.challengeType}(t))return this.convertValidationResult(this.deviceSchema.validate(t));const r=new d.ValidationResult;return r.addFailures([new d.ValidationFailure(void 0,"",void 0,h.RuntimeErrors.general.invalidPayload().code,h.RuntimeErrors.general.invalidPayload().message)]),r}};y=i([l(0,p.Inject),o("design:paramtypes",[h.SchemaRepository])],y);let g=class CreateChallengeUseCase extends h.UseCase{constructor(t,r,a){super(a),this.challengeController=t,this.relationshipsController=r}async executeInternal(t){const r=await this.getRelationship(t);if(r.isError)return c.Result.fail(r.error);let a;switch(t.challengeType){case"Relationship":a=u.ChallengeType.Relationship;break;case"Identity":a=u.ChallengeType.Identity;break;case"Device":a=u.ChallengeType.Device;break;default:throw new Error("Unknown challenge type.")}const i=await this.challengeController.createChallenge(a,r.value);return c.Result.ok(m.ChallengeMapper.toChallengeDTO(i))}async getRelationship(t){if(!isCreateRelationshipChallengeRequest(t))return c.Result.ok(void 0);const r=await this.relationshipsController.getRelationship(u.CoreId.from(t.relationship));return r?c.Result.ok(r):c.Result.fail(h.RuntimeErrors.general.recordNotFound(u.Relationship))}};g=i([l(0,p.Inject),l(1,p.Inject),l(2,p.Inject),o("design:paramtypes",[u.ChallengeController,u.RelationshipsController,y])],g),r.CreateChallengeUseCase=g},50473:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.ValidateChallengeUseCase=void 0;const c=a(75172),u=a(82890),d=a(19663),p=a(63586),h=a(7071),m=a(7049);let y=class Validator extends m.SchemaValidator{constructor(t){super(t.getSchema("ValidateChallengeRequest"))}async validate(t){const r=await super.validate(t);if(r.isInvalid())return r;const a=await this.validateSignature(t.signature);a.isError&&r.addFailures([new p.ValidationFailure(void 0,"signature",void 0,void 0,a.error.message)]);const i=await this.validateChallenge(t.challenge);return i.isError&&r.addFailures([new p.ValidationFailure(void 0,"challenge",void 0,void 0,i.error.message)]),r}async validateSignature(t){try{return await u.CryptoSignature.fromBase64(t),c.Result.ok(void 0)}catch{return c.Result.fail(m.RuntimeErrors.challenges.invalidSignature())}}async validateChallenge(t){try{return await d.Challenge.deserialize(t),c.Result.ok(void 0)}catch{return c.Result.fail(m.RuntimeErrors.challenges.invalidChallenge())}}};y=i([l(0,h.Inject),o("design:paramtypes",[m.SchemaRepository])],y);let g=class ValidateChallengeUseCase extends m.UseCase{constructor(t,r){super(r),this.challengeController=t}async executeInternal(t){const r=await u.CryptoSignature.fromBase64(t.signature),a=await d.ChallengeSigned.from({challenge:t.challenge,signature:r});try{const t=await this.challengeController.checkChallenge(a),r={isValid:!!t,challengeCreatedBy:null==t?void 0:t.peer.address.toString()};return c.Result.ok(r)}catch(t){if(!(t instanceof d.CoreError)||"error.transport.notImplemented"!==t.code)throw t;return c.Result.fail(m.RuntimeErrors.general.featureNotImplemented("Validating challenges of the type 'Device' is not yet implemented."))}}};g=i([l(0,h.Inject),l(1,h.Inject),o("design:paramtypes",[d.ChallengeController,y])],g),r.ValidateChallengeUseCase=g},75629:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(99936),r),o(a(50473),r)},5188:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CreateDeviceUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049),h=a(83067);class CreateDeviceRequestValidator extends p.RuntimeValidator{constructor(){super()}}let m=class CreateDeviceUseCase extends p.UseCase{constructor(t,r,a){super(a),this.devicesController=t,this.accountController=r}async executeInternal(t){const r=await this.devicesController.sendDevice(t);return await this.accountController.syncDatawallet(),c.Result.ok(h.DeviceMapper.toDeviceDTO(r))}};m=i([l(0,d.Inject),l(1,d.Inject),l(2,d.Inject),o("design:paramtypes",[u.DevicesController,u.AccountController,CreateDeviceRequestValidator])],m),r.CreateDeviceUseCase=m},20795:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CreateDeviceOnboardingTokenUseCase=void 0;const c=a(75172),u=a(19663),d=a(99490),p=a(7071),h=a(7049),m=a(57121);class CreateDeviceOnboardingTokenRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.id)).fulfills(h.IdValidator.required(u.BackboneIds.device)),this.validateIf((t=>t.expiresAt)).fulfills(h.DateValidator.optional()),this.validateIf((t=>t.expiresAt)).fulfills((t=>d.DateTime.fromISO(t)>d.DateTime.utc())).whenNotNull().withFailureMessage("'$propertyName' must be in the future.")}}let y=class CreateDeviceOnboardingTokenUseCase extends h.UseCase{constructor(t,r,a){super(a),this.devicesController=t,this.tokenController=r}async executeInternal(t){const r=await this.devicesController.getSharedSecret(u.CoreId.from(t.id)),a=t.expiresAt?u.CoreDate.from(t.expiresAt):u.CoreDate.utc().add({minutes:5}),i=await u.TokenContentDeviceSharedSecret.from({sharedSecret:r}),o=await this.tokenController.sendToken({content:i,expiresAt:a,ephemeral:!0});return c.Result.ok(await m.TokenMapper.toTokenDTO(o,!0))}};y=i([l(0,p.Inject),l(1,p.Inject),l(2,p.Inject),o("design:paramtypes",[u.DevicesController,u.TokenController,CreateDeviceOnboardingTokenRequestValidator])],y),r.CreateDeviceOnboardingTokenUseCase=y},2137:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DeleteDeviceUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049);class DeleteDeviceRequestValidator extends p.RuntimeValidator{constructor(){super(),this.validateIf((t=>t.id)).fulfills(p.IdValidator.required(u.BackboneIds.device))}}let h=class DeleteDeviceUseCase extends p.UseCase{constructor(t,r,a){super(a),this.devicesController=t,this.accountController=r}async executeInternal(t){const r=await this.devicesController.get(u.CoreId.from(t.id));return r?(await this.devicesController.delete(r),await this.accountController.syncDatawallet(),c.Result.ok(void 0)):c.Result.fail(p.RuntimeErrors.general.recordNotFound(u.Device))}};h=i([l(0,d.Inject),l(1,d.Inject),l(2,d.Inject),o("design:paramtypes",[u.DevicesController,u.AccountController,DeleteDeviceRequestValidator])],h),r.DeleteDeviceUseCase=h},83067:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.DeviceMapper=void 0;const i=a(82890),o=a(19663);r.DeviceMapper=class DeviceMapper{static toDeviceDTO(t){var r,a;return{id:t.id.toString(),createdAt:t.createdAt.toString(),createdByDevice:t.createdByDevice.toString(),name:t.name,type:t.type.toString(),username:t.username,certificate:t.certificate,description:t.description,lastLoginAt:null===(r=t.lastLoginAt)||void 0===r?void 0:r.toString(),operatingSystem:t.operatingSystem,publicKey:null===(a=t.publicKey)||void 0===a?void 0:a.toString()}}static toDeviceOnboardingInfoDTO(t){return{id:t.id.toString(),createdAt:t.createdAt.toString(),createdByDevice:t.createdByDevice.toString(),name:t.name,description:t.description,secretBaseKey:t.secretBaseKey.toBase64(),deviceIndex:t.deviceIndex,synchronizationKey:t.synchronizationKey.toBase64(),identityPrivateKey:t.identityPrivateKey?t.identityPrivateKey.toString():void 0,identity:{address:t.identity.address.toString(),publicKey:t.identity.publicKey.toString(),realm:t.identity.realm.toString()},password:t.password,username:t.username}}static async toDeviceSharedSecret(t){return await o.DeviceSharedSecret.from({id:o.CoreId.from(t.id),createdAt:o.CoreDate.from(t.createdAt),createdByDevice:o.CoreId.from(t.createdByDevice),name:t.name,description:t.description,secretBaseKey:await i.CryptoSecretKey.fromBase64(t.secretBaseKey),deviceIndex:t.deviceIndex,synchronizationKey:await i.CryptoSecretKey.fromBase64(t.synchronizationKey),identityPrivateKey:t.identityPrivateKey?await i.CryptoSignaturePrivateKey.deserialize(t.identityPrivateKey):void 0,identity:{address:o.CoreAddress.from(t.identity.address),publicKey:await i.CryptoSignaturePublicKey.deserialize(t.identity.publicKey),realm:t.identity.realm},password:t.password,username:t.username})}}},40770:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetDeviceUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049),h=a(83067);class GetDeviceRequestValidator extends p.RuntimeValidator{constructor(){super(),this.validateIf((t=>t.id)).fulfills(p.IdValidator.required(u.BackboneIds.device))}}let m=class GetDeviceUseCase extends p.UseCase{constructor(t,r){super(r),this.devicesController=t}async executeInternal(t){const r=await this.devicesController.get(u.CoreId.from(t.id));return r?c.Result.ok(h.DeviceMapper.toDeviceDTO(r)):c.Result.fail(p.RuntimeErrors.general.recordNotFound(u.Device))}};m=i([l(0,d.Inject),l(1,d.Inject),o("design:paramtypes",[u.DevicesController,GetDeviceRequestValidator])],m),r.GetDeviceUseCase=m},8283:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetDeviceOnboardingInfoUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049),h=a(83067);let m=class GetDeviceOnboardingInfoUseCase extends p.UseCase{constructor(t,r){super(r),this.devicesController=t}async executeInternal(t){const r=await this.devicesController.getSharedSecret(u.CoreId.from(t.id));return c.Result.ok(h.DeviceMapper.toDeviceOnboardingInfoDTO(r))}};m=i([l(0,d.Inject),l(1,d.Inject),o("design:paramtypes",[u.DevicesController,p.RuntimeValidator])],m),r.GetDeviceOnboardingInfoUseCase=m},93341:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetDevicesUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049),h=a(83067);let m=class GetDevicesUseCase extends p.UseCase{constructor(t){super(),this.devicesController=t}async executeInternal(){const t=(await this.devicesController.list()).map((t=>h.DeviceMapper.toDeviceDTO(t)));return c.Result.ok(t)}};m=i([l(0,d.Inject),o("design:paramtypes",[u.DevicesController])],m),r.GetDevicesUseCase=m},80189:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.UpdateDeviceUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(97802),h=a(7049);class UpdateDeviceRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIf((t=>t.id)).fulfills(h.IdValidator.required(u.BackboneIds.device))}}let m=class UpdateDeviceUseCase extends h.UseCase{constructor(t,r,a){super(a),this.devicesController=t,this.accountController=r}async executeInternal(t){const r=await this.devicesController.get(u.CoreId.from(t.id));return r?(t.name&&(r.name=t.name),r.description=t.description,await this.devicesController.update(r),await this.accountController.syncDatawallet(),c.Result.ok(p.DeviceMapper.toDeviceDTO(r))):c.Result.fail(h.RuntimeErrors.general.recordNotFound(u.Device))}};m=i([l(0,d.Inject),l(1,d.Inject),l(2,d.Inject),o("design:paramtypes",[u.DevicesController,u.AccountController,UpdateDeviceRequestValidator])],m),r.UpdateDeviceUseCase=m},97802:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(5188),r),o(a(20795),r),o(a(2137),r),o(a(83067),r),o(a(40770),r),o(a(8283),r),o(a(93341),r),o(a(80189),r)},10542:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CreateTokenForFileUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049),h=a(57121);let m=class Validator extends p.SchemaValidator{constructor(t){super(t.getSchema("CreateTokenForFileRequest"))}};m=i([l(0,d.Inject),o("design:paramtypes",[p.SchemaRepository])],m);let y=class CreateTokenForFileUseCase extends p.UseCase{constructor(t,r,a,i){super(i),this.fileController=t,this.tokenController=r,this.accountController=a}async executeInternal(t){var r,a,i;const o=await this.fileController.getFile(u.CoreId.from(t.fileId));if(!o)return c.Result.fail(p.RuntimeErrors.general.recordNotFound(u.File));const l=await u.TokenContentFile.from({fileId:o.id,secretKey:o.secretKey}),d=null===(r=t.ephemeral)||void 0===r||r,m=null!==(i=null===(a=o.cache)||void 0===a?void 0:a.expiresAt)&&void 0!==i?i:u.CoreDate.utc().add({days:12}),y=t.expiresAt?u.CoreDate.from(t.expiresAt):m,g=await this.tokenController.sendToken({content:l,expiresAt:y,ephemeral:d});return d||await this.accountController.syncDatawallet(),c.Result.ok(await h.TokenMapper.toTokenDTO(g,d))}};y=i([l(0,d.Inject),l(1,d.Inject),l(2,d.Inject),l(3,d.Inject),o("design:paramtypes",[u.FileController,u.TokenController,u.AccountController,m])],y),r.CreateTokenForFileUseCase=y},6913:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CreateTokenQrCodeForFileUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049);let h=class Validator extends p.SchemaValidator{constructor(t){super(t.getSchema("CreateTokenQrCodeForFileRequest"))}};h=i([l(0,d.Inject),o("design:paramtypes",[p.SchemaRepository])],h);let m=class CreateTokenQrCodeForFileUseCase extends p.UseCase{constructor(t,r,a){super(a),this.fileController=t,this.tokenController=r}async executeInternal(t){var r,a;const i=await this.fileController.getFile(u.CoreId.from(t.fileId));if(!i)return c.Result.fail(p.RuntimeErrors.general.recordNotFound(u.File));const o=await u.TokenContentFile.from({fileId:i.id,secretKey:i.secretKey}),l=null!==(a=null===(r=i.cache)||void 0===r?void 0:r.expiresAt)&&void 0!==a?a:u.CoreDate.utc().add({days:12}),d=t.expiresAt?u.CoreDate.from(t.expiresAt):l,h=await this.tokenController.sendToken({content:o,expiresAt:d,ephemeral:!0}),m=await p.QRCode.from(await h.truncate());return c.Result.ok({qrCodeBytes:m.asBase64()})}};m=i([l(0,d.Inject),l(1,d.Inject),l(2,d.Inject),o("design:paramtypes",[u.FileController,u.TokenController,h])],m),r.CreateTokenQrCodeForFileUseCase=m},68516:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DownloadFileUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049),h=a(35076);let m=class Validator extends p.SchemaValidator{constructor(t){super(t.getSchema("DownloadFileRequest"))}};m=i([l(0,d.Inject),o("design:paramtypes",[p.SchemaRepository])],m);let y=class DownloadFileUseCase extends p.UseCase{constructor(t,r){super(r),this.fileController=t}async executeInternal(t){const r=u.CoreId.from(t.id),a=await this.fileController.getFile(r);if(!a)return c.Result.fail(p.RuntimeErrors.general.recordNotFound(u.File));const i=await this.fileController.downloadFileContent(a.id);return c.Result.ok(h.FileMapper.toDownloadFileResponse(i,a))}};y=i([l(0,d.Inject),l(1,d.Inject),o("design:paramtypes",[u.FileController,m])],y),r.DownloadFileUseCase=y},35076:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.FileMapper=void 0;const i=a(19663),o=a(7049);r.FileMapper=class FileMapper{static toDownloadFileResponse(t,r){if(!r.cache)throw o.RuntimeErrors.general.cacheEmpty(i.File,r.id.toString());return{content:t.buffer,filename:r.cache.filename?r.cache.filename:r.id.toString(),mimetype:r.cache.mimetype}}static toFileDTO(t){var r,a,l,c;if(!t.cache)throw o.RuntimeErrors.general.cacheEmpty(i.File,t.id.toString());return{id:t.id.toString(),filename:t.cache.filename,filesize:t.cache.filesize,createdAt:t.cache.createdAt.toString(),createdBy:t.cache.createdBy.toString(),createdByDevice:t.cache.createdByDevice.toString(),expiresAt:t.cache.expiresAt.toString(),mimetype:t.cache.mimetype,isOwn:t.isOwn,title:null!==(r=t.cache.title)&&void 0!==r?r:"",secretKey:t.secretKey.toBase64(),description:t.cache.description,deletedAt:null===(a=t.cache.deletedAt)||void 0===a?void 0:a.toString(),deletedBy:null===(l=t.cache.deletedBy)||void 0===l?void 0:l.toString(),deletedByDevice:null===(c=t.cache.deletedByDevice)||void 0===c?void 0:c.toString()}}static toFileDTOList(t){return t.map((t=>this.toFileDTO(t)))}}},13520:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetFileUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049),h=a(35076);let m=class Validator extends p.SchemaValidator{constructor(t){super(t.getSchema("GetFileRequest"))}};m=i([l(0,d.Inject),o("design:paramtypes",[p.SchemaRepository])],m);let y=class GetFileUseCase extends p.UseCase{constructor(t,r){super(r),this.fileController=t}async executeInternal(t){const r=await this.fileController.getFile(u.CoreId.from(t.id));return r?c.Result.ok(h.FileMapper.toFileDTO(r)):c.Result.fail(p.RuntimeErrors.general.recordNotFound(u.File))}};y=i([l(0,d.Inject),l(1,d.Inject),o("design:paramtypes",[u.FileController,m])],y),r.GetFileUseCase=y},35911:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetFilesUseCase=void 0;const c=a(92937),u=a(75172),d=a(19663),p=a(94714),h=a(7071),m=a(7049),y=a(35076);let g=class GetFilesUseCase extends m.UseCase{constructor(t,r){super(r),this.fileController=t}async executeInternal(t){const r=GetFilesUseCase.queryTranslator.parse(t.query);t.ownerRestriction&&(r[(0,p.nameof)((t=>t.isOwn))]=t.ownerRestriction===m.OwnerRestriction.Own);const a=await this.fileController.getFiles(r);return u.Result.ok(y.FileMapper.toFileDTOList(a))}};g.queryTranslator=new c.QueryTranslator({whitelist:{[(0,p.nameof)((t=>t.createdAt))]:!0,[(0,p.nameof)((t=>t.createdBy))]:!0,[(0,p.nameof)((t=>t.createdByDevice))]:!0,[(0,p.nameof)((t=>t.deletedAt))]:!0,[(0,p.nameof)((t=>t.deletedBy))]:!0,[(0,p.nameof)((t=>t.deletedByDevice))]:!0,[(0,p.nameof)((t=>t.description))]:!0,[(0,p.nameof)((t=>t.expiresAt))]:!0,[(0,p.nameof)((t=>t.filename))]:!0,[(0,p.nameof)((t=>t.filesize))]:!0,[(0,p.nameof)((t=>t.mimetype))]:!0,[(0,p.nameof)((t=>t.title))]:!0,[(0,p.nameof)((t=>t.isOwn))]:!0},alias:{[(0,p.nameof)((t=>t.createdAt))]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.createdAt))}`,[(0,p.nameof)((t=>t.createdBy))]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.createdBy))}`,[(0,p.nameof)((t=>t.createdByDevice))]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.createdByDevice))}`,[(0,p.nameof)((t=>t.deletedAt))]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.deletedAt))}`,[(0,p.nameof)((t=>t.deletedBy))]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.deletedBy))}`,[(0,p.nameof)((t=>t.deletedByDevice))]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.deletedByDevice))}`,[(0,p.nameof)((t=>t.description))]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.description))}`,[(0,p.nameof)((t=>t.expiresAt))]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.expiresAt))}`,[(0,p.nameof)((t=>t.filename))]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.filename))}`,[(0,p.nameof)((t=>t.filesize))]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.filesize))}`,[(0,p.nameof)((t=>t.mimetype))]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.mimetype))}`,[(0,p.nameof)((t=>t.title))]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.title))}`,[(0,p.nameof)((t=>t.isOwn))]:(0,p.nameof)((t=>t.isOwn))}}),g=i([l(0,h.Inject),l(1,h.Inject),o("design:paramtypes",[d.FileController,m.RuntimeValidator])],g),r.GetFilesUseCase=g},67435:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.LoadPeerFileUseCase=void 0;const c=a(75172),u=a(82890),d=a(19663),p=a(63586),h=a(7071),m=a(7049),y=a(35076);function isLoadPeerFileViaSecret(t){return"id"in t&&"secretKey"in t}function isLoadPeerFileViaReference(t){return"reference"in t}let g=class Validator extends m.SchemaValidator{constructor(t){super(t.getSchema("LoadPeerFileRequest")),this.loadViaSecretSchema=t.getSchema("LoadPeerFileViaSecretRequest"),this.loadViaReferenceSchema=t.getSchema("LoadPeerFileViaReferenceRequest")}validate(t){if(this.schema.validate(t).isValid)return new p.ValidationResult;if(isLoadPeerFileViaReference(t))return this.convertValidationResult(this.loadViaReferenceSchema.validate(t));if(isLoadPeerFileViaSecret(t))return this.convertValidationResult(this.loadViaSecretSchema.validate(t));const r=new p.ValidationResult;return r.addFailures([new p.ValidationFailure(void 0,"",void 0,m.RuntimeErrors.general.invalidPayload().code,m.RuntimeErrors.general.invalidPayload().message)]),r}};g=i([l(0,h.Inject),o("design:paramtypes",[m.SchemaRepository])],g);let v=class LoadPeerFileUseCase extends m.UseCase{constructor(t,r,a,i){super(i),this.fileController=t,this.tokenController=r,this.accountController=a}async executeInternal(t){let r;if(isLoadPeerFileViaSecret(t)){const a=await u.CryptoSecretKey.fromBase64(t.secretKey);r=await this.loadFile(d.CoreId.from(t.id),a)}else{if(!isLoadPeerFileViaReference(t))throw new Error("Invalid request format.");r=await this.createFileFromTokenReferenceRequest(t.reference)}return await this.accountController.syncDatawallet(),r}async createFileFromTokenReferenceRequest(t){const r=await this.tokenController.loadPeerTokenByTruncated(t,!0);if(!r.cache)throw m.RuntimeErrors.general.cacheEmpty(d.Token,r.id.toString());if(!(r.cache.content instanceof d.TokenContentFile))return c.Result.fail(m.RuntimeErrors.general.invalidTokenContent());const a=r.cache.content;return await this.loadFile(a.fileId,a.secretKey)}async loadFile(t,r){const a=await this.fileController.loadPeerFile(t,r);return c.Result.ok(y.FileMapper.toFileDTO(a))}};v=i([l(0,h.Inject),l(1,h.Inject),l(2,h.Inject),l(3,h.Inject),o("design:paramtypes",[d.FileController,d.TokenController,d.AccountController,g])],v),r.LoadPeerFileUseCase=v},32109:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.UploadOwnFileUseCase=void 0;const c=a(75172),u=a(82890),d=a(19663),p=a(99490),h=a(7071),m=a(7049),y=a(35076);class UploadOwnFileRequestValidator extends m.RuntimeValidator{constructor(){super(),this.validateIf((t=>t.content)).isNotNull().fulfills((t=>t.length>0)).withFailureMessage("file content is empty"),this.validateIf((t=>t.content)).isNotNull().fulfills((t=>t.byteLength<=this._maxFileSize)).withFailureMessage("file content is too large"),this.validateIf((t=>t.filename)).isNotNull(),this.validateIf((t=>t.mimetype)).isNotNull(),this.validateIf((t=>t.title)).isNotNull(),this.validateIf((t=>t.expiresAt)).isNotNull(),this.validateIf((t=>t.expiresAt)).fulfills(m.DateValidator.required()),this.validateIf((t=>t.expiresAt)).fulfills((t=>p.DateTime.fromISO(t)>p.DateTime.utc())).withFailureMessage("'$propertyName' must be in the future.")}set maxFileSize(t){this._maxFileSize=t}}let g=class UploadOwnFileUseCase extends m.UseCase{constructor(t,r,a){super(a),this.fileController=t,this.accountController=r,a.maxFileSize=t.config.platformMaxUnencryptedFileSize}async executeInternal(t){var r;const a=await this.fileController.sendFile({buffer:u.CoreBuffer.from(t.content),title:t.title,description:null!==(r=t.description)&&void 0!==r?r:"",filename:t.filename,mimetype:t.mimetype,expiresAt:d.CoreDate.from(t.expiresAt)});return await this.accountController.syncDatawallet(),c.Result.ok(y.FileMapper.toFileDTO(a))}};g=i([l(0,h.Inject),l(1,h.Inject),l(2,h.Inject),o("design:paramtypes",[d.FileController,d.AccountController,UploadOwnFileRequestValidator])],g),r.UploadOwnFileUseCase=g},20098:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(10542),r),o(a(6913),r),o(a(68516),r),o(a(35076),r),o(a(13520),r),o(a(35911),r),o(a(67435),r),o(a(32109),r)},54824:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CheckIdentityUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049),h=a(94316);class CheckIdentityRequestValidator extends p.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.address)).fulfills(p.AddressValidator.required())}}let m=class CheckIdentityUseCase extends p.UseCase{constructor(t,r,a){super(a),this.identityController=t,this.relationshipsController=r}async executeInternal(t){const r=u.CoreAddress.from(t.address);if(this.identityController.isMe(r))return c.Result.ok({self:!0});const a=await this.relationshipsController.getRelationshipToIdentity(r);if(a){const t=h.RelationshipMapper.toRelationshipDTO(a);return a.status===u.RelationshipStatus.Pending?c.Result.ok({peer:!0,relationshipPending:!0,relationship:t}):a.status===u.RelationshipStatus.Active||a.status===u.RelationshipStatus.Terminating?c.Result.ok({peer:!0,relationshipActive:!0,relationship:t}):c.Result.ok({peer:!0,relationshipTerminated:!0,relationship:t})}return c.Result.ok({unknown:!0})}};m=i([l(0,d.Inject),l(1,d.Inject),l(2,d.Inject),o("design:paramtypes",[u.IdentityController,u.RelationshipsController,CheckIdentityRequestValidator])],m),r.CheckIdentityUseCase=m},74847:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(54824),r)},29667:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(69276),r),o(a(75629),r),o(a(97802),r),o(a(20098),r),o(a(74847),r),o(a(92290),r),o(a(7831),r),o(a(43084),r),o(a(25631),r)},64860:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DownloadAttachmentUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049),h=a(76881);class DownloadAttachmentRequestValidator extends p.RuntimeValidator{constructor(){super(),this.validateIf((t=>t.id)).fulfills(p.IdValidator.required(u.BackboneIds.message)),this.validateIf((t=>t.attachmentId)).fulfills(p.IdValidator.required(u.BackboneIds.file))}}let m=class DownloadAttachmentUseCase extends p.UseCase{constructor(t,r,a){super(a),this.messageController=t,this.fileController=r}async executeInternal(t){const r=await this.messageController.getMessage(u.CoreId.from(t.id));if(!r)return c.Result.fail(p.RuntimeErrors.general.recordNotFound(u.Message));if(!r.cache)throw p.RuntimeErrors.general.cacheEmpty(u.Message,r.id.toString());const a=r.cache.attachments.find((r=>r.equals(u.CoreId.from(t.attachmentId))));if(!a)return c.Result.fail(p.RuntimeErrors.messages.fileNotFoundInMessage(t.attachmentId));const i=await this.fileController.getFile(a);if(!i)return c.Result.fail(p.RuntimeErrors.general.recordNotFound(u.File));const o=await this.fileController.downloadFileContent(a);return c.Result.ok(h.MessageMapper.toDownloadAttachmentResponse(o,i))}};m=i([l(0,d.Inject),l(1,d.Inject),l(2,d.Inject),o("design:paramtypes",[u.MessageController,u.FileController,DownloadAttachmentRequestValidator])],m),r.DownloadAttachmentUseCase=m},19558:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetAttachmentMetadataUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049),h=a(35076);class GetAttachmentMetadataRequestValidator extends p.RuntimeValidator{constructor(){super(),this.validateIf((t=>t.id)).fulfills(p.IdValidator.required(u.BackboneIds.message)),this.validateIf((t=>t.attachmentId)).fulfills(p.IdValidator.required(u.BackboneIds.file))}}let m=class GetAttachmentMetadataUseCase extends p.UseCase{constructor(t,r,a){super(a),this.messageController=t,this.fileController=r}async executeInternal(t){const r=await this.messageController.getMessage(u.CoreId.from(t.id));if(!r)return c.Result.fail(p.RuntimeErrors.general.recordNotFound(u.Message));if(!r.cache)throw p.RuntimeErrors.general.cacheEmpty(u.Message,r.id.toString());const a=r.cache.attachments.find((r=>r.equals(u.CoreId.from(t.attachmentId))));if(!a)return c.Result.fail(p.RuntimeErrors.messages.fileNotFoundInMessage(t.attachmentId));const i=await this.fileController.getFile(a);return i?c.Result.ok(h.FileMapper.toFileDTO(i)):c.Result.fail(p.RuntimeErrors.general.recordNotFound(File))}};m=i([l(0,d.Inject),l(1,d.Inject),l(2,d.Inject),o("design:paramtypes",[u.MessageController,u.FileController,GetAttachmentMetadataRequestValidator])],m),r.GetAttachmentMetadataUseCase=m},40978:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetMessageUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049),h=a(76881);class GetMessageRequestValidator extends p.RuntimeValidator{constructor(){super(),this.validateIf((t=>t.id)).fulfills(p.IdValidator.required(u.BackboneIds.message))}}let m=class GetMessageUseCase extends p.UseCase{constructor(t,r,a){super(a),this.messageController=t,this.fileController=r}async executeInternal(t){const r=await this.messageController.getMessage(u.CoreId.from(t.id));if(!r)return c.Result.fail(p.RuntimeErrors.general.recordNotFound(u.Message));if(!r.cache)return c.Result.fail(p.RuntimeErrors.general.cacheEmpty(u.Message,r.id.toString()));const a=await Promise.all(r.cache.attachments.map((t=>this.fileController.getFile(t))));if(a.some((t=>!t)))throw new Error("A file could not be fetched.");return c.Result.ok(h.MessageMapper.toMessageWithAttachmentsDTO(r,a))}};m=i([l(0,d.Inject),l(1,d.Inject),l(2,d.Inject),o("design:paramtypes",[u.MessageController,u.FileController,GetMessageRequestValidator])],m),r.GetMessageUseCase=m},79231:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetMessagesUseCase=void 0;const c=a(92937),u=a(75172),d=a(19663),p=a(94714),h=a(7071),m=a(7049),y=a(76881);class GetMessagesRequestValidator extends m.RuntimeValidator{constructor(){super()}}let g=class GetMessagesUseCase extends m.UseCase{constructor(t,r){super(r),this.messageController=t}async executeInternal(t){const r=GetMessagesUseCase.queryTranslator.parse(t.query),a=await this.messageController.getMessages(r);return u.Result.ok(y.MessageMapper.toMessageDTOList(a))}};g.queryTranslator=new c.QueryTranslator({whitelist:{[(0,p.nameof)((t=>t.createdBy))]:!0,[(0,p.nameof)((t=>t.createdByDevice))]:!0,[(0,p.nameof)((t=>t.createdAt))]:!0,[`${(0,p.nameof)((t=>t.recipients))}.${(0,p.nameof)((t=>t.address))}`]:!0,[`${(0,p.nameof)((t=>t.content))}.@type`]:!0,[`${(0,p.nameof)((t=>t.content))}.body`]:!0,[`${(0,p.nameof)((t=>t.content))}.subject`]:!0,[(0,p.nameof)((t=>t.attachments))]:!0,[(0,p.nameof)((t=>t.relationshipIds))]:!0,participant:!0},alias:{[(0,p.nameof)((t=>t.createdBy))]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.createdBy))}`,[(0,p.nameof)((t=>t.createdByDevice))]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.createdByDevice))}`,[(0,p.nameof)((t=>t.createdAt))]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.createdAt))}`,[`${(0,p.nameof)((t=>t.recipients))}.${(0,p.nameof)((t=>t.address))}`]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.recipients))}.${(0,p.nameof)((t=>t.address))}`,[`${(0,p.nameof)((t=>t.content))}.@type`]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.content))}.@type`,[`${(0,p.nameof)((t=>t.content))}.body`]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.content))}.body`,[`${(0,p.nameof)((t=>t.content))}.subject`]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.content))}.subject`,[(0,p.nameof)((t=>t.attachments))]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.attachments))}`},custom:{relationshipIds:(t,r)=>{t.relationshipIds={$contains:r}},participant:(t,r)=>{let a;if(Array.isArray(r)){if(0===r.length)return;a={};for(const t of r){const r=g.queryTranslator.parseString(t,!0);switch(r.field){case"$in":case"$nin":a[r.field]=a[r.field]||[],a[r.field].push(r.value);break;default:a[r.field]=r.value}}}else a=g.queryTranslator.parseStringVal(r);t.$or=[{[`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.createdBy))}`]:a},{[`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.recipients))}.${(0,p.nameof)((t=>t.address))}`]:a}]}}}),g=i([l(0,h.Inject),l(1,h.Inject),o("design:paramtypes",[d.MessageController,GetMessagesRequestValidator])],g),r.GetMessagesUseCase=g},76881:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.MessageMapper=void 0;const i=a(19663),o=a(7049),l=a(35076);r.MessageMapper=class MessageMapper{static toDownloadAttachmentResponse(t,r){if(!r.cache)throw o.RuntimeErrors.general.cacheEmpty(i.File,r.id.toString());return{content:t.buffer,filename:r.cache.filename?r.cache.filename:r.id.toString(),mimetype:r.cache.mimetype}}static toMessageWithAttachmentsDTO(t,r){if(!t.cache)throw o.RuntimeErrors.general.cacheEmpty(i.Message,t.id.toString());return{id:t.id.toString(),content:t.cache.content.toJSON(),createdBy:t.cache.createdBy.toString(),createdByDevice:t.cache.createdByDevice.toString(),recipients:t.cache.recipients.map((t=>this.toRecipient(t))),createdAt:t.cache.createdAt.toString(),relationshipIds:t.relationshipIds.map((t=>t.toString())),attachments:r.map((t=>l.FileMapper.toFileDTO(t)))}}static toMessageDTO(t){if(!t.cache)throw o.RuntimeErrors.general.cacheEmpty(i.Message,t.id.toString());return{id:t.id.toString(),content:t.cache.content.toJSON(),createdBy:t.cache.createdBy.toString(),createdByDevice:t.cache.createdByDevice.toString(),recipients:t.cache.recipients.map((t=>this.toRecipient(t))),relationshipIds:t.relationshipIds.map((t=>t.toString())),createdAt:t.cache.createdAt.toString(),attachments:t.cache.attachments.map((t=>t.toString()))}}static toMessageDTOList(t){return t.map((t=>this.toMessageDTO(t)))}static toRecipient(t){var r,a;return{address:t.address.toString(),receivedAt:null===(r=t.receivedAt)||void 0===r?void 0:r.toString(),receivedByDevice:null===(a=t.receivedByDevice)||void 0===a?void 0:a.toString()}}}},38400:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.SendMessageUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(42205),h=a(7049),m=a(76881);class SendMessageRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfIterable((t=>t.recipients)).isNotEmpty(),this.validateIfEachString((t=>t.recipients)).fulfills(h.AddressValidator.required()),this.validateIfAny((t=>t.content)).isNotNull(),this.validateIfEachString((t=>t.attachments)).fulfills(h.IdValidator.required(u.BackboneIds.file))}}let y=class SendMessageUseCase extends h.UseCase{constructor(t,r,a,i,o,l){super(l),this.messageController=t,this.fileController=r,this.accountController=a,this.identityController=i,this.eventBus=o}async executeInternal(t){const r=await this.transformAttachments(t.attachments);if(r.isError)return c.Result.fail(r.error);const a=await this.messageController.sendMessage({recipients:t.recipients.map((t=>u.CoreAddress.from(t))),content:t.content,attachments:r.value}),i=m.MessageMapper.toMessageDTO(a);return this.eventBus.publish(new p.MessageSentEvent(this.identityController.identity.address.toString(),i)),await this.accountController.syncDatawallet(),c.Result.ok(m.MessageMapper.toMessageDTO(a))}async transformAttachments(t){if(!t||0===t.length)return c.Result.ok([]);const r=[];for(const a of t){const t=await this.fileController.getFile(u.CoreId.from(a));if(!t)return c.Result.fail(h.RuntimeErrors.general.recordNotFound(u.File));r.push(t)}return c.Result.ok(r)}};y=i([l(0,d.Inject),l(1,d.Inject),l(2,d.Inject),l(3,d.Inject),l(4,d.Inject),l(5,d.Inject),o("design:paramtypes",[u.MessageController,u.FileController,u.AccountController,u.IdentityController,c.EventBus,SendMessageRequestValidator])],y),r.SendMessageUseCase=y},92290:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(64860),r),o(a(19558),r),o(a(40978),r),o(a(79231),r),o(a(76881),r),o(a(38400),r)},88580:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CreateOwnRelationshipTemplateUseCase=void 0;const c=a(75172),u=a(19663),d=a(99490),p=a(7071),h=a(7049),m=a(58434);class CreateOwnRelationshipTemplateRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIf((t=>t.expiresAt)).fulfills(h.DateValidator.required()),this.validateIf((t=>t.expiresAt)).fulfills((t=>d.DateTime.fromISO(t)>d.DateTime.utc())).withFailureMessage("'$propertyName' must be in the future."),this.validateIfAny((t=>t.content)).isNotNull(),this.validateIfNumber((t=>t.maxNumberOfRelationships)).isGreaterThanOrEqual(1).whenNotNull()}}let y=class CreateOwnRelationshipTemplateUseCase extends h.UseCase{constructor(t,r,a){super(a),this.templateController=t,this.accountController=r}async executeInternal(t){const r=await this.templateController.sendRelationshipTemplate({content:t.content,expiresAt:u.CoreDate.from(t.expiresAt),maxNumberOfRelationships:t.maxNumberOfRelationships});return await this.accountController.syncDatawallet(),c.Result.ok(m.RelationshipTemplateMapper.toRelationshipTemplateDTO(r))}};y=i([l(0,p.Inject),l(1,p.Inject),l(2,p.Inject),o("design:paramtypes",[u.RelationshipTemplateController,u.AccountController,CreateOwnRelationshipTemplateRequestValidator])],y),r.CreateOwnRelationshipTemplateUseCase=y},17255:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CreateTokenForOwnTemplateUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049),h=a(57121);class CreateTokenForOwnTemplateRequestValidator extends p.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.templateId)).fulfills(p.IdValidator.required(u.BackboneIds.relationshipTemplate)),this.validateIfString((t=>t.expiresAt)).fulfills(p.DateValidator.optional())}}let m=class CreateTokenForOwnTemplateUseCase extends p.UseCase{constructor(t,r,a,i){super(i),this.templateController=t,this.tokenController=r,this.accountController=a}async executeInternal(t){var r,a,i;const o=await this.templateController.getRelationshipTemplate(u.CoreId.from(t.templateId));if(!o)return c.Result.fail(p.RuntimeErrors.general.recordNotFound(u.RelationshipTemplate));if(!o.isOwn)return c.Result.fail(p.RuntimeErrors.relationshipTemplates.cannotCreateTokenForPeerTemplate());const l=await u.TokenContentRelationshipTemplate.from({templateId:o.id,secretKey:o.secretKey}),d=null===(r=t.ephemeral)||void 0===r||r,m=null!==(i=null===(a=o.cache)||void 0===a?void 0:a.expiresAt)&&void 0!==i?i:u.CoreDate.utc().add({days:12}),y=t.expiresAt?u.CoreDate.from(t.expiresAt):m,g=await this.tokenController.sendToken({content:l,expiresAt:y,ephemeral:d});return d||await this.accountController.syncDatawallet(),c.Result.ok(await h.TokenMapper.toTokenDTO(g,d))}};m=i([l(0,d.Inject),l(1,d.Inject),l(2,d.Inject),l(3,d.Inject),o("design:paramtypes",[u.RelationshipTemplateController,u.TokenController,u.AccountController,CreateTokenForOwnTemplateRequestValidator])],m),r.CreateTokenForOwnTemplateUseCase=m},13683:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CreateTokenQrCodeForOwnTemplateUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049);class CreateTokenQrCodeForOwnTemplateRequestValidator extends p.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.templateId)).fulfills(p.IdValidator.required(u.BackboneIds.relationshipTemplate)),this.validateIfString((t=>t.expiresAt)).fulfills(p.DateValidator.optional())}}let h=class CreateTokenQrCodeForOwnTemplateUseCase extends p.UseCase{constructor(t,r,a){super(a),this.templateController=t,this.tokenController=r}async executeInternal(t){var r,a;const i=await this.templateController.getRelationshipTemplate(u.CoreId.from(t.templateId));if(!i)return c.Result.fail(p.RuntimeErrors.general.recordNotFound(u.RelationshipTemplate));if(!i.isOwn)return c.Result.fail(p.RuntimeErrors.relationshipTemplates.cannotCreateTokenForPeerTemplate());const o=await u.TokenContentRelationshipTemplate.from({templateId:i.id,secretKey:i.secretKey}),l=null!==(a=null===(r=i.cache)||void 0===r?void 0:r.expiresAt)&&void 0!==a?a:u.CoreDate.utc().add({days:12}),d=t.expiresAt?u.CoreDate.from(t.expiresAt):l,h=await this.tokenController.sendToken({content:o,expiresAt:d,ephemeral:!0}),m=await p.QRCode.from(await h.truncate());return c.Result.ok({qrCodeBytes:m.asBase64()})}};h=i([l(0,d.Inject),l(1,d.Inject),l(2,d.Inject),o("design:paramtypes",[u.RelationshipTemplateController,u.TokenController,CreateTokenQrCodeForOwnTemplateRequestValidator])],h),r.CreateTokenQrCodeForOwnTemplateUseCase=h},72603:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetRelationshipTemplateUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049),h=a(58434);class GetRelationshipTemplateRequestValidator extends p.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.id)).fulfills(p.IdValidator.required(u.BackboneIds.relationshipTemplate))}}let m=class GetRelationshipTemplateUseCase extends p.UseCase{constructor(t,r){super(r),this.relationshipTemplateController=t}async executeInternal(t){const r=await this.relationshipTemplateController.getRelationshipTemplate(u.CoreId.from(t.id));return r?c.Result.ok(h.RelationshipTemplateMapper.toRelationshipTemplateDTO(r)):c.Result.fail(p.RuntimeErrors.general.recordNotFound(u.RelationshipTemplate))}};m=i([l(0,d.Inject),l(1,d.Inject),o("design:paramtypes",[u.RelationshipTemplateController,GetRelationshipTemplateRequestValidator])],m),r.GetRelationshipTemplateUseCase=m},1371:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetRelationshipTemplatesUseCase=void 0;const c=a(92937),u=a(75172),d=a(19663),p=a(94714),h=a(7071),m=a(7049),y=a(58434);let g=class GetRelationshipTemplatesUseCase extends m.UseCase{constructor(t,r){super(r),this.relationshipTemplateController=t}async executeInternal(t){const r=GetRelationshipTemplatesUseCase.queryTranslator.parse(t.query);t.ownerRestriction&&(r[(0,p.nameof)((t=>t.isOwn))]=t.ownerRestriction===m.OwnerRestriction.Own);const a=await this.relationshipTemplateController.getRelationshipTemplates(r);return u.Result.ok(y.RelationshipTemplateMapper.toRelationshipTemplateDTOList(a))}};g.queryTranslator=new c.QueryTranslator({whitelist:{[(0,p.nameof)((t=>t.isOwn))]:!0,[(0,p.nameof)((t=>t.createdAt))]:!0,[(0,p.nameof)((t=>t.expiresAt))]:!0,[(0,p.nameof)((t=>t.createdBy))]:!0,[(0,p.nameof)((t=>t.createdByDevice))]:!0,[(0,p.nameof)((t=>t.maxNumberOfRelationships))]:!0},alias:{[(0,p.nameof)((t=>t.isOwn))]:(0,p.nameof)((t=>t.isOwn)),[(0,p.nameof)((t=>t.createdAt))]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.createdAt))}`,[(0,p.nameof)((t=>t.expiresAt))]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.expiresAt))}`,[(0,p.nameof)((t=>t.createdBy))]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.createdBy))}`,[(0,p.nameof)((t=>t.createdByDevice))]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.createdByDevice))}`,[(0,p.nameof)((t=>t.maxNumberOfRelationships))]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.maxNumberOfRelationships))}`}}),g=i([l(0,h.Inject),l(1,h.Inject),o("design:paramtypes",[d.RelationshipTemplateController,m.RuntimeValidator])],g),r.GetRelationshipTemplatesUseCase=g},73186:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.LoadPeerRelationshipTemplateUseCase=void 0;const c=a(75172),u=a(82890),d=a(19663),p=a(7071),h=a(7049),m=a(58434);class LoadPeerRelationshipTemplateRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIf((t=>t)).fulfills((t=>this.isCreateRelationshipTemplateFromIdAndKeyRequest(t)||this.isCreateRelationshipTemplateFromTokenReferenceRequest(t))).withFailureCode(h.RuntimeErrors.general.invalidPayload().code).withFailureMessage(h.RuntimeErrors.general.invalidPayload().message),this.setupRulesForCreateRelationshipTemplateFromIdAndKeyRequest(),this.setupRulesForCreateRelationshipTemplateFromTokenReferenceRequest()}setupRulesForCreateRelationshipTemplateFromIdAndKeyRequest(){this.validateIfString((t=>t.id)).fulfills(h.IdValidator.required(d.BackboneIds.relationshipTemplate)).when(this.isCreateRelationshipTemplateFromIdAndKeyRequest),this.validateIfString((t=>t.secretKey)).isNotNull().when(this.isCreateRelationshipTemplateFromIdAndKeyRequest)}setupRulesForCreateRelationshipTemplateFromTokenReferenceRequest(){this.validateIfString((t=>t.reference)).isNotNull().when(this.isCreateRelationshipTemplateFromTokenReferenceRequest)}isCreateRelationshipTemplateFromIdAndKeyRequest(t){return!!t.id&&!!t.secretKey}isCreateRelationshipTemplateFromTokenReferenceRequest(t){return!!t.reference}}let y=class LoadPeerRelationshipTemplateUseCase extends h.UseCase{constructor(t,r,a,i){super(i),this.templateController=t,this.tokenController=r,this.accountController=a}async executeInternal(t){let r;if(t.id&&t.secretKey){const a=await u.CryptoSecretKey.fromBase64(t.secretKey);r=await this.loadTemplate(d.CoreId.from(t.id),a)}else{if(!t.reference)throw new Error("Invalid request format.");r=await this.createRelationshipTemplateFromTokenReferenceRequest(t.reference)}return await this.accountController.syncDatawallet(),r}async createRelationshipTemplateFromTokenReferenceRequest(t){const r=await this.tokenController.loadPeerTokenByTruncated(t,!0);if(!r.cache)throw h.RuntimeErrors.general.cacheEmpty(d.Token,r.id.toString());if(!(r.cache.content instanceof d.TokenContentRelationshipTemplate))return c.Result.fail(h.RuntimeErrors.general.invalidTokenContent());const a=r.cache.content;return await this.loadTemplate(a.templateId,a.secretKey)}async loadTemplate(t,r){const a=await this.templateController.loadPeerRelationshipTemplate(t,r);return c.Result.ok(m.RelationshipTemplateMapper.toRelationshipTemplateDTO(a))}};y=i([l(0,p.Inject),l(1,p.Inject),l(2,p.Inject),l(3,p.Inject),o("design:paramtypes",[d.RelationshipTemplateController,d.TokenController,d.AccountController,LoadPeerRelationshipTemplateRequestValidator])],y),r.LoadPeerRelationshipTemplateUseCase=y},58434:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.RelationshipTemplateMapper=void 0;const i=a(19663),o=a(7049);r.RelationshipTemplateMapper=class RelationshipTemplateMapper{static toRelationshipTemplateDTO(t){var r;if(!t.cache)throw o.RuntimeErrors.general.cacheEmpty(i.RelationshipTemplate,t.id.toString());return{id:t.id.toString(),isOwn:t.isOwn,createdBy:t.cache.createdBy.toString(),createdByDevice:t.cache.createdByDevice.toString(),createdAt:t.cache.createdAt.toString(),content:t.cache.content.toJSON(),expiresAt:null===(r=t.cache.expiresAt)||void 0===r?void 0:r.toString(),maxNumberOfRelationships:t.cache.maxNumberOfRelationships}}static toRelationshipTemplateDTOList(t){return t.map((t=>this.toRelationshipTemplateDTO(t)))}}},43084:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(88580),r),o(a(17255),r),o(a(13683),r),o(a(72603),r),o(a(1371),r),o(a(73186),r),o(a(58434),r)},63018:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.AcceptRelationshipChangeUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(42205),h=a(7049),m=a(94316);class AcceptRelationshipChangeRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.relationshipId)).fulfills(h.IdValidator.required(u.BackboneIds.relationship)),this.validateIfString((t=>t.changeId)).fulfills(h.IdValidator.required(u.BackboneIds.relationshipChange))}}let y=class AcceptRelationshipChangeUseCase extends h.UseCase{constructor(t,r,a,i,o){super(o),this.relationshipsController=t,this.accountController=r,this.identityController=a,this.eventBus=i}async executeInternal(t){const r=await this.relationshipsController.getRelationship(u.CoreId.from(t.relationshipId));if(!r)return c.Result.fail(h.RuntimeErrors.general.recordNotFound(u.Relationship));if(!r.cache)return c.Result.fail(h.RuntimeErrors.general.cacheEmpty(u.Relationship,r.id.toString()));const a=r.cache.changes.find((r=>r.id.toString()===t.changeId));if(!a)return c.Result.fail(h.RuntimeErrors.general.recordNotFound(u.RelationshipChange));const i=await this.relationshipsController.acceptChange(a,t.content),o=m.RelationshipMapper.toRelationshipDTO(i);return this.eventBus.publish(new p.RelationshipChangedEvent(this.identityController.identity.address.toString(),o)),await this.accountController.syncDatawallet(),c.Result.ok(o)}};y=i([l(0,d.Inject),l(1,d.Inject),l(2,d.Inject),l(3,d.Inject),l(4,d.Inject),o("design:paramtypes",[u.RelationshipsController,u.AccountController,u.IdentityController,c.EventBus,AcceptRelationshipChangeRequestValidator])],y),r.AcceptRelationshipChangeUseCase=y},83986:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CreateRelationshipUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(42205),h=a(7049),m=a(94316);class CreateRelationshipRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.templateId)).fulfills(h.IdValidator.required(u.BackboneIds.relationshipTemplate)),this.validateIf((t=>t.content)).isDefined()}}let y=class CreateRelationshipUseCase extends h.UseCase{constructor(t,r,a,i,o,l){super(l),this.relationshipsController=t,this.relationshipTemplateController=r,this.accountController=a,this.identityController=i,this.eventBus=o}async executeInternal(t){const r=await this.relationshipTemplateController.getRelationshipTemplate(u.CoreId.from(t.templateId));if(!r)return c.Result.fail(h.RuntimeErrors.general.recordNotFound(u.RelationshipTemplate));const a=await this.relationshipsController.sendRelationship({template:r,content:t.content}),i=m.RelationshipMapper.toRelationshipDTO(a);return this.eventBus.publish(new p.RelationshipChangedEvent(this.identityController.identity.address.toString(),i)),await this.accountController.syncDatawallet(),c.Result.ok(i)}};y=i([l(0,d.Inject),l(1,d.Inject),l(2,d.Inject),l(3,d.Inject),l(4,d.Inject),l(5,d.Inject),o("design:paramtypes",[u.RelationshipsController,u.RelationshipTemplateController,u.AccountController,u.IdentityController,c.EventBus,CreateRelationshipRequestValidator])],y),r.CreateRelationshipUseCase=y},57619:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CreateRelationshipChangeUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049);class CreateRelationshipChangeRequestValidator extends p.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.id)).fulfills(p.IdValidator.required(u.BackboneIds.relationship)),this.validateIf((t=>t.content)).isDefined()}}let h=class CreateRelationshipChangeUseCase extends p.UseCase{constructor(t,r,a){super(a),this.relationshipsController=t,this.accountController=r}async executeInternal(t){return c.Result.fail(p.RuntimeErrors.general.notImplemented())}};h=i([l(0,d.Inject),l(1,d.Inject),l(2,d.Inject),o("design:paramtypes",[u.RelationshipsController,u.AccountController,CreateRelationshipChangeRequestValidator])],h),r.CreateRelationshipChangeUseCase=h},59456:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetRelationshipUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049),h=a(94316);class GetRelationshipRequestValidator extends p.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.id)).fulfills(p.IdValidator.required(u.BackboneIds.relationship))}}let m=class GetRelationshipUseCase extends p.UseCase{constructor(t,r){super(r),this.relationshipsController=t}async executeInternal(t){const r=await this.relationshipsController.getRelationship(u.CoreId.from(t.id));return r?c.Result.ok(h.RelationshipMapper.toRelationshipDTO(r)):c.Result.fail(p.RuntimeErrors.general.recordNotFound(u.Relationship))}};m=i([l(0,d.Inject),l(1,d.Inject),o("design:paramtypes",[u.RelationshipsController,GetRelationshipRequestValidator])],m),r.GetRelationshipUseCase=m},90215:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetRelationshipByAddressUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049),h=a(94316);class GetRelationshipByAddressRequestValidator extends p.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.address)).fulfills(p.AddressValidator.required())}}let m=class GetRelationshipByAddressUseCase extends p.UseCase{constructor(t,r){super(r),this.relationshipsController=t}async executeInternal(t){const r=await this.relationshipsController.getRelationshipToIdentity(u.CoreAddress.from(t.address));return r?c.Result.ok(h.RelationshipMapper.toRelationshipDTO(r)):c.Result.fail(p.RuntimeErrors.general.recordNotFound(u.Relationship))}};m=i([l(0,d.Inject),l(1,d.Inject),o("design:paramtypes",[u.RelationshipsController,GetRelationshipByAddressRequestValidator])],m),r.GetRelationshipByAddressUseCase=m},73457:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetRelationshipsUseCase=void 0;const c=a(92937),u=a(75172),d=a(19663),p=a(94714),h=a(7071),m=a(7049),y=a(94316);let g=class GetRelationshipsUseCase extends m.UseCase{constructor(t,r){super(r),this.relationshipsController=t}async executeInternal(t){const r=GetRelationshipsUseCase.queryTranslator.parse(t.query),a=await this.relationshipsController.getRelationships(r);return u.Result.ok(y.RelationshipMapper.toRelationshipDTOList(a))}};g.queryTranslator=new c.QueryTranslator({whitelist:{[(0,p.nameof)((t=>t.lastMessageReceivedAt))]:!0,[(0,p.nameof)((t=>t.lastMessageSentAt))]:!0,[(0,p.nameof)((t=>t.peer))]:!0,[(0,p.nameof)((t=>t.status))]:!0,[`${(0,p.nameof)((t=>t.template))}.${(0,p.nameof)((t=>t.id))}`]:!0},alias:{[(0,p.nameof)((t=>t.lastMessageReceivedAt))]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.lastMessageReceivedAt))}`,[(0,p.nameof)((t=>t.lastMessageSentAt))]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.lastMessageSentAt))}`,[`${(0,p.nameof)((t=>t.template))}.${(0,p.nameof)((t=>t.id))}`]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.template))}.${(0,p.nameof)((t=>t.id))}`,[(0,p.nameof)((t=>t.peer))]:(0,p.nameof)((t=>t.peer)),[(0,p.nameof)((t=>t.status))]:(0,p.nameof)((t=>t.status)),[(0,p.nameof)((t=>t.peer))]:`${(0,p.nameof)((t=>t.peer))}.${(0,p.nameof)((t=>t.address))}`}}),g=i([l(0,h.Inject),l(1,h.Inject),o("design:paramtypes",[d.RelationshipsController,m.RuntimeValidator])],g),r.GetRelationshipsUseCase=g},42214:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.RejectRelationshipChangeUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(42205),h=a(7049),m=a(94316);class RejectRelationshipChangeRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.relationshipId)).fulfills(h.IdValidator.required(u.BackboneIds.relationship)),this.validateIfString((t=>t.changeId)).fulfills(h.IdValidator.required(u.BackboneIds.relationshipChange))}}let y=class RejectRelationshipChangeUseCase extends h.UseCase{constructor(t,r,a,i,o){super(o),this.relationshipsController=t,this.accountController=r,this.identityController=a,this.eventBus=i}async executeInternal(t){const r=await this.relationshipsController.getRelationship(u.CoreId.from(t.relationshipId));if(!r)return c.Result.fail(h.RuntimeErrors.general.recordNotFound(u.Relationship));if(!r.cache)return c.Result.fail(h.RuntimeErrors.general.cacheEmpty(u.Relationship,r.id.toString()));const a=r.cache.changes.find((r=>r.id.toString()===t.changeId));if(!a)return c.Result.fail(h.RuntimeErrors.general.recordNotFound(u.RelationshipChange));const i=await this.relationshipsController.rejectChange(a,t.content),o=m.RelationshipMapper.toRelationshipDTO(i);return this.eventBus.publish(new p.RelationshipChangedEvent(this.identityController.identity.address.toString(),o)),await this.accountController.syncDatawallet(),c.Result.ok(o)}};y=i([l(0,d.Inject),l(1,d.Inject),l(2,d.Inject),l(3,d.Inject),l(4,d.Inject),o("design:paramtypes",[u.RelationshipsController,u.AccountController,u.IdentityController,c.EventBus,RejectRelationshipChangeRequestValidator])],y),r.RejectRelationshipChangeUseCase=y},94316:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.RelationshipMapper=void 0;const i=a(19663),o=a(7049),l=a(58434);r.RelationshipMapper=class RelationshipMapper{static toRelationshipDTO(t){var r,a;if(!t.cache)throw o.RuntimeErrors.general.cacheEmpty(i.Relationship,t.id.toString());return{id:t.id.toString(),template:l.RelationshipTemplateMapper.toRelationshipTemplateDTO(t.cache.template),status:t.status,peer:t.peer.address.toString(),peerIdentity:{address:t.peer.address.toString(),publicKey:t.peer.publicKey.toString(),realm:t.peer.realm},changes:t.cache.changes.map((t=>this.toRelationshipChangeDTO(t))),lastMessageSentAt:null===(r=t.cache.lastMessageSentAt)||void 0===r?void 0:r.toString(),lastMessageReceivedAt:null===(a=t.cache.lastMessageReceivedAt)||void 0===a?void 0:a.toString()}}static toRelationshipDTOList(t){return t.map((t=>this.toRelationshipDTO(t)))}static toRelationshipChangeRequestDTO(t){var r;return{createdBy:t.createdBy.toString(),createdByDevice:t.createdByDevice.toString(),createdAt:t.createdAt.toString(),content:null===(r=t.content)||void 0===r?void 0:r.toJSON()}}static toRelationshipChangeResponseDTO(t){var r;return{createdBy:t.createdBy.toString(),createdByDevice:t.createdByDevice.toString(),createdAt:t.createdAt.toString(),content:null===(r=t.content)||void 0===r?void 0:r.toJSON()}}static toRelationshipChangeDTO(t){return{id:t.id.toString(),request:this.toRelationshipChangeRequestDTO(t.request),status:t.status,type:t.type,response:t.response?this.toRelationshipChangeResponseDTO(t.response):void 0}}}},5261:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.RevokeRelationshipChangeUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(42205),h=a(7049),m=a(94316);class RevokeRelationshipChangeRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.relationshipId)).fulfills(h.IdValidator.required(u.BackboneIds.relationship)),this.validateIfString((t=>t.changeId)).fulfills(h.IdValidator.required(u.BackboneIds.relationshipChange))}}let y=class RevokeRelationshipChangeUseCase extends h.UseCase{constructor(t,r,a,i,o){super(o),this.relationshipsController=t,this.accountController=r,this.eventBus=a,this.identityController=i}async executeInternal(t){const r=await this.relationshipsController.getRelationship(u.CoreId.from(t.relationshipId));if(!r)return c.Result.fail(h.RuntimeErrors.general.recordNotFound(u.Relationship));if(!r.cache)return c.Result.fail(h.RuntimeErrors.general.cacheEmpty(u.Relationship,r.id.toString()));const a=r.cache.changes.find((r=>r.id.toString()===t.changeId));if(!a)return c.Result.fail(h.RuntimeErrors.general.recordNotFound(u.RelationshipChange));const i=await this.relationshipsController.revokeChange(a,t.content),o=m.RelationshipMapper.toRelationshipDTO(i);return this.eventBus.publish(new p.RelationshipChangedEvent(this.identityController.identity.address.toString(),o)),await this.accountController.syncDatawallet(),c.Result.ok(o)}};y=i([l(0,d.Inject),l(1,d.Inject),l(2,d.Inject),l(3,d.Inject),l(4,d.Inject),o("design:paramtypes",[u.RelationshipsController,u.AccountController,c.EventBus,u.IdentityController,RevokeRelationshipChangeRequestValidator])],y),r.RevokeRelationshipChangeUseCase=y},7831:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(63018),r),o(a(83986),r),o(a(57619),r),o(a(59456),r),o(a(90215),r),o(a(73457),r),o(a(42214),r),o(a(94316),r),o(a(5261),r)},10429:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CreateOwnTokenUseCase=void 0;const c=a(90194),u=a(75172),d=a(19663),p=a(99490),h=a(7071),m=a(7049),y=a(57121);class CreateOwnTokenRequestValidator extends m.RuntimeValidator{constructor(){super(),this.validateIfAny((t=>t.content)).isNotNull(),this.validateIf((t=>t.expiresAt)).isNotNull(),this.validateIf((t=>t.expiresAt)).fulfills(m.DateValidator.required()),this.validateIf((t=>t.expiresAt)).fulfills((t=>p.DateTime.fromISO(t)>p.DateTime.utc())).withFailureMessage("'$propertyName' must be in the future."),this.validateIfAny((t=>t.ephemeral)).isNotNull()}}let g=class CreateOwnTokenUseCase extends m.UseCase{constructor(t,r,a){super(a),this.tokenController=t,this.accountController=r}async executeInternal(t){let r;try{r=await c.SerializableAsync.from(t.content)}catch{throw m.RuntimeErrors.general.invalidTokenContent()}const a=await this.tokenController.sendToken({content:r,expiresAt:d.CoreDate.from(t.expiresAt),ephemeral:t.ephemeral});return t.ephemeral||await this.accountController.syncDatawallet(),u.Result.ok(await y.TokenMapper.toTokenDTO(a,t.ephemeral))}};g=i([l(0,h.Inject),l(1,h.Inject),l(2,h.Inject),o("design:paramtypes",[d.TokenController,d.AccountController,CreateOwnTokenRequestValidator])],g),r.CreateOwnTokenUseCase=g},37896:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetQRCodeForTokenUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049);class GetQRCodeForTokenRequestValidator extends p.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.id)).fulfills(p.IdValidator.required(u.BackboneIds.token))}}let h=class GetQRCodeForTokenUseCase extends p.UseCase{constructor(t,r){super(r),this.tokenController=t}async executeInternal(t){const r=await this.tokenController.getToken(u.CoreId.from(t.id));if(!r)return c.Result.fail(p.RuntimeErrors.general.recordNotFound(u.Token));const a=await p.QRCode.from(await r.truncate());return c.Result.ok({qrCodeBytes:a.asBase64()})}};h=i([l(0,d.Inject),l(1,d.Inject),o("design:paramtypes",[u.TokenController,GetQRCodeForTokenRequestValidator])],h),r.GetQRCodeForTokenUseCase=h},50858:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetTokenUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049),h=a(57121);class GetTokenRequestValidator extends p.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.id)).fulfills(p.IdValidator.required(u.BackboneIds.token))}}let m=class GetTokenUseCase extends p.UseCase{constructor(t,r){super(r),this.tokenController=t}async executeInternal(t){const r=await this.tokenController.getToken(u.CoreId.from(t.id));return r?c.Result.ok(await h.TokenMapper.toTokenDTO(r,!1)):c.Result.fail(p.RuntimeErrors.general.recordNotFound("Token"))}};m=i([l(0,d.Inject),l(1,d.Inject),o("design:paramtypes",[u.TokenController,GetTokenRequestValidator])],m),r.GetTokenUseCase=m},82093:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetTokensUseCase=void 0;const c=a(92937),u=a(75172),d=a(19663),p=a(94714),h=a(7071),m=a(7049),y=a(57121);let g=class GetTokensUseCase extends m.UseCase{constructor(t,r){super(r),this.tokenController=t}async executeInternal(t){const r=GetTokensUseCase.queryTranslator.parse(t.query);t.ownerRestriction&&(r[(0,p.nameof)((t=>t.isOwn))]=t.ownerRestriction===m.OwnerRestriction.Own);const a=await this.tokenController.getTokens(r);return u.Result.ok(await y.TokenMapper.toTokenDTOList(a,!1))}};g.queryTranslator=new c.QueryTranslator({whitelist:{[(0,p.nameof)((t=>t.createdAt))]:!0,[(0,p.nameof)((t=>t.createdBy))]:!0,[(0,p.nameof)((t=>t.createdByDevice))]:!0,[(0,p.nameof)((t=>t.expiresAt))]:!0},alias:{[(0,p.nameof)((t=>t.createdAt))]:`${(0,p.nameof)((t=>t.cache))}.${[(0,p.nameof)((t=>t.createdAt))]}`,[(0,p.nameof)((t=>t.createdBy))]:`${(0,p.nameof)((t=>t.cache))}.${[(0,p.nameof)((t=>t.createdBy))]}`,[(0,p.nameof)((t=>t.createdByDevice))]:`${(0,p.nameof)((t=>t.cache))}.${[(0,p.nameof)((t=>t.createdByDevice))]}`,[(0,p.nameof)((t=>t.expiresAt))]:`${(0,p.nameof)((t=>t.cache))}.${[(0,p.nameof)((t=>t.expiresAt))]}`}}),g=i([l(0,h.Inject),l(1,h.Inject),o("design:paramtypes",[d.TokenController,m.RuntimeValidator])],g),r.GetTokensUseCase=g},28442:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.LoadPeerTokenUseCase=void 0;const c=a(75172),u=a(82890),d=a(19663),p=a(7071),h=a(7049),m=a(57121);class LoadPeerTokenRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIf((t=>t)).fulfills((t=>isCreateTokenFromIdAndKeyRequest(t)||isCreateTokenFromReferenceRequest(t))).withFailureCode(h.RuntimeErrors.general.invalidPayload().code).withFailureMessage(h.RuntimeErrors.general.invalidPayload().message),this.setupRulesForCreateTokenFromReferenceRequest(),this.setupRulesForCreateTokenFromIdAndKeyRequest(),this.validateIfAny((t=>t.ephemeral)).isNotNull()}setupRulesForCreateTokenFromReferenceRequest(){this.validateIfString((t=>t.reference)).isNotNull().when(isCreateTokenFromReferenceRequest)}setupRulesForCreateTokenFromIdAndKeyRequest(){this.validateIfString((t=>t.id)).fulfills(h.IdValidator.required(d.BackboneIds.token)).when(isCreateTokenFromIdAndKeyRequest),this.validateIfString((t=>t.secretKey)).isNotNull().when(isCreateTokenFromIdAndKeyRequest)}}function isCreateTokenFromReferenceRequest(t){return!!t.reference}function isCreateTokenFromIdAndKeyRequest(t){return!!t.id&&!!t.secretKey}let y=class LoadPeerTokenUseCase extends h.UseCase{constructor(t,r,a){super(a),this.tokenController=t,this.accountController=r}async executeInternal(t){let r;if(t.id&&t.secretKey){const a=await u.CryptoSecretKey.fromBase64(t.secretKey);r=await this.tokenController.loadPeerToken(d.CoreId.from(t.id),a,t.ephemeral)}else{if(!t.reference)return c.Result.fail(h.RuntimeErrors.general.invalidPayload());r=await this.tokenController.loadPeerTokenByTruncated(t.reference,t.ephemeral)}return t.ephemeral||await this.accountController.syncDatawallet(),c.Result.ok(await m.TokenMapper.toTokenDTO(r,t.ephemeral))}};y=i([l(0,p.Inject),l(1,p.Inject),l(2,p.Inject),o("design:paramtypes",[d.TokenController,d.AccountController,LoadPeerTokenRequestValidator])],y),r.LoadPeerTokenUseCase=y},57121:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.TokenMapper=void 0;const i=a(19663),o=a(7049);class TokenMapper{static async toTokenDTO(t,r){if(!t.cache)throw o.RuntimeErrors.general.cacheEmpty(i.Token,t.id.toString());const a=await t.toTokenReference();return{id:t.id.toString(),createdBy:t.cache.createdBy.toString(),createdByDevice:t.cache.createdByDevice.toString(),content:t.cache.content.toJSON(),createdAt:t.cache.createdAt.toString(),expiresAt:t.cache.expiresAt.toString(),secretKey:t.secretKey.toBase64(),truncatedReference:a.truncate(),isEphemeral:r}}static async toTokenDTOList(t,r){return await Promise.all(t.map((t=>TokenMapper.toTokenDTO(t,r))))}}r.TokenMapper=TokenMapper},25631:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(10429),r),o(a(37896),r),o(a(50858),r),o(a(82093),r),o(a(28442),r),o(a(57121),r)},79126:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.QueryTranslator=void 0;class QueryTranslator{static defaultKeyRegex=/^[A-z_@][A-z@0-9-_]*(\.[A-z_@][A-z@0-9-_]*)*$/;static defaultValRegex=void 0;static defaultArrRegex=/^[a-zæøå0-9-_.]+(\[])?$/i;ops;alias;blacklist;whitelist;custom;string;keyRegex;valRegex;arrRegex;constructor(t={}){this.ops=t.ops??["!","^","$","~",">","<","$in"],this.alias=t.alias??{},this.blacklist=t.blacklist??{},this.whitelist=t.whitelist??{},this.custom=t.custom??{},t.string=t.string??{},this.string=t.string,this.string.toBoolean="boolean"!=typeof t.string.toBoolean||t.string.toBoolean,this.string.toNumber="boolean"!=typeof t.string.toNumber||t.string.toNumber,this.keyRegex=t.keyRegex??QueryTranslator.defaultKeyRegex,this.valRegex=t.valRegex??QueryTranslator.defaultValRegex,this.arrRegex=t.arrRegex??QueryTranslator.defaultArrRegex}static setDefaultKeyRegex(t){QueryTranslator.defaultKeyRegex=t}static setDefaultValRegex(t){QueryTranslator.defaultValRegex=t}static setDefaultArrRegex(t){QueryTranslator.defaultArrRegex=t}parseString(t,r){let a=t[0]||"";const i="="===t[1];let o=t.substr(i?2:1)||"";const l=this.parseStringVal(o),c={op:a,org:o,value:l};switch(a){case"!":r?c.field="$nin":""===o?(c.field="$exists",c.value=!1):c.field="$ne";break;case">":c.field=i?"$gte":"$gt";break;case"<":c.field=i?"$lte":"$lt";break;case"^":case"$":case"~":switch(c.field="$regex",c.options="i",c.value=this.valRegex?o.replace(this.valRegex,""):c.value.toString(),a){case"^":c.value=`^${l}`;break;case"$":c.value=`${l}$`}break;default:c.org=o=a+o,c.op=a="",c.value=this.parseStringVal(o),r?c.field="$in":""===o?(c.field="$exists",c.value=!0):c.field="$eq"}return c.parsed={},c.parsed[c.field]=c.value,c.options&&(c.parsed.$options=c.options),c}parseStringVal(t){return!(!this.string.toBoolean||"true"!==t.toLowerCase())||(!this.string.toBoolean||"false"!==t.toLowerCase())&&(this.string.toNumber&&!isNaN(parseInt(t,10))&&+t-+t+1>=0?parseFloat(t):t)}parse(t){if(!t)return{};const r={};for(let a of Object.keys(t)){const i=t[a];if(Array.isArray(i)&&(a=a.replace(/\[]$/,"")),(!Object.keys(this.whitelist).length||this.whitelist[a])&&!this.blacklist[a]&&(this.alias[a]&&(a=this.alias[a]),("string"!=typeof i||this.keyRegex.test(a))&&(!Array.isArray(i)||this.arrRegex.test(a))))if("function"!=typeof this.custom[a])if(Array.isArray(i)){if(this.ops.includes("$in")&&i.length>0){r[a]={};for(const t of i)if(this.ops.includes(t[0])){const i=this.parseString(t,!0);switch(i.field){case"$in":case"$nin":r[a][i.field]=r[a][i.field]||[],r[a][i.field].push(i.value);break;case"$regex":r[a].$regex=i.value,r[a].$options=i.options;break;default:r[a][i.field]=i.value}}else r[a].$in=r[a].$in||[],r[a].$in.push(this.parseStringVal(t))}}else"string"==typeof i&&(i?this.ops.includes(i[0])?r[a]=this.parseString(i).parsed:r[a]=this.parseStringVal(i):r[a]={$exists:!0});else this.custom[a].apply(null,[r,i])}return r}}r.QueryTranslator=QueryTranslator},92937:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.QueryTranslator=void 0;var i=a(79126);Object.defineProperty(r,"QueryTranslator",{enumerable:!0,get:function(){return i.QueryTranslator}})},71174:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},29159:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.getEventNamespaceFromObject=r.EventBus=void 0;r.EventBus=class EventBus{},r.getEventNamespaceFromObject=function getEventNamespaceFromObject(t){return t.namespace}},95970:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.SubscriptionTargetInfo=void 0;class SubscriptionTargetInfo{namespace;constructor(t){this.namespace=t}static from(t){return t instanceof Function?new ConstructorSubscriptionTargetInfo(t):new NamespaceSubscriptionTargetInfo(t)}}r.SubscriptionTargetInfo=SubscriptionTargetInfo;class ConstructorSubscriptionTargetInfo extends SubscriptionTargetInfo{constructorFunction;constructor(t){super(function getEventNamespaceFromClass(t){return t.namespace}(t)),this.constructorFunction=t}isCompatibleWith(t){return t instanceof this.constructorFunction}}class NamespaceSubscriptionTargetInfo extends SubscriptionTargetInfo{constructor(t){super(t)}isCompatibleWith(t){return!0}}},69729:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.EventEmitter2EventBus=void 0;const i=a(56387);a(28660);const o=a(29159),l=a(95970);r.EventEmitter2EventBus=class EventEmitter2EventBus{emitter;wrappers=new Map;nextId=0;constructor(){this.emitter=new i.EventEmitter2({wildcard:!0,maxListeners:50,verboseMemoryLeak:!0})}subscribe(t,r){return this.registerHandler(t,r)}subscribeOnce(t,r){return this.registerHandler(t,r,!0)}unsubscribe(t,r){return this.unregisterHandler(t,r)}registerHandler(t,r,a=!1){const i=l.SubscriptionTargetInfo.from(t),o=this.nextId++,handlerWrapper=l=>{i.isCompatibleWith(l)&&(r(l),a&&this.unsubscribe(t,o))};return this.wrappers.set(o,handlerWrapper),this.emitter.on(i.namespace,handlerWrapper),o}unregisterHandler(t,r){const a=l.SubscriptionTargetInfo.from(t),i=this.wrappers.get(r);return!!i&&(this.emitter.off(a.namespace,i),this.wrappers.delete(r),!0)}publish(t){const r=(0,o.getEventNamespaceFromObject)(t);if(!r)throw Error("The event needs a namespace. Use the EventNamespace-decorator in order to define a namespace for a event.");this.emitter.emit(r,t)}}},9256:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(29159),r),o(a(69729),r)},35917:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.DataEvent=void 0;const i=a(28267);class DataEvent extends i.Event{data;constructor(t,r){super(t),this.data=r}}r.DataEvent=DataEvent},28267:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.Event=void 0;r.Event=class Event{namespace;constructor(t){this.namespace=t}}},42636:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(35917),r),o(a(28267),r)},75172:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(9256),r),o(a(42636),r),o(a(9855),r),o(a(81809),r),o(a(44569),r),o(a(71174),r),o(a(17226),r),o(a(77374),r)},9855:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.log=void 0,r.log=function log(t,r,a){const i=a.value;return a.value=function(...t){const a=t.map((t=>JSON.stringify(t))).join();try{const o=i.apply(this,t),l=JSON.stringify(o);return console.log(`Call: ${r}(${a}) => ${l}`),o}catch(t){throw console.log(t),t}},a}},81809:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.measureExcecutionTime=void 0,r.measureExcecutionTime=function measureExcecutionTime(t,r,a){const i=a.value;return a.value=async function(...t){const r=Date.now(),a=await i.apply(this,t),o=Date.now();return console.info(`Execution time: ${o-r}ms`),a},a}},44569:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.randomString=void 0,r.randomString=function randomString(t,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"){let a="";const i=r.length;for(let o=0;o<t;o++)a+=r.charAt(Math.floor(Math.random()*i));return a}},77807:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.ApplicationError=void 0;class ApplicationError extends Error{code;data;constructor(t,r,a){super(r),this.code=t,this.data=a}equals(t){return this.code===t.code}}r.ApplicationError=ApplicationError},19278:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.Result=void 0;class Result{_isSuccess;_error;_value;constructor(t,r,a){if(t&&a)throw new Error("InvalidOperation: A result cannot be successful and contain an error");if(!t&&!a)throw new Error("InvalidOperation: A failing result needs to contain an error");if(void 0!==r&&!t)throw new Error("InvalidOperation: A value is only useful in case of a success.");this._value=r,this._isSuccess=t,this._error=a}get isSuccess(){return this._isSuccess}get isError(){return!this._isSuccess}get error(){return this._error}get value(){if(!this.isSuccess)throw new Error("Can't get the value of an error result. Use 'error' instead.");return this._value}static ok(t){return new Result(!0,t)}static fail(t){return new Result(!1,void 0,t)}}r.Result=Result},17226:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(77807),r),o(a(19278),r)},77374:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.sleep=void 0,r.sleep=function sleep(t){return new Promise((r=>{setTimeout(r,t)}))}},33351:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});const i=a(1581),o=a(93487),l=a(57023),c=a(74815),u=a(4181),d=a(22141),p="errorMessage",h=new i.Name("emUsed"),m={required:"missingProperty",dependencies:"property",dependentRequired:"property"},y=/\$\{[^}]+\}/,g=/\$\{([^}]+)\}/g,v=/^""\s*\+\s*|\s*\+\s*""$/g;function errorMessage(t){return{keyword:p,schemaType:["string","object"],post:!0,code(r){const{gen:a,data:b,schema:R,schemaValue:C,it:I}=r;if(!1===I.createErrors)return;const w=R,S=o.strConcat(d.default.instancePath,I.errorPath);function matchKeywordError(t,r){return o.and(i._`${t}.keyword !== ${p}`,i._`!${t}.${h}`,i._`${t}.instancePath === ${S}`,i._`${t}.keyword in ${r}`,i._`${t}.schemaPath.indexOf(${I.errSchemaPath}) === 0`,i._`/^\\/[^\\/]*$/.test(${t}.schemaPath.slice(${I.errSchemaPath.length}))`)}function getTemplatesCode(t,r){const i=[];for(const a in t){const t=r[a];y.test(t)&&i.push([a,templateFunc(t)])}return a.object(...i)}function templateExpr(t){return y.test(t)?new l._Code(l.safeStringify(t).replace(g,((t,r)=>`" + JSON.stringify(${c.getData(r,I)}) + "`)).replace(v,"")):i.stringify(t)}function templateFunc(t){return i._`function(){return ${templateExpr(t)}}`}a.if(i._`${d.default.errors} > 0`,(()=>{if("object"==typeof w){const[l,c]=function keywordErrorsConfig(t){let r,a;for(const i in t){if("properties"===i||"items"===i)continue;const o=t[i];if("object"==typeof o){r||(r={});const t=r[i]={};for(const r in o)t[r]=[]}else a||(a={}),a[i]=[]}return[r,a]}(w);c&&function processKeywordErrors(o){const l=a.const("emErrors",i.stringify(o)),c=a.const("templates",getTemplatesCode(o,R));a.forOf("err",d.default.vErrors,(t=>a.if(matchKeywordError(t,l),(()=>a.code(i._`${l}[${t}.keyword].push(${t})`).assign(i._`${t}.${h}`,!0)))));const{singleError:p}=t;if(p){const t=a.let("message",i._`""`),o=a.let("paramsErrors",i._`[]`);loopErrors((r=>{a.if(t,(()=>a.code(i._`${t} += ${"string"==typeof p?p:";"}`))),a.code(i._`${t} += ${errMessage(r)}`),a.assign(o,i._`${o}.concat(${l}[${r}])`)})),u.reportError(r,{message:t,params:i._`{errors: ${o}}`})}else loopErrors((t=>u.reportError(r,{message:errMessage(t),params:i._`{errors: ${l}[${t}]}`})));function loopErrors(t){a.forIn("key",l,(r=>a.if(i._`${l}[${r}].length`,(()=>t(r)))))}function errMessage(t){return i._`${t} in ${c} ? ${c}[${t}]() : ${C}[${t}]`}}(c),l&&function processKeywordPropErrors(t){const o=a.const("emErrors",i.stringify(t)),l=[];for(const r in t)l.push([r,getTemplatesCode(t[r],R[r])]);const c=a.const("templates",a.object(...l)),p=a.scopeValue("obj",{ref:m,code:i.stringify(m)}),y=a.let("emPropParams"),g=a.let("emParamsErrors");a.forOf("err",d.default.vErrors,(t=>a.if(matchKeywordError(t,o),(()=>{a.assign(y,i._`${p}[${t}.keyword]`),a.assign(g,i._`${o}[${t}.keyword][${t}.params[${y}]]`),a.if(g,(()=>a.code(i._`${g}.push(${t})`).assign(i._`${t}.${h}`,!0)))})))),a.forIn("key",o,(t=>a.forIn("keyProp",i._`${o}[${t}]`,(l=>{a.assign(g,i._`${o}[${t}][${l}]`),a.if(i._`${g}.length`,(()=>{const o=a.const("tmpl",i._`${c}[${t}] && ${c}[${t}][${l}]`);u.reportError(r,{message:i._`${o} ? ${o}() : ${C}[${t}][${l}]`,params:i._`{errors: ${g}}`})}))}))))}(l),function processChildErrors(t){const{props:l,items:c}=t;if(!l&&!c)return;const m=i._`typeof ${b} == "object"`,y=i._`Array.isArray(${b})`,g=a.let("emErrors");let v,I;const w=a.let("templates");l&&c?(v=a.let("emChildKwd"),a.if(m),a.if(y,(()=>{init(c,R.items),a.assign(v,i.str`items`)}),(()=>{init(l,R.properties),a.assign(v,i.str`properties`)})),I=i._`[${v}]`):c?(a.if(y),init(c,R.items),I=i._`.items`):l&&(a.if(o.and(m,o.not(y))),init(l,R.properties),I=i._`.properties`);function init(t,r){a.assign(g,i.stringify(t)),a.assign(w,getTemplatesCode(t,r))}a.forOf("err",d.default.vErrors,(t=>function ifMatchesChildError(t,r,l){a.if(o.and(i._`${t}.keyword !== ${p}`,i._`!${t}.${h}`,i._`${t}.instancePath.indexOf(${S}) === 0`),(()=>{const o=a.scopeValue("pattern",{ref:/^\/([^/]*)(?:\/|$)/,code:i._`new RegExp("^\\\/([^/]*)(?:\\\/|$)")`}),c=a.const("emMatches",i._`${o}.exec(${t}.instancePath.slice(${S}.length))`),u=a.const("emChild",i._`${c} && ${c}[1].replace(/~1/g, "/").replace(/~0/g, "~")`);a.if(i._`${u} !== undefined && ${u} in ${r}`,(()=>l(u)))}))}(t,g,(r=>a.code(i._`${g}[${r}].push(${t})`).assign(i._`${t}.${h}`,!0))))),a.forIn("key",g,(t=>a.if(i._`${g}[${t}].length`,(()=>{u.reportError(r,{message:i._`${t} in ${w} ? ${w}[${t}]() : ${C}${I}[${t}]`,params:i._`{errors: ${g}[${t}]}`}),a.assign(i._`${d.default.vErrors}[${d.default.errors}-1].instancePath`,i._`${S} + "/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`)})))),a.endIf()}(function childErrorsConfig({properties:t,items:r}){const a={};if(t){a.props={};for(const r in t)a.props[r]=[]}if(r){a.items={};for(let t=0;t<r.length;t++)a.items[t]=[]}return a}(w))}const l="string"==typeof w?w:w._;l&&function processAllErrors(t){const l=a.const("emErrs",i._`[]`);a.forOf("err",d.default.vErrors,(t=>a.if(function matchAnyError(t){return o.and(i._`${t}.keyword !== ${p}`,i._`!${t}.${h}`,o.or(i._`${t}.instancePath === ${S}`,o.and(i._`${t}.instancePath.indexOf(${S}) === 0`,i._`${t}.instancePath[${S}.length] === "/"`)),i._`${t}.schemaPath.indexOf(${I.errSchemaPath}) === 0`,i._`${t}.schemaPath[${I.errSchemaPath}.length] === "/"`)}(t),(()=>a.code(i._`${l}.push(${t})`).assign(i._`${t}.${h}`,!0))))),a.if(i._`${l}.length`,(()=>u.reportError(r,{message:templateExpr(t),params:i._`{errors: ${l}}`})))}(l),t.keepErrors||function removeUsedErrors(){const t=a.const("emErrs",i._`[]`);a.forOf("err",d.default.vErrors,(r=>a.if(i._`!${r}.${h}`,(()=>a.code(i._`${t}.push(${r})`))))),a.assign(d.default.vErrors,t).assign(d.default.errors,i._`${t}.length`)}()}))},metaSchema:{anyOf:[{type:"string"},{type:"object",properties:{properties:{$ref:"#/$defs/stringMap"},items:{$ref:"#/$defs/stringList"},required:{$ref:"#/$defs/stringOrMap"},dependencies:{$ref:"#/$defs/stringOrMap"}},additionalProperties:{type:"string"}}],$defs:{stringMap:{type:"object",additionalProperties:{type:"string"}},stringOrMap:{anyOf:[{type:"string"},{$ref:"#/$defs/stringMap"}]},stringList:{type:"array",items:{type:"string"}}}}}}const ajvErrors=(t,r={})=>{if(!t.opts.allErrors)throw new Error("ajv-errors: Ajv option allErrors must be true");if(t.opts.jsPropertySyntax)throw new Error("ajv-errors: ajv option jsPropertySyntax is not supported");return t.addKeyword(errorMessage(r))};r.default=ajvErrors,t.exports=ajvErrors,t.exports.default=ajvErrors},16870:(t,r)=>{"use strict";function fmtDef(t,r){return{validate:t,compare:r}}Object.defineProperty(r,"__esModule",{value:!0}),r.formatNames=r.fastFormats=r.fullFormats=void 0,r.fullFormats={date:fmtDef(date,compareDate),time:fmtDef(time,compareTime),"date-time":fmtDef((function date_time(t){const r=t.split(l);return 2===r.length&&date(r[0])&&time(r[1],!0)}),compareDateTime),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:function uri(t){return c.test(t)&&u.test(t)},"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:function regex(t){if(p.test(t))return!1;try{return new RegExp(t),!0}catch(t){return!1}},uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:function byte(t){return d.lastIndex=0,d.test(t)},int32:{type:"number",validate:function validateInt32(t){return Number.isInteger(t)&&t<=2147483647&&t>=-2147483648}},int64:{type:"number",validate:function validateInt64(t){return Number.isInteger(t)}},float:{type:"number",validate:validateNumber},double:{type:"number",validate:validateNumber},password:!0,binary:!0},r.fastFormats={...r.fullFormats,date:fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,compareDate),time:fmtDef(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,compareTime),"date-time":fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,compareDateTime),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},r.formatNames=Object.keys(r.fullFormats);const a=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i=[0,31,28,31,30,31,30,31,31,30,31,30,31];function date(t){const r=a.exec(t);if(!r)return!1;const o=+r[1],l=+r[2],c=+r[3];return l>=1&&l<=12&&c>=1&&c<=(2===l&&function isLeapYear(t){return t%4==0&&(t%100!=0||t%400==0)}(o)?29:i[l])}function compareDate(t,r){if(t&&r)return t>r?1:t<r?-1:0}const o=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i;function time(t,r){const a=o.exec(t);if(!a)return!1;const i=+a[1],l=+a[2],c=+a[3],u=a[5];return(i<=23&&l<=59&&c<=59||23===i&&59===l&&60===c)&&(!r||""!==u)}function compareTime(t,r){if(!t||!r)return;const a=o.exec(t),i=o.exec(r);return a&&i?(t=a[1]+a[2]+a[3]+(a[4]||""))>(r=i[1]+i[2]+i[3]+(i[4]||""))?1:t<r?-1:0:void 0}const l=/t|\s/i;function compareDateTime(t,r){if(!t||!r)return;const[a,i]=t.split(l),[o,c]=r.split(l),u=compareDate(a,o);return void 0!==u?u||compareTime(i,c):void 0}const c=/\/|:/,u=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;const d=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function validateNumber(){return!0}const p=/[^\\]\\Z/},5477:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});const i=a(16870),o=a(57963),l=a(93487),c=new l.Name("fullFormats"),u=new l.Name("fastFormats"),formatsPlugin=(t,r={keywords:!0})=>{if(Array.isArray(r))return addFormats(t,r,i.fullFormats,c),t;const[a,l]="fast"===r.mode?[i.fastFormats,u]:[i.fullFormats,c];return addFormats(t,r.formats||i.formatNames,a,l),r.keywords&&o.default(t),t};function addFormats(t,r,a,i){var o,c;null!==(o=(c=t.opts.code).formats)&&void 0!==o||(c.formats=l._`require("ajv-formats/dist/formats").${i}`);for(const i of r)t.addFormat(i,a[i])}formatsPlugin.get=(t,r="full")=>{const a=("fast"===r?i.fastFormats:i.fullFormats)[t];if(!a)throw new Error(`Unknown format "${t}"`);return a},t.exports=r=formatsPlugin,Object.defineProperty(r,"__esModule",{value:!0}),r.default=formatsPlugin},57963:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.formatLimitDefinition=void 0;const i=a(1581),o=a(93487),l=o.operators,c={formatMaximum:{okStr:"<=",ok:l.LTE,fail:l.GT},formatMinimum:{okStr:">=",ok:l.GTE,fail:l.LT},formatExclusiveMaximum:{okStr:"<",ok:l.LT,fail:l.GTE},formatExclusiveMinimum:{okStr:">",ok:l.GT,fail:l.LTE}},u={message:({keyword:t,schemaCode:r})=>o.str`should be ${c[t].okStr} ${r}`,params:({keyword:t,schemaCode:r})=>o._`{comparison: ${c[t].okStr}, limit: ${r}}`};r.formatLimitDefinition={keyword:Object.keys(c),type:"string",schemaType:"string",$data:!0,error:u,code(t){const{gen:r,data:a,schemaCode:l,keyword:u,it:d}=t,{opts:p,self:h}=d;if(!p.validateFormats)return;const m=new i.KeywordCxt(d,h.RULES.all.format.definition,"format");function compareCode(t){return o._`${t}.compare(${a}, ${l}) ${c[u].fail} 0`}m.$data?function validate$DataFormat(){const a=r.scopeValue("formats",{ref:h.formats,code:p.code.formats}),i=r.const("fmt",o._`${a}[${m.schemaCode}]`);t.fail$data(o.or(o._`typeof ${i} != "object"`,o._`${i} instanceof RegExp`,o._`typeof ${i}.compare != "function"`,compareCode(i)))}():function validateFormat(){const a=m.schema,i=h.formats[a];if(!i||!0===i)return;if("object"!=typeof i||i instanceof RegExp||"function"!=typeof i.compare)throw new Error(`"${u}": format "${a}" does not define "compare" function`);const l=r.scopeValue("formats",{key:a,ref:i,code:p.code.formats?o._`${p.code.formats}${o.getProperty(a)}`:void 0});t.fail$data(compareCode(l))}()},dependencies:["format"]};r.default=t=>(t.addKeyword(r.formatLimitDefinition),t)},1581:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.CodeGen=r.Name=r.nil=r.stringify=r.str=r._=r.KeywordCxt=void 0;const i=a(27159),o=a(93924),l=a(1240),c=a(98),u=["/properties"],d="http://json-schema.org/draft-07/schema";class Ajv extends i.default{_addVocabularies(){super._addVocabularies(),o.default.forEach((t=>this.addVocabulary(t))),this.opts.discriminator&&this.addKeyword(l.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const t=this.opts.$data?this.$dataMetaSchema(c,u):c;this.addMetaSchema(t,d,!1),this.refs["http://json-schema.org/schema"]=d}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(d)?d:void 0)}}t.exports=r=Ajv,Object.defineProperty(r,"__esModule",{value:!0}),r.default=Ajv;var p=a(74815);Object.defineProperty(r,"KeywordCxt",{enumerable:!0,get:function(){return p.KeywordCxt}});var h=a(93487);Object.defineProperty(r,"_",{enumerable:!0,get:function(){return h._}}),Object.defineProperty(r,"str",{enumerable:!0,get:function(){return h.str}}),Object.defineProperty(r,"stringify",{enumerable:!0,get:function(){return h.stringify}}),Object.defineProperty(r,"nil",{enumerable:!0,get:function(){return h.nil}}),Object.defineProperty(r,"Name",{enumerable:!0,get:function(){return h.Name}}),Object.defineProperty(r,"CodeGen",{enumerable:!0,get:function(){return h.CodeGen}})},57023:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.regexpCode=r.getEsmExportName=r.getProperty=r.safeStringify=r.stringify=r.strConcat=r.addCodeArg=r.str=r._=r.nil=r._Code=r.Name=r.IDENTIFIER=r._CodeOrName=void 0;class _CodeOrName{}r._CodeOrName=_CodeOrName,r.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class Name extends _CodeOrName{constructor(t){if(super(),!r.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}r.Name=Name;class _Code extends _CodeOrName{constructor(t){super(),this._items="string"==typeof t?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const t=this._items[0];return""===t||'""'===t}get str(){var t;return null!==(t=this._str)&&void 0!==t?t:this._str=this._items.reduce(((t,r)=>`${t}${r}`),"")}get names(){var t;return null!==(t=this._names)&&void 0!==t?t:this._names=this._items.reduce(((t,r)=>(r instanceof Name&&(t[r.str]=(t[r.str]||0)+1),t)),{})}}function _(t,...r){const a=[t[0]];let i=0;for(;i<r.length;)addCodeArg(a,r[i]),a.push(t[++i]);return new _Code(a)}r._Code=_Code,r.nil=new _Code(""),r._=_;const a=new _Code("+");function str(t,...r){const i=[safeStringify(t[0])];let o=0;for(;o<r.length;)i.push(a),addCodeArg(i,r[o]),i.push(a,safeStringify(t[++o]));return function optimize(t){let r=1;for(;r<t.length-1;){if(t[r]===a){const a=mergeExprItems(t[r-1],t[r+1]);if(void 0!==a){t.splice(r-1,3,a);continue}t[r++]="+"}r++}}(i),new _Code(i)}function addCodeArg(t,r){r instanceof _Code?t.push(...r._items):r instanceof Name?t.push(r):t.push(function interpolate(t){return"number"==typeof t||"boolean"==typeof t||null===t?t:safeStringify(Array.isArray(t)?t.join(","):t)}(r))}function mergeExprItems(t,r){if('""'===r)return t;if('""'===t)return r;if("string"==typeof t){if(r instanceof Name||'"'!==t[t.length-1])return;return"string"!=typeof r?`${t.slice(0,-1)}${r}"`:'"'===r[0]?t.slice(0,-1)+r.slice(1):void 0}return"string"!=typeof r||'"'!==r[0]||t instanceof Name?void 0:`"${t}${r.slice(1)}`}function safeStringify(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}r.str=str,r.addCodeArg=addCodeArg,r.strConcat=function strConcat(t,r){return r.emptyStr()?t:t.emptyStr()?r:str`${t}${r}`},r.stringify=function stringify(t){return new _Code(safeStringify(t))},r.safeStringify=safeStringify,r.getProperty=function getProperty(t){return"string"==typeof t&&r.IDENTIFIER.test(t)?new _Code(`.${t}`):_`[${t}]`},r.getEsmExportName=function getEsmExportName(t){if("string"==typeof t&&r.IDENTIFIER.test(t))return new _Code(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)},r.regexpCode=function regexpCode(t){return new _Code(t.toString())}},93487:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.or=r.and=r.not=r.CodeGen=r.operators=r.varKinds=r.ValueScopeName=r.ValueScope=r.Scope=r.Name=r.regexpCode=r.stringify=r.getProperty=r.nil=r.strConcat=r.str=r._=void 0;const i=a(57023),o=a(98490);var l=a(57023);Object.defineProperty(r,"_",{enumerable:!0,get:function(){return l._}}),Object.defineProperty(r,"str",{enumerable:!0,get:function(){return l.str}}),Object.defineProperty(r,"strConcat",{enumerable:!0,get:function(){return l.strConcat}}),Object.defineProperty(r,"nil",{enumerable:!0,get:function(){return l.nil}}),Object.defineProperty(r,"getProperty",{enumerable:!0,get:function(){return l.getProperty}}),Object.defineProperty(r,"stringify",{enumerable:!0,get:function(){return l.stringify}}),Object.defineProperty(r,"regexpCode",{enumerable:!0,get:function(){return l.regexpCode}}),Object.defineProperty(r,"Name",{enumerable:!0,get:function(){return l.Name}});var c=a(98490);Object.defineProperty(r,"Scope",{enumerable:!0,get:function(){return c.Scope}}),Object.defineProperty(r,"ValueScope",{enumerable:!0,get:function(){return c.ValueScope}}),Object.defineProperty(r,"ValueScopeName",{enumerable:!0,get:function(){return c.ValueScopeName}}),Object.defineProperty(r,"varKinds",{enumerable:!0,get:function(){return c.varKinds}}),r.operators={GT:new i._Code(">"),GTE:new i._Code(">="),LT:new i._Code("<"),LTE:new i._Code("<="),EQ:new i._Code("==="),NEQ:new i._Code("!=="),NOT:new i._Code("!"),OR:new i._Code("||"),AND:new i._Code("&&"),ADD:new i._Code("+")};class Node{optimizeNodes(){return this}optimizeNames(t,r){return this}}class Def extends Node{constructor(t,r,a){super(),this.varKind=t,this.name=r,this.rhs=a}render({es5:t,_n:r}){const a=t?o.varKinds.var:this.varKind,i=void 0===this.rhs?"":` = ${this.rhs}`;return`${a} ${this.name}${i};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=optimizeExpr(this.rhs,t,r)),this}get names(){return this.rhs instanceof i._CodeOrName?this.rhs.names:{}}}class Assign extends Node{constructor(t,r,a){super(),this.lhs=t,this.rhs=r,this.sideEffects=a}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(!(this.lhs instanceof i.Name)||t[this.lhs.str]||this.sideEffects)return this.rhs=optimizeExpr(this.rhs,t,r),this}get names(){return addExprNames(this.lhs instanceof i.Name?{}:{...this.lhs.names},this.rhs)}}class AssignOp extends Assign{constructor(t,r,a,i){super(t,a,i),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}}class Label extends Node{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}}class Break extends Node{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}}class Throw extends Node{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}}class AnyCode extends Node{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,r){return this.code=optimizeExpr(this.code,t,r),this}get names(){return this.code instanceof i._CodeOrName?this.code.names:{}}}class ParentNode extends Node{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce(((r,a)=>r+a.render(t)),"")}optimizeNodes(){const{nodes:t}=this;let r=t.length;for(;r--;){const a=t[r].optimizeNodes();Array.isArray(a)?t.splice(r,1,...a):a?t[r]=a:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){const{nodes:a}=this;let i=a.length;for(;i--;){const o=a[i];o.optimizeNames(t,r)||(subtractNames(t,o.names),a.splice(i,1))}return a.length>0?this:void 0}get names(){return this.nodes.reduce(((t,r)=>addNames(t,r.names)),{})}}class BlockNode extends ParentNode{render(t){return"{"+t._n+super.render(t)+"}"+t._n}}class Root extends ParentNode{}class Else extends BlockNode{}Else.kind="else";class If extends BlockNode{constructor(t,r){super(r),this.condition=t}render(t){let r=`if(${this.condition})`+super.render(t);return this.else&&(r+="else "+this.else.render(t)),r}optimizeNodes(){super.optimizeNodes();const t=this.condition;if(!0===t)return this.nodes;let r=this.else;if(r){const t=r.optimizeNodes();r=this.else=Array.isArray(t)?new Else(t):t}return r?!1===t?r instanceof If?r:r.nodes:this.nodes.length?this:new If(not(t),r instanceof If?[r]:r.nodes):!1!==t&&this.nodes.length?this:void 0}optimizeNames(t,r){var a;if(this.else=null===(a=this.else)||void 0===a?void 0:a.optimizeNames(t,r),super.optimizeNames(t,r)||this.else)return this.condition=optimizeExpr(this.condition,t,r),this}get names(){const t=super.names;return addExprNames(t,this.condition),this.else&&addNames(t,this.else.names),t}}If.kind="if";class For extends BlockNode{}For.kind="for";class ForLoop extends For{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iteration=optimizeExpr(this.iteration,t,r),this}get names(){return addNames(super.names,this.iteration.names)}}class ForRange extends For{constructor(t,r,a,i){super(),this.varKind=t,this.name=r,this.from=a,this.to=i}render(t){const r=t.es5?o.varKinds.var:this.varKind,{name:a,from:i,to:l}=this;return`for(${r} ${a}=${i}; ${a}<${l}; ${a}++)`+super.render(t)}get names(){const t=addExprNames(super.names,this.from);return addExprNames(t,this.to)}}class ForIter extends For{constructor(t,r,a,i){super(),this.loop=t,this.varKind=r,this.name=a,this.iterable=i}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iterable=optimizeExpr(this.iterable,t,r),this}get names(){return addNames(super.names,this.iterable.names)}}class Func extends BlockNode{constructor(t,r,a){super(),this.name=t,this.args=r,this.async=a}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}}Func.kind="func";class Return extends ParentNode{render(t){return"return "+super.render(t)}}Return.kind="return";class Try extends BlockNode{render(t){let r="try"+super.render(t);return this.catch&&(r+=this.catch.render(t)),this.finally&&(r+=this.finally.render(t)),r}optimizeNodes(){var t,r;return super.optimizeNodes(),null===(t=this.catch)||void 0===t||t.optimizeNodes(),null===(r=this.finally)||void 0===r||r.optimizeNodes(),this}optimizeNames(t,r){var a,i;return super.optimizeNames(t,r),null===(a=this.catch)||void 0===a||a.optimizeNames(t,r),null===(i=this.finally)||void 0===i||i.optimizeNames(t,r),this}get names(){const t=super.names;return this.catch&&addNames(t,this.catch.names),this.finally&&addNames(t,this.finally.names),t}}class Catch extends BlockNode{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}}Catch.kind="catch";class Finally extends BlockNode{render(t){return"finally"+super.render(t)}}Finally.kind="finally";function addNames(t,r){for(const a in r)t[a]=(t[a]||0)+(r[a]||0);return t}function addExprNames(t,r){return r instanceof i._CodeOrName?addNames(t,r.names):t}function optimizeExpr(t,r,a){return t instanceof i.Name?replaceName(t):function canOptimize(t){return t instanceof i._Code&&t._items.some((t=>t instanceof i.Name&&1===r[t.str]&&void 0!==a[t.str]))}(t)?new i._Code(t._items.reduce(((t,r)=>(r instanceof i.Name&&(r=replaceName(r)),r instanceof i._Code?t.push(...r._items):t.push(r),t)),[])):t;function replaceName(t){const i=a[t.str];return void 0===i||1!==r[t.str]?t:(delete r[t.str],i)}}function subtractNames(t,r){for(const a in r)t[a]=(t[a]||0)-(r[a]||0)}function not(t){return"boolean"==typeof t||"number"==typeof t||null===t?!t:i._`!${par(t)}`}r.CodeGen=class CodeGen{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?"\n":""},this._extScope=t,this._scope=new o.Scope({parent:t}),this._nodes=[new Root]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,r){const a=this._extScope.value(t,r);return(this._values[a.prefix]||(this._values[a.prefix]=new Set)).add(a),a}getScopeValue(t,r){return this._extScope.getValue(t,r)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,r,a,i){const o=this._scope.toName(r);return void 0!==a&&i&&(this._constants[o.str]=a),this._leafNode(new Def(t,o,a)),o}const(t,r,a){return this._def(o.varKinds.const,t,r,a)}let(t,r,a){return this._def(o.varKinds.let,t,r,a)}var(t,r,a){return this._def(o.varKinds.var,t,r,a)}assign(t,r,a){return this._leafNode(new Assign(t,r,a))}add(t,a){return this._leafNode(new AssignOp(t,r.operators.ADD,a))}code(t){return"function"==typeof t?t():t!==i.nil&&this._leafNode(new AnyCode(t)),this}object(...t){const r=["{"];for(const[a,o]of t)r.length>1&&r.push(","),r.push(a),(a!==o||this.opts.es5)&&(r.push(":"),(0,i.addCodeArg)(r,o));return r.push("}"),new i._Code(r)}if(t,r,a){if(this._blockNode(new If(t)),r&&a)this.code(r).else().code(a).endIf();else if(r)this.code(r).endIf();else if(a)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new If(t))}else(){return this._elseNode(new Else)}endIf(){return this._endBlockNode(If,Else)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new ForLoop(t),r)}forRange(t,r,a,i,l=(this.opts.es5?o.varKinds.var:o.varKinds.let)){const c=this._scope.toName(t);return this._for(new ForRange(l,c,r,a),(()=>i(c)))}forOf(t,r,a,l=o.varKinds.const){const c=this._scope.toName(t);if(this.opts.es5){const t=r instanceof i.Name?r:this.var("_arr",r);return this.forRange("_i",0,i._`${t}.length`,(r=>{this.var(c,i._`${t}[${r}]`),a(c)}))}return this._for(new ForIter("of",l,c,r),(()=>a(c)))}forIn(t,r,a,l=(this.opts.es5?o.varKinds.var:o.varKinds.const)){if(this.opts.ownProperties)return this.forOf(t,i._`Object.keys(${r})`,a);const c=this._scope.toName(t);return this._for(new ForIter("in",l,c,r),(()=>a(c)))}endFor(){return this._endBlockNode(For)}label(t){return this._leafNode(new Label(t))}break(t){return this._leafNode(new Break(t))}return(t){const r=new Return;if(this._blockNode(r),this.code(t),1!==r.nodes.length)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Return)}try(t,r,a){if(!r&&!a)throw new Error('CodeGen: "try" without "catch" and "finally"');const i=new Try;if(this._blockNode(i),this.code(t),r){const t=this.name("e");this._currNode=i.catch=new Catch(t),r(t)}return a&&(this._currNode=i.finally=new Finally,this.code(a)),this._endBlockNode(Catch,Finally)}throw(t){return this._leafNode(new Throw(t))}block(t,r){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(r),this}endBlock(t){const r=this._blockStarts.pop();if(void 0===r)throw new Error("CodeGen: not in self-balancing block");const a=this._nodes.length-r;if(a<0||void 0!==t&&a!==t)throw new Error(`CodeGen: wrong number of nodes: ${a} vs ${t} expected`);return this._nodes.length=r,this}func(t,r=i.nil,a,o){return this._blockNode(new Func(t,r,a)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(Func)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,r){const a=this._currNode;if(a instanceof t||r&&a instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${t.kind}/${r.kind}`:t.kind}"`)}_elseNode(t){const r=this._currNode;if(!(r instanceof If))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=t,this}get _root(){return this._nodes[0]}get _currNode(){const t=this._nodes;return t[t.length-1]}set _currNode(t){const r=this._nodes;r[r.length-1]=t}},r.not=not;const u=mappend(r.operators.AND);r.and=function and(...t){return t.reduce(u)};const d=mappend(r.operators.OR);function mappend(t){return(r,a)=>r===i.nil?a:a===i.nil?r:i._`${par(r)} ${t} ${par(a)}`}function par(t){return t instanceof i.Name?t:i._`(${t})`}r.or=function or(...t){return t.reduce(d)}},98490:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.ValueScope=r.ValueScopeName=r.Scope=r.varKinds=r.UsedValueState=void 0;const i=a(57023);class ValueError extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}}var o;!function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"}(o=r.UsedValueState||(r.UsedValueState={})),r.varKinds={const:new i.Name("const"),let:new i.Name("let"),var:new i.Name("var")};class Scope{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof i.Name?t:this.name(t)}name(t){return new i.Name(this._newName(t))}_newName(t){return`${t}${(this._names[t]||this._nameGroup(t)).index++}`}_nameGroup(t){var r,a;if((null===(a=null===(r=this._parent)||void 0===r?void 0:r._prefixes)||void 0===a?void 0:a.has(t))||this._prefixes&&!this._prefixes.has(t))throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}}r.Scope=Scope;class ValueScopeName extends i.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:a}){this.value=t,this.scopePath=i._`.${new i.Name(r)}[${a}]`}}r.ValueScopeName=ValueScopeName;const l=i._`\n`;r.ValueScope=class ValueScope extends Scope{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?l:i.nil}}get(){return this._scope}name(t){return new ValueScopeName(t,this._newName(t))}value(t,r){var a;if(void 0===r.ref)throw new Error("CodeGen: ref must be passed in value");const i=this.toName(t),{prefix:o}=i,l=null!==(a=r.key)&&void 0!==a?a:r.ref;let c=this._values[o];if(c){const t=c.get(l);if(t)return t}else c=this._values[o]=new Map;c.set(l,i);const u=this._scope[o]||(this._scope[o]=[]),d=u.length;return u[d]=r.ref,i.setValue(r,{property:o,itemIndex:d}),i}getValue(t,r){const a=this._values[t];if(a)return a.get(r)}scopeRefs(t,r=this._values){return this._reduceValues(r,(r=>{if(void 0===r.scopePath)throw new Error(`CodeGen: name "${r}" has no value`);return i._`${t}${r.scopePath}`}))}scopeCode(t=this._values,r,a){return this._reduceValues(t,(t=>{if(void 0===t.value)throw new Error(`CodeGen: name "${t}" has no value`);return t.value.code}),r,a)}_reduceValues(t,a,l={},c){let u=i.nil;for(const d in t){const p=t[d];if(!p)continue;const h=l[d]=l[d]||new Map;p.forEach((t=>{if(h.has(t))return;h.set(t,o.Started);let l=a(t);if(l){const a=this.opts.es5?r.varKinds.var:r.varKinds.const;u=i._`${u}${a} ${t} = ${l};${this.opts._n}`}else{if(!(l=null==c?void 0:c(t)))throw new ValueError(t);u=i._`${u}${l}${this.opts._n}`}h.set(t,o.Completed)}))}return u}}},4181:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.extendErrors=r.resetErrorsCount=r.reportExtraError=r.reportError=r.keyword$DataError=r.keywordError=void 0;const i=a(93487),o=a(76776),l=a(22141);function addError(t,r){const a=t.const("err",r);t.if(i._`${l.default.vErrors} === null`,(()=>t.assign(l.default.vErrors,i._`[${a}]`)),i._`${l.default.vErrors}.push(${a})`),t.code(i._`${l.default.errors}++`)}function returnErrors(t,r){const{gen:a,validateName:o,schemaEnv:l}=t;l.$async?a.throw(i._`new ${t.ValidationError}(${r})`):(a.assign(i._`${o}.errors`,r),a.return(!1))}r.keywordError={message:({keyword:t})=>i.str`must pass "${t}" keyword validation`},r.keyword$DataError={message:({keyword:t,schemaType:r})=>r?i.str`"${t}" keyword must be ${r} ($data)`:i.str`"${t}" keyword is invalid ($data)`},r.reportError=function reportError(t,a=r.keywordError,o,l){const{it:c}=t,{gen:u,compositeRule:d,allErrors:p}=c,h=errorObjectCode(t,a,o);(null!=l?l:d||p)?addError(u,h):returnErrors(c,i._`[${h}]`)},r.reportExtraError=function reportExtraError(t,a=r.keywordError,i){const{it:o}=t,{gen:c,compositeRule:u,allErrors:d}=o;addError(c,errorObjectCode(t,a,i)),u||d||returnErrors(o,l.default.vErrors)},r.resetErrorsCount=function resetErrorsCount(t,r){t.assign(l.default.errors,r),t.if(i._`${l.default.vErrors} !== null`,(()=>t.if(r,(()=>t.assign(i._`${l.default.vErrors}.length`,r)),(()=>t.assign(l.default.vErrors,null)))))},r.extendErrors=function extendErrors({gen:t,keyword:r,schemaValue:a,data:o,errsCount:c,it:u}){if(void 0===c)throw new Error("ajv implementation error");const d=t.name("err");t.forRange("i",c,l.default.errors,(c=>{t.const(d,i._`${l.default.vErrors}[${c}]`),t.if(i._`${d}.instancePath === undefined`,(()=>t.assign(i._`${d}.instancePath`,(0,i.strConcat)(l.default.instancePath,u.errorPath)))),t.assign(i._`${d}.schemaPath`,i.str`${u.errSchemaPath}/${r}`),u.opts.verbose&&(t.assign(i._`${d}.schema`,a),t.assign(i._`${d}.data`,o))}))};const c={keyword:new i.Name("keyword"),schemaPath:new i.Name("schemaPath"),params:new i.Name("params"),propertyName:new i.Name("propertyName"),message:new i.Name("message"),schema:new i.Name("schema"),parentSchema:new i.Name("parentSchema")};function errorObjectCode(t,r,a){const{createErrors:o}=t.it;return!1===o?i._`{}`:function errorObject(t,r,a={}){const{gen:o,it:u}=t,d=[errorInstancePath(u,a),errorSchemaPath(t,a)];return function extraErrorProps(t,{params:r,message:a},o){const{keyword:u,data:d,schemaValue:p,it:h}=t,{opts:m,propertyName:y,topSchemaRef:g,schemaPath:v}=h;o.push([c.keyword,u],[c.params,"function"==typeof r?r(t):r||i._`{}`]),m.messages&&o.push([c.message,"function"==typeof a?a(t):a]);m.verbose&&o.push([c.schema,p],[c.parentSchema,i._`${g}${v}`],[l.default.data,d]);y&&o.push([c.propertyName,y])}(t,r,d),o.object(...d)}(t,r,a)}function errorInstancePath({errorPath:t},{instancePath:r}){const a=r?i.str`${t}${(0,o.getErrorPath)(r,o.Type.Str)}`:t;return[l.default.instancePath,(0,i.strConcat)(l.default.instancePath,a)]}function errorSchemaPath({keyword:t,it:{errSchemaPath:r}},{schemaPath:a,parentSchema:l}){let u=l?r:i.str`${r}/${t}`;return a&&(u=i.str`${u}${(0,o.getErrorPath)(a,o.Type.Str)}`),[c.schemaPath,u]}},25173:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.resolveSchema=r.getCompilingSchema=r.resolveRef=r.compileSchema=r.SchemaEnv=void 0;const i=a(93487),o=a(67426),l=a(22141),c=a(32531),u=a(76776),d=a(74815);class SchemaEnv{constructor(t){var r;let a;this.refs={},this.dynamicAnchors={},"object"==typeof t.schema&&(a=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=null!==(r=t.baseId)&&void 0!==r?r:(0,c.normalizeId)(null==a?void 0:a[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=null==a?void 0:a.$async,this.refs={}}}function compileSchema(t){const r=getCompilingSchema.call(this,t);if(r)return r;const a=(0,c.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:u,lines:p}=this.opts.code,{ownProperties:h}=this.opts,m=new i.CodeGen(this.scope,{es5:u,lines:p,ownProperties:h});let y;t.$async&&(y=m.scopeValue("Error",{ref:o.default,code:i._`require("ajv/dist/runtime/validation_error").default`}));const g=m.scopeName("validate");t.validateName=g;const v={gen:m,allErrors:this.opts.allErrors,data:l.default.data,parentData:l.default.parentData,parentDataProperty:l.default.parentDataProperty,dataNames:[l.default.data],dataPathArr:[i.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:m.scopeValue("schema",!0===this.opts.code.source?{ref:t.schema,code:(0,i.stringify)(t.schema)}:{ref:t.schema}),validateName:g,ValidationError:y,schema:t.schema,schemaEnv:t,rootId:a,baseId:t.baseId||a,schemaPath:i.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:i._`""`,opts:this.opts,self:this};let b;try{this._compilations.add(t),(0,d.validateFunctionCode)(v),m.optimize(this.opts.code.optimize);const r=m.toString();b=`${m.scopeRefs(l.default.scope)}return ${r}`,this.opts.code.process&&(b=this.opts.code.process(b,t));const a=new Function(`${l.default.self}`,`${l.default.scope}`,b)(this,this.scope.get());if(this.scope.value(g,{ref:a}),a.errors=null,a.schema=t.schema,a.schemaEnv=t,t.$async&&(a.$async=!0),!0===this.opts.code.source&&(a.source={validateName:g,validateCode:r,scopeValues:m._values}),this.opts.unevaluated){const{props:t,items:r}=v;a.evaluated={props:t instanceof i.Name?void 0:t,items:r instanceof i.Name?void 0:r,dynamicProps:t instanceof i.Name,dynamicItems:r instanceof i.Name},a.source&&(a.source.evaluated=(0,i.stringify)(a.evaluated))}return t.validate=a,t}catch(r){throw delete t.validate,delete t.validateName,b&&this.logger.error("Error compiling schema, function code:",b),r}finally{this._compilations.delete(t)}}function inlineOrCompile(t){return(0,c.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:compileSchema.call(this,t)}function getCompilingSchema(t){for(const i of this._compilations)if(a=t,(r=i).schema===a.schema&&r.root===a.root&&r.baseId===a.baseId)return i;var r,a}function resolve(t,r){let a;for(;"string"==typeof(a=this.refs[r]);)r=a;return a||this.schemas[r]||resolveSchema.call(this,t,r)}function resolveSchema(t,r){const a=this.opts.uriResolver.parse(r),i=(0,c._getFullPath)(this.opts.uriResolver,a);let o=(0,c.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&i===o)return getJsonPointer.call(this,a,t);const l=(0,c.normalizeId)(i),u=this.refs[l]||this.schemas[l];if("string"==typeof u){const r=resolveSchema.call(this,t,u);if("object"!=typeof(null==r?void 0:r.schema))return;return getJsonPointer.call(this,a,r)}if("object"==typeof(null==u?void 0:u.schema)){if(u.validate||compileSchema.call(this,u),l===(0,c.normalizeId)(r)){const{schema:r}=u,{schemaId:a}=this.opts,i=r[a];return i&&(o=(0,c.resolveUrl)(this.opts.uriResolver,o,i)),new SchemaEnv({schema:r,schemaId:a,root:t,baseId:o})}return getJsonPointer.call(this,a,u)}}r.SchemaEnv=SchemaEnv,r.compileSchema=compileSchema,r.resolveRef=function resolveRef(t,r,a){var i;a=(0,c.resolveUrl)(this.opts.uriResolver,r,a);const o=t.refs[a];if(o)return o;let l=resolve.call(this,t,a);if(void 0===l){const o=null===(i=t.localRefs)||void 0===i?void 0:i[a],{schemaId:c}=this.opts;o&&(l=new SchemaEnv({schema:o,schemaId:c,root:t,baseId:r}))}return void 0!==l?t.refs[a]=inlineOrCompile.call(this,l):void 0},r.getCompilingSchema=getCompilingSchema,r.resolveSchema=resolveSchema;const p=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function getJsonPointer(t,{baseId:r,schema:a,root:i}){var o;if("/"!==(null===(o=t.fragment)||void 0===o?void 0:o[0]))return;for(const i of t.fragment.slice(1).split("/")){if("boolean"==typeof a)return;const t=a[(0,u.unescapeFragment)(i)];if(void 0===t)return;const o="object"==typeof(a=t)&&a[this.opts.schemaId];!p.has(i)&&o&&(r=(0,c.resolveUrl)(this.opts.uriResolver,r,o))}let l;if("boolean"!=typeof a&&a.$ref&&!(0,u.schemaHasRulesButRef)(a,this.RULES)){const t=(0,c.resolveUrl)(this.opts.uriResolver,r,a.$ref);l=resolveSchema.call(this,i,t)}const{schemaId:d}=this.opts;return l=l||new SchemaEnv({schema:a,schemaId:d,root:i,baseId:r}),l.schema!==l.root.schema?l:void 0}},22141:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});const i=a(93487),o={data:new i.Name("data"),valCxt:new i.Name("valCxt"),instancePath:new i.Name("instancePath"),parentData:new i.Name("parentData"),parentDataProperty:new i.Name("parentDataProperty"),rootData:new i.Name("rootData"),dynamicAnchors:new i.Name("dynamicAnchors"),vErrors:new i.Name("vErrors"),errors:new i.Name("errors"),this:new i.Name("this"),self:new i.Name("self"),scope:new i.Name("scope"),json:new i.Name("json"),jsonPos:new i.Name("jsonPos"),jsonLen:new i.Name("jsonLen"),jsonPart:new i.Name("jsonPart")};r.default=o},6646:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});const i=a(32531);class MissingRefError extends Error{constructor(t,r,a,o){super(o||`can't resolve reference ${a} from id ${r}`),this.missingRef=(0,i.resolveUrl)(t,r,a),this.missingSchema=(0,i.normalizeId)((0,i.getFullPath)(t,this.missingRef))}}r.default=MissingRefError},32531:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.getSchemaRefs=r.resolveUrl=r.normalizeId=r._getFullPath=r.getFullPath=r.inlineRef=void 0;const i=a(76776),o=a(64063),l=a(49461),c=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);r.inlineRef=function inlineRef(t,r=!0){return"boolean"==typeof t||(!0===r?!hasRef(t):!!r&&countKeys(t)<=r)};const u=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function hasRef(t){for(const r in t){if(u.has(r))return!0;const a=t[r];if(Array.isArray(a)&&a.some(hasRef))return!0;if("object"==typeof a&&hasRef(a))return!0}return!1}function countKeys(t){let r=0;for(const a in t){if("$ref"===a)return 1/0;if(r++,!c.has(a)&&("object"==typeof t[a]&&(0,i.eachItem)(t[a],(t=>r+=countKeys(t))),r===1/0))return 1/0}return r}function getFullPath(t,r="",a){!1!==a&&(r=normalizeId(r));const i=t.parse(r);return _getFullPath(t,i)}function _getFullPath(t,r){return t.serialize(r).split("#")[0]+"#"}r.getFullPath=getFullPath,r._getFullPath=_getFullPath;const d=/#\/?$/;function normalizeId(t){return t?t.replace(d,""):""}r.normalizeId=normalizeId,r.resolveUrl=function resolveUrl(t,r,a){return a=normalizeId(a),t.resolve(r,a)};const p=/^[a-z_][-a-z0-9._]*$/i;r.getSchemaRefs=function getSchemaRefs(t,r){if("boolean"==typeof t)return{};const{schemaId:a,uriResolver:i}=this.opts,c=normalizeId(t[a]||r),u={"":c},d=getFullPath(i,c,!1),h={},m=new Set;return l(t,{allKeys:!0},((t,r,i,o)=>{if(void 0===o)return;const l=d+r;let c=u[o];function addRef(r){const a=this.opts.uriResolver.resolve;if(r=normalizeId(c?a(c,r):r),m.has(r))throw ambiguos(r);m.add(r);let i=this.refs[r];return"string"==typeof i&&(i=this.refs[i]),"object"==typeof i?checkAmbiguosRef(t,i.schema,r):r!==normalizeId(l)&&("#"===r[0]?(checkAmbiguosRef(t,h[r],r),h[r]=t):this.refs[r]=l),r}function addAnchor(t){if("string"==typeof t){if(!p.test(t))throw new Error(`invalid anchor "${t}"`);addRef.call(this,`#${t}`)}}"string"==typeof t[a]&&(c=addRef.call(this,t[a])),addAnchor.call(this,t.$anchor),addAnchor.call(this,t.$dynamicAnchor),u[r]=c})),h;function checkAmbiguosRef(t,r,a){if(void 0!==r&&!o(t,r))throw ambiguos(a)}function ambiguos(t){return new Error(`reference "${t}" resolves to more than one schema`)}}},13141:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.getRules=r.isJSONType=void 0;const a=new Set(["string","number","integer","boolean","null","object","array"]);r.isJSONType=function isJSONType(t){return"string"==typeof t&&a.has(t)},r.getRules=function getRules(){const t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}},76776:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.checkStrictMode=r.getErrorPath=r.Type=r.useFunc=r.setEvaluated=r.evaluatedPropsToName=r.mergeEvaluated=r.eachItem=r.unescapeJsonPointer=r.escapeJsonPointer=r.escapeFragment=r.unescapeFragment=r.schemaRefOrVal=r.schemaHasRulesButRef=r.schemaHasRules=r.checkUnknownRules=r.alwaysValidSchema=r.toHash=void 0;const i=a(93487),o=a(57023);function checkUnknownRules(t,r=t.schema){const{opts:a,self:i}=t;if(!a.strictSchema)return;if("boolean"==typeof r)return;const o=i.RULES.keywords;for(const a in r)o[a]||checkStrictMode(t,`unknown keyword: "${a}"`)}function schemaHasRules(t,r){if("boolean"==typeof t)return!t;for(const a in t)if(r[a])return!0;return!1}function escapeJsonPointer(t){return"number"==typeof t?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}function unescapeJsonPointer(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function makeMergeEvaluated({mergeNames:t,mergeToName:r,mergeValues:a,resultToName:o}){return(l,c,u,d)=>{const p=void 0===u?c:u instanceof i.Name?(c instanceof i.Name?t(l,c,u):r(l,c,u),u):c instanceof i.Name?(r(l,u,c),c):a(c,u);return d!==i.Name||p instanceof i.Name?p:o(l,p)}}function evaluatedPropsToName(t,r){if(!0===r)return t.var("props",!0);const a=t.var("props",i._`{}`);return void 0!==r&&setEvaluated(t,a,r),a}function setEvaluated(t,r,a){Object.keys(a).forEach((a=>t.assign(i._`${r}${(0,i.getProperty)(a)}`,!0)))}r.toHash=function toHash(t){const r={};for(const a of t)r[a]=!0;return r},r.alwaysValidSchema=function alwaysValidSchema(t,r){return"boolean"==typeof r?r:0===Object.keys(r).length||(checkUnknownRules(t,r),!schemaHasRules(r,t.self.RULES.all))},r.checkUnknownRules=checkUnknownRules,r.schemaHasRules=schemaHasRules,r.schemaHasRulesButRef=function schemaHasRulesButRef(t,r){if("boolean"==typeof t)return!t;for(const a in t)if("$ref"!==a&&r.all[a])return!0;return!1},r.schemaRefOrVal=function schemaRefOrVal({topSchemaRef:t,schemaPath:r},a,o,l){if(!l){if("number"==typeof a||"boolean"==typeof a)return a;if("string"==typeof a)return i._`${a}`}return i._`${t}${r}${(0,i.getProperty)(o)}`},r.unescapeFragment=function unescapeFragment(t){return unescapeJsonPointer(decodeURIComponent(t))},r.escapeFragment=function escapeFragment(t){return encodeURIComponent(escapeJsonPointer(t))},r.escapeJsonPointer=escapeJsonPointer,r.unescapeJsonPointer=unescapeJsonPointer,r.eachItem=function eachItem(t,r){if(Array.isArray(t))for(const a of t)r(a);else r(t)},r.mergeEvaluated={props:makeMergeEvaluated({mergeNames:(t,r,a)=>t.if(i._`${a} !== true && ${r} !== undefined`,(()=>{t.if(i._`${r} === true`,(()=>t.assign(a,!0)),(()=>t.assign(a,i._`${a} || {}`).code(i._`Object.assign(${a}, ${r})`)))})),mergeToName:(t,r,a)=>t.if(i._`${a} !== true`,(()=>{!0===r?t.assign(a,!0):(t.assign(a,i._`${a} || {}`),setEvaluated(t,a,r))})),mergeValues:(t,r)=>!0===t||{...t,...r},resultToName:evaluatedPropsToName}),items:makeMergeEvaluated({mergeNames:(t,r,a)=>t.if(i._`${a} !== true && ${r} !== undefined`,(()=>t.assign(a,i._`${r} === true ? true : ${a} > ${r} ? ${a} : ${r}`))),mergeToName:(t,r,a)=>t.if(i._`${a} !== true`,(()=>t.assign(a,!0===r||i._`${a} > ${r} ? ${a} : ${r}`))),mergeValues:(t,r)=>!0===t||Math.max(t,r),resultToName:(t,r)=>t.var("items",r)})},r.evaluatedPropsToName=evaluatedPropsToName,r.setEvaluated=setEvaluated;const l={};var c;function checkStrictMode(t,r,a=t.opts.strictSchema){if(a){if(r=`strict mode: ${r}`,!0===a)throw new Error(r);t.self.logger.warn(r)}}r.useFunc=function useFunc(t,r){return t.scopeValue("func",{ref:r,code:l[r.code]||(l[r.code]=new o._Code(r.code))})},function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"}(c=r.Type||(r.Type={})),r.getErrorPath=function getErrorPath(t,r,a){if(t instanceof i.Name){const o=r===c.Num;return a?o?i._`"[" + ${t} + "]"`:i._`"['" + ${t} + "']"`:o?i._`"/" + ${t}`:i._`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return a?(0,i.getProperty)(t).toString():"/"+escapeJsonPointer(t)},r.checkStrictMode=checkStrictMode},58876:(t,r)=>{"use strict";function shouldUseGroup(t,r){return r.rules.some((r=>shouldUseRule(t,r)))}function shouldUseRule(t,r){var a;return void 0!==t[r.keyword]||(null===(a=r.definition.implements)||void 0===a?void 0:a.some((r=>void 0!==t[r])))}Object.defineProperty(r,"__esModule",{value:!0}),r.shouldUseRule=r.shouldUseGroup=r.schemaHasRulesForType=void 0,r.schemaHasRulesForType=function schemaHasRulesForType({schema:t,self:r},a){const i=r.RULES.types[a];return i&&!0!==i&&shouldUseGroup(t,i)},r.shouldUseGroup=shouldUseGroup,r.shouldUseRule=shouldUseRule},55667:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.boolOrEmptySchema=r.topBoolOrEmptySchema=void 0;const i=a(4181),o=a(93487),l=a(22141),c={message:"boolean schema is false"};function falseSchemaError(t,r){const{gen:a,data:o}=t,l={gen:a,keyword:"false schema",data:o,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,i.reportError)(l,c,void 0,r)}r.topBoolOrEmptySchema=function topBoolOrEmptySchema(t){const{gen:r,schema:a,validateName:i}=t;!1===a?falseSchemaError(t,!1):"object"==typeof a&&!0===a.$async?r.return(l.default.data):(r.assign(o._`${i}.errors`,null),r.return(!0))},r.boolOrEmptySchema=function boolOrEmptySchema(t,r){const{gen:a,schema:i}=t;!1===i?(a.var(r,!1),falseSchemaError(t)):a.var(r,!0)}},50453:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.reportTypeError=r.checkDataTypes=r.checkDataType=r.coerceAndCheckDataType=r.getJSONTypes=r.getSchemaTypes=r.DataType=void 0;const i=a(13141),o=a(58876),l=a(4181),c=a(93487),u=a(76776);var d;function getJSONTypes(t){const r=Array.isArray(t)?t:t?[t]:[];if(r.every(i.isJSONType))return r;throw new Error("type must be JSONType or JSONType[]: "+r.join(","))}!function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"}(d=r.DataType||(r.DataType={})),r.getSchemaTypes=function getSchemaTypes(t){const r=getJSONTypes(t.type);if(r.includes("null")){if(!1===t.nullable)throw new Error("type: null contradicts nullable: false")}else{if(!r.length&&void 0!==t.nullable)throw new Error('"nullable" cannot be used without "type"');!0===t.nullable&&r.push("null")}return r},r.getJSONTypes=getJSONTypes,r.coerceAndCheckDataType=function coerceAndCheckDataType(t,r){const{gen:a,data:i,opts:l}=t,u=function coerceToTypes(t,r){return r?t.filter((t=>p.has(t)||"array"===r&&"array"===t)):[]}(r,l.coerceTypes),h=r.length>0&&!(0===u.length&&1===r.length&&(0,o.schemaHasRulesForType)(t,r[0]));if(h){const o=checkDataTypes(r,i,l.strictNumbers,d.Wrong);a.if(o,(()=>{u.length?function coerceData(t,r,a){const{gen:i,data:o,opts:l}=t,u=i.let("dataType",c._`typeof ${o}`),d=i.let("coerced",c._`undefined`);"array"===l.coerceTypes&&i.if(c._`${u} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,(()=>i.assign(o,c._`${o}[0]`).assign(u,c._`typeof ${o}`).if(checkDataTypes(r,o,l.strictNumbers),(()=>i.assign(d,o)))));i.if(c._`${d} !== undefined`);for(const t of a)(p.has(t)||"array"===t&&"array"===l.coerceTypes)&&coerceSpecificType(t);function coerceSpecificType(t){switch(t){case"string":return void i.elseIf(c._`${u} == "number" || ${u} == "boolean"`).assign(d,c._`"" + ${o}`).elseIf(c._`${o} === null`).assign(d,c._`""`);case"number":return void i.elseIf(c._`${u} == "boolean" || ${o} === null
|
|
2
|
+
var NMSHDRuntime;(()=>{var t={6984:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.Runtime=void 0;const i=a(75172),o=a(3850),l=a(19663),c=a(7071),u=a(34086),d=a(42205),p=a(5200),h=a(986),m=a(60485),y=a(32746);r.Runtime=class Runtime{constructor(t){this._isInitialized=!1,this._isStarted=!1,this.runtimeConfig=t,this._eventBus=new i.EventEmitter2EventBus}isLoggedIn(){return!!this._accountController}getAccountController(){if(!this._accountController)throw m.RuntimeErrors.startup.noActiveAccount();return this._accountController}getConsumptionController(){if(!this._consumptionController)throw m.RuntimeErrors.startup.noActiveConsumptionController();return this._consumptionController}getDataViewExpander(){if(!this._expander)throw m.RuntimeErrors.startup.noActiveExpander();return this._expander}login(t,r){return this._accountController=t,this._transportServices=c.Container.get(p.TransportServices),this._consumptionController=r,this._consumptionServices=c.Container.get(p.ConsumptionServices),this._expander=c.Container.get(u.DataViewExpander),this}get modules(){return this._modules}get transportServices(){return this._transportServices}get consumptionServices(){return this._consumptionServices}get anonymousServices(){return this._anonymousServices}get eventBus(){return this._eventBus}get isInitialized(){return this._isInitialized}async init(){if(this._isInitialized)throw m.RuntimeErrors.general.alreadyInitialized();this.eventBus.publish(new d.RuntimeInitializingEvent),this.loggerFactory=await this.createLoggerFactory(),await this.initDIContainer(),await this.initTransportLibrary(),await this.initAccount(),this._modules=new p.RuntimeModuleRegistry,await this.loadModules(),await this.initInfrastructure(),await this.initModules(),this._isInitialized=!0,this.eventBus.publish(new d.RuntimeInitializedEvent)}initInfrastructure(){}async getSupportInformation(){return{health:await this.getHealth(),configuration:JSON.parse(JSON.stringify(this.runtimeConfig))}}async initTransportLibrary(){this.eventBus.publish(new d.TransportLibraryInitializingEvent),this.logger.debug("Initializing Database connection... ");const t=await this.createDatabaseConnection();this.transport=new l.Transport(t,this.runtimeConfig.transportLibrary,this.loggerFactory),this.logger.debug("Initializing Transport Library..."),await this.transport.init(),this.logger.debug("Finished initialization of Transport Library."),this._anonymousServices=c.Container.get(p.AnonymousServices),this.eventBus.publish(new d.TransportLibraryInitializedEvent)}async initDIContainer(){c.Container.bind(i.EventBus).factory((()=>this.eventBus)).scope(c.Scope.Singleton),c.Container.bind(h.RuntimeLoggerFactory).factory((()=>this.loggerFactory)).scope(c.Scope.Singleton),c.Container.bind(l.AccountController).factory((()=>this.getAccountController())).scope(c.Scope.Request),c.Container.bind(l.DevicesController).factory((()=>this.getAccountController().devices)).scope(c.Scope.Request),c.Container.bind(l.DeviceController).factory((()=>this.getAccountController().activeDevice)).scope(c.Scope.Request),c.Container.bind(l.FileController).factory((()=>this.getAccountController().files)).scope(c.Scope.Request),c.Container.bind(l.IdentityController).factory((()=>this.getAccountController().identity)).scope(c.Scope.Request),c.Container.bind(l.MessageController).factory((()=>this.getAccountController().messages)).scope(c.Scope.Request),c.Container.bind(l.RelationshipTemplateController).factory((()=>this.getAccountController().relationshipTemplates)).scope(c.Scope.Request),c.Container.bind(l.RelationshipsController).factory((()=>this.getAccountController().relationships)).scope(c.Scope.Request),c.Container.bind(l.TokenController).factory((()=>this.getAccountController().tokens)).scope(c.Scope.Request),c.Container.bind(l.ChallengeController).factory((()=>this.getAccountController().challenges)).scope(c.Scope.Request),c.Container.bind(o.ConsumptionController).factory((()=>this.getConsumptionController())).scope(c.Scope.Request),c.Container.bind(o.ConsumptionAttributesController).factory((()=>this.getConsumptionController().attributes)).scope(c.Scope.Request),c.Container.bind(o.DraftsController).factory((()=>this.getConsumptionController().drafts)).scope(c.Scope.Request),c.Container.bind(o.RelationshipInfoController).factory((()=>this.getConsumptionController().relationshipInfo)).scope(c.Scope.Request),c.Container.bind(o.RequestsController).factory((()=>this.getConsumptionController().requests)).scope(c.Scope.Request),c.Container.bind(o.SettingsController).factory((()=>this.getConsumptionController().settings)).scope(c.Scope.Request),c.Container.bind(o.SharedItemsController).factory((()=>this.getConsumptionController().sharedItems)).scope(c.Scope.Request),c.Container.bind(l.AnonymousTokenController).factory((()=>new l.AnonymousTokenController(this.transport.config))).scope(c.Scope.Singleton);const t=new y.SchemaRepository;await t.loadSchemas(),c.Container.bind(y.SchemaRepository).factory((()=>t)).scope(c.Scope.Singleton)}async loadModules(){this.logger.info("Loading modules...");for(const t in this.runtimeConfig.modules){const r=this.runtimeConfig.modules[t];r.name=t,r.enabled?r.location?await this.loadModule(r):this.logger.error(`Skip loading module '${this.getModuleName(r)}' because has no location.`):this.logger.info(`Skip loading module '${this.getModuleName(r)}' because it is not enabled.`)}this.eventBus.publish(new d.ModulesLoadedEvent)}async initModules(){this.logger.info("Initializing modules...");for(const t of this.modules.toArray())try{await t.init(),this.logger.info(`Module '${this.getModuleName(t)}' was initialized successfully.`)}catch(r){throw this.logger.error(`Module '${this.getModuleName(t)}' could not be initialized.`,r),r}this.eventBus.publish(new d.ModulesInitializedEvent)}get isStarted(){return this._isStarted}async start(){if(!this._isInitialized)throw m.RuntimeErrors.general.notInitialized();if(this._isStarted)throw m.RuntimeErrors.general.alreadyStarted();await this.startInfrastructure(),await this.startModules(),this._isStarted=!0}startInfrastructure(){}async stop(){var t;if(!this._isInitialized)throw m.RuntimeErrors.general.notInitialized();if(!this._isStarted)throw m.RuntimeErrors.general.notStarted();await this.stopModules(),await this.stopInfrastructure(),this.logger.info("Closing AccountController..."),await(null===(t=this._accountController)||void 0===t?void 0:t.close()),this._accountController=void 0,this.logger.info("AccountController was closed successfully."),this._isInitialized=!1,this._isStarted=!1}stopInfrastructure(){}async stopModules(){this.logger.info("Stopping modules...");for(const t of this.modules.toArray())try{await t.stop(),this.logger.info(`Module '${this.getModuleName(t)}' was stopped successfully.`)}catch(r){this.logger.error(`An Error occured while stopping module '${this.getModuleName(t)}': `,r)}this.logger.info("Stopped all modules.")}async startModules(){this.logger.info("Starting modules...");for(const t of this.modules.toArray())try{await t.start(),this.logger.info(`Module '${this.getModuleName(t)}' was started successfully.`)}catch(r){throw this.logger.error(`Module '${this.getModuleName(t)}' could not be started.`,r),r}this.eventBus.publish(new d.ModulesStartedEvent),this.logger.info("Started all modules.")}getModuleName(t){return t.displayName||t.name||JSON.stringify(t)}}},59757:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},986:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.RuntimeLoggerFactory=void 0;r.RuntimeLoggerFactory=class RuntimeLoggerFactory{}},2500:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.buildInformation=void 0;const i=a(90194),o=a(3850),l=a(25030),c=a(82890),u=a(19663);r.buildInformation={version:"1.3.1",build:"38",date:"2022-02-21T13:14:28+00:00",commit:"c3b0ab491b81daf8be410295fe64570026ebaa39",dependencies:{"@js-soft/docdb-querytranslator":"1.0.1","@js-soft/logging-abstractions":"1.0.0","@js-soft/ts-serval":"1.0.2","@js-soft/ts-utils":"^1.1.1","@nmshd/consumption":"1.0.13","@nmshd/content":"1.1.4","@nmshd/crypto":"1.0.8","@nmshd/transport":"1.1.10",ajv:"^8.10.0","ajv-errors":"^3.0.0","ajv-formats":"^2.1.1","fluent-ts-validator":"3.0.3","json-stringify-safe":"^5.0.1",luxon:"^2.3.0",qrcode:"1.5.0","reflect-metadata":"0.1.13","ts-simple-nameof":"1.3.1","typescript-ioc":"3.2.2"},libraries:{serval:i.buildInformation,consumption:o.buildInformation,content:l.buildInformation,crypto:c.buildInformation,transport:u.buildInformation}}},64869:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DataViewExpander=void 0;const c=a(19663),u=a(7071),d=a(5200),p=a(4629),h=a(60485),m=a(32043),y=a(14700),g=a(82466);let v=class DataViewExpander{constructor(t,r,a){this.transport=t,this.consumption=r,this.identityController=a}async expand(t,r){let a=r;if(t["@type"]&&(a=t["@type"]),t instanceof Array){if(!(t.length>0))return[];a=t[0]["@type"]}if(!a)throw h.RuntimeErrors.general.invalidPayload("No type found.");switch(a){case"Message":return t instanceof Array?await this.expandMessageDTOs(t):await this.expandMessageDTO(t);case"Request":return t instanceof Array?await this.expandUnknownRequests(t):await this.expandUnknownRequest(t);case"AttributesShareRequest":return t instanceof Array?await this.expandAttributesShareRequests(t):await this.expandAttributesShareRequest(t);case"AttributesChangeRequest":return t instanceof Array?await this.expandAttributesChangeRequests(t):await this.expandAttributesChangeRequest(t);case"Attribute":return t instanceof Array?await this.expandAttributes(t):this.expandAttribute(t);case"AttributeName":return t instanceof Array?await this.expandAttributeNames(t):await this.expandAttributeName(t);case"Address":return t instanceof Array?await this.expandAddresses(t):await this.expandAddress(t);case"FileId":return t instanceof Array?await this.expandFileIds(t):await this.expandFileId(t);case"File":return t instanceof Array?await this.expandFileDTOs(t):await this.expandFileDTO(t);case"Recipient":return t instanceof Array?await this.expandRecipients(t):await this.expandAddress(t);case"Relationship":return t instanceof Array?await this.expandRelationshipDTOs(t):await this.expandRelationshipDTO(t);case"ConsumptionAttribute":return t instanceof Array?await this.expandConsumptionAttributes(t):this.expandConsumptionAttribute(t);default:throw h.RuntimeErrors.general.notImplemented()}}async expandMessageDTO(t){const r=await this.expandRecipients(t.recipients),a={};r.forEach((t=>a[t.id]=t));const i=await this.expandAddress(t.createdBy),o=[],l=[];for(const r of t.attachments)"string"==typeof r?(l.push(this.expandFileId(r)),o.push(r)):(l.push(this.expandFileDTO(r)),o.push(r.id));const u=await Promise.all(l),d=this.identityController.isMe(c.CoreAddress.from(t.createdBy));let p,h=y.MessageStatus.Received;if(d){h=t.recipients.every((t=>!!t.receivedAt))?y.MessageStatus.Delivered:y.MessageStatus.Delivering,p={...r[0],type:"IdentityDVO"}}else p=i;const g=m.DataViewTranslateable.transport.messageName,v={id:t.id,name:g,date:t.createdAt,type:"MessageDVO",createdByDevice:t.createdByDevice,createdAt:t.createdAt,createdBy:i,recipients:r,attachments:u,isOwn:d,recipientCount:t.recipients.length,attachmentCount:t.attachments.length,status:h,statusText:`i18n://dvo.message.${h}`,image:"",peer:p};if("Mail"===t.content["@type"]||"RequestMail"===t.content["@type"]){const r=t.content,i=r.to.map((t=>a[t]));let o=[];r.cc&&(o=r.cc.map((t=>a[t])));const l={...v,type:"MailDVO",name:r.subject?r.subject:m.DataViewTranslateable.consumption.mails.mailSubjectFallback,subject:r.subject,body:r.body,to:i,toCount:r.to.length,cc:o,ccCount:o.length};if("RequestMail"===r["@type"]){const r=t.content;return{...l,type:"RequestMailDVO",name:r.subject?r.subject:m.DataViewTranslateable.consumption.mails.requestMailSubjectFallback,requests:await this.expandUnknownRequests(r.requests),requestCount:r.requests.length}}return l}return v}async expandMessageDTOs(t){const r=t.map((t=>this.expandMessageDTO(t)));return await Promise.all(r)}async expandUnknownRequest(t){switch(t["@type"]){case"AttributesRequest":return await this.expandAttributesRequest(t);case"AttributesShareRequest":return await this.expandAttributesShareRequest(t);case"AttributesChangeRequest":return await this.expandAttributesChangeRequest(t)}return{id:t.id?t.id:"",name:`${t["@type"]} ${t.key}`,description:"i18n://dvo.request.unknownType",type:"RequestDVO",date:t.expiresAt,...t}}expandRequest(t){return{id:t.id?t.id:"",name:`${t["@type"]} ${t.key}`,type:"RequestDVO",date:t.expiresAt,...t}}async expandUnknownRequests(t){const r=t.map((t=>this.expandUnknownRequest(t)));return await Promise.all(r)}async expandAttributesShareRequest(t){var r,a;const i=this.expandRequest(t),o=[];let l=0;for(const r of t.recipients){if(this.identityController.isMe(c.CoreAddress.from(r)))continue;const t=await this.expandIdentityForAddress(r);t.hasRelationship&&(o.push(t),l++)}if(0===o.length){i.errorCount=(null!==(r=i.errorCount)&&void 0!==r?r:0)+1;const t={code:"error.dvo.request.AttributeShareRequest.noRelationship",message:"There are no relationships to any of the recipients of this request."};i.errors||(i.errors=[]),i.errors.push(t)}else if(o.length!==l){i.warningCount=(null!==(a=i.warningCount)&&void 0!==a?a:0)+1;const t={code:"warning.dvo.request.AttributeShareRequest.onlyRelationships",message:"Not to every recipient of this request exist a relationship."};i.warnings||(i.warnings=[]),i.warnings.push(t)}const u=[];for(const r of t.attributes){const t=await this.expandAttributeName(r);u.push(t)}let d;return d=u.length>1?m.DataViewTranslateable.consumption.requests.attributesShareRequestNamePlural:m.DataViewTranslateable.consumption.requests.attributesShareRequestName,{...i,name:d,type:"AttributesShareRequestDVO",attributes:u,attributeCount:u.length,recipients:o,recipientCount:o.length,possibleRecipientCount:l}}expandConsumptionAttribute(t){return{type:"StoredAttributeDVO",id:t.id,name:t.content.name,value:t.content.value,date:t.createdAt,isOwn:!0,sharedItems:[],sharedItemCount:0}}async expandConsumptionAttributes(t){const r=t.map((t=>this.expandConsumptionAttribute(t)));return await Promise.all(r)}async expandAttributeName(t){const r=await this.consumption.attributes.getAttributeByName({name:t});let a,i=[];return r.isSuccess&&(i=[this.expandConsumptionAttribute(r.value)]),i.length>0&&(a=i[0]),{type:"MatchedAttributesDVO",id:t,name:t,matches:i,matchCount:i.length,bestMatch:a}}async expandAttributeNames(t){const r=t.map((t=>this.expandAttributeName(t)));return await Promise.all(r)}expandAttribute(t){return{type:"AttributeDVO",id:t.name,name:t.name,value:t.value,isOwn:!1}}async expandAttributes(t){const r=t.map((t=>this.expandAttribute(t)));return await Promise.all(r)}async expandAttributesChangeRequest(t){const r=this.expandRequest(t);let a,i;a=t.applyTo?await this.expandIdentityForAddress(t.applyTo):this.expandSelf();const o=[];for(const r of t.attributes){const t=this.expandAttribute(r);o.push(t)}const l=await this.expandAttributeNames(o.map((t=>t.id)));i=o.length>1?m.DataViewTranslateable.consumption.requests.attributesChangeRequestNamePlural:m.DataViewTranslateable.consumption.requests.attributesChangeRequestName;const c=[];return o.forEach(((t,r)=>{c.push({oldAttribute:l[r],newAttribute:t})})),{...r,type:"AttributesChangeRequestDVO",name:i,newAttributes:o,newAttributeCount:o.length,oldAttributes:l,oldAttributeCount:l.length,applyTo:a,changes:c,changeCount:c.length}}async expandAttributesRequest(t){const r=this.expandRequest(t);let a;const i=await this.expandAttributeNames(t.names);return a=i.length>1?m.DataViewTranslateable.consumption.requests.attributesChangeRequestNamePlural:m.DataViewTranslateable.consumption.requests.attributesChangeRequestName,{...r,type:"AttributesRequestDVO",names:t.names,nameCount:t.names.length,name:a,attributes:i,attributeCount:i.length,required:t.required}}expandSelf(){return{id:this.identityController.address.toString(),type:"IdentityDVO",name:"i18n://dvo.identity.self.name",initials:"i18n://dvo.identity.self.initials",realm:c.Realm.Prod,description:"i18n://dvo.identity.self.description",isSelf:!0,hasRelationship:!1}}expandUnknown(t){var r;const a=t.substring(3,9),i=(null!==(r=a.match(/\b\w/g))&&void 0!==r?r:[]).join("");return{id:this.identityController.address.toString(),type:"IdentityDVO",name:a,initials:i,realm:c.Realm.Prod,description:"i18n://dvo.identity.unknown.description",isSelf:!1,hasRelationship:!1}}async expandAttributesShareRequests(t){const r=t.map((t=>this.expandAttributesShareRequest(t)));return await Promise.all(r)}async expandAttributesChangeRequests(t){const r=t.map((t=>this.expandAttributesChangeRequest(t)));return await Promise.all(r)}async expandAddress(t){if(this.identityController.isMe(c.CoreAddress.from(t)))return this.expandSelf();const r=await this.transport.relationships.getRelationshipByAddress({address:t});return r.isError?this.expandUnknown(t):await this.expandRelationshipDTO(r.value)}async expandAddresses(t){const r=t.map((t=>this.expandAddress(t)));return await Promise.all(r)}async expandRecipient(t){return{...await this.expandAddress(t.address),type:"RecipientDVO",receivedAt:t.receivedAt,receivedByDevice:t.receivedByDevice}}async expandRecipients(t){const r=t.map((t=>this.expandRecipient(t)));return await Promise.all(r)}expandRelationshipChange(t,r){const a=r.response?r.response.createdAt:r.request.createdAt;let i,o=!1;return this.identityController.isMe(c.CoreAddress.from(r.request.createdBy))&&(o=!0),r.response&&(i={...r.response,id:`${r.id}_response`,name:"i18n://dvo.relationshipChange.response.name",type:"RelationshipChangeResponseDVO"}),Promise.resolve({type:"RelationshipChangeDVO",id:r.id,name:"",date:a,status:r.status,statusText:`i18n://dvo.relationshipChange.${r.status}`,changeType:r.type,changeTypeText:`i18n://dvo.relationshipChange.${r.type}`,isOwn:o,request:{...r.request,id:`${r.id}_request`,name:"i18n://dvo.relationshipChange.request.name",type:"RelationshipChangeRequestDVO"},response:i})}async expandRelationshipChanges(t){const r=t.changes.map((r=>this.expandRelationshipChange(t,r)));return await Promise.all(r)}async createRelationshipDVO(t,r){var a,i,o,l;if(!r){r=(await this.consumption.relationshipInfo.getRelationshipInfoByRelationship({relationshipId:t.id})).value}let u=g.RelationshipDirection.Incoming;this.identityController.isMe(c.CoreAddress.from(t.changes[0].request.createdBy))&&(u=g.RelationshipDirection.Outgoing);let d="";t.status===c.RelationshipStatus.Pending&&u===g.RelationshipDirection.Outgoing?d=m.DataViewTranslateable.transport.relationshipOutgoing:t.status===c.RelationshipStatus.Pending?d=m.DataViewTranslateable.transport.relationshipIncoming:t.status===c.RelationshipStatus.Rejected?d=m.DataViewTranslateable.transport.relationshipRejected:t.status===c.RelationshipStatus.Revoked?d=m.DataViewTranslateable.transport.relationshipRevoked:t.status===c.RelationshipStatus.Active&&(d=m.DataViewTranslateable.transport.relationshipActive);const p=await this.expandRelationshipChanges(t);return{id:t.id,name:r.userTitle?r.userTitle:r.title,description:r.userDescription?r.userDescription:r.description,date:t.changes[0].request.createdAt,image:"",type:"RelationshipDVO",status:t.status,statusText:d,direction:u,isPinned:r.isPinned,theme:{image:null===(a=r.theme)||void 0===a?void 0:a.image,headerImage:null===(i=r.theme)||void 0===i?void 0:i.imageBar,backgroundColor:null===(o=r.theme)||void 0===o?void 0:o.backgroundColor,foregroundColor:null===(l=r.theme)||void 0===l?void 0:l.foregroundColor},changes:p,changeCount:p.length}}async expandRelationshipDTO(t){var r;const a=(await this.consumption.relationshipInfo.getRelationshipInfoByRelationship({relationshipId:t.id})).value,i=a.userTitle?a.userTitle:a.title;let o=a.userDescription?a.userDescription:a.description;const l=(null!==(r=i.match(/\b\w/g))&&void 0!==r?r:[]).join(""),c=await this.createRelationshipDVO(t,a);return o||(o=c.statusText),{type:"IdentityDVO",id:t.peer,name:i,date:c.date,description:o,publicKey:t.peerIdentity.publicKey,realm:t.peerIdentity.realm,initials:l,isSelf:!1,hasRelationship:!0,relationship:c}}async expandIdentityForAddress(t){var r;if(t===this.identityController.address.toString())return this.expandSelf();const a=await this.transport.relationships.getRelationshipByAddress({address:t});if(a.isSuccess)return await this.expandRelationshipDTO(a.value);if(a.error.code!==h.RuntimeErrors.general.recordNotFound(c.Relationship).code)throw a.error;const i=t.substring(3,9),o=(null!==(r=i.match(/\b\w/g))&&void 0!==r?r:[]).join("");return{id:t,type:"IdentityDVO",name:i,initials:o,publicKey:"i18n://dvo.identity.publicKey.unknown",realm:this.identityController.realm.toString(),description:"i18n://dvo.identity.unknown",isSelf:!1,hasRelationship:!1}}async expandIdentity(t){return await this.expandIdentityForAddress(t.address)}async expandRelationshipDTOs(t){const r=t.map((t=>this.expandRelationshipDTO(t)));return await Promise.all(r)}async expandFileId(t){const r=await this.transport.files.getFile({id:t});if(r.isError)throw r.error;return await this.expandFileDTO(r.value)}async expandFileIds(t){const r=t.map((t=>this.expandFileId(t)));return await Promise.all(r)}async expandFileDTO(t){return{...t,type:"FileDVO",id:t.id,name:t.title?t.title:t.filename,date:t.createdAt,image:"",filename:t.filename,filesize:t.filesize,createdBy:await this.expandAddress(t.createdBy),deletedBy:t.deletedBy?await this.expandAddress(t.deletedBy):void 0}}async expandFileDTOs(t){const r=t.map((t=>this.expandFileDTO(t)));return await Promise.all(r)}};v=i([l(0,u.Inject),l(1,u.Inject),l(2,u.Inject),o("design:paramtypes",[d.TransportServices,p.ConsumptionServices,c.IdentityController])],v),r.DataViewExpander=v},9121:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},32043:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.DataViewTranslateable=void 0;class DataViewTranslateable{}r.DataViewTranslateable=DataViewTranslateable,DataViewTranslateable.prefix="i18n://dvo.",DataViewTranslateable.transport={messageName:`${DataViewTranslateable.prefix}message.name`,relationshipOutgoing:`${DataViewTranslateable.prefix}relationship.Outgoing`,relationshipIncoming:`${DataViewTranslateable.prefix}relationship.Incoming`,relationshipRejected:`${DataViewTranslateable.prefix}relationship.Rejected`,relationshipRevoked:`${DataViewTranslateable.prefix}relationship.Revoked`,relationshipActive:`${DataViewTranslateable.prefix}relationship.Active`,fileName:`${DataViewTranslateable.prefix}file.name`},DataViewTranslateable.consumption={mails:{mailSubjectFallback:`${DataViewTranslateable.prefix}mails.mailSubjectFallback`,requestMailSubjectFallback:`${DataViewTranslateable.prefix}mails.requestMailSubjectFallback`},attributes:{unknownAttributeName:`${DataViewTranslateable.prefix}attributes.UnknownAttributeName`},requests:{attributesShareRequestName:`${DataViewTranslateable.prefix}requests.AttributesShareRequest.name`,attributesShareRequestNamePlural:`${DataViewTranslateable.prefix}requests.AttributesShareRequest.namePlural`,attributesShareRequestNoRelationship:`${DataViewTranslateable.prefix}requests.AttributesShareRequest.noRelationship`,attributesShareRequestOnlyRelationships:`${DataViewTranslateable.prefix}requests.AttributesShareRequest.onlyRelationships`,attributesChangeRequestName:`${DataViewTranslateable.prefix}requests.AttributesChangeRequest.name`,attributesChangeRequestNamePlural:`${DataViewTranslateable.prefix}requests.AttributesChangeRequest.namePlural`},identities:{self:`${DataViewTranslateable.prefix}identities.self.name`}}},89248:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},18928:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},48306:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(89248),r),o(a(18928),r)},39427:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},89542:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(39427),r)},33112:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},36519:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},63522:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},80166:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(33112),r),o(a(36519),r),o(a(63522),r)},34086:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(48306),r),o(a(89542),r),o(a(80166),r),o(a(64869),r),o(a(9121),r),o(a(32043),r),o(a(56574),r)},84457:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},56342:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},14700:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.MessageStatus=void 0,function(t){t.Received="Received",t.Delivering="Delivering",t.Delivered="Delivered"}(r.MessageStatus||(r.MessageStatus={}))},82466:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.RelationshipDirection=void 0,function(t){t.Outgoing="Outgoing",t.Incoming="Incoming"}(r.RelationshipDirection||(r.RelationshipDirection={}))},49893:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},56574:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(84457),r),o(a(56342),r),o(a(14700),r),o(a(82466),r),o(a(49893),r)},21291:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.DataEvent=void 0;const i=a(44584);class DataEvent extends i.Event{constructor(t,r,a){super(t),this.eventTargetAddress=r,this.data=a}}r.DataEvent=DataEvent},44584:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.Event=void 0;r.Event=class Event{constructor(t){this.namespace=t}}},34209:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.MailReceivedEvent=void 0;const i=a(21291);class MailReceivedEvent extends i.DataEvent{constructor(t,r,a){super(MailReceivedEvent.namespace,t,a),this.mail=r}}r.MailReceivedEvent=MailReceivedEvent,MailReceivedEvent.namespace="consumption.mailReceived"},87834:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.RelationshipEvent=void 0;const i=a(21291);class RelationshipEvent extends i.DataEvent{constructor(t,r,a){super(RelationshipEvent.namespace+a.id,t,a),this.event=r}}r.RelationshipEvent=RelationshipEvent,RelationshipEvent.namespace="consumption.relationshipEvent."},49935:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.RequestMailReceivedEvent=void 0;const i=a(21291);class RequestMailReceivedEvent extends i.DataEvent{constructor(t,r,a){super(RequestMailReceivedEvent.namespace,t,a),this.requestMail=r}}r.RequestMailReceivedEvent=RequestMailReceivedEvent,RequestMailReceivedEvent.namespace="consumption.requestMailReceived"},66589:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.RequestReceivedEvent=void 0;const i=a(21291);class RequestReceivedEvent extends i.DataEvent{constructor(t,r,a){super(RequestReceivedEvent.namespace,t,a),this.request=r}}r.RequestReceivedEvent=RequestReceivedEvent,RequestReceivedEvent.namespace="consumption.requestReceived"},42205:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(21291),r),o(a(44584),r),o(a(76762),r),o(a(188),r),o(a(84737),r),o(a(52866),r),o(a(62937),r),o(a(48994),r),o(a(4769),r),o(a(11690),r),o(a(95049),r),o(a(17194),r)},76762:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.ModulesInitializedEvent=void 0;const i=a(44584);class ModulesInitializedEvent extends i.Event{constructor(){super(ModulesInitializedEvent.namespace)}}r.ModulesInitializedEvent=ModulesInitializedEvent,ModulesInitializedEvent.namespace="runtime.modulesInitialized"},188:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.ModulesLoadedEvent=void 0;const i=a(44584);class ModulesLoadedEvent extends i.Event{constructor(){super(ModulesLoadedEvent.namespace)}}r.ModulesLoadedEvent=ModulesLoadedEvent,ModulesLoadedEvent.namespace="runtime.modulesLoaded"},84737:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.ModulesStartedEvent=void 0;const i=a(44584);class ModulesStartedEvent extends i.Event{constructor(){super(ModulesStartedEvent.namespace)}}r.ModulesStartedEvent=ModulesStartedEvent,ModulesStartedEvent.namespace="runtime.modulesStarted"},52866:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.RuntimeInitializedEvent=void 0;const i=a(44584);class RuntimeInitializedEvent extends i.Event{constructor(){super(RuntimeInitializedEvent.namespace)}}r.RuntimeInitializedEvent=RuntimeInitializedEvent,RuntimeInitializedEvent.namespace="runtime.initialized"},62937:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.RuntimeInitializingEvent=void 0;const i=a(44584);class RuntimeInitializingEvent extends i.Event{constructor(){super(RuntimeInitializingEvent.namespace)}}r.RuntimeInitializingEvent=RuntimeInitializingEvent,RuntimeInitializingEvent.namespace="runtime.initializing"},48994:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.MessageReceivedEvent=void 0;const i=a(21291);class MessageReceivedEvent extends i.DataEvent{constructor(t,r){super(MessageReceivedEvent.namespace,t,r)}}r.MessageReceivedEvent=MessageReceivedEvent,MessageReceivedEvent.namespace="transport.messageReceived"},4769:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.MessageSentEvent=void 0;const i=a(21291);class MessageSentEvent extends i.DataEvent{constructor(t,r){super(MessageSentEvent.namespace,t,r)}}r.MessageSentEvent=MessageSentEvent,MessageSentEvent.namespace="transport.messageSent"},11690:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.RelationshipChangedEvent=void 0;const i=a(21291);class RelationshipChangedEvent extends i.DataEvent{constructor(t,r){super(RelationshipChangedEvent.namespace,t,r)}}r.RelationshipChangedEvent=RelationshipChangedEvent,RelationshipChangedEvent.namespace="transport.relationshipChanged"},95049:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.TransportLibraryInitializedEvent=void 0;const i=a(44584);class TransportLibraryInitializedEvent extends i.Event{constructor(){super(TransportLibraryInitializedEvent.namespace)}}r.TransportLibraryInitializedEvent=TransportLibraryInitializedEvent,TransportLibraryInitializedEvent.namespace="transport.initialized"},17194:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.TransportLibraryInitializingEvent=void 0;const i=a(44584);class TransportLibraryInitializingEvent extends i.Event{constructor(){super(TransportLibraryInitializingEvent.namespace)}}r.TransportLibraryInitializingEvent=TransportLibraryInitializingEvent,TransportLibraryInitializingEvent.namespace="transport.initializing"},27371:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.AnonymousServices=void 0;const c=a(7071),u=a(38346);let d=class AnonymousServices{constructor(t){this.tokens=t}};d=i([l(0,c.Inject),o("design:paramtypes",[u.AnonymousTokensFacade])],d),r.AnonymousServices=d},4629:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.ConsumptionServices=void 0;const c=a(7071),u=a(26013);let d=class ConsumptionServices{constructor(t,r,a,i,o){this.attributes=t,this.drafts=r,this.settings=a,this.sharedItems=i,this.relationshipInfo=o}};d=i([l(0,c.Inject),l(1,c.Inject),l(2,c.Inject),l(3,c.Inject),l(4,c.Inject),o("design:paramtypes",[u.AttributesFacade,u.DraftsFacade,u.SettingsFacade,u.SharedItemsFacade,u.RelationshipInfoFacade])],d),r.ConsumptionServices=d},34164:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.TransportServices=void 0;const c=a(7071),u=a(19728);let d=class TransportServices{constructor(t,r,a,i,o,l,c,u){this.files=t,this.messages=r,this.relationships=a,this.relationshipTemplates=i,this.tokens=o,this.account=l,this.devices=c,this.challenges=u}};d=i([l(0,c.Inject),l(1,c.Inject),l(2,c.Inject),l(3,c.Inject),l(4,c.Inject),l(5,c.Inject),l(6,c.Inject),l(7,c.Inject),o("design:paramtypes",[u.FilesFacade,u.MessagesFacade,u.RelationshipsFacade,u.RelationshipTemplatesFacade,u.TokensFacade,u.AccountFacade,u.DevicesFacade,u.ChallengesFacade])],d),r.TransportServices=d},37306:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.AnonymousTokensFacade=void 0;const c=a(7071),u=a(60485);let d=class AnonymousTokensFacade{constructor(t,r){this.loadPeerTokenByTruncatedReferenceUseCase=t,this.loadPeerTokenByIdAndKeyUseCase=r}async loadPeerTokenByTruncatedReference(t){return await this.loadPeerTokenByTruncatedReferenceUseCase.execute(t)}async loadPeerTokenByIdAndKey(t){return await this.loadPeerTokenByIdAndKeyUseCase.execute(t)}};d=i([l(0,c.Inject),l(1,c.Inject),o("design:paramtypes",[u.LoadPeerTokenAnonymousByTruncatedReferenceUseCase,u.LoadPeerTokenAnonymousByIdAndKeyUseCase])],d),r.AnonymousTokensFacade=d},38346:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(37306),r)},12534:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.AttributesFacade=void 0;const c=a(7071),u=a(60485);let d=class AttributesFacade{constructor(t,r,a,i,o,l,c,u,d,p,h){this.createAttributeUseCase=t,this.deleteAttributeUseCase=r,this.deleteAttributeByNameUseCase=a,this.getAllValidUseCase=i,this.getAttributeUseCase=o,this.getAttributeByNameUseCase=l,this.getAttributesUseCase=c,this.getAttributesByNamesUseCase=u,this.getHistoryByNameUseCase=d,this.succeedAttributeUseCase=p,this.updateAttributeUseCase=h}async createAttribute(t){return await this.createAttributeUseCase.execute(t)}async deleteAttribute(t){return await this.deleteAttributeUseCase.execute(t)}async deleteAttributeByName(t){return await this.deleteAttributeByNameUseCase.execute(t)}async getAllValid(){return await this.getAllValidUseCase.execute()}async getAttribute(t){return await this.getAttributeUseCase.execute(t)}async getAttributeByName(t){return await this.getAttributeByNameUseCase.execute(t)}async getAttributes(t){return await this.getAttributesUseCase.execute(t)}async getAttributesByNames(t){return await this.getAttributesByNamesUseCase.execute(t)}async getHistoryByName(t){return await this.getHistoryByNameUseCase.execute(t)}async succeedAttribute(t){return await this.succeedAttributeUseCase.execute(t)}async updateAttribute(t){return await this.updateAttributeUseCase.execute(t)}};d=i([l(0,c.Inject),l(1,c.Inject),l(2,c.Inject),l(3,c.Inject),l(4,c.Inject),l(5,c.Inject),l(6,c.Inject),l(7,c.Inject),l(8,c.Inject),l(9,c.Inject),l(10,c.Inject),o("design:paramtypes",[u.CreateAttributeUseCase,u.DeleteAttributeUseCase,u.DeleteAttributeByNameUseCase,u.GetAllValidUseCase,u.GetAttributeUseCase,u.GetAttributeByNameUseCase,u.GetAttributesUseCase,u.GetAttributesByNamesUseCase,u.GetHistoryByNameUseCase,u.SucceedAttributeUseCase,u.UpdateAttributeUseCase])],d),r.AttributesFacade=d},13514:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DraftsFacade=void 0;const c=a(7071),u=a(60485);let d=class DraftsFacade{constructor(t,r,a,i,o){this.createDraftUseCase=t,this.deleteDraftUseCase=r,this.getDraftUseCase=a,this.getDraftsUseCase=i,this.updateDraftUseCase=o}async createDraft(t){return await this.createDraftUseCase.execute(t)}async deleteDraft(t){return await this.deleteDraftUseCase.execute(t)}async getDraft(t){return await this.getDraftUseCase.execute(t)}async getDrafts(t){return await this.getDraftsUseCase.execute(t)}async updateDraft(t){return await this.updateDraftUseCase.execute(t)}};d=i([l(0,c.Inject),l(1,c.Inject),l(2,c.Inject),l(3,c.Inject),l(4,c.Inject),o("design:paramtypes",[u.CreateDraftUseCase,u.DeleteDraftUseCase,u.GetDraftUseCase,u.GetDraftsUseCase,u.UpdateDraftUseCase])],d),r.DraftsFacade=d},74786:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.RelationshipInfoFacade=void 0;const c=a(7071),u=a(60485);let d=class RelationshipInfoFacade{constructor(t,r,a,i,o,l){this.createRelationshipInfoUseCase=t,this.deleteRelationshipInfoUseCase=r,this.deleteRelationshipInfoByRelationshipUseCase=a,this.getRelationshipInfoUseCase=i,this.getRelationshipInfoByRelationshipUseCase=o,this.updateRelationshipInfoUseCase=l}async createRelationshipInfo(t){return await this.createRelationshipInfoUseCase.execute(t)}async deleteRelationshipInfo(t){return await this.deleteRelationshipInfoUseCase.execute(t)}async deleteRelationshipInfoByRelationship(t){return await this.deleteRelationshipInfoByRelationshipUseCase.execute(t)}async getRelationshipInfo(t){return await this.getRelationshipInfoUseCase.execute(t)}async getRelationshipInfoByRelationship(t){return await this.getRelationshipInfoByRelationshipUseCase.execute(t)}async updateRelationshipInfo(t){return await this.updateRelationshipInfoUseCase.execute(t)}};d=i([l(0,c.Inject),l(1,c.Inject),l(2,c.Inject),l(3,c.Inject),l(4,c.Inject),l(5,c.Inject),o("design:paramtypes",[u.CreateRelationshipInfoUseCase,u.DeleteRelationshipInfoUseCase,u.DeleteRelationshipInfoByRelationshipUseCase,u.GetRelationshipInfoUseCase,u.GetRelationshipInfoByRelationshipUseCase,u.UpdateRelationshipInfoUseCase])],d),r.RelationshipInfoFacade=d},16615:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.SettingsFacade=void 0;const c=a(7071),u=a(60485);let d=class SettingsFacade{constructor(t,r,a,i,o){this.createSettingUseCase=t,this.updateSettingUseCase=r,this.deleteSettingUseCase=a,this.getSettingsUseCase=i,this.getSettingUseCase=o}async createSetting(t){return await this.createSettingUseCase.execute(t)}async getSetting(t){return await this.getSettingUseCase.execute(t)}async getSettings(t){return await this.getSettingsUseCase.execute(t)}async deleteSetting(t){return await this.deleteSettingUseCase.execute(t)}async updateSetting(t){return await this.updateSettingUseCase.execute(t)}};d=i([l(0,c.Inject),l(1,c.Inject),l(2,c.Inject),l(3,c.Inject),l(4,c.Inject),o("design:paramtypes",[u.CreateSettingUseCase,u.UpdateSettingUseCase,u.DeleteSettingUseCase,u.GetSettingsUseCase,u.GetSettingUseCase])],d),r.SettingsFacade=d},89558:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.SharedItemsFacade=void 0;const c=a(7071),u=a(60485);let d=class SharedItemsFacade{constructor(t,r,a,i,o,l,c,u,d){this.createSharedItemUseCase=t,this.deleteSharedItemUseCase=r,this.getSharedItemUseCase=a,this.getSharedItemsUseCase=i,this.getSharedItemsByAddressUseCase=o,this.getSharedItemsByReferenceUseCase=l,this.getSharedItemsSharedByAddressUseCase=c,this.getSharedItemsSharedWithAddressUseCase=u,this.updateSharedItemUseCase=d}async createSharedItem(t){return await this.createSharedItemUseCase.execute(t)}async deleteSharedItem(t){return await this.deleteSharedItemUseCase.execute(t)}async getSharedItem(t){return await this.getSharedItemUseCase.execute(t)}async getSharedItems(t){return await this.getSharedItemsUseCase.execute(t)}async getSharedItemsByAddress(t){return await this.getSharedItemsByAddressUseCase.execute(t)}async getSharedItemsByReference(t){return await this.getSharedItemsByReferenceUseCase.execute(t)}async getSharedItemsSharedByAddress(t){return await this.getSharedItemsSharedByAddressUseCase.execute(t)}async getSharedItemsSharedWithAddress(t){return await this.getSharedItemsSharedWithAddressUseCase.execute(t)}async updateSharedItem(t){return await this.updateSharedItemUseCase.execute(t)}};d=i([l(0,c.Inject),l(1,c.Inject),l(2,c.Inject),l(3,c.Inject),l(4,c.Inject),l(5,c.Inject),l(6,c.Inject),l(7,c.Inject),l(8,c.Inject),o("design:paramtypes",[u.CreateSharedItemUseCase,u.DeleteSharedItemUseCase,u.GetSharedItemUseCase,u.GetSharedItemsUseCase,u.GetSharedItemsByAddressUseCase,u.GetSharedItemsByReferenceUseCase,u.GetSharedItemsSharedByAddressUseCase,u.GetSharedItemsSharedWithAddressUseCase,u.UpdateSharedItemUseCase])],d),r.SharedItemsFacade=d},26013:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(12534),r),o(a(13514),r),o(a(74786),r),o(a(16615),r),o(a(89558),r)},30941:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.AccountFacade=void 0;const c=a(7071),u=a(60485);let d=class AccountFacade{constructor(t,r,a,i,o,l,c,u){this.getIdentityInfoUseCase=t,this.getDeviceInfoUseCase=r,this.registerPushNotificationTokenUseCase=a,this.syncDatawalletUseCase=i,this.syncEverythingUseCase=o,this.getSyncInfoUseCase=l,this.disableAutoSyncUseCase=c,this.enableAutoSyncUseCase=u}async getIdentityInfo(){return await this.getIdentityInfoUseCase.execute()}async getDeviceInfo(){return await this.getDeviceInfoUseCase.execute()}createDeviceBackup(){throw u.RuntimeErrors.general.notImplemented()}recoverDevice(){throw u.RuntimeErrors.general.notImplemented()}async registerPushNotificationToken(t){return await this.registerPushNotificationTokenUseCase.execute(t)}async syncDatawallet(){return await this.syncDatawalletUseCase.execute()}async syncEverything(){return await this.syncEverythingUseCase.execute()}async getSyncInfo(){return await this.getSyncInfoUseCase.execute()}async enableAutoSync(){return await this.enableAutoSyncUseCase.execute()}async disableAutoSync(){return await this.disableAutoSyncUseCase.execute()}};d=i([l(0,c.Inject),l(1,c.Inject),l(2,c.Inject),l(3,c.Inject),l(4,c.Inject),l(5,c.Inject),l(6,c.Inject),l(7,c.Inject),o("design:paramtypes",[u.GetIdentityInfoUseCase,u.GetDeviceInfoUseCase,u.RegisterPushNotificationTokenUseCase,u.SyncDatawalletUseCase,u.SyncEverythingUseCase,u.GetSyncInfoUseCase,u.DisableAutoSyncUseCase,u.EnableAutoSyncUseCase])],d),r.AccountFacade=d},44213:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.ChallengesFacade=void 0;const c=a(7071),u=a(60485);let d=class ChallengesFacade{constructor(t,r){this.createChallengeUseCase=t,this.validateChallengeUseCase=r}async createChallenge(t){return await this.createChallengeUseCase.execute(t)}async validateChallenge(t){return await this.validateChallengeUseCase.execute(t)}};d=i([l(0,c.Inject),l(1,c.Inject),o("design:paramtypes",[u.CreateChallengeUseCase,u.ValidateChallengeUseCase])],d),r.ChallengesFacade=d},17974:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DevicesFacade=void 0;const c=a(7071),u=a(60485);let d=class DevicesFacade{constructor(t,r,a,i,o,l,c){this.getDeviceUseCase=t,this.getDevicesUseCase=r,this.createDeviceUseCase=a,this.updateDeviceUseCase=i,this.deleteDeviceUseCase=o,this.getDeviceOnboardingInfoUseCase=l,this.getDeviceOnboardingTokenUseCase=c}async getDevice(t){return await this.getDeviceUseCase.execute(t)}async getDevices(){return await this.getDevicesUseCase.execute()}async createDevice(t){return await this.createDeviceUseCase.execute(t)}async getDeviceOnboardingInfo(t){return await this.getDeviceOnboardingInfoUseCase.execute(t)}async getDeviceOnboardingToken(t){return await this.getDeviceOnboardingTokenUseCase.execute(t)}async updateDevice(t){return await this.updateDeviceUseCase.execute(t)}async deleteDevice(t){return await this.deleteDeviceUseCase.execute(t)}};d=i([l(0,c.Inject),l(1,c.Inject),l(2,c.Inject),l(3,c.Inject),l(4,c.Inject),l(5,c.Inject),l(6,c.Inject),o("design:paramtypes",[u.GetDeviceUseCase,u.GetDevicesUseCase,u.CreateDeviceUseCase,u.UpdateDeviceUseCase,u.DeleteDeviceUseCase,u.GetDeviceOnboardingInfoUseCase,u.CreateDeviceOnboardingTokenUseCase])],d),r.DevicesFacade=d},50360:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.FilesFacade=void 0;const c=a(7071),u=a(60485);let d=class FilesFacade{constructor(t,r,a,i,o,l,c){this.uploadOwnFileUseCase=t,this.loadPeerFileUseCase=r,this.getFilesUseCase=a,this.downloadFileUseCase=i,this.getFileUseCase=o,this.createTokenForFileUseCase=l,this.createTokenQrCodeForFileUseCase=c}async getFiles(t){return await this.getFilesUseCase.execute(t)}async loadPeerFile(t){return await this.loadPeerFileUseCase.execute(t)}async downloadFile(t){return await this.downloadFileUseCase.execute(t)}async getFile(t){return await this.getFileUseCase.execute(t)}async uploadOwnFile(t){return await this.uploadOwnFileUseCase.execute(t)}async createTokenForFile(t){return await this.createTokenForFileUseCase.execute(t)}async createTokenQrCodeForFile(t){return await this.createTokenQrCodeForFileUseCase.execute(t)}};d=i([l(0,c.Inject),l(1,c.Inject),l(2,c.Inject),l(3,c.Inject),l(4,c.Inject),l(5,c.Inject),l(6,c.Inject),o("design:paramtypes",[u.UploadOwnFileUseCase,u.LoadPeerFileUseCase,u.GetFilesUseCase,u.DownloadFileUseCase,u.GetFileUseCase,u.CreateTokenForFileUseCase,u.CreateTokenQrCodeForFileUseCase])],d),r.FilesFacade=d},91106:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.IdentityFacade=void 0;const c=a(7071),u=a(60485);let d=class IdentityFacade{constructor(t){this.checkIdentityUseCase=t}async checkIdentity(t){return await this.checkIdentityUseCase.execute(t)}};d=i([l(0,c.Inject),o("design:paramtypes",[u.CheckIdentityUseCase])],d),r.IdentityFacade=d},81532:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.MessagesFacade=void 0;const c=a(7071),u=a(60485);let d=class MessagesFacade{constructor(t,r,a,i,o){this.getMessagesUseCase=t,this.getMessageUseCase=r,this.sendMessageUseCase=a,this.downloadAttachmentUseCase=i,this.getAttachmentMetadataUseCase=o}async sendMessage(t){return await this.sendMessageUseCase.execute(t)}async getMessages(t){return await this.getMessagesUseCase.execute(t)}async getMessage(t){return await this.getMessageUseCase.execute(t)}async downloadAttachment(t){return await this.downloadAttachmentUseCase.execute(t)}async getAttachmentMetadata(t){return await this.getAttachmentMetadataUseCase.execute(t)}};d=i([l(0,c.Inject),l(1,c.Inject),l(2,c.Inject),l(3,c.Inject),l(4,c.Inject),o("design:paramtypes",[u.GetMessagesUseCase,u.GetMessageUseCase,u.SendMessageUseCase,u.DownloadAttachmentUseCase,u.GetAttachmentMetadataUseCase])],d),r.MessagesFacade=d},47349:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.RelationshipTemplatesFacade=void 0;const c=a(7071),u=a(60485);let d=class RelationshipTemplatesFacade{constructor(t,r,a,i,o,l){this.createOwnRelationshipTemplateUseCase=t,this.loadPeerRelationshipTemplateUseCase=r,this.getRealtionshipTemplatesUseCase=a,this.getRelationshipTemplateUseCase=i,this.createTokenQrCodeForOwnTemplateUseCase=o,this.createTokenForOwnTemplateUseCase=l}async createOwnRelationshipTemplate(t){return await this.createOwnRelationshipTemplateUseCase.execute(t)}async loadPeerRelationshipTemplate(t){return await this.loadPeerRelationshipTemplateUseCase.execute(t)}async getRelationshipTemplates(t){return await this.getRealtionshipTemplatesUseCase.execute(t)}async getRelationshipTemplate(t){return await this.getRelationshipTemplateUseCase.execute(t)}async createTokenQrCodeForOwnTemplate(t){return await this.createTokenQrCodeForOwnTemplateUseCase.execute(t)}async createTokenForOwnTemplate(t){return await this.createTokenForOwnTemplateUseCase.execute(t)}};d=i([l(0,c.Inject),l(1,c.Inject),l(2,c.Inject),l(3,c.Inject),l(4,c.Inject),l(5,c.Inject),o("design:paramtypes",[u.CreateOwnRelationshipTemplateUseCase,u.LoadPeerRelationshipTemplateUseCase,u.GetRelationshipTemplatesUseCase,u.GetRelationshipTemplateUseCase,u.CreateTokenQrCodeForOwnTemplateUseCase,u.CreateTokenForOwnTemplateUseCase])],d),r.RelationshipTemplatesFacade=d},98586:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.RelationshipsFacade=void 0;const c=a(7071),u=a(60485);let d=class RelationshipsFacade{constructor(t,r,a,i,o,l,c,u){this.getRelationshipsUseCase=t,this.getRelationshipUseCase=r,this.getRelationshipByAddressUseCase=a,this.createRelationshipUseCase=i,this.createRelationshipChangeUseCase=o,this.acceptRelationshipChangeUseCase=l,this.rejectRelationshipChangeUseCase=c,this.revokeRelationshipChangeUseCase=u}async getRelationships(t){return await this.getRelationshipsUseCase.execute(t)}async getRelationship(t){return await this.getRelationshipUseCase.execute(t)}async getRelationshipByAddress(t){return await this.getRelationshipByAddressUseCase.execute(t)}async createRelationship(t){return await this.createRelationshipUseCase.execute(t)}async createRelationshipChange(t){return await this.createRelationshipChangeUseCase.execute(t)}async acceptRelationshipChange(t){return await this.acceptRelationshipChangeUseCase.execute(t)}async rejectRelationshipChange(t){return await this.rejectRelationshipChangeUseCase.execute(t)}async revokeRelationshipChange(t){return await this.revokeRelationshipChangeUseCase.execute(t)}};d=i([l(0,c.Inject),l(1,c.Inject),l(2,c.Inject),l(3,c.Inject),l(4,c.Inject),l(5,c.Inject),l(6,c.Inject),l(7,c.Inject),o("design:paramtypes",[u.GetRelationshipsUseCase,u.GetRelationshipUseCase,u.GetRelationshipByAddressUseCase,u.CreateRelationshipUseCase,u.CreateRelationshipChangeUseCase,u.AcceptRelationshipChangeUseCase,u.RejectRelationshipChangeUseCase,u.RevokeRelationshipChangeUseCase])],d),r.RelationshipsFacade=d},75392:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.TokensFacade=void 0;const c=a(7071),u=a(60485);let d=class TokensFacade{constructor(t,r,a,i,o){this.createOwnTokenUseCase=t,this.loadPeerTokenUseCase=r,this.getTokensUseCase=a,this.getTokenUseCase=i,this.getQRCodeForTokenUseCase=o}async createOwnToken(t){return await this.createOwnTokenUseCase.execute(t)}async loadPeerToken(t){return await this.loadPeerTokenUseCase.execute(t)}async getTokens(t){return await this.getTokensUseCase.execute(t)}async getToken(t){return await this.getTokenUseCase.execute(t)}async getQRCodeForToken(t){return await this.getQRCodeForTokenUseCase.execute(t)}};d=i([l(0,c.Inject),l(1,c.Inject),l(2,c.Inject),l(3,c.Inject),l(4,c.Inject),o("design:paramtypes",[u.CreateOwnTokenUseCase,u.LoadPeerTokenUseCase,u.GetTokensUseCase,u.GetTokenUseCase,u.GetQRCodeForTokenUseCase])],d),r.TokensFacade=d},19728:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(30941),r),o(a(44213),r),o(a(17974),r),o(a(50360),r),o(a(91106),r),o(a(81532),r),o(a(98586),r),o(a(47349),r),o(a(75392),r)},5200:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(27371),r),o(a(4629),r),o(a(22432),r),o(a(55372),r),o(a(34164),r)},22432:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.RuntimeModule=void 0;r.RuntimeModule=class RuntimeModule{get name(){return this.configuration.name}get displayName(){return this.configuration.displayName}}},55372:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.ModulesIterator=r.RuntimeModuleRegistry=void 0;class RuntimeModuleRegistry{constructor(){this.modules=[]}getByName(t){return this.modules.find((r=>r.name.toLowerCase()===t.toLowerCase()))}add(t){this.modules.push(t)}toArray(){return this.modules.slice()}[Symbol.iterator](){return new ModulesIterator(this.modules)}}r.RuntimeModuleRegistry=RuntimeModuleRegistry;class ModulesIterator{constructor(t){this.items=t,this.currentIndex=0}next(t){return{value:this.items[this.currentIndex++],done:this.currentIndex>this.items.length}}}r.ModulesIterator=ModulesIterator},65590:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(2500),r),o(a(34086),r),o(a(42205),r),o(a(5200),r),o(a(49662),r),o(a(6984),r),o(a(59757),r),o(a(986),r),o(a(83377),r),o(a(60485),r)},86432:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});const i=a(25030),o=a(42205),l=a(34209),c=a(87834),u=a(49935),d=a(66589),p=a(22432);class MessageModule extends p.RuntimeModule{init(){}start(){this.messageReceivedSubscription=this.runtime.eventBus.subscribe(o.MessageReceivedEvent,this.handleMessageReceived)}async handleMessageReceived(t){const r=t.data;this.logger.trace(`Incoming MessageReceivedEvent for ${r.id}`);let a;switch(r.content["@type"]){case"Mail":const o=await i.Mail.from(r.content);a=new l.MailReceivedEvent(t.eventTargetAddress,o,r),this.runtime.eventBus.publish(a),this.logger.trace(`Published MailReceivedEvent for ${r.id}`);break;case"RequestMail":const c=await i.RequestMail.from(r.content);a=new u.RequestMailReceivedEvent(t.eventTargetAddress,c,r),this.runtime.eventBus.publish(a),this.logger.trace(`Published RequestMailReceivedEvent for ${r.id}`);let p=0;for(const a of c.requests)this.runtime.eventBus.publish(new d.RequestReceivedEvent(t.eventTargetAddress,a,r)),this.logger.trace(`Published RequestReceivedEvent request #${p} of RequestMail ${r.id}`),p++;break;default:return}const o=await this.runtime.transportServices.relationships.getRelationshipByAddress({address:r.createdBy});if(!o.isSuccess)return void this.logger.error(`Could not find relationship for address '${r.createdBy}'.`,o.error);const p=o.value;this.runtime.eventBus.publish(new c.RelationshipEvent(t.eventTargetAddress,a,p)),this.logger.trace(`Published RelationshipEvent for ${r.id} to ${p.id}`)}stop(){this.runtime.eventBus.unsubscribe(o.MessageReceivedEvent,this.messageReceivedSubscription)}}r.default=MessageModule},49662:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(86432),r)},25953:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},61776:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},5292:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},58162:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},13899:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},77744:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},17564:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},34009:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},87946:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(61776),r),o(a(5292),r),o(a(58162),r),o(a(13899),r),o(a(77744),r),o(a(17564),r),o(a(34009),r)},83377:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(87946),r),o(a(25953),r),o(a(70450),r)},53456:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},77891:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},59475:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},13462:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},46261:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},86623:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},40641:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},55968:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},82944:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.RelationshipChangeType=r.RelationshipChangeStatus=void 0,function(t){t.Pending="Pending",t.Rejected="Rejected",t.Revoked="Revoked",t.Accepted="Accepted"}(r.RelationshipChangeStatus||(r.RelationshipChangeStatus={})),function(t){t.Creation="Creation",t.Termination="Termination",t.TerminationCancellation="TerminationCancellation"}(r.RelationshipChangeType||(r.RelationshipChangeType={}))},2220:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.RelationshipStatus=void 0,function(t){t.Pending="Pending",t.Active="Active",t.Rejected="Rejected",t.Revoked="Revoked",t.Terminating="Terminating",t.Terminated="Terminated"}(r.RelationshipStatus||(r.RelationshipStatus={}))},16081:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},44561:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},70450:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(53456),r),o(a(77891),r),o(a(59475),r),o(a(13462),r),o(a(46261),r),o(a(86623),r),o(a(40641),r),o(a(55968),r),o(a(82944),r),o(a(2220),r),o(a(16081),r),o(a(44561),r)},49365:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(7771),r)},70807:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.LoadPeerTokenAnonymousByIdAndKeyUseCase=void 0;const c=a(75172),u=a(82890),d=a(19663),p=a(7071),h=a(7049),m=a(57121);class LoadPeerTokenAnonymousByIdAndKeyRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.id)).fulfills(h.IdValidator.required(d.BackboneIds.token)),this.validateIfString((t=>t.secretKey)).isNotNull()}}let y=class LoadPeerTokenAnonymousByIdAndKeyUseCase extends h.UseCase{constructor(t,r){super(r),this.anonymousTokenController=t}async executeInternal(t){const r=await u.CryptoSecretKey.fromBase64(t.secretKey),a=await this.anonymousTokenController.loadPeerToken(d.CoreId.from(t.id),r);return c.Result.ok(await m.TokenMapper.toTokenDTO(a,!0))}};y=i([l(0,p.Inject),l(1,p.Inject),o("design:paramtypes",[d.AnonymousTokenController,LoadPeerTokenAnonymousByIdAndKeyRequestValidator])],y),r.LoadPeerTokenAnonymousByIdAndKeyUseCase=y},86297:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.LoadPeerTokenAnonymousByTruncatedReferenceUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049),h=a(57121);class LoadPeerTokenAnonymousByTruncatedReferenceRequestValidator extends p.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.reference)).isNotNull()}}let m=class LoadPeerTokenAnonymousByTruncatedReferenceUseCase extends p.UseCase{constructor(t,r){super(r),this.anonymousTokenController=t}async executeInternal(t){const r=await this.anonymousTokenController.loadPeerTokenByTruncated(t.reference);return c.Result.ok(await h.TokenMapper.toTokenDTO(r,!0))}};m=i([l(0,d.Inject),l(1,d.Inject),o("design:paramtypes",[u.AnonymousTokenController,LoadPeerTokenAnonymousByTruncatedReferenceRequestValidator])],m),r.LoadPeerTokenAnonymousByTruncatedReferenceUseCase=m},7771:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(70807),r),o(a(86297),r)},56819:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.OwnerRestriction=void 0,function(t){t.Own="o",t.Peer="p"}(r.OwnerRestriction||(r.OwnerRestriction={}))},48728:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.PlatformErrorCodes=void 0;class PlatformErrorCodes{static isNotFoundError(t){return t.code===PlatformErrorCodes.NOT_FOUND}static isValidationError(t){return t.code.startsWith("error.platform.validation")}static isUnexpectedError(t){return t.code.startsWith("error.platform.validation")}}r.PlatformErrorCodes=PlatformErrorCodes,PlatformErrorCodes.NOT_FOUND="error.platform.recordNotFound",PlatformErrorCodes.UNAUTHORIZED="error.platform.unauthorized",PlatformErrorCodes.FORBIDDEN="error.platform.forbidden",PlatformErrorCodes.INVALID_PROPERTY_VALUE="error.platform.invalidPropertyValue",PlatformErrorCodes.UNEXPECTED="error.platform.unexpected"},73832:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__setModuleDefault||(Object.create?function(t,r){Object.defineProperty(t,"default",{enumerable:!0,value:r})}:function(t,r){t.default=r}),l=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var r={};if(null!=t)for(var a in t)"default"!==a&&Object.prototype.hasOwnProperty.call(t,a)&&i(r,t,a);return o(r,t),r};Object.defineProperty(r,"__esModule",{value:!0}),r.QRCode=void 0;const c=l(a(92592));class QRCode{constructor(t){this.base64=t}asBase64(){return this.base64}static async from(t){const r=(await c.toDataURL(`nmshd://qr#${t}`)).split(",")[1];return new QRCode(r)}}r.QRCode=QRCode},6595:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.RuntimeErrors=void 0;const i=a(75172);class RuntimeErrors{}r.RuntimeErrors=RuntimeErrors,RuntimeErrors.general=new class General{unknown(t,r){return new i.ApplicationError("error.runtime.unknown",t,r)}alreadyInitialized(){return new i.ApplicationError("error.runtime.alreadyInitialized","The runtime is already initialized. The init method can only be executed once.")}notInitialized(){return new i.ApplicationError("error.runtime.notInitialized","The runtime is not initialized. You must run init before you can start or stop the runtime.")}alreadyStarted(){return new i.ApplicationError("error.runtime.alreadyStarted","The runtime is already started. You should stop it first for a restart.")}notStarted(){return new i.ApplicationError("error.runtime.notStarted","The runtime is not started. You should start it before stopping.")}recordNotFound(t){return this.recordNotFoundWithMessage(`${t instanceof Function?t.name:t} not found. Make sure the ID exists and the record is not expired.`)}recordNotFoundWithMessage(t){return new i.ApplicationError("error.runtime.recordNotFound",t)}unauthorized(){return new i.ApplicationError("error.runtime.unauthorized","Unauthorized.")}missingRequiredProperty(t){return new i.ApplicationError("error.runtime.validation.missingRequiredProperty",`'${t}' must not be empty.`)}invalidPropertyValue(t,r){return new i.ApplicationError("error.runtime.validation.invalidPropertyValue",null!=r?r:`The value of '${t}' is not valid.`)}invalidPayload(t){return new i.ApplicationError("error.runtime.validation.invalidPayload",null!=t?t:"The given combination of properties in the payload is not supported.")}notImplemented(){return new i.ApplicationError("error.runtime.methodNotImplemented","The requested method is not yet implemented.")}featureNotImplemented(t){return new i.ApplicationError("error.runtime.featureNotImplemented",t)}invalidTokenContent(){return new i.ApplicationError("error.runtime.invalidTokenContent","The given token has an invalid content for this route.")}cacheEmpty(t,r){return new i.ApplicationError("error.runtime.cacheEmpty",`The cache of ${t instanceof Function?t.name:t} with id '${r}' is empty.`)}},RuntimeErrors.serval=new class Serval{unknownType(t){return new i.ApplicationError("error.runtime.unknownType",t)}general(t){return new i.ApplicationError("error.runtime.servalError",t)}requestDeserialization(t){return new i.ApplicationError("error.runtime.requestDeserialization",t)}},RuntimeErrors.startup=new class Startup{noIdentityFound(){return new i.ApplicationError("error.runtime.startup.noIdentityFound","No identity information could be found. Please check your database integrity.")}noActiveAccount(){return new i.ApplicationError("error.runtime.startup.noActiveAccount","No AccountController could be found. You might have to login first.")}noActiveConsumptionController(){return new i.ApplicationError("error.runtime.startup.noActiveConsumptionController","No ConsumptionController could be found. You might have to login first.")}noActiveExpander(){return new i.ApplicationError("error.runtime.startup.noActiveExpander","No DataViewExpander could be found. You might have to login first.")}noDatabaseDefined(){return new i.ApplicationError("error.runtime.startup.noDatabaseDefined","No database is defined. Please check the database configuration.")}noPlatformConnection(){return new i.ApplicationError("error.runtime.startup.noPlatformConnection","No platform connection could be established. Please check you network connectivity.")}privateDeviceKeyInvalid(){return new i.ApplicationError("error.runtime.startup.privateDeviceKeyInvalid","The private key of this device seems to be invalid. You should check your config or database connection.")}},RuntimeErrors.database=new class Database{unknown(){return new i.ApplicationError("error.runtime.database.unknown","An unknown database error occured. Please check the logs.")}connectionError(){return new i.ApplicationError("error.runtime.database.connectionError","Connection to database could not be established. Please check the database credentials.")}quotaExceeded(){return new i.ApplicationError("error.runtime.database.quotaExceeded","It seems that the database quota exceeded. Please increase the database size.")}},RuntimeErrors.relationshipTemplates=new class RelationshipTemplates{cannotCreateTokenForPeerTemplate(){return new i.ApplicationError("error.runtime.relationshipRequests.cannotCreateTokenForPeerTemplate","You cannot create a token for a peer template.")}},RuntimeErrors.messages=new class Messages{fileNotFoundInMessage(t){return new i.ApplicationError("error.runtime.messages.fileNotFoundInMessage",`The requested file '${t}' was not found in the given message.`)}},RuntimeErrors.relationshipInfo=new class RelationshipInfo{relationshipInfoExists(t){return new i.ApplicationError("error.runtime.relationshipInfo.relationshipInfoExists",`RelationshipInfo for RelationshipId ${t} already exists. Try to update the RelationshipInfo instead.`)}},RuntimeErrors.challenges=new class Challenges{invalidSignature(){return new i.ApplicationError("error.runtime.challenges.invalidSignature","The signature is invalid.")}invalidChallenge(){return new i.ApplicationError("error.runtime.challenges.invalidChallenge","The challenge is invalid.")}}},71683:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.RuntimeValidator=void 0;const i=a(63586);class RuntimeValidator extends i.AbstractValidator{constructor(){super(),this.validateIfAny((t=>t)).isDefined().withFailureMessage("request is undefined")}}r.RuntimeValidator=RuntimeValidator},32746:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__setModuleDefault||(Object.create?function(t,r){Object.defineProperty(t,"default",{enumerable:!0,value:r})}:function(t,r){t.default=r}),l=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var r={};if(null!=t)for(var a in t)"default"!==a&&Object.prototype.hasOwnProperty.call(t,a)&&i(r,t,a);return o(r,t),r},c=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:!0}),r.JsonSchema=r.SchemaRepository=void 0;const u=c(a(1581)),d=c(a(33351)),p=c(a(5477)),h={fileId:"FIL[A-z0-9]{17}",relationshipId:"REL[A-z0-9]{17}",messageId:"MSG[A-z0-9]{17}",relationshipTemplateId:"RLT[A-z0-9]{17}",tokenId:"TOK[A-z0-9]{17}",relationshipChangeId:"RCH[A-z0-9]{17}",deviceId:"DVC[A-z0-9]{17}",challengeId:"CHL[A-z0-9]{17}"};r.SchemaRepository=class SchemaRepository{constructor(){this.jsonSchemas=new Map,this.compiler=new u.default({allErrors:!0}),(0,p.default)(this.compiler),(0,d.default)(this.compiler),this.addCustomFormats()}addCustomFormats(){Object.entries(h).forEach((([t,r])=>{this.compiler.addFormat(t,r)}))}async loadSchemas(){this.schemaDefinitions=await Promise.resolve().then((()=>l(a(11873))))}getSchema(t){return this.jsonSchemas.has(t)||this.jsonSchemas.set(t,new JsonSchema(this.getValidationFunction(t))),this.jsonSchemas.get(t)}getValidationFunction(t){return this.compiler.compile(this.getSchemaDefinition(t))}getSchemaDefinition(t){const r=this.schemaDefinitions[t];if(!r)throw new Error(`Schema ${t} not found`);return r}};class JsonSchema{constructor(t){this.validateSchema=t}validate(t){return{isValid:this.validateSchema(t),errors:this.validateSchema.errors?[...this.validateSchema.errors]:void 0}}}r.JsonSchema=JsonSchema},11873:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.GetDeviceOnboardingInfoRequest=r.GetDeviceRequest=r.DeleteDeviceRequest=r.CreateDeviceOnboardingTokenRequest=r.CreateDeviceRequest=r.ValidateChallengeRequest=r.CreateChallengeRequest=r.CreateDeviceChallengeRequest=r.CreateIdentityChallengeRequest=r.CreateRelationshipChallengeRequest=r.DownloadAttachmentRequest=r.DownloadFileRequest=r.RegisterPushNotificationTokenRequest=r.UpdateSharedItemRequest=r.GetSharedItemsSharedWithAddressRequest=r.GetSharedItemsSharedByAddressRequest=r.GetSharedItemsByReferenceRequest=r.GetSharedItemsByAddressRequest=r.GetSharedItemsRequest=r.GetSharedItemRequest=r.DeleteSharedItemRequest=r.CreateSharedItemRequest=r.UpdateSettingRequest=r.GetSettingsRequest=r.GetSettingRequest=r.DeleteSettingRequest=r.CreateSettingRequest=r.UpdateRelationshipInfoRequest=r.GetRelationshipInfoByRelationshipRequest=r.GetRelationshipInfoRequest=r.DeleteRelationshipInfoByRelationshipRequest=r.DeleteRelationshipInfoRequest=r.CreateRelationshipInfoRequest=r.UpdateDraftRequest=r.GetDraftsRequest=r.GetDraftRequest=r.DeleteDraftRequest=r.CreateDraftRequest=r.UpdateAttributeRequest=r.SucceedAttributeRequest=r.GetHistoryByNameRequest=r.GetAttributesRequest=r.GetAttributeByNameRequest=r.GetAttributeRequest=r.DeleteAttributeByNameRequest=r.DeleteAttributeRequest=r.CreateAttributeRequest=r.GetAttributesByNamesRequest=r.LoadPeerTokenAnonymousByTruncatedReferenceRequest=r.LoadPeerTokenAnonymousByIdAndKeyRequest=void 0,r.LoadPeerTokenRequest=r.GetTokensRequest=r.GetTokenRequest=r.GetQRCodeForTokenRequest=r.CreateOwnTokenRequest=r.LoadPeerRelationshipTemplateRequest=r.GetRelationshipTemplatesRequest=r.GetRelationshipTemplateRequest=r.CreateTokenQrCodeForOwnTemplateRequest=r.CreateTokenForOwnTemplateRequest=r.CreateOwnRelationshipTemplateRequest=r.RevokeRelationshipChangeRequest=r.RejectRelationshipChangeRequest=r.GetRelationshipsRequest=r.GetRelationshipByAddressRequest=r.GetRelationshipRequest=r.CreateRelationshipChangeRequest=r.CreateRelationshipRequest=r.AcceptRelationshipChangeRequest=r.SendMessageRequest=r.GetMessagesRequest=r.GetMessageRequest=r.GetAttachmentMetadataRequest=r.CheckIdentityRequest=r.UploadOwnFileRequest=r.LoadPeerFileRequest=r.LoadPeerFileViaReferenceRequest=r.LoadPeerFileViaSecretRequest=r.GetFilesRequest=r.GetFileRequest=r.CreateTokenQrCodeForFileRequest=r.CreateTokenForFileRequest=r.UpdateDeviceRequest=void 0,r.LoadPeerTokenAnonymousByIdAndKeyRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/LoadPeerTokenAnonymousByIdAndKeyRequest",definitions:{LoadPeerTokenAnonymousByIdAndKeyRequest:{type:"object",properties:{id:{type:"string"},secretKey:{type:"string"}},required:["id","secretKey"],additionalProperties:!1}}},r.LoadPeerTokenAnonymousByTruncatedReferenceRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/LoadPeerTokenAnonymousByTruncatedReferenceRequest",definitions:{LoadPeerTokenAnonymousByTruncatedReferenceRequest:{type:"object",properties:{reference:{type:"string"}},required:["reference"],additionalProperties:!1}}},r.GetAttributesByNamesRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetAttributesByNamesRequest",definitions:{GetAttributesByNamesRequest:{type:"object",additionalProperties:!1}}},r.CreateAttributeRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/CreateAttributeRequest",definitions:{CreateAttributeRequest:{type:"object",properties:{attribute:{$ref:"#/definitions/IAttribute"}},required:["attribute"],additionalProperties:!1},IAttribute:{type:"object",properties:{name:{type:"string"},value:{},validFrom:{$ref:"#/definitions/ICoreDate"},validTo:{$ref:"#/definitions/ICoreDate"}},required:["name","value"],additionalProperties:!1},ICoreDate:{type:"object",properties:{date:{type:"string"}},required:["date"],additionalProperties:!1}}},r.DeleteAttributeRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/DeleteAttributeRequest",definitions:{DeleteAttributeRequest:{type:"object",properties:{id:{type:"string"}},required:["id"],additionalProperties:!1}}},r.DeleteAttributeByNameRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/DeleteAttributeByNameRequest",definitions:{DeleteAttributeByNameRequest:{type:"object",properties:{name:{type:"string"}},required:["name"],additionalProperties:!1}}},r.GetAttributeRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetAttributeRequest",definitions:{GetAttributeRequest:{type:"object",properties:{id:{type:"string"}},required:["id"],additionalProperties:!1}}},r.GetAttributeByNameRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetAttributeByNameRequest",definitions:{GetAttributeByNameRequest:{type:"object",properties:{name:{type:"string"}},required:["name"],additionalProperties:!1}}},r.GetAttributesRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetAttributesRequest",definitions:{GetAttributesRequest:{type:"object",additionalProperties:!1}}},r.GetHistoryByNameRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetHistoryByNameRequest",definitions:{GetHistoryByNameRequest:{type:"object",properties:{name:{type:"string"}},required:["name"],additionalProperties:!1}}},r.SucceedAttributeRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/SucceedAttributeRequest",definitions:{SucceedAttributeRequest:{type:"object",properties:{attribute:{$ref:"#/definitions/IAttribute"},validFrom:{type:"string"}},required:["attribute"],additionalProperties:!1},IAttribute:{type:"object",properties:{name:{type:"string"},value:{},validFrom:{$ref:"#/definitions/ICoreDate"},validTo:{$ref:"#/definitions/ICoreDate"}},required:["name","value"],additionalProperties:!1},ICoreDate:{type:"object",properties:{date:{type:"string"}},required:["date"],additionalProperties:!1}}},r.UpdateAttributeRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/UpdateAttributeRequest",definitions:{UpdateAttributeRequest:{type:"object",properties:{id:{type:"string"},attribute:{$ref:"#/definitions/IAttribute"}},required:["id","attribute"],additionalProperties:!1},IAttribute:{type:"object",properties:{name:{type:"string"},value:{},validFrom:{$ref:"#/definitions/ICoreDate"},validTo:{$ref:"#/definitions/ICoreDate"}},required:["name","value"],additionalProperties:!1},ICoreDate:{type:"object",properties:{date:{type:"string"}},required:["date"],additionalProperties:!1}}},r.CreateDraftRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/CreateDraftRequest",definitions:{CreateDraftRequest:{type:"object",properties:{content:{},type:{type:"string"}},required:["content"],additionalProperties:!1}}},r.DeleteDraftRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/DeleteDraftRequest",definitions:{DeleteDraftRequest:{type:"object",properties:{id:{type:"string"}},required:["id"],additionalProperties:!1}}},r.GetDraftRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetDraftRequest",definitions:{GetDraftRequest:{type:"object",properties:{id:{type:"string"}},required:["id"],additionalProperties:!1}}},r.GetDraftsRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetDraftsRequest",definitions:{GetDraftsRequest:{type:"object",properties:{query:{}},additionalProperties:!1}}},r.UpdateDraftRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/UpdateDraftRequest",definitions:{UpdateDraftRequest:{type:"object",properties:{id:{type:"string"},content:{}},required:["id","content"],additionalProperties:!1}}},r.CreateRelationshipInfoRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/CreateRelationshipInfoRequest",definitions:{CreateRelationshipInfoRequest:{type:"object",properties:{relationshipId:{type:"string"},attributes:{type:"array",items:{$ref:"#/definitions/RelationshipAttributeDTO"}},isPinned:{type:"boolean"},title:{type:"string"},description:{type:"string"},userTitle:{type:"string"},userDescription:{type:"string"},theme:{$ref:"#/definitions/RelationshipThemeDTO"}},required:["relationshipId","attributes","isPinned","title"],additionalProperties:!1},RelationshipAttributeDTO:{type:"object",properties:{name:{type:"string"},content:{$ref:"#/definitions/AttributeJSON"},sharedItem:{type:"string"}},required:["name","content","sharedItem"],additionalProperties:!1},AttributeJSON:{type:"object",properties:{"@type":{type:"string"},"@schema":{type:"string"},name:{type:"string"},value:{},validFrom:{type:"string"},validTo:{type:"string"}},required:["@type","name","value"],additionalProperties:!1},RelationshipThemeDTO:{type:"object",properties:{image:{type:"string"},imageBar:{type:"string"},backgroundColor:{type:"string"},foregroundColor:{type:"string"}},required:["image","imageBar","backgroundColor","foregroundColor"],additionalProperties:!1}}},r.DeleteRelationshipInfoRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/DeleteRelationshipInfoRequest",definitions:{DeleteRelationshipInfoRequest:{type:"object",properties:{id:{type:"string"}},required:["id"],additionalProperties:!1}}},r.DeleteRelationshipInfoByRelationshipRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/DeleteRelationshipInfoByRelationshipRequest",definitions:{DeleteRelationshipInfoByRelationshipRequest:{type:"object",properties:{relationshipId:{type:"string"}},required:["relationshipId"],additionalProperties:!1}}},r.GetRelationshipInfoRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetRelationshipInfoRequest",definitions:{GetRelationshipInfoRequest:{type:"object",properties:{id:{type:"string"}},required:["id"],additionalProperties:!1}}},r.GetRelationshipInfoByRelationshipRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetRelationshipInfoByRelationshipRequest",definitions:{GetRelationshipInfoByRelationshipRequest:{type:"object",properties:{relationshipId:{type:"string"}},required:["relationshipId"],additionalProperties:!1}}},r.UpdateRelationshipInfoRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/UpdateRelationshipInfoRequest",definitions:{UpdateRelationshipInfoRequest:{type:"object",properties:{id:{type:"string"},attributes:{type:"array",items:{$ref:"#/definitions/RelationshipAttributeDTO"}},isPinned:{type:"boolean"},title:{type:"string"},description:{type:"string"},userTitle:{type:"string"},userDescription:{type:"string"},theme:{$ref:"#/definitions/RelationshipThemeDTO"}},required:["id"],additionalProperties:!1,description:"Overwrite a RelationshipInfo's attributes with the request's corresponding fields. Undefined fields in the request will leave the corresponding RelationshipInfo's attributes untouched."},RelationshipAttributeDTO:{type:"object",properties:{name:{type:"string"},content:{$ref:"#/definitions/AttributeJSON"},sharedItem:{type:"string"}},required:["name","content","sharedItem"],additionalProperties:!1},AttributeJSON:{type:"object",properties:{"@type":{type:"string"},"@schema":{type:"string"},name:{type:"string"},value:{},validFrom:{type:"string"},validTo:{type:"string"}},required:["@type","name","value"],additionalProperties:!1},RelationshipThemeDTO:{type:"object",properties:{image:{type:"string"},imageBar:{type:"string"},backgroundColor:{type:"string"},foregroundColor:{type:"string"}},required:["image","imageBar","backgroundColor","foregroundColor"],additionalProperties:!1}}},r.CreateSettingRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/CreateSettingRequest",definitions:{CreateSettingRequest:{type:"object",properties:{key:{type:"string"},value:{},reference:{type:"string"},scope:{type:"string"},succeedsAt:{type:"string"},succeedsItem:{type:"string"}},required:["key","value"],additionalProperties:!1}}},r.DeleteSettingRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/DeleteSettingRequest",definitions:{DeleteSettingRequest:{type:"object",properties:{id:{type:"string"}},required:["id"],additionalProperties:!1}}},r.GetSettingRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetSettingRequest",definitions:{GetSettingRequest:{type:"object",properties:{id:{type:"string"}},required:["id"],additionalProperties:!1}}},r.GetSettingsRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetSettingsRequest",definitions:{GetSettingsRequest:{type:"object",properties:{query:{}},additionalProperties:!1}}},r.UpdateSettingRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/UpdateSettingRequest",definitions:{UpdateSettingRequest:{type:"object",properties:{id:{type:"string"},value:{}},required:["id","value"],additionalProperties:!1}}},r.CreateSharedItemRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/CreateSharedItemRequest",definitions:{CreateSharedItemRequest:{type:"object",properties:{tags:{type:"array",items:{type:"string"}},sharedBy:{type:"string"},sharedWith:{type:"string"},sharedAt:{type:"string"},reference:{type:"string"},content:{},succeedsItem:{type:"string"},succeedsAt:{type:"string"},expiresAt:{type:"string"}},required:["sharedBy","sharedWith","sharedAt","content"],additionalProperties:!1}}},r.DeleteSharedItemRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/DeleteSharedItemRequest",definitions:{DeleteSharedItemRequest:{type:"object",properties:{id:{type:"string"}},required:["id"],additionalProperties:!1}}},r.GetSharedItemRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetSharedItemRequest",definitions:{GetSharedItemRequest:{type:"object",properties:{id:{type:"string"}},required:["id"],additionalProperties:!1}}},r.GetSharedItemsRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetSharedItemsRequest",definitions:{GetSharedItemsRequest:{type:"object",properties:{query:{}},additionalProperties:!1}}},r.GetSharedItemsByAddressRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetSharedItemsByAddressRequest",definitions:{GetSharedItemsByAddressRequest:{type:"object",properties:{address:{type:"string"}},required:["address"],additionalProperties:!1}}},r.GetSharedItemsByReferenceRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetSharedItemsByReferenceRequest",definitions:{GetSharedItemsByReferenceRequest:{type:"object",properties:{reference:{type:"string"}},required:["reference"],additionalProperties:!1}}},r.GetSharedItemsSharedByAddressRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetSharedItemsSharedByAddressRequest",definitions:{GetSharedItemsSharedByAddressRequest:{type:"object",properties:{address:{type:"string"}},required:["address"],additionalProperties:!1}}},r.GetSharedItemsSharedWithAddressRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetSharedItemsSharedWithAddressRequest",definitions:{GetSharedItemsSharedWithAddressRequest:{type:"object",properties:{address:{type:"string"}},required:["address"],additionalProperties:!1}}},r.UpdateSharedItemRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/UpdateSharedItemRequest",definitions:{UpdateSharedItemRequest:{type:"object",properties:{id:{type:"string"},content:{}},required:["id","content"],additionalProperties:!1}}},r.RegisterPushNotificationTokenRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/RegisterPushNotificationTokenRequest",definitions:{RegisterPushNotificationTokenRequest:{type:"object",properties:{handle:{type:"string"},installationId:{type:"string"},platform:{type:"string"}},required:["handle","installationId","platform"],additionalProperties:!1}}},r.DownloadFileRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/DownloadFileRequest",definitions:{DownloadFileRequest:{type:"object",properties:{id:{type:"string",format:"fileId"}},required:["id"],additionalProperties:!1}}},r.DownloadAttachmentRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/DownloadAttachmentRequest",definitions:{DownloadAttachmentRequest:{type:"object",properties:{id:{type:"string"},attachmentId:{type:"string"}},required:["id","attachmentId"],additionalProperties:!1}}},r.CreateRelationshipChallengeRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/CreateRelationshipChallengeRequest",definitions:{CreateRelationshipChallengeRequest:{type:"object",properties:{challengeType:{type:"string",const:"Relationship"},relationship:{type:"string",format:"relationshipId"}},required:["challengeType","relationship"],additionalProperties:!1}}},r.CreateIdentityChallengeRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/CreateIdentityChallengeRequest",definitions:{CreateIdentityChallengeRequest:{type:"object",properties:{challengeType:{type:"string",const:"Identity"}},required:["challengeType"],additionalProperties:!1}}},r.CreateDeviceChallengeRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/CreateDeviceChallengeRequest",definitions:{CreateDeviceChallengeRequest:{type:"object",properties:{challengeType:{type:"string",const:"Device"}},required:["challengeType"],additionalProperties:!1}}},r.CreateChallengeRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/CreateChallengeRequest",definitions:{CreateChallengeRequest:{anyOf:[{$ref:"#/definitions/CreateRelationshipChallengeRequest"},{$ref:"#/definitions/CreateIdentityChallengeRequest"},{$ref:"#/definitions/CreateDeviceChallengeRequest"}]},CreateRelationshipChallengeRequest:{type:"object",properties:{challengeType:{type:"string",const:"Relationship"},relationship:{type:"string",format:"relationshipId"}},required:["challengeType","relationship"],additionalProperties:!1},CreateIdentityChallengeRequest:{type:"object",properties:{challengeType:{type:"string",const:"Identity"}},required:["challengeType"],additionalProperties:!1},CreateDeviceChallengeRequest:{type:"object",properties:{challengeType:{type:"string",const:"Device"}},required:["challengeType"],additionalProperties:!1}}},r.ValidateChallengeRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/ValidateChallengeRequest",definitions:{ValidateChallengeRequest:{type:"object",properties:{challenge:{type:"string"},signature:{type:"string"}},required:["challenge","signature"],additionalProperties:!1}}},r.CreateDeviceRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/CreateDeviceRequest",definitions:{CreateDeviceRequest:{type:"object",properties:{name:{type:"string"},description:{type:"string"},isAdmin:{type:"boolean"}},additionalProperties:!1}}},r.CreateDeviceOnboardingTokenRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/CreateDeviceOnboardingTokenRequest",definitions:{CreateDeviceOnboardingTokenRequest:{type:"object",properties:{id:{type:"string"},expiresAt:{type:"string"}},required:["id"],additionalProperties:!1}}},r.DeleteDeviceRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/DeleteDeviceRequest",definitions:{DeleteDeviceRequest:{type:"object",properties:{id:{type:"string"}},required:["id"],additionalProperties:!1}}},r.GetDeviceRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetDeviceRequest",definitions:{GetDeviceRequest:{type:"object",properties:{id:{type:"string"}},required:["id"],additionalProperties:!1}}},r.GetDeviceOnboardingInfoRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetDeviceOnboardingInfoRequest",definitions:{GetDeviceOnboardingInfoRequest:{type:"object",properties:{id:{type:"string"}},required:["id"],additionalProperties:!1}}},r.UpdateDeviceRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/UpdateDeviceRequest",definitions:{UpdateDeviceRequest:{type:"object",properties:{id:{type:"string"},name:{type:"string"},description:{type:"string"}},required:["id"],additionalProperties:!1}}},r.CreateTokenForFileRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/CreateTokenForFileRequest",definitions:{CreateTokenForFileRequest:{type:"object",properties:{fileId:{type:"string",format:"fileId"},expiresAt:{type:"string",format:"date-time"},ephemeral:{type:"boolean"}},required:["fileId"],additionalProperties:!1}}},r.CreateTokenQrCodeForFileRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/CreateTokenQrCodeForFileRequest",definitions:{CreateTokenQrCodeForFileRequest:{type:"object",properties:{fileId:{type:"string",format:"fileId"},expiresAt:{type:"string",format:"date-time"}},required:["fileId"],additionalProperties:!1}}},r.GetFileRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetFileRequest",definitions:{GetFileRequest:{type:"object",properties:{id:{type:"string",format:"fileId"}},required:["id"],additionalProperties:!1}}},r.GetFilesRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetFilesRequest",definitions:{GetFilesRequest:{type:"object",properties:{query:{},ownerRestriction:{$ref:"#/definitions/OwnerRestriction"}},additionalProperties:!1},OwnerRestriction:{type:"string",enum:["o","p"]}}},r.LoadPeerFileViaSecretRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/LoadPeerFileViaSecretRequest",definitions:{LoadPeerFileViaSecretRequest:{type:"object",properties:{id:{type:"string",format:"fileId"},secretKey:{type:"string",minLength:100}},required:["id","secretKey"],additionalProperties:!1}}},r.LoadPeerFileViaReferenceRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/LoadPeerFileViaReferenceRequest",definitions:{LoadPeerFileViaReferenceRequest:{type:"object",properties:{reference:{type:"string",pattern:"VE9L.{84}"}},required:["reference"],additionalProperties:!1,errorMessage:"token reference invalid"}}},r.LoadPeerFileRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/LoadPeerFileRequest",definitions:{LoadPeerFileRequest:{anyOf:[{$ref:"#/definitions/LoadPeerFileViaSecretRequest"},{$ref:"#/definitions/LoadPeerFileViaReferenceRequest"}]},LoadPeerFileViaSecretRequest:{type:"object",properties:{id:{type:"string",format:"fileId"},secretKey:{type:"string",minLength:100}},required:["id","secretKey"],additionalProperties:!1},LoadPeerFileViaReferenceRequest:{type:"object",properties:{reference:{type:"string",pattern:"VE9L.{84}"}},required:["reference"],additionalProperties:!1,errorMessage:"token reference invalid"}}},r.UploadOwnFileRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/UploadOwnFileRequest",definitions:{UploadOwnFileRequest:{type:"object",properties:{content:{type:"object",properties:{BYTES_PER_ELEMENT:{type:"number"},buffer:{type:"object",properties:{byteLength:{type:"number"}},required:["byteLength"],additionalProperties:!1},byteLength:{type:"number"},byteOffset:{type:"number"},length:{type:"number"}},required:["BYTES_PER_ELEMENT","buffer","byteLength","byteOffset","length"],additionalProperties:{type:"number"}},filename:{type:"string"},mimetype:{type:"string"},expiresAt:{type:"string"},title:{type:"string"},description:{type:"string"}},required:["content","filename","mimetype","expiresAt","title"],additionalProperties:!1}}},r.CheckIdentityRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/CheckIdentityRequest",definitions:{CheckIdentityRequest:{type:"object",properties:{address:{type:"string"}},required:["address"],additionalProperties:!1}}},r.GetAttachmentMetadataRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetAttachmentMetadataRequest",definitions:{GetAttachmentMetadataRequest:{type:"object",properties:{id:{type:"string"},attachmentId:{type:"string"}},required:["id","attachmentId"],additionalProperties:!1}}},r.GetMessageRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetMessageRequest",definitions:{GetMessageRequest:{type:"object",properties:{id:{type:"string"}},required:["id"],additionalProperties:!1}}},r.GetMessagesRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetMessagesRequest",definitions:{GetMessagesRequest:{type:"object",properties:{query:{}},additionalProperties:!1}}},r.SendMessageRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/SendMessageRequest",definitions:{SendMessageRequest:{type:"object",properties:{recipients:{type:"array",items:{type:"string"}},content:{},attachments:{type:"array",items:{type:"string"}}},required:["recipients","content"],additionalProperties:!1}}},r.AcceptRelationshipChangeRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/AcceptRelationshipChangeRequest",definitions:{AcceptRelationshipChangeRequest:{type:"object",properties:{relationshipId:{type:"string"},changeId:{type:"string"},content:{}},required:["relationshipId","changeId","content"],additionalProperties:!1}}},r.CreateRelationshipRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/CreateRelationshipRequest",definitions:{CreateRelationshipRequest:{type:"object",properties:{templateId:{type:"string"},content:{}},required:["templateId","content"],additionalProperties:!1}}},r.CreateRelationshipChangeRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/CreateRelationshipChangeRequest",definitions:{CreateRelationshipChangeRequest:{type:"object",properties:{id:{type:"string"},content:{}},required:["id"],additionalProperties:!1}}},r.GetRelationshipRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetRelationshipRequest",definitions:{GetRelationshipRequest:{type:"object",properties:{id:{type:"string"}},required:["id"],additionalProperties:!1}}},r.GetRelationshipByAddressRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetRelationshipByAddressRequest",definitions:{GetRelationshipByAddressRequest:{type:"object",properties:{address:{type:"string"}},required:["address"],additionalProperties:!1}}},r.GetRelationshipsRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetRelationshipsRequest",definitions:{GetRelationshipsRequest:{type:"object",properties:{query:{}},additionalProperties:!1}}},r.RejectRelationshipChangeRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/RejectRelationshipChangeRequest",definitions:{RejectRelationshipChangeRequest:{type:"object",properties:{relationshipId:{type:"string"},changeId:{type:"string"},content:{}},required:["relationshipId","changeId","content"],additionalProperties:!1}}},r.RevokeRelationshipChangeRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/RevokeRelationshipChangeRequest",definitions:{RevokeRelationshipChangeRequest:{type:"object",properties:{relationshipId:{type:"string"},changeId:{type:"string"},content:{}},required:["relationshipId","changeId","content"],additionalProperties:!1}}},r.CreateOwnRelationshipTemplateRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/CreateOwnRelationshipTemplateRequest",definitions:{CreateOwnRelationshipTemplateRequest:{type:"object",properties:{expiresAt:{type:"string"},content:{},maxNumberOfRelationships:{type:"number"}},required:["expiresAt","content"],additionalProperties:!1}}},r.CreateTokenForOwnTemplateRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/CreateTokenForOwnTemplateRequest",definitions:{CreateTokenForOwnTemplateRequest:{type:"object",properties:{templateId:{type:"string"},expiresAt:{type:"string"},ephemeral:{type:"boolean"}},required:["templateId"],additionalProperties:!1}}},r.CreateTokenQrCodeForOwnTemplateRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/CreateTokenQrCodeForOwnTemplateRequest",definitions:{CreateTokenQrCodeForOwnTemplateRequest:{type:"object",properties:{templateId:{type:"string"},expiresAt:{type:"string"}},required:["templateId"],additionalProperties:!1}}},r.GetRelationshipTemplateRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetRelationshipTemplateRequest",definitions:{GetRelationshipTemplateRequest:{type:"object",properties:{id:{type:"string"}},required:["id"],additionalProperties:!1}}},r.GetRelationshipTemplatesRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetRelationshipTemplatesRequest",definitions:{GetRelationshipTemplatesRequest:{type:"object",properties:{query:{},ownerRestriction:{$ref:"#/definitions/OwnerRestriction"}},additionalProperties:!1},OwnerRestriction:{type:"string",enum:["o","p"]}}},r.LoadPeerRelationshipTemplateRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/LoadPeerRelationshipTemplateRequest",definitions:{LoadPeerRelationshipTemplateRequest:{type:"object",properties:{id:{type:"string"},secretKey:{type:"string"},reference:{type:"string"}},additionalProperties:!1}}},r.CreateOwnTokenRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/CreateOwnTokenRequest",definitions:{CreateOwnTokenRequest:{type:"object",properties:{content:{},expiresAt:{type:"string"},ephemeral:{type:"boolean"}},required:["content","expiresAt","ephemeral"],additionalProperties:!1}}},r.GetQRCodeForTokenRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetQRCodeForTokenRequest",definitions:{GetQRCodeForTokenRequest:{type:"object",properties:{id:{type:"string"}},required:["id"],additionalProperties:!1}}},r.GetTokenRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetTokenRequest",definitions:{GetTokenRequest:{type:"object",properties:{id:{type:"string"}},required:["id"],additionalProperties:!1}}},r.GetTokensRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/GetTokensRequest",definitions:{GetTokensRequest:{type:"object",properties:{query:{},ownerRestriction:{$ref:"#/definitions/OwnerRestriction"}},additionalProperties:!1},OwnerRestriction:{type:"string",enum:["o","p"]}}},r.LoadPeerTokenRequest={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/LoadPeerTokenRequest",definitions:{LoadPeerTokenRequest:{type:"object",properties:{id:{type:"string"},secretKey:{type:"string"},reference:{type:"string"},ephemeral:{type:"boolean"}},required:["ephemeral"],additionalProperties:!1}}}},45420:function(t,r,a){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:!0}),r.UseCase=void 0;const o=a(90194),l=a(75172),c=a(19663),u=i(a(64530)),d=a(48728),p=a(6595);r.UseCase=class UseCase{constructor(t){this.requestValidator=t}async execute(t){if(this.requestValidator){const r=await this.requestValidator.validate(t);if(r.isInvalid())return this.validationFailed(r)}try{return await this.executeInternal(t)}catch(t){return this.failingResultFromUnknownError(t)}}failingResultFromUnknownError(t){return t instanceof Error?t instanceof c.RequestError?this.handleRequestError(t):t instanceof o.ServalError?this.handleServalError(t):t instanceof l.ApplicationError?l.Result.fail(t):l.Result.fail(p.RuntimeErrors.general.unknown(`An error was thrown in a UseCase: ${t.message}`,t)):l.Result.fail(p.RuntimeErrors.general.unknown(`An unknown object was thrown in a UseCase: ${(0,u.default)(t)}`,t))}handleServalError(t){let r;return r=t instanceof o.ParsingError||t instanceof o.ValidationError?p.RuntimeErrors.serval.requestDeserialization(t.message):t.message.match(/Type '.+' was not found within reflection classes. You might have to install a module first./)?p.RuntimeErrors.serval.unknownType(t.message):p.RuntimeErrors.serval.general(t.message),r.stack=t.stack,l.Result.fail(r)}handleRequestError(t){return d.PlatformErrorCodes.isNotFoundError(t)?l.Result.fail(p.RuntimeErrors.general.recordNotFoundWithMessage(t.reason)):d.PlatformErrorCodes.isValidationError(t)||d.PlatformErrorCodes.isUnexpectedError(t)?l.Result.fail(new l.ApplicationError(t.code,t.message)):l.Result.fail(t)}validationFailed(t){var r,a,i;const o=t.getFailures()[0],c=null!==(r=o.code)&&void 0!==r?r:p.RuntimeErrors.general.invalidPropertyValue().code,u=null!==(i=null===(a=o.message)||void 0===a?void 0:a.replace(/\$propertyName/g,o.propertyName))&&void 0!==i?i:p.RuntimeErrors.general.invalidPropertyValue(o.propertyName).message;return l.Result.fail(new l.ApplicationError(c,u))}}},7049:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(56819),r),o(a(73832),r),o(a(6595),r),o(a(71683),r),o(a(32746),r),o(a(45420),r),o(a(20263),r),o(a(43492),r),o(a(43519),r),o(a(96665),r),o(a(53800),r)},20263:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.AddressValidator=void 0;const i=a(63586);class AddressValidator extends i.AbstractValidator{constructor(t){super();let r=this.validateIfString((t=>t));t||(r=r.isNotNull()),r=r.hasLengthBetween(35,36),t&&r.whenNotNull()}static required(){return new AddressValidator(!1)}static optional(){return new AddressValidator(!0)}}r.AddressValidator=AddressValidator},43492:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.DateValidator=void 0;const i=a(63586),o=a(99490);class DateValidator extends i.AbstractValidator{constructor(t){super();let r=this.validateIfString((t=>t));t||(r=r.isNotNull()),r=r.fulfills((t=>o.DateTime.fromISO(t).isValid)),t&&r.whenNotNull()}static required(){return new DateValidator(!1)}static optional(){return new DateValidator(!0)}}r.DateValidator=DateValidator},43519:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.IdValidator=void 0;const i=a(63586);class IdValidator extends i.AbstractValidator{constructor(t,r){super();let a=this.validateIfString((t=>t));t||(a=a.isNotNull()),a=a.fulfills((t=>r.validate(t))),t&&a.whenNotNull()}static required(t){return new IdValidator(!1,t)}static optional(t){return new IdValidator(!0,t)}}r.IdValidator=IdValidator},96665:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.RelationshipAttributeDTOValidator=void 0;const i=a(3850),o=a(63586);class RelationshipAttributeDTOValidator extends o.AbstractValidator{constructor(){super(),this.validateIfString((t=>t.sharedItem)).fulfills((t=>i.ConsumptionIds.sharedItem.validate(t)))}static required(){return new RelationshipAttributeDTOValidator}}r.RelationshipAttributeDTOValidator=RelationshipAttributeDTOValidator},53800:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.SchemaValidator=void 0;const i=a(63586);r.SchemaValidator=class SchemaValidator{constructor(t){this.schema=t}validate(t){const r=this.schema.validate(t);return this.convertValidationResult(r)}convertValidationResult(t){const r=new i.ValidationResult;return t.isValid||r.addFailures(t.errors.map(this.schemaErrorToValidationFailure)),r}schemaErrorToValidationFailure(t){const r=`${t.instancePath} ${t.message}`.replace(/^\//,"").replace(/"/g,"").trim();return new i.ValidationFailure(void 0,t.instancePath,void 0,void 0,r)}}},41192:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.AttributeMapper=void 0;class AttributeMapper{static toAttributeDTO(t){return{id:t.id.toString(),content:t.content.toJSON(),createdAt:t.createdAt.toString()}}static toAttributeDTOList(t){return t.map((t=>this.toAttributeDTO(t)))}static toGetAttributesByNamesResponse(t){const r={};for(const a in t)r[a]=AttributeMapper.toAttributeDTO(t[a]);return r}}r.AttributeMapper=AttributeMapper},17716:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CreateAttributeUseCase=void 0;const c=a(75172),u=a(3850),d=a(19663),p=a(7071),h=a(7049),m=a(41192);class CreateAttributeRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIf((t=>t.attribute)).isDefined(),this.validateIfString((t=>t.attribute.name)).isNotEmpty()}}let y=class CreateAttributeUseCase extends h.UseCase{constructor(t,r,a){super(a),this.attributeController=t,this.accountController=r}async executeInternal(t){const r=await u.ConsumptionAttribute.fromAttribute(t.attribute),a=await this.attributeController.createAttribute(r);return await this.accountController.syncDatawallet(),c.Result.ok(m.AttributeMapper.toAttributeDTO(a))}};y=i([l(0,p.Inject),l(1,p.Inject),l(2,p.Inject),o("design:paramtypes",[u.ConsumptionAttributesController,d.AccountController,CreateAttributeRequestValidator])],y),r.CreateAttributeUseCase=y},24946:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DeleteAttributeUseCase=void 0;const c=a(75172),u=a(3850),d=a(19663),p=a(7071),h=a(7049);class DeleteAttributeRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.id)).fulfills(h.IdValidator.required(u.ConsumptionIds.attribute))}}let m=class DeleteAttributeUseCase extends h.UseCase{constructor(t,r,a){super(a),this.attributeController=t,this.accountController=r}async executeInternal(t){const r=await this.attributeController.getAttribute(d.CoreId.from(t.id));return r?(await this.attributeController.deleteAttribute(r),await this.accountController.syncDatawallet(),c.Result.ok(void 0)):c.Result.fail(h.RuntimeErrors.general.recordNotFound(u.ConsumptionAttribute))}};m=i([l(0,p.Inject),l(1,p.Inject),l(2,p.Inject),o("design:paramtypes",[u.ConsumptionAttributesController,d.AccountController,DeleteAttributeRequestValidator])],m),r.DeleteAttributeUseCase=m},14856:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DeleteAttributeByNameUseCase=void 0;const c=a(75172),u=a(3850),d=a(19663),p=a(7071),h=a(7049);class DeleteAttributeByNameRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.name)).isDefined()}}let m=class DeleteAttributeByNameUseCase extends h.UseCase{constructor(t,r,a){super(a),this.attributeController=t,this.accountController=r}async executeInternal(t){const r=await this.attributeController.getAttributeByName(t.name);return r?(await this.attributeController.deleteAttribute(r),await this.accountController.syncDatawallet(),c.Result.ok(void 0)):c.Result.fail(h.RuntimeErrors.general.recordNotFound(u.ConsumptionAttribute))}};m=i([l(0,p.Inject),l(1,p.Inject),l(2,p.Inject),o("design:paramtypes",[u.ConsumptionAttributesController,d.AccountController,DeleteAttributeByNameRequestValidator])],m),r.DeleteAttributeByNameUseCase=m},14746:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetAllValidUseCase=void 0;const c=a(75172),u=a(3850),d=a(7071),p=a(7049),h=a(41192);let m=class GetAllValidUseCase extends p.UseCase{constructor(t){super(),this.attributeController=t}async executeInternal(){const t=await this.attributeController.getValidAttributes();return c.Result.ok(h.AttributeMapper.toAttributeDTOList(t))}};m=i([l(0,d.Inject),o("design:paramtypes",[u.ConsumptionAttributesController])],m),r.GetAllValidUseCase=m},73421:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetAttributeUseCase=void 0;const c=a(75172),u=a(3850),d=a(25030),p=a(19663),h=a(7071),m=a(7049),y=a(41192);class GetAttributeRequestValidator extends m.RuntimeValidator{constructor(){super(),this.validateIf((t=>t.id)).fulfills(m.IdValidator.required(u.ConsumptionIds.attribute))}}let g=class GetAttributeUseCase extends m.UseCase{constructor(t,r){super(r),this.attributeController=t}async executeInternal(t){const r=await this.attributeController.getAttribute(p.CoreId.from(t.id));return r?c.Result.ok(y.AttributeMapper.toAttributeDTO(r)):c.Result.fail(m.RuntimeErrors.general.recordNotFound(d.Attribute))}};g=i([l(0,h.Inject),l(1,h.Inject),o("design:paramtypes",[u.ConsumptionAttributesController,GetAttributeRequestValidator])],g),r.GetAttributeUseCase=g},5519:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetAttributeByNameUseCase=void 0;const c=a(75172),u=a(3850),d=a(25030),p=a(7071),h=a(7049),m=a(41192);class GetAttributeByNameRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.name)).isNotEmpty()}}let y=class GetAttributeByNameUseCase extends h.UseCase{constructor(t,r){super(r),this.attributeController=t}async executeInternal(t){const r=await this.attributeController.getAttributeByName(t.name);return r?c.Result.ok(m.AttributeMapper.toAttributeDTO(r)):c.Result.fail(h.RuntimeErrors.general.recordNotFound(d.Attribute))}};y=i([l(0,p.Inject),l(1,p.Inject),o("design:paramtypes",[u.ConsumptionAttributesController,GetAttributeByNameRequestValidator])],y),r.GetAttributeByNameUseCase=y},99536:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetAttributesUseCase=void 0;const c=a(75172),u=a(3850),d=a(7071),p=a(7049),h=a(41192);class GetAttributesRequestValidator extends p.RuntimeValidator{constructor(){super()}}let m=class GetAttributesUseCase extends p.UseCase{constructor(t,r){super(r),this.attributeController=t}async executeInternal(t){const r=await this.attributeController.getAttributes();return c.Result.ok(h.AttributeMapper.toAttributeDTOList(r))}};m=i([l(0,d.Inject),l(1,d.Inject),o("design:paramtypes",[u.ConsumptionAttributesController,GetAttributesRequestValidator])],m),r.GetAttributesUseCase=m},18796:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetAttributesByNamesUseCase=void 0;const c=a(75172),u=a(3850),d=a(7071),p=a(7049),h=a(41192);class GetAttributesByNamesRequestValidator extends p.RuntimeValidator{constructor(){super()}}let m=class GetAttributesByNamesUseCase extends p.UseCase{constructor(t,r){super(r),this.attributeController=t}async executeInternal(t){const r=await this.attributeController.getAttributesByName();return c.Result.ok(h.AttributeMapper.toGetAttributesByNamesResponse(r))}};m=i([l(0,d.Inject),l(1,d.Inject),o("design:paramtypes",[u.ConsumptionAttributesController,GetAttributesByNamesRequestValidator])],m),r.GetAttributesByNamesUseCase=m},16932:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetHistoryByNameUseCase=void 0;const c=a(75172),u=a(3850),d=a(25030),p=a(7071),h=a(7049),m=a(41192);class GetHistoryByNameRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.name)).isDefined()}}let y=class GetHistoryByNameUseCase extends h.UseCase{constructor(t,r){super(r),this.attributeController=t}async executeInternal(t){const r=await this.attributeController.getAttributeHistoryByName(t.name);return 0===r.length?c.Result.fail(h.RuntimeErrors.general.recordNotFound(d.Attribute)):c.Result.ok(m.AttributeMapper.toAttributeDTOList(r))}};y=i([l(0,p.Inject),l(1,p.Inject),o("design:paramtypes",[u.ConsumptionAttributesController,GetHistoryByNameRequestValidator])],y),r.GetHistoryByNameUseCase=y},4415:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.SucceedAttributeUseCase=void 0;const c=a(75172),u=a(3850),d=a(19663),p=a(7071),h=a(7049),m=a(41192);class SucceedAttributeRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIf((t=>t.validFrom)).fulfills(h.DateValidator.optional()),this.validateIf((t=>t.attribute)).isDefined(),this.validateIf((t=>t.attribute.name)).isNotEmpty()}}let y=class SucceedAttributeUseCase extends h.UseCase{constructor(t,r,a){super(a),this.attributeController=t,this.accountController=r}async executeInternal(t){const r=await u.ConsumptionAttribute.fromAttribute(t.attribute),a=await this.attributeController.succeedAttribute(r,t.validFrom?d.CoreDate.from(t.validFrom):void 0);return await this.accountController.syncDatawallet(),c.Result.ok(m.AttributeMapper.toAttributeDTO(a))}};y=i([l(0,p.Inject),l(1,p.Inject),l(2,p.Inject),o("design:paramtypes",[u.ConsumptionAttributesController,d.AccountController,SucceedAttributeRequestValidator])],y),r.SucceedAttributeUseCase=y},9660:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.UpdateAttributeUseCase=void 0;const c=a(75172),u=a(3850),d=a(25030),p=a(19663),h=a(7071),m=a(7049),y=a(41192);class UpdateAttributeRequestValidator extends m.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.id)).fulfills(m.IdValidator.required(u.ConsumptionIds.attribute)),this.validateIf((t=>t.attribute)).isDefined(),this.validateIf((t=>t.attribute.name)).isNotEmpty()}}let g=class UpdateAttributeUseCase extends m.UseCase{constructor(t,r,a){super(a),this.attributeController=t,this.accountController=r}async executeInternal(t){const r=await this.attributeController.getAttribute(p.CoreId.from(t.id));if(!r)return c.Result.fail(m.RuntimeErrors.general.recordNotFound(u.ConsumptionAttribute));r.content=d.Attribute.from(t.attribute);const a=await this.attributeController.updateAttribute(r);return await this.accountController.syncDatawallet(),c.Result.ok(y.AttributeMapper.toAttributeDTO(a))}};g=i([l(0,h.Inject),l(1,h.Inject),l(2,h.Inject),o("design:paramtypes",[u.ConsumptionAttributesController,p.AccountController,UpdateAttributeRequestValidator])],g),r.UpdateAttributeUseCase=g},20099:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(41192),r),o(a(17716),r),o(a(24946),r),o(a(14856),r),o(a(14746),r),o(a(73421),r),o(a(5519),r),o(a(99536),r),o(a(18796),r),o(a(16932),r),o(a(4415),r),o(a(9660),r)},37372:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CreateDraftUseCase=void 0;const c=a(75172),u=a(3850),d=a(19663),p=a(7071),h=a(7049),m=a(50660);class CreateDraftRequestValidator extends h.RuntimeValidator{constructor(){super()}}let y=class CreateDraftUseCase extends h.UseCase{constructor(t,r,a){super(a),this.draftController=t,this.accountController=r}async executeInternal(t){const r=await this.draftController.createDraft(t.content,t.type);return await this.accountController.syncDatawallet(),c.Result.ok(m.DraftMapper.toDraftDTO(r))}};y=i([l(0,p.Inject),l(1,p.Inject),l(2,p.Inject),o("design:paramtypes",[u.DraftsController,d.AccountController,CreateDraftRequestValidator])],y),r.CreateDraftUseCase=y},69696:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DeleteDraftUseCase=void 0;const c=a(75172),u=a(3850),d=a(19663),p=a(7071),h=a(7049);class DeleteDraftRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfAny((t=>t.id)).fulfills(h.IdValidator.required(u.ConsumptionIds.draft))}}let m=class DeleteDraftUseCase extends h.UseCase{constructor(t,r,a){super(a),this.draftController=t,this.accountController=r}async executeInternal(t){const r=await this.draftController.getDraft(d.CoreId.from(t.id));return r?(await this.draftController.deleteDraft(r),await this.accountController.syncDatawallet(),c.Result.ok(void 0)):c.Result.fail(h.RuntimeErrors.general.recordNotFound(u.Draft))}};m=i([l(0,p.Inject),l(1,p.Inject),l(2,p.Inject),o("design:paramtypes",[u.DraftsController,d.AccountController,DeleteDraftRequestValidator])],m),r.DeleteDraftUseCase=m},50660:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.DraftMapper=void 0;r.DraftMapper=class DraftMapper{static toDraftDTO(t){return{id:t.id.toString(),type:t.type,createdAt:t.createdAt.toString(),lastModifiedAt:t.lastModifiedAt.toISOString(),content:t.content.toJSON()}}static toDraftDTOList(t){return t.map((t=>this.toDraftDTO(t)))}}},23165:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetDraftUseCase=void 0;const c=a(75172),u=a(3850),d=a(19663),p=a(7071),h=a(7049),m=a(50660);class GetDraftRequestValidator extends h.RuntimeValidator{constructor(){super()}}let y=class GetDraftUseCase extends h.UseCase{constructor(t,r){super(r),this.draftController=t}async executeInternal(t){const r=await this.draftController.getDraft(d.CoreId.from(t.id));return r?c.Result.ok(m.DraftMapper.toDraftDTO(r)):c.Result.fail(h.RuntimeErrors.general.recordNotFound(u.Draft))}};y=i([l(0,p.Inject),l(1,p.Inject),o("design:paramtypes",[u.DraftsController,GetDraftRequestValidator])],y),r.GetDraftUseCase=y},46863:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetDraftsUseCase=void 0;const c=a(92937),u=a(75172),d=a(3850),p=a(94714),h=a(7071),m=a(7049),y=a(50660);let g=class GetDraftsUseCase extends m.UseCase{constructor(t,r){super(r),this.draftController=t}async executeInternal(t){const r=GetDraftsUseCase.queryTranslator.parse(t.query),a=await this.draftController.getDrafts(r);return u.Result.ok(y.DraftMapper.toDraftDTOList(a))}};g.queryTranslator=new c.QueryTranslator({whitelist:{[(0,p.nameof)((t=>t.type))]:!0,[(0,p.nameof)((t=>t.createdAt))]:!0,[(0,p.nameof)((t=>t.lastModifiedAt))]:!0}}),g=i([l(0,h.Inject),l(1,h.Inject),o("design:paramtypes",[d.DraftsController,m.RuntimeValidator])],g),r.GetDraftsUseCase=g},65760:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.UpdateDraftUseCase=void 0;const c=a(90194),u=a(75172),d=a(3850),p=a(19663),h=a(7071),m=a(7049),y=a(50660);class UpdateDraftRequestValidator extends m.RuntimeValidator{constructor(){super()}}let g=class UpdateDraftUseCase extends m.UseCase{constructor(t,r,a){super(a),this.draftController=t,this.accountController=r}async executeInternal(t){const r=await this.draftController.getDraft(p.CoreId.from(t.id));return r?(r.content=await c.SerializableAsync.fromUnknown(t.content),await this.draftController.updateDraft(r),await this.accountController.syncDatawallet(),u.Result.ok(y.DraftMapper.toDraftDTO(r))):u.Result.fail(m.RuntimeErrors.general.recordNotFound(d.Draft))}};g=i([l(0,h.Inject),l(1,h.Inject),l(2,h.Inject),o("design:paramtypes",[d.DraftsController,p.AccountController,UpdateDraftRequestValidator])],g),r.UpdateDraftUseCase=g},75966:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(37372),r),o(a(69696),r),o(a(50660),r),o(a(23165),r),o(a(46863),r),o(a(65760),r)},23742:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(20099),r),o(a(75966),r),o(a(94938),r),o(a(21394),r),o(a(90710),r)},71979:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CreateRelationshipInfoUseCase=void 0;const c=a(75172),u=a(3850),d=a(19663),p=a(7071),h=a(7049),m=a(45420),y=a(56618);class CreateRelationshipInfoRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfAny((t=>t.relationshipId)).fulfills(h.IdValidator.required(d.BackboneIds.relationship)),this.validateIfEach((t=>t.attributes)).fulfills(h.RelationshipAttributeDTOValidator.required())}}let g=class CreateRelationshipInfoUseCase extends m.UseCase{constructor(t,r,a){super(a),this.relationshipInfoController=t,this.accountController=r}async executeInternal(t){const r=d.CoreId.from(t.relationshipId);if(void 0!==await this.relationshipInfoController.getRelationshipInfoByRelationship(r))return c.Result.fail(h.RuntimeErrors.relationshipInfo.relationshipInfoExists(r.toString()));const a=await Promise.all(t.attributes.map((t=>u.RelationshipAttribute.from({name:t.name,content:t.content,sharedItem:d.CoreId.from(t.sharedItem)})))),i=void 0===t.theme?void 0:await u.RelationshipTheme.from(t.theme),o=await u.RelationshipInfo.from({id:await u.ConsumptionIds.relationshipInfo.generate(),relationshipId:r,attributes:a,isPinned:t.isPinned,title:t.title,description:t.description,userTitle:t.userTitle,userDescription:t.userDescription,theme:i});return await this.relationshipInfoController.createRelationshipInfo(o),await this.accountController.syncDatawallet(),c.Result.ok(y.RelationshipInfoMapper.toRelationshipInfoDTO(o))}};g=i([l(0,p.Inject),l(1,p.Inject),l(2,p.Inject),o("design:paramtypes",[u.RelationshipInfoController,d.AccountController,CreateRelationshipInfoRequestValidator])],g),r.CreateRelationshipInfoUseCase=g},11788:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DeleteRelationshipInfoUseCase=void 0;const c=a(75172),u=a(3850),d=a(19663),p=a(7071),h=a(7049),m=a(6595),y=a(45420);class DeleteRelationshipInfoRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfAny((t=>t.id)).fulfills(h.IdValidator.required(u.ConsumptionIds.relationshipInfo))}}let g=class DeleteRelationshipInfoUseCase extends y.UseCase{constructor(t,r,a){super(a),this.relationshipInfoController=t,this.accountController=r}async executeInternal(t){const r=await this.relationshipInfoController.getRelationshipInfo(d.CoreId.from(t.id));return r?(await this.relationshipInfoController.deleteRelationshipInfo(r),await this.accountController.syncDatawallet(),c.Result.ok(void 0)):c.Result.fail(m.RuntimeErrors.general.recordNotFound(u.RelationshipInfo))}};g=i([l(0,p.Inject),l(1,p.Inject),l(2,p.Inject),o("design:paramtypes",[u.RelationshipInfoController,d.AccountController,DeleteRelationshipInfoRequestValidator])],g),r.DeleteRelationshipInfoUseCase=g},42212:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DeleteRelationshipInfoByRelationshipUseCase=void 0;const c=a(75172),u=a(3850),d=a(19663),p=a(7071),h=a(7049),m=a(6595),y=a(45420);class DeleteRelationshipInfoByRelationshipRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfAny((t=>t.relationshipId)).fulfills(h.IdValidator.required(d.BackboneIds.relationship))}}let g=class DeleteRelationshipInfoByRelationshipUseCase extends y.UseCase{constructor(t,r,a){super(a),this.relationshipInfoController=t,this.accountController=r}async executeInternal(t){const r=await this.relationshipInfoController.getRelationshipInfoByRelationship(d.CoreId.from(t.relationshipId));return r?(await this.relationshipInfoController.deleteRelationshipInfo(r),await this.accountController.syncDatawallet(),c.Result.ok(void 0)):c.Result.fail(m.RuntimeErrors.general.recordNotFound(u.RelationshipInfo))}};g=i([l(0,p.Inject),l(1,p.Inject),l(2,p.Inject),o("design:paramtypes",[u.RelationshipInfoController,d.AccountController,DeleteRelationshipInfoByRelationshipRequestValidator])],g),r.DeleteRelationshipInfoByRelationshipUseCase=g},25116:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetRelationshipInfoUseCase=void 0;const c=a(75172),u=a(3850),d=a(19663),p=a(63586),h=a(7071),m=a(7049),y=a(6595),g=a(45420),v=a(56618);class GetRelationshipInfoRequestValidator extends p.AbstractValidator{constructor(){super(),this.validateIfAny((t=>t.id)).fulfills(m.IdValidator.required(u.ConsumptionIds.relationshipInfo))}}let b=class GetRelationshipInfoUseCase extends g.UseCase{constructor(t,r){super(r),this.relationshipInfoController=t}async executeInternal(t){const r=await this.relationshipInfoController.getRelationshipInfo(d.CoreId.from(t.id));return r?c.Result.ok(v.RelationshipInfoMapper.toRelationshipInfoDTO(r)):c.Result.fail(y.RuntimeErrors.general.recordNotFound(u.RelationshipInfo))}};b=i([l(0,h.Inject),l(1,h.Inject),o("design:paramtypes",[u.RelationshipInfoController,GetRelationshipInfoRequestValidator])],b),r.GetRelationshipInfoUseCase=b},27170:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetRelationshipInfoByRelationshipUseCase=void 0;const c=a(75172),u=a(3850),d=a(19663),p=a(7071),h=a(7049),m=a(6595),y=a(45420),g=a(56618);class GetRelationshipInfoRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfAny((t=>t.relationshipId)).fulfills(h.IdValidator.required(d.BackboneIds.relationship))}}let v=class GetRelationshipInfoByRelationshipUseCase extends y.UseCase{constructor(t,r){super(r),this.relationshipInfoController=t}async executeInternal(t){const r=await this.relationshipInfoController.getRelationshipInfoByRelationship(d.CoreId.from(t.relationshipId));return r?c.Result.ok(g.RelationshipInfoMapper.toRelationshipInfoDTO(r)):c.Result.fail(m.RuntimeErrors.general.recordNotFound(u.RelationshipInfo))}};v=i([l(0,p.Inject),l(1,p.Inject),o("design:paramtypes",[u.RelationshipInfoController,GetRelationshipInfoRequestValidator])],v),r.GetRelationshipInfoByRelationshipUseCase=v},16616:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.RelationshipAttributeMapper=void 0;r.RelationshipAttributeMapper=class RelationshipAttributeMapper{static toRelationshipAttributeDTO(t){return{name:t.name,content:t.content.toJSON(),sharedItem:t.sharedItem.toString()}}static toRelationshipAttributeDTOList(t){return t.map((t=>this.toRelationshipAttributeDTO(t)))}}},56618:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.RelationshipInfoMapper=void 0;const i=a(16616),o=a(51711);r.RelationshipInfoMapper=class RelationshipInfoMapper{static toRelationshipInfoDTO(t){return{id:t.id.toString(),relationshipId:t.relationshipId.toString(),attributes:i.RelationshipAttributeMapper.toRelationshipAttributeDTOList(t.attributes),isPinned:t.isPinned,title:t.title,description:t.description,userTitle:t.userTitle,userDescription:t.userDescription,theme:t.theme?o.RelationshipThemeMapper.toRelationshipThemeDTO(t.theme):void 0}}static toRelationshipInfoDTOList(t){return t.map((t=>this.toRelationshipInfoDTO(t)))}}},51711:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.RelationshipThemeMapper=void 0;r.RelationshipThemeMapper=class RelationshipThemeMapper{static toRelationshipThemeDTO(t){return{image:t.image,imageBar:t.imageBar,backgroundColor:t.backgroundColor,foregroundColor:t.foregroundColor}}static toRelationshipThemeDTOList(t){return t.map((t=>this.toRelationshipThemeDTO(t)))}}},75341:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.UpdateRelationshipInfoUseCase=void 0;const c=a(75172),u=a(3850),d=a(19663),p=a(7071),h=a(7049),m=a(6595),y=a(45420),g=a(56618);class UpdateRelationshipInfoRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfAny((t=>t.id)).fulfills(h.IdValidator.required(u.ConsumptionIds.relationshipInfo)),this.validateIfEachAny((t=>t.attributes)).fulfills(h.RelationshipAttributeDTOValidator.required())}}let v=class UpdateRelationshipInfoUseCase extends y.UseCase{constructor(t,r,a){super(a),this.relationshipInfoController=t,this.accountController=r}async executeInternal(t){const r=await this.relationshipInfoController.getRelationshipInfo(d.CoreId.from(t.id));return r?(void 0!==t.attributes&&(r.attributes=await Promise.all(t.attributes.map((t=>u.RelationshipAttribute.from({name:t.name,content:t.content,sharedItem:d.CoreId.from(t.sharedItem)}))))),r.isPinned=void 0===t.isPinned?r.isPinned:t.isPinned,r.title=void 0===t.title?r.title:t.title,r.description=void 0===t.description?r.description:t.description,r.userTitle=void 0===t.userTitle?r.userTitle:t.userTitle,r.userDescription=void 0===t.userDescription?r.userDescription:t.userDescription,r.theme=void 0===t.theme?r.theme:await u.RelationshipTheme.from(t.theme),await this.relationshipInfoController.updateRelationshipInfo(r),await this.accountController.syncDatawallet(),c.Result.ok(g.RelationshipInfoMapper.toRelationshipInfoDTO(r))):c.Result.fail(m.RuntimeErrors.general.recordNotFound(u.RelationshipInfo))}};v=i([l(0,p.Inject),l(1,p.Inject),l(2,p.Inject),o("design:paramtypes",[u.RelationshipInfoController,d.AccountController,UpdateRelationshipInfoRequestValidator])],v),r.UpdateRelationshipInfoUseCase=v},94938:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(71979),r),o(a(11788),r),o(a(42212),r),o(a(25116),r),o(a(27170),r),o(a(75341),r)},83951:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CreateSettingUseCase=void 0;const c=a(75172),u=a(3850),d=a(19663),p=a(7071),h=a(7049),m=a(96950);class CreateSettingRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.key)).isDefined(),this.validateIfAny((t=>t.value)).isDefined(),this.validateIfString((t=>t.reference)).fulfills(h.IdValidator.optional(d.TransportIds.generic)),this.validateIfString((t=>t.scope)).isIn([u.SettingScope.Device,u.SettingScope.Identity,u.SettingScope.Relationship]).whenDefined(),this.validateIfString((t=>t.succeedsAt)).fulfills(h.DateValidator.optional()),this.validateIfString((t=>t.succeedsItem)).fulfills(h.IdValidator.optional(u.ConsumptionIds.setting))}}let y=class CreateSettingUseCase extends h.UseCase{constructor(t,r,a){super(a),this.settingController=t,this.accountController=r}async executeInternal(t){const r=await this.settingController.createSetting({key:t.key,value:t.value,reference:t.reference?d.CoreId.from(t.reference):void 0,scope:t.scope,succeedsAt:t.succeedsAt?d.CoreDate.from(t.succeedsAt):void 0,succeedsItem:t.succeedsItem?d.CoreId.from(t.succeedsItem):void 0});return await this.accountController.syncDatawallet(),c.Result.ok(m.SettingMapper.toSettingDTO(r))}};y=i([l(0,p.Inject),l(1,p.Inject),l(2,p.Inject),o("design:paramtypes",[u.SettingsController,d.AccountController,CreateSettingRequestValidator])],y),r.CreateSettingUseCase=y},80678:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DeleteSettingUseCase=void 0;const c=a(75172),u=a(3850),d=a(19663),p=a(7071),h=a(60485),m=a(7049);class DeleteSettingRequestValidator extends m.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.id)).fulfills(m.IdValidator.required(u.ConsumptionIds.setting))}}let y=class DeleteSettingUseCase extends m.UseCase{constructor(t,r,a){super(a),this.settingController=t,this.accountController=r}async executeInternal(t){const r=await this.settingController.getSetting(d.CoreId.from(t.id));return r?(await this.settingController.deleteSetting(r),await this.accountController.syncDatawallet(),c.Result.ok(void 0)):c.Result.fail(h.RuntimeErrors.general.recordNotFound(u.Setting))}};y=i([l(0,p.Inject),l(1,p.Inject),l(2,p.Inject),o("design:paramtypes",[u.SettingsController,d.AccountController,DeleteSettingRequestValidator])],y),r.DeleteSettingUseCase=y},86798:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetSettingUseCase=void 0;const c=a(75172),u=a(3850),d=a(19663),p=a(7071),h=a(7049),m=a(96950);class GetSettingRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.id)).fulfills(h.IdValidator.required(u.ConsumptionIds.setting))}}let y=class GetSettingUseCase extends h.UseCase{constructor(t,r){super(r),this.settingController=t}async executeInternal(t){const r=await this.settingController.getSetting(d.CoreId.from(t.id));return r?c.Result.ok(m.SettingMapper.toSettingDTO(r)):c.Result.fail(h.RuntimeErrors.general.recordNotFound(u.Setting))}};y=i([l(0,p.Inject),l(1,p.Inject),o("design:paramtypes",[u.SettingsController,GetSettingRequestValidator])],y),r.GetSettingUseCase=y},26101:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetSettingsUseCase=void 0;const c=a(92937),u=a(75172),d=a(3850),p=a(94714),h=a(7071),m=a(7049),y=a(96950);let g=class GetSettingsUseCase extends m.UseCase{constructor(t,r){super(r),this.settingController=t}async executeInternal(t){const r=GetSettingsUseCase.queryTranslator.parse(t.query),a=await this.settingController.getSettings(r);return u.Result.ok(y.SettingMapper.toSettingDTOList(a))}};g.queryTranslator=new c.QueryTranslator({whitelist:{[(0,p.nameof)((t=>t.key))]:!0,[(0,p.nameof)((t=>t.scope))]:!0,[(0,p.nameof)((t=>t.reference))]:!0,[(0,p.nameof)((t=>t.createdAt))]:!0,[(0,p.nameof)((t=>t.deletedAt))]:!0,[(0,p.nameof)((t=>t.succeedsItem))]:!0,[(0,p.nameof)((t=>t.succeedsAt))]:!0}}),g=i([l(0,h.Inject),l(1,h.Inject),o("design:paramtypes",[d.SettingsController,m.RuntimeValidator])],g),r.GetSettingsUseCase=g},96950:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.SettingMapper=void 0;r.SettingMapper=class SettingMapper{static toSettingDTO(t){var r,a,i,o;return{id:t.id.toString(),key:t.key,scope:t.scope.toString(),reference:null===(r=t.reference)||void 0===r?void 0:r.toString(),value:t.value.toJSON(),createdAt:t.createdAt.toISOString(),deletedAt:null===(a=t.deletedAt)||void 0===a?void 0:a.toISOString(),succeedsItem:null===(i=t.succeedsItem)||void 0===i?void 0:i.toString(),succeedsAt:null===(o=t.succeedsAt)||void 0===o?void 0:o.toString()}}static toSettingDTOList(t){return t.map((t=>this.toSettingDTO(t)))}}},1853:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.UpdateSettingUseCase=void 0;const c=a(90194),u=a(75172),d=a(3850),p=a(19663),h=a(7071),m=a(60485),y=a(7049),g=a(96950);class UpdateSettingRequestValidator extends y.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.id)).fulfills(y.IdValidator.required(d.ConsumptionIds.setting)),this.validateIfAny((t=>t.value)).isDefined()}}let v=class UpdateSettingUseCase extends y.UseCase{constructor(t,r,a){super(a),this.settingController=t,this.accountController=r}async executeInternal(t){const r=await this.settingController.getSetting(p.CoreId.from(t.id));return r?(r.value=await c.SerializableAsync.from(t.value),await this.settingController.updateSetting(r),await this.accountController.syncDatawallet(),u.Result.ok(g.SettingMapper.toSettingDTO(r))):u.Result.fail(m.RuntimeErrors.general.recordNotFound(d.Setting))}};v=i([l(0,h.Inject),l(1,h.Inject),l(2,h.Inject),o("design:paramtypes",[d.SettingsController,p.AccountController,UpdateSettingRequestValidator])],v),r.UpdateSettingUseCase=v},21394:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(83951),r),o(a(80678),r),o(a(86798),r),o(a(26101),r),o(a(96950),r),o(a(1853),r)},45382:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CreateSharedItemUseCase=void 0;const c=a(75172),u=a(3850),d=a(19663),p=a(7071),h=a(7049),m=a(99443);class CreateSharedItemRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfEachString((t=>t.tags)).isDefined().whenDefined(),this.validateIfString((t=>t.sharedBy)).fulfills(h.AddressValidator.required()),this.validateIfString((t=>t.sharedWith)).fulfills(h.AddressValidator.required()),this.validateIfString((t=>t.sharedAt)).fulfills(h.DateValidator.required()),this.validateIfString((t=>t.reference)).fulfills(h.IdValidator.optional(d.TransportIds.generic)),this.validateIfString((t=>t.content)).isDefined(),this.validateIfString((t=>t.succeedsItem)).fulfills(h.IdValidator.optional(u.ConsumptionIds.sharedItem)),this.validateIfString((t=>t.succeedsAt)).fulfills(h.DateValidator.optional()),this.validateIfString((t=>t.expiresAt)).fulfills(h.DateValidator.optional())}}let y=class CreateSharedItemUseCase extends h.UseCase{constructor(t,r,a){super(a),this.sharedItemsController=t,this.accountController=r}async executeInternal(t){const r=await u.SharedItem.from({id:await u.ConsumptionIds.sharedItem.generate(),tags:t.tags,sharedBy:d.CoreAddress.from(t.sharedBy),sharedWith:d.CoreAddress.from(t.sharedWith),sharedAt:d.CoreDate.from(t.sharedAt),reference:t.reference?d.CoreId.from(t.reference):void 0,content:t.content,succeedsItem:t.succeedsItem?d.CoreId.from(t.succeedsItem):void 0,succeedsAt:t.succeedsAt?d.CoreDate.from(t.succeedsAt):void 0,expiresAt:t.expiresAt?d.CoreDate.from(t.expiresAt):void 0});return await this.sharedItemsController.createSharedItem(r),await this.accountController.syncDatawallet(),c.Result.ok(m.SharedItemsMapper.toSharedItemDTO(r))}};y=i([l(0,p.Inject),l(1,p.Inject),l(2,p.Inject),o("design:paramtypes",[u.SharedItemsController,d.AccountController,CreateSharedItemRequestValidator])],y),r.CreateSharedItemUseCase=y},71872:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DeleteSharedItemUseCase=void 0;const c=a(75172),u=a(3850),d=a(19663),p=a(7071),h=a(60485),m=a(7049);class DeleteSharedItemRequestValidator extends m.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.id)).fulfills(m.IdValidator.required(u.ConsumptionIds.sharedItem))}}let y=class DeleteSharedItemUseCase extends m.UseCase{constructor(t,r,a){super(a),this.sharedItemsController=t,this.accountController=r}async executeInternal(t){const r=await this.sharedItemsController.getSharedItem(d.CoreId.from(t.id));return r?(await this.sharedItemsController.deleteSharedItem(r),await this.accountController.syncDatawallet(),c.Result.ok(void 0)):c.Result.fail(h.RuntimeErrors.general.recordNotFound(u.SharedItem))}};y=i([l(0,p.Inject),l(1,p.Inject),l(2,p.Inject),o("design:paramtypes",[u.SharedItemsController,d.AccountController,DeleteSharedItemRequestValidator])],y),r.DeleteSharedItemUseCase=y},26081:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetSharedItemUseCase=void 0;const c=a(75172),u=a(3850),d=a(19663),p=a(7071),h=a(7049),m=a(99443);class GetSharedItemRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.id)).fulfills(h.IdValidator.required(u.ConsumptionIds.sharedItem))}}let y=class GetSharedItemUseCase extends h.UseCase{constructor(t,r){super(r),this.sharedItemsController=t}async executeInternal(t){const r=await this.sharedItemsController.getSharedItem(d.CoreId.from(t.id));return r?c.Result.ok(m.SharedItemsMapper.toSharedItemDTO(r)):c.Result.fail(h.RuntimeErrors.general.recordNotFound(u.SharedItem))}};y=i([l(0,p.Inject),l(1,p.Inject),o("design:paramtypes",[u.SharedItemsController,GetSharedItemRequestValidator])],y),r.GetSharedItemUseCase=y},98796:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetSharedItemsUseCase=void 0;const c=a(92937),u=a(75172),d=a(3850),p=a(94714),h=a(7071),m=a(7049),y=a(99443);let g=class GetSharedItemsUseCase extends m.UseCase{constructor(t,r){super(r),this.sharedItemsController=t}async executeInternal(t){const r=GetSharedItemsUseCase.queryTranslator.parse(t.query),a=await this.sharedItemsController.getSharedItems(r);return u.Result.ok(y.SharedItemsMapper.toSharedItemDTOList(a))}};g.queryTranslator=new c.QueryTranslator({whitelist:{[(0,p.nameof)((t=>t.tags))]:!0,[(0,p.nameof)((t=>t.sharedBy))]:!0,[(0,p.nameof)((t=>t.sharedWith))]:!0,[(0,p.nameof)((t=>t.sharedAt))]:!0,[(0,p.nameof)((t=>t.reference))]:!0,[(0,p.nameof)((t=>t.succeedsItem))]:!0,[(0,p.nameof)((t=>t.succeedsAt))]:!0,[(0,p.nameof)((t=>t.expiresAt))]:!0},custom:{tags:(t,r)=>{t.tags={$contains:r}}}}),g=i([l(0,h.Inject),l(1,h.Inject),o("design:paramtypes",[d.SharedItemsController,m.RuntimeValidator])],g),r.GetSharedItemsUseCase=g},4408:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetSharedItemsByAddressUseCase=void 0;const c=a(75172),u=a(3850),d=a(94714),p=a(7071),h=a(7049),m=a(99443);class GetSharedItemsByAddressRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.address)).fulfills(h.AddressValidator.required())}}let y=class GetSharedItemsByAddressUseCase extends h.UseCase{constructor(t,r){super(r),this.sharedItemsController=t}async executeInternal(t){const r=await this.sharedItemsController.getSharedItems({$or:[{[(0,d.nameof)((t=>t.sharedBy))]:t.address},{[(0,d.nameof)((t=>t.sharedWith))]:t.address}]});return c.Result.ok(m.SharedItemsMapper.toSharedItemDTOList(r))}};y=i([l(0,p.Inject),l(1,p.Inject),o("design:paramtypes",[u.SharedItemsController,GetSharedItemsByAddressRequestValidator])],y),r.GetSharedItemsByAddressUseCase=y},14042:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetSharedItemsByReferenceUseCase=void 0;const c=a(75172),u=a(3850),d=a(19663),p=a(94714),h=a(7071),m=a(7049),y=a(99443);class GetSharedItemsByReferenceRequestValidator extends m.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.reference)).fulfills(m.IdValidator.required(d.TransportIds.generic))}}let g=class GetSharedItemsByReferenceUseCase extends m.UseCase{constructor(t,r){super(r),this.sharedItemsController=t}async executeInternal(t){const r=await this.sharedItemsController.getSharedItems({[(0,p.nameof)((t=>t.reference))]:t.reference});return c.Result.ok(y.SharedItemsMapper.toSharedItemDTOList(r))}};g=i([l(0,h.Inject),l(1,h.Inject),o("design:paramtypes",[u.SharedItemsController,GetSharedItemsByReferenceRequestValidator])],g),r.GetSharedItemsByReferenceUseCase=g},55402:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetSharedItemsSharedByAddressUseCase=void 0;const c=a(75172),u=a(3850),d=a(94714),p=a(7071),h=a(7049),m=a(99443);class GetSharedItemsSharedByAddressRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.address)).fulfills(h.AddressValidator.required())}}let y=class GetSharedItemsSharedByAddressUseCase extends h.UseCase{constructor(t,r){super(r),this.sharedItemsController=t}async executeInternal(t){const r=await this.sharedItemsController.getSharedItems({[(0,d.nameof)((t=>t.sharedBy))]:t.address});return c.Result.ok(m.SharedItemsMapper.toSharedItemDTOList(r))}};y=i([l(0,p.Inject),l(1,p.Inject),o("design:paramtypes",[u.SharedItemsController,GetSharedItemsSharedByAddressRequestValidator])],y),r.GetSharedItemsSharedByAddressUseCase=y},6652:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetSharedItemsSharedWithAddressUseCase=void 0;const c=a(75172),u=a(3850),d=a(94714),p=a(7071),h=a(7049),m=a(99443);class GetSharedItemsSharedWithAddressRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.address)).fulfills(h.AddressValidator.required())}}let y=class GetSharedItemsSharedWithAddressUseCase extends h.UseCase{constructor(t,r){super(r),this.sharedItemsController=t}async executeInternal(t){const r=await this.sharedItemsController.getSharedItems({[(0,d.nameof)((t=>t.sharedWith))]:t.address});return c.Result.ok(m.SharedItemsMapper.toSharedItemDTOList(r))}};y=i([l(0,p.Inject),l(1,p.Inject),o("design:paramtypes",[u.SharedItemsController,GetSharedItemsSharedWithAddressRequestValidator])],y),r.GetSharedItemsSharedWithAddressUseCase=y},99443:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.SharedItemsMapper=void 0;r.SharedItemsMapper=class SharedItemsMapper{static toSharedItemDTO(t){var r,a,i,o;return{id:t.id.toString(),tags:t.tags,sharedBy:t.sharedBy.toString(),sharedWith:t.sharedWith.toString(),sharedAt:t.sharedAt.toString(),reference:null===(r=t.reference)||void 0===r?void 0:r.toString(),content:t.content.toJSON(),succeedsItem:null===(a=t.succeedsItem)||void 0===a?void 0:a.toString(),succeedsAt:null===(i=t.succeedsAt)||void 0===i?void 0:i.toString(),expiresAt:null===(o=t.expiresAt)||void 0===o?void 0:o.toString()}}static toSharedItemDTOList(t){return t.map((t=>this.toSharedItemDTO(t)))}}},40466:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.UpdateSharedItemUseCase=void 0;const c=a(90194),u=a(75172),d=a(3850),p=a(19663),h=a(7071),m=a(60485),y=a(7049),g=a(99443);class UpdateSharedItemRequestValidator extends y.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.id)).fulfills(y.IdValidator.required(d.ConsumptionIds.sharedItem)),this.validateIfAny((t=>t.content)).isDefined()}}let v=class UpdateSharedItemUseCase extends y.UseCase{constructor(t,r,a){super(a),this.sharedItemsController=t,this.accountController=r}async executeInternal(t){const r=await this.sharedItemsController.getSharedItem(p.CoreId.from(t.id));return r?(r.content=c.Serializable.fromUnknown(t.content),await this.sharedItemsController.updateSharedItem(r),await this.accountController.syncDatawallet(),u.Result.ok(g.SharedItemsMapper.toSharedItemDTO(r))):u.Result.fail(m.RuntimeErrors.general.recordNotFound(d.SharedItem))}};v=i([l(0,h.Inject),l(1,h.Inject),l(2,h.Inject),o("design:paramtypes",[d.SharedItemsController,p.AccountController,UpdateSharedItemRequestValidator])],v),r.UpdateSharedItemUseCase=v},90710:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(45382),r),o(a(71872),r),o(a(26081),r),o(a(98796),r),o(a(4408),r),o(a(14042),r),o(a(55402),r),o(a(6652),r),o(a(99443),r),o(a(40466),r)},60485:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(49365),r),o(a(56819),r),o(a(6595),r),o(a(23742),r),o(a(29667),r)},72737:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DisableAutoSyncUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049);let h=class DisableAutoSyncUseCase extends p.UseCase{constructor(t){super(),this.accountController=t}executeInternal(){return this.accountController.disableAutoSync(),c.Result.ok(void 0)}};h=i([l(0,d.Inject),o("design:paramtypes",[u.AccountController])],h),r.DisableAutoSyncUseCase=h},89710:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.EnableAutoSyncUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049);let h=class EnableAutoSyncUseCase extends p.UseCase{constructor(t){super(),this.accountController=t}async executeInternal(){return await this.accountController.enableAutoSync(),c.Result.ok(void 0)}};h=i([l(0,d.Inject),o("design:paramtypes",[u.AccountController])],h),r.EnableAutoSyncUseCase=h},60569:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetDeviceInfoUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049),h=a(83067);let m=class GetDeviceInfoUseCase extends p.UseCase{constructor(t){super(),this.deviceController=t}executeInternal(){const t=this.deviceController.device;return c.Result.ok(h.DeviceMapper.toDeviceDTO(t))}};m=i([l(0,d.Inject),o("design:paramtypes",[u.DeviceController])],m),r.GetDeviceInfoUseCase=m},73378:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetIdentityInfoUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049);let h=class GetIdentityInfoUseCase extends p.UseCase{constructor(t){super(),this.identityController=t}executeInternal(){const t=this.identityController.identity;return c.Result.ok({address:t.address.toString(),publicKey:t.publicKey.toString()})}};h=i([l(0,d.Inject),o("design:paramtypes",[u.IdentityController])],h),r.GetIdentityInfoUseCase=h},68562:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetSyncInfoUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049);let h=class GetSyncInfoUseCase extends p.UseCase{constructor(t){super(),this.accountController=t}async executeInternal(){const t=await this.accountController.getLastCompletedSyncTime(),r=await this.accountController.getLastCompletedDatawalletSyncTime();return c.Result.ok({lastSyncRun:t?{completedAt:t.toISOString()}:void 0,lastDatawalletSync:r?{completedAt:r.toISOString()}:void 0})}};h=i([l(0,d.Inject),o("design:paramtypes",[u.AccountController])],h),r.GetSyncInfoUseCase=h},63826:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.RegisterPushNotificationTokenUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049);class Validator extends p.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.handle)).isDefined().isNotEmpty(),this.validateIfString((t=>t.installationId)).isDefined().isNotEmpty(),this.validateIfString((t=>t.platform)).isDefined().isNotEmpty()}}let h=class RegisterPushNotificationTokenUseCase extends p.UseCase{constructor(t,r){super(r),this.accountController=t}async executeInternal(t){return await this.accountController.registerPushNotificationToken({handle:t.handle,installationId:t.installationId,platform:t.platform}),c.Result.ok(void 0)}};h=i([l(0,d.Inject),l(1,d.Inject),o("design:paramtypes",[u.AccountController,Validator])],h),r.RegisterPushNotificationTokenUseCase=h},54204:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.SyncDatawalletUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049);let h=class SyncDatawalletUseCase extends p.UseCase{constructor(t){super(),this.accountController=t}async executeInternal(){return await this.accountController.syncDatawallet(!0),c.Result.ok(void 0)}};h=i([l(0,d.Inject),o("design:paramtypes",[u.AccountController])],h),r.SyncDatawalletUseCase=h},84773:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.SyncEverythingUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(42205),h=a(986),m=a(7049),y=a(76881),g=a(94316);let v=class SyncEverythingUseCase extends m.UseCase{constructor(t,r,a,i){super(),this.accountController=t,this.identityController=r,this.eventBus=a,this.logger=i.getLogger(SyncEverythingUseCase)}async executeInternal(){if(this.currentSync)return await this.currentSync;this.currentSync=this._executeInternal();try{return await this.currentSync}finally{this.currentSync=void 0}}async _executeInternal(){const t=await this.accountController.syncEverything(),r=t.messages.map((t=>y.MessageMapper.toMessageDTO(t))),a=t.relationships.map((t=>g.RelationshipMapper.toRelationshipDTO(t))),i=this.identityController.identity.address.toString();return this.processNewMessages(r,i),this.processNewRelationships(a,i),c.Result.ok({messages:r,relationships:a})}processNewRelationships(t,r){if(0!==t.length){this.logger.debug(`Found ${t.length} relationship(s) with changes. Start publishing on event bus...`);for(const a of t)this.eventBus.publish(new p.RelationshipChangedEvent(r,a));this.logger.debug("Finished publishing relationship changes on event bus.")}}processNewMessages(t,r){if(0!==t.length){this.logger.debug(`Found ${t.length} new message(s). Start publishing on event bus...`);for(const a of t)this.eventBus.publish(new p.MessageReceivedEvent(r,a));this.logger.debug("Finished publishing message changes on event bus.")}}};v=i([l(0,d.Inject),l(1,d.Inject),l(2,d.Inject),l(3,d.Inject),o("design:paramtypes",[u.AccountController,u.IdentityController,c.EventBus,h.RuntimeLoggerFactory])],v),r.SyncEverythingUseCase=v},69276:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(72737),r),o(a(89710),r),o(a(60569),r),o(a(73378),r),o(a(68562),r),o(a(63826),r),o(a(54204),r),o(a(84773),r)},57661:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.ChallengeMapper=void 0;r.ChallengeMapper=class ChallengeMapper{static toChallengeDTO(t){const r=JSON.parse(t.challenge);return{id:r.id,expiresAt:r.expiresAt,createdBy:r.createdBy,createdByDevice:r.createdByDevice,type:r.type,signature:t.signature.toBase64(),challengeString:t.challenge}}}},99936:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CreateChallengeUseCase=void 0;const c=a(75172),u=a(19663),d=a(63586),p=a(7071),h=a(7049),m=a(57661);function isCreateRelationshipChallengeRequest(t){return"Relationship"===t.challengeType&&"string"==typeof t.relationship}let y=class Validator extends h.SchemaValidator{constructor(t){super(t.getSchema("CreateChallengeRequest")),this.relationshipSchema=t.getSchema("CreateRelationshipChallengeRequest"),this.identitySchema=t.getSchema("CreateIdentityChallengeRequest"),this.deviceSchema=t.getSchema("CreateDeviceChallengeRequest")}validate(t){if(this.schema.validate(t).isValid)return new d.ValidationResult;if(isCreateRelationshipChallengeRequest(t))return this.convertValidationResult(this.relationshipSchema.validate(t));if(function isCreateIdentityChallengeRequest(t){return"Identity"===t.challengeType}(t))return this.convertValidationResult(this.identitySchema.validate(t));if(function isCreateDeviceChallengeRequest(t){return"Device"===t.challengeType}(t))return this.convertValidationResult(this.deviceSchema.validate(t));const r=new d.ValidationResult;return r.addFailures([new d.ValidationFailure(void 0,"",void 0,h.RuntimeErrors.general.invalidPayload().code,h.RuntimeErrors.general.invalidPayload().message)]),r}};y=i([l(0,p.Inject),o("design:paramtypes",[h.SchemaRepository])],y);let g=class CreateChallengeUseCase extends h.UseCase{constructor(t,r,a){super(a),this.challengeController=t,this.relationshipsController=r}async executeInternal(t){const r=await this.getRelationship(t);if(r.isError)return c.Result.fail(r.error);let a;switch(t.challengeType){case"Relationship":a=u.ChallengeType.Relationship;break;case"Identity":a=u.ChallengeType.Identity;break;case"Device":a=u.ChallengeType.Device;break;default:throw new Error("Unknown challenge type.")}const i=await this.challengeController.createChallenge(a,r.value);return c.Result.ok(m.ChallengeMapper.toChallengeDTO(i))}async getRelationship(t){if(!isCreateRelationshipChallengeRequest(t))return c.Result.ok(void 0);const r=await this.relationshipsController.getRelationship(u.CoreId.from(t.relationship));return r?c.Result.ok(r):c.Result.fail(h.RuntimeErrors.general.recordNotFound(u.Relationship))}};g=i([l(0,p.Inject),l(1,p.Inject),l(2,p.Inject),o("design:paramtypes",[u.ChallengeController,u.RelationshipsController,y])],g),r.CreateChallengeUseCase=g},50473:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.ValidateChallengeUseCase=void 0;const c=a(75172),u=a(82890),d=a(19663),p=a(63586),h=a(7071),m=a(7049),y=a(94316);let g=class Validator extends m.SchemaValidator{constructor(t){super(t.getSchema("ValidateChallengeRequest"))}async validate(t){const r=await super.validate(t);if(r.isInvalid())return r;const a=await this.validateSignature(t.signature);a.isError&&r.addFailures([new p.ValidationFailure(void 0,"signature",void 0,void 0,a.error.message)]);const i=await this.validateChallenge(t.challenge);return i.isError&&r.addFailures([new p.ValidationFailure(void 0,"challenge",void 0,void 0,i.error.message)]),r}async validateSignature(t){try{return await u.CryptoSignature.fromBase64(t),c.Result.ok(void 0)}catch{return c.Result.fail(m.RuntimeErrors.challenges.invalidSignature())}}async validateChallenge(t){try{return await d.Challenge.deserialize(t),c.Result.ok(void 0)}catch{return c.Result.fail(m.RuntimeErrors.challenges.invalidChallenge())}}};g=i([l(0,h.Inject),o("design:paramtypes",[m.SchemaRepository])],g);let v=class ValidateChallengeUseCase extends m.UseCase{constructor(t,r){super(r),this.challengeController=t}async executeInternal(t){const r=await u.CryptoSignature.fromBase64(t.signature),a=await d.ChallengeSigned.from({challenge:t.challenge,signature:r});try{const t=await this.challengeController.validateChallenge(a),r=t.correspondingRelationship?y.RelationshipMapper.toRelationshipDTO(t.correspondingRelationship):void 0;return c.Result.ok({isValid:t.isValid,correspondingRelationship:r})}catch(t){if(!(t instanceof d.CoreError)||"error.transport.notImplemented"!==t.code)throw t;return c.Result.fail(m.RuntimeErrors.general.featureNotImplemented("Validating challenges of the type 'Device' is not yet implemented."))}}};v=i([l(0,h.Inject),l(1,h.Inject),o("design:paramtypes",[d.ChallengeController,g])],v),r.ValidateChallengeUseCase=v},75629:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(99936),r),o(a(50473),r)},5188:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CreateDeviceUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049),h=a(83067);class CreateDeviceRequestValidator extends p.RuntimeValidator{constructor(){super()}}let m=class CreateDeviceUseCase extends p.UseCase{constructor(t,r,a){super(a),this.devicesController=t,this.accountController=r}async executeInternal(t){const r=await this.devicesController.sendDevice(t);return await this.accountController.syncDatawallet(),c.Result.ok(h.DeviceMapper.toDeviceDTO(r))}};m=i([l(0,d.Inject),l(1,d.Inject),l(2,d.Inject),o("design:paramtypes",[u.DevicesController,u.AccountController,CreateDeviceRequestValidator])],m),r.CreateDeviceUseCase=m},20795:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CreateDeviceOnboardingTokenUseCase=void 0;const c=a(75172),u=a(19663),d=a(99490),p=a(7071),h=a(7049),m=a(57121);class CreateDeviceOnboardingTokenRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.id)).fulfills(h.IdValidator.required(u.BackboneIds.device)),this.validateIf((t=>t.expiresAt)).fulfills(h.DateValidator.optional()),this.validateIf((t=>t.expiresAt)).fulfills((t=>d.DateTime.fromISO(t)>d.DateTime.utc())).whenNotNull().withFailureMessage("'$propertyName' must be in the future.")}}let y=class CreateDeviceOnboardingTokenUseCase extends h.UseCase{constructor(t,r,a){super(a),this.devicesController=t,this.tokenController=r}async executeInternal(t){const r=await this.devicesController.getSharedSecret(u.CoreId.from(t.id)),a=t.expiresAt?u.CoreDate.from(t.expiresAt):u.CoreDate.utc().add({minutes:5}),i=await u.TokenContentDeviceSharedSecret.from({sharedSecret:r}),o=await this.tokenController.sendToken({content:i,expiresAt:a,ephemeral:!0});return c.Result.ok(await m.TokenMapper.toTokenDTO(o,!0))}};y=i([l(0,p.Inject),l(1,p.Inject),l(2,p.Inject),o("design:paramtypes",[u.DevicesController,u.TokenController,CreateDeviceOnboardingTokenRequestValidator])],y),r.CreateDeviceOnboardingTokenUseCase=y},2137:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DeleteDeviceUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049);class DeleteDeviceRequestValidator extends p.RuntimeValidator{constructor(){super(),this.validateIf((t=>t.id)).fulfills(p.IdValidator.required(u.BackboneIds.device))}}let h=class DeleteDeviceUseCase extends p.UseCase{constructor(t,r,a){super(a),this.devicesController=t,this.accountController=r}async executeInternal(t){const r=await this.devicesController.get(u.CoreId.from(t.id));return r?(await this.devicesController.delete(r),await this.accountController.syncDatawallet(),c.Result.ok(void 0)):c.Result.fail(p.RuntimeErrors.general.recordNotFound(u.Device))}};h=i([l(0,d.Inject),l(1,d.Inject),l(2,d.Inject),o("design:paramtypes",[u.DevicesController,u.AccountController,DeleteDeviceRequestValidator])],h),r.DeleteDeviceUseCase=h},83067:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.DeviceMapper=void 0;const i=a(82890),o=a(19663);r.DeviceMapper=class DeviceMapper{static toDeviceDTO(t){var r,a;return{id:t.id.toString(),createdAt:t.createdAt.toString(),createdByDevice:t.createdByDevice.toString(),name:t.name,type:t.type.toString(),username:t.username,certificate:t.certificate,description:t.description,lastLoginAt:null===(r=t.lastLoginAt)||void 0===r?void 0:r.toString(),operatingSystem:t.operatingSystem,publicKey:null===(a=t.publicKey)||void 0===a?void 0:a.toString()}}static toDeviceOnboardingInfoDTO(t){return{id:t.id.toString(),createdAt:t.createdAt.toString(),createdByDevice:t.createdByDevice.toString(),name:t.name,description:t.description,secretBaseKey:t.secretBaseKey.toBase64(),deviceIndex:t.deviceIndex,synchronizationKey:t.synchronizationKey.toBase64(),identityPrivateKey:t.identityPrivateKey?t.identityPrivateKey.toString():void 0,identity:{address:t.identity.address.toString(),publicKey:t.identity.publicKey.toString(),realm:t.identity.realm.toString()},password:t.password,username:t.username}}static async toDeviceSharedSecret(t){return await o.DeviceSharedSecret.from({id:o.CoreId.from(t.id),createdAt:o.CoreDate.from(t.createdAt),createdByDevice:o.CoreId.from(t.createdByDevice),name:t.name,description:t.description,secretBaseKey:await i.CryptoSecretKey.fromBase64(t.secretBaseKey),deviceIndex:t.deviceIndex,synchronizationKey:await i.CryptoSecretKey.fromBase64(t.synchronizationKey),identityPrivateKey:t.identityPrivateKey?await i.CryptoSignaturePrivateKey.deserialize(t.identityPrivateKey):void 0,identity:{address:o.CoreAddress.from(t.identity.address),publicKey:await i.CryptoSignaturePublicKey.deserialize(t.identity.publicKey),realm:t.identity.realm},password:t.password,username:t.username})}}},40770:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetDeviceUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049),h=a(83067);class GetDeviceRequestValidator extends p.RuntimeValidator{constructor(){super(),this.validateIf((t=>t.id)).fulfills(p.IdValidator.required(u.BackboneIds.device))}}let m=class GetDeviceUseCase extends p.UseCase{constructor(t,r){super(r),this.devicesController=t}async executeInternal(t){const r=await this.devicesController.get(u.CoreId.from(t.id));return r?c.Result.ok(h.DeviceMapper.toDeviceDTO(r)):c.Result.fail(p.RuntimeErrors.general.recordNotFound(u.Device))}};m=i([l(0,d.Inject),l(1,d.Inject),o("design:paramtypes",[u.DevicesController,GetDeviceRequestValidator])],m),r.GetDeviceUseCase=m},8283:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetDeviceOnboardingInfoUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049),h=a(83067);let m=class GetDeviceOnboardingInfoUseCase extends p.UseCase{constructor(t,r){super(r),this.devicesController=t}async executeInternal(t){const r=await this.devicesController.getSharedSecret(u.CoreId.from(t.id));return c.Result.ok(h.DeviceMapper.toDeviceOnboardingInfoDTO(r))}};m=i([l(0,d.Inject),l(1,d.Inject),o("design:paramtypes",[u.DevicesController,p.RuntimeValidator])],m),r.GetDeviceOnboardingInfoUseCase=m},93341:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetDevicesUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049),h=a(83067);let m=class GetDevicesUseCase extends p.UseCase{constructor(t){super(),this.devicesController=t}async executeInternal(){const t=(await this.devicesController.list()).map((t=>h.DeviceMapper.toDeviceDTO(t)));return c.Result.ok(t)}};m=i([l(0,d.Inject),o("design:paramtypes",[u.DevicesController])],m),r.GetDevicesUseCase=m},80189:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.UpdateDeviceUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(97802),h=a(7049);class UpdateDeviceRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIf((t=>t.id)).fulfills(h.IdValidator.required(u.BackboneIds.device))}}let m=class UpdateDeviceUseCase extends h.UseCase{constructor(t,r,a){super(a),this.devicesController=t,this.accountController=r}async executeInternal(t){const r=await this.devicesController.get(u.CoreId.from(t.id));return r?(t.name&&(r.name=t.name),r.description=t.description,await this.devicesController.update(r),await this.accountController.syncDatawallet(),c.Result.ok(p.DeviceMapper.toDeviceDTO(r))):c.Result.fail(h.RuntimeErrors.general.recordNotFound(u.Device))}};m=i([l(0,d.Inject),l(1,d.Inject),l(2,d.Inject),o("design:paramtypes",[u.DevicesController,u.AccountController,UpdateDeviceRequestValidator])],m),r.UpdateDeviceUseCase=m},97802:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(5188),r),o(a(20795),r),o(a(2137),r),o(a(83067),r),o(a(40770),r),o(a(8283),r),o(a(93341),r),o(a(80189),r)},10542:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CreateTokenForFileUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049),h=a(57121);let m=class Validator extends p.SchemaValidator{constructor(t){super(t.getSchema("CreateTokenForFileRequest"))}};m=i([l(0,d.Inject),o("design:paramtypes",[p.SchemaRepository])],m);let y=class CreateTokenForFileUseCase extends p.UseCase{constructor(t,r,a,i){super(i),this.fileController=t,this.tokenController=r,this.accountController=a}async executeInternal(t){var r,a,i;const o=await this.fileController.getFile(u.CoreId.from(t.fileId));if(!o)return c.Result.fail(p.RuntimeErrors.general.recordNotFound(u.File));const l=await u.TokenContentFile.from({fileId:o.id,secretKey:o.secretKey}),d=null===(r=t.ephemeral)||void 0===r||r,m=null!==(i=null===(a=o.cache)||void 0===a?void 0:a.expiresAt)&&void 0!==i?i:u.CoreDate.utc().add({days:12}),y=t.expiresAt?u.CoreDate.from(t.expiresAt):m,g=await this.tokenController.sendToken({content:l,expiresAt:y,ephemeral:d});return d||await this.accountController.syncDatawallet(),c.Result.ok(await h.TokenMapper.toTokenDTO(g,d))}};y=i([l(0,d.Inject),l(1,d.Inject),l(2,d.Inject),l(3,d.Inject),o("design:paramtypes",[u.FileController,u.TokenController,u.AccountController,m])],y),r.CreateTokenForFileUseCase=y},6913:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CreateTokenQrCodeForFileUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049);let h=class Validator extends p.SchemaValidator{constructor(t){super(t.getSchema("CreateTokenQrCodeForFileRequest"))}};h=i([l(0,d.Inject),o("design:paramtypes",[p.SchemaRepository])],h);let m=class CreateTokenQrCodeForFileUseCase extends p.UseCase{constructor(t,r,a){super(a),this.fileController=t,this.tokenController=r}async executeInternal(t){var r,a;const i=await this.fileController.getFile(u.CoreId.from(t.fileId));if(!i)return c.Result.fail(p.RuntimeErrors.general.recordNotFound(u.File));const o=await u.TokenContentFile.from({fileId:i.id,secretKey:i.secretKey}),l=null!==(a=null===(r=i.cache)||void 0===r?void 0:r.expiresAt)&&void 0!==a?a:u.CoreDate.utc().add({days:12}),d=t.expiresAt?u.CoreDate.from(t.expiresAt):l,h=await this.tokenController.sendToken({content:o,expiresAt:d,ephemeral:!0}),m=await p.QRCode.from(await h.truncate());return c.Result.ok({qrCodeBytes:m.asBase64()})}};m=i([l(0,d.Inject),l(1,d.Inject),l(2,d.Inject),o("design:paramtypes",[u.FileController,u.TokenController,h])],m),r.CreateTokenQrCodeForFileUseCase=m},68516:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DownloadFileUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049),h=a(35076);let m=class Validator extends p.SchemaValidator{constructor(t){super(t.getSchema("DownloadFileRequest"))}};m=i([l(0,d.Inject),o("design:paramtypes",[p.SchemaRepository])],m);let y=class DownloadFileUseCase extends p.UseCase{constructor(t,r){super(r),this.fileController=t}async executeInternal(t){const r=u.CoreId.from(t.id),a=await this.fileController.getFile(r);if(!a)return c.Result.fail(p.RuntimeErrors.general.recordNotFound(u.File));const i=await this.fileController.downloadFileContent(a.id);return c.Result.ok(h.FileMapper.toDownloadFileResponse(i,a))}};y=i([l(0,d.Inject),l(1,d.Inject),o("design:paramtypes",[u.FileController,m])],y),r.DownloadFileUseCase=y},35076:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.FileMapper=void 0;const i=a(19663),o=a(7049);r.FileMapper=class FileMapper{static toDownloadFileResponse(t,r){if(!r.cache)throw o.RuntimeErrors.general.cacheEmpty(i.File,r.id.toString());return{content:t.buffer,filename:r.cache.filename?r.cache.filename:r.id.toString(),mimetype:r.cache.mimetype}}static toFileDTO(t){var r,a,l,c;if(!t.cache)throw o.RuntimeErrors.general.cacheEmpty(i.File,t.id.toString());return{id:t.id.toString(),filename:t.cache.filename,filesize:t.cache.filesize,createdAt:t.cache.createdAt.toString(),createdBy:t.cache.createdBy.toString(),createdByDevice:t.cache.createdByDevice.toString(),expiresAt:t.cache.expiresAt.toString(),mimetype:t.cache.mimetype,isOwn:t.isOwn,title:null!==(r=t.cache.title)&&void 0!==r?r:"",secretKey:t.secretKey.toBase64(),description:t.cache.description,deletedAt:null===(a=t.cache.deletedAt)||void 0===a?void 0:a.toString(),deletedBy:null===(l=t.cache.deletedBy)||void 0===l?void 0:l.toString(),deletedByDevice:null===(c=t.cache.deletedByDevice)||void 0===c?void 0:c.toString()}}static toFileDTOList(t){return t.map((t=>this.toFileDTO(t)))}}},13520:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetFileUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049),h=a(35076);let m=class Validator extends p.SchemaValidator{constructor(t){super(t.getSchema("GetFileRequest"))}};m=i([l(0,d.Inject),o("design:paramtypes",[p.SchemaRepository])],m);let y=class GetFileUseCase extends p.UseCase{constructor(t,r){super(r),this.fileController=t}async executeInternal(t){const r=await this.fileController.getFile(u.CoreId.from(t.id));return r?c.Result.ok(h.FileMapper.toFileDTO(r)):c.Result.fail(p.RuntimeErrors.general.recordNotFound(u.File))}};y=i([l(0,d.Inject),l(1,d.Inject),o("design:paramtypes",[u.FileController,m])],y),r.GetFileUseCase=y},35911:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetFilesUseCase=void 0;const c=a(92937),u=a(75172),d=a(19663),p=a(94714),h=a(7071),m=a(7049),y=a(35076);let g=class GetFilesUseCase extends m.UseCase{constructor(t,r){super(r),this.fileController=t}async executeInternal(t){const r=GetFilesUseCase.queryTranslator.parse(t.query);t.ownerRestriction&&(r[(0,p.nameof)((t=>t.isOwn))]=t.ownerRestriction===m.OwnerRestriction.Own);const a=await this.fileController.getFiles(r);return u.Result.ok(y.FileMapper.toFileDTOList(a))}};g.queryTranslator=new c.QueryTranslator({whitelist:{[(0,p.nameof)((t=>t.createdAt))]:!0,[(0,p.nameof)((t=>t.createdBy))]:!0,[(0,p.nameof)((t=>t.createdByDevice))]:!0,[(0,p.nameof)((t=>t.deletedAt))]:!0,[(0,p.nameof)((t=>t.deletedBy))]:!0,[(0,p.nameof)((t=>t.deletedByDevice))]:!0,[(0,p.nameof)((t=>t.description))]:!0,[(0,p.nameof)((t=>t.expiresAt))]:!0,[(0,p.nameof)((t=>t.filename))]:!0,[(0,p.nameof)((t=>t.filesize))]:!0,[(0,p.nameof)((t=>t.mimetype))]:!0,[(0,p.nameof)((t=>t.title))]:!0,[(0,p.nameof)((t=>t.isOwn))]:!0},alias:{[(0,p.nameof)((t=>t.createdAt))]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.createdAt))}`,[(0,p.nameof)((t=>t.createdBy))]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.createdBy))}`,[(0,p.nameof)((t=>t.createdByDevice))]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.createdByDevice))}`,[(0,p.nameof)((t=>t.deletedAt))]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.deletedAt))}`,[(0,p.nameof)((t=>t.deletedBy))]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.deletedBy))}`,[(0,p.nameof)((t=>t.deletedByDevice))]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.deletedByDevice))}`,[(0,p.nameof)((t=>t.description))]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.description))}`,[(0,p.nameof)((t=>t.expiresAt))]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.expiresAt))}`,[(0,p.nameof)((t=>t.filename))]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.filename))}`,[(0,p.nameof)((t=>t.filesize))]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.filesize))}`,[(0,p.nameof)((t=>t.mimetype))]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.mimetype))}`,[(0,p.nameof)((t=>t.title))]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.title))}`,[(0,p.nameof)((t=>t.isOwn))]:(0,p.nameof)((t=>t.isOwn))}}),g=i([l(0,h.Inject),l(1,h.Inject),o("design:paramtypes",[d.FileController,m.RuntimeValidator])],g),r.GetFilesUseCase=g},67435:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.LoadPeerFileUseCase=void 0;const c=a(75172),u=a(82890),d=a(19663),p=a(63586),h=a(7071),m=a(7049),y=a(35076);function isLoadPeerFileViaSecret(t){return"id"in t&&"secretKey"in t}function isLoadPeerFileViaReference(t){return"reference"in t}let g=class Validator extends m.SchemaValidator{constructor(t){super(t.getSchema("LoadPeerFileRequest")),this.loadViaSecretSchema=t.getSchema("LoadPeerFileViaSecretRequest"),this.loadViaReferenceSchema=t.getSchema("LoadPeerFileViaReferenceRequest")}validate(t){if(this.schema.validate(t).isValid)return new p.ValidationResult;if(isLoadPeerFileViaReference(t))return this.convertValidationResult(this.loadViaReferenceSchema.validate(t));if(isLoadPeerFileViaSecret(t))return this.convertValidationResult(this.loadViaSecretSchema.validate(t));const r=new p.ValidationResult;return r.addFailures([new p.ValidationFailure(void 0,"",void 0,m.RuntimeErrors.general.invalidPayload().code,m.RuntimeErrors.general.invalidPayload().message)]),r}};g=i([l(0,h.Inject),o("design:paramtypes",[m.SchemaRepository])],g);let v=class LoadPeerFileUseCase extends m.UseCase{constructor(t,r,a,i){super(i),this.fileController=t,this.tokenController=r,this.accountController=a}async executeInternal(t){let r;if(isLoadPeerFileViaSecret(t)){const a=await u.CryptoSecretKey.fromBase64(t.secretKey);r=await this.loadFile(d.CoreId.from(t.id),a)}else{if(!isLoadPeerFileViaReference(t))throw new Error("Invalid request format.");r=await this.createFileFromTokenReferenceRequest(t.reference)}return await this.accountController.syncDatawallet(),r}async createFileFromTokenReferenceRequest(t){const r=await this.tokenController.loadPeerTokenByTruncated(t,!0);if(!r.cache)throw m.RuntimeErrors.general.cacheEmpty(d.Token,r.id.toString());if(!(r.cache.content instanceof d.TokenContentFile))return c.Result.fail(m.RuntimeErrors.general.invalidTokenContent());const a=r.cache.content;return await this.loadFile(a.fileId,a.secretKey)}async loadFile(t,r){const a=await this.fileController.loadPeerFile(t,r);return c.Result.ok(y.FileMapper.toFileDTO(a))}};v=i([l(0,h.Inject),l(1,h.Inject),l(2,h.Inject),l(3,h.Inject),o("design:paramtypes",[d.FileController,d.TokenController,d.AccountController,g])],v),r.LoadPeerFileUseCase=v},32109:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.UploadOwnFileUseCase=void 0;const c=a(75172),u=a(82890),d=a(19663),p=a(99490),h=a(7071),m=a(7049),y=a(35076);class UploadOwnFileRequestValidator extends m.RuntimeValidator{constructor(){super(),this.validateIf((t=>t.content)).isNotNull().fulfills((t=>t.length>0)).withFailureMessage("file content is empty"),this.validateIf((t=>t.content)).isNotNull().fulfills((t=>t.byteLength<=this._maxFileSize)).withFailureMessage("file content is too large"),this.validateIf((t=>t.filename)).isNotNull(),this.validateIf((t=>t.mimetype)).isNotNull(),this.validateIf((t=>t.title)).isNotNull(),this.validateIf((t=>t.expiresAt)).isNotNull(),this.validateIf((t=>t.expiresAt)).fulfills(m.DateValidator.required()),this.validateIf((t=>t.expiresAt)).fulfills((t=>p.DateTime.fromISO(t)>p.DateTime.utc())).withFailureMessage("'$propertyName' must be in the future.")}set maxFileSize(t){this._maxFileSize=t}}let g=class UploadOwnFileUseCase extends m.UseCase{constructor(t,r,a){super(a),this.fileController=t,this.accountController=r,a.maxFileSize=t.config.platformMaxUnencryptedFileSize}async executeInternal(t){var r;const a=await this.fileController.sendFile({buffer:u.CoreBuffer.from(t.content),title:t.title,description:null!==(r=t.description)&&void 0!==r?r:"",filename:t.filename,mimetype:t.mimetype,expiresAt:d.CoreDate.from(t.expiresAt)});return await this.accountController.syncDatawallet(),c.Result.ok(y.FileMapper.toFileDTO(a))}};g=i([l(0,h.Inject),l(1,h.Inject),l(2,h.Inject),o("design:paramtypes",[d.FileController,d.AccountController,UploadOwnFileRequestValidator])],g),r.UploadOwnFileUseCase=g},20098:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(10542),r),o(a(6913),r),o(a(68516),r),o(a(35076),r),o(a(13520),r),o(a(35911),r),o(a(67435),r),o(a(32109),r)},54824:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CheckIdentityUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049),h=a(94316);class CheckIdentityRequestValidator extends p.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.address)).fulfills(p.AddressValidator.required())}}let m=class CheckIdentityUseCase extends p.UseCase{constructor(t,r,a){super(a),this.identityController=t,this.relationshipsController=r}async executeInternal(t){const r=u.CoreAddress.from(t.address);if(this.identityController.isMe(r))return c.Result.ok({self:!0});const a=await this.relationshipsController.getRelationshipToIdentity(r);if(a){const t=h.RelationshipMapper.toRelationshipDTO(a);return a.status===u.RelationshipStatus.Pending?c.Result.ok({peer:!0,relationshipPending:!0,relationship:t}):a.status===u.RelationshipStatus.Active||a.status===u.RelationshipStatus.Terminating?c.Result.ok({peer:!0,relationshipActive:!0,relationship:t}):c.Result.ok({peer:!0,relationshipTerminated:!0,relationship:t})}return c.Result.ok({unknown:!0})}};m=i([l(0,d.Inject),l(1,d.Inject),l(2,d.Inject),o("design:paramtypes",[u.IdentityController,u.RelationshipsController,CheckIdentityRequestValidator])],m),r.CheckIdentityUseCase=m},74847:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(54824),r)},29667:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(69276),r),o(a(75629),r),o(a(97802),r),o(a(20098),r),o(a(74847),r),o(a(92290),r),o(a(7831),r),o(a(43084),r),o(a(25631),r)},64860:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DownloadAttachmentUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049),h=a(76881);class DownloadAttachmentRequestValidator extends p.RuntimeValidator{constructor(){super(),this.validateIf((t=>t.id)).fulfills(p.IdValidator.required(u.BackboneIds.message)),this.validateIf((t=>t.attachmentId)).fulfills(p.IdValidator.required(u.BackboneIds.file))}}let m=class DownloadAttachmentUseCase extends p.UseCase{constructor(t,r,a){super(a),this.messageController=t,this.fileController=r}async executeInternal(t){const r=await this.messageController.getMessage(u.CoreId.from(t.id));if(!r)return c.Result.fail(p.RuntimeErrors.general.recordNotFound(u.Message));if(!r.cache)throw p.RuntimeErrors.general.cacheEmpty(u.Message,r.id.toString());const a=r.cache.attachments.find((r=>r.equals(u.CoreId.from(t.attachmentId))));if(!a)return c.Result.fail(p.RuntimeErrors.messages.fileNotFoundInMessage(t.attachmentId));const i=await this.fileController.getFile(a);if(!i)return c.Result.fail(p.RuntimeErrors.general.recordNotFound(u.File));const o=await this.fileController.downloadFileContent(a);return c.Result.ok(h.MessageMapper.toDownloadAttachmentResponse(o,i))}};m=i([l(0,d.Inject),l(1,d.Inject),l(2,d.Inject),o("design:paramtypes",[u.MessageController,u.FileController,DownloadAttachmentRequestValidator])],m),r.DownloadAttachmentUseCase=m},19558:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetAttachmentMetadataUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049),h=a(35076);class GetAttachmentMetadataRequestValidator extends p.RuntimeValidator{constructor(){super(),this.validateIf((t=>t.id)).fulfills(p.IdValidator.required(u.BackboneIds.message)),this.validateIf((t=>t.attachmentId)).fulfills(p.IdValidator.required(u.BackboneIds.file))}}let m=class GetAttachmentMetadataUseCase extends p.UseCase{constructor(t,r,a){super(a),this.messageController=t,this.fileController=r}async executeInternal(t){const r=await this.messageController.getMessage(u.CoreId.from(t.id));if(!r)return c.Result.fail(p.RuntimeErrors.general.recordNotFound(u.Message));if(!r.cache)throw p.RuntimeErrors.general.cacheEmpty(u.Message,r.id.toString());const a=r.cache.attachments.find((r=>r.equals(u.CoreId.from(t.attachmentId))));if(!a)return c.Result.fail(p.RuntimeErrors.messages.fileNotFoundInMessage(t.attachmentId));const i=await this.fileController.getFile(a);return i?c.Result.ok(h.FileMapper.toFileDTO(i)):c.Result.fail(p.RuntimeErrors.general.recordNotFound(File))}};m=i([l(0,d.Inject),l(1,d.Inject),l(2,d.Inject),o("design:paramtypes",[u.MessageController,u.FileController,GetAttachmentMetadataRequestValidator])],m),r.GetAttachmentMetadataUseCase=m},40978:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetMessageUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049),h=a(76881);class GetMessageRequestValidator extends p.RuntimeValidator{constructor(){super(),this.validateIf((t=>t.id)).fulfills(p.IdValidator.required(u.BackboneIds.message))}}let m=class GetMessageUseCase extends p.UseCase{constructor(t,r,a){super(a),this.messageController=t,this.fileController=r}async executeInternal(t){const r=await this.messageController.getMessage(u.CoreId.from(t.id));if(!r)return c.Result.fail(p.RuntimeErrors.general.recordNotFound(u.Message));if(!r.cache)return c.Result.fail(p.RuntimeErrors.general.cacheEmpty(u.Message,r.id.toString()));const a=await Promise.all(r.cache.attachments.map((t=>this.fileController.getFile(t))));if(a.some((t=>!t)))throw new Error("A file could not be fetched.");return c.Result.ok(h.MessageMapper.toMessageWithAttachmentsDTO(r,a))}};m=i([l(0,d.Inject),l(1,d.Inject),l(2,d.Inject),o("design:paramtypes",[u.MessageController,u.FileController,GetMessageRequestValidator])],m),r.GetMessageUseCase=m},79231:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetMessagesUseCase=void 0;const c=a(92937),u=a(75172),d=a(19663),p=a(94714),h=a(7071),m=a(7049),y=a(76881);class GetMessagesRequestValidator extends m.RuntimeValidator{constructor(){super()}}let g=class GetMessagesUseCase extends m.UseCase{constructor(t,r){super(r),this.messageController=t}async executeInternal(t){const r=GetMessagesUseCase.queryTranslator.parse(t.query),a=await this.messageController.getMessages(r);return u.Result.ok(y.MessageMapper.toMessageDTOList(a))}};g.queryTranslator=new c.QueryTranslator({whitelist:{[(0,p.nameof)((t=>t.createdBy))]:!0,[(0,p.nameof)((t=>t.createdByDevice))]:!0,[(0,p.nameof)((t=>t.createdAt))]:!0,[`${(0,p.nameof)((t=>t.recipients))}.${(0,p.nameof)((t=>t.address))}`]:!0,[`${(0,p.nameof)((t=>t.content))}.@type`]:!0,[`${(0,p.nameof)((t=>t.content))}.body`]:!0,[`${(0,p.nameof)((t=>t.content))}.subject`]:!0,[(0,p.nameof)((t=>t.attachments))]:!0,[(0,p.nameof)((t=>t.relationshipIds))]:!0,participant:!0},alias:{[(0,p.nameof)((t=>t.createdBy))]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.createdBy))}`,[(0,p.nameof)((t=>t.createdByDevice))]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.createdByDevice))}`,[(0,p.nameof)((t=>t.createdAt))]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.createdAt))}`,[`${(0,p.nameof)((t=>t.recipients))}.${(0,p.nameof)((t=>t.address))}`]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.recipients))}.${(0,p.nameof)((t=>t.address))}`,[`${(0,p.nameof)((t=>t.content))}.@type`]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.content))}.@type`,[`${(0,p.nameof)((t=>t.content))}.body`]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.content))}.body`,[`${(0,p.nameof)((t=>t.content))}.subject`]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.content))}.subject`,[(0,p.nameof)((t=>t.attachments))]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.attachments))}`},custom:{relationshipIds:(t,r)=>{t.relationshipIds={$contains:r}},participant:(t,r)=>{let a;if(Array.isArray(r)){if(0===r.length)return;a={};for(const t of r){const r=g.queryTranslator.parseString(t,!0);switch(r.field){case"$in":case"$nin":a[r.field]=a[r.field]||[],a[r.field].push(r.value);break;default:a[r.field]=r.value}}}else a=g.queryTranslator.parseStringVal(r);t.$or=[{[`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.createdBy))}`]:a},{[`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.recipients))}.${(0,p.nameof)((t=>t.address))}`]:a}]}}}),g=i([l(0,h.Inject),l(1,h.Inject),o("design:paramtypes",[d.MessageController,GetMessagesRequestValidator])],g),r.GetMessagesUseCase=g},76881:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.MessageMapper=void 0;const i=a(19663),o=a(7049),l=a(35076);r.MessageMapper=class MessageMapper{static toDownloadAttachmentResponse(t,r){if(!r.cache)throw o.RuntimeErrors.general.cacheEmpty(i.File,r.id.toString());return{content:t.buffer,filename:r.cache.filename?r.cache.filename:r.id.toString(),mimetype:r.cache.mimetype}}static toMessageWithAttachmentsDTO(t,r){if(!t.cache)throw o.RuntimeErrors.general.cacheEmpty(i.Message,t.id.toString());return{id:t.id.toString(),content:t.cache.content.toJSON(),createdBy:t.cache.createdBy.toString(),createdByDevice:t.cache.createdByDevice.toString(),recipients:t.cache.recipients.map((t=>this.toRecipient(t))),createdAt:t.cache.createdAt.toString(),relationshipIds:t.relationshipIds.map((t=>t.toString())),attachments:r.map((t=>l.FileMapper.toFileDTO(t)))}}static toMessageDTO(t){if(!t.cache)throw o.RuntimeErrors.general.cacheEmpty(i.Message,t.id.toString());return{id:t.id.toString(),content:t.cache.content.toJSON(),createdBy:t.cache.createdBy.toString(),createdByDevice:t.cache.createdByDevice.toString(),recipients:t.cache.recipients.map((t=>this.toRecipient(t))),relationshipIds:t.relationshipIds.map((t=>t.toString())),createdAt:t.cache.createdAt.toString(),attachments:t.cache.attachments.map((t=>t.toString()))}}static toMessageDTOList(t){return t.map((t=>this.toMessageDTO(t)))}static toRecipient(t){var r,a;return{address:t.address.toString(),receivedAt:null===(r=t.receivedAt)||void 0===r?void 0:r.toString(),receivedByDevice:null===(a=t.receivedByDevice)||void 0===a?void 0:a.toString()}}}},38400:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.SendMessageUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(42205),h=a(7049),m=a(76881);class SendMessageRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfIterable((t=>t.recipients)).isNotEmpty(),this.validateIfEachString((t=>t.recipients)).fulfills(h.AddressValidator.required()),this.validateIfAny((t=>t.content)).isNotNull(),this.validateIfEachString((t=>t.attachments)).fulfills(h.IdValidator.required(u.BackboneIds.file))}}let y=class SendMessageUseCase extends h.UseCase{constructor(t,r,a,i,o,l){super(l),this.messageController=t,this.fileController=r,this.accountController=a,this.identityController=i,this.eventBus=o}async executeInternal(t){const r=await this.transformAttachments(t.attachments);if(r.isError)return c.Result.fail(r.error);const a=await this.messageController.sendMessage({recipients:t.recipients.map((t=>u.CoreAddress.from(t))),content:t.content,attachments:r.value}),i=m.MessageMapper.toMessageDTO(a);return this.eventBus.publish(new p.MessageSentEvent(this.identityController.identity.address.toString(),i)),await this.accountController.syncDatawallet(),c.Result.ok(m.MessageMapper.toMessageDTO(a))}async transformAttachments(t){if(!t||0===t.length)return c.Result.ok([]);const r=[];for(const a of t){const t=await this.fileController.getFile(u.CoreId.from(a));if(!t)return c.Result.fail(h.RuntimeErrors.general.recordNotFound(u.File));r.push(t)}return c.Result.ok(r)}};y=i([l(0,d.Inject),l(1,d.Inject),l(2,d.Inject),l(3,d.Inject),l(4,d.Inject),l(5,d.Inject),o("design:paramtypes",[u.MessageController,u.FileController,u.AccountController,u.IdentityController,c.EventBus,SendMessageRequestValidator])],y),r.SendMessageUseCase=y},92290:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(64860),r),o(a(19558),r),o(a(40978),r),o(a(79231),r),o(a(76881),r),o(a(38400),r)},88580:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CreateOwnRelationshipTemplateUseCase=void 0;const c=a(75172),u=a(19663),d=a(99490),p=a(7071),h=a(7049),m=a(58434);class CreateOwnRelationshipTemplateRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIf((t=>t.expiresAt)).fulfills(h.DateValidator.required()),this.validateIf((t=>t.expiresAt)).fulfills((t=>d.DateTime.fromISO(t)>d.DateTime.utc())).withFailureMessage("'$propertyName' must be in the future."),this.validateIfAny((t=>t.content)).isNotNull(),this.validateIfNumber((t=>t.maxNumberOfRelationships)).isGreaterThanOrEqual(1).whenNotNull()}}let y=class CreateOwnRelationshipTemplateUseCase extends h.UseCase{constructor(t,r,a){super(a),this.templateController=t,this.accountController=r}async executeInternal(t){const r=await this.templateController.sendRelationshipTemplate({content:t.content,expiresAt:u.CoreDate.from(t.expiresAt),maxNumberOfRelationships:t.maxNumberOfRelationships});return await this.accountController.syncDatawallet(),c.Result.ok(m.RelationshipTemplateMapper.toRelationshipTemplateDTO(r))}};y=i([l(0,p.Inject),l(1,p.Inject),l(2,p.Inject),o("design:paramtypes",[u.RelationshipTemplateController,u.AccountController,CreateOwnRelationshipTemplateRequestValidator])],y),r.CreateOwnRelationshipTemplateUseCase=y},17255:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CreateTokenForOwnTemplateUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049),h=a(57121);class CreateTokenForOwnTemplateRequestValidator extends p.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.templateId)).fulfills(p.IdValidator.required(u.BackboneIds.relationshipTemplate)),this.validateIfString((t=>t.expiresAt)).fulfills(p.DateValidator.optional())}}let m=class CreateTokenForOwnTemplateUseCase extends p.UseCase{constructor(t,r,a,i){super(i),this.templateController=t,this.tokenController=r,this.accountController=a}async executeInternal(t){var r,a,i;const o=await this.templateController.getRelationshipTemplate(u.CoreId.from(t.templateId));if(!o)return c.Result.fail(p.RuntimeErrors.general.recordNotFound(u.RelationshipTemplate));if(!o.isOwn)return c.Result.fail(p.RuntimeErrors.relationshipTemplates.cannotCreateTokenForPeerTemplate());const l=await u.TokenContentRelationshipTemplate.from({templateId:o.id,secretKey:o.secretKey}),d=null===(r=t.ephemeral)||void 0===r||r,m=null!==(i=null===(a=o.cache)||void 0===a?void 0:a.expiresAt)&&void 0!==i?i:u.CoreDate.utc().add({days:12}),y=t.expiresAt?u.CoreDate.from(t.expiresAt):m,g=await this.tokenController.sendToken({content:l,expiresAt:y,ephemeral:d});return d||await this.accountController.syncDatawallet(),c.Result.ok(await h.TokenMapper.toTokenDTO(g,d))}};m=i([l(0,d.Inject),l(1,d.Inject),l(2,d.Inject),l(3,d.Inject),o("design:paramtypes",[u.RelationshipTemplateController,u.TokenController,u.AccountController,CreateTokenForOwnTemplateRequestValidator])],m),r.CreateTokenForOwnTemplateUseCase=m},13683:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CreateTokenQrCodeForOwnTemplateUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049);class CreateTokenQrCodeForOwnTemplateRequestValidator extends p.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.templateId)).fulfills(p.IdValidator.required(u.BackboneIds.relationshipTemplate)),this.validateIfString((t=>t.expiresAt)).fulfills(p.DateValidator.optional())}}let h=class CreateTokenQrCodeForOwnTemplateUseCase extends p.UseCase{constructor(t,r,a){super(a),this.templateController=t,this.tokenController=r}async executeInternal(t){var r,a;const i=await this.templateController.getRelationshipTemplate(u.CoreId.from(t.templateId));if(!i)return c.Result.fail(p.RuntimeErrors.general.recordNotFound(u.RelationshipTemplate));if(!i.isOwn)return c.Result.fail(p.RuntimeErrors.relationshipTemplates.cannotCreateTokenForPeerTemplate());const o=await u.TokenContentRelationshipTemplate.from({templateId:i.id,secretKey:i.secretKey}),l=null!==(a=null===(r=i.cache)||void 0===r?void 0:r.expiresAt)&&void 0!==a?a:u.CoreDate.utc().add({days:12}),d=t.expiresAt?u.CoreDate.from(t.expiresAt):l,h=await this.tokenController.sendToken({content:o,expiresAt:d,ephemeral:!0}),m=await p.QRCode.from(await h.truncate());return c.Result.ok({qrCodeBytes:m.asBase64()})}};h=i([l(0,d.Inject),l(1,d.Inject),l(2,d.Inject),o("design:paramtypes",[u.RelationshipTemplateController,u.TokenController,CreateTokenQrCodeForOwnTemplateRequestValidator])],h),r.CreateTokenQrCodeForOwnTemplateUseCase=h},72603:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetRelationshipTemplateUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049),h=a(58434);class GetRelationshipTemplateRequestValidator extends p.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.id)).fulfills(p.IdValidator.required(u.BackboneIds.relationshipTemplate))}}let m=class GetRelationshipTemplateUseCase extends p.UseCase{constructor(t,r){super(r),this.relationshipTemplateController=t}async executeInternal(t){const r=await this.relationshipTemplateController.getRelationshipTemplate(u.CoreId.from(t.id));return r?c.Result.ok(h.RelationshipTemplateMapper.toRelationshipTemplateDTO(r)):c.Result.fail(p.RuntimeErrors.general.recordNotFound(u.RelationshipTemplate))}};m=i([l(0,d.Inject),l(1,d.Inject),o("design:paramtypes",[u.RelationshipTemplateController,GetRelationshipTemplateRequestValidator])],m),r.GetRelationshipTemplateUseCase=m},1371:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetRelationshipTemplatesUseCase=void 0;const c=a(92937),u=a(75172),d=a(19663),p=a(94714),h=a(7071),m=a(7049),y=a(58434);let g=class GetRelationshipTemplatesUseCase extends m.UseCase{constructor(t,r){super(r),this.relationshipTemplateController=t}async executeInternal(t){const r=GetRelationshipTemplatesUseCase.queryTranslator.parse(t.query);t.ownerRestriction&&(r[(0,p.nameof)((t=>t.isOwn))]=t.ownerRestriction===m.OwnerRestriction.Own);const a=await this.relationshipTemplateController.getRelationshipTemplates(r);return u.Result.ok(y.RelationshipTemplateMapper.toRelationshipTemplateDTOList(a))}};g.queryTranslator=new c.QueryTranslator({whitelist:{[(0,p.nameof)((t=>t.isOwn))]:!0,[(0,p.nameof)((t=>t.createdAt))]:!0,[(0,p.nameof)((t=>t.expiresAt))]:!0,[(0,p.nameof)((t=>t.createdBy))]:!0,[(0,p.nameof)((t=>t.createdByDevice))]:!0,[(0,p.nameof)((t=>t.maxNumberOfRelationships))]:!0},alias:{[(0,p.nameof)((t=>t.isOwn))]:(0,p.nameof)((t=>t.isOwn)),[(0,p.nameof)((t=>t.createdAt))]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.createdAt))}`,[(0,p.nameof)((t=>t.expiresAt))]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.expiresAt))}`,[(0,p.nameof)((t=>t.createdBy))]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.createdBy))}`,[(0,p.nameof)((t=>t.createdByDevice))]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.createdByDevice))}`,[(0,p.nameof)((t=>t.maxNumberOfRelationships))]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.maxNumberOfRelationships))}`}}),g=i([l(0,h.Inject),l(1,h.Inject),o("design:paramtypes",[d.RelationshipTemplateController,m.RuntimeValidator])],g),r.GetRelationshipTemplatesUseCase=g},73186:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.LoadPeerRelationshipTemplateUseCase=void 0;const c=a(75172),u=a(82890),d=a(19663),p=a(7071),h=a(7049),m=a(58434);class LoadPeerRelationshipTemplateRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIf((t=>t)).fulfills((t=>this.isCreateRelationshipTemplateFromIdAndKeyRequest(t)||this.isCreateRelationshipTemplateFromTokenReferenceRequest(t))).withFailureCode(h.RuntimeErrors.general.invalidPayload().code).withFailureMessage(h.RuntimeErrors.general.invalidPayload().message),this.setupRulesForCreateRelationshipTemplateFromIdAndKeyRequest(),this.setupRulesForCreateRelationshipTemplateFromTokenReferenceRequest()}setupRulesForCreateRelationshipTemplateFromIdAndKeyRequest(){this.validateIfString((t=>t.id)).fulfills(h.IdValidator.required(d.BackboneIds.relationshipTemplate)).when(this.isCreateRelationshipTemplateFromIdAndKeyRequest),this.validateIfString((t=>t.secretKey)).isNotNull().when(this.isCreateRelationshipTemplateFromIdAndKeyRequest)}setupRulesForCreateRelationshipTemplateFromTokenReferenceRequest(){this.validateIfString((t=>t.reference)).isNotNull().when(this.isCreateRelationshipTemplateFromTokenReferenceRequest)}isCreateRelationshipTemplateFromIdAndKeyRequest(t){return!!t.id&&!!t.secretKey}isCreateRelationshipTemplateFromTokenReferenceRequest(t){return!!t.reference}}let y=class LoadPeerRelationshipTemplateUseCase extends h.UseCase{constructor(t,r,a,i){super(i),this.templateController=t,this.tokenController=r,this.accountController=a}async executeInternal(t){let r;if(t.id&&t.secretKey){const a=await u.CryptoSecretKey.fromBase64(t.secretKey);r=await this.loadTemplate(d.CoreId.from(t.id),a)}else{if(!t.reference)throw new Error("Invalid request format.");r=await this.createRelationshipTemplateFromTokenReferenceRequest(t.reference)}return await this.accountController.syncDatawallet(),r}async createRelationshipTemplateFromTokenReferenceRequest(t){const r=await this.tokenController.loadPeerTokenByTruncated(t,!0);if(!r.cache)throw h.RuntimeErrors.general.cacheEmpty(d.Token,r.id.toString());if(!(r.cache.content instanceof d.TokenContentRelationshipTemplate))return c.Result.fail(h.RuntimeErrors.general.invalidTokenContent());const a=r.cache.content;return await this.loadTemplate(a.templateId,a.secretKey)}async loadTemplate(t,r){const a=await this.templateController.loadPeerRelationshipTemplate(t,r);return c.Result.ok(m.RelationshipTemplateMapper.toRelationshipTemplateDTO(a))}};y=i([l(0,p.Inject),l(1,p.Inject),l(2,p.Inject),l(3,p.Inject),o("design:paramtypes",[d.RelationshipTemplateController,d.TokenController,d.AccountController,LoadPeerRelationshipTemplateRequestValidator])],y),r.LoadPeerRelationshipTemplateUseCase=y},58434:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.RelationshipTemplateMapper=void 0;const i=a(19663),o=a(7049);r.RelationshipTemplateMapper=class RelationshipTemplateMapper{static toRelationshipTemplateDTO(t){var r;if(!t.cache)throw o.RuntimeErrors.general.cacheEmpty(i.RelationshipTemplate,t.id.toString());return{id:t.id.toString(),isOwn:t.isOwn,createdBy:t.cache.createdBy.toString(),createdByDevice:t.cache.createdByDevice.toString(),createdAt:t.cache.createdAt.toString(),content:t.cache.content.toJSON(),expiresAt:null===(r=t.cache.expiresAt)||void 0===r?void 0:r.toString(),maxNumberOfRelationships:t.cache.maxNumberOfRelationships}}static toRelationshipTemplateDTOList(t){return t.map((t=>this.toRelationshipTemplateDTO(t)))}}},43084:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(88580),r),o(a(17255),r),o(a(13683),r),o(a(72603),r),o(a(1371),r),o(a(73186),r),o(a(58434),r)},63018:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.AcceptRelationshipChangeUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(42205),h=a(7049),m=a(94316);class AcceptRelationshipChangeRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.relationshipId)).fulfills(h.IdValidator.required(u.BackboneIds.relationship)),this.validateIfString((t=>t.changeId)).fulfills(h.IdValidator.required(u.BackboneIds.relationshipChange))}}let y=class AcceptRelationshipChangeUseCase extends h.UseCase{constructor(t,r,a,i,o){super(o),this.relationshipsController=t,this.accountController=r,this.identityController=a,this.eventBus=i}async executeInternal(t){const r=await this.relationshipsController.getRelationship(u.CoreId.from(t.relationshipId));if(!r)return c.Result.fail(h.RuntimeErrors.general.recordNotFound(u.Relationship));if(!r.cache)return c.Result.fail(h.RuntimeErrors.general.cacheEmpty(u.Relationship,r.id.toString()));const a=r.cache.changes.find((r=>r.id.toString()===t.changeId));if(!a)return c.Result.fail(h.RuntimeErrors.general.recordNotFound(u.RelationshipChange));const i=await this.relationshipsController.acceptChange(a,t.content),o=m.RelationshipMapper.toRelationshipDTO(i);return this.eventBus.publish(new p.RelationshipChangedEvent(this.identityController.identity.address.toString(),o)),await this.accountController.syncDatawallet(),c.Result.ok(o)}};y=i([l(0,d.Inject),l(1,d.Inject),l(2,d.Inject),l(3,d.Inject),l(4,d.Inject),o("design:paramtypes",[u.RelationshipsController,u.AccountController,u.IdentityController,c.EventBus,AcceptRelationshipChangeRequestValidator])],y),r.AcceptRelationshipChangeUseCase=y},83986:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CreateRelationshipUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(42205),h=a(7049),m=a(94316);class CreateRelationshipRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.templateId)).fulfills(h.IdValidator.required(u.BackboneIds.relationshipTemplate)),this.validateIf((t=>t.content)).isDefined()}}let y=class CreateRelationshipUseCase extends h.UseCase{constructor(t,r,a,i,o,l){super(l),this.relationshipsController=t,this.relationshipTemplateController=r,this.accountController=a,this.identityController=i,this.eventBus=o}async executeInternal(t){const r=await this.relationshipTemplateController.getRelationshipTemplate(u.CoreId.from(t.templateId));if(!r)return c.Result.fail(h.RuntimeErrors.general.recordNotFound(u.RelationshipTemplate));const a=await this.relationshipsController.sendRelationship({template:r,content:t.content}),i=m.RelationshipMapper.toRelationshipDTO(a);return this.eventBus.publish(new p.RelationshipChangedEvent(this.identityController.identity.address.toString(),i)),await this.accountController.syncDatawallet(),c.Result.ok(i)}};y=i([l(0,d.Inject),l(1,d.Inject),l(2,d.Inject),l(3,d.Inject),l(4,d.Inject),l(5,d.Inject),o("design:paramtypes",[u.RelationshipsController,u.RelationshipTemplateController,u.AccountController,u.IdentityController,c.EventBus,CreateRelationshipRequestValidator])],y),r.CreateRelationshipUseCase=y},57619:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CreateRelationshipChangeUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049);class CreateRelationshipChangeRequestValidator extends p.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.id)).fulfills(p.IdValidator.required(u.BackboneIds.relationship)),this.validateIf((t=>t.content)).isDefined()}}let h=class CreateRelationshipChangeUseCase extends p.UseCase{constructor(t,r,a){super(a),this.relationshipsController=t,this.accountController=r}async executeInternal(t){return c.Result.fail(p.RuntimeErrors.general.notImplemented())}};h=i([l(0,d.Inject),l(1,d.Inject),l(2,d.Inject),o("design:paramtypes",[u.RelationshipsController,u.AccountController,CreateRelationshipChangeRequestValidator])],h),r.CreateRelationshipChangeUseCase=h},59456:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetRelationshipUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049),h=a(94316);class GetRelationshipRequestValidator extends p.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.id)).fulfills(p.IdValidator.required(u.BackboneIds.relationship))}}let m=class GetRelationshipUseCase extends p.UseCase{constructor(t,r){super(r),this.relationshipsController=t}async executeInternal(t){const r=await this.relationshipsController.getRelationship(u.CoreId.from(t.id));return r?c.Result.ok(h.RelationshipMapper.toRelationshipDTO(r)):c.Result.fail(p.RuntimeErrors.general.recordNotFound(u.Relationship))}};m=i([l(0,d.Inject),l(1,d.Inject),o("design:paramtypes",[u.RelationshipsController,GetRelationshipRequestValidator])],m),r.GetRelationshipUseCase=m},90215:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetRelationshipByAddressUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049),h=a(94316);class GetRelationshipByAddressRequestValidator extends p.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.address)).fulfills(p.AddressValidator.required())}}let m=class GetRelationshipByAddressUseCase extends p.UseCase{constructor(t,r){super(r),this.relationshipsController=t}async executeInternal(t){const r=await this.relationshipsController.getRelationshipToIdentity(u.CoreAddress.from(t.address));return r?c.Result.ok(h.RelationshipMapper.toRelationshipDTO(r)):c.Result.fail(p.RuntimeErrors.general.recordNotFound(u.Relationship))}};m=i([l(0,d.Inject),l(1,d.Inject),o("design:paramtypes",[u.RelationshipsController,GetRelationshipByAddressRequestValidator])],m),r.GetRelationshipByAddressUseCase=m},73457:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetRelationshipsUseCase=void 0;const c=a(92937),u=a(75172),d=a(19663),p=a(94714),h=a(7071),m=a(7049),y=a(94316);let g=class GetRelationshipsUseCase extends m.UseCase{constructor(t,r){super(r),this.relationshipsController=t}async executeInternal(t){const r=GetRelationshipsUseCase.queryTranslator.parse(t.query),a=await this.relationshipsController.getRelationships(r);return u.Result.ok(y.RelationshipMapper.toRelationshipDTOList(a))}};g.queryTranslator=new c.QueryTranslator({whitelist:{[(0,p.nameof)((t=>t.lastMessageReceivedAt))]:!0,[(0,p.nameof)((t=>t.lastMessageSentAt))]:!0,[(0,p.nameof)((t=>t.peer))]:!0,[(0,p.nameof)((t=>t.status))]:!0,[`${(0,p.nameof)((t=>t.template))}.${(0,p.nameof)((t=>t.id))}`]:!0},alias:{[(0,p.nameof)((t=>t.lastMessageReceivedAt))]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.lastMessageReceivedAt))}`,[(0,p.nameof)((t=>t.lastMessageSentAt))]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.lastMessageSentAt))}`,[`${(0,p.nameof)((t=>t.template))}.${(0,p.nameof)((t=>t.id))}`]:`${(0,p.nameof)((t=>t.cache))}.${(0,p.nameof)((t=>t.template))}.${(0,p.nameof)((t=>t.id))}`,[(0,p.nameof)((t=>t.peer))]:(0,p.nameof)((t=>t.peer)),[(0,p.nameof)((t=>t.status))]:(0,p.nameof)((t=>t.status)),[(0,p.nameof)((t=>t.peer))]:`${(0,p.nameof)((t=>t.peer))}.${(0,p.nameof)((t=>t.address))}`}}),g=i([l(0,h.Inject),l(1,h.Inject),o("design:paramtypes",[d.RelationshipsController,m.RuntimeValidator])],g),r.GetRelationshipsUseCase=g},42214:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.RejectRelationshipChangeUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(42205),h=a(7049),m=a(94316);class RejectRelationshipChangeRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.relationshipId)).fulfills(h.IdValidator.required(u.BackboneIds.relationship)),this.validateIfString((t=>t.changeId)).fulfills(h.IdValidator.required(u.BackboneIds.relationshipChange))}}let y=class RejectRelationshipChangeUseCase extends h.UseCase{constructor(t,r,a,i,o){super(o),this.relationshipsController=t,this.accountController=r,this.identityController=a,this.eventBus=i}async executeInternal(t){const r=await this.relationshipsController.getRelationship(u.CoreId.from(t.relationshipId));if(!r)return c.Result.fail(h.RuntimeErrors.general.recordNotFound(u.Relationship));if(!r.cache)return c.Result.fail(h.RuntimeErrors.general.cacheEmpty(u.Relationship,r.id.toString()));const a=r.cache.changes.find((r=>r.id.toString()===t.changeId));if(!a)return c.Result.fail(h.RuntimeErrors.general.recordNotFound(u.RelationshipChange));const i=await this.relationshipsController.rejectChange(a,t.content),o=m.RelationshipMapper.toRelationshipDTO(i);return this.eventBus.publish(new p.RelationshipChangedEvent(this.identityController.identity.address.toString(),o)),await this.accountController.syncDatawallet(),c.Result.ok(o)}};y=i([l(0,d.Inject),l(1,d.Inject),l(2,d.Inject),l(3,d.Inject),l(4,d.Inject),o("design:paramtypes",[u.RelationshipsController,u.AccountController,u.IdentityController,c.EventBus,RejectRelationshipChangeRequestValidator])],y),r.RejectRelationshipChangeUseCase=y},94316:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.RelationshipMapper=void 0;const i=a(19663),o=a(7049),l=a(58434);r.RelationshipMapper=class RelationshipMapper{static toRelationshipDTO(t){var r,a;if(!t.cache)throw o.RuntimeErrors.general.cacheEmpty(i.Relationship,t.id.toString());return{id:t.id.toString(),template:l.RelationshipTemplateMapper.toRelationshipTemplateDTO(t.cache.template),status:t.status,peer:t.peer.address.toString(),peerIdentity:{address:t.peer.address.toString(),publicKey:t.peer.publicKey.toString(),realm:t.peer.realm},changes:t.cache.changes.map((t=>this.toRelationshipChangeDTO(t))),lastMessageSentAt:null===(r=t.cache.lastMessageSentAt)||void 0===r?void 0:r.toString(),lastMessageReceivedAt:null===(a=t.cache.lastMessageReceivedAt)||void 0===a?void 0:a.toString()}}static toRelationshipDTOList(t){return t.map((t=>this.toRelationshipDTO(t)))}static toRelationshipChangeRequestDTO(t){var r;return{createdBy:t.createdBy.toString(),createdByDevice:t.createdByDevice.toString(),createdAt:t.createdAt.toString(),content:null===(r=t.content)||void 0===r?void 0:r.toJSON()}}static toRelationshipChangeResponseDTO(t){var r;return{createdBy:t.createdBy.toString(),createdByDevice:t.createdByDevice.toString(),createdAt:t.createdAt.toString(),content:null===(r=t.content)||void 0===r?void 0:r.toJSON()}}static toRelationshipChangeDTO(t){return{id:t.id.toString(),request:this.toRelationshipChangeRequestDTO(t.request),status:t.status,type:t.type,response:t.response?this.toRelationshipChangeResponseDTO(t.response):void 0}}}},5261:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.RevokeRelationshipChangeUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(42205),h=a(7049),m=a(94316);class RevokeRelationshipChangeRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.relationshipId)).fulfills(h.IdValidator.required(u.BackboneIds.relationship)),this.validateIfString((t=>t.changeId)).fulfills(h.IdValidator.required(u.BackboneIds.relationshipChange))}}let y=class RevokeRelationshipChangeUseCase extends h.UseCase{constructor(t,r,a,i,o){super(o),this.relationshipsController=t,this.accountController=r,this.eventBus=a,this.identityController=i}async executeInternal(t){const r=await this.relationshipsController.getRelationship(u.CoreId.from(t.relationshipId));if(!r)return c.Result.fail(h.RuntimeErrors.general.recordNotFound(u.Relationship));if(!r.cache)return c.Result.fail(h.RuntimeErrors.general.cacheEmpty(u.Relationship,r.id.toString()));const a=r.cache.changes.find((r=>r.id.toString()===t.changeId));if(!a)return c.Result.fail(h.RuntimeErrors.general.recordNotFound(u.RelationshipChange));const i=await this.relationshipsController.revokeChange(a,t.content),o=m.RelationshipMapper.toRelationshipDTO(i);return this.eventBus.publish(new p.RelationshipChangedEvent(this.identityController.identity.address.toString(),o)),await this.accountController.syncDatawallet(),c.Result.ok(o)}};y=i([l(0,d.Inject),l(1,d.Inject),l(2,d.Inject),l(3,d.Inject),l(4,d.Inject),o("design:paramtypes",[u.RelationshipsController,u.AccountController,c.EventBus,u.IdentityController,RevokeRelationshipChangeRequestValidator])],y),r.RevokeRelationshipChangeUseCase=y},7831:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(63018),r),o(a(83986),r),o(a(57619),r),o(a(59456),r),o(a(90215),r),o(a(73457),r),o(a(42214),r),o(a(94316),r),o(a(5261),r)},10429:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CreateOwnTokenUseCase=void 0;const c=a(90194),u=a(75172),d=a(19663),p=a(99490),h=a(7071),m=a(7049),y=a(57121);class CreateOwnTokenRequestValidator extends m.RuntimeValidator{constructor(){super(),this.validateIfAny((t=>t.content)).isNotNull(),this.validateIf((t=>t.expiresAt)).isNotNull(),this.validateIf((t=>t.expiresAt)).fulfills(m.DateValidator.required()),this.validateIf((t=>t.expiresAt)).fulfills((t=>p.DateTime.fromISO(t)>p.DateTime.utc())).withFailureMessage("'$propertyName' must be in the future."),this.validateIfAny((t=>t.ephemeral)).isNotNull()}}let g=class CreateOwnTokenUseCase extends m.UseCase{constructor(t,r,a){super(a),this.tokenController=t,this.accountController=r}async executeInternal(t){let r;try{r=await c.SerializableAsync.from(t.content)}catch{throw m.RuntimeErrors.general.invalidTokenContent()}const a=await this.tokenController.sendToken({content:r,expiresAt:d.CoreDate.from(t.expiresAt),ephemeral:t.ephemeral});return t.ephemeral||await this.accountController.syncDatawallet(),u.Result.ok(await y.TokenMapper.toTokenDTO(a,t.ephemeral))}};g=i([l(0,h.Inject),l(1,h.Inject),l(2,h.Inject),o("design:paramtypes",[d.TokenController,d.AccountController,CreateOwnTokenRequestValidator])],g),r.CreateOwnTokenUseCase=g},37896:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetQRCodeForTokenUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049);class GetQRCodeForTokenRequestValidator extends p.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.id)).fulfills(p.IdValidator.required(u.BackboneIds.token))}}let h=class GetQRCodeForTokenUseCase extends p.UseCase{constructor(t,r){super(r),this.tokenController=t}async executeInternal(t){const r=await this.tokenController.getToken(u.CoreId.from(t.id));if(!r)return c.Result.fail(p.RuntimeErrors.general.recordNotFound(u.Token));const a=await p.QRCode.from(await r.truncate());return c.Result.ok({qrCodeBytes:a.asBase64()})}};h=i([l(0,d.Inject),l(1,d.Inject),o("design:paramtypes",[u.TokenController,GetQRCodeForTokenRequestValidator])],h),r.GetQRCodeForTokenUseCase=h},50858:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetTokenUseCase=void 0;const c=a(75172),u=a(19663),d=a(7071),p=a(7049),h=a(57121);class GetTokenRequestValidator extends p.RuntimeValidator{constructor(){super(),this.validateIfString((t=>t.id)).fulfills(p.IdValidator.required(u.BackboneIds.token))}}let m=class GetTokenUseCase extends p.UseCase{constructor(t,r){super(r),this.tokenController=t}async executeInternal(t){const r=await this.tokenController.getToken(u.CoreId.from(t.id));return r?c.Result.ok(await h.TokenMapper.toTokenDTO(r,!1)):c.Result.fail(p.RuntimeErrors.general.recordNotFound("Token"))}};m=i([l(0,d.Inject),l(1,d.Inject),o("design:paramtypes",[u.TokenController,GetTokenRequestValidator])],m),r.GetTokenUseCase=m},82093:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.GetTokensUseCase=void 0;const c=a(92937),u=a(75172),d=a(19663),p=a(94714),h=a(7071),m=a(7049),y=a(57121);let g=class GetTokensUseCase extends m.UseCase{constructor(t,r){super(r),this.tokenController=t}async executeInternal(t){const r=GetTokensUseCase.queryTranslator.parse(t.query);t.ownerRestriction&&(r[(0,p.nameof)((t=>t.isOwn))]=t.ownerRestriction===m.OwnerRestriction.Own);const a=await this.tokenController.getTokens(r);return u.Result.ok(await y.TokenMapper.toTokenDTOList(a,!1))}};g.queryTranslator=new c.QueryTranslator({whitelist:{[(0,p.nameof)((t=>t.createdAt))]:!0,[(0,p.nameof)((t=>t.createdBy))]:!0,[(0,p.nameof)((t=>t.createdByDevice))]:!0,[(0,p.nameof)((t=>t.expiresAt))]:!0},alias:{[(0,p.nameof)((t=>t.createdAt))]:`${(0,p.nameof)((t=>t.cache))}.${[(0,p.nameof)((t=>t.createdAt))]}`,[(0,p.nameof)((t=>t.createdBy))]:`${(0,p.nameof)((t=>t.cache))}.${[(0,p.nameof)((t=>t.createdBy))]}`,[(0,p.nameof)((t=>t.createdByDevice))]:`${(0,p.nameof)((t=>t.cache))}.${[(0,p.nameof)((t=>t.createdByDevice))]}`,[(0,p.nameof)((t=>t.expiresAt))]:`${(0,p.nameof)((t=>t.cache))}.${[(0,p.nameof)((t=>t.expiresAt))]}`}}),g=i([l(0,h.Inject),l(1,h.Inject),o("design:paramtypes",[d.TokenController,m.RuntimeValidator])],g),r.GetTokensUseCase=g},28442:function(t,r,a){"use strict";var i=this&&this.__decorate||function(t,r,a,i){var o,l=arguments.length,c=l<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,r,a,i);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(c=(l<3?o(c):l>3?o(r,a,c):o(r,a))||c);return l>3&&c&&Object.defineProperty(r,a,c),c},o=this&&this.__metadata||function(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)},l=this&&this.__param||function(t,r){return function(a,i){r(a,i,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.LoadPeerTokenUseCase=void 0;const c=a(75172),u=a(82890),d=a(19663),p=a(7071),h=a(7049),m=a(57121);class LoadPeerTokenRequestValidator extends h.RuntimeValidator{constructor(){super(),this.validateIf((t=>t)).fulfills((t=>isCreateTokenFromIdAndKeyRequest(t)||isCreateTokenFromReferenceRequest(t))).withFailureCode(h.RuntimeErrors.general.invalidPayload().code).withFailureMessage(h.RuntimeErrors.general.invalidPayload().message),this.setupRulesForCreateTokenFromReferenceRequest(),this.setupRulesForCreateTokenFromIdAndKeyRequest(),this.validateIfAny((t=>t.ephemeral)).isNotNull()}setupRulesForCreateTokenFromReferenceRequest(){this.validateIfString((t=>t.reference)).isNotNull().when(isCreateTokenFromReferenceRequest)}setupRulesForCreateTokenFromIdAndKeyRequest(){this.validateIfString((t=>t.id)).fulfills(h.IdValidator.required(d.BackboneIds.token)).when(isCreateTokenFromIdAndKeyRequest),this.validateIfString((t=>t.secretKey)).isNotNull().when(isCreateTokenFromIdAndKeyRequest)}}function isCreateTokenFromReferenceRequest(t){return!!t.reference}function isCreateTokenFromIdAndKeyRequest(t){return!!t.id&&!!t.secretKey}let y=class LoadPeerTokenUseCase extends h.UseCase{constructor(t,r,a){super(a),this.tokenController=t,this.accountController=r}async executeInternal(t){let r;if(t.id&&t.secretKey){const a=await u.CryptoSecretKey.fromBase64(t.secretKey);r=await this.tokenController.loadPeerToken(d.CoreId.from(t.id),a,t.ephemeral)}else{if(!t.reference)return c.Result.fail(h.RuntimeErrors.general.invalidPayload());r=await this.tokenController.loadPeerTokenByTruncated(t.reference,t.ephemeral)}return t.ephemeral||await this.accountController.syncDatawallet(),c.Result.ok(await m.TokenMapper.toTokenDTO(r,t.ephemeral))}};y=i([l(0,p.Inject),l(1,p.Inject),l(2,p.Inject),o("design:paramtypes",[d.TokenController,d.AccountController,LoadPeerTokenRequestValidator])],y),r.LoadPeerTokenUseCase=y},57121:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.TokenMapper=void 0;const i=a(19663),o=a(7049);class TokenMapper{static async toTokenDTO(t,r){if(!t.cache)throw o.RuntimeErrors.general.cacheEmpty(i.Token,t.id.toString());const a=await t.toTokenReference();return{id:t.id.toString(),createdBy:t.cache.createdBy.toString(),createdByDevice:t.cache.createdByDevice.toString(),content:t.cache.content.toJSON(),createdAt:t.cache.createdAt.toString(),expiresAt:t.cache.expiresAt.toString(),secretKey:t.secretKey.toBase64(),truncatedReference:a.truncate(),isEphemeral:r}}static async toTokenDTOList(t,r){return await Promise.all(t.map((t=>TokenMapper.toTokenDTO(t,r))))}}r.TokenMapper=TokenMapper},25631:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(10429),r),o(a(37896),r),o(a(50858),r),o(a(82093),r),o(a(28442),r),o(a(57121),r)},79126:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.QueryTranslator=void 0;class QueryTranslator{static defaultKeyRegex=/^[A-z_@][A-z@0-9-_]*(\.[A-z_@][A-z@0-9-_]*)*$/;static defaultValRegex=void 0;static defaultArrRegex=/^[a-zæøå0-9-_.]+(\[])?$/i;ops;alias;blacklist;whitelist;custom;string;keyRegex;valRegex;arrRegex;constructor(t={}){this.ops=t.ops??["!","^","$","~",">","<","$in"],this.alias=t.alias??{},this.blacklist=t.blacklist??{},this.whitelist=t.whitelist??{},this.custom=t.custom??{},t.string=t.string??{},this.string=t.string,this.string.toBoolean="boolean"!=typeof t.string.toBoolean||t.string.toBoolean,this.string.toNumber="boolean"!=typeof t.string.toNumber||t.string.toNumber,this.keyRegex=t.keyRegex??QueryTranslator.defaultKeyRegex,this.valRegex=t.valRegex??QueryTranslator.defaultValRegex,this.arrRegex=t.arrRegex??QueryTranslator.defaultArrRegex}static setDefaultKeyRegex(t){QueryTranslator.defaultKeyRegex=t}static setDefaultValRegex(t){QueryTranslator.defaultValRegex=t}static setDefaultArrRegex(t){QueryTranslator.defaultArrRegex=t}parseString(t,r){let a=t[0]||"";const i="="===t[1];let o=t.substr(i?2:1)||"";const l=this.parseStringVal(o),c={op:a,org:o,value:l};switch(a){case"!":r?c.field="$nin":""===o?(c.field="$exists",c.value=!1):c.field="$ne";break;case">":c.field=i?"$gte":"$gt";break;case"<":c.field=i?"$lte":"$lt";break;case"^":case"$":case"~":switch(c.field="$regex",c.options="i",c.value=this.valRegex?o.replace(this.valRegex,""):c.value.toString(),a){case"^":c.value=`^${l}`;break;case"$":c.value=`${l}$`}break;default:c.org=o=a+o,c.op=a="",c.value=this.parseStringVal(o),r?c.field="$in":""===o?(c.field="$exists",c.value=!0):c.field="$eq"}return c.parsed={},c.parsed[c.field]=c.value,c.options&&(c.parsed.$options=c.options),c}parseStringVal(t){return!(!this.string.toBoolean||"true"!==t.toLowerCase())||(!this.string.toBoolean||"false"!==t.toLowerCase())&&(this.string.toNumber&&!isNaN(parseInt(t,10))&&+t-+t+1>=0?parseFloat(t):t)}parse(t){if(!t)return{};const r={};for(let a of Object.keys(t)){const i=t[a];if(Array.isArray(i)&&(a=a.replace(/\[]$/,"")),(!Object.keys(this.whitelist).length||this.whitelist[a])&&!this.blacklist[a]&&(this.alias[a]&&(a=this.alias[a]),("string"!=typeof i||this.keyRegex.test(a))&&(!Array.isArray(i)||this.arrRegex.test(a))))if("function"!=typeof this.custom[a])if(Array.isArray(i)){if(this.ops.includes("$in")&&i.length>0){r[a]={};for(const t of i)if(this.ops.includes(t[0])){const i=this.parseString(t,!0);switch(i.field){case"$in":case"$nin":r[a][i.field]=r[a][i.field]||[],r[a][i.field].push(i.value);break;case"$regex":r[a].$regex=i.value,r[a].$options=i.options;break;default:r[a][i.field]=i.value}}else r[a].$in=r[a].$in||[],r[a].$in.push(this.parseStringVal(t))}}else"string"==typeof i&&(i?this.ops.includes(i[0])?r[a]=this.parseString(i).parsed:r[a]=this.parseStringVal(i):r[a]={$exists:!0});else this.custom[a].apply(null,[r,i])}return r}}r.QueryTranslator=QueryTranslator},92937:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.QueryTranslator=void 0;var i=a(79126);Object.defineProperty(r,"QueryTranslator",{enumerable:!0,get:function(){return i.QueryTranslator}})},71174:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},29159:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.getEventNamespaceFromObject=r.EventBus=void 0;r.EventBus=class EventBus{},r.getEventNamespaceFromObject=function getEventNamespaceFromObject(t){return t.namespace}},95970:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.SubscriptionTargetInfo=void 0;class SubscriptionTargetInfo{namespace;constructor(t){this.namespace=t}static from(t){return t instanceof Function?new ConstructorSubscriptionTargetInfo(t):new NamespaceSubscriptionTargetInfo(t)}}r.SubscriptionTargetInfo=SubscriptionTargetInfo;class ConstructorSubscriptionTargetInfo extends SubscriptionTargetInfo{constructorFunction;constructor(t){super(function getEventNamespaceFromClass(t){return t.namespace}(t)),this.constructorFunction=t}isCompatibleWith(t){return t instanceof this.constructorFunction}}class NamespaceSubscriptionTargetInfo extends SubscriptionTargetInfo{constructor(t){super(t)}isCompatibleWith(t){return!0}}},69729:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.EventEmitter2EventBus=void 0;const i=a(56387);a(28660);const o=a(29159),l=a(95970);r.EventEmitter2EventBus=class EventEmitter2EventBus{emitter;wrappers=new Map;nextId=0;constructor(){this.emitter=new i.EventEmitter2({wildcard:!0,maxListeners:50,verboseMemoryLeak:!0})}subscribe(t,r){return this.registerHandler(t,r)}subscribeOnce(t,r){return this.registerHandler(t,r,!0)}unsubscribe(t,r){return this.unregisterHandler(t,r)}registerHandler(t,r,a=!1){const i=l.SubscriptionTargetInfo.from(t),o=this.nextId++,handlerWrapper=l=>{i.isCompatibleWith(l)&&(r(l),a&&this.unsubscribe(t,o))};return this.wrappers.set(o,handlerWrapper),this.emitter.on(i.namespace,handlerWrapper),o}unregisterHandler(t,r){const a=l.SubscriptionTargetInfo.from(t),i=this.wrappers.get(r);return!!i&&(this.emitter.off(a.namespace,i),this.wrappers.delete(r),!0)}publish(t){const r=(0,o.getEventNamespaceFromObject)(t);if(!r)throw Error("The event needs a namespace. Use the EventNamespace-decorator in order to define a namespace for a event.");this.emitter.emit(r,t)}}},9256:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(29159),r),o(a(69729),r)},35917:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.DataEvent=void 0;const i=a(28267);class DataEvent extends i.Event{data;constructor(t,r){super(t),this.data=r}}r.DataEvent=DataEvent},28267:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.Event=void 0;r.Event=class Event{namespace;constructor(t){this.namespace=t}}},42636:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(35917),r),o(a(28267),r)},75172:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(9256),r),o(a(42636),r),o(a(9855),r),o(a(81809),r),o(a(44569),r),o(a(71174),r),o(a(17226),r),o(a(77374),r)},9855:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.log=void 0,r.log=function log(t,r,a){const i=a.value;return a.value=function(...t){const a=t.map((t=>JSON.stringify(t))).join();try{const o=i.apply(this,t),l=JSON.stringify(o);return console.log(`Call: ${r}(${a}) => ${l}`),o}catch(t){throw console.log(t),t}},a}},81809:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.measureExcecutionTime=void 0,r.measureExcecutionTime=function measureExcecutionTime(t,r,a){const i=a.value;return a.value=async function(...t){const r=Date.now(),a=await i.apply(this,t),o=Date.now();return console.info(`Execution time: ${o-r}ms`),a},a}},44569:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.randomString=void 0,r.randomString=function randomString(t,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"){let a="";const i=r.length;for(let o=0;o<t;o++)a+=r.charAt(Math.floor(Math.random()*i));return a}},77807:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.ApplicationError=void 0;class ApplicationError extends Error{code;data;constructor(t,r,a){super(r),this.code=t,this.data=a}equals(t){return this.code===t.code}}r.ApplicationError=ApplicationError},19278:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.Result=void 0;class Result{_isSuccess;_error;_value;constructor(t,r,a){if(t&&a)throw new Error("InvalidOperation: A result cannot be successful and contain an error");if(!t&&!a)throw new Error("InvalidOperation: A failing result needs to contain an error");if(void 0!==r&&!t)throw new Error("InvalidOperation: A value is only useful in case of a success.");this._value=r,this._isSuccess=t,this._error=a}get isSuccess(){return this._isSuccess}get isError(){return!this._isSuccess}get error(){return this._error}get value(){if(!this.isSuccess)throw new Error("Can't get the value of an error result. Use 'error' instead.");return this._value}static ok(t){return new Result(!0,t)}static fail(t){return new Result(!1,void 0,t)}}r.Result=Result},17226:function(t,r,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,a,i){void 0===i&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return r[a]}})}:function(t,r,a,i){void 0===i&&(i=a),t[i]=r[a]}),o=this&&this.__exportStar||function(t,r){for(var a in t)"default"===a||Object.prototype.hasOwnProperty.call(r,a)||i(r,t,a)};Object.defineProperty(r,"__esModule",{value:!0}),o(a(77807),r),o(a(19278),r)},77374:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.sleep=void 0,r.sleep=function sleep(t){return new Promise((r=>{setTimeout(r,t)}))}},33351:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});const i=a(1581),o=a(93487),l=a(57023),c=a(74815),u=a(4181),d=a(22141),p="errorMessage",h=new i.Name("emUsed"),m={required:"missingProperty",dependencies:"property",dependentRequired:"property"},y=/\$\{[^}]+\}/,g=/\$\{([^}]+)\}/g,v=/^""\s*\+\s*|\s*\+\s*""$/g;function errorMessage(t){return{keyword:p,schemaType:["string","object"],post:!0,code(r){const{gen:a,data:b,schema:R,schemaValue:C,it:I}=r;if(!1===I.createErrors)return;const w=R,S=o.strConcat(d.default.instancePath,I.errorPath);function matchKeywordError(t,r){return o.and(i._`${t}.keyword !== ${p}`,i._`!${t}.${h}`,i._`${t}.instancePath === ${S}`,i._`${t}.keyword in ${r}`,i._`${t}.schemaPath.indexOf(${I.errSchemaPath}) === 0`,i._`/^\\/[^\\/]*$/.test(${t}.schemaPath.slice(${I.errSchemaPath.length}))`)}function getTemplatesCode(t,r){const i=[];for(const a in t){const t=r[a];y.test(t)&&i.push([a,templateFunc(t)])}return a.object(...i)}function templateExpr(t){return y.test(t)?new l._Code(l.safeStringify(t).replace(g,((t,r)=>`" + JSON.stringify(${c.getData(r,I)}) + "`)).replace(v,"")):i.stringify(t)}function templateFunc(t){return i._`function(){return ${templateExpr(t)}}`}a.if(i._`${d.default.errors} > 0`,(()=>{if("object"==typeof w){const[l,c]=function keywordErrorsConfig(t){let r,a;for(const i in t){if("properties"===i||"items"===i)continue;const o=t[i];if("object"==typeof o){r||(r={});const t=r[i]={};for(const r in o)t[r]=[]}else a||(a={}),a[i]=[]}return[r,a]}(w);c&&function processKeywordErrors(o){const l=a.const("emErrors",i.stringify(o)),c=a.const("templates",getTemplatesCode(o,R));a.forOf("err",d.default.vErrors,(t=>a.if(matchKeywordError(t,l),(()=>a.code(i._`${l}[${t}.keyword].push(${t})`).assign(i._`${t}.${h}`,!0)))));const{singleError:p}=t;if(p){const t=a.let("message",i._`""`),o=a.let("paramsErrors",i._`[]`);loopErrors((r=>{a.if(t,(()=>a.code(i._`${t} += ${"string"==typeof p?p:";"}`))),a.code(i._`${t} += ${errMessage(r)}`),a.assign(o,i._`${o}.concat(${l}[${r}])`)})),u.reportError(r,{message:t,params:i._`{errors: ${o}}`})}else loopErrors((t=>u.reportError(r,{message:errMessage(t),params:i._`{errors: ${l}[${t}]}`})));function loopErrors(t){a.forIn("key",l,(r=>a.if(i._`${l}[${r}].length`,(()=>t(r)))))}function errMessage(t){return i._`${t} in ${c} ? ${c}[${t}]() : ${C}[${t}]`}}(c),l&&function processKeywordPropErrors(t){const o=a.const("emErrors",i.stringify(t)),l=[];for(const r in t)l.push([r,getTemplatesCode(t[r],R[r])]);const c=a.const("templates",a.object(...l)),p=a.scopeValue("obj",{ref:m,code:i.stringify(m)}),y=a.let("emPropParams"),g=a.let("emParamsErrors");a.forOf("err",d.default.vErrors,(t=>a.if(matchKeywordError(t,o),(()=>{a.assign(y,i._`${p}[${t}.keyword]`),a.assign(g,i._`${o}[${t}.keyword][${t}.params[${y}]]`),a.if(g,(()=>a.code(i._`${g}.push(${t})`).assign(i._`${t}.${h}`,!0)))})))),a.forIn("key",o,(t=>a.forIn("keyProp",i._`${o}[${t}]`,(l=>{a.assign(g,i._`${o}[${t}][${l}]`),a.if(i._`${g}.length`,(()=>{const o=a.const("tmpl",i._`${c}[${t}] && ${c}[${t}][${l}]`);u.reportError(r,{message:i._`${o} ? ${o}() : ${C}[${t}][${l}]`,params:i._`{errors: ${g}}`})}))}))))}(l),function processChildErrors(t){const{props:l,items:c}=t;if(!l&&!c)return;const m=i._`typeof ${b} == "object"`,y=i._`Array.isArray(${b})`,g=a.let("emErrors");let v,I;const w=a.let("templates");l&&c?(v=a.let("emChildKwd"),a.if(m),a.if(y,(()=>{init(c,R.items),a.assign(v,i.str`items`)}),(()=>{init(l,R.properties),a.assign(v,i.str`properties`)})),I=i._`[${v}]`):c?(a.if(y),init(c,R.items),I=i._`.items`):l&&(a.if(o.and(m,o.not(y))),init(l,R.properties),I=i._`.properties`);function init(t,r){a.assign(g,i.stringify(t)),a.assign(w,getTemplatesCode(t,r))}a.forOf("err",d.default.vErrors,(t=>function ifMatchesChildError(t,r,l){a.if(o.and(i._`${t}.keyword !== ${p}`,i._`!${t}.${h}`,i._`${t}.instancePath.indexOf(${S}) === 0`),(()=>{const o=a.scopeValue("pattern",{ref:/^\/([^/]*)(?:\/|$)/,code:i._`new RegExp("^\\\/([^/]*)(?:\\\/|$)")`}),c=a.const("emMatches",i._`${o}.exec(${t}.instancePath.slice(${S}.length))`),u=a.const("emChild",i._`${c} && ${c}[1].replace(/~1/g, "/").replace(/~0/g, "~")`);a.if(i._`${u} !== undefined && ${u} in ${r}`,(()=>l(u)))}))}(t,g,(r=>a.code(i._`${g}[${r}].push(${t})`).assign(i._`${t}.${h}`,!0))))),a.forIn("key",g,(t=>a.if(i._`${g}[${t}].length`,(()=>{u.reportError(r,{message:i._`${t} in ${w} ? ${w}[${t}]() : ${C}${I}[${t}]`,params:i._`{errors: ${g}[${t}]}`}),a.assign(i._`${d.default.vErrors}[${d.default.errors}-1].instancePath`,i._`${S} + "/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`)})))),a.endIf()}(function childErrorsConfig({properties:t,items:r}){const a={};if(t){a.props={};for(const r in t)a.props[r]=[]}if(r){a.items={};for(let t=0;t<r.length;t++)a.items[t]=[]}return a}(w))}const l="string"==typeof w?w:w._;l&&function processAllErrors(t){const l=a.const("emErrs",i._`[]`);a.forOf("err",d.default.vErrors,(t=>a.if(function matchAnyError(t){return o.and(i._`${t}.keyword !== ${p}`,i._`!${t}.${h}`,o.or(i._`${t}.instancePath === ${S}`,o.and(i._`${t}.instancePath.indexOf(${S}) === 0`,i._`${t}.instancePath[${S}.length] === "/"`)),i._`${t}.schemaPath.indexOf(${I.errSchemaPath}) === 0`,i._`${t}.schemaPath[${I.errSchemaPath}.length] === "/"`)}(t),(()=>a.code(i._`${l}.push(${t})`).assign(i._`${t}.${h}`,!0))))),a.if(i._`${l}.length`,(()=>u.reportError(r,{message:templateExpr(t),params:i._`{errors: ${l}}`})))}(l),t.keepErrors||function removeUsedErrors(){const t=a.const("emErrs",i._`[]`);a.forOf("err",d.default.vErrors,(r=>a.if(i._`!${r}.${h}`,(()=>a.code(i._`${t}.push(${r})`))))),a.assign(d.default.vErrors,t).assign(d.default.errors,i._`${t}.length`)}()}))},metaSchema:{anyOf:[{type:"string"},{type:"object",properties:{properties:{$ref:"#/$defs/stringMap"},items:{$ref:"#/$defs/stringList"},required:{$ref:"#/$defs/stringOrMap"},dependencies:{$ref:"#/$defs/stringOrMap"}},additionalProperties:{type:"string"}}],$defs:{stringMap:{type:"object",additionalProperties:{type:"string"}},stringOrMap:{anyOf:[{type:"string"},{$ref:"#/$defs/stringMap"}]},stringList:{type:"array",items:{type:"string"}}}}}}const ajvErrors=(t,r={})=>{if(!t.opts.allErrors)throw new Error("ajv-errors: Ajv option allErrors must be true");if(t.opts.jsPropertySyntax)throw new Error("ajv-errors: ajv option jsPropertySyntax is not supported");return t.addKeyword(errorMessage(r))};r.default=ajvErrors,t.exports=ajvErrors,t.exports.default=ajvErrors},16870:(t,r)=>{"use strict";function fmtDef(t,r){return{validate:t,compare:r}}Object.defineProperty(r,"__esModule",{value:!0}),r.formatNames=r.fastFormats=r.fullFormats=void 0,r.fullFormats={date:fmtDef(date,compareDate),time:fmtDef(time,compareTime),"date-time":fmtDef((function date_time(t){const r=t.split(l);return 2===r.length&&date(r[0])&&time(r[1],!0)}),compareDateTime),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:function uri(t){return c.test(t)&&u.test(t)},"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:function regex(t){if(p.test(t))return!1;try{return new RegExp(t),!0}catch(t){return!1}},uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:function byte(t){return d.lastIndex=0,d.test(t)},int32:{type:"number",validate:function validateInt32(t){return Number.isInteger(t)&&t<=2147483647&&t>=-2147483648}},int64:{type:"number",validate:function validateInt64(t){return Number.isInteger(t)}},float:{type:"number",validate:validateNumber},double:{type:"number",validate:validateNumber},password:!0,binary:!0},r.fastFormats={...r.fullFormats,date:fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,compareDate),time:fmtDef(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,compareTime),"date-time":fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,compareDateTime),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},r.formatNames=Object.keys(r.fullFormats);const a=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i=[0,31,28,31,30,31,30,31,31,30,31,30,31];function date(t){const r=a.exec(t);if(!r)return!1;const o=+r[1],l=+r[2],c=+r[3];return l>=1&&l<=12&&c>=1&&c<=(2===l&&function isLeapYear(t){return t%4==0&&(t%100!=0||t%400==0)}(o)?29:i[l])}function compareDate(t,r){if(t&&r)return t>r?1:t<r?-1:0}const o=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i;function time(t,r){const a=o.exec(t);if(!a)return!1;const i=+a[1],l=+a[2],c=+a[3],u=a[5];return(i<=23&&l<=59&&c<=59||23===i&&59===l&&60===c)&&(!r||""!==u)}function compareTime(t,r){if(!t||!r)return;const a=o.exec(t),i=o.exec(r);return a&&i?(t=a[1]+a[2]+a[3]+(a[4]||""))>(r=i[1]+i[2]+i[3]+(i[4]||""))?1:t<r?-1:0:void 0}const l=/t|\s/i;function compareDateTime(t,r){if(!t||!r)return;const[a,i]=t.split(l),[o,c]=r.split(l),u=compareDate(a,o);return void 0!==u?u||compareTime(i,c):void 0}const c=/\/|:/,u=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;const d=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function validateNumber(){return!0}const p=/[^\\]\\Z/},5477:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});const i=a(16870),o=a(57963),l=a(93487),c=new l.Name("fullFormats"),u=new l.Name("fastFormats"),formatsPlugin=(t,r={keywords:!0})=>{if(Array.isArray(r))return addFormats(t,r,i.fullFormats,c),t;const[a,l]="fast"===r.mode?[i.fastFormats,u]:[i.fullFormats,c];return addFormats(t,r.formats||i.formatNames,a,l),r.keywords&&o.default(t),t};function addFormats(t,r,a,i){var o,c;null!==(o=(c=t.opts.code).formats)&&void 0!==o||(c.formats=l._`require("ajv-formats/dist/formats").${i}`);for(const i of r)t.addFormat(i,a[i])}formatsPlugin.get=(t,r="full")=>{const a=("fast"===r?i.fastFormats:i.fullFormats)[t];if(!a)throw new Error(`Unknown format "${t}"`);return a},t.exports=r=formatsPlugin,Object.defineProperty(r,"__esModule",{value:!0}),r.default=formatsPlugin},57963:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.formatLimitDefinition=void 0;const i=a(1581),o=a(93487),l=o.operators,c={formatMaximum:{okStr:"<=",ok:l.LTE,fail:l.GT},formatMinimum:{okStr:">=",ok:l.GTE,fail:l.LT},formatExclusiveMaximum:{okStr:"<",ok:l.LT,fail:l.GTE},formatExclusiveMinimum:{okStr:">",ok:l.GT,fail:l.LTE}},u={message:({keyword:t,schemaCode:r})=>o.str`should be ${c[t].okStr} ${r}`,params:({keyword:t,schemaCode:r})=>o._`{comparison: ${c[t].okStr}, limit: ${r}}`};r.formatLimitDefinition={keyword:Object.keys(c),type:"string",schemaType:"string",$data:!0,error:u,code(t){const{gen:r,data:a,schemaCode:l,keyword:u,it:d}=t,{opts:p,self:h}=d;if(!p.validateFormats)return;const m=new i.KeywordCxt(d,h.RULES.all.format.definition,"format");function compareCode(t){return o._`${t}.compare(${a}, ${l}) ${c[u].fail} 0`}m.$data?function validate$DataFormat(){const a=r.scopeValue("formats",{ref:h.formats,code:p.code.formats}),i=r.const("fmt",o._`${a}[${m.schemaCode}]`);t.fail$data(o.or(o._`typeof ${i} != "object"`,o._`${i} instanceof RegExp`,o._`typeof ${i}.compare != "function"`,compareCode(i)))}():function validateFormat(){const a=m.schema,i=h.formats[a];if(!i||!0===i)return;if("object"!=typeof i||i instanceof RegExp||"function"!=typeof i.compare)throw new Error(`"${u}": format "${a}" does not define "compare" function`);const l=r.scopeValue("formats",{key:a,ref:i,code:p.code.formats?o._`${p.code.formats}${o.getProperty(a)}`:void 0});t.fail$data(compareCode(l))}()},dependencies:["format"]};r.default=t=>(t.addKeyword(r.formatLimitDefinition),t)},1581:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.CodeGen=r.Name=r.nil=r.stringify=r.str=r._=r.KeywordCxt=void 0;const i=a(27159),o=a(93924),l=a(1240),c=a(98),u=["/properties"],d="http://json-schema.org/draft-07/schema";class Ajv extends i.default{_addVocabularies(){super._addVocabularies(),o.default.forEach((t=>this.addVocabulary(t))),this.opts.discriminator&&this.addKeyword(l.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const t=this.opts.$data?this.$dataMetaSchema(c,u):c;this.addMetaSchema(t,d,!1),this.refs["http://json-schema.org/schema"]=d}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(d)?d:void 0)}}t.exports=r=Ajv,Object.defineProperty(r,"__esModule",{value:!0}),r.default=Ajv;var p=a(74815);Object.defineProperty(r,"KeywordCxt",{enumerable:!0,get:function(){return p.KeywordCxt}});var h=a(93487);Object.defineProperty(r,"_",{enumerable:!0,get:function(){return h._}}),Object.defineProperty(r,"str",{enumerable:!0,get:function(){return h.str}}),Object.defineProperty(r,"stringify",{enumerable:!0,get:function(){return h.stringify}}),Object.defineProperty(r,"nil",{enumerable:!0,get:function(){return h.nil}}),Object.defineProperty(r,"Name",{enumerable:!0,get:function(){return h.Name}}),Object.defineProperty(r,"CodeGen",{enumerable:!0,get:function(){return h.CodeGen}})},57023:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.regexpCode=r.getEsmExportName=r.getProperty=r.safeStringify=r.stringify=r.strConcat=r.addCodeArg=r.str=r._=r.nil=r._Code=r.Name=r.IDENTIFIER=r._CodeOrName=void 0;class _CodeOrName{}r._CodeOrName=_CodeOrName,r.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class Name extends _CodeOrName{constructor(t){if(super(),!r.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}r.Name=Name;class _Code extends _CodeOrName{constructor(t){super(),this._items="string"==typeof t?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const t=this._items[0];return""===t||'""'===t}get str(){var t;return null!==(t=this._str)&&void 0!==t?t:this._str=this._items.reduce(((t,r)=>`${t}${r}`),"")}get names(){var t;return null!==(t=this._names)&&void 0!==t?t:this._names=this._items.reduce(((t,r)=>(r instanceof Name&&(t[r.str]=(t[r.str]||0)+1),t)),{})}}function _(t,...r){const a=[t[0]];let i=0;for(;i<r.length;)addCodeArg(a,r[i]),a.push(t[++i]);return new _Code(a)}r._Code=_Code,r.nil=new _Code(""),r._=_;const a=new _Code("+");function str(t,...r){const i=[safeStringify(t[0])];let o=0;for(;o<r.length;)i.push(a),addCodeArg(i,r[o]),i.push(a,safeStringify(t[++o]));return function optimize(t){let r=1;for(;r<t.length-1;){if(t[r]===a){const a=mergeExprItems(t[r-1],t[r+1]);if(void 0!==a){t.splice(r-1,3,a);continue}t[r++]="+"}r++}}(i),new _Code(i)}function addCodeArg(t,r){r instanceof _Code?t.push(...r._items):r instanceof Name?t.push(r):t.push(function interpolate(t){return"number"==typeof t||"boolean"==typeof t||null===t?t:safeStringify(Array.isArray(t)?t.join(","):t)}(r))}function mergeExprItems(t,r){if('""'===r)return t;if('""'===t)return r;if("string"==typeof t){if(r instanceof Name||'"'!==t[t.length-1])return;return"string"!=typeof r?`${t.slice(0,-1)}${r}"`:'"'===r[0]?t.slice(0,-1)+r.slice(1):void 0}return"string"!=typeof r||'"'!==r[0]||t instanceof Name?void 0:`"${t}${r.slice(1)}`}function safeStringify(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}r.str=str,r.addCodeArg=addCodeArg,r.strConcat=function strConcat(t,r){return r.emptyStr()?t:t.emptyStr()?r:str`${t}${r}`},r.stringify=function stringify(t){return new _Code(safeStringify(t))},r.safeStringify=safeStringify,r.getProperty=function getProperty(t){return"string"==typeof t&&r.IDENTIFIER.test(t)?new _Code(`.${t}`):_`[${t}]`},r.getEsmExportName=function getEsmExportName(t){if("string"==typeof t&&r.IDENTIFIER.test(t))return new _Code(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)},r.regexpCode=function regexpCode(t){return new _Code(t.toString())}},93487:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.or=r.and=r.not=r.CodeGen=r.operators=r.varKinds=r.ValueScopeName=r.ValueScope=r.Scope=r.Name=r.regexpCode=r.stringify=r.getProperty=r.nil=r.strConcat=r.str=r._=void 0;const i=a(57023),o=a(98490);var l=a(57023);Object.defineProperty(r,"_",{enumerable:!0,get:function(){return l._}}),Object.defineProperty(r,"str",{enumerable:!0,get:function(){return l.str}}),Object.defineProperty(r,"strConcat",{enumerable:!0,get:function(){return l.strConcat}}),Object.defineProperty(r,"nil",{enumerable:!0,get:function(){return l.nil}}),Object.defineProperty(r,"getProperty",{enumerable:!0,get:function(){return l.getProperty}}),Object.defineProperty(r,"stringify",{enumerable:!0,get:function(){return l.stringify}}),Object.defineProperty(r,"regexpCode",{enumerable:!0,get:function(){return l.regexpCode}}),Object.defineProperty(r,"Name",{enumerable:!0,get:function(){return l.Name}});var c=a(98490);Object.defineProperty(r,"Scope",{enumerable:!0,get:function(){return c.Scope}}),Object.defineProperty(r,"ValueScope",{enumerable:!0,get:function(){return c.ValueScope}}),Object.defineProperty(r,"ValueScopeName",{enumerable:!0,get:function(){return c.ValueScopeName}}),Object.defineProperty(r,"varKinds",{enumerable:!0,get:function(){return c.varKinds}}),r.operators={GT:new i._Code(">"),GTE:new i._Code(">="),LT:new i._Code("<"),LTE:new i._Code("<="),EQ:new i._Code("==="),NEQ:new i._Code("!=="),NOT:new i._Code("!"),OR:new i._Code("||"),AND:new i._Code("&&"),ADD:new i._Code("+")};class Node{optimizeNodes(){return this}optimizeNames(t,r){return this}}class Def extends Node{constructor(t,r,a){super(),this.varKind=t,this.name=r,this.rhs=a}render({es5:t,_n:r}){const a=t?o.varKinds.var:this.varKind,i=void 0===this.rhs?"":` = ${this.rhs}`;return`${a} ${this.name}${i};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=optimizeExpr(this.rhs,t,r)),this}get names(){return this.rhs instanceof i._CodeOrName?this.rhs.names:{}}}class Assign extends Node{constructor(t,r,a){super(),this.lhs=t,this.rhs=r,this.sideEffects=a}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(!(this.lhs instanceof i.Name)||t[this.lhs.str]||this.sideEffects)return this.rhs=optimizeExpr(this.rhs,t,r),this}get names(){return addExprNames(this.lhs instanceof i.Name?{}:{...this.lhs.names},this.rhs)}}class AssignOp extends Assign{constructor(t,r,a,i){super(t,a,i),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}}class Label extends Node{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}}class Break extends Node{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}}class Throw extends Node{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}}class AnyCode extends Node{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,r){return this.code=optimizeExpr(this.code,t,r),this}get names(){return this.code instanceof i._CodeOrName?this.code.names:{}}}class ParentNode extends Node{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce(((r,a)=>r+a.render(t)),"")}optimizeNodes(){const{nodes:t}=this;let r=t.length;for(;r--;){const a=t[r].optimizeNodes();Array.isArray(a)?t.splice(r,1,...a):a?t[r]=a:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){const{nodes:a}=this;let i=a.length;for(;i--;){const o=a[i];o.optimizeNames(t,r)||(subtractNames(t,o.names),a.splice(i,1))}return a.length>0?this:void 0}get names(){return this.nodes.reduce(((t,r)=>addNames(t,r.names)),{})}}class BlockNode extends ParentNode{render(t){return"{"+t._n+super.render(t)+"}"+t._n}}class Root extends ParentNode{}class Else extends BlockNode{}Else.kind="else";class If extends BlockNode{constructor(t,r){super(r),this.condition=t}render(t){let r=`if(${this.condition})`+super.render(t);return this.else&&(r+="else "+this.else.render(t)),r}optimizeNodes(){super.optimizeNodes();const t=this.condition;if(!0===t)return this.nodes;let r=this.else;if(r){const t=r.optimizeNodes();r=this.else=Array.isArray(t)?new Else(t):t}return r?!1===t?r instanceof If?r:r.nodes:this.nodes.length?this:new If(not(t),r instanceof If?[r]:r.nodes):!1!==t&&this.nodes.length?this:void 0}optimizeNames(t,r){var a;if(this.else=null===(a=this.else)||void 0===a?void 0:a.optimizeNames(t,r),super.optimizeNames(t,r)||this.else)return this.condition=optimizeExpr(this.condition,t,r),this}get names(){const t=super.names;return addExprNames(t,this.condition),this.else&&addNames(t,this.else.names),t}}If.kind="if";class For extends BlockNode{}For.kind="for";class ForLoop extends For{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iteration=optimizeExpr(this.iteration,t,r),this}get names(){return addNames(super.names,this.iteration.names)}}class ForRange extends For{constructor(t,r,a,i){super(),this.varKind=t,this.name=r,this.from=a,this.to=i}render(t){const r=t.es5?o.varKinds.var:this.varKind,{name:a,from:i,to:l}=this;return`for(${r} ${a}=${i}; ${a}<${l}; ${a}++)`+super.render(t)}get names(){const t=addExprNames(super.names,this.from);return addExprNames(t,this.to)}}class ForIter extends For{constructor(t,r,a,i){super(),this.loop=t,this.varKind=r,this.name=a,this.iterable=i}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iterable=optimizeExpr(this.iterable,t,r),this}get names(){return addNames(super.names,this.iterable.names)}}class Func extends BlockNode{constructor(t,r,a){super(),this.name=t,this.args=r,this.async=a}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}}Func.kind="func";class Return extends ParentNode{render(t){return"return "+super.render(t)}}Return.kind="return";class Try extends BlockNode{render(t){let r="try"+super.render(t);return this.catch&&(r+=this.catch.render(t)),this.finally&&(r+=this.finally.render(t)),r}optimizeNodes(){var t,r;return super.optimizeNodes(),null===(t=this.catch)||void 0===t||t.optimizeNodes(),null===(r=this.finally)||void 0===r||r.optimizeNodes(),this}optimizeNames(t,r){var a,i;return super.optimizeNames(t,r),null===(a=this.catch)||void 0===a||a.optimizeNames(t,r),null===(i=this.finally)||void 0===i||i.optimizeNames(t,r),this}get names(){const t=super.names;return this.catch&&addNames(t,this.catch.names),this.finally&&addNames(t,this.finally.names),t}}class Catch extends BlockNode{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}}Catch.kind="catch";class Finally extends BlockNode{render(t){return"finally"+super.render(t)}}Finally.kind="finally";function addNames(t,r){for(const a in r)t[a]=(t[a]||0)+(r[a]||0);return t}function addExprNames(t,r){return r instanceof i._CodeOrName?addNames(t,r.names):t}function optimizeExpr(t,r,a){return t instanceof i.Name?replaceName(t):function canOptimize(t){return t instanceof i._Code&&t._items.some((t=>t instanceof i.Name&&1===r[t.str]&&void 0!==a[t.str]))}(t)?new i._Code(t._items.reduce(((t,r)=>(r instanceof i.Name&&(r=replaceName(r)),r instanceof i._Code?t.push(...r._items):t.push(r),t)),[])):t;function replaceName(t){const i=a[t.str];return void 0===i||1!==r[t.str]?t:(delete r[t.str],i)}}function subtractNames(t,r){for(const a in r)t[a]=(t[a]||0)-(r[a]||0)}function not(t){return"boolean"==typeof t||"number"==typeof t||null===t?!t:i._`!${par(t)}`}r.CodeGen=class CodeGen{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?"\n":""},this._extScope=t,this._scope=new o.Scope({parent:t}),this._nodes=[new Root]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,r){const a=this._extScope.value(t,r);return(this._values[a.prefix]||(this._values[a.prefix]=new Set)).add(a),a}getScopeValue(t,r){return this._extScope.getValue(t,r)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,r,a,i){const o=this._scope.toName(r);return void 0!==a&&i&&(this._constants[o.str]=a),this._leafNode(new Def(t,o,a)),o}const(t,r,a){return this._def(o.varKinds.const,t,r,a)}let(t,r,a){return this._def(o.varKinds.let,t,r,a)}var(t,r,a){return this._def(o.varKinds.var,t,r,a)}assign(t,r,a){return this._leafNode(new Assign(t,r,a))}add(t,a){return this._leafNode(new AssignOp(t,r.operators.ADD,a))}code(t){return"function"==typeof t?t():t!==i.nil&&this._leafNode(new AnyCode(t)),this}object(...t){const r=["{"];for(const[a,o]of t)r.length>1&&r.push(","),r.push(a),(a!==o||this.opts.es5)&&(r.push(":"),(0,i.addCodeArg)(r,o));return r.push("}"),new i._Code(r)}if(t,r,a){if(this._blockNode(new If(t)),r&&a)this.code(r).else().code(a).endIf();else if(r)this.code(r).endIf();else if(a)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new If(t))}else(){return this._elseNode(new Else)}endIf(){return this._endBlockNode(If,Else)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new ForLoop(t),r)}forRange(t,r,a,i,l=(this.opts.es5?o.varKinds.var:o.varKinds.let)){const c=this._scope.toName(t);return this._for(new ForRange(l,c,r,a),(()=>i(c)))}forOf(t,r,a,l=o.varKinds.const){const c=this._scope.toName(t);if(this.opts.es5){const t=r instanceof i.Name?r:this.var("_arr",r);return this.forRange("_i",0,i._`${t}.length`,(r=>{this.var(c,i._`${t}[${r}]`),a(c)}))}return this._for(new ForIter("of",l,c,r),(()=>a(c)))}forIn(t,r,a,l=(this.opts.es5?o.varKinds.var:o.varKinds.const)){if(this.opts.ownProperties)return this.forOf(t,i._`Object.keys(${r})`,a);const c=this._scope.toName(t);return this._for(new ForIter("in",l,c,r),(()=>a(c)))}endFor(){return this._endBlockNode(For)}label(t){return this._leafNode(new Label(t))}break(t){return this._leafNode(new Break(t))}return(t){const r=new Return;if(this._blockNode(r),this.code(t),1!==r.nodes.length)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Return)}try(t,r,a){if(!r&&!a)throw new Error('CodeGen: "try" without "catch" and "finally"');const i=new Try;if(this._blockNode(i),this.code(t),r){const t=this.name("e");this._currNode=i.catch=new Catch(t),r(t)}return a&&(this._currNode=i.finally=new Finally,this.code(a)),this._endBlockNode(Catch,Finally)}throw(t){return this._leafNode(new Throw(t))}block(t,r){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(r),this}endBlock(t){const r=this._blockStarts.pop();if(void 0===r)throw new Error("CodeGen: not in self-balancing block");const a=this._nodes.length-r;if(a<0||void 0!==t&&a!==t)throw new Error(`CodeGen: wrong number of nodes: ${a} vs ${t} expected`);return this._nodes.length=r,this}func(t,r=i.nil,a,o){return this._blockNode(new Func(t,r,a)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(Func)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,r){const a=this._currNode;if(a instanceof t||r&&a instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${t.kind}/${r.kind}`:t.kind}"`)}_elseNode(t){const r=this._currNode;if(!(r instanceof If))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=t,this}get _root(){return this._nodes[0]}get _currNode(){const t=this._nodes;return t[t.length-1]}set _currNode(t){const r=this._nodes;r[r.length-1]=t}},r.not=not;const u=mappend(r.operators.AND);r.and=function and(...t){return t.reduce(u)};const d=mappend(r.operators.OR);function mappend(t){return(r,a)=>r===i.nil?a:a===i.nil?r:i._`${par(r)} ${t} ${par(a)}`}function par(t){return t instanceof i.Name?t:i._`(${t})`}r.or=function or(...t){return t.reduce(d)}},98490:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.ValueScope=r.ValueScopeName=r.Scope=r.varKinds=r.UsedValueState=void 0;const i=a(57023);class ValueError extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}}var o;!function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"}(o=r.UsedValueState||(r.UsedValueState={})),r.varKinds={const:new i.Name("const"),let:new i.Name("let"),var:new i.Name("var")};class Scope{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof i.Name?t:this.name(t)}name(t){return new i.Name(this._newName(t))}_newName(t){return`${t}${(this._names[t]||this._nameGroup(t)).index++}`}_nameGroup(t){var r,a;if((null===(a=null===(r=this._parent)||void 0===r?void 0:r._prefixes)||void 0===a?void 0:a.has(t))||this._prefixes&&!this._prefixes.has(t))throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}}r.Scope=Scope;class ValueScopeName extends i.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:a}){this.value=t,this.scopePath=i._`.${new i.Name(r)}[${a}]`}}r.ValueScopeName=ValueScopeName;const l=i._`\n`;r.ValueScope=class ValueScope extends Scope{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?l:i.nil}}get(){return this._scope}name(t){return new ValueScopeName(t,this._newName(t))}value(t,r){var a;if(void 0===r.ref)throw new Error("CodeGen: ref must be passed in value");const i=this.toName(t),{prefix:o}=i,l=null!==(a=r.key)&&void 0!==a?a:r.ref;let c=this._values[o];if(c){const t=c.get(l);if(t)return t}else c=this._values[o]=new Map;c.set(l,i);const u=this._scope[o]||(this._scope[o]=[]),d=u.length;return u[d]=r.ref,i.setValue(r,{property:o,itemIndex:d}),i}getValue(t,r){const a=this._values[t];if(a)return a.get(r)}scopeRefs(t,r=this._values){return this._reduceValues(r,(r=>{if(void 0===r.scopePath)throw new Error(`CodeGen: name "${r}" has no value`);return i._`${t}${r.scopePath}`}))}scopeCode(t=this._values,r,a){return this._reduceValues(t,(t=>{if(void 0===t.value)throw new Error(`CodeGen: name "${t}" has no value`);return t.value.code}),r,a)}_reduceValues(t,a,l={},c){let u=i.nil;for(const d in t){const p=t[d];if(!p)continue;const h=l[d]=l[d]||new Map;p.forEach((t=>{if(h.has(t))return;h.set(t,o.Started);let l=a(t);if(l){const a=this.opts.es5?r.varKinds.var:r.varKinds.const;u=i._`${u}${a} ${t} = ${l};${this.opts._n}`}else{if(!(l=null==c?void 0:c(t)))throw new ValueError(t);u=i._`${u}${l}${this.opts._n}`}h.set(t,o.Completed)}))}return u}}},4181:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.extendErrors=r.resetErrorsCount=r.reportExtraError=r.reportError=r.keyword$DataError=r.keywordError=void 0;const i=a(93487),o=a(76776),l=a(22141);function addError(t,r){const a=t.const("err",r);t.if(i._`${l.default.vErrors} === null`,(()=>t.assign(l.default.vErrors,i._`[${a}]`)),i._`${l.default.vErrors}.push(${a})`),t.code(i._`${l.default.errors}++`)}function returnErrors(t,r){const{gen:a,validateName:o,schemaEnv:l}=t;l.$async?a.throw(i._`new ${t.ValidationError}(${r})`):(a.assign(i._`${o}.errors`,r),a.return(!1))}r.keywordError={message:({keyword:t})=>i.str`must pass "${t}" keyword validation`},r.keyword$DataError={message:({keyword:t,schemaType:r})=>r?i.str`"${t}" keyword must be ${r} ($data)`:i.str`"${t}" keyword is invalid ($data)`},r.reportError=function reportError(t,a=r.keywordError,o,l){const{it:c}=t,{gen:u,compositeRule:d,allErrors:p}=c,h=errorObjectCode(t,a,o);(null!=l?l:d||p)?addError(u,h):returnErrors(c,i._`[${h}]`)},r.reportExtraError=function reportExtraError(t,a=r.keywordError,i){const{it:o}=t,{gen:c,compositeRule:u,allErrors:d}=o;addError(c,errorObjectCode(t,a,i)),u||d||returnErrors(o,l.default.vErrors)},r.resetErrorsCount=function resetErrorsCount(t,r){t.assign(l.default.errors,r),t.if(i._`${l.default.vErrors} !== null`,(()=>t.if(r,(()=>t.assign(i._`${l.default.vErrors}.length`,r)),(()=>t.assign(l.default.vErrors,null)))))},r.extendErrors=function extendErrors({gen:t,keyword:r,schemaValue:a,data:o,errsCount:c,it:u}){if(void 0===c)throw new Error("ajv implementation error");const d=t.name("err");t.forRange("i",c,l.default.errors,(c=>{t.const(d,i._`${l.default.vErrors}[${c}]`),t.if(i._`${d}.instancePath === undefined`,(()=>t.assign(i._`${d}.instancePath`,(0,i.strConcat)(l.default.instancePath,u.errorPath)))),t.assign(i._`${d}.schemaPath`,i.str`${u.errSchemaPath}/${r}`),u.opts.verbose&&(t.assign(i._`${d}.schema`,a),t.assign(i._`${d}.data`,o))}))};const c={keyword:new i.Name("keyword"),schemaPath:new i.Name("schemaPath"),params:new i.Name("params"),propertyName:new i.Name("propertyName"),message:new i.Name("message"),schema:new i.Name("schema"),parentSchema:new i.Name("parentSchema")};function errorObjectCode(t,r,a){const{createErrors:o}=t.it;return!1===o?i._`{}`:function errorObject(t,r,a={}){const{gen:o,it:u}=t,d=[errorInstancePath(u,a),errorSchemaPath(t,a)];return function extraErrorProps(t,{params:r,message:a},o){const{keyword:u,data:d,schemaValue:p,it:h}=t,{opts:m,propertyName:y,topSchemaRef:g,schemaPath:v}=h;o.push([c.keyword,u],[c.params,"function"==typeof r?r(t):r||i._`{}`]),m.messages&&o.push([c.message,"function"==typeof a?a(t):a]);m.verbose&&o.push([c.schema,p],[c.parentSchema,i._`${g}${v}`],[l.default.data,d]);y&&o.push([c.propertyName,y])}(t,r,d),o.object(...d)}(t,r,a)}function errorInstancePath({errorPath:t},{instancePath:r}){const a=r?i.str`${t}${(0,o.getErrorPath)(r,o.Type.Str)}`:t;return[l.default.instancePath,(0,i.strConcat)(l.default.instancePath,a)]}function errorSchemaPath({keyword:t,it:{errSchemaPath:r}},{schemaPath:a,parentSchema:l}){let u=l?r:i.str`${r}/${t}`;return a&&(u=i.str`${u}${(0,o.getErrorPath)(a,o.Type.Str)}`),[c.schemaPath,u]}},25173:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.resolveSchema=r.getCompilingSchema=r.resolveRef=r.compileSchema=r.SchemaEnv=void 0;const i=a(93487),o=a(67426),l=a(22141),c=a(32531),u=a(76776),d=a(74815);class SchemaEnv{constructor(t){var r;let a;this.refs={},this.dynamicAnchors={},"object"==typeof t.schema&&(a=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=null!==(r=t.baseId)&&void 0!==r?r:(0,c.normalizeId)(null==a?void 0:a[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=null==a?void 0:a.$async,this.refs={}}}function compileSchema(t){const r=getCompilingSchema.call(this,t);if(r)return r;const a=(0,c.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:u,lines:p}=this.opts.code,{ownProperties:h}=this.opts,m=new i.CodeGen(this.scope,{es5:u,lines:p,ownProperties:h});let y;t.$async&&(y=m.scopeValue("Error",{ref:o.default,code:i._`require("ajv/dist/runtime/validation_error").default`}));const g=m.scopeName("validate");t.validateName=g;const v={gen:m,allErrors:this.opts.allErrors,data:l.default.data,parentData:l.default.parentData,parentDataProperty:l.default.parentDataProperty,dataNames:[l.default.data],dataPathArr:[i.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:m.scopeValue("schema",!0===this.opts.code.source?{ref:t.schema,code:(0,i.stringify)(t.schema)}:{ref:t.schema}),validateName:g,ValidationError:y,schema:t.schema,schemaEnv:t,rootId:a,baseId:t.baseId||a,schemaPath:i.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:i._`""`,opts:this.opts,self:this};let b;try{this._compilations.add(t),(0,d.validateFunctionCode)(v),m.optimize(this.opts.code.optimize);const r=m.toString();b=`${m.scopeRefs(l.default.scope)}return ${r}`,this.opts.code.process&&(b=this.opts.code.process(b,t));const a=new Function(`${l.default.self}`,`${l.default.scope}`,b)(this,this.scope.get());if(this.scope.value(g,{ref:a}),a.errors=null,a.schema=t.schema,a.schemaEnv=t,t.$async&&(a.$async=!0),!0===this.opts.code.source&&(a.source={validateName:g,validateCode:r,scopeValues:m._values}),this.opts.unevaluated){const{props:t,items:r}=v;a.evaluated={props:t instanceof i.Name?void 0:t,items:r instanceof i.Name?void 0:r,dynamicProps:t instanceof i.Name,dynamicItems:r instanceof i.Name},a.source&&(a.source.evaluated=(0,i.stringify)(a.evaluated))}return t.validate=a,t}catch(r){throw delete t.validate,delete t.validateName,b&&this.logger.error("Error compiling schema, function code:",b),r}finally{this._compilations.delete(t)}}function inlineOrCompile(t){return(0,c.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:compileSchema.call(this,t)}function getCompilingSchema(t){for(const i of this._compilations)if(a=t,(r=i).schema===a.schema&&r.root===a.root&&r.baseId===a.baseId)return i;var r,a}function resolve(t,r){let a;for(;"string"==typeof(a=this.refs[r]);)r=a;return a||this.schemas[r]||resolveSchema.call(this,t,r)}function resolveSchema(t,r){const a=this.opts.uriResolver.parse(r),i=(0,c._getFullPath)(this.opts.uriResolver,a);let o=(0,c.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&i===o)return getJsonPointer.call(this,a,t);const l=(0,c.normalizeId)(i),u=this.refs[l]||this.schemas[l];if("string"==typeof u){const r=resolveSchema.call(this,t,u);if("object"!=typeof(null==r?void 0:r.schema))return;return getJsonPointer.call(this,a,r)}if("object"==typeof(null==u?void 0:u.schema)){if(u.validate||compileSchema.call(this,u),l===(0,c.normalizeId)(r)){const{schema:r}=u,{schemaId:a}=this.opts,i=r[a];return i&&(o=(0,c.resolveUrl)(this.opts.uriResolver,o,i)),new SchemaEnv({schema:r,schemaId:a,root:t,baseId:o})}return getJsonPointer.call(this,a,u)}}r.SchemaEnv=SchemaEnv,r.compileSchema=compileSchema,r.resolveRef=function resolveRef(t,r,a){var i;a=(0,c.resolveUrl)(this.opts.uriResolver,r,a);const o=t.refs[a];if(o)return o;let l=resolve.call(this,t,a);if(void 0===l){const o=null===(i=t.localRefs)||void 0===i?void 0:i[a],{schemaId:c}=this.opts;o&&(l=new SchemaEnv({schema:o,schemaId:c,root:t,baseId:r}))}return void 0!==l?t.refs[a]=inlineOrCompile.call(this,l):void 0},r.getCompilingSchema=getCompilingSchema,r.resolveSchema=resolveSchema;const p=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function getJsonPointer(t,{baseId:r,schema:a,root:i}){var o;if("/"!==(null===(o=t.fragment)||void 0===o?void 0:o[0]))return;for(const i of t.fragment.slice(1).split("/")){if("boolean"==typeof a)return;const t=a[(0,u.unescapeFragment)(i)];if(void 0===t)return;const o="object"==typeof(a=t)&&a[this.opts.schemaId];!p.has(i)&&o&&(r=(0,c.resolveUrl)(this.opts.uriResolver,r,o))}let l;if("boolean"!=typeof a&&a.$ref&&!(0,u.schemaHasRulesButRef)(a,this.RULES)){const t=(0,c.resolveUrl)(this.opts.uriResolver,r,a.$ref);l=resolveSchema.call(this,i,t)}const{schemaId:d}=this.opts;return l=l||new SchemaEnv({schema:a,schemaId:d,root:i,baseId:r}),l.schema!==l.root.schema?l:void 0}},22141:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});const i=a(93487),o={data:new i.Name("data"),valCxt:new i.Name("valCxt"),instancePath:new i.Name("instancePath"),parentData:new i.Name("parentData"),parentDataProperty:new i.Name("parentDataProperty"),rootData:new i.Name("rootData"),dynamicAnchors:new i.Name("dynamicAnchors"),vErrors:new i.Name("vErrors"),errors:new i.Name("errors"),this:new i.Name("this"),self:new i.Name("self"),scope:new i.Name("scope"),json:new i.Name("json"),jsonPos:new i.Name("jsonPos"),jsonLen:new i.Name("jsonLen"),jsonPart:new i.Name("jsonPart")};r.default=o},6646:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});const i=a(32531);class MissingRefError extends Error{constructor(t,r,a,o){super(o||`can't resolve reference ${a} from id ${r}`),this.missingRef=(0,i.resolveUrl)(t,r,a),this.missingSchema=(0,i.normalizeId)((0,i.getFullPath)(t,this.missingRef))}}r.default=MissingRefError},32531:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.getSchemaRefs=r.resolveUrl=r.normalizeId=r._getFullPath=r.getFullPath=r.inlineRef=void 0;const i=a(76776),o=a(64063),l=a(49461),c=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);r.inlineRef=function inlineRef(t,r=!0){return"boolean"==typeof t||(!0===r?!hasRef(t):!!r&&countKeys(t)<=r)};const u=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function hasRef(t){for(const r in t){if(u.has(r))return!0;const a=t[r];if(Array.isArray(a)&&a.some(hasRef))return!0;if("object"==typeof a&&hasRef(a))return!0}return!1}function countKeys(t){let r=0;for(const a in t){if("$ref"===a)return 1/0;if(r++,!c.has(a)&&("object"==typeof t[a]&&(0,i.eachItem)(t[a],(t=>r+=countKeys(t))),r===1/0))return 1/0}return r}function getFullPath(t,r="",a){!1!==a&&(r=normalizeId(r));const i=t.parse(r);return _getFullPath(t,i)}function _getFullPath(t,r){return t.serialize(r).split("#")[0]+"#"}r.getFullPath=getFullPath,r._getFullPath=_getFullPath;const d=/#\/?$/;function normalizeId(t){return t?t.replace(d,""):""}r.normalizeId=normalizeId,r.resolveUrl=function resolveUrl(t,r,a){return a=normalizeId(a),t.resolve(r,a)};const p=/^[a-z_][-a-z0-9._]*$/i;r.getSchemaRefs=function getSchemaRefs(t,r){if("boolean"==typeof t)return{};const{schemaId:a,uriResolver:i}=this.opts,c=normalizeId(t[a]||r),u={"":c},d=getFullPath(i,c,!1),h={},m=new Set;return l(t,{allKeys:!0},((t,r,i,o)=>{if(void 0===o)return;const l=d+r;let c=u[o];function addRef(r){const a=this.opts.uriResolver.resolve;if(r=normalizeId(c?a(c,r):r),m.has(r))throw ambiguos(r);m.add(r);let i=this.refs[r];return"string"==typeof i&&(i=this.refs[i]),"object"==typeof i?checkAmbiguosRef(t,i.schema,r):r!==normalizeId(l)&&("#"===r[0]?(checkAmbiguosRef(t,h[r],r),h[r]=t):this.refs[r]=l),r}function addAnchor(t){if("string"==typeof t){if(!p.test(t))throw new Error(`invalid anchor "${t}"`);addRef.call(this,`#${t}`)}}"string"==typeof t[a]&&(c=addRef.call(this,t[a])),addAnchor.call(this,t.$anchor),addAnchor.call(this,t.$dynamicAnchor),u[r]=c})),h;function checkAmbiguosRef(t,r,a){if(void 0!==r&&!o(t,r))throw ambiguos(a)}function ambiguos(t){return new Error(`reference "${t}" resolves to more than one schema`)}}},13141:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.getRules=r.isJSONType=void 0;const a=new Set(["string","number","integer","boolean","null","object","array"]);r.isJSONType=function isJSONType(t){return"string"==typeof t&&a.has(t)},r.getRules=function getRules(){const t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}},76776:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.checkStrictMode=r.getErrorPath=r.Type=r.useFunc=r.setEvaluated=r.evaluatedPropsToName=r.mergeEvaluated=r.eachItem=r.unescapeJsonPointer=r.escapeJsonPointer=r.escapeFragment=r.unescapeFragment=r.schemaRefOrVal=r.schemaHasRulesButRef=r.schemaHasRules=r.checkUnknownRules=r.alwaysValidSchema=r.toHash=void 0;const i=a(93487),o=a(57023);function checkUnknownRules(t,r=t.schema){const{opts:a,self:i}=t;if(!a.strictSchema)return;if("boolean"==typeof r)return;const o=i.RULES.keywords;for(const a in r)o[a]||checkStrictMode(t,`unknown keyword: "${a}"`)}function schemaHasRules(t,r){if("boolean"==typeof t)return!t;for(const a in t)if(r[a])return!0;return!1}function escapeJsonPointer(t){return"number"==typeof t?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}function unescapeJsonPointer(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function makeMergeEvaluated({mergeNames:t,mergeToName:r,mergeValues:a,resultToName:o}){return(l,c,u,d)=>{const p=void 0===u?c:u instanceof i.Name?(c instanceof i.Name?t(l,c,u):r(l,c,u),u):c instanceof i.Name?(r(l,u,c),c):a(c,u);return d!==i.Name||p instanceof i.Name?p:o(l,p)}}function evaluatedPropsToName(t,r){if(!0===r)return t.var("props",!0);const a=t.var("props",i._`{}`);return void 0!==r&&setEvaluated(t,a,r),a}function setEvaluated(t,r,a){Object.keys(a).forEach((a=>t.assign(i._`${r}${(0,i.getProperty)(a)}`,!0)))}r.toHash=function toHash(t){const r={};for(const a of t)r[a]=!0;return r},r.alwaysValidSchema=function alwaysValidSchema(t,r){return"boolean"==typeof r?r:0===Object.keys(r).length||(checkUnknownRules(t,r),!schemaHasRules(r,t.self.RULES.all))},r.checkUnknownRules=checkUnknownRules,r.schemaHasRules=schemaHasRules,r.schemaHasRulesButRef=function schemaHasRulesButRef(t,r){if("boolean"==typeof t)return!t;for(const a in t)if("$ref"!==a&&r.all[a])return!0;return!1},r.schemaRefOrVal=function schemaRefOrVal({topSchemaRef:t,schemaPath:r},a,o,l){if(!l){if("number"==typeof a||"boolean"==typeof a)return a;if("string"==typeof a)return i._`${a}`}return i._`${t}${r}${(0,i.getProperty)(o)}`},r.unescapeFragment=function unescapeFragment(t){return unescapeJsonPointer(decodeURIComponent(t))},r.escapeFragment=function escapeFragment(t){return encodeURIComponent(escapeJsonPointer(t))},r.escapeJsonPointer=escapeJsonPointer,r.unescapeJsonPointer=unescapeJsonPointer,r.eachItem=function eachItem(t,r){if(Array.isArray(t))for(const a of t)r(a);else r(t)},r.mergeEvaluated={props:makeMergeEvaluated({mergeNames:(t,r,a)=>t.if(i._`${a} !== true && ${r} !== undefined`,(()=>{t.if(i._`${r} === true`,(()=>t.assign(a,!0)),(()=>t.assign(a,i._`${a} || {}`).code(i._`Object.assign(${a}, ${r})`)))})),mergeToName:(t,r,a)=>t.if(i._`${a} !== true`,(()=>{!0===r?t.assign(a,!0):(t.assign(a,i._`${a} || {}`),setEvaluated(t,a,r))})),mergeValues:(t,r)=>!0===t||{...t,...r},resultToName:evaluatedPropsToName}),items:makeMergeEvaluated({mergeNames:(t,r,a)=>t.if(i._`${a} !== true && ${r} !== undefined`,(()=>t.assign(a,i._`${r} === true ? true : ${a} > ${r} ? ${a} : ${r}`))),mergeToName:(t,r,a)=>t.if(i._`${a} !== true`,(()=>t.assign(a,!0===r||i._`${a} > ${r} ? ${a} : ${r}`))),mergeValues:(t,r)=>!0===t||Math.max(t,r),resultToName:(t,r)=>t.var("items",r)})},r.evaluatedPropsToName=evaluatedPropsToName,r.setEvaluated=setEvaluated;const l={};var c;function checkStrictMode(t,r,a=t.opts.strictSchema){if(a){if(r=`strict mode: ${r}`,!0===a)throw new Error(r);t.self.logger.warn(r)}}r.useFunc=function useFunc(t,r){return t.scopeValue("func",{ref:r,code:l[r.code]||(l[r.code]=new o._Code(r.code))})},function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"}(c=r.Type||(r.Type={})),r.getErrorPath=function getErrorPath(t,r,a){if(t instanceof i.Name){const o=r===c.Num;return a?o?i._`"[" + ${t} + "]"`:i._`"['" + ${t} + "']"`:o?i._`"/" + ${t}`:i._`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return a?(0,i.getProperty)(t).toString():"/"+escapeJsonPointer(t)},r.checkStrictMode=checkStrictMode},58876:(t,r)=>{"use strict";function shouldUseGroup(t,r){return r.rules.some((r=>shouldUseRule(t,r)))}function shouldUseRule(t,r){var a;return void 0!==t[r.keyword]||(null===(a=r.definition.implements)||void 0===a?void 0:a.some((r=>void 0!==t[r])))}Object.defineProperty(r,"__esModule",{value:!0}),r.shouldUseRule=r.shouldUseGroup=r.schemaHasRulesForType=void 0,r.schemaHasRulesForType=function schemaHasRulesForType({schema:t,self:r},a){const i=r.RULES.types[a];return i&&!0!==i&&shouldUseGroup(t,i)},r.shouldUseGroup=shouldUseGroup,r.shouldUseRule=shouldUseRule},55667:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.boolOrEmptySchema=r.topBoolOrEmptySchema=void 0;const i=a(4181),o=a(93487),l=a(22141),c={message:"boolean schema is false"};function falseSchemaError(t,r){const{gen:a,data:o}=t,l={gen:a,keyword:"false schema",data:o,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,i.reportError)(l,c,void 0,r)}r.topBoolOrEmptySchema=function topBoolOrEmptySchema(t){const{gen:r,schema:a,validateName:i}=t;!1===a?falseSchemaError(t,!1):"object"==typeof a&&!0===a.$async?r.return(l.default.data):(r.assign(o._`${i}.errors`,null),r.return(!0))},r.boolOrEmptySchema=function boolOrEmptySchema(t,r){const{gen:a,schema:i}=t;!1===i?(a.var(r,!1),falseSchemaError(t)):a.var(r,!0)}},50453:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.reportTypeError=r.checkDataTypes=r.checkDataType=r.coerceAndCheckDataType=r.getJSONTypes=r.getSchemaTypes=r.DataType=void 0;const i=a(13141),o=a(58876),l=a(4181),c=a(93487),u=a(76776);var d;function getJSONTypes(t){const r=Array.isArray(t)?t:t?[t]:[];if(r.every(i.isJSONType))return r;throw new Error("type must be JSONType or JSONType[]: "+r.join(","))}!function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"}(d=r.DataType||(r.DataType={})),r.getSchemaTypes=function getSchemaTypes(t){const r=getJSONTypes(t.type);if(r.includes("null")){if(!1===t.nullable)throw new Error("type: null contradicts nullable: false")}else{if(!r.length&&void 0!==t.nullable)throw new Error('"nullable" cannot be used without "type"');!0===t.nullable&&r.push("null")}return r},r.getJSONTypes=getJSONTypes,r.coerceAndCheckDataType=function coerceAndCheckDataType(t,r){const{gen:a,data:i,opts:l}=t,u=function coerceToTypes(t,r){return r?t.filter((t=>p.has(t)||"array"===r&&"array"===t)):[]}(r,l.coerceTypes),h=r.length>0&&!(0===u.length&&1===r.length&&(0,o.schemaHasRulesForType)(t,r[0]));if(h){const o=checkDataTypes(r,i,l.strictNumbers,d.Wrong);a.if(o,(()=>{u.length?function coerceData(t,r,a){const{gen:i,data:o,opts:l}=t,u=i.let("dataType",c._`typeof ${o}`),d=i.let("coerced",c._`undefined`);"array"===l.coerceTypes&&i.if(c._`${u} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,(()=>i.assign(o,c._`${o}[0]`).assign(u,c._`typeof ${o}`).if(checkDataTypes(r,o,l.strictNumbers),(()=>i.assign(d,o)))));i.if(c._`${d} !== undefined`);for(const t of a)(p.has(t)||"array"===t&&"array"===l.coerceTypes)&&coerceSpecificType(t);function coerceSpecificType(t){switch(t){case"string":return void i.elseIf(c._`${u} == "number" || ${u} == "boolean"`).assign(d,c._`"" + ${o}`).elseIf(c._`${o} === null`).assign(d,c._`""`);case"number":return void i.elseIf(c._`${u} == "boolean" || ${o} === null
|
|
3
3
|
|| (${u} == "string" && ${o} && ${o} == +${o})`).assign(d,c._`+${o}`);case"integer":return void i.elseIf(c._`${u} === "boolean" || ${o} === null
|
|
4
4
|
|| (${u} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(d,c._`+${o}`);case"boolean":return void i.elseIf(c._`${o} === "false" || ${o} === 0 || ${o} === null`).assign(d,!1).elseIf(c._`${o} === "true" || ${o} === 1`).assign(d,!0);case"null":return i.elseIf(c._`${o} === "" || ${o} === 0 || ${o} === false`),void i.assign(d,null);case"array":i.elseIf(c._`${u} === "string" || ${u} === "number"
|
|
5
5
|
|| ${u} === "boolean" || ${o} === null`).assign(d,c._`[${o}]`)}}i.else(),reportTypeError(t),i.endIf(),i.if(c._`${d} !== undefined`,(()=>{i.assign(o,d),function assignParentData({gen:t,parentData:r,parentDataProperty:a},i){t.if(c._`${r} !== undefined`,(()=>t.assign(c._`${r}[${a}]`,i)))}(t,d)}))}(t,r,u):reportTypeError(t)}))}return h};const p=new Set(["string","number","integer","boolean","null"]);function checkDataType(t,r,a,i=d.Correct){const o=i===d.Correct?c.operators.EQ:c.operators.NEQ;let l;switch(t){case"null":return c._`${r} ${o} null`;case"array":l=c._`Array.isArray(${r})`;break;case"object":l=c._`${r} && typeof ${r} == "object" && !Array.isArray(${r})`;break;case"integer":l=numCond(c._`!(${r} % 1) && !isNaN(${r})`);break;case"number":l=numCond();break;default:return c._`typeof ${r} ${o} ${t}`}return i===d.Correct?l:(0,c.not)(l);function numCond(t=c.nil){return(0,c.and)(c._`typeof ${r} == "number"`,t,a?c._`isFinite(${r})`:c.nil)}}function checkDataTypes(t,r,a,i){if(1===t.length)return checkDataType(t[0],r,a,i);let o;const l=(0,u.toHash)(t);if(l.array&&l.object){const t=c._`typeof ${r} != "object"`;o=l.null?t:c._`!${r} || ${t}`,delete l.null,delete l.array,delete l.object}else o=c.nil;l.number&&delete l.integer;for(const t in l)o=(0,c.and)(o,checkDataType(t,r,a,i));return o}r.checkDataType=checkDataType,r.checkDataTypes=checkDataTypes;const h={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:r})=>"string"==typeof t?c._`{type: ${t}}`:c._`{type: ${r}}`};function reportTypeError(t){const r=function getTypeErrorContext(t){const{gen:r,data:a,schema:i}=t,o=(0,u.schemaRefOrVal)(t,i,"type");return{gen:r,keyword:"type",data:a,schema:i.type,schemaCode:o,schemaValue:o,parentSchema:i,params:{},it:t}}(t);(0,l.reportError)(r,h)}r.reportTypeError=reportTypeError},90313:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.assignDefaults=void 0;const i=a(93487),o=a(76776);function assignDefault(t,r,a){const{gen:l,compositeRule:c,data:u,opts:d}=t;if(void 0===a)return;const p=i._`${u}${(0,i.getProperty)(r)}`;if(c)return void(0,o.checkStrictMode)(t,`default is ignored for: ${p}`);let h=i._`${p} === undefined`;"empty"===d.useDefaults&&(h=i._`${h} || ${p} === null || ${p} === ""`),l.if(h,i._`${p} = ${(0,i.stringify)(a)}`)}r.assignDefaults=function assignDefaults(t,r){const{properties:a,items:i}=t.schema;if("object"===r&&a)for(const r in a)assignDefault(t,r,a[r].default);else"array"===r&&Array.isArray(i)&&i.forEach(((r,a)=>assignDefault(t,a,r.default)))}},74815:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.getData=r.KeywordCxt=r.validateFunctionCode=void 0;const i=a(55667),o=a(50453),l=a(58876),c=a(50453),u=a(90313),d=a(95005),p=a(13099),h=a(93487),m=a(22141),y=a(32531),g=a(76776),v=a(4181);function validateFunction({gen:t,validateName:r,schema:a,schemaEnv:i,opts:o},l){o.code.es5?t.func(r,h._`${m.default.data}, ${m.default.valCxt}`,i.$async,(()=>{t.code(h._`"use strict"; ${funcSourceUrl(a,o)}`),function destructureValCxtES5(t,r){t.if(m.default.valCxt,(()=>{t.var(m.default.instancePath,h._`${m.default.valCxt}.${m.default.instancePath}`),t.var(m.default.parentData,h._`${m.default.valCxt}.${m.default.parentData}`),t.var(m.default.parentDataProperty,h._`${m.default.valCxt}.${m.default.parentDataProperty}`),t.var(m.default.rootData,h._`${m.default.valCxt}.${m.default.rootData}`),r.dynamicRef&&t.var(m.default.dynamicAnchors,h._`${m.default.valCxt}.${m.default.dynamicAnchors}`)}),(()=>{t.var(m.default.instancePath,h._`""`),t.var(m.default.parentData,h._`undefined`),t.var(m.default.parentDataProperty,h._`undefined`),t.var(m.default.rootData,m.default.data),r.dynamicRef&&t.var(m.default.dynamicAnchors,h._`{}`)}))}(t,o),t.code(l)})):t.func(r,h._`${m.default.data}, ${function destructureValCxt(t){return h._`{${m.default.instancePath}="", ${m.default.parentData}, ${m.default.parentDataProperty}, ${m.default.rootData}=${m.default.data}${t.dynamicRef?h._`, ${m.default.dynamicAnchors}={}`:h.nil}}={}`}(o)}`,i.$async,(()=>t.code(funcSourceUrl(a,o)).code(l)))}function funcSourceUrl(t,r){const a="object"==typeof t&&t[r.schemaId];return a&&(r.code.source||r.code.process)?h._`/*# sourceURL=${a} */`:h.nil}function subschemaCode(t,r){isSchemaObj(t)&&(checkKeywords(t),schemaCxtHasRules(t))?function subSchemaObjCode(t,r){const{schema:a,gen:i,opts:o}=t;o.$comment&&a.$comment&&commentKeyword(t);(function updateContext(t){const r=t.schema[t.opts.schemaId];r&&(t.baseId=(0,y.resolveUrl)(t.opts.uriResolver,t.baseId,r))})(t),function checkAsyncSchema(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}(t);const l=i.const("_errs",m.default.errors);typeAndKeywords(t,l),i.var(r,h._`${l} === ${m.default.errors}`)}(t,r):(0,i.boolOrEmptySchema)(t,r)}function schemaCxtHasRules({schema:t,self:r}){if("boolean"==typeof t)return!t;for(const a in t)if(r.RULES.all[a])return!0;return!1}function isSchemaObj(t){return"boolean"!=typeof t.schema}function checkKeywords(t){(0,g.checkUnknownRules)(t),function checkRefsAndKeywords(t){const{schema:r,errSchemaPath:a,opts:i,self:o}=t;r.$ref&&i.ignoreKeywordsWithRef&&(0,g.schemaHasRulesButRef)(r,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${a}"`)}(t)}function typeAndKeywords(t,r){if(t.opts.jtd)return schemaKeywords(t,[],!1,r);const a=(0,o.getSchemaTypes)(t.schema);schemaKeywords(t,a,!(0,o.coerceAndCheckDataType)(t,a),r)}function commentKeyword({gen:t,schemaEnv:r,schema:a,errSchemaPath:i,opts:o}){const l=a.$comment;if(!0===o.$comment)t.code(h._`${m.default.self}.logger.log(${l})`);else if("function"==typeof o.$comment){const a=h.str`${i}/$comment`,o=t.scopeValue("root",{ref:r.root});t.code(h._`${m.default.self}.opts.$comment(${l}, ${a}, ${o}.schema)`)}}function schemaKeywords(t,r,a,i){const{gen:o,schema:u,data:d,allErrors:p,opts:y,self:v}=t,{RULES:b}=v;function groupKeywords(g){(0,l.shouldUseGroup)(u,g)&&(g.type?(o.if((0,c.checkDataType)(g.type,d,y.strictNumbers)),iterateKeywords(t,g),1===r.length&&r[0]===g.type&&a&&(o.else(),(0,c.reportTypeError)(t)),o.endIf()):iterateKeywords(t,g),p||o.if(h._`${m.default.errors} === ${i||0}`))}!u.$ref||!y.ignoreKeywordsWithRef&&(0,g.schemaHasRulesButRef)(u,b)?(y.jtd||function checkStrictTypes(t,r){if(t.schemaEnv.meta||!t.opts.strictTypes)return;(function checkContextTypes(t,r){if(!r.length)return;if(!t.dataTypes.length)return void(t.dataTypes=r);r.forEach((r=>{includesType(t.dataTypes,r)||strictTypesError(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)})),t.dataTypes=t.dataTypes.filter((t=>includesType(r,t)))})(t,r),t.opts.allowUnionTypes||function checkMultipleTypes(t,r){r.length>1&&(2!==r.length||!r.includes("null"))&&strictTypesError(t,"use allowUnionTypes to allow union type keyword")}(t,r);!function checkKeywordTypes(t,r){const a=t.self.RULES.all;for(const i in a){const o=a[i];if("object"==typeof o&&(0,l.shouldUseRule)(t.schema,o)){const{type:a}=o.definition;a.length&&!a.some((t=>hasApplicableType(r,t)))&&strictTypesError(t,`missing type "${a.join(",")}" for keyword "${i}"`)}}}(t,t.dataTypes)}(t,r),o.block((()=>{for(const t of b.rules)groupKeywords(t);groupKeywords(b.post)}))):o.block((()=>keywordCode(t,"$ref",b.all.$ref.definition)))}function iterateKeywords(t,r){const{gen:a,schema:i,opts:{useDefaults:o}}=t;o&&(0,u.assignDefaults)(t,r.type),a.block((()=>{for(const a of r.rules)(0,l.shouldUseRule)(i,a)&&keywordCode(t,a.keyword,a.definition,r.type)}))}function hasApplicableType(t,r){return t.includes(r)||"number"===r&&t.includes("integer")}function includesType(t,r){return t.includes(r)||"integer"===r&&t.includes("number")}function strictTypesError(t,r){r+=` at "${t.schemaEnv.baseId+t.errSchemaPath}" (strictTypes)`,(0,g.checkStrictMode)(t,r,t.opts.strictTypes)}r.validateFunctionCode=function validateFunctionCode(t){isSchemaObj(t)&&(checkKeywords(t),schemaCxtHasRules(t))?function topSchemaObjCode(t){const{schema:r,opts:a,gen:i}=t;return void validateFunction(t,(()=>{a.$comment&&r.$comment&&commentKeyword(t),function checkNoDefault(t){const{schema:r,opts:a}=t;void 0!==r.default&&a.useDefaults&&a.strictSchema&&(0,g.checkStrictMode)(t,"default is ignored in the schema root")}(t),i.let(m.default.vErrors,null),i.let(m.default.errors,0),a.unevaluated&&function resetEvaluated(t){const{gen:r,validateName:a}=t;t.evaluated=r.const("evaluated",h._`${a}.evaluated`),r.if(h._`${t.evaluated}.dynamicProps`,(()=>r.assign(h._`${t.evaluated}.props`,h._`undefined`))),r.if(h._`${t.evaluated}.dynamicItems`,(()=>r.assign(h._`${t.evaluated}.items`,h._`undefined`)))}(t),typeAndKeywords(t),function returnResults(t){const{gen:r,schemaEnv:a,validateName:i,ValidationError:o,opts:l}=t;a.$async?r.if(h._`${m.default.errors} === 0`,(()=>r.return(m.default.data)),(()=>r.throw(h._`new ${o}(${m.default.vErrors})`))):(r.assign(h._`${i}.errors`,m.default.vErrors),l.unevaluated&&function assignEvaluated({gen:t,evaluated:r,props:a,items:i}){a instanceof h.Name&&t.assign(h._`${r}.props`,a);i instanceof h.Name&&t.assign(h._`${r}.items`,i)}(t),r.return(h._`${m.default.errors} === 0`))}(t)}))}(t):validateFunction(t,(()=>(0,i.topBoolOrEmptySchema)(t)))};class KeywordCxt{constructor(t,r,a){if((0,d.validateKeywordUsage)(t,r,a),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=a,this.data=t.data,this.schema=t.schema[a],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,g.schemaRefOrVal)(t,this.schema,a,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const("vSchema",getData(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,d.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${a} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:!1!==r.errors)&&(this.errsCount=t.gen.const("_errs",m.default.errors))}result(t,r,a){this.failResult((0,h.not)(t),r,a)}failResult(t,r,a){this.gen.if(t),a?a():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,h.not)(t),void 0,r)}fail(t){if(void 0===t)return this.error(),void(this.allErrors||this.gen.if(!1));this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);const{schemaCode:r}=this;this.fail(h._`${r} !== undefined && (${(0,h.or)(this.invalid$data(),t)})`)}error(t,r,a){if(r)return this.setParams(r),this._error(t,a),void this.setParams({});this._error(t,a)}_error(t,r){(t?v.reportExtraError:v.reportError)(this,this.def.error,r)}$dataError(){(0,v.reportError)(this,this.def.$dataError||v.keyword$DataError)}reset(){if(void 0===this.errsCount)throw new Error('add "trackErrors" to keyword definition');(0,v.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,r){r?Object.assign(this.params,t):this.params=t}block$data(t,r,a=h.nil){this.gen.block((()=>{this.check$data(t,a),r()}))}check$data(t=h.nil,r=h.nil){if(!this.$data)return;const{gen:a,schemaCode:i,schemaType:o,def:l}=this;a.if((0,h.or)(h._`${i} === undefined`,r)),t!==h.nil&&a.assign(t,!0),(o.length||l.validateSchema)&&(a.elseIf(this.invalid$data()),this.$dataError(),t!==h.nil&&a.assign(t,!1)),a.else()}invalid$data(){const{gen:t,schemaCode:r,schemaType:a,def:i,it:o}=this;return(0,h.or)(function wrong$DataType(){if(a.length){if(!(r instanceof h.Name))throw new Error("ajv implementation error");const t=Array.isArray(a)?a:[a];return h._`${(0,c.checkDataTypes)(t,r,o.opts.strictNumbers,c.DataType.Wrong)}`}return h.nil}(),function invalid$DataSchema(){if(i.validateSchema){const a=t.scopeValue("validate$data",{ref:i.validateSchema});return h._`!${a}(${r})`}return h.nil}())}subschema(t,r){const a=(0,p.getSubschema)(this.it,t);(0,p.extendSubschemaData)(a,this.it,t),(0,p.extendSubschemaMode)(a,t);const i={...this.it,...a,items:void 0,props:void 0};return subschemaCode(i,r),i}mergeEvaluated(t,r){const{it:a,gen:i}=this;a.opts.unevaluated&&(!0!==a.props&&void 0!==t.props&&(a.props=g.mergeEvaluated.props(i,t.props,a.props,r)),!0!==a.items&&void 0!==t.items&&(a.items=g.mergeEvaluated.items(i,t.items,a.items,r)))}mergeValidEvaluated(t,r){const{it:a,gen:i}=this;if(a.opts.unevaluated&&(!0!==a.props||!0!==a.items))return i.if(r,(()=>this.mergeEvaluated(t,h.Name))),!0}}function keywordCode(t,r,a,i){const o=new KeywordCxt(t,a,r);"code"in a?a.code(o,i):o.$data&&a.validate?(0,d.funcKeywordCode)(o,a):"macro"in a?(0,d.macroKeywordCode)(o,a):(a.compile||a.validate)&&(0,d.funcKeywordCode)(o,a)}r.KeywordCxt=KeywordCxt;const b=/^\/(?:[^~]|~0|~1)*$/,R=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function getData(t,{dataLevel:r,dataNames:a,dataPathArr:i}){let o,l;if(""===t)return m.default.rootData;if("/"===t[0]){if(!b.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);o=t,l=m.default.rootData}else{const c=R.exec(t);if(!c)throw new Error(`Invalid JSON-pointer: ${t}`);const u=+c[1];if(o=c[2],"#"===o){if(u>=r)throw new Error(errorMsg("property/index",u));return i[r-u]}if(u>r)throw new Error(errorMsg("data",u));if(l=a[r-u],!o)return l}let c=l;const u=o.split("/");for(const t of u)t&&(l=h._`${l}${(0,h.getProperty)((0,g.unescapeJsonPointer)(t))}`,c=h._`${c} && ${l}`);return c;function errorMsg(t,a){return`Cannot access ${t} ${a} levels up, current level is ${r}`}}r.getData=getData},95005:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.validateKeywordUsage=r.validSchemaType=r.funcKeywordCode=r.macroKeywordCode=void 0;const i=a(93487),o=a(22141),l=a(10412),c=a(4181);function modifyData(t){const{gen:r,data:a,it:o}=t;r.if(o.parentData,(()=>r.assign(a,i._`${o.parentData}[${o.parentDataProperty}]`)))}function useKeyword(t,r,a){if(void 0===a)throw new Error(`keyword "${r}" failed to compile`);return t.scopeValue("keyword","function"==typeof a?{ref:a}:{ref:a,code:(0,i.stringify)(a)})}r.macroKeywordCode=function macroKeywordCode(t,r){const{gen:a,keyword:o,schema:l,parentSchema:c,it:u}=t,d=r.macro.call(u.self,l,c,u),p=useKeyword(a,o,d);!1!==u.opts.validateSchema&&u.self.validateSchema(d,!0);const h=a.name("valid");t.subschema({schema:d,schemaPath:i.nil,errSchemaPath:`${u.errSchemaPath}/${o}`,topSchemaRef:p,compositeRule:!0},h),t.pass(h,(()=>t.error(!0)))},r.funcKeywordCode=function funcKeywordCode(t,r){var a;const{gen:u,keyword:d,schema:p,parentSchema:h,$data:m,it:y}=t;!function checkAsyncKeyword({schemaEnv:t},r){if(r.async&&!t.$async)throw new Error("async keyword in sync schema")}(y,r);const g=!m&&r.compile?r.compile.call(y.self,p,h,y):r.validate,v=useKeyword(u,d,g),b=u.let("valid");function assignValid(a=(r.async?i._`await `:i.nil)){const c=y.opts.passContext?o.default.this:o.default.self,d=!("compile"in r&&!m||!1===r.schema);u.assign(b,i._`${a}${(0,l.callValidateCode)(t,v,c,d)}`,r.modifying)}function reportErrs(t){var a;u.if((0,i.not)(null!==(a=r.valid)&&void 0!==a?a:b),t)}t.block$data(b,(function validateKeyword(){if(!1===r.errors)assignValid(),r.modifying&&modifyData(t),reportErrs((()=>t.error()));else{const a=r.async?function validateAsync(){const t=u.let("ruleErrs",null);return u.try((()=>assignValid(i._`await `)),(r=>u.assign(b,!1).if(i._`${r} instanceof ${y.ValidationError}`,(()=>u.assign(t,i._`${r}.errors`)),(()=>u.throw(r))))),t}():function validateSync(){const t=i._`${v}.errors`;return u.assign(t,null),assignValid(i.nil),t}();r.modifying&&modifyData(t),reportErrs((()=>function addErrs(t,r){const{gen:a}=t;a.if(i._`Array.isArray(${r})`,(()=>{a.assign(o.default.vErrors,i._`${o.default.vErrors} === null ? ${r} : ${o.default.vErrors}.concat(${r})`).assign(o.default.errors,i._`${o.default.vErrors}.length`),(0,c.extendErrors)(t)}),(()=>t.error()))}(t,a)))}})),t.ok(null!==(a=r.valid)&&void 0!==a?a:b)},r.validSchemaType=function validSchemaType(t,r,a=!1){return!r.length||r.some((r=>"array"===r?Array.isArray(t):"object"===r?t&&"object"==typeof t&&!Array.isArray(t):typeof t==r||a&&void 0===t))},r.validateKeywordUsage=function validateKeywordUsage({schema:t,opts:r,self:a,errSchemaPath:i},o,l){if(Array.isArray(o.keyword)?!o.keyword.includes(l):o.keyword!==l)throw new Error("ajv implementation error");const c=o.dependencies;if(null==c?void 0:c.some((r=>!Object.prototype.hasOwnProperty.call(t,r))))throw new Error(`parent schema must have dependencies of ${l}: ${c.join(",")}`);if(o.validateSchema){if(!o.validateSchema(t[l])){const t=`keyword "${l}" value is invalid at path "${i}": `+a.errorsText(o.validateSchema.errors);if("log"!==r.validateSchema)throw new Error(t);a.logger.error(t)}}}},13099:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.extendSubschemaMode=r.extendSubschemaData=r.getSubschema=void 0;const i=a(93487),o=a(76776);r.getSubschema=function getSubschema(t,{keyword:r,schemaProp:a,schema:l,schemaPath:c,errSchemaPath:u,topSchemaRef:d}){if(void 0!==r&&void 0!==l)throw new Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==r){const l=t.schema[r];return void 0===a?{schema:l,schemaPath:i._`${t.schemaPath}${(0,i.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${r}`}:{schema:l[a],schemaPath:i._`${t.schemaPath}${(0,i.getProperty)(r)}${(0,i.getProperty)(a)}`,errSchemaPath:`${t.errSchemaPath}/${r}/${(0,o.escapeFragment)(a)}`}}if(void 0!==l){if(void 0===c||void 0===u||void 0===d)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:l,schemaPath:c,topSchemaRef:d,errSchemaPath:u}}throw new Error('either "keyword" or "schema" must be passed')},r.extendSubschemaData=function extendSubschemaData(t,r,{dataProp:a,dataPropType:l,data:c,dataTypes:u,propertyName:d}){if(void 0!==c&&void 0!==a)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:p}=r;if(void 0!==a){const{errorPath:c,dataPathArr:u,opts:d}=r;dataContextProps(p.let("data",i._`${r.data}${(0,i.getProperty)(a)}`,!0)),t.errorPath=i.str`${c}${(0,o.getErrorPath)(a,l,d.jsPropertySyntax)}`,t.parentDataProperty=i._`${a}`,t.dataPathArr=[...u,t.parentDataProperty]}if(void 0!==c){dataContextProps(c instanceof i.Name?c:p.let("data",c,!0)),void 0!==d&&(t.propertyName=d)}function dataContextProps(a){t.data=a,t.dataLevel=r.dataLevel+1,t.dataTypes=[],r.definedProperties=new Set,t.parentData=r.data,t.dataNames=[...r.dataNames,a]}u&&(t.dataTypes=u)},r.extendSubschemaMode=function extendSubschemaMode(t,{jtdDiscriminator:r,jtdMetadata:a,compositeRule:i,createErrors:o,allErrors:l}){void 0!==i&&(t.compositeRule=i),void 0!==o&&(t.createErrors=o),void 0!==l&&(t.allErrors=l),t.jtdDiscriminator=r,t.jtdMetadata=a}},27159:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.CodeGen=r.Name=r.nil=r.stringify=r.str=r._=r.KeywordCxt=void 0;var i=a(74815);Object.defineProperty(r,"KeywordCxt",{enumerable:!0,get:function(){return i.KeywordCxt}});var o=a(93487);Object.defineProperty(r,"_",{enumerable:!0,get:function(){return o._}}),Object.defineProperty(r,"str",{enumerable:!0,get:function(){return o.str}}),Object.defineProperty(r,"stringify",{enumerable:!0,get:function(){return o.stringify}}),Object.defineProperty(r,"nil",{enumerable:!0,get:function(){return o.nil}}),Object.defineProperty(r,"Name",{enumerable:!0,get:function(){return o.Name}}),Object.defineProperty(r,"CodeGen",{enumerable:!0,get:function(){return o.CodeGen}});const l=a(67426),c=a(6646),u=a(13141),d=a(25173),p=a(93487),h=a(32531),m=a(50453),y=a(76776),g=a(64775),v=a(43589),defaultRegExp=(t,r)=>new RegExp(t,r);defaultRegExp.code="new RegExp";const b=["removeAdditional","useDefaults","coerceTypes"],R=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),C={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},I={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};function requiredOptions(t){var r,a,i,o,l,c,u,d,p,h,m,y,g,b,R,C,I,w,S,O,j,D,T,P,A;const E=t.strict,M=null===(r=t.code)||void 0===r?void 0:r.optimize,$=!0===M||void 0===M?1:M||0,x=null!==(i=null===(a=t.code)||void 0===a?void 0:a.regExp)&&void 0!==i?i:defaultRegExp,k=null!==(o=t.uriResolver)&&void 0!==o?o:v.default;return{strictSchema:null===(c=null!==(l=t.strictSchema)&&void 0!==l?l:E)||void 0===c||c,strictNumbers:null===(d=null!==(u=t.strictNumbers)&&void 0!==u?u:E)||void 0===d||d,strictTypes:null!==(h=null!==(p=t.strictTypes)&&void 0!==p?p:E)&&void 0!==h?h:"log",strictTuples:null!==(y=null!==(m=t.strictTuples)&&void 0!==m?m:E)&&void 0!==y?y:"log",strictRequired:null!==(b=null!==(g=t.strictRequired)&&void 0!==g?g:E)&&void 0!==b&&b,code:t.code?{...t.code,optimize:$,regExp:x}:{optimize:$,regExp:x},loopRequired:null!==(R=t.loopRequired)&&void 0!==R?R:200,loopEnum:null!==(C=t.loopEnum)&&void 0!==C?C:200,meta:null===(I=t.meta)||void 0===I||I,messages:null===(w=t.messages)||void 0===w||w,inlineRefs:null===(S=t.inlineRefs)||void 0===S||S,schemaId:null!==(O=t.schemaId)&&void 0!==O?O:"$id",addUsedSchema:null===(j=t.addUsedSchema)||void 0===j||j,validateSchema:null===(D=t.validateSchema)||void 0===D||D,validateFormats:null===(T=t.validateFormats)||void 0===T||T,unicodeRegExp:null===(P=t.unicodeRegExp)||void 0===P||P,int32range:null===(A=t.int32range)||void 0===A||A,uriResolver:k}}class Ajv{constructor(t={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...requiredOptions(t)};const{es5:r,lines:a}=this.opts.code;this.scope=new p.ValueScope({scope:{},prefixes:R,es5:r,lines:a}),this.logger=function getLogger(t){if(!1===t)return w;if(void 0===t)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}(t.logger);const i=t.validateFormats;t.validateFormats=!1,this.RULES=(0,u.getRules)(),checkOptions.call(this,C,t,"NOT SUPPORTED"),checkOptions.call(this,I,t,"DEPRECATED","warn"),this._metaOpts=getMetaSchemaOptions.call(this),t.formats&&addInitialFormats.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&addInitialKeywords.call(this,t.keywords),"object"==typeof t.meta&&this.addMetaSchema(t.meta),addInitialSchemas.call(this),t.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:t,meta:r,schemaId:a}=this.opts;let i=g;"id"===a&&(i={...g},i.id=i.$id,delete i.$id),r&&t&&this.addMetaSchema(i,i[a],!1)}defaultMeta(){const{meta:t,schemaId:r}=this.opts;return this.opts.defaultMeta="object"==typeof t?t[r]||t:void 0}validate(t,r){let a;if("string"==typeof t){if(a=this.getSchema(t),!a)throw new Error(`no schema with key or ref "${t}"`)}else a=this.compile(t);const i=a(r);return"$async"in a||(this.errors=a.errors),i}compile(t,r){const a=this._addSchema(t,r);return a.validate||this._compileSchemaEnv(a)}compileAsync(t,r){if("function"!=typeof this.opts.loadSchema)throw new Error("options.loadSchema should be a function");const{loadSchema:a}=this.opts;return runCompileAsync.call(this,t,r);async function runCompileAsync(t,r){await loadMetaSchema.call(this,t.$schema);const a=this._addSchema(t,r);return a.validate||_compileAsync.call(this,a)}async function loadMetaSchema(t){t&&!this.getSchema(t)&&await runCompileAsync.call(this,{$ref:t},!0)}async function _compileAsync(t){try{return this._compileSchemaEnv(t)}catch(r){if(!(r instanceof c.default))throw r;return checkLoaded.call(this,r),await loadMissingSchema.call(this,r.missingSchema),_compileAsync.call(this,t)}}function checkLoaded({missingSchema:t,missingRef:r}){if(this.refs[t])throw new Error(`AnySchema ${t} is loaded but ${r} cannot be resolved`)}async function loadMissingSchema(t){const a=await _loadSchema.call(this,t);this.refs[t]||await loadMetaSchema.call(this,a.$schema),this.refs[t]||this.addSchema(a,t,r)}async function _loadSchema(t){const r=this._loading[t];if(r)return r;try{return await(this._loading[t]=a(t))}finally{delete this._loading[t]}}}addSchema(t,r,a,i=this.opts.validateSchema){if(Array.isArray(t)){for(const r of t)this.addSchema(r,void 0,a,i);return this}let o;if("object"==typeof t){const{schemaId:r}=this.opts;if(o=t[r],void 0!==o&&"string"!=typeof o)throw new Error(`schema ${r} must be string`)}return r=(0,h.normalizeId)(r||o),this._checkUnique(r),this.schemas[r]=this._addSchema(t,a,r,i,!0),this}addMetaSchema(t,r,a=this.opts.validateSchema){return this.addSchema(t,r,!0,a),this}validateSchema(t,r){if("boolean"==typeof t)return!0;let a;if(a=t.$schema,void 0!==a&&"string"!=typeof a)throw new Error("$schema must be a string");if(a=a||this.opts.defaultMeta||this.defaultMeta(),!a)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const i=this.validate(a,t);if(!i&&r){const t="schema is invalid: "+this.errorsText();if("log"!==this.opts.validateSchema)throw new Error(t);this.logger.error(t)}return i}getSchema(t){let r;for(;"string"==typeof(r=getSchEnv.call(this,t));)t=r;if(void 0===r){const{schemaId:a}=this.opts,i=new d.SchemaEnv({schema:{},schemaId:a});if(r=d.resolveSchema.call(this,i,t),!r)return;this.refs[t]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(t){if(t instanceof RegExp)return this._removeAllSchemas(this.schemas,t),this._removeAllSchemas(this.refs,t),this;switch(typeof t){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const r=getSchEnv.call(this,t);return"object"==typeof r&&this._cache.delete(r.schema),delete this.schemas[t],delete this.refs[t],this}case"object":{const r=t;this._cache.delete(r);let a=t[this.opts.schemaId];return a&&(a=(0,h.normalizeId)(a),delete this.schemas[a],delete this.refs[a]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(const r of t)this.addKeyword(r);return this}addKeyword(t,r){let a;if("string"==typeof t)a=t,"object"==typeof r&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=a);else{if("object"!=typeof t||void 0!==r)throw new Error("invalid addKeywords parameters");if(a=(r=t).keyword,Array.isArray(a)&&!a.length)throw new Error("addKeywords: keyword must be string or non-empty array")}if(checkKeyword.call(this,a,r),!r)return(0,y.eachItem)(a,(t=>addRule.call(this,t))),this;keywordMetaschema.call(this,r);const i={...r,type:(0,m.getJSONTypes)(r.type),schemaType:(0,m.getJSONTypes)(r.schemaType)};return(0,y.eachItem)(a,0===i.type.length?t=>addRule.call(this,t,i):t=>i.type.forEach((r=>addRule.call(this,t,i,r)))),this}getKeyword(t){const r=this.RULES.all[t];return"object"==typeof r?r.definition:!!r}removeKeyword(t){const{RULES:r}=this;delete r.keywords[t],delete r.all[t];for(const a of r.rules){const r=a.rules.findIndex((r=>r.keyword===t));r>=0&&a.rules.splice(r,1)}return this}addFormat(t,r){return"string"==typeof r&&(r=new RegExp(r)),this.formats[t]=r,this}errorsText(t=this.errors,{separator:r=", ",dataVar:a="data"}={}){return t&&0!==t.length?t.map((t=>`${a}${t.instancePath} ${t.message}`)).reduce(((t,a)=>t+r+a)):"No errors"}$dataMetaSchema(t,r){const a=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(const i of r){const r=i.split("/").slice(1);let o=t;for(const t of r)o=o[t];for(const t in a){const r=a[t];if("object"!=typeof r)continue;const{$data:i}=r.definition,l=o[t];i&&l&&(o[t]=schemaOrData(l))}}return t}_removeAllSchemas(t,r){for(const a in t){const i=t[a];r&&!r.test(a)||("string"==typeof i?delete t[a]:i&&!i.meta&&(this._cache.delete(i.schema),delete t[a]))}}_addSchema(t,r,a,i=this.opts.validateSchema,o=this.opts.addUsedSchema){let l;const{schemaId:c}=this.opts;if("object"==typeof t)l=t[c];else{if(this.opts.jtd)throw new Error("schema must be object");if("boolean"!=typeof t)throw new Error("schema must be object or boolean")}let u=this._cache.get(t);if(void 0!==u)return u;a=(0,h.normalizeId)(l||a);const p=h.getSchemaRefs.call(this,t,a);return u=new d.SchemaEnv({schema:t,schemaId:c,meta:r,baseId:a,localRefs:p}),this._cache.set(u.schema,u),o&&!a.startsWith("#")&&(a&&this._checkUnique(a),this.refs[a]=u),i&&this.validateSchema(t,!0),u}_checkUnique(t){if(this.schemas[t]||this.refs[t])throw new Error(`schema with key or id "${t}" already exists`)}_compileSchemaEnv(t){if(t.meta?this._compileMetaSchema(t):d.compileSchema.call(this,t),!t.validate)throw new Error("ajv implementation error");return t.validate}_compileMetaSchema(t){const r=this.opts;this.opts=this._metaOpts;try{d.compileSchema.call(this,t)}finally{this.opts=r}}}function checkOptions(t,r,a,i="error"){for(const o in t){const l=o;l in r&&this.logger[i](`${a}: option ${o}. ${t[l]}`)}}function getSchEnv(t){return t=(0,h.normalizeId)(t),this.schemas[t]||this.refs[t]}function addInitialSchemas(){const t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(const r in t)this.addSchema(t[r],r)}function addInitialFormats(){for(const t in this.opts.formats){const r=this.opts.formats[t];r&&this.addFormat(t,r)}}function addInitialKeywords(t){if(Array.isArray(t))this.addVocabulary(t);else{this.logger.warn("keywords option as map is deprecated, pass array");for(const r in t){const a=t[r];a.keyword||(a.keyword=r),this.addKeyword(a)}}}function getMetaSchemaOptions(){const t={...this.opts};for(const r of b)delete t[r];return t}r.default=Ajv,Ajv.ValidationError=l.default,Ajv.MissingRefError=c.default;const w={log(){},warn(){},error(){}};const S=/^[a-z_$][a-z0-9_$:-]*$/i;function checkKeyword(t,r){const{RULES:a}=this;if((0,y.eachItem)(t,(t=>{if(a.keywords[t])throw new Error(`Keyword ${t} is already defined`);if(!S.test(t))throw new Error(`Keyword ${t} has invalid name`)})),r&&r.$data&&!("code"in r)&&!("validate"in r))throw new Error('$data keyword must have "code" or "validate" function')}function addRule(t,r,a){var i;const o=null==r?void 0:r.post;if(a&&o)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:l}=this;let c=o?l.post:l.rules.find((({type:t})=>t===a));if(c||(c={type:a,rules:[]},l.rules.push(c)),l.keywords[t]=!0,!r)return;const u={keyword:t,definition:{...r,type:(0,m.getJSONTypes)(r.type),schemaType:(0,m.getJSONTypes)(r.schemaType)}};r.before?addBeforeRule.call(this,c,u,r.before):c.rules.push(u),l.all[t]=u,null===(i=r.implements)||void 0===i||i.forEach((t=>this.addKeyword(t)))}function addBeforeRule(t,r,a){const i=t.rules.findIndex((t=>t.keyword===a));i>=0?t.rules.splice(i,0,r):(t.rules.push(r),this.logger.warn(`rule ${a} is not defined`))}function keywordMetaschema(t){let{metaSchema:r}=t;void 0!==r&&(t.$data&&this.opts.$data&&(r=schemaOrData(r)),t.validateSchema=this.compile(r,!0))}const O={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function schemaOrData(t){return{anyOf:[t,O]}}},43510:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});const i=a(64063);i.code='require("ajv/dist/runtime/equal").default',r.default=i},74499:(t,r)=>{"use strict";function ucs2length(t){const r=t.length;let a,i=0,o=0;for(;o<r;)i++,a=t.charCodeAt(o++),a>=55296&&a<=56319&&o<r&&(a=t.charCodeAt(o),56320==(64512&a)&&o++);return i}Object.defineProperty(r,"__esModule",{value:!0}),r.default=ucs2length,ucs2length.code='require("ajv/dist/runtime/ucs2length").default'},43589:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});const i=a(60540);i.code='require("ajv/dist/runtime/uri").default',r.default=i},67426:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});class ValidationError extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}}r.default=ValidationError},4783:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.validateAdditionalItems=void 0;const i=a(93487),o=a(76776),l={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:t}})=>i.str`must NOT have more than ${t} items`,params:({params:{len:t}})=>i._`{limit: ${t}}`},code(t){const{parentSchema:r,it:a}=t,{items:i}=r;Array.isArray(i)?validateAdditionalItems(t,i):(0,o.checkStrictMode)(a,'"additionalItems" is ignored when "items" is not an array of schemas')}};function validateAdditionalItems(t,r){const{gen:a,schema:l,data:c,keyword:u,it:d}=t;d.items=!0;const p=a.const("len",i._`${c}.length`);if(!1===l)t.setParams({len:r.length}),t.pass(i._`${p} <= ${r.length}`);else if("object"==typeof l&&!(0,o.alwaysValidSchema)(d,l)){const l=a.var("valid",i._`${p} <= ${r.length}`);a.if((0,i.not)(l),(()=>function validateItems(l){a.forRange("i",r.length,p,(r=>{t.subschema({keyword:u,dataProp:r,dataPropType:o.Type.Num},l),d.allErrors||a.if((0,i.not)(l),(()=>a.break()))}))}(l))),t.ok(l)}}r.validateAdditionalItems=validateAdditionalItems,r.default=l},69351:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});const i=a(10412),o=a(93487),l=a(22141),c=a(76776),u={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:t})=>o._`{additionalProperty: ${t.additionalProperty}}`},code(t){const{gen:r,schema:a,parentSchema:u,data:d,errsCount:p,it:h}=t;if(!p)throw new Error("ajv implementation error");const{allErrors:m,opts:y}=h;if(h.props=!0,"all"!==y.removeAdditional&&(0,c.alwaysValidSchema)(h,a))return;const g=(0,i.allSchemaProperties)(u.properties),v=(0,i.allSchemaProperties)(u.patternProperties);function deleteAdditional(t){r.code(o._`delete ${d}[${t}]`)}function additionalPropertyCode(i){if("all"===y.removeAdditional||y.removeAdditional&&!1===a)deleteAdditional(i);else{if(!1===a)return t.setParams({additionalProperty:i}),t.error(),void(m||r.break());if("object"==typeof a&&!(0,c.alwaysValidSchema)(h,a)){const a=r.name("valid");"failing"===y.removeAdditional?(applyAdditionalSchema(i,a,!1),r.if((0,o.not)(a),(()=>{t.reset(),deleteAdditional(i)}))):(applyAdditionalSchema(i,a),m||r.if((0,o.not)(a),(()=>r.break())))}}}function applyAdditionalSchema(r,a,i){const o={keyword:"additionalProperties",dataProp:r,dataPropType:c.Type.Str};!1===i&&Object.assign(o,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(o,a)}!function checkAdditionalProperties(){r.forIn("key",d,(a=>{g.length||v.length?r.if(function isAdditional(a){let l;if(g.length>8){const t=(0,c.schemaRefOrVal)(h,u.properties,"properties");l=(0,i.isOwnProperty)(r,t,a)}else l=g.length?(0,o.or)(...g.map((t=>o._`${a} === ${t}`))):o.nil;v.length&&(l=(0,o.or)(l,...v.map((r=>o._`${(0,i.usePattern)(t,r)}.test(${a})`))));return(0,o.not)(l)}(a),(()=>additionalPropertyCode(a))):additionalPropertyCode(a)}))}(),t.ok(o._`${p} === ${l.default.errors}`)}};r.default=u},71125:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});const i=a(76776),o={keyword:"allOf",schemaType:"array",code(t){const{gen:r,schema:a,it:o}=t;if(!Array.isArray(a))throw new Error("ajv implementation error");const l=r.name("valid");a.forEach(((r,a)=>{if((0,i.alwaysValidSchema)(o,r))return;const c=t.subschema({keyword:"allOf",schemaProp:a},l);t.ok(l),t.mergeEvaluated(c)}))}};r.default=o},50019:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});const i={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:a(10412).validateUnion,error:{message:"must match a schema in anyOf"}};r.default=i},79864:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});const i=a(93487),o=a(76776),l={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:t,max:r}})=>void 0===r?i.str`must contain at least ${t} valid item(s)`:i.str`must contain at least ${t} and no more than ${r} valid item(s)`,params:({params:{min:t,max:r}})=>void 0===r?i._`{minContains: ${t}}`:i._`{minContains: ${t}, maxContains: ${r}}`},code(t){const{gen:r,schema:a,parentSchema:l,data:c,it:u}=t;let d,p;const{minContains:h,maxContains:m}=l;u.opts.next?(d=void 0===h?1:h,p=m):d=1;const y=r.const("len",i._`${c}.length`);if(t.setParams({min:d,max:p}),void 0===p&&0===d)return void(0,o.checkStrictMode)(u,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==p&&d>p)return(0,o.checkStrictMode)(u,'"minContains" > "maxContains" is always invalid'),void t.fail();if((0,o.alwaysValidSchema)(u,a)){let r=i._`${y} >= ${d}`;return void 0!==p&&(r=i._`${r} && ${y} <= ${p}`),void t.pass(r)}u.items=!0;const g=r.name("valid");function validateItemsWithCount(){const t=r.name("_valid"),a=r.let("count",0);validateItems(t,(()=>r.if(t,(()=>function checkLimits(t){r.code(i._`${t}++`),void 0===p?r.if(i._`${t} >= ${d}`,(()=>r.assign(g,!0).break())):(r.if(i._`${t} > ${p}`,(()=>r.assign(g,!1).break())),1===d?r.assign(g,!0):r.if(i._`${t} >= ${d}`,(()=>r.assign(g,!0))))}(a)))))}function validateItems(a,i){r.forRange("i",0,y,(r=>{t.subschema({keyword:"contains",dataProp:r,dataPropType:o.Type.Num,compositeRule:!0},a),i()}))}void 0===p&&1===d?validateItems(g,(()=>r.if(g,(()=>r.break())))):0===d?(r.let(g,!0),void 0!==p&&r.if(i._`${c}.length > 0`,validateItemsWithCount)):(r.let(g,!1),validateItemsWithCount()),t.result(g,(()=>t.reset()))}};r.default=l},67772:(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.validateSchemaDeps=r.validatePropertyDeps=r.error=void 0;const i=a(93487),o=a(76776),l=a(10412);r.error={message:({params:{property:t,depsCount:r,deps:a}})=>{const o=1===r?"property":"properties";return i.str`must have ${o} ${a} when property ${t} is present`},params:({params:{property:t,depsCount:r,deps:a,missingProperty:o}})=>i._`{property: ${t},
|