@communecter/cocolight-api-client 1.0.7 → 1.0.8

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.
@@ -1 +1,2 @@
1
- import*as e from"events";import*as t from"ajv";import*as o from"ajv-formats";import*as n from"axios";import*as r from"axios-retry";import*as i from"ejson";import*as s from"pino";var a={d:(e,t)=>{for(var o in t)a.o(t,o)&&!a.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},m={};a.d(m,{A:()=>C});class c extends Error{constructor(e,t,o){super(e),this.name="ApiError",this.status=t,this.details=o}}class p extends c{constructor(e,t,o){super(e,t,o),this.name="ApiClientError"}}class l extends c{constructor(e){super(e,503),this.name="CircuitBreakerError"}}class d extends Error{constructor(e,t,o,n=null){super(e),this.name="ApiResponseError",this.status=t,this.responseData=o,this.details=n}}class u extends c{constructor(e,t,o){super(e,t,o),this.name="ApiAuthenticationError"}}const y={async resolveId(e){return this.apiClient.safeCall((async()=>{if(!this.id&&this.slug){const t=await this.apiClient.callEndpoint("GET_ELEMENTS_KEY",{pathParams:{slug:this.slug}});if(!0!==t?.data?.result)throw new d(`Impossible de récupérer l'identifiant pour le slug ${this.slug}`,t.status,t.data);if(!t?.data?.contextId||t?.data?.contextType!==e)throw new d(`Le slug ${this.slug} ne correspond pas à un ${e}`,t.status,t.data);this.id=t.data.contextId}return this.id}))},async getPublicProfile(){return this.apiClient.safeCall((async()=>(await this.resolveId(this.getEntityType()),this.apiClient.callEndpoint("GET_ELEMENTS_ABOUT",{pathParams:{id:this.id}}))))}};class f{#e;#t;#o=null;constructor(e,{id:t,slug:o}={}){if(!t&&!o)throw new Error("Vous devez fournir un id ou un slug pour créer un User.");this.apiClient=e,this.#e=t||null,this.#t=o||null}get id(){return this.#e}get slug(){return this.#t}_slug(e){this.#t=e}get isConnected(){return this.apiClient.isConnected}get data(){return this.#o}_setData(e){this.#o=e}get userId(){return this.apiClient.userId}get isMe(){return this.isConnected&&this.userId===this.id}getEntityType(){return"organizations"}async getProfile(){return this.apiClient.safeCall((async()=>{const e=await this.getPublicProfile();return this._setData(e.data),e.data}))}}Object.assign(f.prototype,y);class h{#e;#t;#o=null;constructor(e,{id:t,slug:o}={}){if(!t&&!o)throw new Error("Vous devez fournir un id ou un slug pour créer un User.");this.apiClient=e,this.#e=t||null,this.#t=o||null}get id(){return this.#e}get slug(){return this.#t}_slug(e){this.#t=e}get isConnected(){return this.apiClient.isConnected}get data(){return this.#o}_setData(e){this.#o=e}get userId(){return this.apiClient.userId}get isMe(){return this.isConnected&&this.userId===this.id}getEntityType(){return"projects"}async getProfile(){return this.apiClient.safeCall((async()=>{const e=await this.getPublicProfile();return this._setData(e.data),e.data}))}}Object.assign(h.prototype,y);class g{#e;#t;#o;constructor(e,{id:t,slug:o}={},n={}){if(!t&&!o)throw new Error("Vous devez fournir un id ou un slug pour créer un User.");this.apiClient=e,this.#e=t||null,this.#t=o||null,this.#o=n}get id(){return this.#e}get slug(){return this.#t}_slug(e){this.#t=e}get isConnected(){return this.apiClient.isConnected}get data(){return this.#o}_setData(e){this.#o=e}getEntityType(){return"citoyens"}get userId(){return this.apiClient.userId}get isMe(){return this.isConnected&&this.userId===this.id}async getProfile(){return this.apiClient.safeCall((async()=>this.isMe?(await this.apiClient.callEndpoint("ME_INFO_URL",{})).data:(await this.getPublicProfile()).data))}}Object.assign(g.prototype,y);const b=(T={EventEmitter:()=>e.EventEmitter},w={},a.d(w,T),w);var T,w;const P=(e=>{var t={};return a.d(t,e),t})({default:()=>t.default}),_=(e=>{var t={};return a.d(t,e),t})({default:()=>o.default}),j=(e=>{var t={};return a.d(t,e),t})({default:()=>n.default}),O=(e=>{var t={};return a.d(t,e),t})({default:()=>r.default}),A=(e=>{var t={};return a.d(t,e),t})({default:()=>i.default});class I extends Error{}I.prototype.name="InvalidTokenError";const k=(e=>{var t={};return a.d(t,e),t})({default:()=>s.default}),v={_looksLikeObjectID:e=>24===e.length&&/^[0-9a-f]*$/.test(e),ObjectID:class{constructor(e){if(e){if(e=e.toLowerCase(),!v._looksLikeObjectID(e))throw new Error("Invalid hexadecimal string for creating an ObjectID");this._str=e}}equals(e){return e instanceof v.ObjectID&&this.valueOf()===e.valueOf()}toString(){return`ObjectID("${this._str}")`}clone(){return new v.ObjectID(this._str)}typeName(){return"oid"}getTimestamp(){return Number.parseInt(this._str.substr(0,8),16)}valueOf(){return this._str}toJSONValue(){return this.valueOf()}toHexString(){return this.valueOf()}}},S=v,$={common1:{type:"string"},common2:{format:"email",type:"string"},common3:{type:"boolean"},common4:{format:"uri",type:"string"},common5:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$",type:"string"},common6:{additionalProperties:!1,properties:{id:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$",type:"string"}},required:["id"],type:"object"},common7:{id:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$",type:"string"}},common8:{default:"",type:"string"},common9:{pattern:"^[a-f0-9]{24}$",type:"string"},common10:{const:"citoyens"},common11:{properties:{value:{type:"boolean"}}},common12:{value:{type:"boolean"}},common13:{},common14:{else:{properties:{id:{pattern:"^[a-f0-9]{24}$",type:"string"}}},if:{properties:{typeElement:{const:"citoyens"}}},then:{properties:{id:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$",type:"string"}}}},common15:{properties:{id:{pattern:"^[a-f0-9]{24}$",type:"string"}}},common16:{id:{pattern:"^[a-f0-9]{24}$",type:"string"}},common17:{properties:{typeElement:{const:"citoyens"}}},common18:{typeElement:{const:"citoyens"}},common19:{properties:{id:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$",type:"string"}}},common20:{not:{type:"null"}},common21:{type:"null"},common22:{default:"citoyens",enum:["citoyens","projects","organizations"],type:"string"},common23:{anyOf:[{items:{type:"string"},type:"array"},{enum:[""],type:"string"}]},common24:{items:{type:"string"},type:"array"},common25:{enum:[""],type:"string"},common26:{properties:{name:{not:{type:"null"}}},required:["name"]},common27:{name:{not:{type:"null"}}},common28:{properties:{url:{not:{type:"null"}}},required:["url"]},common29:{url:{not:{type:"null"}}},common30:{properties:{tags:{not:{type:"null"}}},required:["tags"]},common31:{tags:{not:{type:"null"}}},common32:{properties:{email:{not:{type:"null"}}},required:["email"]},common33:{email:{not:{type:"null"}}},common34:{const:"info",default:"info",type:"string"},common35:{$ref:"#/$defs/sharedFields/email"},common36:{$ref:"#/$defs/sharedFields/name"},common37:{$ref:"#/$defs/sharedFields/tags"},common38:{$ref:"#/$defs/sharedFields/url"},common39:{const:"projects"},common40:{const:"organizations"},common41:{$ref:"#/$defs/socialField"},common42:{properties:{id:{pattern:"^[a-f0-9]{24}$"}}},common43:{id:{pattern:"^[a-f0-9]{24}$"}},common44:{pattern:"^[a-f0-9]{24}$"},common45:{minLength:0,type:"string"},common46:{type:["string","number"]},common47:{type:"number"},common48:{const:!0,default:!0,type:"boolean"},common49:{properties:{id:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}}},common50:{id:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}},common51:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"},common52:{maxLength:100,minLength:3,pattern:"^[a-zA-Z0-9]+$",type:"string"},common53:{properties:{type:{const:"citoyens"}}},common54:{type:{const:"citoyens"}},common55:{additionalProperties:!1,else:{properties:{ownerId:{pattern:"^[a-f0-9]{24}$"}}},if:{properties:{folder:{const:"citoyens"}}},properties:{folder:{default:"citoyens",enum:["citoyens","projects","organizations"],type:"string"},ownerId:{type:"string"}},required:["folder","ownerId"],then:{properties:{ownerId:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}}},type:"object"},common56:{properties:{ownerId:{pattern:"^[a-f0-9]{24}$"}}},common57:{ownerId:{pattern:"^[a-f0-9]{24}$"}},common58:{properties:{folder:{const:"citoyens"}}},common59:{folder:{const:"citoyens"}},common60:{folder:{default:"citoyens",enum:["citoyens","projects","organizations"],type:"string"},ownerId:{type:"string"}},common61:{properties:{ownerId:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}}},common62:{ownerId:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}},common63:{additionalProperties:!1,else:{properties:{id:{pattern:"^[a-f0-9]{24}$"}}},if:{properties:{type:{const:"citoyens"}}},properties:{id:{type:"string"},type:{default:"citoyens",enum:["citoyens","projects","organizations"],type:"string"}},required:["type","id"],then:{properties:{id:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}}},type:"object"},common64:{id:{type:"string"},type:{default:"citoyens",enum:["citoyens","projects","organizations"],type:"string"}},common65:{properties:{parentId:{pattern:"^[a-f0-9]{24}$"}}},common66:{parentId:{pattern:"^[a-f0-9]{24}$"}},common67:{properties:{parentType:{const:"citoyens"}}},common68:{parentType:{const:"citoyens"}},common69:{properties:{parentId:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}}},common70:{parentId:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}},common71:{default:!0,type:"boolean"},common72:{required:["text"]},common73:{required:["mediaImg"]},common74:{required:["mediaFile"]},common75:{additionalProperties:!1,properties:{countFiles:{type:"number"},files:{items:{type:"string"},type:"array"}},required:["countFiles","files"],type:"object"},common76:{countFiles:{type:"number"},files:{items:{type:"string"},type:"array"}},common77:{additionalProperties:!1,properties:{countImages:{type:"number"},images:{items:{type:"string"},type:"array"}},required:["countImages","images"],type:"object"},common78:{countImages:{type:"number"},images:{items:{type:"string"},type:"array"}},common79:{additionalProperties:!1,patternProperties:{"^[0-9]+$":{additionalProperties:!1,properties:{count:{type:"number"},id:{type:"string"},name:{type:"string"},slug:{type:"string"},type:{type:"string"},value:{type:"string"}},required:["id","name","slug","type","value","count"],type:"object"}},type:"object"},common80:{"^[0-9]+$":{additionalProperties:!1,properties:{count:{type:"number"},id:{type:"string"},name:{type:"string"},slug:{type:"string"},type:{type:"string"},value:{type:"string"}},required:["id","name","slug","type","value","count"],type:"object"}},common81:{additionalProperties:!1,properties:{count:{type:"number"},id:{type:"string"},name:{type:"string"},slug:{type:"string"},type:{type:"string"},value:{type:"string"}},required:["id","name","slug","type","value","count"],type:"object"},common82:{count:{type:"number"},id:{type:"string"},name:{type:"string"},slug:{type:"string"},type:{type:"string"},value:{type:"string"}},common83:{default:"public",enum:["public","private","restricted"],type:"string"},common84:{const:"news",default:"news",type:"string"},common85:{additionalProperties:!1,properties:{id:{pattern:"^[a-f0-9]{24}$",type:"string"}},required:["id"],type:"object"},common86:{default:!1,type:"boolean"},common87:{additionalProperties:!1,properties:{id:{pattern:"^[a-f0-9]{24}$",type:"string"},type:{default:"news",enum:["news"],type:"string"}},required:["type","id"],type:"object"},common88:{id:{pattern:"^[a-f0-9]{24}$",type:"string"},type:{default:"news",enum:["news"],type:"string"}},common89:{default:"news",enum:["news"],type:"string"},common90:{items:{additionalProperties:!1,properties:{count:{type:"number"},id:{pattern:"^[a-f0-9]{24}$",type:"string"},name:{type:"string"},slug:{type:"string"},type:{type:"string"},value:{type:"string"}},required:["id","name","slug","type","value","count"],type:"object"},type:"array"},common91:{additionalProperties:!1,properties:{count:{type:"number"},id:{pattern:"^[a-f0-9]{24}$",type:"string"},name:{type:"string"},slug:{type:"string"},type:{type:"string"},value:{type:"string"}},required:["id","name","slug","type","value","count"],type:"object"},common92:{count:{type:"number"},id:{pattern:"^[a-f0-9]{24}$",type:"string"},name:{type:"string"},slug:{type:"string"},type:{type:"string"},value:{type:"string"}},common93:{enum:["NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects","citoyens","poi"],type:"string"},common94:{const:!1,default:!1,type:"boolean"},common95:{const:"",default:"",type:"string"},common96:{additionalProperties:!1,properties:{indexMax:{type:"number"},indexMin:{type:"number"}},required:["indexMin","indexMax"],type:"object"},common97:{indexMax:{type:"number"},indexMin:{type:"number"}},common98:{default:0,minimum:0,type:"integer"},common99:{const:["projects"],default:["projects"],items:{enum:["projects"],type:"string"},type:"array"},common100:{enum:["projects"],type:"string"},common101:{$exists:!0},common102:{additionalProperties:!1,properties:{$exists:{const:!0}},required:["$exists"],type:"object"},common103:{$exists:{const:!0}},common104:{const:!0},common105:{default:30,type:"integer"},common106:{const:["poi"],default:["poi"],items:{enum:["poi"],type:"string"},type:"array"},common107:{enum:["poi"],type:"string"},common108:{const:["NGO","Cooperative","LocalBusiness","Group","GovernmentOrganization"],default:["NGO","Cooperative","LocalBusiness","Group","GovernmentOrganization"],items:{enum:["NGO","Cooperative","LocalBusiness","Group","GovernmentOrganization"],type:"string"},type:"array"},common109:{enum:["NGO","Cooperative","LocalBusiness","Group","GovernmentOrganization"],type:"string"},common110:{$exists:!1},common111:{additionalProperties:!1,properties:{$exists:{const:!1}},required:["$exists"],type:"object"},common112:{$exists:{const:!1}},common113:{const:!1},common114:{const:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],default:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],items:{enum:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],type:"string"},type:"array"},common115:{enum:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],type:"string"},common116:{additionalProperties:!1,properties:{$exists:{default:!1,type:"boolean"}},required:["$exists"],type:"object"},common117:{$exists:{default:!1,type:"boolean"}},common118:{additionalProperties:!1,properties:{$in:{items:{type:"string"},minItems:1,type:"array"}},required:["$in"],type:"object"},common119:{$in:{items:{type:"string"},minItems:1,type:"array"}},common120:{items:{type:"string"},minItems:1,type:"array"},common121:{const:["citoyens"],default:["citoyens"],items:{enum:["citoyens"],type:"string"},type:"array"},common122:{enum:["citoyens"],type:"string"},common123:{const:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects"],default:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects"],items:{enum:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects"],type:"string"},type:"array"},common124:{enum:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects"],type:"string"},common125:{not:{propertyNames:{pattern:"^(?!links\\.followers\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}}},common126:{propertyNames:{pattern:"^(?!links\\.followers\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}},common127:{pattern:"^(?!links\\.followers\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"},common128:{"^links\\.followers\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":{additionalProperties:!1,properties:{$exists:{const:!0}},required:["$exists"],type:"object"},"^links\\.followers\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":{additionalProperties:!1,properties:{$exists:{const:!1}},required:["$exists"],type:"object"},"^links\\.followers\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":{additionalProperties:!1,properties:{$exists:{const:!1}},required:["$exists"],type:"object"}},common129:{not:{propertyNames:{pattern:"^(?!links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}}},common130:{propertyNames:{pattern:"^(?!links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}},common131:{pattern:"^(?!links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"},common132:{const:["badges"],default:["badges"],items:{enum:["badges"],type:"string"},type:"array"},common133:{enum:["badges"],type:"string"},common134:{const:["citoyens","projects","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],default:["citoyens","projects","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],items:{enum:["citoyens","projects","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],type:"string"},type:"array"},common135:{enum:["citoyens","projects","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],type:"string"},common136:{additionalProperties:!1,properties:{$exists:{const:!0,type:"boolean"}},required:["$exists"],type:"object"},common137:{$exists:{const:!0,type:"boolean"}},common138:{const:!0,type:"boolean"},common139:{additionalProperties:!1,properties:{$exists:{const:!1,type:"boolean"}},required:["$exists"],type:"object"},common140:{$exists:{const:!1,type:"boolean"}},common141:{const:!1,type:"boolean"},common142:{"badges\\.(?:[a-f0-9]{24}|@\\w+)\\.attenteEmetteur$":{additionalProperties:!1,properties:{$exists:{const:!1,type:"boolean"}},required:["$exists"],type:"object"},"badges\\.(?:[a-f0-9]{24}|@\\w+)\\.attenteRecepteur$":{additionalProperties:!1,properties:{$exists:{const:!0,type:"boolean"}},required:["$exists"],type:"object"}},common143:{indexMax:30,indexMin:0},common144:{additionalProperties:!1,allOf:[{if:{properties:{parentType:{const:"citoyens"}}},then:{properties:{connectType:{const:"friend",default:"friend"}}}},{if:{properties:{parentType:{const:"organizations"}}},then:{properties:{connectType:{enum:["admin","member"]}}}},{if:{properties:{parentType:{const:"projects"}}},then:{properties:{connectType:{enum:["admin","contributor"]}}}},{if:{properties:{parentType:{const:"events"}}},then:{properties:{connectType:{const:"attendee",default:"attendee"}}}}],properties:{childId:{default:"@userId",pattern:"^([a-f0-9]{24}|@\\w+)$",type:"string"},childType:{const:"citoyens",default:"citoyens",enum:["citoyens"],type:"string"},connectType:{enum:["admin","member","contributor","attendee","friend"],type:"string"},parentId:{pattern:"^[a-f0-9]{24}$",type:"string"},parentType:{enum:["citoyens","organizations","projects","events"],type:"string"}},required:["childId","childType","parentType","parentId","connectType"],type:"object"},common145:{if:{properties:{parentType:{const:"citoyens"}}},then:{properties:{connectType:{const:"friend",default:"friend"}}}},common146:{properties:{connectType:{const:"friend",default:"friend"}}},common147:{connectType:{const:"friend",default:"friend"}},common148:{const:"friend",default:"friend"},common149:{if:{properties:{parentType:{const:"organizations"}}},then:{properties:{connectType:{enum:["admin","member"]}}}},common150:{properties:{parentType:{const:"organizations"}}},common151:{parentType:{const:"organizations"}},common152:{properties:{connectType:{enum:["admin","member"]}}},common153:{connectType:{enum:["admin","member"]}},common154:{enum:["admin","member"]},common155:{if:{properties:{parentType:{const:"projects"}}},then:{properties:{connectType:{enum:["admin","contributor"]}}}},common156:{properties:{parentType:{const:"projects"}}},common157:{parentType:{const:"projects"}},common158:{properties:{connectType:{enum:["admin","contributor"]}}},common159:{connectType:{enum:["admin","contributor"]}},common160:{enum:["admin","contributor"]},common161:{if:{properties:{parentType:{const:"events"}}},then:{properties:{connectType:{const:"attendee",default:"attendee"}}}},common162:{properties:{parentType:{const:"events"}}},common163:{parentType:{const:"events"}},common164:{const:"events"},common165:{properties:{connectType:{const:"attendee",default:"attendee"}}},common166:{connectType:{const:"attendee",default:"attendee"}},common167:{const:"attendee",default:"attendee"},common168:{childId:{default:"@userId",pattern:"^([a-f0-9]{24}|@\\w+)$",type:"string"},childType:{const:"citoyens",default:"citoyens",enum:["citoyens"],type:"string"},connectType:{enum:["admin","member","contributor","attendee","friend"],type:"string"},parentId:{pattern:"^[a-f0-9]{24}$",type:"string"},parentType:{enum:["citoyens","organizations","projects","events"],type:"string"}},common169:{default:"@userId",pattern:"^([a-f0-9]{24}|@\\w+)$",type:"string"},common170:{const:"citoyens",default:"citoyens",enum:["citoyens"],type:"string"},common171:{enum:["admin","member","contributor","attendee","friend"],type:"string"},common172:{enum:["citoyens","organizations","projects","events"],type:"string"}},E=[{auth:"none",constant:"PERSON_REGISTER",contentType:"application/x-www-form-urlencoded",generateModule:"UserNoAuth",method:"POST",onlyAuthNone:!0,path:"/co2/person/register",request:{additionalProperties:!1,properties:{app:$.common1,email:$.common2,isInvitation:$.common3,mode:$.common1,name:$.common1,pendingUserId:$.common1,pwd:$.common1,username:$.common1},required:["name","username","email","pwd"],type:"object"}},{auth:"none",constant:"AUTHENTICATE_URL",contentType:"application/json",generateModule:"UserNoAuth",method:"POST",onlyAuthNone:!0,path:"/api/cocolight/authenticate",postActions:[{path:"accessToken",type:"setToken"},{path:"refreshToken",type:"setRefreshToken"},{event:"userLoggedIn",path:"user",type:"emitEvent"}],request:{additionalProperties:!1,properties:{email:$.common2,password:$.common1},required:["email","password"],type:"object"}},{auth:"none",constant:"REFRESH_TOKEN_URL",contentType:"application/json",method:"POST",path:"/api/cocolight/refreshtoken",request:{additionalProperties:!1,properties:{refreshToken:$.common1},required:["refreshToken"],type:"object"}},{auth:"bearer",constant:"ME_INFO_URL",contentType:"application/json",method:"POST",path:"/api/cocolight/me"},{auth:"none",constant:"PASSWORD_RECOVERY",contentType:"application/x-www-form-urlencoded",generateModule:"UserNoAuth",method:"POST",onlyAuthNone:!0,path:"/co2/person/sendemail",request:{additionalProperties:!1,properties:{email:$.common2,type:{const:"password",default:"password",type:"string"}},required:["email","type"],type:"object"}},{auth:"bearer",constant:"SERVER_EXCHANGE_TOKEN",contentType:"application/json",method:"POST",path:"/api/cocolight/exchangetoken",request:{additionalProperties:!1,properties:{serverUrl:$.common4},required:["serverUrl"],type:"object"}},{auth:"bearer",constant:"CHANGE_PASSWORD",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/person/changepassword",request:{additionalProperties:!1,properties:{mode:{const:"changePassword",default:"changePassword",type:"string"},newPassword:$.common1,newPassword2:$.common1,oldPassword:$.common1,scope:{default:"",type:["string"]},userId:$.common5},required:["mode","userId","oldPassword","newPassword","newPassword2"],type:"object"}},{auth:"bearer",constant:"DELETE_ACCOUNT",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/delete/id/{id}/type/citoyens",pathParams:$.common6,postActions:[{type:"resetSession"},{event:"accountDeleted",path:null,type:"emitEvent"}],request:{additionalProperties:!1,properties:{reason:$.common8},required:["reason"],type:"object"}},{auth:"bearer",constant:"UPDATE_SETTINGS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/updatesettings",request:{additionalProperties:!1,allOf:[{else:{properties:{idEntity:$.common9}},if:{properties:{typeEntity:$.common10}},then:{properties:{idEntity:$.common5}}},{if:{properties:{type:{enum:["birthDate","email","locality","phone","directory"]},typeEntity:$.common10}},then:{properties:{value:{enum:["private","public","mask"],type:"string"}}}},{if:{properties:{type:{enum:["activitypub","isOpenData"]},typeEntity:$.common10}},then:$.common11},{if:{properties:{type:{enum:["isOpenData","isOpenEdition","private","feedback"]},typeEntity:{not:$.common10}}},then:$.common11}],properties:{idEntity:$.common1,type:$.common1,typeEntity:{default:"citoyens",type:"string"},value:$.common13},required:["type","value","typeEntity","idEntity"],type:"object"}},{auth:"bearer",constant:"UPDATE_BLOCK_DESCRIPTION",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/updateblock/",request:{additionalProperties:!1,allOf:[$.common14,{anyOf:[{properties:{description:$.common20},required:["description"]},{properties:{shortDescription:$.common20},required:["shortDescription"]}]}],properties:{block:{const:"descriptions",default:"descriptions",type:"string"},descMentions:$.common8,description:$.common1,id:$.common1,scope:{default:"",type:["string","null"]},shortDescription:$.common1,typeElement:$.common22},required:["block","typeElement","id"],type:"object"}},{auth:"bearer",constant:"UPDATE_BLOCK_INFO",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/updateblock/",request:{$defs:{sharedFields:{email:$.common2,name:$.common1,tags:$.common23,url:$.common4}},allOf:[{if:$.common17,then:{additionalProperties:!1,anyOf:[$.common26,{properties:{birthDate:$.common20},required:["birthDate"]},{properties:{fixe:$.common20},required:["fixe"]},{properties:{mobile:$.common20},required:["mobile"]},$.common28,$.common30,$.common32],properties:{birthDate:{format:"date",type:"string"},block:$.common34,email:$.common35,fixe:$.common1,id:$.common5,mobile:$.common1,name:$.common36,scope:$.common8,tags:$.common37,typeElement:$.common22,url:$.common38}}},{if:{properties:{typeElement:$.common39}},then:{additionalProperties:!1,anyOf:[$.common26,$.common28,$.common30,$.common32,{properties:{avancement:$.common20},required:["avancement"]},{properties:{parent:$.common20},required:["parent"]}],properties:{avancement:{enum:["abandoned","concept","development","production","started","testing","idea","mature","qa","finished"],type:"string"},block:$.common34,email:$.common35,id:$.common1,name:$.common36,parent:{additionalProperties:!1,patternProperties:{"^[a-fA-F0-9]{24}$":{additionalProperties:!1,properties:{name:$.common1,type:$.common1},required:["type","name"],type:"object"}},type:"object"},scope:$.common8,tags:$.common37,typeElement:$.common22,url:$.common38}}},{if:{properties:{typeElement:$.common40}},then:{additionalProperties:!1,anyOf:[$.common26,$.common28,$.common30,$.common32,{properties:{type:$.common20},required:["type"]}],properties:{block:$.common34,email:$.common35,id:$.common1,name:$.common36,scope:$.common8,tags:$.common37,type:{enum:["NGO","Cooperative","LocalBusiness","GovernmentOrganizationautre"],type:"string"},typeElement:$.common22,url:$.common38}}}],properties:{block:$.common34,id:$.common1,scope:$.common8,typeElement:$.common22},required:["block","typeElement","id"],type:"object"}},{auth:"bearer",constant:"UPDATE_BLOCK_SOCIAL",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/updateblock/",request:{$defs:{socialField:{anyOf:[$.common25,$.common4]}},allOf:[$.common14,{anyOf:[{properties:{gitlab:$.common20},required:["gitlab"]},{properties:{github:$.common20},required:["github"]},{properties:{twitter:$.common20},required:["twitter"]},{properties:{facebook:$.common20},required:["facebook"]},{properties:{instagram:$.common20},required:["instagram"]},{properties:{diaspora:$.common20},required:["diaspora"]},{properties:{mastodon:$.common20},required:["mastodon"]},{properties:{telegram:$.common20},required:["telegram"]},{properties:{signal:$.common20},required:["signal"]}]}],properties:{block:{const:"network",default:"network",type:"string"},diaspora:$.common41,facebook:$.common41,github:$.common41,gitlab:$.common41,id:$.common1,instagram:$.common41,mastodon:$.common41,scope:$.common8,signal:$.common41,telegram:$.common41,twitter:$.common41,typeElement:$.common22},required:["block","typeElement","id"],type:"object"}},{auth:"bearer",constant:"UPDATE_BLOCK_LOCALITY",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/updateblock/",request:{else:$.common42,if:$.common17,properties:{address:{additionalProperties:!1,properties:{"@type":{const:"PostalAddress",type:"string"},addressCountry:$.common1,addressLocality:$.common1,codeInsee:$.common1,level1:$.common1,level1Name:$.common1,level3:$.common45,level3Name:$.common45,level4:$.common45,level4Name:$.common45,localityId:$.common1,postalCode:$.common1,streetAddress:$.common1},required:["@type","addressCountry","codeInsee","addressLocality","localityId","level1","level1Name"],type:"object"},block:{const:"localities",default:"localities",type:"string"},geo:{additionalProperties:!1,properties:{"@type":{const:"GeoCoordinates",type:"string"},latitude:$.common46,longitude:$.common46},required:["latitude","longitude"],type:"object"},geoPosition:{additionalProperties:!0,properties:{coordinates:{items:$.common47,maxItems:2,minItems:2,type:"array"},float:$.common48,type:{const:"Point",type:"string"}},required:["type","coordinates","float"],type:"object"},id:$.common1,scope:$.common8,typeElement:$.common22},required:["block","typeElement","id","address"],then:$.common49,type:"object"}},{auth:"bearer",constant:"UPDATE_BLOCK_SLUG",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/updateblock/",request:{else:$.common42,if:$.common17,properties:{block:$.common34,id:$.common1,scope:$.common8,slug:$.common52,typeElement:$.common22},required:["block","typeElement","id","slug"],then:$.common49,type:"object"}},{auth:"bearer",constant:"CHECK",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/slug/check",request:{additionalProperties:!1,else:$.common42,if:$.common53,properties:{block:$.common34,id:$.common1,slug:$.common52,type:$.common22},required:["block","type","id","slug"],then:$.common49,type:"object"}},{auth:"bearer",constant:"PROFIL_IMAGE",contentType:"multipart/form-data",method:"POST",path:"/co2/document/upload-save/dir/communecter/folder/{folder}/ownerId/{ownerId}/input/profil_avatar/contentKey/profil/docType/image",pathParams:$.common55,request:{additionalProperties:!1,properties:{profil_avatar:$.common13},required:["profil_avatar"],type:"object"}},{auth:"none",constant:"GET_ELEMENTS_ABOUT",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/about/type/{type}/id/{id}/json/true",pathParams:$.common63,request:{additionalProperties:!1,properties:{tpl:{const:"ficheInfoElement",default:"ficheInfoElement",type:"string"}},required:["tpl"],type:"object"}},{auth:"bearer",constant:"MULTICONNECT",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/link/multiconnect",request:{additionalProperties:!1,else:$.common65,if:$.common67,properties:{listInvite:{additionalProperties:!1,patternProperties:{"^(citoyens|projects|organizations)$":{additionalProperties:!1,patternProperties:{"^[0-9a-fA-F]{24}$":{additionalProperties:!1,properties:{name:$.common1},required:["name"],type:"object"}},type:"object"}},type:"object"},parentId:$.common1,parentType:$.common22},required:["parentId","parentType","listInvite"],then:$.common69,type:"object"}},{auth:"none",constant:"GET_NEWS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/news/co/get/type/{type}/id/{id}/isLive/{isLive}/json/true",pathParams:{additionalProperties:!1,else:$.common42,if:$.common53,properties:{id:$.common1,isLive:$.common71,type:$.common22},required:["isLive","type","id"],then:$.common49,type:"object"},request:{additionalProperties:!1,properties:{dateLimit:{default:0,type:"integer"},indexStep:{default:12,type:"integer"},search:{additionalProperties:!1,properties:{name:$.common8},required:["name"],type:"object"}},required:["dateLimit","indexStep"],type:"object"}},{auth:"none",constant:"GET_NEWS_BY_ID",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/news/co/getbyids",request:{additionalProperties:!1,properties:{ids:{items:$.common9,type:"array"}},required:["ids"],type:"object"}},{auth:"bearer",constant:"ADD_NEWS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/news/co/save",request:{additionalProperties:!1,anyOf:[$.common72,$.common73,$.common74],else:$.common65,if:$.common67,properties:{json:$.common48,markdownActive:$.common71,mediaFile:$.common75,mediaImg:$.common77,mentions:$.common79,parentId:$.common1,parentType:$.common22,scope:$.common83,tags:$.common23,text:$.common1,type:$.common84},required:["scope","markdownActive","parentId","parentType","type","json"],then:$.common69,type:"object"}},{auth:"bearer",constant:"ADD_IMAGE_NEWS",contentType:"multipart/form-data",method:"POST",path:"/co2/document/uploadSave/dir/communecter/folder/{folder}/ownerId/{ownerId}/input/newsImage/docType/image/contentKey/slider",pathParams:$.common55,request:{additionalProperties:!1,properties:{newsImage:$.common13},required:["newsImage"],type:"object"}},{auth:"bearer",constant:"ADD_FILE_NEWS",contentType:"multipart/form-data",method:"POST",path:"/co2/document/uploadSave/dir/communecter/folder/{folder}/ownerId/{ownerId}}/input/newsFile/docType/file",pathParams:$.common55,request:{additionalProperties:!1,properties:{newsFile:$.common13},required:["newsFile"],type:"object"}},{auth:"bearer",constant:"DELETE_NEWS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/news/co/delete/id/{id}",pathParams:$.common85,request:{additionalProperties:!1,properties:{isLive:$.common86},required:["isLive"],type:"object"}},{auth:"bearer",constant:"UPDATE_NEWS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/news/co/update",request:{additionalProperties:!1,anyOf:[$.common72,$.common73,$.common74],else:$.common65,if:$.common67,properties:{idNews:$.common9,markdownActive:$.common71,mediaFile:$.common75,mediaImg:$.common77,mentions:$.common79,parentId:$.common1,parentType:$.common22,scope:$.common83,tags:$.common23,text:$.common1,type:$.common84},required:["idNews","scope","markdownActive","parentId","parentType","type"],then:$.common69,type:"object"}},{auth:"bearer",constant:"SHARE_NEWS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/news/co/share",request:{additionalProperties:!1,else:{properties:{childId:$.common44}},if:{properties:{childType:$.common10}},properties:{childId:$.common9,childType:$.common22,comment:$.common1,connectType:{const:"share",default:"share",type:"string"},parentId:$.common9,parentType:$.common84},required:["parentId","parentType","childId","childType","connectType"],then:{properties:{childId:$.common51}},type:"object"}},{auth:"none",constant:"GET_COMMENTS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/comment/index/type/{type}/id/{id}/json/true",pathParams:$.common87},{auth:"bearer",constant:"ADD_COMMENTS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/comment/save",request:{additionalProperties:!1,properties:{argval:$.common8,contextId:$.common9,contextType:$.common89,mentions:$.common90,parentCommentId:$.common9,path:$.common8,text:$.common1},required:["text","contextId","contextType"],type:"object"}},{auth:"bearer",constant:"DELETE_COMMENTS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/comment/delete/id/{id}",pathParams:$.common85},{auth:"bearer",constant:"UPDATE_COMMENTS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/comment/update",request:{additionalProperties:!1,properties:{id:$.common9,params:{properties:{mentions:$.common90,text:$.common1},required:["text"],type:"object"}},required:["id","params"],type:"object"}},{auth:"none",constant:"SEARCH_TAGS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/api/tags/search?q={q}",pathParams:{additionalProperties:!1,properties:{q:$.common1},required:["q"],type:"object"}},{auth:"none",constant:"SHOW_VOTE",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/action/list/type/{type}/id/{id}/actionType/vote/json/true",pathParams:$.common87},{auth:"none",constant:"GLOBAL_AUTOCOMPLETE",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:$.common48,countType:{const:["NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects","citoyens","poi"],default:["NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects","citoyens","poi"],items:$.common93,type:"array"},fediverse:$.common94,filters:$.common95,indexMin:{const:0,default:0,type:"number"},indexStep:$.common47,initType:$.common95,locality:{additionalProperties:!1,patternProperties:{"^[^\\s]+$":{additionalProperties:!1,properties:{id:$.common1,type:{enum:["cities","level1"],type:"string"}},required:["id","type"],type:"object"}},type:"object"},name:$.common1,notSourceKey:$.common48,ranges:{additionalProperties:!1,patternProperties:{"^[^\\s]+$":$.common96},type:"object"},searchTags:$.common24,searchType:{items:$.common93,type:"array"}},required:["name","searchType","countType","indexMin","indexStep","initType","count","notSourceKey","filters","fediverse"],type:"object"}},{auth:"none",constant:"CITY_AUTOCOMPLETE",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{indexMax:{minimum:5,type:"integer"},indexMin:{minimum:0,type:"integer"},locality:$.common95,name:$.common1,searchBy:{const:"ALL",default:"ALL",type:"string"},searchType:{const:["cities"],default:["cities"],items:{enum:["cities"],type:"string"},type:"array"}},required:["name","locality","searchType"],type:"object"}},{auth:"none",constant:"SUGGESTION_INPUT",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{indexMax:{default:20,minimum:20,type:"integer"},indexMin:$.common98,name:$.common1,searchType:{items:{enum:["organizations","projects","poi"],type:"string"},type:"array"}},required:["name","searchType","indexMin","indexMax"],type:"object"}},{auth:"none",constant:"GET_PROJECTS_NO_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:$.common48,countType:$.common99,fediverse:$.common94,filters:{additionalProperties:!1,default:{$or:{"links.contributors.@userId":$.common101,"parent.@userId":$.common101},"links.contributors.@userId":$.common101},patternProperties:{"^links\\.contributors\\.(?:[a-f0-9]{24}|@\\w+)$":$.common102},properties:{$or:{additionalProperties:!1,maxProperties:2,minProperties:2,patternProperties:{"^links\\.contributors\\.(?:[a-f0-9]{24}|@\\w+)$":$.common102,"^parent\\.(?:[a-f0-9]{24}|@\\w+)$":$.common102},type:"object"}},required:["$or"],type:"object"},indexMin:$.common98,indexStep:$.common105,initType:$.common95,locality:$.common95,name:$.common1,notSourceKey:$.common48,searchType:$.common99},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"bearer",constant:"GET_PROJECTS_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocompleteadmin/type/{type}/id/{id}/canSee/true",pathParams:$.common63,request:{additionalProperties:!1,properties:{count:$.common48,countType:$.common99,fediverse:$.common94,filters:{additionalProperties:!1,default:{$or:{"links.contributors.@{pathParams.id}":$.common101,"parent.@{pathParams.id}":$.common101},"links.contributors.@{pathParams.id}":$.common101},patternProperties:{"^links\\.contributors\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":$.common102},properties:{$or:{additionalProperties:!1,maxProperties:2,minProperties:2,patternProperties:{"^links\\.contributors\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":$.common102,"^parent\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":$.common102},type:"object"}},required:["$or"],type:"object"},indexMin:$.common98,indexStep:$.common105,initType:$.common95,locality:$.common95,name:$.common1,notSourceKey:$.common48,searchType:$.common99},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"none",constant:"GET_POIS_NO_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:$.common48,countType:$.common106,fediverse:$.common94,filters:{additionalProperties:!1,default:{"parent.@userId":$.common101},patternProperties:{"^parent\\.(?:[a-f0-9]{24}|@\\w+)$":$.common102},type:"object"},indexMin:$.common98,indexStep:$.common105,initType:$.common95,locality:$.common95,name:$.common1,notSourceKey:$.common48,searchType:$.common106},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"bearer",constant:"GET_POIS_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocompleteadmin/type/{type}/id/{id}/canSee/true",pathParams:$.common63,request:{additionalProperties:!1,properties:{count:$.common48,countType:$.common106,fediverse:$.common94,filters:{additionalProperties:!1,default:{"parent.@{pathParams.id}":$.common101},patternProperties:{"^parent\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":$.common102},type:"object"},indexMin:$.common98,indexStep:$.common105,initType:$.common95,locality:$.common95,name:$.common1,notSourceKey:$.common48,searchType:$.common106},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"none",constant:"GET_ORGANIZATIONS_NO_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:$.common48,countType:$.common108,fediverse:$.common94,filters:{additionalProperties:!1,default:{"links.members.@userId":$.common101,"links.members.@userId.isInviting":$.common110,"links.members.@userId.toBeValidated":$.common110},patternProperties:{"^links\\.members\\.(?:[a-f0-9]{24}|@\\w+)$":$.common102,"^links\\.members\\.(?:[a-f0-9]{24}|@\\w+)\\.isInviting$":$.common111,"^links\\.members\\.(?:[a-f0-9]{24}|@\\w+)\\.toBeValidated$":$.common111},type:"object"},indexMin:$.common98,indexStep:$.common105,initType:$.common95,locality:$.common95,name:$.common1,notSourceKey:$.common48,searchType:$.common108},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"bearer",constant:"GET_ORGANIZATIONS_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocompleteadmin/type/{type}/id/{id}/canSee/true",pathParams:{additionalProperties:!1,else:$.common42,if:$.common53,properties:{id:$.common1,type:{default:"citoyens",enum:["citoyens","organizations"],type:"string"}},required:["type","id"],then:$.common49,type:"object"},request:{additionalProperties:!1,properties:{count:$.common48,countType:$.common108,fediverse:$.common94,filters:{additionalProperties:!1,default:{"links.members.@{pathParams.id}":$.common101,"links.members.@{pathParams.id}.isInviting":$.common110,"links.members.@{pathParams.id}.toBeValidated":$.common110},patternProperties:{"^links\\.members\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":$.common102,"^links\\.members\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":$.common111,"^links\\.members\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":$.common111},type:"object"},indexMin:$.common98,indexStep:$.common105,initType:$.common95,locality:$.common95,name:$.common1,notSourceKey:$.common48,searchType:$.common108},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"none",constant:"GET_MEMBERS_NO_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:$.common48,countType:$.common114,fediverse:$.common94,filters:{additionalProperties:!1,allOf:[{not:{propertyNames:{pattern:"^(?!links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)$)"}}},{not:{propertyNames:{pattern:"^(?!links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)\\.toBeValidated$)"}}}],patternProperties:{"^links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)$":$.common102,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)\\.isAdmin$":$.common102,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)\\.isInviting$":$.common116,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)\\.roles$":$.common118,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)\\.toBeValidated$":$.common111},type:"object"},indexMin:$.common98,indexStep:$.common105,initType:$.common95,locality:$.common95,name:$.common1,notSourceKey:$.common48,searchType:$.common114},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"bearer",constant:"GET_MEMBERS_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocompleteadmin/type/organizations/id/{id}/canSee/true",pathParams:$.common85,request:{additionalProperties:!1,properties:{count:$.common48,countType:$.common114,fediverse:$.common94,filters:{additionalProperties:!1,allOf:[{not:{propertyNames:{pattern:"^(?!links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}}}],default:{"links.memberOf.@{pathParams.id}":$.common101,"links.memberOf.@{pathParams.id}.isInviting":$.common110,"links.memberOf.@{pathParams.id}.toBeValidated":$.common110},patternProperties:{"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":$.common102,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isAdmin$":$.common102,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":$.common116,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.roles$":$.common118,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":$.common116},type:"object"},indexMin:$.common98,indexStep:$.common105,initType:$.common95,locality:$.common95,name:$.common1,notSourceKey:$.common48,searchType:$.common114},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"bearer",constant:"GET_FRIENDS_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocompleteadmin/type/citoyens/id/{id}/canSee/true",pathParams:$.common6,request:{additionalProperties:!1,properties:{count:$.common48,countType:$.common121,fediverse:$.common94,filters:{additionalProperties:!1,allOf:[{not:{propertyNames:{pattern:"^(?!links\\.friends\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}}}],default:{"links.friends.@{pathParams.id}":$.common101,"links.friends.@{pathParams.id}.isInviting":$.common110,"links.friends.@{pathParams.id}.toBeValidated":$.common110},patternProperties:{"^links\\.friends\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":$.common102,"^links\\.friends\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":$.common116,"^links\\.friends\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":$.common116},type:"object"},indexMin:$.common98,indexStep:$.common105,initType:$.common95,locality:$.common95,name:$.common1,notSourceKey:$.common48,searchType:$.common121},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"none",constant:"GET_SUBSCRIPTIONS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:$.common48,countType:$.common123,fediverse:$.common94,filters:{additionalProperties:!1,allOf:[$.common125],default:{"links.followers.@userId":$.common101,"links.followers.@{userId}.isInviting":$.common110,"links.followers.@{userId}.toBeValidated":$.common110},patternProperties:$.common128,type:"object"},indexMin:$.common98,indexStep:$.common105,initType:$.common95,locality:$.common95,name:$.common1,notSourceKey:$.common48,searchType:$.common123},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"bearer",constant:"GET_SUBSCRIPTIONS_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocompleteadmin/type/citoyens/id/{id}/canSee/true",pathParams:$.common6,request:{additionalProperties:!1,properties:{count:$.common48,countType:$.common123,fediverse:$.common94,filters:{additionalProperties:!1,allOf:[$.common125],default:{"links.followers.@{pathParams.id}":$.common101,"links.followers.@{pathParams.id}.isInviting":$.common110,"links.followers.@{pathParams.id}.toBeValidated":$.common110},patternProperties:$.common128,type:"object"},indexMin:$.common98,indexStep:$.common105,initType:$.common95,locality:$.common95,name:$.common1,notSourceKey:$.common48,searchType:$.common123},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"none",constant:"GET_SUBSCRIBERS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:$.common48,countType:$.common121,fediverse:$.common94,filters:{additionalProperties:!1,allOf:[$.common129],default:{"links.follows.@userId":$.common101,"links.follows.@{userId}.isInviting":$.common110,"links.follows.@{userId}.toBeValidated":$.common110},patternProperties:{"^links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":$.common102,"^links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":$.common111,"^links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":$.common111},type:"object"},indexMin:$.common98,indexStep:$.common105,initType:$.common95,locality:$.common95,name:$.common1,notSourceKey:$.common48,searchType:$.common121},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"bearer",constant:"GET_SUBSCRIBERS_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocompleteadmin/type/{type}/id/{id}/canSee/true",pathParams:{additionalProperties:!1,allOf:[{else:$.common42,if:$.common53,then:$.common49}],properties:{id:$.common1,type:{default:"citoyens",enum:["citoyens","organizations","projects"],type:"string"}},required:["type","id"],type:"object"},request:{additionalProperties:!1,properties:{count:$.common48,countType:$.common121,fediverse:$.common94,filters:{additionalProperties:!1,allOf:[$.common129],default:{"links.follows.@{pathParams.id}":$.common101},maxProperties:1,minProperties:1,patternProperties:{"^links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":$.common102},type:"object"},indexMin:$.common98,indexStep:$.common105,initType:$.common95,locality:$.common95,name:$.common1,notSourceKey:$.common48,searchType:$.common121},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"none",constant:"GET_CONTRIBUTORS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:$.common48,countType:$.common114,fediverse:$.common94,filters:{additionalProperties:!1,allOf:[{not:{propertyNames:{pattern:"^(?!links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)$)"}}},{not:{propertyNames:{pattern:"^(?!links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)\\.toBeValidated$)"}}}],patternProperties:{"^links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)$":$.common102,"^links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)\\.isAdmin$":$.common102,"^links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)\\.isInviting$":$.common116,"^links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)\\.roles$":$.common118,"^links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)\\.toBeValidated$":$.common111},type:"object"},indexMin:$.common98,indexStep:$.common105,initType:$.common95,locality:$.common95,name:$.common1,notSourceKey:$.common48,searchType:$.common114},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"bearer",constant:"GET_CONTRIBUTORS_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocompleteadmin/type/projects/id/{id}/canSee/true",pathParams:$.common85,request:{additionalProperties:!1,properties:{count:$.common48,countType:$.common114,fediverse:$.common94,filters:{additionalProperties:!1,allOf:[{not:{propertyNames:{pattern:"^(?!links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}}}],default:{"links.projects.@{pathParams.id}":$.common101,"links.projects.@{pathParams.id}.isInviting":$.common110,"links.projects.@{pathParams.id}.toBeValidated":$.common110},patternProperties:{"^links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":$.common102,"^links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isAdmin$":$.common102,"^links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":$.common116,"^links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.roles$":$.common118,"^links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":$.common116},type:"object"},indexMin:$.common98,indexStep:$.common105,initType:$.common95,locality:$.common95,name:$.common1,notSourceKey:$.common48,searchType:$.common114},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"none",constant:"GET_BADGES",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:$.common48,countType:$.common132,fediverse:$.common94,filters:{properties:{$or:{additionalProperties:!1,minProperties:1,patternProperties:{"^issuer\\.(?:[a-f0-9]{24}|@\\w+)$":$.common102},type:"object"},isParcours:$.common3,"preferences.private":$.common94},required:["preferences.private"],type:"object"},indexMin:$.common98,indexStep:$.common105,initType:$.common95,locality:$.common95,name:$.common1,notSourceKey:$.common48,searchType:$.common132},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"none",constant:"GET_BADGES_FILTERS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:$.common48,countType:$.common134,fediverse:$.common94,fields:$.common132,filters:{oneOf:[{additionalProperties:!1,maxProperties:1,minProperties:1,patternProperties:{"badges\\.(?:[a-f0-9]{24}|@\\w+)$":$.common136}},{additionalProperties:!1,maxProperties:3,minProperties:3,patternProperties:{"badges\\.(?:[a-f0-9]{24}|@\\w+)$":$.common136,"badges\\.(?:[a-f0-9]{24}|@\\w+)\\.attenteEmetteur$":$.common139,"badges\\.(?:[a-f0-9]{24}|@\\w+)\\.attenteRecepteur$":$.common139}},{additionalProperties:!1,maxProperties:2,minProperties:2,patternProperties:$.common142},{additionalProperties:!1,maxProperties:1,minProperties:1,properties:{$or:{additionalProperties:!1,maxProperties:2,minProperties:2,patternProperties:$.common142,type:"object"}},required:["$or"]},{additionalProperties:!1,maxProperties:1,minProperties:1,patternProperties:{"badges\\.(?:[a-f0-9]{24}|@\\w+)\\.revoke$":$.common138}},{additionalProperties:!1,maxProperties:1,minProperties:1,patternProperties:{"badges\\.(?:[a-f0-9]{24}|@\\w+)\\.attenteEmetteur$":$.common136}}],type:"object"},indexMin:$.common98,indexStep:$.common105,initType:$.common95,locality:$.common95,name:$.common1,notSourceKey:$.common48,ranges:{additionalProperties:!1,default:{Cooperative:$.common143,GovernmentOrganization:$.common143,Group:$.common143,LocalBusiness:$.common143,NGO:$.common143,citoyens:$.common143,projects:$.common143},maxProperties:7,minProperties:7,patternProperties:{"^[a-zA-Z][a-zA-Z0-9]*$":$.common96},type:"object"},searchType:$.common134},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","locality","fediverse"],type:"object"}},{auth:"bearer",constant:"CONNECT",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/link/connect",request:$.common144},{auth:"bearer",constant:"DISCONNECT",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/link/disconnect",request:$.common144},{auth:"none",constant:"GET_ELEMENTS_KEY",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/slug/getinfo/key/{slug}",pathParams:{slug:$.common1}}];A.default.addType("oid",(e=>new S.ObjectID(e)));class x extends b.EventEmitter{constructor({baseURL:e,accessToken:t,refreshToken:o,refreshUrl:n="/api/cocolight/refreshtoken",endpoints:r=E,timeout:i=3e4,debug:s=!1,maxRetries:a=0,circuitBreakerThreshold:m=5,circuitBreakerResetTime:c=6e4,fromJSONValue:l=!0}={}){if(super(),!e)throw new p('Le paramètre "baseURL" est obligatoire.',500);this._baseURL=e,this._refreshToken=o,this._refreshUrl=n,this._endpoints=r,this._debug=s;let d=null;this._fromJSONValue=l,Object.defineProperty(this,"userId",{get:()=>d,set:()=>{throw new Error("Modification directe de userId non autorisée.")},enumerable:!0}),this._setUserId=e=>{d=e,this._logger.debug(`[ApiClient] userId set: ${e}`)},this._ajv=new P.default({strict:!1,useDefaults:!0}),(0,_.default)(this._ajv),this._logger=(0,k.default)({transport:{target:"pino-pretty",options:{colorize:!0}},level:s?"debug":"info"}),this._client=j.default.create({baseURL:e,timeout:i}),a>0&&((0,O.default)(this._client,{retries:a,retryDelay:O.default.exponentialDelay,retryCondition:e=>O.default.isNetworkError(e)||O.default.isRetryableError(e)}),this._logger.info(`[ApiClient] Retry activé : ${a} max`)),this._breakerThreshold=m,this._breakerResetTime=c,this._breakerErrorCount=0,this._breakerOpen=!1,this._lastBreakerOpenTime=null,t&&this.setToken(t),this._client.interceptors.response.use((e=>e),(async e=>{if(e.response&&401===e.response.status&&this._refreshToken)try{if(await this._refreshAccessToken())return this._client.request(e.config)}catch(e){throw new p(e.message,401,e)}throw e}))}setToken(e){this._accessToken=e,this._client.defaults.headers.common.Authorization="Bearer "+e;const t=this._getIdFromToken(e);t&&(this._setUserId(t),this._logger.debug(`[ApiClient] userId extrait et défini : ${t}`)),this._logger.debug(`[ApiClient] setToken: ${e}`)}getToken(){return this._accessToken}setRefreshToken(e){this._refreshToken=e;const t=this._getIdFromToken(e);t&&(this._setUserId(t),this._logger.debug(`[ApiClient] userId extrait depuis refreshToken : ${t}`)),this._logger.debug(`[ApiClient] setRefreshToken: ${e}`)}getRefreshToken(){return this._refreshToken}get isConnected(){return!!this._accessToken}_getIdFromToken(e){if(!e)return null;try{const t=function(e,t){if("string"!=typeof e)throw new I("Invalid token specified: must be a string");t||(t={});const o=!0===t.header?0:1,n=e.split(".")[o];if("string"!=typeof n)throw new I(`Invalid token specified: missing part #${o+1}`);let r;try{r=function(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return function(e){return decodeURIComponent(atob(e).replace(/(.)/g,((e,t)=>{let o=t.charCodeAt(0).toString(16).toUpperCase();return o.length<2&&(o="0"+o),"%"+o})))}(t)}catch(e){return atob(t)}}(n)}catch(e){throw new I(`Invalid token specified: invalid base64 for part #${o+1} (${e.message})`)}try{return JSON.parse(r)}catch(e){throw new I(`Invalid token specified: invalid json for part #${o+1} (${e.message})`)}}(e);return this._logger.debug("[ApiClient] Payload décodé :",t),t.id||t.userId||null}catch(e){return this._logger.error("[ApiClient] Erreur lors du décodage du token :",e),null}}async _refreshAccessToken(){if(!this._refreshToken)return!1;try{const e=await this._client.post(this._refreshUrl,{refreshToken:this._refreshToken},{headers:{"Content-Type":"application/json"}});return!(!e.data||!e.data.accessToken||(this.setToken(e.data.accessToken),e.data.refreshToken&&this.setRefreshToken(e.data.refreshToken),this.emit("refreshSuccess",e.data),0))}catch(e){return this.resetSession(),this._logger.error(`[ApiClient] Refresh Error : ${e.message}`),!1}}_checkCircuitBreaker(){return!this._breakerOpen||Date.now()-this._lastBreakerOpenTime>this._breakerResetTime&&(this._breakerOpen=!1,this._breakerErrorCount=0,this._logger.warn("[ApiClient] Circuit breaker réinitialisé"),!0)}_updateCircuitBreakerError(){this._breakerErrorCount+=1,this._logger.warn(`[ApiClient] Erreur #${this._breakerErrorCount} sur ${this._breakerThreshold}`),this._breakerErrorCount>=this._breakerThreshold&&(this._breakerOpen=!0,this._lastBreakerOpenTime=Date.now(),this._logger.error("[ApiClient] Circuit breaker ACTIVÉ - L'API est considérée indisponible"))}_resetCircuitBreakerSuccess(){this._breakerErrorCount=0,this._breakerOpen&&(this._breakerOpen=!1,this._logger.warn("[ApiClient] Circuit breaker refermé suite à un succès"))}static stripNullsInPlace(e){if(e&&"object"==typeof e&&e.value&&"function"==typeof e.value.pipe)return e;if(Array.isArray(e))for(let t=e.length-1;t>=0;t--)null===e[t]||void 0===e[t]?e.splice(t,1):"object"==typeof e[t]&&x.stripNullsInPlace(e[t]);else if(e&&"object"==typeof e)for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(null===e[t]||void 0===e[t]?delete e[t]:"object"==typeof e[t]&&x.stripNullsInPlace(e[t]));return e}_resolveSpecialValuesInPlace(e,t={}){const o={userId:()=>this.userId,accessToken:()=>this._accessToken,refreshToken:()=>this._refreshToken,baseURL:()=>this._baseURL,pathParams:e=>{const o=this._getValueByPath(t,e);return null!=o?o:void 0}},n=/@(?:\{([^}]+)\}|([\w.]+))/g,r=e=>"string"!=typeof e?e:e.replace(n,((t,n,r)=>{if(n){if(n.startsWith("pathParams.")){const e=n.substring(11),t=o.pathParams(e);return null!=t?t:`@{${n}}`}{const e=o[n];if("function"==typeof e){const t=e();return null!=t?t:`@{${n}}`}return`@{${n}}`}}if(r){if(r.startsWith("pathParams.")){const e=r.match(/^pathParams\.([^.]+)(.*)$/);if(e){const t=e[1],n=e[2],i=o.pathParams(t);return null!=i?i+n:`@${r}`}return`@${r}`}{const e=o[r];if("function"==typeof e){const t=e();return null!=t?t:`@${r}`}return`@${r}`}}return e})),i=e=>{if((e=>e&&"object"==typeof e&&("function"==typeof e.pipe||"undefined"!=typeof Buffer&&e instanceof Buffer))(e))return e;if(Array.isArray(e))return e.map(i);if((e=>"[object Object]"===Object.prototype.toString.call(e))(e)){const t={};for(const[o,n]of Object.entries(e))t[r(o)]=i(n);return t}return"string"==typeof e?r(e):e};return i(e)}_cleanSchemaLeftoverAlias(e){const t=/@\w+/;if(Array.isArray(e))return e.map((e=>this._cleanSchemaLeftoverAlias(e)));if(e&&"object"==typeof e){const o={};for(const n of Object.keys(e)){const r=e[n];if(!t.test(n)){if("default"===n){if("string"==typeof r&&t.test(r))continue;if(r&&"object"==typeof r){const e=this._cleanSchemaLeftoverAlias(r);Object.keys(e).length>0&&(o[n]=e);continue}}"string"==typeof r&&t.test(r)||(o[n]=this._cleanSchemaLeftoverAlias(r))}}return o}return e}async safeCall(e,...t){try{return await e(...t)}catch(e){throw this._logger.error(`[ApiClient.safeCall] Erreur: ${e.message}`),e}}async callEndpoint(e,t={},o=!0,n=!0){if(!this._checkCircuitBreaker())throw new l("Le circuit breaker est activé, impossible d'appeler l'API");const r=this._endpoints.find((t=>t.constant===e));if(!r)throw new p(`Endpoint introuvable : ${e}`,404);const{path:i,method:s,contentType:a,auth:m,pathParams:c,request:d,responses:u}=r,y=(s||"GET").toLowerCase(),f=a||"application/json",h={"Content-Type":f};if(this._accessToken)"bearer"===m?h.Authorization=`Bearer ${this._accessToken}`:m&&"none"!==m||h.Authorization||(h.Authorization=`Bearer ${this._accessToken}`);else if("bearer"===m)throw new p(`Token requis pour l'endpoint sécurisé : ${e}`,401);let g,b=i,T={};if(c){let e=c;"none"===m&&null===this.userId&&(e=this._cleanSchemaLeftoverAlias(c));const o=t.pathParams||{},n=this._ajv.compile(e);if(!n(o))throw this.emit("validationError",{stage:"pathParams",errors:n.errors}),new p("Path parameter validation failed.",400,n.errors);T=this._resolveSpecialValuesInPlace(o),b=b.replace(/\{(\w+)\}/g,((e,t)=>{const o=T[t];if(void 0!==o)return encodeURIComponent(o);throw new p(`Path param manquant ou non résolu : {${t}}`,400)}))}if(d){let e=d;"none"===m&&null===this.userId&&(e=this._cleanSchemaLeftoverAlias(d));const o={...t};delete o.pathParams;const n=x.stripNullsInPlace(o),r=this._ajv.compile(e);if(!r(n))throw this.emit("validationError",{stage:"request",errors:r.errors}),new p("Request validation failed.",400,r.errors);t=this._resolveSpecialValuesInPlace(n,T)}"application/json"===f||"multipart/form-data"===f?g=t:"application/x-www-form-urlencoded"===f&&(g=x.toURLSearchParams(t)),this._logger.debug(`[ApiClient] callEndpoint: ${e} -> ${b}, method=${y}`);try{const e=await this._client.request({url:b,method:y,headers:h,["get"===y?"params":"data"]:g});if(n){const t=e.status.toString(),o=u?.[t];if(o){const n=this._ajv.compile(o);if(!n(e.data))throw this.emit("validationError",{stage:"response",errors:n.errors}),new p("Response validation failed.",t,n.errors)}}return this._resetCircuitBreakerSuccess(),"function"==typeof o?e.data=o(e.data):!0===o&&(e.data=this._transformData(e.data)),Array.isArray(r.postActions)&&r.postActions.forEach((t=>{const o=t.path?this._getValueByPath(e.data,t.path):null;switch(t.type){case"setToken":this.setToken(o);break;case"setRefreshToken":this.setRefreshToken(o);break;case"resetSession":this.resetSession();break;case"emitEvent":t.event&&(this.emit(t.event,o),this._logger.debug(`[ApiClient] Event émis : ${t.event}`,o));break;case"callMethod":"function"==typeof this[t.method]?(this[t.method](),this._logger.debug(`[ApiClient] Méthode appelée : ${t.method}`)):this._logger.warn(`[ApiClient] Méthode inconnue : ${t.method}`);break;default:this._logger.warn(`[ApiClient] Action inconnue : ${t.type}`)}})),e}catch(t){throw this._updateCircuitBreakerError(),this._logger.error(`[ApiClient] Erreur lors de l'appel de ${e}: ${t.message}`),new p(`Erreur lors de l'appel de l'API : ${t.message}`,t.response?t.response.status:500,t.response?t.response.data:null)}}resetSession(){this.setToken(null),this.setRefreshToken(null),this._setUserId(null),delete this._client.defaults.headers.common.Authorization,this._logger.info("[ApiClient] Session utilisateur réinitialisée."),this.emit("sessionReset")}_getValueByPath(e,t){if(t)return t.split(".").reduce(((e,t)=>e&&e[t]),e)}static toURLSearchParams(e,t={}){return this._buildParams(e,new URLSearchParams,t)}static _buildParams(e,t,o={}){if("object"!=typeof e||null===e)throw new TypeError("La donnée doit être un objet non nul.");const{dots:n=!1,indexes:r=!1,metaTokens:i=!0}=o,s=[];function a(e){return"[object Object]"===Object.prototype.toString.call(e)||Array.isArray(e)}function m(e){return e.endsWith("[]")?e.slice(0,-2):e}function c(e,t,o=!1){return e?e.concat(t).map(((e,t)=>(e=m(e),!o&&t?`[${e}]`:e))).join(o?".":""):t}function p(e){return null==e?"":e instanceof Date?e.toISOString():(e instanceof Blob||e instanceof File||e instanceof ArrayBuffer||ArrayBuffer.isView(e),e)}return function e(o,l=[]){null==o||s.includes(o)||(s.push(o),Object.entries(o).forEach((([o,s])=>{void 0!==s&&function(e,o,s){if(e&&"object"==typeof e){if(o.endsWith("{}"))return o=i?o:o.slice(0,-2),t.append(c(s,o,n),JSON.stringify(e)),!1;if(Array.isArray(e)&&!e.some(a)||o.endsWith("[]"))return o=m(o),e.forEach(((e,i)=>{if(null!=e){const a=r?c(s.concat(o),i,n):`${c(s,o,n)}[]`;t.append(a,p(e))}})),!1}return!!a(e)||(t.append(c(s,o,n),p(e)),!1)}(s,o.trim(),l)&&e(s,l.concat(m(o)))})),s.pop())}(e),t}_transformData(e){if(e&&"object"==typeof e)if(e.resultGoods?.msg)e=this._normalizeJsonData({msg:e.resultGoods.msg,...e});else if(e.resultErrors?.msg)e=this._normalizeJsonData({msg:e.resultErrors.msg,...e});else if(e.results&&"object"==typeof e.results&&!Array.isArray(e.results))e.results=Object.keys(e.results).map((t=>this._normalizeJsonData({id:t,...e.results[t]})));else if(Array.isArray(e.results))e.results=e.results.map((e=>this._normalizeJsonData(e)));else if(e.news&&Array.isArray(e.news)&&0===e.news.length)e=e.news;else if(e.news&&"object"==typeof e.news&&!Array.isArray(e.news))e=Object.keys(e.news).map((t=>this._normalizeJsonData({id:t,...e.news[t]})));else if(e.notif&&"object"==typeof e.notif&&!Array.isArray(e.notif))e.notif=Object.keys(e.notif).map((t=>this._normalizeJsonData({id:t,...e.notif[t]})));else if(e.citoyens&&"object"==typeof e.citoyens&&!Array.isArray(e.citoyens)&&e.organizations&&"object"==typeof e.organizations&&!Array.isArray(e.organizations))e=[...Object.keys(e.citoyens).map((t=>this._normalizeJsonData({id:t,...e.citoyens[t]}))),...Object.keys(e.organizations).map((t=>this._normalizeJsonData({id:t,...e.organizations[t]})))];else if(e.citoyens&&"object"==typeof e.citoyens&&!Array.isArray(e.citoyens))e=Object.keys(e.citoyens).map((t=>this._normalizeJsonData({id:t,...e.citoyens[t]})));else if(e.cities&&"object"==typeof e.cities&&!Array.isArray(e.cities))e=Object.keys(e.cities).map((t=>this._normalizeJsonData({id:t,...e.cities[t]})));else if(e.cities&&Array.isArray(e.cities)&&0===e.cities.length)e=e.cities;else if(e.newComment&&"object"==typeof e.newComment)e.newComment=this._normalizeJsonData({...e.newComment});else if(Array.isArray(e))e=e.map((e=>this._normalizeJsonData(e)));else if(e.map&&"object"==typeof e.map)e.map=this._normalizeJsonData(e.map);else if(e.object&&"object"==typeof e.object)e.object=this._normalizeJsonData(e.object);else if("object"==typeof e&&Object.keys(e).length>0){const t=Object.keys(e).every((e=>/^[0-9a-fA-F]{24}$/.test(e)));e=t?Object.keys(e).map((t=>({id:t,...this._normalizeJsonData(e[t])}))):this._normalizeJsonData(e)}return e}_normalizeJsonData(e){if(!e||"object"!=typeof e)return e;if(e=this._normalizeRecursively(e),e?.mediaImg?.images&&Array.isArray(e.mediaImg.images)&&e.mediaImg.images.length>0&&(e.mediaImg.countImages=e.mediaImg.images.length),e?.mediaFile?.files&&Array.isArray(e.mediaFile.files)&&e.mediaFile.files.length>0&&(e.mediaFile.countFiles=e.mediaFile.files.length),e?.src?.changes&&"object"==typeof e.src.changes&&Object.keys(e.src.changes).length>0&&Object.keys(e.src.changes).forEach((t=>{e.src.changes[t]&&(e.src.changes[t]=this._ensureFullURL(e.src.changes[t]))})),e?.openingHours&&Array.isArray(e.openingHours)&&e.openingHours.length>0&&(e.openingHours=e.openingHours.filter((e=>e.dayOfWeek&&e.hours&&e.hours[0]&&e.hours[0].opens))),e.replies&&"object"==typeof e.replies&&Object.keys(e.replies).length>0&&(e.replies=Object.keys(e.replies).map((t=>this._normalizeJsonData({id:t,...e.replies[t]})))),e?.author&&"object"==typeof e.author&&Object.keys(e.author).length>0&&!("profilThumbImageUrl"in e.author)){const t=Object.keys(e.author)[0];e.author={...e.author[t]}}return e?.timeAgo&&delete e.timeAgo,this._fromJSONValue?A.default.fromJSONValue(e):e}_ensureFullURL(e){if(!e)return e;if(!(e=e.trim())||/^https?:\/\//i.test(e))return e;let t="/";return t=this._baseURL.endsWith("/")&&e.startsWith("/")||this._baseURL.endsWith("/")||e.startsWith("/")?"":"/",`${this._baseURL}${t}${e}`}_normalizeString(e){return"true"===e||"false"!==e&&e}_normalizeId(e){return e._id&&e._id.$id&&/^[0-9a-fA-F]{24}$/.test(e._id.$id)&&(e.id=e._id.$id,e._id={$type:"oid",$value:e._id.$id}),e.id&&e.id.$id&&/^[0-9a-fA-F]{24}$/.test(e.id.$id)&&(e._id={$type:"oid",$value:e.id.$id},e.id=e.id.$id),e}_normalizeDate(e){return e&&"object"==typeof e&&"number"==typeof e.sec?{$date:1e3*e.sec}:"number"==typeof e?{$date:1e3*e}:e}_normalizeImage(e){return"string"==typeof e&&""!==e.trim()?this._ensureFullURL(e):e}_imageFields=["profilImageUrl","profilThumbImageUrl","profilMediumImageUrl","profilMarkerImageUrl","profilBannerUrl","profilRealBannerUrl","imagePath","imageThumbPath","docPath"];_dateFields=["modified","created","updated","birthDate","lastLoginDate","startDate","endDate","date"];_normalizeRecursively(e){if("string"==typeof e)return this._normalizeString(e);if(Array.isArray(e))return e.map((e=>this._normalizeRecursively(e)));if(null!==e&&"object"==typeof e){const t={};return Object.keys(e).forEach((o=>{let n=this._normalizeRecursively(e[o]);this._dateFields.includes(o)&&(n=this._normalizeDate(n)),this._imageFields.includes(o)&&(n=this._normalizeImage(n)),"content"===o&&n&&"object"==typeof n&&n.image&&(n.image=this._normalizeImage(n.image)),t[o]=n})),this._normalizeId(t)}return e}}class q{constructor(e){this.client=new x(e),this.loggedUser=null}async login(e,t){return this.client.safeCall((async()=>{const o=await this.client.callEndpoint("AUTHENTICATE_URL",{email:e,password:t});return this.loggedUser=new g(this.client,{id:o.data.user.id},o.data.user),this.loggedUser}))}async register({name:e,username:t,email:o,pwd:n}={}){return this.client.safeCall((async()=>{const r=await this.client.callEndpoint("PERSON_REGISTER",{name:e,username:t,email:o,pwd:n});if(!1===r?.data?.result)throw new d(r.data.msg,r.status,r.data);return r.data}))}async recoverPassword(e){return this.client.safeCall((async()=>{const t=await this.client.callEndpoint("PASSWORD_RECOVERY",{email:e});if(!1===t?.data?.result)throw new d(t.data.msg,t.status,t.data);return t.data}))}}class z{static async userLogin(e,t,o){const n=z.userApi(o);return await z.userApiLogin(n,e,t)}static userApi(e){try{return new q(e)}catch(e){throw console.error("[Api.userApi] Erreur lors de la création d'un objet utilisateur :",e.message),e}}static async userApiLogin(e,t,o){try{const n=await e.login(t,o);return new z(n,e.client)}catch(e){if(e instanceof p)throw e?.details?.error?new u(e.details.error,e.status,e.details):e}}constructor(e,t){this._loggedUser=e,this._client=t}me(){if(!this._loggedUser)throw new Error("Accès refusé : utilisateur non authentifié.");return this._loggedUser}user(e){try{return new g(this._client,e)}catch(e){throw console.error("[Api.user] Erreur lors de la création d'un objet utilisateur public :",e.message),e}}async organization(e,t={getProfile:!0}){try{const o=new f(this._client,e);return t.getProfile&&await o.getProfile(),o}catch(e){throw console.error("[Api.organization] Erreur lors de la création d'un objet organisation :",e.message),e}}async project(e,t={getProfile:!0}){try{const o=new h(this._client,e);return t.getProfile&&await o.getProfile(),o}catch(e){throw console.error("[Api.project] Erreur lors de la création d'un objet projet :",e.message),e}}get client(){return this._client}}const C={ApiClient:x,Api:z};var N=m.A;export{N as default};
1
+ /*! For license information please see cocolight-api-client.mjs.js.LICENSE.txt */
2
+ import*as e from"events";import*as t from"ajv";import*as o from"ajv-formats";import*as n from"axios";import*as i from"axios-retry";import*as r from"ejson";import*as a from"pino";var s={251:(e,t)=>{t.L=function(e,t,o,n,i){var r,a,s=8*i-n-1,c=(1<<s)-1,m=c>>1,p=-7,l=o?i-1:0,d=o?-1:1,u=e[t+l];for(l+=d,r=u&(1<<-p)-1,u>>=-p,p+=s;p>0;r=256*r+e[t+l],l+=d,p-=8);for(a=r&(1<<-p)-1,r>>=-p,p+=n;p>0;a=256*a+e[t+l],l+=d,p-=8);if(0===r)r=1-m;else{if(r===c)return a?NaN:1/0*(u?-1:1);a+=Math.pow(2,n),r-=m}return(u?-1:1)*a*Math.pow(2,r-n)},t.M=function(e,t,o,n,i,r){var a,s,c,m=8*r-i-1,p=(1<<m)-1,l=p>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,u=n?0:r-1,f=n?1:-1,h=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=p):(a=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-a))<1&&(a--,c*=2),(t+=a+l>=1?d/c:d*Math.pow(2,1-l))*c>=2&&(a++,c/=2),a+l>=p?(s=0,a=p):a+l>=1?(s=(t*c-1)*Math.pow(2,i),a+=l):(s=t*Math.pow(2,l-1)*Math.pow(2,i),a=0));i>=8;e[o+u]=255&s,u+=f,s/=256,i-=8);for(a=a<<i|s,m+=i;m>0;e[o+u]=255&a,u+=f,a/=256,m-=8);e[o+u-f]|=128*h}},585:e=>{var t=1e3,o=60*t,n=60*o,i=24*n,r=7*i;function a(e,t,o,n){var i=t>=1.5*o;return Math.round(e/o)+" "+n+(i?"s":"")}e.exports=function(e,s){s=s||{};var c,m,p=typeof e;if("string"===p&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(a){var s=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*s;case"weeks":case"week":case"w":return s*r;case"days":case"day":case"d":return s*i;case"hours":case"hour":case"hrs":case"hr":case"h":return s*n;case"minutes":case"minute":case"mins":case"min":case"m":return s*o;case"seconds":case"second":case"secs":case"sec":case"s":return s*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return s;default:return}}}}(e);if("number"===p&&isFinite(e))return s.long?(c=e,(m=Math.abs(c))>=i?a(c,m,i,"day"):m>=n?a(c,m,n,"hour"):m>=o?a(c,m,o,"minute"):m>=t?a(c,m,t,"second"):c+" ms"):function(e){var r=Math.abs(e);return r>=i?Math.round(e/i)+"d":r>=n?Math.round(e/n)+"h":r>=o?Math.round(e/o)+"m":r>=t?Math.round(e/t)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},736:(e,t,o)=>{e.exports=function(e){function t(e){let o,i,r,a=null;function s(...e){if(!s.enabled)return;const n=s,i=Number(new Date),r=i-(o||i);n.diff=r,n.prev=o,n.curr=i,o=i,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((o,i)=>{if("%%"===o)return"%";a++;const r=t.formatters[i];if("function"==typeof r){const t=e[a];o=r.call(n,t),e.splice(a,1),a--}return o})),t.formatArgs.call(n,e),(n.log||t.log).apply(n,e)}return s.namespace=e,s.useColors=t.useColors(),s.color=t.selectColor(e),s.extend=n,s.destroy=t.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==a?a:(i!==t.namespaces&&(i=t.namespaces,r=t.enabled(e)),r),set:e=>{a=e}}),"function"==typeof t.init&&t.init(s),s}function n(e,o){const n=t(this.namespace+(void 0===o?":":o)+e);return n.log=this.log,n}function i(e,t){let o=0,n=0,i=-1,r=0;for(;o<e.length;)if(n<t.length&&(t[n]===e[o]||"*"===t[n]))"*"===t[n]?(i=n,r=o,n++):(o++,n++);else{if(-1===i)return!1;n=i+1,r++,o=r}for(;n<t.length&&"*"===t[n];)n++;return n===t.length}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){const e=[...t.names,...t.skips.map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){t.save(e),t.namespaces=e,t.names=[],t.skips=[];const o=("string"==typeof e?e:"").trim().replace(" ",",").split(",").filter(Boolean);for(const e of o)"-"===e[0]?t.skips.push(e.slice(1)):t.names.push(e)},t.enabled=function(e){for(const o of t.skips)if(i(e,o))return!1;for(const o of t.names)if(i(e,o))return!0;return!1},t.humanize=o(585),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((o=>{t[o]=e[o]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let o=0;for(let t=0;t<e.length;t++)o=(o<<5)-o+e.charCodeAt(t),o|=0;return t.colors[Math.abs(o)%t.colors.length]},t.enable(t.load()),t}},833:(e,t,o)=>{t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const o="color: "+this.color;t.splice(1,0,o,"color: inherit");let n=0,i=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(n++,"%c"===e&&(i=n))})),t.splice(i,0,o)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=o(736)(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}},c={};function m(e){var t=c[e];if(void 0!==t)return t.exports;var o=c[e]={exports:{}};return s[e](o,o.exports,m),o.exports}m.d=(e,t)=>{for(var o in t)m.o(t,o)&&!m.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},m.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),m.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var p={};m.d(p,{A:()=>mt});var l={};m.r(l),m.d(l,{ApiAuthenticationError:()=>g,ApiClientError:()=>u,ApiError:()=>d,ApiResponseError:()=>y,ApiValidationError:()=>f,CircuitBreakerError:()=>h});class d extends Error{constructor(e,t,o){super(e),this.name="ApiError",this.status=t,this.details=o}}class u extends d{constructor(e,t,o){super(e,t,o),this.name="ApiClientError"}}class f extends Error{constructor(e,t,o,n=null){super(e),this.name="ApiValidationError",this.status=t,this.messages=o,this.details=n}}class h extends d{constructor(e){super(e,503),this.name="CircuitBreakerError"}}class y extends Error{constructor(e,t,o,n=null){super(e),this.name="ApiResponseError",this.status=t,this.responseData=o,this.details=n}}class g extends d{constructor(e,t,o){super(e,t,o),this.name="ApiAuthenticationError"}}const w={async resolveId(e){if(!this.id&&this.slug)try{const t=await this._getElementsKey({pathParams:{slug:this.slug}});if(!t?.contextId||t?.contextType!==e)throw new y(`Le slug ${this.slug} ne correspond pas à un ${e}`,200,t);this._id(t.contextId)}catch(t){throw t instanceof y?t?.responseData?.contextType!==e?t:new y(`Impossible de récupérer l'identifiant pour le slug ${this.slug}`,t.status,t.responseData):t}return this.id},async getPublicProfile(){return await this.resolveId(this.getEntityType()),this._getElementsAbout({pathParams:{id:this.id,type:this.getEntityType()}})},async _getElementsAbout(e={}){return this.call("GET_ELEMENTS_ABOUT",e)},async _getElementsKey(e={}){return this.call("GET_ELEMENTS_KEY",e)},async _profilImage(e={}){return this.callIsConnected("PROFIL_IMAGE",e)},async _updateSettings(e={}){return this.callIsConnected("UPDATE_SETTINGS",e)},async _updateBlockDescription(e={}){return this.callIsConnected("UPDATE_BLOCK_DESCRIPTION",e)},async _updateBlockInfo(e={}){return this.callIsConnected("UPDATE_BLOCK_INFO",e)},async _updateBlockSocial(e={}){return this.callIsConnected("UPDATE_BLOCK_SOCIAL",e)},async _updateBlockLocality(e={}){return this.callIsConnected("UPDATE_BLOCK_LOCALITY",e)},async _updateBlockSlug(e={}){return this.callIsConnected("UPDATE_BLOCK_SLUG",e)},async _check(e={}){return this.callIsConnected("CHECK",e)}},b={async _getNews(e={}){return this.call("GET_NEWS",e)},async _getNewsById(e={}){return this.call("GET_NEWS_BY_ID",e)},async _addNews(e={}){return this.callIsConnected("ADD_NEWS",e)},async _addImageNews(e={}){return this.callIsConnected("ADD_IMAGE_NEWS",e)},async _addFileNews(e={}){return this.callIsConnected("ADD_FILE_NEWS",e)},async _deleteNews(e={}){return this.callIsConnected("DELETE_NEWS",e)},async _updateNews(e={}){return this.callIsConnected("UPDATE_NEWS",e)},async _shareNews(e={}){return this.callIsConnected("SHARE_NEWS",e)}};function x(e){return new DataView(e.buffer,e.byteOffset)}m(251);const k={len:1,get:(e,t)=>x(e).getUint8(t),put:(e,t,o)=>(x(e).setUint8(t,o),t+1)},v={len:2,get:(e,t)=>x(e).getUint16(t,!0),put:(e,t,o)=>(x(e).setUint16(t,o,!0),t+2)},T={len:2,get:(e,t)=>x(e).getUint16(t),put:(e,t,o)=>(x(e).setUint16(t,o),t+2)},P={len:4,get:(e,t)=>x(e).getUint32(t,!0),put:(e,t,o)=>(x(e).setUint32(t,o,!0),t+4)},_={len:4,get:(e,t)=>x(e).getUint32(t),put:(e,t,o)=>(x(e).setUint32(t,o),t+4)},S={len:4,get:(e,t)=>x(e).getInt32(t),put:(e,t,o)=>(x(e).setInt32(t,o),t+4)},I={len:8,get:(e,t)=>x(e).getBigUint64(t,!0),put:(e,t,o)=>(x(e).setBigUint64(t,o,!0),t+8)};class A{constructor(e,t){this.len=e,this.encoding=t,this.textDecoder=new TextDecoder(t)}get(e,t){return this.textDecoder.decode(e.subarray(t,t+this.len))}}class E extends Error{constructor(){super("End-Of-Stream"),this.name="EndOfStreamError"}}class C extends Error{constructor(e="The operation was aborted"){super(e),this.name="AbortError"}}class j{constructor(){this.endOfStream=!1,this.interrupted=!1,this.peekQueue=[]}async peek(e,t=!1){const o=await this.read(e,t);return this.peekQueue.push(e.subarray(0,o)),o}async read(e,t=!1){if(0===e.length)return 0;let o=this.readFromPeekBuffer(e);if(this.endOfStream||(o+=await this.readRemainderFromStream(e.subarray(o),t)),0===o)throw new E;return o}readFromPeekBuffer(e){let t=e.length,o=0;for(;this.peekQueue.length>0&&t>0;){const n=this.peekQueue.pop();if(!n)throw new Error("peekData should be defined");const i=Math.min(n.length,t);e.set(n.subarray(0,i),o),o+=i,t-=i,i<n.length&&this.peekQueue.push(n.subarray(i))}return o}async readRemainderFromStream(e,t){let o=0;for(;o<e.length&&!this.endOfStream;){if(this.interrupted)throw new C;const n=await this.readFromStream(e.subarray(o),t);if(0===n)break;o+=n}if(!t&&o<e.length)throw new E;return o}}class O extends j{constructor(e){super(),this.reader=e}async abort(){return this.close()}async close(){this.reader.releaseLock()}}class $ extends O{async readFromStream(e,t){if(0===e.length)return 0;const o=await this.reader.read(new Uint8Array(e.length),{min:t?void 0:e.length});return o.done&&(this.endOfStream=o.done),o.value?(e.set(o.value),o.value.length):0}}class z extends j{constructor(e){super(),this.reader=e,this.buffer=null}writeChunk(e,t){const o=Math.min(t.length,e.length);return e.set(t.subarray(0,o)),o<t.length?this.buffer=t.subarray(o):this.buffer=null,o}async readFromStream(e,t){if(0===e.length)return 0;let o=0;for(this.buffer&&(o+=this.writeChunk(e,this.buffer));o<e.length&&!this.endOfStream;){const t=await this.reader.read();if(t.done){this.endOfStream=!0;break}t.value&&(o+=this.writeChunk(e.subarray(o),t.value))}if(0===o&&this.endOfStream)throw new E;return o}abort(){return this.interrupted=!0,this.reader.cancel()}async close(){await this.abort(),this.reader.releaseLock()}}class q{constructor(e){this.numBuffer=new Uint8Array(8),this.position=0,this.onClose=e?.onClose,e?.abortSignal&&e.abortSignal.addEventListener("abort",(()=>{this.abort()}))}async readToken(e,t=this.position){const o=new Uint8Array(e.len);if(await this.readBuffer(o,{position:t})<e.len)throw new E;return e.get(o,0)}async peekToken(e,t=this.position){const o=new Uint8Array(e.len);if(await this.peekBuffer(o,{position:t})<e.len)throw new E;return e.get(o,0)}async readNumber(e){if(await this.readBuffer(this.numBuffer,{length:e.len})<e.len)throw new E;return e.get(this.numBuffer,0)}async peekNumber(e){if(await this.peekBuffer(this.numBuffer,{length:e.len})<e.len)throw new E;return e.get(this.numBuffer,0)}async ignore(e){if(void 0!==this.fileInfo.size){const t=this.fileInfo.size-this.position;if(e>t)return this.position+=t,t}return this.position+=e,e}async close(){await this.abort(),await(this.onClose?.())}normalizeOptions(e,t){if(!this.supportsRandomAccess()&&t&&void 0!==t.position&&t.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");return{mayBeLess:!1,offset:0,length:e.length,position:this.position,...t}}abort(){return Promise.resolve()}}class N extends q{constructor(e,t){super(t),this.streamReader=e,this.fileInfo=t?.fileInfo??{}}async readBuffer(e,t){const o=this.normalizeOptions(e,t),n=o.position-this.position;if(n>0)return await this.ignore(n),this.readBuffer(e,t);if(n<0)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");if(0===o.length)return 0;const i=await this.streamReader.read(e.subarray(0,o.length),o.mayBeLess);if(this.position+=i,(!t||!t.mayBeLess)&&i<o.length)throw new E;return i}async peekBuffer(e,t){const o=this.normalizeOptions(e,t);let n=0;if(o.position){const t=o.position-this.position;if(t>0){const i=new Uint8Array(o.length+t);return n=await this.peekBuffer(i,{mayBeLess:o.mayBeLess}),e.set(i.subarray(t)),n-t}if(t<0)throw new Error("Cannot peek from a negative offset in a stream")}if(o.length>0){try{n=await this.streamReader.peek(e.subarray(0,o.length),o.mayBeLess)}catch(e){if(t?.mayBeLess&&e instanceof E)return 0;throw e}if(!o.mayBeLess&&n<o.length)throw new E}return n}async ignore(e){const t=Math.min(256e3,e),o=new Uint8Array(t);let n=0;for(;n<e;){const i=e-n,r=await this.readBuffer(o,{length:Math.min(t,i)});if(r<0)return r;n+=r}return n}abort(){return this.streamReader.abort()}async close(){return this.streamReader.close()}supportsRandomAccess(){return!1}}class M extends q{constructor(e,t){super(t),this.uint8Array=e,this.fileInfo={...t?.fileInfo??{},size:e.length}}async readBuffer(e,t){t?.position&&(this.position=t.position);const o=await this.peekBuffer(e,t);return this.position+=o,o}async peekBuffer(e,t){const o=this.normalizeOptions(e,t),n=Math.min(this.uint8Array.length-o.position,o.length);if(!o.mayBeLess&&n<o.length)throw new E;return e.set(this.uint8Array.subarray(o.position,o.position+n)),n}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(e){this.position=e}}var B=Uint8Array,L=Uint16Array,F=Int32Array,D=new B([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),U=new B([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),R=new B([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),G=function(e,t){for(var o=new L(31),n=0;n<31;++n)o[n]=t+=1<<e[n-1];var i=new F(o[30]);for(n=1;n<30;++n)for(var r=o[n];r<o[n+1];++r)i[r]=r-o[n]<<5|n;return{b:o,r:i}},Z=G(D,2),V=Z.b,K=Z.r;V[28]=258,K[258]=28;for(var W=G(U,0),J=W.b,H=(W.r,new L(32768)),Y=0;Y<32768;++Y){var Q=(43690&Y)>>1|(21845&Y)<<1;Q=(61680&(Q=(52428&Q)>>2|(13107&Q)<<2))>>4|(3855&Q)<<4,H[Y]=((65280&Q)>>8|(255&Q)<<8)>>1}var X=function(e,t,o){for(var n=e.length,i=0,r=new L(t);i<n;++i)e[i]&&++r[e[i]-1];var a,s=new L(t);for(i=1;i<t;++i)s[i]=s[i-1]+r[i-1]<<1;if(o){a=new L(1<<t);var c=15-t;for(i=0;i<n;++i)if(e[i])for(var m=i<<4|e[i],p=t-e[i],l=s[e[i]-1]++<<p,d=l|(1<<p)-1;l<=d;++l)a[H[l]>>c]=m}else for(a=new L(n),i=0;i<n;++i)e[i]&&(a[i]=H[s[e[i]-1]++]>>15-e[i]);return a},ee=new B(288);for(Y=0;Y<144;++Y)ee[Y]=8;for(Y=144;Y<256;++Y)ee[Y]=9;for(Y=256;Y<280;++Y)ee[Y]=7;for(Y=280;Y<288;++Y)ee[Y]=8;var te=new B(32);for(Y=0;Y<32;++Y)te[Y]=5;var oe=X(ee,9,1),ne=X(te,5,1),ie=function(e){for(var t=e[0],o=1;o<e.length;++o)e[o]>t&&(t=e[o]);return t},re=function(e,t,o){var n=t/8|0;return(e[n]|e[n+1]<<8)>>(7&t)&o},ae=function(e,t){var o=t/8|0;return(e[o]|e[o+1]<<8|e[o+2]<<16)>>(7&t)},se=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],ce=function(e,t,o){var n=new Error(t||se[e]);if(n.code=e,Error.captureStackTrace&&Error.captureStackTrace(n,ce),!o)throw n;return n},me=function(e,t,o,n){var i=e.length,r=n?n.length:0;if(!i||t.f&&!t.l)return o||new B(0);var a=!o,s=a||2!=t.i,c=t.i;a&&(o=new B(3*i));var m,p=function(e){var t=o.length;if(e>t){var n=new B(Math.max(2*t,e));n.set(o),o=n}},l=t.f||0,d=t.p||0,u=t.b||0,f=t.l,h=t.d,y=t.m,g=t.n,w=8*i;do{if(!f){l=re(e,d,1);var b=re(e,d+1,3);if(d+=3,!b){var x=e[(m=d,(j=4+((m+7)/8|0))-4)]|e[j-3]<<8,k=j+x;if(k>i){c&&ce(0);break}s&&p(u+x),o.set(e.subarray(j,k),u),t.b=u+=x,t.p=d=8*k,t.f=l;continue}if(1==b)f=oe,h=ne,y=9,g=5;else if(2==b){var v=re(e,d,31)+257,T=re(e,d+10,15)+4,P=v+re(e,d+5,31)+1;d+=14;for(var _=new B(P),S=new B(19),I=0;I<T;++I)S[R[I]]=re(e,d+3*I,7);d+=3*T;var A=ie(S),E=(1<<A)-1,C=X(S,A,1);for(I=0;I<P;){var j,O=C[re(e,d,E)];if(d+=15&O,(j=O>>4)<16)_[I++]=j;else{var $=0,z=0;for(16==j?(z=3+re(e,d,3),d+=2,$=_[I-1]):17==j?(z=3+re(e,d,7),d+=3):18==j&&(z=11+re(e,d,127),d+=7);z--;)_[I++]=$}}var q=_.subarray(0,v),N=_.subarray(v);y=ie(q),g=ie(N),f=X(q,y,1),h=X(N,g,1)}else ce(1);if(d>w){c&&ce(0);break}}s&&p(u+131072);for(var M=(1<<y)-1,L=(1<<g)-1,F=d;;F=d){var G=($=f[ae(e,d)&M])>>4;if((d+=15&$)>w){c&&ce(0);break}if($||ce(2),G<256)o[u++]=G;else{if(256==G){F=d,f=null;break}var Z=G-254;if(G>264){var K=D[I=G-257];Z=re(e,d,(1<<K)-1)+V[I],d+=K}var W=h[ae(e,d)&L],H=W>>4;if(W||ce(3),d+=15&W,N=J[H],H>3&&(K=U[H],N+=ae(e,d)&(1<<K)-1,d+=K),d>w){c&&ce(0);break}s&&p(u+131072);var Y=u+Z;if(u<N){var Q=r-N,ee=Math.min(N,Y);for(Q+u<0&&ce(3);u<ee;++u)o[u]=n[Q+u]}for(;u<Y;++u)o[u]=o[u-N]}}t.l=f,t.p=F,t.b=u,t.f=l,f&&(l=1,t.m=y,t.d=h,t.n=g)}while(!l);return u!=o.length&&a?function(e,t,o){return(null==t||t<0)&&(t=0),(null==o||o>e.length)&&(o=e.length),new B(e.subarray(t,o))}(o,0,u):o.subarray(0,u)},pe=new B(0);function le(e,t){var o,n,i=function(e){31==e[0]&&139==e[1]&&8==e[2]||ce(6,"invalid gzip data");var t=e[3],o=10;4&t&&(o+=2+(e[10]|e[11]<<8));for(var n=(t>>3&1)+(t>>4&1);n>0;n-=!e[o++]);return o+(2&t)}(e);return i+8>e.length&&ce(6,"invalid gzip data"),me(e.subarray(i,-8),{i:2},t&&t.out||new B((n=(o=e).length,(o[n-4]|o[n-3]<<8|o[n-2]<<16|o[n-1]<<24)>>>0)),t&&t.dictionary)}function de(e,t){return me(e.subarray((o=e,n=t&&t.dictionary,(8!=(15&o[0])||o[0]>>4>7||(o[0]<<8|o[1])%31)&&ce(6,"invalid zlib data"),(o[1]>>5&1)==+!n&&ce(6,"invalid zlib data: "+(32&o[1]?"need":"unexpected")+" dictionary"),2+(o[1]>>3&4)),-4),{i:2},t&&t.out,t&&t.dictionary);var o,n}var ue="undefined"!=typeof TextDecoder&&new TextDecoder;try{ue.decode(pe,{stream:!0})}catch(e){}"function"==typeof queueMicrotask?queueMicrotask:"function"==typeof setTimeout&&setTimeout;var fe=m(833);const he=67324752,ye=33639248,ge={get:e=>(v.get(e,6),{signature:P.get(e,0),compressedSize:P.get(e,8),uncompressedSize:P.get(e,12)}),len:16},we={get(e){const t=v.get(e,6);return{signature:P.get(e,0),minVersion:v.get(e,4),dataDescriptor:!!(8&t),compressedMethod:v.get(e,8),compressedSize:P.get(e,18),uncompressedSize:P.get(e,22),filenameLength:v.get(e,26),extraFieldLength:v.get(e,28),filename:null}},len:30},be={get:e=>({signature:P.get(e,0),nrOfThisDisk:v.get(e,4),nrOfThisDiskWithTheStart:v.get(e,6),nrOfEntriesOnThisDisk:v.get(e,8),nrOfEntriesOfSize:v.get(e,10),sizeOfCd:P.get(e,12),offsetOfStartOfCd:P.get(e,16),zipFileCommentLength:v.get(e,20)}),len:22},xe={get(e){const t=v.get(e,8);return{signature:P.get(e,0),minVersion:v.get(e,6),dataDescriptor:!!(8&t),compressedMethod:v.get(e,10),compressedSize:P.get(e,20),uncompressedSize:P.get(e,24),filenameLength:v.get(e,28),extraFieldLength:v.get(e,30),fileCommentLength:v.get(e,32),relativeOffsetOfLocalHeader:P.get(e,42),filename:null}},len:46};function ke(e){const t=new Uint8Array(P.len);return P.put(t,0,e),t}const ve=fe("tokenizer:inflate"),Te=262144,Pe=ke(134695760),_e=ke(101010256);class Se{constructor(e){this.tokenizer=e,this.syncBuffer=new Uint8Array(Te)}async isZip(){return await this.peekSignature()===he}peekSignature(){return this.tokenizer.peekToken(P)}async findEndOfCentralDirectoryLocator(){const e=this.tokenizer,t=Math.min(16384,e.fileInfo.size),o=this.syncBuffer.subarray(0,t);await this.tokenizer.readBuffer(o,{position:e.fileInfo.size-t});for(let n=o.length-4;n>=0;n--)if(o[n]===_e[0]&&o[n+1]===_e[1]&&o[n+2]===_e[2]&&o[n+3]===_e[3])return e.fileInfo.size-t+n;return-1}async readCentralDirectory(){if(!this.tokenizer.supportsRandomAccess())return void ve("Cannot reading central-directory without random-read support");ve("Reading central-directory...");const e=this.tokenizer.position,t=await this.findEndOfCentralDirectoryLocator();if(t>0){ve("Central-directory 32-bit signature found");const o=await this.tokenizer.readToken(be,t),n=[];this.tokenizer.setPosition(o.offsetOfStartOfCd);for(let e=0;e<o.nrOfEntriesOfSize;++e){const t=await this.tokenizer.readToken(xe);if(t.signature!==ye)throw new Error("Expected Central-File-Header signature");t.filename=await this.tokenizer.readToken(new A(t.filenameLength,"utf-8")),await this.tokenizer.ignore(t.extraFieldLength),await this.tokenizer.ignore(t.fileCommentLength),n.push(t),ve(`Add central-directory file-entry: n=${e+1}/${n.length}: filename=${n[e].filename}`)}return this.tokenizer.setPosition(e),n}this.tokenizer.setPosition(e)}async unzip(e){const t=await this.readCentralDirectory();if(t)return this.iterateOverCentralDirectory(t,e);let o=!1;do{const t=await this.readLocalFileHeader();if(!t)break;const n=e(t);let i;if(o=!!n.stop,await this.tokenizer.ignore(t.extraFieldLength),t.dataDescriptor&&0===t.compressedSize){const e=[];let o=Te;ve("Compressed-file-size unknown, scanning for next data-descriptor-signature....");let i=-1;for(;i<0&&o===Te;){o=await this.tokenizer.peekBuffer(this.syncBuffer,{mayBeLess:!0}),i=Ie(this.syncBuffer.subarray(0,o),Pe);const t=i>=0?i:o;if(n.handler){const o=new Uint8Array(t);await this.tokenizer.readBuffer(o),e.push(o)}else await this.tokenizer.ignore(t)}ve(`Found data-descriptor-signature at pos=${this.tokenizer.position}`),n.handler&&await this.inflate(t,Ae(e),n.handler)}else n.handler?(ve(`Reading compressed-file-data: ${t.compressedSize} bytes`),i=new Uint8Array(t.compressedSize),await this.tokenizer.readBuffer(i),await this.inflate(t,i,n.handler)):(ve(`Ignoring compressed-file-data: ${t.compressedSize} bytes`),await this.tokenizer.ignore(t.compressedSize));if(ve(`Reading data-descriptor at pos=${this.tokenizer.position}`),t.dataDescriptor&&134695760!==(await this.tokenizer.readToken(ge)).signature)throw new Error("Expected data-descriptor-signature at position "+(this.tokenizer.position-ge.len))}while(!o)}async iterateOverCentralDirectory(e,t){for(const o of e){const e=t(o);if(e.handler){this.tokenizer.setPosition(o.relativeOffsetOfLocalHeader);const t=await this.readLocalFileHeader();if(t){await this.tokenizer.ignore(t.extraFieldLength);const n=new Uint8Array(o.compressedSize);await this.tokenizer.readBuffer(n),await this.inflate(t,n,e.handler)}}if(e.stop)break}}inflate(e,t,o){return 0===e.compressedMethod?o(t):(ve(`Decompress filename=${e.filename}, compressed-size=${t.length}`),o(31==(n=t)[0]&&139==n[1]&&8==n[2]?le(n,i):8!=(15&n[0])||n[0]>>4>7||(n[0]<<8|n[1])%31?function(e,t){return me(e,{i:2},t&&t.out,t&&t.dictionary)}(n,i):de(n,i)));var n,i}async readLocalFileHeader(){const e=await this.tokenizer.peekToken(P);if(e===he){const e=await this.tokenizer.readToken(we);return e.filename=await this.tokenizer.readToken(new A(e.filenameLength,"utf-8")),e}if(e===ye)return!1;if(3759263696===e)throw new Error("Encrypted ZIP");throw new Error("Unexpected signature")}}function Ie(e,t){const o=e.length,n=t.length;if(n>o)return-1;for(let i=0;i<=o-n;i++){let o=!0;for(let r=0;r<n;r++)if(e[i+r]!==t[r]){o=!1;break}if(o)return i}return-1}function Ae(e){const t=e.reduce(((e,t)=>e+t.length),0),o=new Uint8Array(t);let n=0;for(const t of e)o.set(t,n),n+=t.length;return o}function Ee(e){const{byteLength:t}=e;return 6===t?e.getUint16(0)*2**32+e.getUint32(2):5===t?e.getUint8(0)*2**32+e.getUint32(1):4===t?e.getUint32(0):3===t?65536*e.getUint8(0)+e.getUint16(1):2===t?e.getUint16(0):1===t?e.getUint8(0):void 0}Object.prototype.toString,new globalThis.TextDecoder("utf8"),new globalThis.TextEncoder,Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));const Ce={get:(e,t)=>127&e[t+3]|e[t+2]<<7|e[t+1]<<14|e[t]<<21,len:4},je=4100;function Oe(e){switch(e){case"application/epub+zip":return{ext:"epub",mime:"application/epub+zip"};case"application/vnd.oasis.opendocument.text":return{ext:"odt",mime:"application/vnd.oasis.opendocument.text"};case"application/vnd.oasis.opendocument.text-template":return{ext:"ott",mime:"application/vnd.oasis.opendocument.text-template"};case"application/vnd.oasis.opendocument.spreadsheet":return{ext:"ods",mime:"application/vnd.oasis.opendocument.spreadsheet"};case"application/vnd.oasis.opendocument.spreadsheet-template":return{ext:"ots",mime:"application/vnd.oasis.opendocument.spreadsheet-template"};case"application/vnd.oasis.opendocument.presentation":return{ext:"odp",mime:"application/vnd.oasis.opendocument.presentation"};case"application/vnd.oasis.opendocument.presentation-template":return{ext:"otp",mime:"application/vnd.oasis.opendocument.presentation-template"};case"application/vnd.oasis.opendocument.graphics":return{ext:"odg",mime:"application/vnd.oasis.opendocument.graphics"};case"application/vnd.oasis.opendocument.graphics-template":return{ext:"otg",mime:"application/vnd.oasis.opendocument.graphics-template"};case"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":return{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"};case"application/vnd.ms-excel.sheet.macroEnabled":return{ext:"xlsm",mime:"application/vnd.ms-excel.sheet.macroEnabled.12"};case"application/vnd.openxmlformats-officedocument.spreadsheetml.template":return{ext:"xltx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.template"};case"application/vnd.ms-excel.template.macroEnabled":return{ext:"xltm",mime:"application/vnd.ms-excel.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return{ext:"docx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};case"application/vnd.ms-word.document.macroEnabled":return{ext:"docm",mime:"application/vnd.ms-word.document.macroEnabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.template":return{ext:"dotx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.template"};case"application/vnd.ms-word.template.macroEnabledTemplate":return{ext:"dotm",mime:"application/vnd.ms-word.template.macroEnabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.template":return{ext:"potx",mime:"application/vnd.openxmlformats-officedocument.presentationml.template"};case"application/vnd.ms-powerpoint.template.macroEnabled":return{ext:"potm",mime:"application/vnd.ms-powerpoint.template.macroEnabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.presentation":return{ext:"pptx",mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation"};case"application/vnd.ms-powerpoint.presentation.macroEnabled":return{ext:"pptm",mime:"application/vnd.ms-powerpoint.presentation.macroEnabled.12"};case"application/vnd.ms-visio.drawing":return{ext:"vsdx",mime:"application/vnd.visio"};case"application/vnd.ms-package.3dmanufacturing-3dmodel+xml":return{ext:"3mf",mime:"model/3mf"}}}function $e(e,t,o){o={offset:0,...o};for(const[n,i]of t.entries())if(o.mask){if(i!==(o.mask[n]&e[n+o.offset]))return!1}else if(i!==e[n+o.offset])return!1;return!0}class ze{constructor(e){this.detectors=[...e?.customDetectors??[],{id:"core",detect:this.detectConfident},{id:"core.imprecise",detect:this.detectImprecise}],this.tokenizerOptions={abortSignal:e?.signal}}async fromTokenizer(e){const t=e.position;for(const o of this.detectors){const n=await o.detect(e);if(n)return n;if(t!==e.position)return}}async fromBuffer(e){if(!(e instanceof Uint8Array||e instanceof ArrayBuffer))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof e}\``);const t=e instanceof Uint8Array?e:new Uint8Array(e);var o,n;if(t?.length>1)return this.fromTokenizer((o=t,n=this.tokenizerOptions,new M(o,n)))}async fromBlob(e){return this.fromStream(e.stream())}async fromStream(e){const t=await function(e,t){const o=function(e){try{const t=e.getReader({mode:"byob"});return t instanceof ReadableStreamDefaultReader?new z(t):new $(t)}catch(t){if(t instanceof TypeError)return new z(e.getReader());throw t}}(e),n=t??{},i=n.onClose;return n.onClose=async()=>{if(await o.close(),i)return i()},new N(o,n)}(e,this.tokenizerOptions);try{return await this.fromTokenizer(t)}finally{await t.close()}}async toDetectionStream(e,t){const{sampleSize:o=je}=t;let n,i;const r=e.getReader({mode:"byob"});try{const{value:e,done:t}=await r.read(new Uint8Array(o));if(i=e,!t&&e)try{n=await this.fromBuffer(e.slice(0,o))}catch(e){if(!(e instanceof E))throw e;n=void 0}i=e}finally{r.releaseLock()}const a=new TransformStream({async start(e){e.enqueue(i)},transform(e,t){t.enqueue(e)}}),s=e.pipeThrough(a);return s.fileType=n,s}check(e,t){return $e(this.buffer,e,t)}checkString(e,t){return this.check((o=e,[...o].map((e=>e.charCodeAt(0)))),t);var o}detectConfident=async e=>{if(this.buffer=new Uint8Array(je),void 0===e.fileInfo.size&&(e.fileInfo.size=Number.MAX_SAFE_INTEGER),this.tokenizer=e,await e.peekBuffer(this.buffer,{length:12,mayBeLess:!0}),this.check([66,77]))return{ext:"bmp",mime:"image/bmp"};if(this.check([11,119]))return{ext:"ac3",mime:"audio/vnd.dolby.dd-raw"};if(this.check([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(this.check([77,90]))return{ext:"exe",mime:"application/x-msdownload"};if(this.check([37,33]))return await e.peekBuffer(this.buffer,{length:24,mayBeLess:!0}),this.checkString("PS-Adobe-",{offset:2})&&this.checkString(" EPSF-",{offset:14})?{ext:"eps",mime:"application/eps"}:{ext:"ps",mime:"application/postscript"};if(this.check([31,160])||this.check([31,157]))return{ext:"Z",mime:"application/x-compress"};if(this.check([199,113]))return{ext:"cpio",mime:"application/x-cpio"};if(this.check([96,234]))return{ext:"arj",mime:"application/x-arj"};if(this.check([239,187,191]))return this.tokenizer.ignore(3),this.detectConfident(e);if(this.check([71,73,70]))return{ext:"gif",mime:"image/gif"};if(this.check([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(this.check([31,139,8]))return{ext:"gz",mime:"application/gzip"};if(this.check([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(this.checkString("ID3")){await e.ignore(6);const t=await e.readToken(Ce);return e.position+t>e.fileInfo.size?{ext:"mp3",mime:"audio/mpeg"}:(await e.ignore(t),this.fromTokenizer(e))}if(this.checkString("MP+"))return{ext:"mpc",mime:"audio/x-musepack"};if((67===this.buffer[0]||70===this.buffer[0])&&this.check([87,83],{offset:1}))return{ext:"swf",mime:"application/x-shockwave-flash"};if(this.check([255,216,255]))return this.check([247],{offset:3})?{ext:"jls",mime:"image/jls"}:{ext:"jpg",mime:"image/jpeg"};if(this.check([79,98,106,1]))return{ext:"avro",mime:"application/avro"};if(this.checkString("FLIF"))return{ext:"flif",mime:"image/flif"};if(this.checkString("8BPS"))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(this.checkString("MPCK"))return{ext:"mpc",mime:"audio/x-musepack"};if(this.checkString("FORM"))return{ext:"aif",mime:"audio/aiff"};if(this.checkString("icns",{offset:0}))return{ext:"icns",mime:"image/icns"};if(this.check([80,75,3,4])){let o;return await new Se(e).unzip((e=>{switch(e.filename){case"META-INF/mozilla.rsa":return o={ext:"xpi",mime:"application/x-xpinstall"},{stop:!0};case"META-INF/MANIFEST.MF":return o={ext:"jar",mime:"application/java-archive"},{stop:!0};case"mimetype":return{async handler(e){const t=new TextDecoder("utf-8").decode(e).trim();o=Oe(t)},stop:!0};case"[Content_Types].xml":return{async handler(e){let t=new TextDecoder("utf-8").decode(e);const n=t.indexOf('.main+xml"');if(-1===n){const e="application/vnd.ms-package.3dmanufacturing-3dmodel+xml";t.includes(`ContentType="${e}"`)&&(o=Oe(e))}else{t=t.slice(0,Math.max(0,n));const e=t.lastIndexOf('"'),i=t.slice(Math.max(0,e+1));o=Oe(i)}},stop:!0};default:return/classes\d*\.dex/.test(e.filename)?(o={ext:"apk",mime:"application/vnd.android.package-archive"},{stop:!0}):{}}})),o??{ext:"zip",mime:"application/zip"}}if(this.checkString("OggS")){await e.ignore(28);const n=new Uint8Array(8);return await e.readBuffer(n),$e(n,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/ogg; codecs=opus"}:$e(n,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:$e(n,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:$e(n,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:$e(n,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:$e(n,[1,118,111,114,98,105,115])?{ext:"ogg",mime:"audio/ogg"}:{ext:"ogx",mime:"application/ogg"}}if(this.check([80,75])&&(3===this.buffer[2]||5===this.buffer[2]||7===this.buffer[2])&&(4===this.buffer[3]||6===this.buffer[3]||8===this.buffer[3]))return{ext:"zip",mime:"application/zip"};if(this.checkString("MThd"))return{ext:"mid",mime:"audio/midi"};if(this.checkString("wOFF")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff",mime:"font/woff"};if(this.checkString("wOF2")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff2",mime:"font/woff2"};if(this.check([212,195,178,161])||this.check([161,178,195,212]))return{ext:"pcap",mime:"application/vnd.tcpdump.pcap"};if(this.checkString("DSD "))return{ext:"dsf",mime:"audio/x-dsf"};if(this.checkString("LZIP"))return{ext:"lz",mime:"application/x-lzip"};if(this.checkString("fLaC"))return{ext:"flac",mime:"audio/x-flac"};if(this.check([66,80,71,251]))return{ext:"bpg",mime:"image/bpg"};if(this.checkString("wvpk"))return{ext:"wv",mime:"audio/wavpack"};if(this.checkString("%PDF")){try{const i=1350;if(i===await e.ignore(i)){const r=10485760,a=new Uint8Array(Math.min(r,e.fileInfo.size-i));if(await e.readBuffer(a,{mayBeLess:!0}),-1!==function(e,t){const o=e.length,n=t.length;if(0===n)return-1;if(n>o)return-1;const i=o-n;for(let o=0;o<=i;o++){let i=!0;for(let r=0;r<n;r++)if(e[o+r]!==t[r]){i=!1;break}if(i)return o}return-1}(a,(new TextEncoder).encode("AIPrivateData")))return{ext:"ai",mime:"application/postscript"}}}catch(s){if(!(s instanceof E))throw s}return{ext:"pdf",mime:"application/pdf"}}if(this.check([0,97,115,109]))return{ext:"wasm",mime:"application/wasm"};if(this.check([73,73])){const c=await this.readTiffHeader(!1);if(c)return c}if(this.check([77,77])){const m=await this.readTiffHeader(!0);if(m)return m}if(this.checkString("MAC "))return{ext:"ape",mime:"audio/ape"};if(this.check([26,69,223,163])){async function p(){const t=await e.peekNumber(k);let o=128,n=0;for(;!(t&o)&&0!==o;)++n,o>>=1;const i=new Uint8Array(n+1);return await e.readBuffer(i),i}async function l(){const e=await p(),t=await p();t[0]^=128>>t.length-1;const o=Math.min(6,t.length),n=new DataView(e.buffer),i=new DataView(t.buffer,t.length-o,o);return{id:Ee(n),len:Ee(i)}}async function d(t){for(;t>0;){const o=await l();if(17026===o.id)return(await e.readToken(new A(o.len))).replaceAll(/\00.*$/g,"");await e.ignore(o.len),--t}}const u=await l();switch(await d(u.len)){case"webm":return{ext:"webm",mime:"video/webm"};case"matroska":return{ext:"mkv",mime:"video/x-matroska"};default:return}}if(this.checkString("SQLi"))return{ext:"sqlite",mime:"application/x-sqlite3"};if(this.check([78,69,83,26]))return{ext:"nes",mime:"application/x-nintendo-nes-rom"};if(this.checkString("Cr24"))return{ext:"crx",mime:"application/x-google-chrome-extension"};if(this.checkString("MSCF")||this.checkString("ISc("))return{ext:"cab",mime:"application/vnd.ms-cab-compressed"};if(this.check([237,171,238,219]))return{ext:"rpm",mime:"application/x-rpm"};if(this.check([197,208,211,198]))return{ext:"eps",mime:"application/eps"};if(this.check([40,181,47,253]))return{ext:"zst",mime:"application/zstd"};if(this.check([127,69,76,70]))return{ext:"elf",mime:"application/x-elf"};if(this.check([33,66,68,78]))return{ext:"pst",mime:"application/vnd.ms-outlook"};if(this.checkString("PAR1"))return{ext:"parquet",mime:"application/x-parquet"};if(this.checkString("ttcf"))return{ext:"ttc",mime:"font/collection"};if(this.check([207,250,237,254]))return{ext:"macho",mime:"application/x-mach-binary"};if(this.check([4,34,77,24]))return{ext:"lz4",mime:"application/x-lz4"};if(this.check([79,84,84,79,0]))return{ext:"otf",mime:"font/otf"};if(this.checkString("#!AMR"))return{ext:"amr",mime:"audio/amr"};if(this.checkString("{\\rtf"))return{ext:"rtf",mime:"application/rtf"};if(this.check([70,76,86,1]))return{ext:"flv",mime:"video/x-flv"};if(this.checkString("IMPM"))return{ext:"it",mime:"audio/x-it"};if(this.checkString("-lh0-",{offset:2})||this.checkString("-lh1-",{offset:2})||this.checkString("-lh2-",{offset:2})||this.checkString("-lh3-",{offset:2})||this.checkString("-lh4-",{offset:2})||this.checkString("-lh5-",{offset:2})||this.checkString("-lh6-",{offset:2})||this.checkString("-lh7-",{offset:2})||this.checkString("-lzs-",{offset:2})||this.checkString("-lz4-",{offset:2})||this.checkString("-lz5-",{offset:2})||this.checkString("-lhd-",{offset:2}))return{ext:"lzh",mime:"application/x-lzh-compressed"};if(this.check([0,0,1,186])){if(this.check([33],{offset:4,mask:[241]}))return{ext:"mpg",mime:"video/MP1S"};if(this.check([68],{offset:4,mask:[196]}))return{ext:"mpg",mime:"video/MP2P"}}if(this.checkString("ITSF"))return{ext:"chm",mime:"application/vnd.ms-htmlhelp"};if(this.check([202,254,186,190]))return{ext:"class",mime:"application/java-vm"};if(this.checkString(".RMF"))return{ext:"rm",mime:"application/vnd.rn-realmedia"};if(this.checkString("DRACO"))return{ext:"drc",mime:"application/vnd.google.draco"};if(this.check([253,55,122,88,90,0]))return{ext:"xz",mime:"application/x-xz"};if(this.checkString("<?xml "))return{ext:"xml",mime:"application/xml"};if(this.check([55,122,188,175,39,28]))return{ext:"7z",mime:"application/x-7z-compressed"};if(this.check([82,97,114,33,26,7])&&(0===this.buffer[6]||1===this.buffer[6]))return{ext:"rar",mime:"application/x-rar-compressed"};if(this.checkString("solid "))return{ext:"stl",mime:"model/stl"};if(this.checkString("AC")){const f=new A(4,"latin1").get(this.buffer,2);if(f.match("^d*")&&f>=1e3&&f<=1050)return{ext:"dwg",mime:"image/vnd.dwg"}}if(this.checkString("070707"))return{ext:"cpio",mime:"application/x-cpio"};if(this.checkString("BLENDER"))return{ext:"blend",mime:"application/x-blender"};if(this.checkString("!<arch>"))return await e.ignore(8),"debian-binary"===await e.readToken(new A(13,"ascii"))?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"};if(this.checkString("WEBVTT")&&["\n","\r","\t"," ","\0"].some((e=>this.checkString(e,{offset:6}))))return{ext:"vtt",mime:"text/vtt"};if(this.check([137,80,78,71,13,10,26,10])){async function h(){return{length:await e.readToken(S),type:await e.readToken(new A(4,"latin1"))}}await e.ignore(8);do{const y=await h();if(y.length<0)return;switch(y.type){case"IDAT":return{ext:"png",mime:"image/png"};case"acTL":return{ext:"apng",mime:"image/apng"};default:await e.ignore(y.length+4)}}while(e.position+8<e.fileInfo.size);return{ext:"png",mime:"image/png"}}if(this.check([65,82,82,79,87,49,0,0]))return{ext:"arrow",mime:"application/x-apache-arrow"};if(this.check([103,108,84,70,2,0,0,0]))return{ext:"glb",mime:"model/gltf-binary"};if(this.check([102,114,101,101],{offset:4})||this.check([109,100,97,116],{offset:4})||this.check([109,111,111,118],{offset:4})||this.check([119,105,100,101],{offset:4}))return{ext:"mov",mime:"video/quicktime"};if(this.check([73,73,82,79,8,0,0,0,24]))return{ext:"orf",mime:"image/x-olympus-orf"};if(this.checkString("gimp xcf "))return{ext:"xcf",mime:"image/x-xcf"};if(this.checkString("ftyp",{offset:4})&&96&this.buffer[8]){const g=new A(4,"latin1").get(this.buffer,8).replace("\0"," ").trim();switch(g){case"avif":case"avis":return{ext:"avif",mime:"image/avif"};case"mif1":return{ext:"heic",mime:"image/heif"};case"msf1":return{ext:"heic",mime:"image/heif-sequence"};case"heic":case"heix":return{ext:"heic",mime:"image/heic"};case"hevc":case"hevx":return{ext:"heic",mime:"image/heic-sequence"};case"qt":return{ext:"mov",mime:"video/quicktime"};case"M4V":case"M4VH":case"M4VP":return{ext:"m4v",mime:"video/x-m4v"};case"M4P":return{ext:"m4p",mime:"video/mp4"};case"M4B":return{ext:"m4b",mime:"audio/mp4"};case"M4A":return{ext:"m4a",mime:"audio/x-m4a"};case"F4V":return{ext:"f4v",mime:"video/mp4"};case"F4P":return{ext:"f4p",mime:"video/mp4"};case"F4A":return{ext:"f4a",mime:"audio/mp4"};case"F4B":return{ext:"f4b",mime:"audio/mp4"};case"crx":return{ext:"cr3",mime:"image/x-canon-cr3"};default:return g.startsWith("3g")?g.startsWith("3g2")?{ext:"3g2",mime:"video/3gpp2"}:{ext:"3gp",mime:"video/3gpp"}:{ext:"mp4",mime:"video/mp4"}}}if(this.check([82,73,70,70])){if(this.checkString("WEBP",{offset:8}))return{ext:"webp",mime:"image/webp"};if(this.check([65,86,73],{offset:8}))return{ext:"avi",mime:"video/vnd.avi"};if(this.check([87,65,86,69],{offset:8}))return{ext:"wav",mime:"audio/wav"};if(this.check([81,76,67,77],{offset:8}))return{ext:"qcp",mime:"audio/qcelp"}}if(this.check([73,73,85,0,24,0,0,0,136,231,116,216]))return{ext:"rw2",mime:"image/x-panasonic-rw2"};if(this.check([48,38,178,117,142,102,207,17,166,217])){async function w(){const t=new Uint8Array(16);return await e.readBuffer(t),{id:t,size:Number(await e.readToken(I))}}for(await e.ignore(30);e.position+24<e.fileInfo.size;){const b=await w();let x=b.size-24;if($e(b.id,[145,7,220,183,183,169,207,17,142,230,0,192,12,32,83,101])){const v=new Uint8Array(16);if(x-=await e.readBuffer(v),$e(v,[64,158,105,248,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"audio/x-ms-asf"};if($e(v,[192,239,25,188,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"video/x-ms-asf"};break}await e.ignore(x)}return{ext:"asf",mime:"application/vnd.ms-asf"}}if(this.check([171,75,84,88,32,49,49,187,13,10,26,10]))return{ext:"ktx",mime:"image/ktx"};if((this.check([126,16,4])||this.check([126,24,4]))&&this.check([48,77,73,69],{offset:4}))return{ext:"mie",mime:"application/x-mie"};if(this.check([39,10,0,0,0,0,0,0,0,0,0,0],{offset:2}))return{ext:"shp",mime:"application/x-esri-shape"};if(this.check([255,79,255,81]))return{ext:"j2c",mime:"image/j2c"};if(this.check([0,0,0,12,106,80,32,32,13,10,135,10]))switch(await e.ignore(20),await e.readToken(new A(4,"ascii"))){case"jp2 ":return{ext:"jp2",mime:"image/jp2"};case"jpx ":return{ext:"jpx",mime:"image/jpx"};case"jpm ":return{ext:"jpm",mime:"image/jpm"};case"mjp2":return{ext:"mj2",mime:"image/mj2"};default:return}if(this.check([255,10])||this.check([0,0,0,12,74,88,76,32,13,10,135,10]))return{ext:"jxl",mime:"image/jxl"};if(this.check([254,255]))return this.check([0,60,0,63,0,120,0,109,0,108],{offset:2})?{ext:"xml",mime:"application/xml"}:void 0;if(this.check([208,207,17,224,161,177,26,225]))return{ext:"cfb",mime:"application/x-cfb"};if(await e.peekBuffer(this.buffer,{length:Math.min(256,e.fileInfo.size),mayBeLess:!0}),this.check([97,99,115,112],{offset:36}))return{ext:"icc",mime:"application/vnd.iccprofile"};if(this.checkString("**ACE",{offset:7})&&this.checkString("**",{offset:12}))return{ext:"ace",mime:"application/x-ace-compressed"};if(this.checkString("BEGIN:")){if(this.checkString("VCARD",{offset:6}))return{ext:"vcf",mime:"text/vcard"};if(this.checkString("VCALENDAR",{offset:6}))return{ext:"ics",mime:"text/calendar"}}if(this.checkString("FUJIFILMCCD-RAW"))return{ext:"raf",mime:"image/x-fujifilm-raf"};if(this.checkString("Extended Module:"))return{ext:"xm",mime:"audio/x-xm"};if(this.checkString("Creative Voice File"))return{ext:"voc",mime:"audio/x-voc"};if(this.check([4,0,0,0])&&this.buffer.length>=16){const T=new DataView(this.buffer.buffer).getUint32(12,!0);if(T>12&&this.buffer.length>=T+16)try{const P=(new TextDecoder).decode(this.buffer.slice(16,T+16));if(JSON.parse(P).files)return{ext:"asar",mime:"application/x-asar"}}catch{}}return this.check([6,14,43,52,2,5,1,1,13,1,2,1,1,2])?{ext:"mxf",mime:"application/mxf"}:this.checkString("SCRM",{offset:44})?{ext:"s3m",mime:"audio/x-s3m"}:this.check([71])&&this.check([71],{offset:188})||this.check([71],{offset:4})&&this.check([71],{offset:196})?{ext:"mts",mime:"video/mp2t"}:this.check([66,79,79,75,77,79,66,73],{offset:60})?{ext:"mobi",mime:"application/x-mobipocket-ebook"}:this.check([68,73,67,77],{offset:128})?{ext:"dcm",mime:"application/dicom"}:this.check([76,0,0,0,1,20,2,0,0,0,0,0,192,0,0,0,0,0,0,70])?{ext:"lnk",mime:"application/x.ms.shortcut"}:this.check([98,111,111,107,0,0,0,0,109,97,114,107,0,0,0,0])?{ext:"alias",mime:"application/x.apple.alias"}:this.checkString("Kaydara FBX Binary \0")?{ext:"fbx",mime:"application/x.autodesk.fbx"}:this.check([76,80],{offset:34})&&(this.check([0,0,1],{offset:8})||this.check([1,0,2],{offset:8})||this.check([2,0,2],{offset:8}))?{ext:"eot",mime:"application/vnd.ms-fontobject"}:this.check([6,6,237,245,216,29,70,229,189,49,239,231,254,116,183,29])?{ext:"indd",mime:"application/x-indesign"}:(await e.peekBuffer(this.buffer,{length:Math.min(512,e.fileInfo.size),mayBeLess:!0}),function(e,t=0){const o=Number.parseInt(new A(6).get(e,148).replace(/\0.*$/,"").trim(),8);if(Number.isNaN(o))return!1;let n=256;for(let o=t;o<t+148;o++)n+=e[o];for(let o=t+156;o<t+512;o++)n+=e[o];return o===n}(this.buffer)?{ext:"tar",mime:"application/x-tar"}:this.check([255,254])?this.check([60,0,63,0,120,0,109,0,108,0],{offset:2})?{ext:"xml",mime:"application/xml"}:this.check([255,14,83,0,107,0,101,0,116,0,99,0,104,0,85,0,112,0,32,0,77,0,111,0,100,0,101,0,108,0],{offset:2})?{ext:"skp",mime:"application/vnd.sketchup.skp"}:void 0:this.checkString("-----BEGIN PGP MESSAGE-----")?{ext:"pgp",mime:"application/pgp-encrypted"}:void 0)};detectImprecise=async e=>{if(this.buffer=new Uint8Array(je),await e.peekBuffer(this.buffer,{length:Math.min(8,e.fileInfo.size),mayBeLess:!0}),this.check([0,0,1,186])||this.check([0,0,1,179]))return{ext:"mpg",mime:"video/mpeg"};if(this.check([0,1,0,0,0]))return{ext:"ttf",mime:"font/ttf"};if(this.check([0,0,1,0]))return{ext:"ico",mime:"image/x-icon"};if(this.check([0,0,2,0]))return{ext:"cur",mime:"image/x-icon"};if(this.buffer.length>=2&&this.check([255,224],{offset:0,mask:[255,224]})){if(this.check([16],{offset:1,mask:[22]}))return this.check([8],{offset:1,mask:[8]}),{ext:"aac",mime:"audio/aac"};if(this.check([2],{offset:1,mask:[6]}))return{ext:"mp3",mime:"audio/mpeg"};if(this.check([4],{offset:1,mask:[6]}))return{ext:"mp2",mime:"audio/mpeg"};if(this.check([6],{offset:1,mask:[6]}))return{ext:"mp1",mime:"audio/mpeg"}}};async readTiffTag(e){const t=await this.tokenizer.readToken(e?T:v);switch(this.tokenizer.ignore(10),t){case 50341:return{ext:"arw",mime:"image/x-sony-arw"};case 50706:return{ext:"dng",mime:"image/x-adobe-dng"}}}async readTiffIFD(e){const t=await this.tokenizer.readToken(e?T:v);for(let o=0;o<t;++o){const t=await this.readTiffTag(e);if(t)return t}}async readTiffHeader(e){const t=(e?T:v).get(this.buffer,2),o=(e?_:P).get(this.buffer,4);if(42===t){if(o>=6){if(this.checkString("CR",{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(o>=8){const t=(e?T:v).get(this.buffer,8),o=(e?T:v).get(this.buffer,10);if(28===t&&254===o||31===t&&11===o)return{ext:"nef",mime:"image/x-nikon-nef"}}}return await this.tokenizer.ignore(o),await this.readTiffIFD(e)??{ext:"tif",mime:"image/tiff"}}if(43===t)return{ext:"tif",mime:"image/tiff"}}}new Set(["jpg","png","apng","gif","webp","flif","xcf","cr2","cr3","orf","arw","dng","nef","rw2","raf","tif","bmp","icns","jxr","psd","indd","zip","tar","rar","gz","bz2","7z","dmg","mp4","mid","mkv","webm","mov","avi","mpg","mp2","mp3","m4a","oga","ogg","ogv","opus","flac","wav","spx","amr","pdf","epub","elf","macho","exe","swf","rtf","wasm","woff","woff2","eot","ttf","otf","ttc","ico","flv","ps","xz","sqlite","nes","crx","xpi","cab","deb","ar","rpm","Z","lz","cfb","mxf","mts","blend","bpg","docx","pptx","xlsx","3gp","3g2","j2c","jp2","jpm","jpx","mj2","aif","qcp","odt","ods","odp","xml","mobi","heic","cur","ktx","ape","wv","dcm","ics","glb","pcap","dsf","lnk","alias","voc","ac3","m4v","m4p","m4b","f4v","f4p","f4b","f4a","mie","asf","ogm","ogx","mpc","arrow","shp","aac","mp1","it","s3m","xm","ai","skp","avif","eps","lzh","pgp","asar","stl","chm","3mf","zst","jxl","vcf","jls","pst","dwg","parquet","class","arj","cpio","ace","avro","icc","fbx","vsdx","vtt","apk","drc","lz4","potx","xltx","dotx","xltm","ott","ots","otp","odg","otg","xlsm","docm","dotm","potm","pptm","jar","rm"]),new Set(["image/jpeg","image/png","image/gif","image/webp","image/flif","image/x-xcf","image/x-canon-cr2","image/x-canon-cr3","image/tiff","image/bmp","image/vnd.ms-photo","image/vnd.adobe.photoshop","application/x-indesign","application/epub+zip","application/x-xpinstall","application/vnd.oasis.opendocument.text","application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/zip","application/x-tar","application/x-rar-compressed","application/gzip","application/x-bzip2","application/x-7z-compressed","application/x-apple-diskimage","application/x-apache-arrow","video/mp4","audio/midi","video/x-matroska","video/webm","video/quicktime","video/vnd.avi","audio/wav","audio/qcelp","audio/x-ms-asf","video/x-ms-asf","application/vnd.ms-asf","video/mpeg","video/3gpp","audio/mpeg","audio/mp4","video/ogg","audio/ogg","audio/ogg; codecs=opus","application/ogg","audio/x-flac","audio/ape","audio/wavpack","audio/amr","application/pdf","application/x-elf","application/x-mach-binary","application/x-msdownload","application/x-shockwave-flash","application/rtf","application/wasm","font/woff","font/woff2","application/vnd.ms-fontobject","font/ttf","font/otf","font/collection","image/x-icon","video/x-flv","application/postscript","application/eps","application/x-xz","application/x-sqlite3","application/x-nintendo-nes-rom","application/x-google-chrome-extension","application/vnd.ms-cab-compressed","application/x-deb","application/x-unix-archive","application/x-rpm","application/x-compress","application/x-lzip","application/x-cfb","application/x-mie","application/mxf","video/mp2t","application/x-blender","image/bpg","image/j2c","image/jp2","image/jpx","image/jpm","image/mj2","audio/aiff","application/xml","application/x-mobipocket-ebook","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/icns","image/ktx","application/dicom","audio/x-musepack","text/calendar","text/vcard","text/vtt","model/gltf-binary","application/vnd.tcpdump.pcap","audio/x-dsf","application/x.ms.shortcut","application/x.apple.alias","audio/x-voc","audio/vnd.dolby.dd-raw","audio/x-m4a","image/apng","image/x-olympus-orf","image/x-sony-arw","image/x-adobe-dng","image/x-nikon-nef","image/x-panasonic-rw2","image/x-fujifilm-raf","video/x-m4v","video/3gpp2","application/x-esri-shape","audio/aac","audio/x-it","audio/x-s3m","audio/x-xm","video/MP1S","video/MP2P","application/vnd.sketchup.skp","image/avif","application/x-lzh-compressed","application/pgp-encrypted","application/x-asar","model/stl","application/vnd.ms-htmlhelp","model/3mf","image/jxl","application/zstd","image/jls","application/vnd.ms-outlook","image/vnd.dwg","application/x-parquet","application/java-vm","application/x-arj","application/x-cpio","application/x-ace-compressed","application/avro","application/vnd.iccprofile","application/x.autodesk.fbx","application/vnd.visio","application/vnd.android.package-archive","application/vnd.google.draco","application/x-lz4","application/vnd.openxmlformats-officedocument.presentationml.template","application/vnd.openxmlformats-officedocument.spreadsheetml.template","application/vnd.openxmlformats-officedocument.wordprocessingml.template","application/vnd.ms-excel.template.macroenabled.12","application/vnd.oasis.opendocument.text-template","application/vnd.oasis.opendocument.spreadsheet-template","application/vnd.oasis.opendocument.presentation-template","application/vnd.oasis.opendocument.graphics","application/vnd.oasis.opendocument.graphics-template","application/vnd.ms-excel.sheet.macroEnabled.12","application/vnd.ms-word.document.macroEnabled.12","application/vnd.ms-word.template.macroEnabled.12","application/vnd.ms-powerpoint.template.macroEnabled.12","application/vnd.ms-powerpoint.presentation.macroEnabled.12","application/java-archive","application/vnd.rn-realmedia"]);const qe={async call(e,t={}){return this.apiClient.safeCall((async()=>{const o=await this.apiClient.callEndpoint(e,t);return this.apiClient.checkAndThrowApiResponseError(o),o.data}))},async callNoConnected(e,t={}){if(this.isConnected)throw new g("Vous devez ne devez pas être connecté pour faire cette action.");return this.call(e,t)},async callIsConnected(e,t={}){if(!this.isConnected)throw new g("Vous devez être connecté pour faire cette action.");return"function"==typeof e?await e():this.call(e,t)},async callIsMe(e,t={}){if(!this.isMe)throw new g("Vous devez être vous-même pour faire cette action.");return"function"==typeof e?await e():await this.callIsConnected(e,t)},async validateImage(e){if(!e)throw new f("Le fichier est requis.");let t="";if("undefined"!=typeof File&&e instanceof File){if(t=e.type,!t||!t.startsWith("image/")||!["image/jpg","image/jpeg","image/png"].includes(t))throw new f("Le fichier doit être une image valide.")}else if("undefined"!=typeof Blob&&e instanceof Blob){t=e.type;const o=`${Date.now()}.${t.split("/")[1]}`;if(e=new File([e],o,{type:t}),console.log(o),!t||!t.startsWith("image/")||!["image/jpg","image/jpeg","image/png"].includes(t))throw new f("Le fichier doit être une image valide (jpg ou png).")}else{if("undefined"==typeof Buffer||!Buffer.isBuffer(e))throw new f("Le fichier doit être de type File (navigateur) ou Buffer (Node).");{const o=await async function(e){return(new ze).fromBuffer(e)}(e);if(!o||!o.mime.startsWith("image/")||!["image/jpg","image/jpeg","image/png"].includes(o.mime))throw new f("Le fichier doit être une image valide.");t=o.mime}}return e}};class Ne{#e;#t;#o=null;constructor(e,{id:t,slug:o}={}){if(!t&&!o)throw new Error("Vous devez fournir un id ou un slug pour créer un User.");this.apiClient=e,this.#e=t||null,this.#t=o||null}get id(){return this.#e}_id(e){this.#e=e}get slug(){return this.#t}_slug(e){this.#t=e}get isConnected(){return this.apiClient.isConnected}get data(){return this.#o}_setData(e){this.#o=e}get userId(){return this.apiClient.userId}get isMe(){return this.isConnected&&this.userId===this.id}getEntityType(){return"organizations"}async getProfil(){return this.apiClient.safeCall((async()=>{const e=await this.getPublicProfile();return this._setData(e),e}))}async getNews(e={}){return e.pathParams={type:this.getEntityType(),id:this.id},this._getNews(e)}async addNews(e={}){return e.parentId=this.id,e.parentType=this.getEntityType(),this.callIsConnected((()=>this._addNews(e)))}}Object.assign(Ne.prototype,w,qe,b);class Me{#e;#t;#o=null;constructor(e,{id:t,slug:o}={}){if(!t&&!o)throw new Error("Vous devez fournir un id ou un slug pour créer un User.");this.apiClient=e,this.#e=t||null,this.#t=o||null}get id(){return this.#e}_id(e){this.#e=e}get slug(){return this.#t}_slug(e){this.#t=e}get isConnected(){return this.apiClient.isConnected}get data(){return this.#o}_setData(e){this.#o=e}get userId(){return this.apiClient.userId}get isMe(){return this.isConnected&&this.userId===this.id}getEntityType(){return"projects"}async getProfil(){return this.apiClient.safeCall((async()=>{const e=await this.getPublicProfile();return this._setData(e),e}))}async getNews(e={}){return e.pathParams={type:this.getEntityType(),id:this.id},this._getNews(e)}async addNews(e={}){return e.parentId=this.id,e.parentType=this.getEntityType(),this.callIsConnected((()=>this._addNews(e)))}}Object.assign(Me.prototype,w,qe,b);const Be={async _meInfoUrl(){return this.callIsConnected("ME_INFO_URL")},async _changePassword(e={}){return e.userId&&delete e.userId,e.mode&&delete e.mode,this.callIsConnected("CHANGE_PASSWORD",e)},async _deleteAccount(e={}){return e.pathParams&&delete e.pathParams,this.callIsConnected("DELETE_ACCOUNT",e)}};class Le{#e;#t;#o;constructor(e,{id:t,slug:o}={},n={}){if(!t&&!o)throw new Error("Vous devez fournir un id ou un slug pour créer un User.");this.apiClient=e,this.#e=t||null,this.#t=o||null,this.#o=n}get id(){return this.#e}_id(e){this.#e=e}get slug(){return this.#t}_slug(e){this.#t=e}get isConnected(){return this.apiClient.isConnected}get data(){return this.#o}_setData(e){this.#o=e}getEntityType(){return"citoyens"}get userId(){return this.apiClient.userId}get isMe(){return this.isConnected&&this.userId===this.id}async getProfil(){return this.apiClient.safeCall((async()=>this.isMe?await this._meInfoUrl():await this.getPublicProfile()))}async changePassword(e={}){return this.callIsMe((()=>this._changePassword(e)))}async delete(e={}){return this.callIsMe((()=>this._deleteAccount(e)))}async updateSettings(e={}){return this.callIsMe((()=>this._updateSettings(e)))}async updateDescription(e={}){return this.callIsMe((()=>this._updateBlockDescription(e)))}async updateInfo(e={}){return this.callIsMe((()=>this._updateBlockInfo(e)))}async updateSocial(e={}){return this.callIsMe((()=>this._updateBlockSocial(e)))}async updateLocality(e={}){return this.callIsMe((()=>this._updateBlockLocality(e)))}async updateSlug(e){try{await this._check({slug:e})}catch(e){if(e instanceof y)throw new y("Erreur lors de la vérification du slug.",e.status,e.data);throw e}return this.callIsMe((()=>this._updateBlockSlug({slug:e})))}async updateImageProfil(e){return e=await this.validateImage(e),this.callIsMe((()=>this._profilImage({profil_avatar:e})))}async getNews(e={}){return e.pathParams&&delete e.pathParams,this.isMe||(e.pathParams={id:this.id}),this._getNews(e)}async addNews(e={}){return e.parentId&&delete e.parentId,e.parentType&&delete e.parentType,this.callIsMe((()=>this._addNews(e)))}}Object.assign(Le.prototype,w,qe,Be,b);const Fe=(e=>{var t={};return m.d(t,e),t})({EventEmitter:()=>e.EventEmitter}),De=(e,t)=>1===t?e:`${e}s`,Ue=e=>{if(""===e)return"$";const t=e.substring(1).split(/\//).map((e=>e.replace(/~1/g,"/").replace(/~0/g,"~").replace(/\./g,"\\."))).map((e=>/^\d+$/.exec(e)?`[${e}]`:`.${e}`)).join("");return"$"+t},Re=e=>{switch(e[0]){case"a":case"e":case"i":case"o":case"u":return"an";default:return"a"}},Ge=(e,t="and")=>0===e.length?"nothing":1===e.length?e[0]:2===e.length?`${e[0]} ${t} ${e[1]}`:`${e.slice(0,-1).join(", ")}, ${t} ${e[e.length-1]}`,Ze={"date-time":"date and time",time:"time",date:"date",email:"email address",hostname:"hostname",ipv4:"IPv4 address",ipv6:"IPv6 address",uri:"URI","uri-reference":"URI Reference","uri-template":"URI-template","json-pointer":"JSON Pointer","relative-json-pointer":"relative JSON Pointer",regex:"regular expression"},Ve={fieldLabels:"title",includeOriginalError:!1,includeData:!1};class Ke extends Error{constructor(e,t={}){super(),this.options={},this.redundant=!1,this.options={...Ve,...t},this.pointer=e.instancePath,this.path=Ue(e.instancePath);const o=(({data:e,keyword:t,message:o,params:n,parentSchema:i,schemaPath:r,instancePath:a},{fieldLabels:s})=>{const c=(({instancePath:e,parentSchema:t},{fieldLabels:o})=>{switch(o){case"js":return""===e?"the root value":`the value at ${Ue(e).replace(/^\$/,"")}`;case"jsonPath":return`the value at ${Ue(e)}`;case"jsonPointer":case"instancePath":return""===e?"the root value":`the value at ${e}`;case"title":return(null==t?void 0:t.title)?t.title:""===e?"the root value":`the value at ${e}`;default:throw new Error(`invalid fieldLabels value: ${o}`)}})({instancePath:a,parentSchema:i},{fieldLabels:s});if(null==i?void 0:i.errorMessage)return`${c} ${i.errorMessage}`;switch(t){case"enum":{const e=n.allowedValues.map(JSON.stringify);return`${c} must be one of: ${Ge(e,"or")}`}case"type":{const t=Array.isArray(n.type)?n.type:n.type.split(","),o=Ge(t,"or"),i=(e=>{const t=typeof e;switch(t){case"object":return null===e?"null":Array.isArray(e)?"an array":"an object";case"undefined":return"undefined";default:return`${Re(t)} ${t}`}})(e);return`${c} must be ${Re(o)} ${o} but it was ${i}`}case"minLength":{const t=n.limit,o=De("character",t),i=e.length;return`${c} must be ${t} ${o} or more but it was ${i} ${De("character",i)}`}case"maxLength":{const t=n.limit,o=De("character",t),i=e.length;return`${c} must be ${t} ${o} or fewer but it was ${i} ${De("character",i)}`}case"pattern":{if(r.endsWith("propertyNames/pattern"))return null;const e=null==i?void 0:i.patternLabel;return e?`${c} must be ${e} but it was not`:`${c} is an invalid string`}case"format":return`${c} must be a valid ${Ze[n.format]||n.format} string but it was not`;case"multipleOf":return`${c} must be a multiple of ${n.multipleOf}`;case"minimum":return`${c} must be equal to or greater than ${n.limit}`;case"exclusiveMinimum":return`${c} must be greater than ${n.limit}`;case"maximum":return`${c} must be equal to or less than ${n.limit}`;case"exclusiveMaximum":return`${c} must be less than ${n.limit}`;case"additionalProperties":{const e=Object.keys(null==i?void 0:i.properties).join(", ");return`${c} has an unexpected property, ${n.additionalProperty}, which is not in the list of allowed properties (${e})`}case"required":return`${c} is missing the required field '${n.missingProperty}'`;case"propertyNames":return`${c} has an invalid property name ${JSON.stringify(n.propertyName)}`;case"minProperties":return`${c} must have ${n.limit} or more properties but it has ${Object.keys(e).length}`;case"maxProperties":return`${c} must have ${n.limit} or fewer properties but it has ${Object.keys(e).length}`;case"dependencies":{const e=n.property;return`${c} must have property ${n.missingProperty} when ${e} is present`}case"minItems":return`${c} must have ${n.limit} or more items but it has ${e.length}`;case"maxItems":return`${c} must have ${n.limit} or fewer items but it has ${e.length}`;case"uniqueItems":{const{i:e,j:t}=n;return`${c} must be unique but elements ${t} and ${e} are the same`}default:return`${c} ${o}`}})(e,this.options);var n;null!==o?(this.message=`${n=o,"string"!=typeof n||0===n.length?n:n.charAt(0).toUpperCase()+n.slice(1)}.`,this.options.includeOriginalError&&(this.original=e),this.options.includeData&&(this.data=e.data)):this.redundant=!0}toJSON(){const e={path:this.path,pointer:this.pointer,message:this.message};return this.options.includeOriginalError&&(e.original=this.original),this.options.includeData&&(e.data=this.data),e}}class We extends Error{constructor(e,t={}){super(),this.name="AggregateAjvError",this.errors=(null!=e?e:[]).map((e=>new Ke(e,t))).filter((e=>!e.redundant)),this.message=this.errors.map((e=>e.message)).join(" ")}toJSON(){return this.errors.map((e=>e.toJSON()))}*[Symbol.iterator](){for(const e of this.errors)yield e}}const Je=(e=>{var t={};return m.d(t,e),t})({default:()=>t.default}),He=(e=>{var t={};return m.d(t,e),t})({default:()=>o.default}),Ye=(e=>{var t={};return m.d(t,e),t})({default:()=>n.default}),Qe=(e=>{var t={};return m.d(t,e),t})({default:()=>i.default}),Xe=(e=>{var t={};return m.d(t,e),t})({default:()=>r.default});class et extends Error{}et.prototype.name="InvalidTokenError";const tt=(e=>{var t={};return m.d(t,e),t})({default:()=>a.default}),ot={_looksLikeObjectID:e=>24===e.length&&/^[0-9a-f]*$/.test(e),ObjectID:class{constructor(e){if(e){if(e=e.toLowerCase(),!ot._looksLikeObjectID(e))throw new Error("Invalid hexadecimal string for creating an ObjectID");this._str=e}}equals(e){return e instanceof ot.ObjectID&&this.valueOf()===e.valueOf()}toString(){return`ObjectID("${this._str}")`}clone(){return new ot.ObjectID(this._str)}typeName(){return"oid"}getTimestamp(){return Number.parseInt(this._str.substr(0,8),16)}valueOf(){return this._str}toJSONValue(){return this.valueOf()}toHexString(){return this.valueOf()}}},nt=ot,it={common1:{type:"string"},common2:{format:"email",type:"string"},common3:{type:"boolean"},common4:{format:"uri",type:"string"},common5:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$",type:"string"},common6:{additionalProperties:!1,properties:{id:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$",type:"string"}},required:["id"],type:"object"},common7:{id:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$",type:"string"}},common8:{default:"",type:"string"},common9:{pattern:"^[a-f0-9]{24}$",type:"string"},common10:{const:"citoyens"},common11:{properties:{value:{type:"boolean"}}},common12:{value:{type:"boolean"}},common13:{default:"citoyens",enum:["citoyens","projects","organizations"],type:"string"},common14:{},common15:{else:{properties:{id:{pattern:"^[a-f0-9]{24}$",type:"string"}}},if:{properties:{typeElement:{const:"citoyens"}}},then:{properties:{id:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$",type:"string"}}}},common16:{properties:{id:{pattern:"^[a-f0-9]{24}$",type:"string"}}},common17:{id:{pattern:"^[a-f0-9]{24}$",type:"string"}},common18:{properties:{typeElement:{const:"citoyens"}}},common19:{typeElement:{const:"citoyens"}},common20:{properties:{id:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$",type:"string"}}},common21:{not:{type:"null"}},common22:{type:"null"},common23:{anyOf:[{items:{type:"string"},type:"array"},{enum:[""],type:"string"}]},common24:{items:{type:"string"},type:"array"},common25:{enum:[""],type:"string"},common26:{properties:{name:{not:{type:"null"}}},required:["name"]},common27:{name:{not:{type:"null"}}},common28:{properties:{url:{not:{type:"null"}}},required:["url"]},common29:{url:{not:{type:"null"}}},common30:{properties:{tags:{not:{type:"null"}}},required:["tags"]},common31:{tags:{not:{type:"null"}}},common32:{properties:{email:{not:{type:"null"}}},required:["email"]},common33:{email:{not:{type:"null"}}},common34:{const:"info",default:"info",type:"string"},common35:{$ref:"#/$defs/sharedFields/email"},common36:{$ref:"#/$defs/sharedFields/name"},common37:{$ref:"#/$defs/sharedFields/tags"},common38:{$ref:"#/$defs/sharedFields/url"},common39:{const:"projects"},common40:{const:"organizations"},common41:{$ref:"#/$defs/socialField"},common42:{properties:{id:{pattern:"^[a-f0-9]{24}$"}}},common43:{id:{pattern:"^[a-f0-9]{24}$"}},common44:{pattern:"^[a-f0-9]{24}$"},common45:{minLength:0,type:"string"},common46:{type:["string","number"]},common47:{type:"number"},common48:{const:!0,default:!0,type:"boolean"},common49:{properties:{id:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}}},common50:{id:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}},common51:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"},common52:{maxLength:100,minLength:3,pattern:"^[a-zA-Z0-9]+$",type:"string"},common53:{properties:{type:{const:"citoyens"}}},common54:{type:{const:"citoyens"}},common55:{additionalProperties:!1,else:{properties:{ownerId:{pattern:"^[a-f0-9]{24}$"}}},if:{properties:{folder:{const:"citoyens"}}},properties:{folder:{default:"citoyens",enum:["citoyens","projects","organizations"],type:"string"},ownerId:{type:"string"}},required:["folder","ownerId"],then:{properties:{ownerId:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}}},type:"object"},common56:{properties:{ownerId:{pattern:"^[a-f0-9]{24}$"}}},common57:{ownerId:{pattern:"^[a-f0-9]{24}$"}},common58:{properties:{folder:{const:"citoyens"}}},common59:{folder:{const:"citoyens"}},common60:{folder:{default:"citoyens",enum:["citoyens","projects","organizations"],type:"string"},ownerId:{type:"string"}},common61:{properties:{ownerId:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}}},common62:{ownerId:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}},common63:{additionalProperties:!1,else:{properties:{id:{pattern:"^[a-f0-9]{24}$"}}},if:{properties:{type:{const:"citoyens"}}},properties:{id:{type:"string"},type:{default:"citoyens",enum:["citoyens","projects","organizations"],type:"string"}},required:["type","id"],then:{properties:{id:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}}},type:"object"},common64:{id:{type:"string"},type:{default:"citoyens",enum:["citoyens","projects","organizations"],type:"string"}},common65:{properties:{parentId:{pattern:"^[a-f0-9]{24}$"}}},common66:{parentId:{pattern:"^[a-f0-9]{24}$"}},common67:{properties:{parentType:{const:"citoyens"}}},common68:{parentType:{const:"citoyens"}},common69:{properties:{parentId:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}}},common70:{parentId:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}},common71:{default:!0,type:"boolean"},common72:{required:["text"]},common73:{required:["mediaImg"]},common74:{required:["mediaFile"]},common75:{additionalProperties:!1,properties:{countFiles:{type:"number"},files:{items:{type:"string"},type:"array"}},required:["countFiles","files"],type:"object"},common76:{countFiles:{type:"number"},files:{items:{type:"string"},type:"array"}},common77:{additionalProperties:!1,properties:{countImages:{type:"number"},images:{items:{type:"string"},type:"array"}},required:["countImages","images"],type:"object"},common78:{countImages:{type:"number"},images:{items:{type:"string"},type:"array"}},common79:{additionalProperties:!1,patternProperties:{"^[0-9]+$":{additionalProperties:!1,properties:{count:{type:"number"},id:{type:"string"},name:{type:"string"},slug:{type:"string"},type:{type:"string"},value:{type:"string"}},required:["id","name","slug","type","value","count"],type:"object"}},type:"object"},common80:{"^[0-9]+$":{additionalProperties:!1,properties:{count:{type:"number"},id:{type:"string"},name:{type:"string"},slug:{type:"string"},type:{type:"string"},value:{type:"string"}},required:["id","name","slug","type","value","count"],type:"object"}},common81:{additionalProperties:!1,properties:{count:{type:"number"},id:{type:"string"},name:{type:"string"},slug:{type:"string"},type:{type:"string"},value:{type:"string"}},required:["id","name","slug","type","value","count"],type:"object"},common82:{count:{type:"number"},id:{type:"string"},name:{type:"string"},slug:{type:"string"},type:{type:"string"},value:{type:"string"}},common83:{default:"public",enum:["public","private","restricted"],type:"string"},common84:{const:"news",default:"news",type:"string"},common85:{additionalProperties:!1,properties:{id:{pattern:"^[a-f0-9]{24}$",type:"string"}},required:["id"],type:"object"},common86:{default:!1,type:"boolean"},common87:{additionalProperties:!1,properties:{id:{pattern:"^[a-f0-9]{24}$",type:"string"},type:{default:"news",enum:["news"],type:"string"}},required:["type","id"],type:"object"},common88:{id:{pattern:"^[a-f0-9]{24}$",type:"string"},type:{default:"news",enum:["news"],type:"string"}},common89:{default:"news",enum:["news"],type:"string"},common90:{items:{additionalProperties:!1,properties:{count:{type:"number"},id:{pattern:"^[a-f0-9]{24}$",type:"string"},name:{type:"string"},slug:{type:"string"},type:{type:"string"},value:{type:"string"}},required:["id","name","slug","type","value","count"],type:"object"},type:"array"},common91:{additionalProperties:!1,properties:{count:{type:"number"},id:{pattern:"^[a-f0-9]{24}$",type:"string"},name:{type:"string"},slug:{type:"string"},type:{type:"string"},value:{type:"string"}},required:["id","name","slug","type","value","count"],type:"object"},common92:{count:{type:"number"},id:{pattern:"^[a-f0-9]{24}$",type:"string"},name:{type:"string"},slug:{type:"string"},type:{type:"string"},value:{type:"string"}},common93:{enum:["NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects","citoyens","poi"],type:"string"},common94:{const:!1,default:!1,type:"boolean"},common95:{const:"",default:"",type:"string"},common96:{additionalProperties:!1,properties:{indexMax:{type:"number"},indexMin:{type:"number"}},required:["indexMin","indexMax"],type:"object"},common97:{indexMax:{type:"number"},indexMin:{type:"number"}},common98:{default:0,minimum:0,type:"integer"},common99:{const:["projects"],default:["projects"],items:{enum:["projects"],type:"string"},type:"array"},common100:{enum:["projects"],type:"string"},common101:{$exists:!0},common102:{additionalProperties:!1,properties:{$exists:{const:!0}},required:["$exists"],type:"object"},common103:{$exists:{const:!0}},common104:{const:!0},common105:{default:30,type:"integer"},common106:{const:["poi"],default:["poi"],items:{enum:["poi"],type:"string"},type:"array"},common107:{enum:["poi"],type:"string"},common108:{const:["NGO","Cooperative","LocalBusiness","Group","GovernmentOrganization"],default:["NGO","Cooperative","LocalBusiness","Group","GovernmentOrganization"],items:{enum:["NGO","Cooperative","LocalBusiness","Group","GovernmentOrganization"],type:"string"},type:"array"},common109:{enum:["NGO","Cooperative","LocalBusiness","Group","GovernmentOrganization"],type:"string"},common110:{$exists:!1},common111:{additionalProperties:!1,properties:{$exists:{const:!1}},required:["$exists"],type:"object"},common112:{$exists:{const:!1}},common113:{const:!1},common114:{const:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],default:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],items:{enum:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],type:"string"},type:"array"},common115:{enum:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],type:"string"},common116:{additionalProperties:!1,properties:{$exists:{default:!1,type:"boolean"}},required:["$exists"],type:"object"},common117:{$exists:{default:!1,type:"boolean"}},common118:{additionalProperties:!1,properties:{$in:{items:{type:"string"},minItems:1,type:"array"}},required:["$in"],type:"object"},common119:{$in:{items:{type:"string"},minItems:1,type:"array"}},common120:{items:{type:"string"},minItems:1,type:"array"},common121:{const:["citoyens"],default:["citoyens"],items:{enum:["citoyens"],type:"string"},type:"array"},common122:{enum:["citoyens"],type:"string"},common123:{const:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects"],default:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects"],items:{enum:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects"],type:"string"},type:"array"},common124:{enum:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects"],type:"string"},common125:{not:{propertyNames:{pattern:"^(?!links\\.followers\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}}},common126:{propertyNames:{pattern:"^(?!links\\.followers\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}},common127:{pattern:"^(?!links\\.followers\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"},common128:{"^links\\.followers\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":{additionalProperties:!1,properties:{$exists:{const:!0}},required:["$exists"],type:"object"},"^links\\.followers\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":{additionalProperties:!1,properties:{$exists:{const:!1}},required:["$exists"],type:"object"},"^links\\.followers\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":{additionalProperties:!1,properties:{$exists:{const:!1}},required:["$exists"],type:"object"}},common129:{not:{propertyNames:{pattern:"^(?!links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}}},common130:{propertyNames:{pattern:"^(?!links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}},common131:{pattern:"^(?!links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"},common132:{const:["badges"],default:["badges"],items:{enum:["badges"],type:"string"},type:"array"},common133:{enum:["badges"],type:"string"},common134:{const:["citoyens","projects","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],default:["citoyens","projects","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],items:{enum:["citoyens","projects","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],type:"string"},type:"array"},common135:{enum:["citoyens","projects","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],type:"string"},common136:{additionalProperties:!1,properties:{$exists:{const:!0,type:"boolean"}},required:["$exists"],type:"object"},common137:{$exists:{const:!0,type:"boolean"}},common138:{const:!0,type:"boolean"},common139:{additionalProperties:!1,properties:{$exists:{const:!1,type:"boolean"}},required:["$exists"],type:"object"},common140:{$exists:{const:!1,type:"boolean"}},common141:{const:!1,type:"boolean"},common142:{"badges\\.(?:[a-f0-9]{24}|@\\w+)\\.attenteEmetteur$":{additionalProperties:!1,properties:{$exists:{const:!1,type:"boolean"}},required:["$exists"],type:"object"},"badges\\.(?:[a-f0-9]{24}|@\\w+)\\.attenteRecepteur$":{additionalProperties:!1,properties:{$exists:{const:!0,type:"boolean"}},required:["$exists"],type:"object"}},common143:{indexMax:30,indexMin:0},common144:{additionalProperties:!1,allOf:[{if:{properties:{parentType:{const:"citoyens"}}},then:{properties:{connectType:{const:"friend",default:"friend"}}}},{if:{properties:{parentType:{const:"organizations"}}},then:{properties:{connectType:{enum:["admin","member"]}}}},{if:{properties:{parentType:{const:"projects"}}},then:{properties:{connectType:{enum:["admin","contributor"]}}}},{if:{properties:{parentType:{const:"events"}}},then:{properties:{connectType:{const:"attendee",default:"attendee"}}}}],properties:{childId:{default:"@userId",pattern:"^([a-f0-9]{24}|@\\w+)$",type:"string"},childType:{const:"citoyens",default:"citoyens",enum:["citoyens"],type:"string"},connectType:{enum:["admin","member","contributor","attendee","friend"],type:"string"},parentId:{pattern:"^[a-f0-9]{24}$",type:"string"},parentType:{enum:["citoyens","organizations","projects","events"],type:"string"}},required:["childId","childType","parentType","parentId","connectType"],type:"object"},common145:{if:{properties:{parentType:{const:"citoyens"}}},then:{properties:{connectType:{const:"friend",default:"friend"}}}},common146:{properties:{connectType:{const:"friend",default:"friend"}}},common147:{connectType:{const:"friend",default:"friend"}},common148:{const:"friend",default:"friend"},common149:{if:{properties:{parentType:{const:"organizations"}}},then:{properties:{connectType:{enum:["admin","member"]}}}},common150:{properties:{parentType:{const:"organizations"}}},common151:{parentType:{const:"organizations"}},common152:{properties:{connectType:{enum:["admin","member"]}}},common153:{connectType:{enum:["admin","member"]}},common154:{enum:["admin","member"]},common155:{if:{properties:{parentType:{const:"projects"}}},then:{properties:{connectType:{enum:["admin","contributor"]}}}},common156:{properties:{parentType:{const:"projects"}}},common157:{parentType:{const:"projects"}},common158:{properties:{connectType:{enum:["admin","contributor"]}}},common159:{connectType:{enum:["admin","contributor"]}},common160:{enum:["admin","contributor"]},common161:{if:{properties:{parentType:{const:"events"}}},then:{properties:{connectType:{const:"attendee",default:"attendee"}}}},common162:{properties:{parentType:{const:"events"}}},common163:{parentType:{const:"events"}},common164:{const:"events"},common165:{properties:{connectType:{const:"attendee",default:"attendee"}}},common166:{connectType:{const:"attendee",default:"attendee"}},common167:{const:"attendee",default:"attendee"},common168:{childId:{default:"@userId",pattern:"^([a-f0-9]{24}|@\\w+)$",type:"string"},childType:{const:"citoyens",default:"citoyens",enum:["citoyens"],type:"string"},connectType:{enum:["admin","member","contributor","attendee","friend"],type:"string"},parentId:{pattern:"^[a-f0-9]{24}$",type:"string"},parentType:{enum:["citoyens","organizations","projects","events"],type:"string"}},common169:{default:"@userId",pattern:"^([a-f0-9]{24}|@\\w+)$",type:"string"},common170:{const:"citoyens",default:"citoyens",enum:["citoyens"],type:"string"},common171:{enum:["admin","member","contributor","attendee","friend"],type:"string"},common172:{enum:["citoyens","organizations","projects","events"],type:"string"}},rt=[{auth:"none",constant:"PERSON_REGISTER",contentType:"application/x-www-form-urlencoded",generateModule:"UserNoAuth",method:"POST",onlyAuthNone:!0,path:"/co2/person/register",request:{additionalProperties:!1,properties:{app:it.common1,email:it.common2,isInvitation:it.common3,mode:it.common1,name:it.common1,pendingUserId:it.common1,pwd:it.common1,username:it.common1},required:["name","username","email","pwd"],type:"object"}},{auth:"none",constant:"AUTHENTICATE_URL",contentType:"application/json",generateModule:"UserNoAuth",method:"POST",onlyAuthNone:!0,path:"/api/cocolight/authenticate",postActions:[{path:"accessToken",type:"setToken"},{path:"refreshToken",type:"setRefreshToken"},{event:"userLoggedIn",path:"user",type:"emitEvent"}],request:{additionalProperties:!1,properties:{email:it.common2,password:it.common1},required:["email","password"],type:"object"}},{auth:"none",constant:"REFRESH_TOKEN_URL",contentType:"application/json",method:"POST",path:"/api/cocolight/refreshtoken",request:{additionalProperties:!1,properties:{refreshToken:it.common1},required:["refreshToken"],type:"object"}},{auth:"bearer",constant:"ME_INFO_URL",contentType:"application/json",method:"POST",path:"/api/cocolight/me"},{auth:"none",constant:"PASSWORD_RECOVERY",contentType:"application/x-www-form-urlencoded",generateModule:"UserNoAuth",method:"POST",onlyAuthNone:!0,path:"/co2/person/sendemail",request:{additionalProperties:!1,properties:{email:it.common2,type:{const:"password",default:"password",type:"string"}},required:["email","type"],type:"object"}},{auth:"bearer",constant:"SERVER_EXCHANGE_TOKEN",contentType:"application/json",method:"POST",path:"/api/cocolight/exchangetoken",request:{additionalProperties:!1,properties:{serverUrl:it.common4},required:["serverUrl"],type:"object"}},{auth:"bearer",constant:"CHANGE_PASSWORD",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/person/changepassword",request:{additionalProperties:!1,properties:{mode:{const:"changePassword",default:"changePassword",type:"string"},newPassword:it.common1,newPassword2:it.common1,oldPassword:it.common1,scope:{default:"",type:["string"]},userId:it.common5},required:["mode","userId","oldPassword","newPassword","newPassword2"],type:"object"}},{auth:"bearer",constant:"DELETE_ACCOUNT",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/delete/id/{id}/type/citoyens",pathParams:it.common6,postActions:[{type:"resetSession"},{event:"accountDeleted",path:null,type:"emitEvent"}],request:{additionalProperties:!1,properties:{reason:it.common8},required:["reason"],type:"object"}},{auth:"bearer",constant:"UPDATE_SETTINGS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/updatesettings",request:{additionalProperties:!1,allOf:[{else:{properties:{idEntity:it.common9}},if:{properties:{typeEntity:it.common10}},then:{properties:{idEntity:it.common5}}},{if:{properties:{type:{enum:["birthDate","email","locality","phone","directory"]},typeEntity:it.common10}},then:{properties:{value:{enum:["private","public","mask"],type:"string"}}}},{if:{properties:{type:{enum:["activitypub","isOpenData"]},typeEntity:it.common10}},then:it.common11},{if:{properties:{type:{enum:["isOpenData","isOpenEdition","private","feedback"]},typeEntity:{not:it.common10}}},then:it.common11}],properties:{idEntity:it.common1,type:it.common1,typeEntity:it.common13,value:it.common14},required:["type","value","typeEntity","idEntity"],type:"object"}},{auth:"bearer",constant:"UPDATE_BLOCK_DESCRIPTION",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/updateblock/",request:{additionalProperties:!1,allOf:[it.common15,{anyOf:[{properties:{description:it.common21},required:["description"]},{properties:{shortDescription:it.common21},required:["shortDescription"]}]}],properties:{block:{const:"descriptions",default:"descriptions",type:"string"},descMentions:it.common8,description:it.common1,id:it.common1,scope:{default:"",type:["string","null"]},shortDescription:it.common1,typeElement:it.common13},required:["block","typeElement","id"],type:"object"}},{auth:"bearer",constant:"UPDATE_BLOCK_INFO",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/updateblock/",request:{$defs:{sharedFields:{email:it.common2,name:it.common1,tags:it.common23,url:it.common4}},allOf:[{if:it.common18,then:{additionalProperties:!1,anyOf:[it.common26,{properties:{birthDate:it.common21},required:["birthDate"]},{properties:{fixe:it.common21},required:["fixe"]},{properties:{mobile:it.common21},required:["mobile"]},it.common28,it.common30,it.common32],properties:{birthDate:{format:"date",type:"string"},block:it.common34,email:it.common35,fixe:it.common1,id:it.common5,mobile:it.common1,name:it.common36,scope:it.common8,tags:it.common37,typeElement:it.common13,url:it.common38}}},{if:{properties:{typeElement:it.common39}},then:{additionalProperties:!1,anyOf:[it.common26,it.common28,it.common30,it.common32,{properties:{avancement:it.common21},required:["avancement"]},{properties:{parent:it.common21},required:["parent"]}],properties:{avancement:{enum:["abandoned","concept","development","production","started","testing","idea","mature","qa","finished"],type:"string"},block:it.common34,email:it.common35,id:it.common1,name:it.common36,parent:{additionalProperties:!1,patternProperties:{"^[a-fA-F0-9]{24}$":{additionalProperties:!1,properties:{name:it.common1,type:it.common1},required:["type","name"],type:"object"}},type:"object"},scope:it.common8,tags:it.common37,typeElement:it.common13,url:it.common38}}},{if:{properties:{typeElement:it.common40}},then:{additionalProperties:!1,anyOf:[it.common26,it.common28,it.common30,it.common32,{properties:{type:it.common21},required:["type"]}],properties:{block:it.common34,email:it.common35,id:it.common1,name:it.common36,scope:it.common8,tags:it.common37,type:{enum:["NGO","Cooperative","LocalBusiness","GovernmentOrganizationautre"],type:"string"},typeElement:it.common13,url:it.common38}}}],properties:{block:it.common34,id:it.common1,scope:it.common8,typeElement:it.common13},required:["block","typeElement","id"],type:"object"}},{auth:"bearer",constant:"UPDATE_BLOCK_SOCIAL",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/updateblock/",request:{$defs:{socialField:{anyOf:[it.common25,it.common4]}},allOf:[it.common15,{anyOf:[{properties:{gitlab:it.common21},required:["gitlab"]},{properties:{github:it.common21},required:["github"]},{properties:{twitter:it.common21},required:["twitter"]},{properties:{facebook:it.common21},required:["facebook"]},{properties:{instagram:it.common21},required:["instagram"]},{properties:{diaspora:it.common21},required:["diaspora"]},{properties:{mastodon:it.common21},required:["mastodon"]},{properties:{telegram:it.common21},required:["telegram"]},{properties:{signal:it.common21},required:["signal"]}]}],properties:{block:{const:"network",default:"network",type:"string"},diaspora:it.common41,facebook:it.common41,github:it.common41,gitlab:it.common41,id:it.common1,instagram:it.common41,mastodon:it.common41,scope:it.common8,signal:it.common41,telegram:it.common41,twitter:it.common41,typeElement:it.common13},required:["block","typeElement","id"],type:"object"}},{auth:"bearer",constant:"UPDATE_BLOCK_LOCALITY",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/updateblock/",request:{else:it.common42,if:it.common18,properties:{address:{additionalProperties:!1,properties:{"@type":{const:"PostalAddress",type:"string"},addressCountry:it.common1,addressLocality:it.common1,codeInsee:it.common1,level1:it.common1,level1Name:it.common1,level3:it.common45,level3Name:it.common45,level4:it.common45,level4Name:it.common45,localityId:it.common1,postalCode:it.common1,streetAddress:it.common1},required:["@type","addressCountry","codeInsee","addressLocality","localityId","level1","level1Name"],type:"object"},block:{const:"localities",default:"localities",type:"string"},geo:{additionalProperties:!1,properties:{"@type":{const:"GeoCoordinates",type:"string"},latitude:it.common46,longitude:it.common46},required:["latitude","longitude"],type:"object"},geoPosition:{additionalProperties:!0,properties:{coordinates:{items:it.common47,maxItems:2,minItems:2,type:"array"},float:it.common48,type:{const:"Point",type:"string"}},required:["type","coordinates","float"],type:"object"},id:it.common1,scope:it.common8,typeElement:it.common13},required:["block","typeElement","id","address"],then:it.common49,type:"object"}},{auth:"bearer",constant:"UPDATE_BLOCK_SLUG",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/updateblock/",request:{else:it.common42,if:it.common18,properties:{block:it.common34,id:it.common1,scope:it.common8,slug:it.common52,typeElement:it.common13},required:["block","typeElement","id","slug"],then:it.common49,type:"object"}},{auth:"bearer",constant:"CHECK",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/slug/check",request:{additionalProperties:!1,else:it.common42,if:it.common53,properties:{block:it.common34,id:it.common1,slug:it.common52,type:it.common13},required:["block","type","id","slug"],then:it.common49,type:"object"}},{auth:"bearer",constant:"PROFIL_IMAGE",contentType:"multipart/form-data",method:"POST",path:"/co2/document/upload-save/dir/communecter/folder/{folder}/ownerId/{ownerId}/input/profil_avatar/contentKey/profil/docType/image",pathParams:it.common55,request:{additionalProperties:!1,properties:{profil_avatar:it.common14},required:["profil_avatar"],type:"object"}},{auth:"none",constant:"GET_ELEMENTS_ABOUT",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/about/type/{type}/id/{id}/json/true",pathParams:it.common63,request:{additionalProperties:!1,properties:{tpl:{const:"ficheInfoElement",default:"ficheInfoElement",type:"string"}},required:["tpl"],type:"object"}},{auth:"bearer",constant:"MULTICONNECT",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/link/multiconnect",request:{additionalProperties:!1,else:it.common65,if:it.common67,properties:{listInvite:{additionalProperties:!1,patternProperties:{"^(citoyens|projects|organizations)$":{additionalProperties:!1,patternProperties:{"^[0-9a-fA-F]{24}$":{additionalProperties:!1,properties:{name:it.common1},required:["name"],type:"object"}},type:"object"}},type:"object"},parentId:it.common1,parentType:it.common13},required:["parentId","parentType","listInvite"],then:it.common69,type:"object"}},{auth:"none",constant:"GET_NEWS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/news/co/get/type/{type}/id/{id}/isLive/{isLive}/json/true",pathParams:{additionalProperties:!1,else:it.common42,if:it.common53,properties:{id:it.common1,isLive:it.common71,type:it.common13},required:["isLive","type","id"],then:it.common49,type:"object"},request:{additionalProperties:!1,properties:{dateLimit:{default:0,type:"integer"},indexStep:{default:12,type:"integer"},search:{additionalProperties:!1,properties:{name:it.common8},required:["name"],type:"object"}},required:["dateLimit","indexStep"],type:"object"}},{auth:"none",constant:"GET_NEWS_BY_ID",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/news/co/getbyids",request:{additionalProperties:!1,properties:{ids:{items:it.common9,type:"array"}},required:["ids"],type:"object"}},{auth:"bearer",constant:"ADD_NEWS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/news/co/save",request:{additionalProperties:!1,anyOf:[it.common72,it.common73,it.common74],else:it.common65,if:it.common67,properties:{json:it.common48,markdownActive:it.common71,mediaFile:it.common75,mediaImg:it.common77,mentions:it.common79,parentId:it.common1,parentType:it.common13,scope:it.common83,tags:it.common23,text:it.common1,type:it.common84},required:["scope","markdownActive","parentId","parentType","type","json"],then:it.common69,type:"object"}},{auth:"bearer",constant:"ADD_IMAGE_NEWS",contentType:"multipart/form-data",method:"POST",path:"/co2/document/uploadSave/dir/communecter/folder/{folder}/ownerId/{ownerId}/input/newsImage/docType/image/contentKey/slider",pathParams:it.common55,request:{additionalProperties:!1,properties:{newsImage:it.common14},required:["newsImage"],type:"object"}},{auth:"bearer",constant:"ADD_FILE_NEWS",contentType:"multipart/form-data",method:"POST",path:"/co2/document/uploadSave/dir/communecter/folder/{folder}/ownerId/{ownerId}}/input/newsFile/docType/file",pathParams:it.common55,request:{additionalProperties:!1,properties:{newsFile:it.common14},required:["newsFile"],type:"object"}},{auth:"bearer",constant:"DELETE_NEWS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/news/co/delete/id/{id}",pathParams:it.common85,request:{additionalProperties:!1,properties:{isLive:it.common86},required:["isLive"],type:"object"}},{auth:"bearer",constant:"UPDATE_NEWS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/news/co/update",request:{additionalProperties:!1,anyOf:[it.common72,it.common73,it.common74],else:it.common65,if:it.common67,properties:{idNews:it.common9,markdownActive:it.common71,mediaFile:it.common75,mediaImg:it.common77,mentions:it.common79,parentId:it.common1,parentType:it.common13,scope:it.common83,tags:it.common23,text:it.common1,type:it.common84},required:["idNews","scope","markdownActive","parentId","parentType","type"],then:it.common69,type:"object"}},{auth:"bearer",constant:"SHARE_NEWS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/news/co/share",request:{additionalProperties:!1,else:{properties:{childId:it.common44}},if:{properties:{childType:it.common10}},properties:{childId:it.common9,childType:it.common13,comment:it.common1,connectType:{const:"share",default:"share",type:"string"},parentId:it.common9,parentType:it.common84},required:["parentId","parentType","childId","childType","connectType"],then:{properties:{childId:it.common51}},type:"object"}},{auth:"none",constant:"GET_COMMENTS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/comment/index/type/{type}/id/{id}/json/true",pathParams:it.common87},{auth:"bearer",constant:"ADD_COMMENTS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/comment/save",request:{additionalProperties:!1,properties:{argval:it.common8,contextId:it.common9,contextType:it.common89,mentions:it.common90,parentCommentId:it.common9,path:it.common8,text:it.common1},required:["text","contextId","contextType"],type:"object"}},{auth:"bearer",constant:"DELETE_COMMENTS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/comment/delete/id/{id}",pathParams:it.common85},{auth:"bearer",constant:"UPDATE_COMMENTS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/comment/update",request:{additionalProperties:!1,properties:{id:it.common9,params:{properties:{mentions:it.common90,text:it.common1},required:["text"],type:"object"}},required:["id","params"],type:"object"}},{auth:"none",constant:"SEARCH_TAGS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/api/tags/search?q={q}",pathParams:{additionalProperties:!1,properties:{q:it.common1},required:["q"],type:"object"}},{auth:"none",constant:"SHOW_VOTE",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/action/list/type/{type}/id/{id}/actionType/vote/json/true",pathParams:it.common87},{auth:"none",constant:"GLOBAL_AUTOCOMPLETE",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:it.common48,countType:{const:["NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects","citoyens","poi"],default:["NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects","citoyens","poi"],items:it.common93,type:"array"},fediverse:it.common94,filters:it.common95,indexMin:{const:0,default:0,type:"number"},indexStep:it.common47,initType:it.common95,locality:{additionalProperties:!1,patternProperties:{"^[^\\s]+$":{additionalProperties:!1,properties:{id:it.common1,type:{enum:["cities","level1"],type:"string"}},required:["id","type"],type:"object"}},type:"object"},name:it.common1,notSourceKey:it.common48,ranges:{additionalProperties:!1,patternProperties:{"^[^\\s]+$":it.common96},type:"object"},searchTags:it.common24,searchType:{items:it.common93,type:"array"}},required:["name","searchType","countType","indexMin","indexStep","initType","count","notSourceKey","filters","fediverse"],type:"object"}},{auth:"none",constant:"CITY_AUTOCOMPLETE",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{indexMax:{minimum:5,type:"integer"},indexMin:{minimum:0,type:"integer"},locality:it.common95,name:it.common1,searchBy:{const:"ALL",default:"ALL",type:"string"},searchType:{const:["cities"],default:["cities"],items:{enum:["cities"],type:"string"},type:"array"}},required:["name","locality","searchType"],type:"object"}},{auth:"none",constant:"SUGGESTION_INPUT",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{indexMax:{default:20,minimum:20,type:"integer"},indexMin:it.common98,name:it.common1,searchType:{items:{enum:["organizations","projects","poi"],type:"string"},type:"array"}},required:["name","searchType","indexMin","indexMax"],type:"object"}},{auth:"none",constant:"GET_PROJECTS_NO_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:it.common48,countType:it.common99,fediverse:it.common94,filters:{additionalProperties:!1,default:{$or:{"links.contributors.@userId":it.common101,"parent.@userId":it.common101},"links.contributors.@userId":it.common101},patternProperties:{"^links\\.contributors\\.(?:[a-f0-9]{24}|@\\w+)$":it.common102},properties:{$or:{additionalProperties:!1,maxProperties:2,minProperties:2,patternProperties:{"^links\\.contributors\\.(?:[a-f0-9]{24}|@\\w+)$":it.common102,"^parent\\.(?:[a-f0-9]{24}|@\\w+)$":it.common102},type:"object"}},required:["$or"],type:"object"},indexMin:it.common98,indexStep:it.common105,initType:it.common95,locality:it.common95,name:it.common1,notSourceKey:it.common48,searchType:it.common99},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"bearer",constant:"GET_PROJECTS_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocompleteadmin/type/{type}/id/{id}/canSee/true",pathParams:it.common63,request:{additionalProperties:!1,properties:{count:it.common48,countType:it.common99,fediverse:it.common94,filters:{additionalProperties:!1,default:{$or:{"links.contributors.@{pathParams.id}":it.common101,"parent.@{pathParams.id}":it.common101},"links.contributors.@{pathParams.id}":it.common101},patternProperties:{"^links\\.contributors\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":it.common102},properties:{$or:{additionalProperties:!1,maxProperties:2,minProperties:2,patternProperties:{"^links\\.contributors\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":it.common102,"^parent\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":it.common102},type:"object"}},required:["$or"],type:"object"},indexMin:it.common98,indexStep:it.common105,initType:it.common95,locality:it.common95,name:it.common1,notSourceKey:it.common48,searchType:it.common99},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"none",constant:"GET_POIS_NO_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:it.common48,countType:it.common106,fediverse:it.common94,filters:{additionalProperties:!1,default:{"parent.@userId":it.common101},patternProperties:{"^parent\\.(?:[a-f0-9]{24}|@\\w+)$":it.common102},type:"object"},indexMin:it.common98,indexStep:it.common105,initType:it.common95,locality:it.common95,name:it.common1,notSourceKey:it.common48,searchType:it.common106},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"bearer",constant:"GET_POIS_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocompleteadmin/type/{type}/id/{id}/canSee/true",pathParams:it.common63,request:{additionalProperties:!1,properties:{count:it.common48,countType:it.common106,fediverse:it.common94,filters:{additionalProperties:!1,default:{"parent.@{pathParams.id}":it.common101},patternProperties:{"^parent\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":it.common102},type:"object"},indexMin:it.common98,indexStep:it.common105,initType:it.common95,locality:it.common95,name:it.common1,notSourceKey:it.common48,searchType:it.common106},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"none",constant:"GET_ORGANIZATIONS_NO_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:it.common48,countType:it.common108,fediverse:it.common94,filters:{additionalProperties:!1,default:{"links.members.@userId":it.common101,"links.members.@userId.isInviting":it.common110,"links.members.@userId.toBeValidated":it.common110},patternProperties:{"^links\\.members\\.(?:[a-f0-9]{24}|@\\w+)$":it.common102,"^links\\.members\\.(?:[a-f0-9]{24}|@\\w+)\\.isInviting$":it.common111,"^links\\.members\\.(?:[a-f0-9]{24}|@\\w+)\\.toBeValidated$":it.common111},type:"object"},indexMin:it.common98,indexStep:it.common105,initType:it.common95,locality:it.common95,name:it.common1,notSourceKey:it.common48,searchType:it.common108},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"bearer",constant:"GET_ORGANIZATIONS_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocompleteadmin/type/{type}/id/{id}/canSee/true",pathParams:{additionalProperties:!1,else:it.common42,if:it.common53,properties:{id:it.common1,type:{default:"citoyens",enum:["citoyens","organizations"],type:"string"}},required:["type","id"],then:it.common49,type:"object"},request:{additionalProperties:!1,properties:{count:it.common48,countType:it.common108,fediverse:it.common94,filters:{additionalProperties:!1,default:{"links.members.@{pathParams.id}":it.common101,"links.members.@{pathParams.id}.isInviting":it.common110,"links.members.@{pathParams.id}.toBeValidated":it.common110},patternProperties:{"^links\\.members\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":it.common102,"^links\\.members\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":it.common111,"^links\\.members\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":it.common111},type:"object"},indexMin:it.common98,indexStep:it.common105,initType:it.common95,locality:it.common95,name:it.common1,notSourceKey:it.common48,searchType:it.common108},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"none",constant:"GET_MEMBERS_NO_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:it.common48,countType:it.common114,fediverse:it.common94,filters:{additionalProperties:!1,allOf:[{not:{propertyNames:{pattern:"^(?!links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)$)"}}},{not:{propertyNames:{pattern:"^(?!links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)\\.toBeValidated$)"}}}],patternProperties:{"^links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)$":it.common102,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)\\.isAdmin$":it.common102,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)\\.isInviting$":it.common116,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)\\.roles$":it.common118,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)\\.toBeValidated$":it.common111},type:"object"},indexMin:it.common98,indexStep:it.common105,initType:it.common95,locality:it.common95,name:it.common1,notSourceKey:it.common48,searchType:it.common114},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"bearer",constant:"GET_MEMBERS_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocompleteadmin/type/organizations/id/{id}/canSee/true",pathParams:it.common85,request:{additionalProperties:!1,properties:{count:it.common48,countType:it.common114,fediverse:it.common94,filters:{additionalProperties:!1,allOf:[{not:{propertyNames:{pattern:"^(?!links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}}}],default:{"links.memberOf.@{pathParams.id}":it.common101,"links.memberOf.@{pathParams.id}.isInviting":it.common110,"links.memberOf.@{pathParams.id}.toBeValidated":it.common110},patternProperties:{"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":it.common102,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isAdmin$":it.common102,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":it.common116,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.roles$":it.common118,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":it.common116},type:"object"},indexMin:it.common98,indexStep:it.common105,initType:it.common95,locality:it.common95,name:it.common1,notSourceKey:it.common48,searchType:it.common114},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"bearer",constant:"GET_FRIENDS_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocompleteadmin/type/citoyens/id/{id}/canSee/true",pathParams:it.common6,request:{additionalProperties:!1,properties:{count:it.common48,countType:it.common121,fediverse:it.common94,filters:{additionalProperties:!1,allOf:[{not:{propertyNames:{pattern:"^(?!links\\.friends\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}}}],default:{"links.friends.@{pathParams.id}":it.common101,"links.friends.@{pathParams.id}.isInviting":it.common110,"links.friends.@{pathParams.id}.toBeValidated":it.common110},patternProperties:{"^links\\.friends\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":it.common102,"^links\\.friends\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":it.common116,"^links\\.friends\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":it.common116},type:"object"},indexMin:it.common98,indexStep:it.common105,initType:it.common95,locality:it.common95,name:it.common1,notSourceKey:it.common48,searchType:it.common121},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"none",constant:"GET_SUBSCRIPTIONS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:it.common48,countType:it.common123,fediverse:it.common94,filters:{additionalProperties:!1,allOf:[it.common125],default:{"links.followers.@userId":it.common101,"links.followers.@{userId}.isInviting":it.common110,"links.followers.@{userId}.toBeValidated":it.common110},patternProperties:it.common128,type:"object"},indexMin:it.common98,indexStep:it.common105,initType:it.common95,locality:it.common95,name:it.common1,notSourceKey:it.common48,searchType:it.common123},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"bearer",constant:"GET_SUBSCRIPTIONS_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocompleteadmin/type/citoyens/id/{id}/canSee/true",pathParams:it.common6,request:{additionalProperties:!1,properties:{count:it.common48,countType:it.common123,fediverse:it.common94,filters:{additionalProperties:!1,allOf:[it.common125],default:{"links.followers.@{pathParams.id}":it.common101,"links.followers.@{pathParams.id}.isInviting":it.common110,"links.followers.@{pathParams.id}.toBeValidated":it.common110},patternProperties:it.common128,type:"object"},indexMin:it.common98,indexStep:it.common105,initType:it.common95,locality:it.common95,name:it.common1,notSourceKey:it.common48,searchType:it.common123},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"none",constant:"GET_SUBSCRIBERS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:it.common48,countType:it.common121,fediverse:it.common94,filters:{additionalProperties:!1,allOf:[it.common129],default:{"links.follows.@userId":it.common101,"links.follows.@{userId}.isInviting":it.common110,"links.follows.@{userId}.toBeValidated":it.common110},patternProperties:{"^links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":it.common102,"^links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":it.common111,"^links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":it.common111},type:"object"},indexMin:it.common98,indexStep:it.common105,initType:it.common95,locality:it.common95,name:it.common1,notSourceKey:it.common48,searchType:it.common121},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"bearer",constant:"GET_SUBSCRIBERS_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocompleteadmin/type/{type}/id/{id}/canSee/true",pathParams:{additionalProperties:!1,allOf:[{else:it.common42,if:it.common53,then:it.common49}],properties:{id:it.common1,type:{default:"citoyens",enum:["citoyens","organizations","projects"],type:"string"}},required:["type","id"],type:"object"},request:{additionalProperties:!1,properties:{count:it.common48,countType:it.common121,fediverse:it.common94,filters:{additionalProperties:!1,allOf:[it.common129],default:{"links.follows.@{pathParams.id}":it.common101},maxProperties:1,minProperties:1,patternProperties:{"^links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":it.common102},type:"object"},indexMin:it.common98,indexStep:it.common105,initType:it.common95,locality:it.common95,name:it.common1,notSourceKey:it.common48,searchType:it.common121},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"none",constant:"GET_CONTRIBUTORS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:it.common48,countType:it.common114,fediverse:it.common94,filters:{additionalProperties:!1,allOf:[{not:{propertyNames:{pattern:"^(?!links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)$)"}}},{not:{propertyNames:{pattern:"^(?!links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)\\.toBeValidated$)"}}}],patternProperties:{"^links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)$":it.common102,"^links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)\\.isAdmin$":it.common102,"^links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)\\.isInviting$":it.common116,"^links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)\\.roles$":it.common118,"^links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)\\.toBeValidated$":it.common111},type:"object"},indexMin:it.common98,indexStep:it.common105,initType:it.common95,locality:it.common95,name:it.common1,notSourceKey:it.common48,searchType:it.common114},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"bearer",constant:"GET_CONTRIBUTORS_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocompleteadmin/type/projects/id/{id}/canSee/true",pathParams:it.common85,request:{additionalProperties:!1,properties:{count:it.common48,countType:it.common114,fediverse:it.common94,filters:{additionalProperties:!1,allOf:[{not:{propertyNames:{pattern:"^(?!links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}}}],default:{"links.projects.@{pathParams.id}":it.common101,"links.projects.@{pathParams.id}.isInviting":it.common110,"links.projects.@{pathParams.id}.toBeValidated":it.common110},patternProperties:{"^links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":it.common102,"^links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isAdmin$":it.common102,"^links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":it.common116,"^links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.roles$":it.common118,"^links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":it.common116},type:"object"},indexMin:it.common98,indexStep:it.common105,initType:it.common95,locality:it.common95,name:it.common1,notSourceKey:it.common48,searchType:it.common114},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"none",constant:"GET_BADGES",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:it.common48,countType:it.common132,fediverse:it.common94,filters:{properties:{$or:{additionalProperties:!1,minProperties:1,patternProperties:{"^issuer\\.(?:[a-f0-9]{24}|@\\w+)$":it.common102},type:"object"},isParcours:it.common3,"preferences.private":it.common94},required:["preferences.private"],type:"object"},indexMin:it.common98,indexStep:it.common105,initType:it.common95,locality:it.common95,name:it.common1,notSourceKey:it.common48,searchType:it.common132},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"none",constant:"GET_BADGES_FILTERS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:it.common48,countType:it.common134,fediverse:it.common94,fields:it.common132,filters:{oneOf:[{additionalProperties:!1,maxProperties:1,minProperties:1,patternProperties:{"badges\\.(?:[a-f0-9]{24}|@\\w+)$":it.common136}},{additionalProperties:!1,maxProperties:3,minProperties:3,patternProperties:{"badges\\.(?:[a-f0-9]{24}|@\\w+)$":it.common136,"badges\\.(?:[a-f0-9]{24}|@\\w+)\\.attenteEmetteur$":it.common139,"badges\\.(?:[a-f0-9]{24}|@\\w+)\\.attenteRecepteur$":it.common139}},{additionalProperties:!1,maxProperties:2,minProperties:2,patternProperties:it.common142},{additionalProperties:!1,maxProperties:1,minProperties:1,properties:{$or:{additionalProperties:!1,maxProperties:2,minProperties:2,patternProperties:it.common142,type:"object"}},required:["$or"]},{additionalProperties:!1,maxProperties:1,minProperties:1,patternProperties:{"badges\\.(?:[a-f0-9]{24}|@\\w+)\\.revoke$":it.common138}},{additionalProperties:!1,maxProperties:1,minProperties:1,patternProperties:{"badges\\.(?:[a-f0-9]{24}|@\\w+)\\.attenteEmetteur$":it.common136}}],type:"object"},indexMin:it.common98,indexStep:it.common105,initType:it.common95,locality:it.common95,name:it.common1,notSourceKey:it.common48,ranges:{additionalProperties:!1,default:{Cooperative:it.common143,GovernmentOrganization:it.common143,Group:it.common143,LocalBusiness:it.common143,NGO:it.common143,citoyens:it.common143,projects:it.common143},maxProperties:7,minProperties:7,patternProperties:{"^[a-zA-Z][a-zA-Z0-9]*$":it.common96},type:"object"},searchType:it.common134},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","locality","fediverse"],type:"object"}},{auth:"bearer",constant:"CONNECT",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/link/connect",request:it.common144},{auth:"bearer",constant:"DISCONNECT",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/link/disconnect",request:it.common144},{auth:"none",constant:"GET_ELEMENTS_KEY",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/slug/getinfo/key/{slug}",pathParams:{additionalProperties:!1,properties:{slug:{pattern:"^([a-zA-Z0-9-_]+)$",type:"string"}},required:["slug"],type:"object"}}];Xe.default.addType("oid",(e=>new nt.ObjectID(e)));class at extends Fe.EventEmitter{constructor({baseURL:e,accessToken:t,refreshToken:o,refreshUrl:n="/api/cocolight/refreshtoken",endpoints:i=rt,timeout:r=3e4,debug:a=!1,maxRetries:s=0,circuitBreakerThreshold:c=5,circuitBreakerResetTime:m=6e4,fromJSONValue:p=!0}={}){if(super(),!e)throw new u('Le paramètre "baseURL" est obligatoire.',500);this._baseURL=e,this._refreshToken=o,this._refreshUrl=n,this._endpoints=i,this._debug=a;let l=null;this._fromJSONValue=p,Object.defineProperty(this,"userId",{get:()=>l,set:()=>{throw new Error("Modification directe de userId non autorisée.")},enumerable:!0}),this._setUserId=e=>{l=e,this._logger.debug(`[ApiClient] userId set: ${e}`)},this._ajv=new Je.default({strict:!1,useDefaults:!0,allErrors:!0,verbose:!0}),(0,He.default)(this._ajv),this._logger=(0,tt.default)({transport:{target:"pino-pretty",options:{colorize:!0}},level:a?"debug":"info"}),this._client=Ye.default.create({baseURL:e,timeout:r}),s>0&&((0,Qe.default)(this._client,{retries:s,retryDelay:Qe.default.exponentialDelay,retryCondition:e=>Qe.default.isNetworkError(e)||Qe.default.isRetryableError(e)}),this._logger.info(`[ApiClient] Retry activé : ${s} max`)),this._breakerThreshold=c,this._breakerResetTime=m,this._breakerErrorCount=0,this._breakerOpen=!1,this._lastBreakerOpenTime=null,t&&this.setToken(t),this._client.interceptors.response.use((e=>e),(async e=>{if(e.response&&401===e.response.status&&this._refreshToken)try{if(await this._refreshAccessToken())return this._client.request(e.config)}catch(e){throw new u(e.message,401,e)}throw e}))}setToken(e){this._accessToken=e,this._client.defaults.headers.common.Authorization="Bearer "+e;const t=this._getIdFromToken(e);t&&(this._setUserId(t),this._logger.debug(`[ApiClient] userId extrait et défini : ${t}`)),this._logger.debug(`[ApiClient] setToken: ${e}`)}getToken(){return this._accessToken}setRefreshToken(e){this._refreshToken=e;const t=this._getIdFromToken(e);t&&(this._setUserId(t),this._logger.debug(`[ApiClient] userId extrait depuis refreshToken : ${t}`)),this._logger.debug(`[ApiClient] setRefreshToken: ${e}`)}getRefreshToken(){return this._refreshToken}get isConnected(){return!!this._accessToken}_getIdFromToken(e){if(!e)return null;try{const t=function(e,t){if("string"!=typeof e)throw new et("Invalid token specified: must be a string");t||(t={});const o=!0===t.header?0:1,n=e.split(".")[o];if("string"!=typeof n)throw new et(`Invalid token specified: missing part #${o+1}`);let i;try{i=function(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return function(e){return decodeURIComponent(atob(e).replace(/(.)/g,((e,t)=>{let o=t.charCodeAt(0).toString(16).toUpperCase();return o.length<2&&(o="0"+o),"%"+o})))}(t)}catch(e){return atob(t)}}(n)}catch(e){throw new et(`Invalid token specified: invalid base64 for part #${o+1} (${e.message})`)}try{return JSON.parse(i)}catch(e){throw new et(`Invalid token specified: invalid json for part #${o+1} (${e.message})`)}}(e);return this._logger.debug("[ApiClient] Payload décodé :",t),t.id||t.userId||null}catch(e){return this._logger.error("[ApiClient] Erreur lors du décodage du token :",e),null}}async _refreshAccessToken(){if(!this._refreshToken)return!1;try{const e=await this._client.post(this._refreshUrl,{refreshToken:this._refreshToken},{headers:{"Content-Type":"application/json"}});return!(!e.data||!e.data.accessToken||(this.setToken(e.data.accessToken),e.data.refreshToken&&this.setRefreshToken(e.data.refreshToken),this.emit("refreshSuccess",e.data),0))}catch(e){return this.resetSession(),this._logger.error(`[ApiClient] Refresh Error : ${e.message}`),!1}}_checkCircuitBreaker(){return!this._breakerOpen||Date.now()-this._lastBreakerOpenTime>this._breakerResetTime&&(this._breakerOpen=!1,this._breakerErrorCount=0,this._logger.warn("[ApiClient] Circuit breaker réinitialisé"),!0)}_updateCircuitBreakerError(){this._breakerErrorCount+=1,this._logger.warn(`[ApiClient] Erreur #${this._breakerErrorCount} sur ${this._breakerThreshold}`),this._breakerErrorCount>=this._breakerThreshold&&(this._breakerOpen=!0,this._lastBreakerOpenTime=Date.now(),this._logger.error("[ApiClient] Circuit breaker ACTIVÉ - L'API est considérée indisponible"))}_resetCircuitBreakerSuccess(){this._breakerErrorCount=0,this._breakerOpen&&(this._breakerOpen=!1,this._logger.warn("[ApiClient] Circuit breaker refermé suite à un succès"))}static stripNullsInPlace(e){if(e&&"object"==typeof e&&e.value&&"function"==typeof e.value.pipe)return e;if(Array.isArray(e))for(let t=e.length-1;t>=0;t--)null===e[t]||void 0===e[t]?e.splice(t,1):"object"==typeof e[t]&&at.stripNullsInPlace(e[t]);else if(e&&"object"==typeof e)for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(null===e[t]||void 0===e[t]?delete e[t]:"object"==typeof e[t]&&at.stripNullsInPlace(e[t]));return e}_resolveSpecialValuesInPlace(e,t={}){const o={userId:()=>this.userId,accessToken:()=>this._accessToken,refreshToken:()=>this._refreshToken,baseURL:()=>this._baseURL,pathParams:e=>{const o=this._getValueByPath(t,e);return null!=o?o:void 0}},n=/@(?:\{([^}]+)\}|([\w.]+))/g,i=e=>"string"!=typeof e?e:e.replace(n,((t,n,i)=>{if(n){if(n.startsWith("pathParams.")){const e=n.substring(11),t=o.pathParams(e);return null!=t?t:`@{${n}}`}{const e=o[n];if("function"==typeof e){const t=e();return null!=t?t:`@{${n}}`}return`@{${n}}`}}if(i){if(i.startsWith("pathParams.")){const e=i.match(/^pathParams\.([^.]+)(.*)$/);if(e){const t=e[1],n=e[2],r=o.pathParams(t);return null!=r?r+n:`@${i}`}return`@${i}`}{const e=o[i];if("function"==typeof e){const t=e();return null!=t?t:`@${i}`}return`@${i}`}}return e})),r=e=>{if((e=>e&&"object"==typeof e&&("function"==typeof e.pipe||"undefined"!=typeof Buffer&&e instanceof Buffer))(e))return e;if(Array.isArray(e))return e.map(r);if((e=>"[object Object]"===Object.prototype.toString.call(e))(e)){const t={};for(const[o,n]of Object.entries(e))t[i(o)]=r(n);return t}return"string"==typeof e?i(e):e};return r(e)}_cleanSchemaLeftoverAlias(e){const t=/@\w+/;if(Array.isArray(e))return e.map((e=>this._cleanSchemaLeftoverAlias(e)));if(e&&"object"==typeof e){const o={};for(const n of Object.keys(e)){const i=e[n];if(!t.test(n)){if("default"===n){if("string"==typeof i&&t.test(i))continue;if(i&&"object"==typeof i){const e=this._cleanSchemaLeftoverAlias(i);Object.keys(e).length>0&&(o[n]=e);continue}}"string"==typeof i&&t.test(i)||(o[n]=this._cleanSchemaLeftoverAlias(i))}}return o}return e}async safeCall(e,...t){try{return await e(...t)}catch(e){throw this._logger.error(`[ApiClient.safeCall] Erreur: ${e.message}`),e}}async callEndpoint(e,t={},o=!0,n=!0){if(!this._checkCircuitBreaker())throw new h("Le circuit breaker est activé, impossible d'appeler l'API");const i=this._endpoints.find((t=>t.constant===e));if(!i)throw new u(`Endpoint introuvable : ${e}`,404);const{path:r,method:a,contentType:s,auth:c,pathParams:m,request:p,responses:l}=i,d=(a||"GET").toLowerCase(),y=s||"application/json",g={"Content-Type":y};if(this._accessToken)"bearer"===c?g.Authorization=`Bearer ${this._accessToken}`:c&&"none"!==c||g.Authorization||(g.Authorization=`Bearer ${this._accessToken}`);else if("bearer"===c)throw new u(`Token requis pour l'endpoint sécurisé : ${e}`,401);let w,b=r,x={};if(m){let e=m;"none"===c&&null===this.userId&&(e=this._cleanSchemaLeftoverAlias(m));const o=t.pathParams||{},n=this._ajv.compile(e);if(!n(o)){const e=this._ajvErrorHuman(n.errors);throw this.emit("validationError",{stage:"pathParams",errors:n.errors}),new f("Path parameter validation failed.",400,e,n.errors)}x=this._resolveSpecialValuesInPlace(o),b=b.replace(/\{(\w+)\}/g,((e,t)=>{const o=x[t];if(void 0!==o)return encodeURIComponent(o);throw new u(`Path param manquant ou non résolu : {${t}}`,400)}))}if(p){let e=p;"none"===c&&null===this.userId&&(e=this._cleanSchemaLeftoverAlias(p));const o={...t};delete o.pathParams;const n=at.stripNullsInPlace(o),i=this._ajv.compile(e);if(!i(n)){const e=this._ajvErrorHuman(i.errors);throw this.emit("validationError",{stage:"request",errors:i.errors}),new f("Request validation failed.",400,e,i.errors)}t=this._resolveSpecialValuesInPlace(n,x)}"application/json"===y||"multipart/form-data"===y?w=t:"application/x-www-form-urlencoded"===y&&(w=at.toURLSearchParams(t)),this._logger.debug(`[ApiClient] callEndpoint: ${e} -> ${b}, method=${d}`);try{const e=await this._client.request({url:b,method:d,headers:g,["get"===d?"params":"data"]:w});if(n){const t=e.status.toString(),o=l?.[t];if(o){const n=this._ajv.compile(o);if(!n(e.data)){const e=this._ajvErrorHuman(n.errors);throw this.emit("validationError",{stage:"response",errors:n.errors}),new f("Response validation failed.",t,e,n.errors)}}}return this._resetCircuitBreakerSuccess(),"function"==typeof o?e.data=o(e.data):!0===o&&(e.data=this._transformData(e.data)),Array.isArray(i.postActions)&&i.postActions.forEach((t=>{const o=t.path?this._getValueByPath(e.data,t.path):null;switch(t.type){case"setToken":this.setToken(o);break;case"setRefreshToken":this.setRefreshToken(o);break;case"resetSession":this.resetSession();break;case"emitEvent":t.event&&(this.emit(t.event,o),this._logger.debug(`[ApiClient] Event émis : ${t.event}`,o));break;case"callMethod":"function"==typeof this[t.method]?(this[t.method](),this._logger.debug(`[ApiClient] Méthode appelée : ${t.method}`)):this._logger.warn(`[ApiClient] Méthode inconnue : ${t.method}`);break;default:this._logger.warn(`[ApiClient] Action inconnue : ${t.type}`)}})),e}catch(t){throw this._updateCircuitBreakerError(),this._logger.error(`[ApiClient] Erreur lors de l'appel de ${e}: ${t.message}`),new u(`Erreur lors de l'appel de l'API : ${t.message}`,t.response?t.response.status:500,t.response?t.response.data:null)}}_ajvErrorHuman(e){return new We(e).errors.map((({message:e})=>e))}checkAndThrowApiResponseError(e){const t=e.data;if(!t||"object"!=typeof t)return e;if("boolean"==typeof t.result&&!1===t.result)throw new y(t.msg||"Erreur inconnue",e.status,t);if(t.resultErrors&&"object"==typeof t.resultErrors&&"boolean"==typeof t.resultErrors.result&&!1===t.resultErrors.result)throw new y(t.resultErrors.msg||"Erreur inconnue",e.status,t);return e}resetSession(){this.setToken(null),this.setRefreshToken(null),this._setUserId(null),delete this._client.defaults.headers.common.Authorization,this._logger.info("[ApiClient] Session utilisateur réinitialisée."),this.emit("sessionReset")}_getValueByPath(e,t){if(t)return t.split(".").reduce(((e,t)=>e&&e[t]),e)}static toURLSearchParams(e,t={}){return this._buildParams(e,new URLSearchParams,t)}static _buildParams(e,t,o={}){if("object"!=typeof e||null===e)throw new TypeError("La donnée doit être un objet non nul.");const{dots:n=!1,indexes:i=!1,metaTokens:r=!0}=o,a=[];function s(e){return"[object Object]"===Object.prototype.toString.call(e)||Array.isArray(e)}function c(e){return e.endsWith("[]")?e.slice(0,-2):e}function m(e,t,o=!1){return e?e.concat(t).map(((e,t)=>(e=c(e),!o&&t?`[${e}]`:e))).join(o?".":""):t}function p(e){return null==e?"":e instanceof Date?e.toISOString():(e instanceof Blob||e instanceof File||e instanceof ArrayBuffer||ArrayBuffer.isView(e),e)}return function e(o,l=[]){null==o||a.includes(o)||(a.push(o),Object.entries(o).forEach((([o,a])=>{void 0!==a&&function(e,o,a){if(e&&"object"==typeof e){if(o.endsWith("{}"))return o=r?o:o.slice(0,-2),t.append(m(a,o,n),JSON.stringify(e)),!1;if(Array.isArray(e)&&!e.some(s)||o.endsWith("[]"))return o=c(o),e.forEach(((e,r)=>{if(null!=e){const s=i?m(a.concat(o),r,n):`${m(a,o,n)}[]`;t.append(s,p(e))}})),!1}return!!s(e)||(t.append(m(a,o,n),p(e)),!1)}(a,o.trim(),l)&&e(a,l.concat(c(o)))})),a.pop())}(e),t}_transformData(e){if(e&&"object"==typeof e)if(e.resultGoods?.msg)e=this._normalizeJsonData({msg:e.resultGoods.msg,...e});else if(e.resultErrors?.msg)e=this._normalizeJsonData({msg:e.resultErrors.msg,...e});else if(e.results&&"object"==typeof e.results&&!Array.isArray(e.results))e.results=Object.keys(e.results).map((t=>this._normalizeJsonData({id:t,...e.results[t]})));else if(Array.isArray(e.results))e.results=e.results.map((e=>this._normalizeJsonData(e)));else if(e.news&&Array.isArray(e.news)&&0===e.news.length)e=e.news;else if(e.news&&"object"==typeof e.news&&!Array.isArray(e.news))e=Object.keys(e.news).map((t=>this._normalizeJsonData({id:t,...e.news[t]})));else if(e.notif&&"object"==typeof e.notif&&!Array.isArray(e.notif))e.notif=Object.keys(e.notif).map((t=>this._normalizeJsonData({id:t,...e.notif[t]})));else if(e.citoyens&&"object"==typeof e.citoyens&&!Array.isArray(e.citoyens)&&e.organizations&&"object"==typeof e.organizations&&!Array.isArray(e.organizations))e=[...Object.keys(e.citoyens).map((t=>this._normalizeJsonData({id:t,...e.citoyens[t]}))),...Object.keys(e.organizations).map((t=>this._normalizeJsonData({id:t,...e.organizations[t]})))];else if(e.citoyens&&"object"==typeof e.citoyens&&!Array.isArray(e.citoyens))e=Object.keys(e.citoyens).map((t=>this._normalizeJsonData({id:t,...e.citoyens[t]})));else if(e.cities&&"object"==typeof e.cities&&!Array.isArray(e.cities))e=Object.keys(e.cities).map((t=>this._normalizeJsonData({id:t,...e.cities[t]})));else if(e.cities&&Array.isArray(e.cities)&&0===e.cities.length)e=e.cities;else if(e.newComment&&"object"==typeof e.newComment)e.newComment=this._normalizeJsonData({...e.newComment});else if(Array.isArray(e))e=e.map((e=>this._normalizeJsonData(e)));else if(e.map&&"object"==typeof e.map)e.map=this._normalizeJsonData(e.map);else if(e.object&&"object"==typeof e.object)e.object=this._normalizeJsonData(e.object);else if("object"==typeof e&&Object.keys(e).length>0){const t=Object.keys(e).every((e=>/^[0-9a-fA-F]{24}$/.test(e)));e=t?Object.keys(e).map((t=>({id:t,...this._normalizeJsonData(e[t])}))):this._normalizeJsonData(e)}return e}_normalizeJsonData(e){if(!e||"object"!=typeof e)return e;if(e=this._normalizeRecursively(e),e?.mediaImg?.images&&Array.isArray(e.mediaImg.images)&&e.mediaImg.images.length>0&&(e.mediaImg.countImages=e.mediaImg.images.length),e?.mediaFile?.files&&Array.isArray(e.mediaFile.files)&&e.mediaFile.files.length>0&&(e.mediaFile.countFiles=e.mediaFile.files.length),e?.src?.changes&&"object"==typeof e.src.changes&&Object.keys(e.src.changes).length>0&&Object.keys(e.src.changes).forEach((t=>{e.src.changes[t]&&(e.src.changes[t]=this._ensureFullURL(e.src.changes[t]))})),e?.openingHours&&Array.isArray(e.openingHours)&&e.openingHours.length>0&&(e.openingHours=e.openingHours.filter((e=>e.dayOfWeek&&e.hours&&e.hours[0]&&e.hours[0].opens))),e.replies&&"object"==typeof e.replies&&Object.keys(e.replies).length>0&&(e.replies=Object.keys(e.replies).map((t=>this._normalizeJsonData({id:t,...e.replies[t]})))),e?.author&&"object"==typeof e.author&&Object.keys(e.author).length>0&&!("profilThumbImageUrl"in e.author)){const t=Object.keys(e.author)[0];e.author={...e.author[t]}}return e?.timeAgo&&delete e.timeAgo,this._fromJSONValue?Xe.default.fromJSONValue(e):e}_ensureFullURL(e){if(!e)return e;if(!(e=e.trim())||/^https?:\/\//i.test(e))return e;let t="/";return t=this._baseURL.endsWith("/")&&e.startsWith("/")||this._baseURL.endsWith("/")||e.startsWith("/")?"":"/",`${this._baseURL}${t}${e}`}_normalizeString(e){return"true"===e||"false"!==e&&e}_normalizeId(e){return e._id&&e._id.$id&&/^[0-9a-fA-F]{24}$/.test(e._id.$id)&&(e.id=e._id.$id,e._id={$type:"oid",$value:e._id.$id}),e.id&&e.id.$id&&/^[0-9a-fA-F]{24}$/.test(e.id.$id)&&(e._id={$type:"oid",$value:e.id.$id},e.id=e.id.$id),e}_normalizeDate(e){return e&&"object"==typeof e&&"number"==typeof e.sec?{$date:1e3*e.sec}:"number"==typeof e?{$date:1e3*e}:e}_normalizeImage(e){return"string"==typeof e&&""!==e.trim()?this._ensureFullURL(e):e}_imageFields=["profilImageUrl","profilThumbImageUrl","profilMediumImageUrl","profilMarkerImageUrl","profilBannerUrl","profilRealBannerUrl","imagePath","imageThumbPath","docPath"];_dateFields=["modified","created","updated","birthDate","lastLoginDate","startDate","endDate","date"];_normalizeRecursively(e){if("string"==typeof e)return this._normalizeString(e);if(Array.isArray(e))return e.map((e=>this._normalizeRecursively(e)));if(null!==e&&"object"==typeof e){const t={};return Object.keys(e).forEach((o=>{let n=this._normalizeRecursively(e[o]);this._dateFields.includes(o)&&(n=this._normalizeDate(n)),this._imageFields.includes(o)&&(n=this._normalizeImage(n)),"content"===o&&n&&"object"==typeof n&&n.image&&(n.image=this._normalizeImage(n.image)),t[o]=n})),this._normalizeId(t)}return e}}class st{constructor(e){this.client=new at(e),this.loggedUser=null}async login(e,t){return this.client.safeCall((async()=>{const o=await this.client.callEndpoint("AUTHENTICATE_URL",{email:e,password:t});return this.loggedUser=new Le(this.client,{id:o.data.user.id},o.data.user),this.loggedUser}))}async register({name:e,username:t,email:o,pwd:n}={}){return this.client.safeCall((async()=>{const i=await this.client.callEndpoint("PERSON_REGISTER",{name:e,username:t,email:o,pwd:n});if(!1===i?.data?.result)throw new y(i.data.msg,i.status,i.data);return i.data}))}async recoverPassword(e){return this.client.safeCall((async()=>{const t=await this.client.callEndpoint("PASSWORD_RECOVERY",{email:e});if(!1===t?.data?.result)throw new y(t.data.msg,t.status,t.data);return t.data}))}}class ct{static async userLogin(e,t,o){const n=ct.userApi(o);return await ct.userApiLogin(n,e,t)}static userApi(e){try{return new st(e)}catch(e){throw console.error("[Api.userApi] Erreur lors de la création d'un objet utilisateur :",e.message),e}}static async userApiLogin(e,t,o){try{const n=await e.login(t,o);return new ct(n,e.client)}catch(e){if(e instanceof u&&e?.details?.error)throw new g(e.details.error,e.status,e.details);throw e}}constructor(e,t){this._loggedUser=e,this._client=t}me(){if(!this._loggedUser)throw new g("Accès refusé : utilisateur non authentifié.");return this._loggedUser}user(e){try{return new Le(this._client,e)}catch(e){throw console.error("[Api.user] Erreur lors de la création d'un objet utilisateur public :",e.message),e}}async organization(e,t={getProfile:!0}){try{const o=new Ne(this._client,e);return t.getProfile&&await o.getProfil(),o}catch(e){throw console.error("[Api.organization] Erreur lors de la création d'un objet organisation :",e.message),e}}async project(e,t={getProfile:!0}){try{const o=new Me(this._client,e);return t.getProfile&&await o.getProfil(),o}catch(e){throw console.error("[Api.project] Erreur lors de la création d'un objet projet :",e.message),e}}get client(){return this._client}}const mt={ApiClient:at,Api:ct,error:l};var pt=p.A;export{pt as default};