@overmap-ai/core 1.0.81-fix-model-reducers.1 → 1.0.81-fix-model-reducers.2

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.
@@ -5038,7 +5038,7 @@ class xw extends v {
5038
5038
  }), [c, p];
5039
5039
  }
5040
5040
  bulkAdd(e, i) {
5041
- const { payloads: n, values: a } = e, { addMany: r, setMany: d, deleteMany: c } = this.actions, p = (/* @__PURE__ */ new Date()).toISOString(), l = [], y = dt(n, Math.min(i ?? n.length, ct)), A = [];
5041
+ const { payloads: n, values: a } = e, { addMany: r, updateMany: d, deleteMany: c } = this.actions, p = (/* @__PURE__ */ new Date()).toISOString(), l = [], y = dt(n, Math.min(i ?? n.length, ct)), A = [];
5042
5042
  for (const b of y) {
5043
5043
  const F = [];
5044
5044
  for (const w of b) {
@@ -7151,7 +7151,7 @@ class dF extends v {
7151
7151
  }
7152
7152
  }
7153
7153
  async refreshStore(e, i) {
7154
- const { setMany: n } = this.actions, r = (await this.listPaginated(
7154
+ const { initialize: n } = this.actions, r = (await this.listPaginated(
7155
7155
  {
7156
7156
  queryParams: {
7157
7157
  issue__project: e
@@ -9162,7 +9162,7 @@ class EF extends v {
9162
9162
  }), [r, d];
9163
9163
  }
9164
9164
  bulkAdd(e) {
9165
- const { addMany: i, setMany: n, deleteMany: a } = this.actions, r = this.select((l) => {
9165
+ const { addMany: i, updateMany: n, deleteMany: a } = this.actions, r = this.select((l) => {
9166
9166
  var y;
9167
9167
  return ((y = l.userReducer.currentUser) == null ? void 0 : y.id) ?? null;
9168
9168
  }), d = (/* @__PURE__ */ new Date()).toISOString(), c = e.map(
@@ -10053,7 +10053,7 @@ class xF extends v {
10053
10053
  }), [r, d];
10054
10054
  }
10055
10055
  bulkAdd(e) {
10056
- const { addMany: i, setMany: n, deleteMany: a } = this.actions, r = this.select((l) => {
10056
+ const { addMany: i, updateMany: n, deleteMany: a } = this.actions, r = this.select((l) => {
10057
10057
  var y;
10058
10058
  return ((y = l.userReducer.currentUser) == null ? void 0 : y.id) ?? null;
10059
10059
  }), d = (/* @__PURE__ */ new Date()).toISOString(), c = e.map(
@@ -10078,7 +10078,7 @@ class xF extends v {
10078
10078
  return p.then((l) => {
10079
10079
  this.dispatch(n(l));
10080
10080
  }).catch(() => {
10081
- this.dispatch(a(c.map((l) => l.uuid)));
10081
+ this.dispatch(a(E(c)));
10082
10082
  }), [c, p];
10083
10083
  }
10084
10084
  async delete(e) {
@@ -10901,7 +10901,7 @@ class YF extends v {
10901
10901
  }), [r, d];
10902
10902
  }
10903
10903
  bulkAdd(e) {
10904
- const { addMany: i, setMany: n, deleteMany: a } = this.actions, r = this.select((p) => {
10904
+ const { addMany: i, updateMany: n, deleteMany: a } = this.actions, r = this.select((p) => {
10905
10905
  var l;
10906
10906
  return ((l = p.userReducer.currentUser) == null ? void 0 : l.id) ?? null;
10907
10907
  }), d = e.map((p) => T({ ...p, created_by: r }));
@@ -4,11 +4,11 @@ Retries:`,e),!(t instanceof Error))throw console.error("ENCOUNTERED NON-ERROR ER
4
4
  Action:`,s);const f=St();if(!f)throw new Error("Outbox coordinator not set");f.remove(s.payload.uuid),t.options.discard=!0,u()}}console.debug("Registering a retry for request:",s.payload.uuid);const d=St();if(!d)throw new Error("Outbox coordinator not set");return d.registerRetry(s.payload.uuid),!1}function tM(t,s,e){var n;return(n=St())==null?void 0:n.peek()}function sM(t,s){return Rt().dispatch(xf(new Date().getTime())),Pc}const gt="An unknown error occurred",iM=500,ab=["non_field_errors","detail"];function nM(t,s){let e;if(t!=null&&t.body)if(typeof t.body=="object"){const n=t.body;if(typeof n.error=="string")e=n.error;else if(typeof n.message=="string")e=n.message;else try{e=Object.entries(n).map(([c,r])=>typeof r=="string"?ab.includes(c)?r:`${c}: ${r}`:Array.isArray(r)?ab.includes(c)?r.join(`
5
5
  `):r.map(a=>`${c}: ${a}`).join(`
6
6
  `):`${c}: ${JSON.stringify(r)}`).join(`
7
- `)}catch(c){console.error("Failed to extract error message from response body",c)}}else typeof t.body=="string"&&(e=t.body);else t!=null&&t.text?e=t.text:s instanceof Error&&(e=s.message);return!e||e.length>iM?gt:e}class U extends Error{constructor(e){super(gt);h(this,"status");h(this,"response");h(this,"message");h(this,"options");const{response:n,innerError:c}=e;this.message=e.message??nM(n,c)??gt,this.status=(n==null?void 0:n.status)??0,this.response=n,e.discard=e.discard??!1,this.options=e}}function rb(t){function s(e){return typeof e=="object"&&e!==null&&["ok","redirect","clientError","serverError","error"].every(c=>c in e)}if(s(t))return t;if(typeof t=="object"&&t!==null){const e=t;if(s(e.response))return e.response;if(e.response&&s(e.response.response))return e.response.response}}class cM extends tb{constructor(s){super(s)}}class yt extends tb{constructor(e,n){super(e);h(this,"auth");this.auth=n}}class aM extends yt{async startConversation(s,e){return this.enqueueRequest({description:"Start agent conversation",method:o.POST,url:"/agents/prompt/",payload:{prompt:s,active_project:e},blockers:["prompt"],blocks:["prompt"]}).then(n=>(this.dispatch(Kc(n)),n))}async continueConversation(s,e,n){return this.enqueueRequest({description:"Prompt agent",method:o.POST,url:"/agents/prompt/",payload:{prompt:s,active_project:n},blockers:["prompt"],blocks:["prompt"],queryParams:{conversation_id:e}}).then(c=>{this.dispatch(Zc(c))})}async fetchDetails(s){return this.enqueueRequest({description:"Get agent conversation",method:o.GET,url:`/agents/conversations/${s}/`,blockers:["conversation"],blocks:["conversation"]}).then(e=>{this.dispatch(Yc(e))})}async rate(s,e){return this.enqueueRequest({description:"Rate agent response",method:o.PUT,url:`/agents/responses/${s}/rate/`,payload:{rating:e},blockers:["rate"],blocks:["rate"]})}async list(s,e){return this.performRequest({method:o.GET,url:"/agents/conversations/",...s},e)}async refreshStore(s,e){const n=await this.list({queryParams:{project:s}},e);return this.dispatch(Wc(n)),n}}function dt(t,s){const e=[];let n=0;const c=t.length;for(;n<c;)e.push(t.slice(n,n+=s));return e}function A(t,s,e){const n=`${s}${e?"s":""}`;switch(t){case o.GET:return`Get ${n}`;case o.POST:return`Create ${n}`;case o.PATCH:return`Update ${n}`;case o.PUT:return`Update ${n}`;case o.DELETE:return`Delete ${n}`}}function R(t){const s={...t};for(const e of[...Fc,"created_by"])e in s&&delete s[e];return s}class v extends yt{async get(s,e){return this.performRequest({url:`${this.url}/${s}/`,method:o.GET},e)}async list(s,e){return this.performRequest({url:`${this.url}/`,method:o.GET,...s},e)}async listPaginated(s,e){return this.performPagination({url:`${this.url}/`,method:o.GET,...s},e)}}class j extends v{async getPresignedUrl(s,e){const{selectById:n}=this.selectors,c=this.select(n(s));if(!c)throw new Error(`Could not find ${this.name}: ${s} in store.`);if(c.object_url)return c.object_url;const r=await this.client.files.getPresignedUrlFromCache(c.file_sha1);if(r)return r;const a=await this.performRequest({url:`${this.url}/${s}/presigned-url/`,method:o.GET},e);return await this.client.files.cachePresignedUrl(c.file_sha1,a),a}async add(s){const{addOne:e,updateOne:n,deleteOne:c}=this.actions;let r,a=null,u=null;if("file"in s){const{file:_,...b}=s;a=await this.client.files.getFilePayload(_),u=URL.createObjectURL(_),r={...b,file_sha1:a.sha1,file_type:a.file_type,file_name:_.name,file_extension:a.extension,object_url:u}}else r=s;const d=this.buildModel(r),p=this.buildPayload(d);this.dispatch(e(d));const m=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:{...p,...a?{file:a}:{}},blockers:this.getBlockers(d),blocks:this.getBlocks(d)});m.then(({instance:_})=>{this.dispatch(n(_))}).catch(_=>{throw this.dispatch(c(this.getId(d))),_}).finally(()=>{u&&URL.revokeObjectURL(u)});const f=m.then(({instance:_})=>_),I=m.then(async({instance:_,presigned_url:b})=>{try{return b&&await this.client.files.processPresignedUrl(_.file_sha1,b),_.file_sha1}catch(M){throw console.error("Upload to s3 using presigned url failed.",M),M}});return[d,f,I]}async bulkAdd(s,e){const{addMany:n,updateMany:c,deleteMany:r}=this.actions,a=new Date().toISOString(),u=[],d=new Set,p=dt(s,Math.min(e??s.length,N)),m=[];for(const b of p){const M=[],g={},E=[],B=[];for(const z of b){let D;if("file"in z){const{file:Sc,...ER}=z,wt=await this.client.files.getFilePayload(Sc);wt.sha1 in g||(g[wt.sha1]=wt);const Ib=URL.createObjectURL(Sc);d.add(Ib),D={...ER,file_sha1:wt.sha1,file_type:wt.file_type,file_name:Sc.name,file_extension:wt.extension,object_url:Ib}}else D=z;const At=this.buildModel(D);u.push(At);const q=this.buildBulkPayload(At);M.push(q);const G=this.getBlockers(At);E.push(...G);const ls=this.getBlocks(At);B.push(...ls)}const C={payloads:M,submittedAt:a,files:Object.values(g),blockers:E,blocks:B};m.push(C)}this.dispatch(n(u));const f=m.map(b=>{const{submittedAt:M,files:g,payloads:E,blocks:B,blockers:C}=b;return this.enqueueRequest({description:A(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:{submitted_at:M,files:g,payloads:E},blockers:C,blocks:B})});Promise.all(f).then(b=>{const M=b.flatMap(g=>g.instances);this.dispatch(c(M))}).catch(b=>{throw this.dispatch(r(u.map(M=>this.getId(M)))),console.error(b),b}).finally(()=>{for(const b of d)URL.revokeObjectURL(b)});const I=Promise.all(f).then(b=>b.flatMap(({instances:M})=>M)),_=Promise.all(f).then(async b=>{const M=[];for(const{presigned_urls:g}of b){const E=this.client.files.processPresignedUrls(g);for(const[B,C]of Object.entries(E))try{await C,M.push(B)}catch(z){throw console.error("Upload to s3 using presigned url failed.",z),z}}return M});return[u,I,_]}async delete(s){const{addOne:e,deleteOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(s));if(!r)throw new Error(`Attempting to delete ${this.name} with pk ${s} that does not exist in the store`);this.dispatch(n(this.getId(r)));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${s}/`,blockers:[s],blocks:[]})}catch(a){throw this.dispatch(e(r)),a}}}class rM extends j{constructor(){super(...arguments);h(this,"name","Asset attachment");h(this,"url","/asset-attachments");h(this,"actions",{addOne:xc,addMany:Ts,setOne:ea,setMany:ta,updateOne:sa,updateMany:ia,deleteOne:na,deleteMany:Os,initialize:Qc});h(this,"selectors",{selectById:aa,selectByIds:ra})}getId(e){return e.uuid}getBlockers(e){const{asset:n}=e;return[n]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(r=>{var a;return((a=r.userReducer.currentUser)==null?void 0:a.id)??null}),c=new Date().toISOString();return O({...e,created_by:n,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,asset:e.asset}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,asset:e.asset}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{asset__project:e}},n)).flat();return this.dispatch(c(a)),a}}class dM extends v{constructor(){super(...arguments);h(this,"name","Asset Comment");h(this,"url","/asset-comments");h(this,"actions",{addOne:ha,addMany:Ut,setOne:ma,setMany:pa,updateOne:ya,updateMany:fa,deleteOne:Sa,deleteMany:Lt,initialize:oa});h(this,"selectors",{selectById:Ia,selectByIds:Ta})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=O({...e,created_by:this.select(d=>{var p;return((p=d.userReducer.currentUser)==null?void 0:p.id)??null}),submitted_at:new Date().toISOString()});this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(a),blockers:[a.asset],blocks:[a.uuid]});return u.then(d=>{this.dispatch(c(d))}).catch(()=>{this.dispatch(r(a.uuid))}),[a,u]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Asset comment with uuid ${e.uuid} not found in store`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Asset comment with uuid ${e} not found in store`);this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{asset__project:e}},n)).flat();return this.dispatch(c(a)),a}}class uM extends v{constructor(){super(...arguments);h(this,"url","/assets");h(this,"name","Asset");h(this,"actions",{addOne:ga,addMany:_s,setOne:va,setMany:Ea,updateOne:Ma,updateMany:Ra,deleteOne:wa,deleteMany:gs,initialize:_a});h(this,"selectors",{selectById:za,selectByIds:Da})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=O({...e,created_by:a,submitted_at:u});this.dispatch(n(d));const p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[d.asset_type],blocks:[d.uuid]});return p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,p]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`No asset with uuid ${e.uuid} found in the store`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{addOne:n,deleteOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`No asset with uuid ${e} found in the store`);const u=this.select(da(e)),d=this.select(Oa(e)),p=this.select(Oh(e)),m=this.select(GA(e)),f=this.select(Ho(e));this.dispatch(c(e)),this.dispatch(Os(w(u))),this.dispatch(Lt(w(d))),this.dispatch(Pt(w(p))),this.dispatch(_t(w(m))),this.dispatch(ot(w(f)));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(I){throw this.dispatch(n(a)),this.dispatch(Ts(u)),this.dispatch(Ut(d)),this.dispatch(Ot(p)),this.dispatch(bt(m)),this.dispatch(lt(f)),I}}bulkAdd(e,n){const{addMany:c}=this.actions,r=new Date().toISOString(),a=dt(e,Math.min(n??e.length,N)).map(p=>{const m=p.map(f=>O(f));return{batchId:ut.v4(),payload:{submitted_at:r,assets:m}}}),u=[];let d=null;for(const p of a){const{batchId:m,payload:f}=p,I=f.assets.map(({uuid:E})=>E),_=f.assets.map(({asset_type:E})=>E),b=f.assets.map(({project:E})=>E),M=f.assets.map(({status:E})=>E),g=this.enqueueRequest({description:A(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:f,blockers:(d?[d]:[]).concat(_).concat(b).concat(M),blocks:[m].concat(I)});d=p.batchId,u.push(g)}return Promise.all(u).then(p=>{const m=p.flat();this.dispatch(c(m))}),u}bulkUpdate(e,n){const{updateMany:c}=this.actions,{selectByIds:r}=this.selectors,a=w(e).toSorted($t);if(a.length!==e.length)throw new Error("payloads contains duplicate uuids.");const u=this.select(r(a)).toSorted(fs);if(a.length!=u.length)throw new Error(`Attempting to bulk update ${a.length-u.length} assets that dont exist in the store`);const d=[];for(let I=0;I<a.length;I++)d.push({...u[I],...e[I]});this.dispatch(c(d));const p=dt(e,Math.min(n??e.length,N)),m=[];let f=null;for(const I of p){const _=ut.v4(),b=w(I),M=I.map(({status:E})=>E).filter(Boolean),g=this.enqueueRequest({description:A(o.PATCH,this.name,!0),method:o.PATCH,url:`${this.url}/bulk/`,payload:{payloads:I},blockers:(f?[f]:[]).concat(b).concat(M),blocks:[_].concat(b)});m.push(g),f=_}return Promise.all(m).then(I=>{this.dispatch(c(I.flat()))}).catch(()=>{this.dispatch(c(u))}),[d,m]}async bulkDelete(e){const{addMany:n,deleteMany:c}=this.actions,{selectByIds:r}=this.selectors,a=this.select(r(e)),u=this.select(Pa(e)),d=this.select(Ph(e)),p=this.select(HA(e)),m=this.select(Wo(e));this.dispatch(c(e)),this.dispatch(Lt(w(u))),this.dispatch(Pt(w(d))),this.dispatch(_t(w(p))),this.dispatch(ot(w(m)));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(f){throw this.dispatch(n(a)),this.dispatch(Ut(u)),this.dispatch(Ot(d)),this.dispatch(bt(p)),this.dispatch(lt(m)),f}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(c(a)),a}}class lM extends j{constructor(){super(...arguments);h(this,"name","Asset Type Attachment");h(this,"url","/asset-type-attachments");h(this,"actions",{addOne:$a,addMany:Rs,setOne:Ua,setMany:La,updateOne:ka,updateMany:Na,deleteOne:Ga,deleteMany:ws,initialize:Ca});h(this,"selectors",{selectById:Wa,selectByIds:Ka})}getId(e){return e.uuid}getBlockers(e){return[e.asset_type]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(r=>{var a;return((a=r.userReducer.currentUser)==null?void 0:a.id)??null}),c=new Date().toISOString();return O({...e,created_by:n,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,asset_type:e.asset_type}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,asset_type:e.asset_type}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(c(r)),r}}class oM extends j{constructor(){super(...arguments);h(this,"name","Asset Type Fields Attachment");h(this,"url","/asset-type-fields-attachments");h(this,"actions",{addOne:Qa,addMany:xa,setOne:er,setMany:tr,updateOne:sr,updateMany:ir,deleteOne:nr,deleteMany:cr,initialize:Xa});h(this,"selectors",{selectById:rr,selectByIds:dr})}getId(e){return e.uuid}getBlockers(e){return[e.fields_revision]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(r=>{var a;return((a=r.userReducer.currentUser)==null?void 0:a.id)??null}),c=new Date().toISOString();return O({...e,created_by:n,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:c,fields_revision:r,file_sha1:a,file_name:u,file_extension:d}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:c,fields_revision:r,file_sha1:a,file_name:u,file_extension:d}}buildBulkPayload(e){const{uuid:n,field_identifier:c,fields_revision:r,file_sha1:a,file_name:u,file_extension:d}=e;return{uuid:n,field_identifier:c,fields_revision:r,file_sha1:a,file_name:u,file_extension:d}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{fields_revision__asset_type__organization:e}},n);return this.dispatch(c(r)),r}}class hM extends v{constructor(){super(...arguments);h(this,"name","Asset Type Fields");h(this,"url","/asset-type-fields");h(this,"actions",{addOne:hr,addMany:mr,setOne:pr,setMany:yr,updateOne:fr,updateMany:Sr,deleteOne:Ar,deleteMany:Ir,initialize:or});h(this,"selectors",{selectById:Or,selectByIds:Pr})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=O({...e,created_by:a,submitted_at:u});this.dispatch(n(d));const p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[d.asset_type],blocks:[d.uuid]});return p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,p]}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(c(r)),r}}class mM extends j{constructor(){super(...arguments);h(this,"name","Asset Type Field Values Attachment");h(this,"url","/asset-type-field-values-attachments");h(this,"actions",{addOne:gr,addMany:Ds,setOne:Mr,setMany:Rr,updateOne:wr,updateMany:vr,deleteOne:Er,deleteMany:js,initialize:_r});h(this,"selectors",{selectById:Vr,selectByIds:zr})}getId(e){return e.uuid}getBlockers(e){return[e.field_values]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(r=>{var a;return((a=r.userReducer.currentUser)==null?void 0:a.id)??null}),c=new Date().toISOString();return O({...e,created_by:n,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:c,field_values:r,file_sha1:a,file_name:u,file_extension:d}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:c,field_values:r,file_sha1:a,file_name:u,file_extension:d}}buildBulkPayload(e){const{uuid:n,field_identifier:c,field_values:r,file_sha1:a,file_name:u,file_extension:d}=e;return{uuid:n,field_identifier:c,field_values:r,file_sha1:a,file_name:u,file_extension:d}}async bulkDelete(e){const{deleteMany:n,addMany:c}=this.actions,{selectByIds:r}=this.selectors,a=this.select(r(e));this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{field_values__asset__project:e,latest:!0}},n)).flat();return this.dispatch(c(a)),a}}class pM extends v{constructor(){super(...arguments);h(this,"name","Asset Type Field Values");h(this,"url","/asset-type-field-values");h(this,"actions",{addOne:$r,addMany:Ur,setOne:Lr,setMany:kr,updateOne:Nr,updateMany:Gr,deleteOne:Hr,deleteMany:Wr,initialize:Cr});h(this,"selectors",{selectById:Yr,selectByIds:Zr})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=O({...e,created_by:a,submitted_at:u}),p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[e.asset,e.fields_revision],blocks:[d.uuid]});return this.dispatch(n(d)),p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,p]}bulkAdd(e,n){const{payloads:c,values:r}=e,{addMany:a,setMany:u,deleteMany:d}=this.actions,p=new Date().toISOString(),m=[],f=dt(c,Math.min(n??c.length,N)),I=[];for(const b of f){const M=[];for(const g of b){const E=O({...g,values:g.values,created_by:this.select(B=>{var C;return((C=B.userReducer.currentUser)==null?void 0:C.id)??null}),submitted_at:p});m.push(E),M.push({uuid:E.uuid,asset:g.asset,fields_revision:g.fields_revision,published_at:g.published_at,values:E.values})}I.push({submitted_at:p,values:r,field_values:M})}this.dispatch(a(m));const _=[];for(const b of I){const{field_values:M}=b,g=M.map(({asset:z})=>z),E=M.map(({fields_revision:z})=>z),B=M.map(({uuid:z})=>z),C=this.enqueueRequest({description:A(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:b,blockers:g.concat(E),blocks:B});_.push(C)}return Promise.all(_).then(b=>{this.dispatch(u(b.flat()))}).catch(()=>{this.dispatch(d(w(m)))}),[m,_]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Expected AssetTypeFieldValues with uuid ${e.uuid} to exist`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[a.uuid,a.fields_revision,a.asset],blocks:[a.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Expected submission with uuid ${e} to exist`);const u=this.select(Dr(e));this.dispatch(n(e)),this.dispatch(js(w(u)));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(a)),this.dispatch(Ds(u)),d}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{asset__project:e,latest:!0}},n)).flat();return this.dispatch(c(a)),a}}class yM extends v{constructor(){super(...arguments);h(this,"name","Asset Type Identifier");h(this,"url","/asset-type-identifiers");h(this,"actions",{addOne:xr,addMany:ed,setOne:td,setMany:sd,updateOne:id,updateMany:nd,deleteOne:cd,deleteMany:ad,initialize:Qr});h(this,"selectors",{selectById:dd,selectByIds:ud})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=O({...e,created_by:a,submitted_at:u});this.dispatch(n(d));const p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[d.asset_type],blocks:[d.uuid]});return p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,p]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Expected asset type identifier with uuid ${e.uuid} to exist`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Expected asset type identifier with uuid ${e} to exist`);this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(c(r)),r}}class fM extends v{constructor(){super(...arguments);h(this,"name","Asset Type Identifier Value");h(this,"url","/asset-type-identifier-values");h(this,"actions",{addOne:md,addMany:pd,setOne:yd,setMany:fd,updateOne:Sd,updateMany:Ad,deleteOne:Id,deleteMany:Td,initialize:hd});h(this,"selectors",{selectById:Pd,selectByIds:Fd})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=O({...e,created_by:a,submitted_at:u});this.dispatch(n(d));const p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[e.asset,e.asset_type_identifier],blocks:[d.uuid]});return p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,p]}bulkAdd(e,n){const{addMany:c,updateMany:r,deleteMany:a}=this.actions,u=new Date().toISOString(),d=this.select(b=>{var M;return((M=b.userReducer.currentUser)==null?void 0:M.id)??null}),p=dt(e,Math.min(n??e.length,N)),m=[],f=[];for(const b of p){const M=[],g=[],E=[];for(const C of b){const z=O({...C,submitted_at:u,created_by:d});f.push(z);const D={uuid:z.uuid,asset:z.asset,asset_type_identifier:z.asset_type_identifier,value:z.value};M.push(D),g.push(z.asset),g.push(z.asset_type_identifier),E.push(z.uuid)}const B={payloads:M,submitted_at:u,blockers:g,blocks:E};m.push(B)}this.dispatch(c(f));const I=m.map(b=>{const{payloads:M,submitted_at:g,blockers:E,blocks:B}=b;return this.enqueueRequest({description:A(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:{submitted_at:g,payloads:M},blockers:E,blocks:B})});Promise.all(I).then(b=>{this.dispatch(r(b.flat()))}).catch(b=>{throw this.dispatch(a(w(f))),b});const _=Promise.all(I).then(b=>b.flat());return[f,_]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Expected asset type identifier value with uuid ${e} to exist`);this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{asset__project:e,latest:!0}},n)).flat();return this.dispatch(c(a)),a}}class SM extends v{constructor(){super(...arguments);h(this,"name","Asset Type");h(this,"url","/asset-types");h(this,"actions",{addOne:wd,addMany:vd,setOne:Md,setMany:Rd,updateOne:Ed,updateMany:Bd,deleteOne:Vd,deleteMany:zd,initialize:gd});h(this,"selectors",{selectById:jd,selectByIds:qd})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=O({...e,created_by:a,submitted_at:u});this.dispatch(n(d));const p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[],blocks:[d.uuid]});return p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,p]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Expected asset type with uuid ${e.uuid} to exist`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[r.uuid],blocks:[r.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Expected asset type with uuid ${e} to exist`);const u=this.select(Va(e)),d=this.select(Ya(e));this.dispatch(n(e)),this.dispatch(gs(w(u))),this.dispatch(ws(w(d)));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(p){throw this.dispatch(c(a)),this.dispatch(_s(u)),this.dispatch(Rs(d)),p}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{organization:e}},n);return this.dispatch(c(r)),r}}class AM extends v{constructor(){super(...arguments);h(this,"name","Asset Type Status");h(this,"url","/asset-type-statuses");h(this,"actions",{addOne:Ld,addMany:kd,setOne:Nd,setMany:Gd,updateOne:Hd,updateMany:Wd,deleteOne:Kd,deleteMany:Yd,initialize:Ud});h(this,"selectors",{selectById:Jd,selectByIds:Xd})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=O({...e,created_by:a,submitted_at:u});this.dispatch(n(d));const p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[e.asset_type],blocks:[d.uuid]});return p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,p]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Expected an existing asset type status with uuid ${e.uuid}`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`No asset type status with uuid ${e} found in the store`);this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(c(r)),r}}class IM extends j{constructor(){super(...arguments);h(this,"name","Document Attachment");h(this,"url","/document-attachments");h(this,"actions",{addOne:nu,addMany:cu,setOne:au,setMany:ru,updateOne:du,updateMany:uu,deleteOne:lu,deleteMany:ou,initialize:iu});h(this,"selectors",{selectById:mu,selectByIds:pu})}getId(e){return e.uuid}getBlockers(e){return[e.document]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(r=>{var a;return((a=r.userReducer.currentUser)==null?void 0:a.id)??null}),c=new Date().toISOString();return O({...e,created_by:n,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,document:e.document}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,document:e.document}}async bulkAdd(e,n){const[c,r,a]=await super.bulkAdd(e,n),u={};for(const{file_sha1:d,uuid:p}of c)d in u||(u[d]=[]),u[d].push(p);return a.then(d=>{const p=d.flatMap(m=>u[m]??[]);for(const m of p)this.makeReadable(m)}),[c,r,a]}makeReadable(e){this.enqueueRequest({description:"Add attachment to AI assistant",method:o.PATCH,url:`${this.url}/${e}/`,payload:{readable_to_assistant:!0},blockers:["index-document-attachment",e],blocks:["index-document-attachment"]})}async refreshStore(e,n){const{initialize:c}=this.actions,r=this.list({queryParams:{document__project__organization:e}},n),a=this.list({queryParams:{document__organization:e}},n),d=(await Promise.all([r,a])).flat();return this.dispatch(c(d)),d}}class TM extends v{constructor(){super(...arguments);h(this,"name","Document");h(this,"url","/documents");h(this,"actions",{addOne:Au,addMany:Iu,setOne:Tu,setMany:Ou,updateOne:Pu,updateMany:Fu,deleteOne:bu,deleteMany:_u,initialize:Su});h(this,"selectors",{selectById:Mu,selectByIds:Ru})}add(e){const{addOne:n,deleteOne:c,updateOne:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=O({...e,created_by:a,submitted_at:u});this.dispatch(n(d));const p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:d.parent_document?[d.parent_document]:[],blocks:[d.uuid]});return p.then(m=>{this.dispatch(r(m))}).catch(()=>{this.dispatch(c(d.uuid))}),[d,p]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`attempting to update a document with uuid ${e.uuid} that does not exist in store.documents`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c,addMany:r,deleteMany:a}=this.actions,{selectById:u}=this.selectors,d=this.select(u(e));if(!d)throw new Error(`attempting to delete a document with uuid ${e} that does not exist in store.documents`);const p=this.select(wu(e));this.dispatch(n(e)),this.dispatch(a(w(p)));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(m){throw this.dispatch(c(d)),this.dispatch(r(p)),m}}async refreshStore(e,n){const{initialize:c}=this.actions,r=this.list({queryParams:{project__organization:e}},n),a=this.list({queryParams:{organization:e}},n),d=(await Promise.all([r,a])).flat();return this.dispatch(c(d)),d}}class ft extends yt{async get(s,e){return this.performRequest({url:`${this.url}/${s}/`,method:o.GET},e)}async list(s,e){return this.performRequest({url:`${this.url}/`,method:o.GET,...s},e)}async listPaginated(s,e){return this.performPagination({url:`${this.url}/`,method:o.GET,...s},e)}}class OM extends ft{constructor(){super(...arguments);h(this,"name","Email Domains");h(this,"url","/organization-email-domains");h(this,"actions",{addOne:Bu,addMany:Vu,setOne:zu,setMany:Du,updateOne:ju,updateMany:qu,deleteOne:Cu,deleteMany:$u,initialize:Eu});h(this,"selectors",{selectById:Lu,selectByIds:ku})}async add(e,n){return this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:{email:n,organization:e},blockers:[e,"create-org"],blocks:[]})}async delete(e){const{deleteOne:n,addOne:c}=this.actions;this.dispatch(n(e.uuid));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e.uuid}/`,blockers:[e.domain],blocks:[]})}catch(r){throw this.dispatch(c(e)),r}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{organization:e}},n);return this.dispatch(c(r)),r}}class PM extends yt{async getVerificationCode(s){return this.enqueueRequest({description:"Get verification code",method:o.GET,url:`/verification/email-verification/${s}/`,isAuthNeeded:!1,blockers:[],blocks:[]})}validateVerificationCode(s,e=void 0){return this.enqueueRequest({description:"Validate verification code",method:o.POST,url:`/verification/email-verification/${s}/`,isAuthNeeded:!1,payload:e,blockers:[],blocks:[]})}}const qt={},hc=new Set,mc=new Set;class FM extends yt{constructor(){super(...arguments);h(this,"host");h(this,"dbPromise",bb.openDB("fileCache",2,{upgrade(e,n){n<1&&e.createObjectStore("files"),n<2&&e.createObjectStore("presignedUrls")}}))}async getDB(){return await this.dbPromise}async cacheFile(e){if(!e.name)throw new Error(`Cant add a file without a name to cache: ${e.name}`);if(!e.type)throw new Error(`Cant add a file without a type to cache: ${e.name}`);if(!e.size)throw new Error(`Cant add an empty file to cache: ${e.name}`);const n=await Ct(e);if(hc.has(n))return;const c=await this.getDB();!!await c.get("files",n)?console.warn(`Attempting to add a file already cached, ${e.name}`):await c.put("files",e,n),hc.add(n)}async uncacheFile(e){await(await this.getDB()).delete("files",e),hc.delete(e)}async getFileFromCache(e){return(await this.getDB()).get("files",e)}async fetchFileFromUrl(e,n,c=n,r){const a=e.split("?")[0]??e,u=await this.getFileFromCache(n);if(u)return u;let d;a in qt?d=qt[a]:zc(e)?(d=Vc(e,c),qt[a]=d):(d=new Promise(f=>{this.performRequest({method:o.GET,url:e,isExternalUrl:!0,isResponseBlob:!0,isAuthNeeded:!1},r).then(I=>{const _=new File([I],c,{type:I.type});f(_)})}),qt[a]=d);let p;try{p=await d}catch(f){throw f instanceof U&&delete qt[a],f}const m=await Ct(p);if(m!==n){const f=`The hash of the file returned from the server (${m}) does not match the
7
+ `)}catch(c){console.error("Failed to extract error message from response body",c)}}else typeof t.body=="string"&&(e=t.body);else t!=null&&t.text?e=t.text:s instanceof Error&&(e=s.message);return!e||e.length>iM?gt:e}class U extends Error{constructor(e){super(gt);h(this,"status");h(this,"response");h(this,"message");h(this,"options");const{response:n,innerError:c}=e;this.message=e.message??nM(n,c)??gt,this.status=(n==null?void 0:n.status)??0,this.response=n,e.discard=e.discard??!1,this.options=e}}function rb(t){function s(e){return typeof e=="object"&&e!==null&&["ok","redirect","clientError","serverError","error"].every(c=>c in e)}if(s(t))return t;if(typeof t=="object"&&t!==null){const e=t;if(s(e.response))return e.response;if(e.response&&s(e.response.response))return e.response.response}}class cM extends tb{constructor(s){super(s)}}class yt extends tb{constructor(e,n){super(e);h(this,"auth");this.auth=n}}class aM extends yt{async startConversation(s,e){return this.enqueueRequest({description:"Start agent conversation",method:o.POST,url:"/agents/prompt/",payload:{prompt:s,active_project:e},blockers:["prompt"],blocks:["prompt"]}).then(n=>(this.dispatch(Kc(n)),n))}async continueConversation(s,e,n){return this.enqueueRequest({description:"Prompt agent",method:o.POST,url:"/agents/prompt/",payload:{prompt:s,active_project:n},blockers:["prompt"],blocks:["prompt"],queryParams:{conversation_id:e}}).then(c=>{this.dispatch(Zc(c))})}async fetchDetails(s){return this.enqueueRequest({description:"Get agent conversation",method:o.GET,url:`/agents/conversations/${s}/`,blockers:["conversation"],blocks:["conversation"]}).then(e=>{this.dispatch(Yc(e))})}async rate(s,e){return this.enqueueRequest({description:"Rate agent response",method:o.PUT,url:`/agents/responses/${s}/rate/`,payload:{rating:e},blockers:["rate"],blocks:["rate"]})}async list(s,e){return this.performRequest({method:o.GET,url:"/agents/conversations/",...s},e)}async refreshStore(s,e){const n=await this.list({queryParams:{project:s}},e);return this.dispatch(Wc(n)),n}}function dt(t,s){const e=[];let n=0;const c=t.length;for(;n<c;)e.push(t.slice(n,n+=s));return e}function A(t,s,e){const n=`${s}${e?"s":""}`;switch(t){case o.GET:return`Get ${n}`;case o.POST:return`Create ${n}`;case o.PATCH:return`Update ${n}`;case o.PUT:return`Update ${n}`;case o.DELETE:return`Delete ${n}`}}function R(t){const s={...t};for(const e of[...Fc,"created_by"])e in s&&delete s[e];return s}class v extends yt{async get(s,e){return this.performRequest({url:`${this.url}/${s}/`,method:o.GET},e)}async list(s,e){return this.performRequest({url:`${this.url}/`,method:o.GET,...s},e)}async listPaginated(s,e){return this.performPagination({url:`${this.url}/`,method:o.GET,...s},e)}}class j extends v{async getPresignedUrl(s,e){const{selectById:n}=this.selectors,c=this.select(n(s));if(!c)throw new Error(`Could not find ${this.name}: ${s} in store.`);if(c.object_url)return c.object_url;const r=await this.client.files.getPresignedUrlFromCache(c.file_sha1);if(r)return r;const a=await this.performRequest({url:`${this.url}/${s}/presigned-url/`,method:o.GET},e);return await this.client.files.cachePresignedUrl(c.file_sha1,a),a}async add(s){const{addOne:e,updateOne:n,deleteOne:c}=this.actions;let r,a=null,u=null;if("file"in s){const{file:_,...b}=s;a=await this.client.files.getFilePayload(_),u=URL.createObjectURL(_),r={...b,file_sha1:a.sha1,file_type:a.file_type,file_name:_.name,file_extension:a.extension,object_url:u}}else r=s;const d=this.buildModel(r),p=this.buildPayload(d);this.dispatch(e(d));const m=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:{...p,...a?{file:a}:{}},blockers:this.getBlockers(d),blocks:this.getBlocks(d)});m.then(({instance:_})=>{this.dispatch(n(_))}).catch(_=>{throw this.dispatch(c(this.getId(d))),_}).finally(()=>{u&&URL.revokeObjectURL(u)});const f=m.then(({instance:_})=>_),I=m.then(async({instance:_,presigned_url:b})=>{try{return b&&await this.client.files.processPresignedUrl(_.file_sha1,b),_.file_sha1}catch(M){throw console.error("Upload to s3 using presigned url failed.",M),M}});return[d,f,I]}async bulkAdd(s,e){const{addMany:n,updateMany:c,deleteMany:r}=this.actions,a=new Date().toISOString(),u=[],d=new Set,p=dt(s,Math.min(e??s.length,N)),m=[];for(const b of p){const M=[],g={},E=[],B=[];for(const z of b){let D;if("file"in z){const{file:Sc,...ER}=z,wt=await this.client.files.getFilePayload(Sc);wt.sha1 in g||(g[wt.sha1]=wt);const Ib=URL.createObjectURL(Sc);d.add(Ib),D={...ER,file_sha1:wt.sha1,file_type:wt.file_type,file_name:Sc.name,file_extension:wt.extension,object_url:Ib}}else D=z;const At=this.buildModel(D);u.push(At);const q=this.buildBulkPayload(At);M.push(q);const G=this.getBlockers(At);E.push(...G);const ls=this.getBlocks(At);B.push(...ls)}const C={payloads:M,submittedAt:a,files:Object.values(g),blockers:E,blocks:B};m.push(C)}this.dispatch(n(u));const f=m.map(b=>{const{submittedAt:M,files:g,payloads:E,blocks:B,blockers:C}=b;return this.enqueueRequest({description:A(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:{submitted_at:M,files:g,payloads:E},blockers:C,blocks:B})});Promise.all(f).then(b=>{const M=b.flatMap(g=>g.instances);this.dispatch(c(M))}).catch(b=>{throw this.dispatch(r(u.map(M=>this.getId(M)))),console.error(b),b}).finally(()=>{for(const b of d)URL.revokeObjectURL(b)});const I=Promise.all(f).then(b=>b.flatMap(({instances:M})=>M)),_=Promise.all(f).then(async b=>{const M=[];for(const{presigned_urls:g}of b){const E=this.client.files.processPresignedUrls(g);for(const[B,C]of Object.entries(E))try{await C,M.push(B)}catch(z){throw console.error("Upload to s3 using presigned url failed.",z),z}}return M});return[u,I,_]}async delete(s){const{addOne:e,deleteOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(s));if(!r)throw new Error(`Attempting to delete ${this.name} with pk ${s} that does not exist in the store`);this.dispatch(n(this.getId(r)));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${s}/`,blockers:[s],blocks:[]})}catch(a){throw this.dispatch(e(r)),a}}}class rM extends j{constructor(){super(...arguments);h(this,"name","Asset attachment");h(this,"url","/asset-attachments");h(this,"actions",{addOne:xc,addMany:Ts,setOne:ea,setMany:ta,updateOne:sa,updateMany:ia,deleteOne:na,deleteMany:Os,initialize:Qc});h(this,"selectors",{selectById:aa,selectByIds:ra})}getId(e){return e.uuid}getBlockers(e){const{asset:n}=e;return[n]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(r=>{var a;return((a=r.userReducer.currentUser)==null?void 0:a.id)??null}),c=new Date().toISOString();return O({...e,created_by:n,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,asset:e.asset}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,asset:e.asset}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{asset__project:e}},n)).flat();return this.dispatch(c(a)),a}}class dM extends v{constructor(){super(...arguments);h(this,"name","Asset Comment");h(this,"url","/asset-comments");h(this,"actions",{addOne:ha,addMany:Ut,setOne:ma,setMany:pa,updateOne:ya,updateMany:fa,deleteOne:Sa,deleteMany:Lt,initialize:oa});h(this,"selectors",{selectById:Ia,selectByIds:Ta})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=O({...e,created_by:this.select(d=>{var p;return((p=d.userReducer.currentUser)==null?void 0:p.id)??null}),submitted_at:new Date().toISOString()});this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(a),blockers:[a.asset],blocks:[a.uuid]});return u.then(d=>{this.dispatch(c(d))}).catch(()=>{this.dispatch(r(a.uuid))}),[a,u]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Asset comment with uuid ${e.uuid} not found in store`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Asset comment with uuid ${e} not found in store`);this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{asset__project:e}},n)).flat();return this.dispatch(c(a)),a}}class uM extends v{constructor(){super(...arguments);h(this,"url","/assets");h(this,"name","Asset");h(this,"actions",{addOne:ga,addMany:_s,setOne:va,setMany:Ea,updateOne:Ma,updateMany:Ra,deleteOne:wa,deleteMany:gs,initialize:_a});h(this,"selectors",{selectById:za,selectByIds:Da})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=O({...e,created_by:a,submitted_at:u});this.dispatch(n(d));const p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[d.asset_type],blocks:[d.uuid]});return p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,p]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`No asset with uuid ${e.uuid} found in the store`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{addOne:n,deleteOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`No asset with uuid ${e} found in the store`);const u=this.select(da(e)),d=this.select(Oa(e)),p=this.select(Oh(e)),m=this.select(GA(e)),f=this.select(Ho(e));this.dispatch(c(e)),this.dispatch(Os(w(u))),this.dispatch(Lt(w(d))),this.dispatch(Pt(w(p))),this.dispatch(_t(w(m))),this.dispatch(ot(w(f)));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(I){throw this.dispatch(n(a)),this.dispatch(Ts(u)),this.dispatch(Ut(d)),this.dispatch(Ot(p)),this.dispatch(bt(m)),this.dispatch(lt(f)),I}}bulkAdd(e,n){const{addMany:c}=this.actions,r=new Date().toISOString(),a=dt(e,Math.min(n??e.length,N)).map(p=>{const m=p.map(f=>O(f));return{batchId:ut.v4(),payload:{submitted_at:r,assets:m}}}),u=[];let d=null;for(const p of a){const{batchId:m,payload:f}=p,I=f.assets.map(({uuid:E})=>E),_=f.assets.map(({asset_type:E})=>E),b=f.assets.map(({project:E})=>E),M=f.assets.map(({status:E})=>E),g=this.enqueueRequest({description:A(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:f,blockers:(d?[d]:[]).concat(_).concat(b).concat(M),blocks:[m].concat(I)});d=p.batchId,u.push(g)}return Promise.all(u).then(p=>{const m=p.flat();this.dispatch(c(m))}),u}bulkUpdate(e,n){const{updateMany:c}=this.actions,{selectByIds:r}=this.selectors,a=w(e).toSorted($t);if(a.length!==e.length)throw new Error("payloads contains duplicate uuids.");const u=this.select(r(a)).toSorted(fs);if(a.length!=u.length)throw new Error(`Attempting to bulk update ${a.length-u.length} assets that dont exist in the store`);const d=[];for(let I=0;I<a.length;I++)d.push({...u[I],...e[I]});this.dispatch(c(d));const p=dt(e,Math.min(n??e.length,N)),m=[];let f=null;for(const I of p){const _=ut.v4(),b=w(I),M=I.map(({status:E})=>E).filter(Boolean),g=this.enqueueRequest({description:A(o.PATCH,this.name,!0),method:o.PATCH,url:`${this.url}/bulk/`,payload:{payloads:I},blockers:(f?[f]:[]).concat(b).concat(M),blocks:[_].concat(b)});m.push(g),f=_}return Promise.all(m).then(I=>{this.dispatch(c(I.flat()))}).catch(()=>{this.dispatch(c(u))}),[d,m]}async bulkDelete(e){const{addMany:n,deleteMany:c}=this.actions,{selectByIds:r}=this.selectors,a=this.select(r(e)),u=this.select(Pa(e)),d=this.select(Ph(e)),p=this.select(HA(e)),m=this.select(Wo(e));this.dispatch(c(e)),this.dispatch(Lt(w(u))),this.dispatch(Pt(w(d))),this.dispatch(_t(w(p))),this.dispatch(ot(w(m)));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(f){throw this.dispatch(n(a)),this.dispatch(Ut(u)),this.dispatch(Ot(d)),this.dispatch(bt(p)),this.dispatch(lt(m)),f}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(c(a)),a}}class lM extends j{constructor(){super(...arguments);h(this,"name","Asset Type Attachment");h(this,"url","/asset-type-attachments");h(this,"actions",{addOne:$a,addMany:Rs,setOne:Ua,setMany:La,updateOne:ka,updateMany:Na,deleteOne:Ga,deleteMany:ws,initialize:Ca});h(this,"selectors",{selectById:Wa,selectByIds:Ka})}getId(e){return e.uuid}getBlockers(e){return[e.asset_type]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(r=>{var a;return((a=r.userReducer.currentUser)==null?void 0:a.id)??null}),c=new Date().toISOString();return O({...e,created_by:n,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,asset_type:e.asset_type}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,asset_type:e.asset_type}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(c(r)),r}}class oM extends j{constructor(){super(...arguments);h(this,"name","Asset Type Fields Attachment");h(this,"url","/asset-type-fields-attachments");h(this,"actions",{addOne:Qa,addMany:xa,setOne:er,setMany:tr,updateOne:sr,updateMany:ir,deleteOne:nr,deleteMany:cr,initialize:Xa});h(this,"selectors",{selectById:rr,selectByIds:dr})}getId(e){return e.uuid}getBlockers(e){return[e.fields_revision]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(r=>{var a;return((a=r.userReducer.currentUser)==null?void 0:a.id)??null}),c=new Date().toISOString();return O({...e,created_by:n,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:c,fields_revision:r,file_sha1:a,file_name:u,file_extension:d}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:c,fields_revision:r,file_sha1:a,file_name:u,file_extension:d}}buildBulkPayload(e){const{uuid:n,field_identifier:c,fields_revision:r,file_sha1:a,file_name:u,file_extension:d}=e;return{uuid:n,field_identifier:c,fields_revision:r,file_sha1:a,file_name:u,file_extension:d}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{fields_revision__asset_type__organization:e}},n);return this.dispatch(c(r)),r}}class hM extends v{constructor(){super(...arguments);h(this,"name","Asset Type Fields");h(this,"url","/asset-type-fields");h(this,"actions",{addOne:hr,addMany:mr,setOne:pr,setMany:yr,updateOne:fr,updateMany:Sr,deleteOne:Ar,deleteMany:Ir,initialize:or});h(this,"selectors",{selectById:Or,selectByIds:Pr})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=O({...e,created_by:a,submitted_at:u});this.dispatch(n(d));const p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[d.asset_type],blocks:[d.uuid]});return p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,p]}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(c(r)),r}}class mM extends j{constructor(){super(...arguments);h(this,"name","Asset Type Field Values Attachment");h(this,"url","/asset-type-field-values-attachments");h(this,"actions",{addOne:gr,addMany:Ds,setOne:Mr,setMany:Rr,updateOne:wr,updateMany:vr,deleteOne:Er,deleteMany:js,initialize:_r});h(this,"selectors",{selectById:Vr,selectByIds:zr})}getId(e){return e.uuid}getBlockers(e){return[e.field_values]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(r=>{var a;return((a=r.userReducer.currentUser)==null?void 0:a.id)??null}),c=new Date().toISOString();return O({...e,created_by:n,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:c,field_values:r,file_sha1:a,file_name:u,file_extension:d}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:c,field_values:r,file_sha1:a,file_name:u,file_extension:d}}buildBulkPayload(e){const{uuid:n,field_identifier:c,field_values:r,file_sha1:a,file_name:u,file_extension:d}=e;return{uuid:n,field_identifier:c,field_values:r,file_sha1:a,file_name:u,file_extension:d}}async bulkDelete(e){const{deleteMany:n,addMany:c}=this.actions,{selectByIds:r}=this.selectors,a=this.select(r(e));this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{field_values__asset__project:e,latest:!0}},n)).flat();return this.dispatch(c(a)),a}}class pM extends v{constructor(){super(...arguments);h(this,"name","Asset Type Field Values");h(this,"url","/asset-type-field-values");h(this,"actions",{addOne:$r,addMany:Ur,setOne:Lr,setMany:kr,updateOne:Nr,updateMany:Gr,deleteOne:Hr,deleteMany:Wr,initialize:Cr});h(this,"selectors",{selectById:Yr,selectByIds:Zr})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=O({...e,created_by:a,submitted_at:u}),p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[e.asset,e.fields_revision],blocks:[d.uuid]});return this.dispatch(n(d)),p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,p]}bulkAdd(e,n){const{payloads:c,values:r}=e,{addMany:a,updateMany:u,deleteMany:d}=this.actions,p=new Date().toISOString(),m=[],f=dt(c,Math.min(n??c.length,N)),I=[];for(const b of f){const M=[];for(const g of b){const E=O({...g,values:g.values,created_by:this.select(B=>{var C;return((C=B.userReducer.currentUser)==null?void 0:C.id)??null}),submitted_at:p});m.push(E),M.push({uuid:E.uuid,asset:g.asset,fields_revision:g.fields_revision,published_at:g.published_at,values:E.values})}I.push({submitted_at:p,values:r,field_values:M})}this.dispatch(a(m));const _=[];for(const b of I){const{field_values:M}=b,g=M.map(({asset:z})=>z),E=M.map(({fields_revision:z})=>z),B=M.map(({uuid:z})=>z),C=this.enqueueRequest({description:A(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:b,blockers:g.concat(E),blocks:B});_.push(C)}return Promise.all(_).then(b=>{this.dispatch(u(b.flat()))}).catch(()=>{this.dispatch(d(w(m)))}),[m,_]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Expected AssetTypeFieldValues with uuid ${e.uuid} to exist`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[a.uuid,a.fields_revision,a.asset],blocks:[a.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Expected submission with uuid ${e} to exist`);const u=this.select(Dr(e));this.dispatch(n(e)),this.dispatch(js(w(u)));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(a)),this.dispatch(Ds(u)),d}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{asset__project:e,latest:!0}},n)).flat();return this.dispatch(c(a)),a}}class yM extends v{constructor(){super(...arguments);h(this,"name","Asset Type Identifier");h(this,"url","/asset-type-identifiers");h(this,"actions",{addOne:xr,addMany:ed,setOne:td,setMany:sd,updateOne:id,updateMany:nd,deleteOne:cd,deleteMany:ad,initialize:Qr});h(this,"selectors",{selectById:dd,selectByIds:ud})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=O({...e,created_by:a,submitted_at:u});this.dispatch(n(d));const p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[d.asset_type],blocks:[d.uuid]});return p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,p]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Expected asset type identifier with uuid ${e.uuid} to exist`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Expected asset type identifier with uuid ${e} to exist`);this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(c(r)),r}}class fM extends v{constructor(){super(...arguments);h(this,"name","Asset Type Identifier Value");h(this,"url","/asset-type-identifier-values");h(this,"actions",{addOne:md,addMany:pd,setOne:yd,setMany:fd,updateOne:Sd,updateMany:Ad,deleteOne:Id,deleteMany:Td,initialize:hd});h(this,"selectors",{selectById:Pd,selectByIds:Fd})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=O({...e,created_by:a,submitted_at:u});this.dispatch(n(d));const p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[e.asset,e.asset_type_identifier],blocks:[d.uuid]});return p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,p]}bulkAdd(e,n){const{addMany:c,updateMany:r,deleteMany:a}=this.actions,u=new Date().toISOString(),d=this.select(b=>{var M;return((M=b.userReducer.currentUser)==null?void 0:M.id)??null}),p=dt(e,Math.min(n??e.length,N)),m=[],f=[];for(const b of p){const M=[],g=[],E=[];for(const C of b){const z=O({...C,submitted_at:u,created_by:d});f.push(z);const D={uuid:z.uuid,asset:z.asset,asset_type_identifier:z.asset_type_identifier,value:z.value};M.push(D),g.push(z.asset),g.push(z.asset_type_identifier),E.push(z.uuid)}const B={payloads:M,submitted_at:u,blockers:g,blocks:E};m.push(B)}this.dispatch(c(f));const I=m.map(b=>{const{payloads:M,submitted_at:g,blockers:E,blocks:B}=b;return this.enqueueRequest({description:A(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:{submitted_at:g,payloads:M},blockers:E,blocks:B})});Promise.all(I).then(b=>{this.dispatch(r(b.flat()))}).catch(b=>{throw this.dispatch(a(w(f))),b});const _=Promise.all(I).then(b=>b.flat());return[f,_]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Expected asset type identifier value with uuid ${e} to exist`);this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{asset__project:e,latest:!0}},n)).flat();return this.dispatch(c(a)),a}}class SM extends v{constructor(){super(...arguments);h(this,"name","Asset Type");h(this,"url","/asset-types");h(this,"actions",{addOne:wd,addMany:vd,setOne:Md,setMany:Rd,updateOne:Ed,updateMany:Bd,deleteOne:Vd,deleteMany:zd,initialize:gd});h(this,"selectors",{selectById:jd,selectByIds:qd})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=O({...e,created_by:a,submitted_at:u});this.dispatch(n(d));const p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[],blocks:[d.uuid]});return p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,p]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Expected asset type with uuid ${e.uuid} to exist`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[r.uuid],blocks:[r.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Expected asset type with uuid ${e} to exist`);const u=this.select(Va(e)),d=this.select(Ya(e));this.dispatch(n(e)),this.dispatch(gs(w(u))),this.dispatch(ws(w(d)));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(p){throw this.dispatch(c(a)),this.dispatch(_s(u)),this.dispatch(Rs(d)),p}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{organization:e}},n);return this.dispatch(c(r)),r}}class AM extends v{constructor(){super(...arguments);h(this,"name","Asset Type Status");h(this,"url","/asset-type-statuses");h(this,"actions",{addOne:Ld,addMany:kd,setOne:Nd,setMany:Gd,updateOne:Hd,updateMany:Wd,deleteOne:Kd,deleteMany:Yd,initialize:Ud});h(this,"selectors",{selectById:Jd,selectByIds:Xd})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=O({...e,created_by:a,submitted_at:u});this.dispatch(n(d));const p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[e.asset_type],blocks:[d.uuid]});return p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,p]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Expected an existing asset type status with uuid ${e.uuid}`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`No asset type status with uuid ${e} found in the store`);this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(c(r)),r}}class IM extends j{constructor(){super(...arguments);h(this,"name","Document Attachment");h(this,"url","/document-attachments");h(this,"actions",{addOne:nu,addMany:cu,setOne:au,setMany:ru,updateOne:du,updateMany:uu,deleteOne:lu,deleteMany:ou,initialize:iu});h(this,"selectors",{selectById:mu,selectByIds:pu})}getId(e){return e.uuid}getBlockers(e){return[e.document]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(r=>{var a;return((a=r.userReducer.currentUser)==null?void 0:a.id)??null}),c=new Date().toISOString();return O({...e,created_by:n,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,document:e.document}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,document:e.document}}async bulkAdd(e,n){const[c,r,a]=await super.bulkAdd(e,n),u={};for(const{file_sha1:d,uuid:p}of c)d in u||(u[d]=[]),u[d].push(p);return a.then(d=>{const p=d.flatMap(m=>u[m]??[]);for(const m of p)this.makeReadable(m)}),[c,r,a]}makeReadable(e){this.enqueueRequest({description:"Add attachment to AI assistant",method:o.PATCH,url:`${this.url}/${e}/`,payload:{readable_to_assistant:!0},blockers:["index-document-attachment",e],blocks:["index-document-attachment"]})}async refreshStore(e,n){const{initialize:c}=this.actions,r=this.list({queryParams:{document__project__organization:e}},n),a=this.list({queryParams:{document__organization:e}},n),d=(await Promise.all([r,a])).flat();return this.dispatch(c(d)),d}}class TM extends v{constructor(){super(...arguments);h(this,"name","Document");h(this,"url","/documents");h(this,"actions",{addOne:Au,addMany:Iu,setOne:Tu,setMany:Ou,updateOne:Pu,updateMany:Fu,deleteOne:bu,deleteMany:_u,initialize:Su});h(this,"selectors",{selectById:Mu,selectByIds:Ru})}add(e){const{addOne:n,deleteOne:c,updateOne:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=O({...e,created_by:a,submitted_at:u});this.dispatch(n(d));const p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:d.parent_document?[d.parent_document]:[],blocks:[d.uuid]});return p.then(m=>{this.dispatch(r(m))}).catch(()=>{this.dispatch(c(d.uuid))}),[d,p]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`attempting to update a document with uuid ${e.uuid} that does not exist in store.documents`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c,addMany:r,deleteMany:a}=this.actions,{selectById:u}=this.selectors,d=this.select(u(e));if(!d)throw new Error(`attempting to delete a document with uuid ${e} that does not exist in store.documents`);const p=this.select(wu(e));this.dispatch(n(e)),this.dispatch(a(w(p)));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(m){throw this.dispatch(c(d)),this.dispatch(r(p)),m}}async refreshStore(e,n){const{initialize:c}=this.actions,r=this.list({queryParams:{project__organization:e}},n),a=this.list({queryParams:{organization:e}},n),d=(await Promise.all([r,a])).flat();return this.dispatch(c(d)),d}}class ft extends yt{async get(s,e){return this.performRequest({url:`${this.url}/${s}/`,method:o.GET},e)}async list(s,e){return this.performRequest({url:`${this.url}/`,method:o.GET,...s},e)}async listPaginated(s,e){return this.performPagination({url:`${this.url}/`,method:o.GET,...s},e)}}class OM extends ft{constructor(){super(...arguments);h(this,"name","Email Domains");h(this,"url","/organization-email-domains");h(this,"actions",{addOne:Bu,addMany:Vu,setOne:zu,setMany:Du,updateOne:ju,updateMany:qu,deleteOne:Cu,deleteMany:$u,initialize:Eu});h(this,"selectors",{selectById:Lu,selectByIds:ku})}async add(e,n){return this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:{email:n,organization:e},blockers:[e,"create-org"],blocks:[]})}async delete(e){const{deleteOne:n,addOne:c}=this.actions;this.dispatch(n(e.uuid));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e.uuid}/`,blockers:[e.domain],blocks:[]})}catch(r){throw this.dispatch(c(e)),r}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{organization:e}},n);return this.dispatch(c(r)),r}}class PM extends yt{async getVerificationCode(s){return this.enqueueRequest({description:"Get verification code",method:o.GET,url:`/verification/email-verification/${s}/`,isAuthNeeded:!1,blockers:[],blocks:[]})}validateVerificationCode(s,e=void 0){return this.enqueueRequest({description:"Validate verification code",method:o.POST,url:`/verification/email-verification/${s}/`,isAuthNeeded:!1,payload:e,blockers:[],blocks:[]})}}const qt={},hc=new Set,mc=new Set;class FM extends yt{constructor(){super(...arguments);h(this,"host");h(this,"dbPromise",bb.openDB("fileCache",2,{upgrade(e,n){n<1&&e.createObjectStore("files"),n<2&&e.createObjectStore("presignedUrls")}}))}async getDB(){return await this.dbPromise}async cacheFile(e){if(!e.name)throw new Error(`Cant add a file without a name to cache: ${e.name}`);if(!e.type)throw new Error(`Cant add a file without a type to cache: ${e.name}`);if(!e.size)throw new Error(`Cant add an empty file to cache: ${e.name}`);const n=await Ct(e);if(hc.has(n))return;const c=await this.getDB();!!await c.get("files",n)?console.warn(`Attempting to add a file already cached, ${e.name}`):await c.put("files",e,n),hc.add(n)}async uncacheFile(e){await(await this.getDB()).delete("files",e),hc.delete(e)}async getFileFromCache(e){return(await this.getDB()).get("files",e)}async fetchFileFromUrl(e,n,c=n,r){const a=e.split("?")[0]??e,u=await this.getFileFromCache(n);if(u)return u;let d;a in qt?d=qt[a]:zc(e)?(d=Vc(e,c),qt[a]=d):(d=new Promise(f=>{this.performRequest({method:o.GET,url:e,isExternalUrl:!0,isResponseBlob:!0,isAuthNeeded:!1},r).then(I=>{const _=new File([I],c,{type:I.type});f(_)})}),qt[a]=d);let p;try{p=await d}catch(f){throw f instanceof U&&delete qt[a],f}const m=await Ct(p);if(m!==n){const f=`The hash of the file returned from the server (${m}) does not match the
8
8
  expected hash (${n}). This can happen if you're using a local development server and the
9
9
  isExternalUrl flag in the request details is set to true, because instead of requesting the local
10
10
  REST API, you will be requesting localhost:80 (where this app runs), resulting in a transformed blob
11
11
  (with an uuid attached) being returned. Alternatively, you may be running with
12
12
  import.meta.env.PROD, which will result in some file requests being treated as
13
- external URLs and therefore not prepended with VITE_API_URL.`;throw new Error(f)}return await this.cacheFile(p),p}processPresignedUrl(e,n){if("warning"in n){if(n.warning==="already_uploaded")return Promise.resolve(void 0);throw console.error(n.warning),new Error(n.warning)}return this.enqueueRequest({url:n.url,description:"Upload file to S3",method:o.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:e,blockers:[`s3-${n.fields.key}`],blocks:[e],s3url:n})}processPresignedUrls(e){const n={};for(const[c,r]of Object.entries(e))n[c]=this.processPresignedUrl(c,r);return n}async getFilePayload(e){const c={sha1:await Ct(e),file_type:e.type,extension:Ec(e),size:e.size};return await this.client.files.cacheFile(e),c}async cachePresignedUrl(e,n){if(mc.has(e))return;const c=await this.getDB();!!await c.get("presignedUrls",e)?console.warn(`Attempting to add a presigned url already cached, ${n}`):await c.put("presignedUrls",n,e),mc.add(e)}async uncachePresignedUrl(e){await(await this.getDB()).delete("presignedUrls",e),mc.delete(e)}async getPresignedUrlFromCache(e){const n=await(await this.getDB()).get("presignedUrls",e);if(!n)return;if(Cc(n)){await this.uncachePresignedUrl(e);return}return n}}class bM extends v{constructor(){super(...arguments);h(this,"name","Form Identifier");h(this,"url","/form-identifiers");h(this,"actions",{addOne:Wu,addMany:Ku,setOne:Yu,setMany:Zu,updateOne:Ju,updateMany:Xu,deleteOne:Qu,deleteMany:xu,initialize:Hu});h(this,"selectors",{selectById:tl,selectByIds:sl})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=O({...e,created_by:a,submitted_at:u});this.dispatch(n(d));const p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[d.form],blocks:[d.uuid]});return p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,p]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Expected form identifier with uuid ${e.uuid} to exist`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Expected form identifier with uuid ${e} to exist`);this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{form__organization:e}},n);return this.dispatch(c(r)),r}}class _M extends v{constructor(){super(...arguments);h(this,"name","Form Identifier Value");h(this,"url","/form-identifier-values");h(this,"actions",{addOne:al,addMany:rl,setOne:dl,setMany:ul,updateOne:ll,updateMany:ol,deleteOne:hl,deleteMany:ml,initialize:cl});h(this,"selectors",{selectById:yl,selectByIds:fl})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=O({...e,created_by:a,submitted_at:u});this.dispatch(n(d));const p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[e.form_submission,e.form_identifier],blocks:[d.uuid]});return p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,p]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Expected form identifier value with uuid ${e} to exist`);this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await Promise.all([this.listPaginated({queryParams:{limit:this.pageSize,paginate:!0,form_submission__organization:e}},n),this.listPaginated({queryParams:{limit:this.pageSize,paginate:!0,form_submission__project__organization:e}},n)])).flatMap(u=>u.flat());return this.dispatch(c(a)),a}}class gM extends j{constructor(){super(...arguments);h(this,"name","Form Revision Attachment");h(this,"url","/form-revision-attachments");h(this,"actions",{addOne:Tl,addMany:Ol,setOne:Pl,setMany:Fl,updateOne:bl,updateMany:_l,deleteOne:gl,deleteMany:Ml,initialize:Il});h(this,"selectors",{selectById:wl,selectByIds:vl})}getId(e){return e.uuid}getBlockers(e){return[e.form_revision]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(r=>{var a;return((a=r.userReducer.currentUser)==null?void 0:a.id)??null}),c=new Date().toISOString();return O({...e,created_by:n,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:c,form_revision:r,file_sha1:a,file_name:u,file_extension:d}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:c,form_revision:r,file_sha1:a,file_name:u,file_extension:d}}buildBulkPayload(e){const{uuid:n,field_identifier:c,form_revision:r,file_sha1:a,file_name:u,file_extension:d}=e;return{uuid:n,field_identifier:c,form_revision:r,file_sha1:a,file_name:u,file_extension:d}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{form_revision__form__organization:e}},n);return this.dispatch(c(r)),r}}class MM extends v{constructor(){super(...arguments);h(this,"name","Form Revision");h(this,"url","/form-revisions");h(this,"actions",{addOne:zl,addMany:ii,setOne:Dl,setMany:jl,updateOne:ql,updateMany:Cl,deleteOne:$l,deleteMany:ni,initialize:Vl});h(this,"selectors",{selectById:Ll,selectByIds:kl})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=O({...e,created_by:a,submitted_at:u});this.dispatch(n(d));const p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[e.form],blocks:[d.uuid]});return p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,p]}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{form__organization:e}},n);return this.dispatch(c(r)),r}}class RM extends v{constructor(){super(...arguments);h(this,"name","Form");h(this,"url","/forms");h(this,"actions",{addOne:ao,addMany:ro,setOne:uo,setMany:lo,updateOne:oo,updateMany:ho,deleteOne:mo,deleteMany:po,initialize:co});h(this,"selectors",{selectById:So,selectByIds:Ao})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=new Date().toISOString(),u=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),d=O({...e,submitted_at:a,created_by:u});this.dispatch(n(d));const p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[],blocks:[d.uuid]});return p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,p]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Expected form with uuid ${e.uuid} to exist`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[r.uuid],blocks:[r.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error("Expected form to exist");const u=this.select(ko(e)),d=this.select(Nl(e)),p=this.select(so(e));this.dispatch(n(e)),this.dispatch(ot(w(u))),this.dispatch(ni(w(d))),this.dispatch(ri(w(p)));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(m){throw this.dispatch(c(a)),this.dispatch(ii(d)),this.dispatch(lt(u)),this.dispatch(ai(p)),m}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{organization:e}},n);return this.dispatch(c(r)),r}}class wM extends v{constructor(){super(...arguments);h(this,"name","Form Subscriber");h(this,"url","/form-subscribers");h(this,"actions",{addOne:Kl,addMany:ai,setOne:Yl,setMany:Zl,updateOne:Jl,updateMany:Xl,deleteOne:Ql,deleteMany:ri,initialize:Wl});h(this,"selectors",{selectById:eo,selectByIds:to})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=new Date().toISOString(),u=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),d=O({...e,created_by:u,submitted_at:a});this.dispatch(n(d));const p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[d.form],blocks:[d.uuid]});return p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,p]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Expected form subscriber with uuid ${e} to exist`);this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{form__organization:e}},n);return this.dispatch(c(r)),r}}class vM extends j{constructor(){super(...arguments);h(this,"name","Form Submission Attachment");h(this,"url","/form-submission-attachments");h(this,"actions",{addOne:Oo,addMany:oi,setOne:Po,setMany:Fo,updateOne:bo,updateMany:_o,deleteOne:go,deleteMany:hi,initialize:To});h(this,"selectors",{selectById:Mo,selectByIds:Ro})}getId(e){return e.uuid}getBlockers(e){return[e.form_submission]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(r=>{var a;return((a=r.userReducer.currentUser)==null?void 0:a.id)??null}),c=new Date().toISOString();return O({...e,created_by:n,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:c,form_submission:r,file_sha1:a,file_name:u,file_extension:d}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:c,form_submission:r,file_sha1:a,file_name:u,file_extension:d}}buildBulkPayload(e){const{uuid:n,field_identifier:c,form_submission:r,file_sha1:a,file_name:u,file_extension:d}=e;return{uuid:n,field_identifier:c,form_submission:r,file_sha1:a,file_name:u,file_extension:d}}async bulkDelete(e){const{deleteMany:n,addMany:c}=this.actions,r=this.select(yi(e));this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(a){throw this.dispatch(c(r)),a}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await Promise.all([this.listPaginated({queryParams:{limit:this.pageSize,paginate:!0,form_submission__organization:e}},n),this.listPaginated({queryParams:{limit:this.pageSize,paginate:!0,form_submission__project__organization:e}},n)])).flatMap(u=>u.flat());return this.dispatch(c(a)),a}}class EM extends v{constructor(){super(...arguments);h(this,"name","Form Submission");h(this,"url","/form-submissions");h(this,"actions",{addOne:Do,addMany:lt,setOne:Vo,setMany:zo,updateOne:jo,updateMany:qo,deleteOne:Co,deleteMany:ot,initialize:Bo});h(this,"selectors",{selectById:Uo,selectByIds:Lo})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=O({...e,created_by:a,submitted_at:u}),p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[e.form_revision],blocks:[d.uuid]});return this.dispatch(n(d)),p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,p]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Expected submission with uuid ${e.uuid} to exist`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${a.uuid}/`,payload:e,blockers:[a.uuid],blocks:[a.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Expected submission with uuid ${e} to exist`);const u=this.select(wo(e));this.dispatch(n(e)),this.dispatch(hi(w(u)));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(a)),this.dispatch(oi(u)),d}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await Promise.all([this.listPaginated({queryParams:{limit:this.pageSize,paginate:!0,organization:e}},n),this.listPaginated({queryParams:{limit:this.pageSize,paginate:!0,project__organization:e}},n)])).flatMap(u=>u.flat());return this.dispatch(c(a)),a}}class BM extends j{constructor(){super(...arguments);h(this,"name","Geo Image");h(this,"url","/geo-images");h(this,"actions",{addOne:Qo,addMany:xo,setOne:Jo,setMany:Xo,updateOne:eh,updateMany:th,deleteOne:sh,deleteMany:ih,initialize:Zo});h(this,"selectors",{selectById:ch,selectByIds:ah})}getId(e){return e.uuid}getBlockers(e){return[e.project]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(r=>{var a;return((a=r.userReducer.currentUser)==null?void 0:a.id)??null}),c=new Date().toISOString();return O({...e,created_by:n,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_sha1:e.file_sha1,file_name:e.file_name,file_extension:e.file_extension,title:e.title,description:e.description,geo_marker:e.geo_marker,canvas_marker:e.canvas_marker,direction:e.direction,original_date:e.original_date,project:e.project}}buildBulkPayload(e){return{uuid:e.uuid,file_sha1:e.file_sha1,file_name:e.file_name,file_extension:e.file_extension,title:e.title,description:e.description,geo_marker:e.geo_marker,canvas_marker:e.canvas_marker,direction:e.direction,original_date:e.original_date,project:e.project}}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Geo image with uuid ${e.uuid} does not exist in the store`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{project:e}},n);return this.dispatch(c(r)),r}}class VM extends v{constructor(){super(...arguments);h(this,"name","Issue Association");h(this,"url","/issue-associations");h(this,"actions",{addOne:ph,addMany:Ot,setOne:oh,setMany:lh,updateOne:hh,updateMany:mh,deleteOne:yh,deleteMany:Pt,initialize:uh});h(this,"selectors",{selectById:Sh,selectByIds:Ah})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=new Date().toISOString(),u=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),d=O({...e,submitted_at:a,created_by:u});this.dispatch(n(d));const p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[e.issue,e.asset],blocks:[d.uuid]});return p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,p]}bulkAdd(e){const{addMany:n,deleteMany:c,updateMany:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=e.map(m=>O({...m,submitted_at:u,created_by:a}));this.dispatch(n(d));const p=this.enqueueRequest({description:A(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:{payloads:d.map(m=>R(m)),submitted_at:u},blockers:d.flatMap(m=>[m.issue,m.asset]),blocks:w(d)});return p.then(m=>{this.dispatch(r(m))}).catch(()=>{this.dispatch(c(w(d)))}),[d,p]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Issue association with uuid ${e} not found in store.`);this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(c(a)),a}}class zM extends j{constructor(){super(...arguments);h(this,"name","Issue Attachment");h(this,"url","/issue-attachments");h(this,"actions",{addOne:gh,addMany:Oi,setOne:Mh,setMany:Rh,updateOne:wh,updateMany:vh,deleteOne:Eh,deleteMany:Pi,initialize:_h});h(this,"selectors",{selectById:zh,selectByIds:Dh})}getId(e){return e.uuid}getBlockers(e){return[e.issue]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(r=>{var a;return((a=r.userReducer.currentUser)==null?void 0:a.id)??null}),c=new Date().toISOString();return O({...e,created_by:n,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue:e.issue}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue:e.issue}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(c(a)),a}}class DM extends j{constructor(){super(...arguments);h(this,"name","Issue Comment Attachment");h(this,"url","/issue-comment-attachments");h(this,"actions",{addOne:$h,addMany:Uh,setOne:Lh,setMany:kh,updateOne:Nh,updateMany:Gh,deleteOne:Hh,deleteMany:Wh,initialize:Ch});h(this,"selectors",{selectById:Yh,selectByIds:Zh})}getId(e){return e.uuid}getBlockers(e){return[e.issue_comment]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(r=>{var a;return((a=r.userReducer.currentUser)==null?void 0:a.id)??null}),c=new Date().toISOString();return O({...e,created_by:n,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue_comment:e.issue_comment}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue_comment:e.issue_comment}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{issue_comment__issue__project:e}},n)).flat();return this.dispatch(c(a)),a}}class jM extends v{constructor(){super(...arguments);h(this,"name","Issue Comment");h(this,"url","/issue-comments");h(this,"actions",{addOne:xh,addMany:em,setOne:tm,setMany:sm,updateOne:im,updateMany:nm,deleteOne:cm,deleteMany:am,initialize:Qh});h(this,"selectors",{selectById:rm,selectByIds:dm})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=O({...e,created_by:this.select(d=>d.userReducer.currentUser.id),submitted_at:new Date().toISOString()});this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(a),blockers:[e.issue],blocks:[a.uuid]});return u.then(d=>{this.dispatch(c(d))}).catch(()=>{this.dispatch(r(a.uuid))}),[a,u]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Comment with uuid ${e.uuid} not found in store`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Comment with uuid ${e} not found in store`);this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{setMany:c}=this.actions,a=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(c(a)),a}}class qM extends v{constructor(){super(...arguments);h(this,"name","Issue");h(this,"url","/issues");h(this,"actions",{addOne:hm,addMany:wi,setOne:mm,setMany:pm,updateOne:ym,updateMany:fm,deleteOne:Sm,deleteMany:vi,initialize:om});h(this,"selectors",{selectById:Im,selectByIds:Tm})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=new Date().toISOString(),u=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),d=O({...e,submitted_at:a,created_by:u});this.dispatch(n(d));const p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[d.project,d.issue_type,d.status,d.priority],blocks:[d.uuid]});return p.then(m=>{this.dispatch(c(m))}).catch(m=>{throw this.dispatch(r(d.uuid)),m}),[d,p]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Attempting to update an issue with uuid ${e.uuid} that doesn't exist in the store`);const a={...r,...e};this.dispatch(n(a));const u={};for(const m of[$.TITLE,$.DESCRIPTION,$.STATUS,$.PRIORITY,$.ASSIGNED_TO,$.DUE_DATE])if(m in e&&e[m]!==r[m])switch(m){case $.PRIORITY:{const f=e[m],I=this.select(Wi(f));if(!I)throw new Error(`Trying to update issue type priority with ${f} which does not exist in store`);u[m]={name:I.name,color:I.color,uuid:I.uuid};break}case $.DUE_DATE:u[m]=e.due_date;break;case $.DESCRIPTION:u[m]=e.description??"";break;case $.TITLE:u[m]=e.title??"";break;case $.STATUS:{const f=e[m],I=this.select(Xi(f));if(!I)throw new Error(`Trying to update issue type status with ${f} which does not exist in store`);u[m]={name:I.name,color:I.color,uuid:I.uuid};break}case $.ASSIGNED_TO:{const f=e[m];if(f===null)u[m]=null;else{const I=this.select(ss(f));if(!I)throw new Error(`Trying to update assigned to with ${f} which does not exist in store.`);u[m]={full_name:I.username,id:I.id}}break}}const d=O({created_by:this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),submitted_at:new Date().toISOString(),issue:r.uuid,changes:u});this.dispatch(xi(d));const p=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return p.then(m=>{this.dispatch(n(m))}).catch(()=>{this.dispatch(n(r)),this.dispatch(tn(d.uuid))}),[a,p]}bulkUpdate(e,n){const{updateMany:c}=this.actions,{selectByIds:r}=this.selectors,a=w(e).toSorted($t);if(a.length!==e.length)throw new Error("payloads contains duplicate uuids.");const u=this.select(r(a)).toSorted(fs);if(a.length!=u.length)throw new Error(`Attempting to bulk update ${a.length-u.length} issues that dont exist in the store`);const d=[];for(let I=0;I<a.length;I++)d.push({...u[I],...e[I]});this.dispatch(c(d));const p=dt(e,Math.min(n??e.length,N)),m=[];let f=null;for(const I of p){const _=ut.v4(),b=w(I),M=I.map(({status:B})=>B).filter(Boolean),g=I.map(({priority:B})=>B).filter(Boolean),E=this.enqueueRequest({description:A(o.PATCH,this.name,!0),method:o.PATCH,url:`${this.url}/bulk/`,payload:{payloads:I},blockers:(f?[f]:[]).concat(b).concat(M).concat(g),blocks:[_].concat(b)});m.push(E),f=_}return Promise.all(m).then(I=>{this.dispatch(c(I.flat()))}).catch(()=>{this.dispatch(c(u))}),[d,m]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`No issue with uuid ${e} found in the store`);const u=this.select(Th(e)),d=this.select(Vh(e)),p=this.select(rf(e)),m=this.select(No(e));this.dispatch(n(e)),this.dispatch(Pi(w(d))),this.dispatch(sn(w(p))),this.dispatch(Pt(w(u))),this.dispatch(ot(w(m)));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(f){throw this.dispatch(c(a)),this.dispatch(Oi(d)),this.dispatch(en(p)),this.dispatch(Ot(u)),this.dispatch(lt(m)),f}}async bulkDelete(e){const{addMany:n,deleteMany:c}=this.actions,{selectByIds:r}=this.selectors,a=this.select(r(e)),u=this.select(Ih(e)),d=this.select(Go(e));this.dispatch(c(e)),this.dispatch(Pt(w(u))),this.dispatch(ot(w(d)));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(p){throw this.dispatch(n(a)),this.dispatch(Ot(u)),this.dispatch(lt(d)),p}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(c(a)),a}}class CM extends j{constructor(){super(...arguments);h(this,"name","Issue Type Attachment");h(this,"url","/issue-type-attachments");h(this,"actions",{addOne:_m,addMany:gm,setOne:Mm,setMany:Rm,updateOne:wm,updateMany:vm,deleteOne:Em,deleteMany:Bm,initialize:bm});h(this,"selectors",{selectById:zm,selectByIds:Dm})}getId(e){return e.uuid}getBlockers(e){return[e.issue_type]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(r=>{var a;return((a=r.userReducer.currentUser)==null?void 0:a.id)??null}),c=new Date().toISOString();return O({...e,created_by:n,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue_type:e.issue_type}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue_type:e.issue_type}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(c(r)),r}}class $M extends j{constructor(){super(...arguments);h(this,"name","Issue Type Fields Attachment");h(this,"url","/issue-type-fields-attachments");h(this,"actions",{addOne:$m,addMany:Um,setOne:Lm,setMany:km,updateOne:Nm,updateMany:Gm,deleteOne:Hm,deleteMany:Wm,initialize:Cm});h(this,"selectors",{selectById:Ym,selectByIds:Zm})}getId(e){return e.uuid}getBlockers(e){return[e.fields_revision]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(r=>{var a;return((a=r.userReducer.currentUser)==null?void 0:a.id)??null}),c=new Date().toISOString();return O({...e,created_by:n,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:c,fields_revision:r,file_sha1:a,file_name:u,file_extension:d}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:c,fields_revision:r,file_sha1:a,file_name:u,file_extension:d}}buildBulkPayload(e){const{uuid:n,field_identifier:c,fields_revision:r,file_sha1:a,file_name:u,file_extension:d}=e;return{uuid:n,field_identifier:c,fields_revision:r,file_sha1:a,file_name:u,file_extension:d}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{fields_revision__issue_type__organization:e}},n);return this.dispatch(c(r)),r}}class UM extends v{constructor(){super(...arguments);h(this,"name","Issue Type Fields");h(this,"url","/issue-type-fields");h(this,"actions",{addOne:mp,addMany:pp,setOne:yp,setMany:fp,updateOne:Sp,updateMany:Ap,deleteOne:Ip,deleteMany:Tp,initialize:hp});h(this,"selectors",{selectById:Pp,selectByIds:Fp})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=O({...e,created_by:a,submitted_at:u});this.dispatch(n(d));const p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[d.issue_type],blocks:[d.uuid]});return p.then(m=>{this.dispatch(c(m))}).catch(m=>{throw this.dispatch(r(d.uuid)),m}),[d,p]}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(c(r)),r}}class LM extends j{constructor(){super(...arguments);h(this,"name","Issue Type Field Values Attachment");h(this,"url","/issue-type-field-values-attachments");h(this,"actions",{addOne:Mp,addMany:Ci,setOne:Rp,setMany:wp,updateOne:vp,updateMany:Ep,deleteOne:Bp,deleteMany:$i,initialize:gp});h(this,"selectors",{selectById:zp,selectByIds:Dp})}getId(e){return e.uuid}getBlockers(e){return[e.field_values]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(r=>{var a;return((a=r.userReducer.currentUser)==null?void 0:a.id)??null}),c=new Date().toISOString();return O({...e,created_by:n,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:c,field_values:r,file_sha1:a,file_name:u,file_extension:d}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:c,field_values:r,file_sha1:a,file_name:u,file_extension:d}}buildBulkPayload(e){const{uuid:n,field_identifier:c,field_values:r,file_sha1:a,file_name:u,file_extension:d}=e;return{uuid:n,field_identifier:c,field_values:r,file_sha1:a,file_name:u,file_extension:d}}async bulkDelete(e){const{deleteMany:n,addMany:c}=this.actions,{selectByIds:r}=this.selectors,a=this.select(r(e));this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{field_values__issue__project:e,latest:!0}},n)).flat();return this.dispatch(c(a)),a}}class kM extends v{constructor(){super(...arguments);h(this,"name","Issue Type Field Values");h(this,"url","/issue-type-field-values");h(this,"actions",{addOne:xm,addMany:ep,setOne:tp,setMany:sp,updateOne:ip,updateMany:np,deleteOne:cp,deleteMany:ap,initialize:Qm});h(this,"selectors",{selectById:dp,selectByIds:up})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=O({...e,created_by:a,submitted_at:u}),p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[e.issue,e.fields_revision],blocks:[d.uuid]});return this.dispatch(n(d)),p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,p]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Expected IssueTypeFieldValues with uuid ${e.uuid} to exist`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[a.uuid,a.fields_revision,a.issue],blocks:[a.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Expected submission with uuid ${e} to exist`);const u=this.select(jp(e));this.dispatch(n(e)),this.dispatch($i(w(u)));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(a)),this.dispatch(Ci(u)),d}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{issue__project:e,latest:!0}},n)).flat();return this.dispatch(c(a)),a}}class NM extends v{constructor(){super(...arguments);h(this,"name","Issue Type Identifier");h(this,"url","/issue-type-identifiers");h(this,"actions",{addOne:Up,addMany:Lp,setOne:kp,setMany:Np,updateOne:Gp,updateMany:Hp,deleteOne:Wp,deleteMany:Kp,initialize:$p});h(this,"selectors",{selectById:Zp,selectByIds:Jp})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=O({...e,created_by:a,submitted_at:u});this.dispatch(n(d));const p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[d.issue_type],blocks:[d.uuid]});return p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,p]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Expected issue type identifier with uuid ${e.uuid} to exist`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Expected issue type identifier with uuid ${e} to exist`);this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(c(r)),r}}class GM extends v{constructor(){super(...arguments);h(this,"name","Issue Type Identifier Value");h(this,"url","/issue-type-identifier-values");h(this,"actions",{addOne:ey,addMany:ty,setOne:sy,setMany:iy,updateOne:ny,updateMany:cy,deleteOne:ay,deleteMany:ry,initialize:xp});h(this,"selectors",{selectById:uy,selectByIds:ly})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=O({...e,created_by:a,submitted_at:u});this.dispatch(n(d));const p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[e.issue,e.issue_type_identifier],blocks:[d.uuid]});return p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,p]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Expected issue type identifier value with uuid ${e} to exist`);this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{issue__project:e,latest:!0}},n)).flat();return this.dispatch(c(a)),a}}class HM extends v{constructor(){super(...arguments);h(this,"name","Issue Type Priority");h(this,"url","/issue-type-priorities");h(this,"actions",{addOne:py,addMany:yy,setOne:fy,setMany:Sy,updateOne:Ay,updateMany:Iy,deleteOne:Ty,deleteMany:Oy,initialize:my});h(this,"selectors",{selectById:Wi,selectByIds:Fy})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=O({...e,created_by:a,submitted_at:u});this.dispatch(n(d));const p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[e.issue_type],blocks:[d.uuid]});return p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,p]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Expected an existing issue type priority with uuid ${e.uuid}`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`No issue type priority with uuid ${e} found in the store`);this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(c(r)),r}}class WM extends v{constructor(){super(...arguments);h(this,"name","Issue Type");h(this,"url","/issue-types");h(this,"actions",{addOne:My,addMany:Ry,setOne:wy,setMany:vy,updateOne:Ey,updateMany:By,deleteOne:Vy,deleteMany:zy,initialize:gy});h(this,"selectors",{selectById:jy,selectByIds:qy})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=O({...e,submitted_at:u,created_by:a});this.dispatch(n(d));const p=this.enqueueRequest({method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[],blocks:[d.uuid]});return p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,p]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`IssueType with uuid ${e.uuid} does not exist in the store.`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{addOne:n,deleteOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`IssueType with uuid ${e} does not exist in the store.`);const u=this.select(Om(e));this.dispatch(c(e)),this.dispatch(vi(w(u)));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(n(a)),this.dispatch(wi(u)),d}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{organization:e}},n);return this.dispatch(c(r)),r}}class KM extends v{constructor(){super(...arguments);h(this,"name","Issue Type Status");h(this,"url","/issue-type-statuses");h(this,"actions",{addOne:Ly,addMany:ky,setOne:Ny,setMany:Gy,updateOne:Hy,updateMany:Wy,deleteOne:Ky,deleteMany:Yy,initialize:Uy});h(this,"selectors",{selectById:Xi,selectByIds:Jy})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=O({...e,created_by:a,submitted_at:u});this.dispatch(n(d));const p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[e.issue_type],blocks:[d.uuid]});return p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,p]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Expected an existing issue type status with uuid ${e.uuid}`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`No issue type status with uuid ${e} found in the store`);this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(c(r)),r}}class YM extends v{constructor(){super(...arguments);h(this,"name","Issue Update");h(this,"url","/issue-updates");h(this,"actions",{addOne:xi,addMany:en,setOne:ef,setMany:tf,updateOne:sf,updateMany:nf,deleteOne:tn,deleteMany:sn,initialize:xy});h(this,"selectors",{selectById:cf,selectByIds:af})}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(c(a)),a}}const ZM=1800;function JM(t){if(!t.access)throw new Error("Missing access token");if(!t.refresh)throw new Error("Missing refresh token");return{accessToken:t.access,refreshToken:t.refresh}}class XM extends cM{constructor(){super(...arguments);h(this,"_getRenewedTokens",async e=>{const n=this.performRequest({method:o.POST,url:this.refreshTokensUrl,payload:{refresh:e},isAuthNeeded:!1,checkAuth:!1});let c;try{c=await n}catch(r){console.error("Could not renew tokens; clearing auth",r),this.clearAuth();return}if(!c.access)throw new Error("Missing access token");return{accessToken:c.access,refreshToken:c.refresh??this.getRefreshToken()}})}clearAuth(){console.debug(this.constructor.name,"clearing auth;"),this.dispatch(eu(!1)),this.clearTokens(),this.dispatch(T()),this.dispatch(T())}async renewTokens(){const e=this.getRefreshToken();if(!e)throw new Error("No refresh token found");console.debug(this.constructor.name,"renewing tokens");try{const n=await this._getRenewedTokens(e);if(!n)return;console.debug("Got renewed tokens"),this.setTokens(n)}catch(n){throw console.error("Could not renew tokens; clearing auth",n),this.clearAuth(),n}}tokenIsExpiringSoon(){const e=this.getAccessToken();if(!e)return!1;const n=Date.now()/1e3;let c;try{c=_b(e).exp??n}catch{c=n}return c-n<ZM}getAuthHeader(){return`Bearer ${this.getAccessToken()}`}async prepareAuth(){if(this.tokenIsExpiringSoon()){console.debug(this.constructor.name,"preparing auth");try{await this.renewTokens()}catch(e){return e instanceof U&&this.clearAuth(),e instanceof Error?Promise.reject(e):Promise.reject(new Error((e??gt).toString()))}}}async handleUnauthorized(e,n){if(e.url.endsWith("/token/refresh/"))throw this.select(c=>c.authReducer.isLoggedIn)&&console.warn("No signed-in user to sign out."),this.clearAuth(),new U({message:"You have been signed out due to inactivity.",response:n,discard:!0});if(this.select(c=>c.authReducer.isLoggedIn))await this.renewTokens();else throw console.debug("Forbidden; user is not logged in."),new U({message:"Incorrect username or password.",response:n,discard:!0})}async initAuth(e){const n=ut.v4();return console.debug(this.constructor.name,"Initiating auth"),this.performRequest({uuid:n,method:o.POST,url:this.initTokensUrl,payload:e,isAuthNeeded:!1,checkAuth:!1}).then(c=>{this.setTokens(JM(c))})}}class QM extends ft{constructor(){super(...arguments);h(this,"name","Organization Access");h(this,"url","/organization-accesses");h(this,"actions",{addOne:Pf,addMany:Ff,setOne:bf,setMany:_f,updateOne:gf,updateMany:Mf,deleteOne:Rf,deleteMany:wf,initialize:Of});h(this,"selectors",{selectById:Ef,selectByIds:Bf})}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid)),a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(d=>{throw this.dispatch(n(r)),d}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e)),u=this.select(ss(a.user));this.dispatch(n(a.uuid)),this.dispatch(dn(a.user));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${a.uuid}/`,blockers:[a.uuid],blocks:[]})}catch(d){throw this.dispatch(c(a)),this.dispatch(rn(u)),d}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{organization:e}},n);return this.dispatch(c(r)),r}}class xM extends ft{constructor(){super(...arguments);h(this,"name","Organization");h(this,"url","/organizations");h(this,"actions",{addOne:$f,addMany:Cf,setOne:qf,setMany:jf,updateOne:Lf,updateMany:Uf,deleteOne:kf,deleteMany:Nf,initialize:Df});h(this,"selectors",{selectById:Wf,selectByIds:Kf})}async add(e){const{addOne:n}=this.actions,c=await this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:e,blockers:[],blocks:[]});return this.dispatch(n(c)),c}async update(e){const{updateOne:n}=this.actions,c=await this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return this.dispatch(n(c)),c}async invite(e,n){return this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/${e}/invite/${n}/`,blockers:[],blocks:[]})}async refreshStore(e){const{initialize:n}=this.actions,c=await this.list({},e);return this.dispatch(n(c)),c}}class eR extends v{constructor(){super(...arguments);h(this,"name","Project Access");h(this,"url","/project-accesses");h(this,"actions",{addOne:iS,addMany:nS,setOne:cS,setMany:aS,updateOne:rS,updateMany:dS,deleteOne:uS,deleteMany:lS,initialize:sS});h(this,"selectors",{selectById:hS,selectByIds:mS})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=O({...e,created_by:this.select(d=>{var p;return((p=d.userReducer.currentUser)==null?void 0:p.id)??null})});this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(a),blockers:[a.organization_access,a.project],blocks:[a.uuid]});return u.then(d=>{this.dispatch(c(d))}).catch(d=>{throw this.dispatch(r(a.uuid)),d}),[a,u]}bulkAdd(e){const{addMany:n,deleteMany:c,updateMany:r}=this.actions,a=this.select(p=>{var m;return((m=p.userReducer.currentUser)==null?void 0:m.id)??null}),u=e.map(p=>O({...p,created_by:a}));this.dispatch(n(u));const d=this.enqueueRequest({description:A(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:{project_accesses:u.map(p=>R(p))},blockers:u.flatMap(p=>[p.project,p.organization_access]),blocks:u.map(p=>p.uuid)});return d.then(p=>{this.dispatch(r(p))}).catch(p=>{throw this.dispatch(c(u.map(m=>m.uuid))),p}),[u,d]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid)),a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[]});return u.then(d=>{this.dispatch(n(d))}).catch(d=>{throw this.dispatch(n(r)),d}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{project__organization:e}},n);return this.dispatch(c(r)),r}}class tR extends j{constructor(){super(...arguments);h(this,"name","Project Attachment");h(this,"url","/project-attachments");h(this,"actions",{addOne:fS,addMany:SS,setOne:AS,setMany:IS,updateOne:TS,updateMany:OS,deleteOne:PS,deleteMany:FS,initialize:yS});h(this,"selectors",{selectById:_S,selectByIds:gS})}getId(e){return e.uuid}getBlockers(e){return[e.project]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(r=>{var a;return((a=r.userReducer.currentUser)==null?void 0:a.id)??null}),c=new Date().toISOString();return O({...e,created_by:n,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,project:e.project}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,project:e.project}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{project__organization:e}},n);return this.dispatch(c(r)),r}}class sR extends v{constructor(){super(...arguments);h(this,"name","Project Comment");h(this,"url","/project-comments");h(this,"actions",{addOne:vS,addMany:ES,setOne:BS,setMany:VS,updateOne:zS,updateMany:DS,deleteOne:jS,deleteMany:qS,initialize:wS});h(this,"selectors",{selectById:$S,selectByIds:US})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=O({...e,created_by:this.select(d=>{var p;return((p=d.userReducer.currentUser)==null?void 0:p.id)??null}),submitted_at:new Date().toISOString()});this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(a),blockers:[a.project],blocks:[a.uuid]});return u.then(d=>{this.dispatch(c(d))}).catch(()=>{this.dispatch(r(a.uuid))}),[a,u]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Project comment with uuid ${e.uuid} not found in store`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Project comment with uuid ${e} not found in store`);this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(c(a)),a}}class iR extends j{constructor(){super(...arguments);h(this,"name","Project File");h(this,"url","/project-files");h(this,"actions",{addOne:WS,addMany:KS,setOne:GS,setMany:HS,updateOne:YS,updateMany:ZS,deleteOne:JS,deleteMany:XS,initialize:NS});h(this,"selectors",{selectById:eA,selectByIds:tA})}getId(e){return e.uuid}getBlockers(e){return[e.project]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(r=>{var a;return((a=r.userReducer.currentUser)==null?void 0:a.id)??null}),c=new Date().toISOString();return O({...e,created_by:n,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_sha1:e.file_sha1,file_name:e.file_name,file_extension:e.file_extension,project:e.project,z_index:e.z_index,canvas_bounds:e.canvas_bounds,bounds:e.bounds}}buildBulkPayload(e){return{uuid:e.uuid,file_sha1:e.file_sha1,file_name:e.file_name,file_extension:e.file_extension,project:e.project,z_index:e.z_index,canvas_bounds:e.canvas_bounds,bounds:e.bounds}}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`${this.name} with uuid ${e.uuid} does not exist in the store`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(c(a)),a}}class nR extends ft{constructor(){super(...arguments);h(this,"name","Project");h(this,"url","/projects");h(this,"actions",{addOne:dA,addMany:rA,setOne:aA,setMany:cA,updateOne:lA,updateMany:uA,deleteOne:oA,deleteMany:hA,initialize:nA});h(this,"selectors",{selectById:yA,selectByIds:fA})}async add(e){const{addOne:n}=this.actions,c=await this.performRequest({method:o.POST,url:`${this.url}/`,payload:R(e)});return this.dispatch(n(c)),c}async update(e){const{updateOne:n}=this.actions,c=await this.performRequest({method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:R(e)});return this.dispatch(n(c)),c}async delete(e){const{deleteOne:n}=this.actions,c=await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return this.dispatch(n(e)),c}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{organization:e}},n);return this.dispatch(c(r)),r}}class cR extends v{constructor(){super(...arguments);h(this,"name","Procedure");h(this,"url","/procedures");h(this,"actions",{addOne:VA,addMany:bt,setOne:zA,setMany:DA,updateOne:jA,updateMany:qA,deleteOne:CA,deleteMany:_t,initialize:BA});h(this,"selectors",{selectById:LA,selectByIds:kA})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=O({...e,created_by:this.select(d=>{var p;return((p=d.userReducer.currentUser)==null?void 0:p.id)??null}),submitted_at:new Date().toISOString()});this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(a),blockers:[a.procedure_type,a.project,a.asset,...a.procedure_initiative?[a.procedure_initiative]:[]],blocks:[a.uuid]});return u.then(d=>{this.dispatch(c(d))}).catch(()=>{this.dispatch(r(a.uuid))}),[a,u]}bulkAdd(e,n){var b;const{store:c}=this.client,{addMany:r,updateMany:a,deleteMany:u}=this.actions,d=new Date().toISOString(),p=((b=c.getState().userReducer.currentUser)==null?void 0:b.id)??null,m=[],f=dt(e,Math.min(n??e.length,N)),I=[];for(const M of f){const g=[],E=[],B=[];for(const z of M){const D=O({...z,submitted_at:d,created_by:p});m.push(D),g.push(R(D)),E.push(D.procedure_type,D.project,D.asset,...D.procedure_initiative?[D.procedure_initiative]:[]),B.push(D.uuid)}const C={payload:{submitted_at:d,payloads:g},blockers:E,blocks:B};I.push(C)}this.dispatch(r(m));const _=I.map(M=>{const{payload:g,blocks:E,blockers:B}=M;return this.enqueueRequest({description:A(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:g,blockers:B,blocks:E})});return Promise.all(_).then(M=>{this.dispatch(a(M.flat()))}).catch(()=>{this.dispatch(u(w(m)))}),[m,Promise.all(_).then(M=>M.flat())]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Expected procedure with uuid ${e.uuid} to exist`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[r.uuid],blocks:[r.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Expected procedure with uuid ${e} to exist`);this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async bulkDelete(e){const{addMany:n,deleteMany:c}=this.actions,{selectByIds:r}=this.selectors,a=this.select(r(e));this.dispatch(c(w(a)));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(n(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(c(a)),a}}class aR extends v{constructor(){super(...arguments);h(this,"name","Procedure Step Assignee");h(this,"url","/procedure-step-assignees");h(this,"actions",{addOne:ZA,addMany:JA,setOne:XA,setMany:QA,updateOne:xA,updateMany:eI,deleteOne:tI,deleteMany:sI,initialize:YA});h(this,"selectors",{selectById:nI,selectByIds:cI})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=O({...e,created_by:this.select(d=>{var p;return((p=d.userReducer.currentUser)==null?void 0:p.id)??null}),submitted_at:new Date().toISOString()});this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(a),blockers:[a.procedure,a.procedure_step],blocks:[a.uuid]});return u.then(d=>{this.dispatch(c(d))}).catch(()=>{this.dispatch(r(a.uuid))}),[a,u]}bulkAdd(e){const{addMany:n,setMany:c,deleteMany:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=e.map(m=>O({...m,created_by:a,submitted_at:u}));this.dispatch(n(d));const p=this.enqueueRequest({description:A(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:{procedure_step_assignees:d.map(m=>R(m)),submitted_at:u},blockers:d.flatMap(m=>[m.procedure,m.procedure_step]),blocks:w(d)});return p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(w(d)))}),[d,p]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Expected procedure step assignee with uuid ${e} to exist`);this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async bulkDelete(e){const{deleteMany:n,addMany:c}=this.actions,{selectByIds:r}=this.selectors,a=this.select(r(e));this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{procedure__project:e}},n)).flat();return this.dispatch(c(a)),a}}class rR extends v{constructor(){super(...arguments);h(this,"name","Procedure Step Comment");h(this,"url","/procedure-step-comments");h(this,"actions",{addOne:uI,addMany:lI,setOne:oI,setMany:hI,updateOne:mI,updateMany:pI,deleteOne:yI,deleteMany:fI,initialize:dI});h(this,"selectors",{selectById:AI,selectByIds:II})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=O({...e,created_by:this.select(d=>{var p;return((p=d.userReducer.currentUser)==null?void 0:p.id)??null}),submitted_at:new Date().toISOString()});this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(a),blockers:[a.procedure,a.procedure_step],blocks:[a.uuid]});return u.then(d=>{this.dispatch(c(d))}).catch(()=>{this.dispatch(r(a.uuid))}),[a,u]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Procedure step comment with uuid ${e.uuid} not found in store`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Procedure step comment with uuid ${e} not found in store`);this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{procedure__project:e}},n)).flat();return this.dispatch(c(a)),a}}class dR extends v{constructor(){super(...arguments);h(this,"name","Procedure Step Default Assignee");h(this,"url","/procedure-step-default-assignees");h(this,"actions",{addOne:FI,addMany:bI,setOne:_I,setMany:gI,updateOne:MI,updateMany:RI,deleteOne:wI,deleteMany:vI,initialize:PI});h(this,"selectors",{selectById:BI,selectByIds:VI})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=O({...e,created_by:this.select(d=>{var p;return((p=d.userReducer.currentUser)==null?void 0:p.id)??null}),submitted_at:new Date().toISOString()});this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(a),blockers:[a.procedure_step],blocks:[a.uuid]});return u.then(d=>{this.dispatch(c(d))}).catch(()=>{this.dispatch(r(a.uuid))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Expected procedure step default assignee with uuid ${e} to exist`);this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{procedure_step__procedure_type__organization:e}},n);return this.dispatch(c(r)),r}}class uR extends v{constructor(){super(...arguments);h(this,"name","Procedure Step Default Reviewer");h(this,"url","/procedure-step-default-reviewers");h(this,"actions",{addOne:qI,addMany:CI,setOne:$I,setMany:UI,updateOne:LI,updateMany:kI,deleteOne:NI,deleteMany:GI,initialize:jI});h(this,"selectors",{selectById:WI,selectByIds:KI})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=O({...e,created_by:this.select(d=>{var p;return((p=d.userReducer.currentUser)==null?void 0:p.id)??null}),submitted_at:new Date().toISOString()});this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(a),blockers:[a.procedure_step],blocks:[a.uuid]});return u.then(d=>{this.dispatch(c(d))}).catch(()=>{this.dispatch(r(a.uuid))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Expected procedure step default reviewer with uuid ${e} to exist`);this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{procedure_step__procedure_type__organization:e}},n);return this.dispatch(c(r)),r}}class lR extends ft{constructor(){super(...arguments);h(this,"name","Procedure Step Event");h(this,"url","/procedure-step-events");h(this,"actions",{addOne:XI,addMany:QI,setOne:xI,setMany:eT,updateOne:tT,updateMany:sT,deleteOne:iT,deleteMany:nT,initialize:JI});h(this,"selectors",{selectById:aT,selectByIds:rT})}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{procedure__project:e}},n)).flat();return this.dispatch(c(a)),a}}class oR extends j{constructor(){super(...arguments);h(this,"name","Procedure Step Fields Attachment");h(this,"url","/procedure-step-fields-attachments");h(this,"actions",{addOne:oT,addMany:vn,setOne:hT,setMany:mT,updateOne:pT,updateMany:yT,deleteOne:fT,deleteMany:En,initialize:lT});h(this,"selectors",{selectById:IT,selectByIds:TT})}getId(e){return e.uuid}getBlockers(e){return[e.fields_revision]}getBlocks(e){return[e.uuid]}buildModel(e){return O({...e,created_by:this.select(n=>{var c;return((c=n.userReducer.currentUser)==null?void 0:c.id)??null}),submitted_at:new Date().toISOString()})}buildPayload(e){const{uuid:n,field_identifier:c,fields_revision:r,file_sha1:a,file_name:u,file_extension:d}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:c,fields_revision:r,file_sha1:a,file_name:u,file_extension:d}}buildBulkPayload(e){const{uuid:n,field_identifier:c,fields_revision:r,file_sha1:a,file_name:u,file_extension:d}=e;return{uuid:n,field_identifier:c,fields_revision:r,file_sha1:a,file_name:u,file_extension:d}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{fields_revision__procedure_step__procedure_type__organization:e}},n);return this.dispatch(c(r)),r}}class hR extends v{constructor(){super(...arguments);h(this,"name","Procedure Step Fields");h(this,"url","/procedure-step-fields");h(this,"actions",{addOne:bT,addMany:_T,setOne:gT,setMany:MT,updateOne:RT,updateMany:wT,deleteOne:vT,deleteMany:ET,initialize:FT});h(this,"selectors",{selectById:BT,selectByIds:VT})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=O({...e,created_by:this.select(d=>{var p;return((p=d.userReducer.currentUser)==null?void 0:p.id)??null}),submitted_at:new Date().toISOString()});this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(a),blockers:[a.procedure_step],blocks:[a.uuid]});return u.then(d=>{this.dispatch(c(d))}).catch(()=>{this.dispatch(r(a.uuid))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Expected procedure step fields with uuid ${e} to exist`);const u=this.select(AT(e));this.dispatch(n(e)),this.dispatch(En(w(u)));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(a)),this.dispatch(vn(u)),d}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{procedure_step__procedure_type__organization:e}},n);return this.dispatch(c(r)),r}}class mR extends j{constructor(){super(...arguments);h(this,"name","Procedure Step Field Values Attachment");h(this,"url","/procedure-step-field-values-attachments");h(this,"actions",{addOne:qT,addMany:jn,setOne:CT,setMany:$T,updateOne:UT,updateMany:LT,deleteOne:kT,deleteMany:qn,initialize:jT});h(this,"selectors",{selectById:GT,selectByIds:HT})}getId(e){return e.uuid}getBlockers(e){return[e.field_values]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(r=>{var a;return((a=r.userReducer.currentUser)==null?void 0:a.id)??null}),c=new Date().toISOString();return O({...e,created_by:n,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:c,field_values:r,file_sha1:a,file_name:u,file_extension:d}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:c,field_values:r,file_sha1:a,file_name:u,file_extension:d}}buildBulkPayload(e){const{uuid:n,field_identifier:c,field_values:r,file_sha1:a,file_name:u,file_extension:d}=e;return{uuid:n,field_identifier:c,field_values:r,file_sha1:a,file_name:u,file_extension:d}}async bulkDelete(e){const{deleteMany:n,addMany:c}=this.actions,{selectByIds:r}=this.selectors,a=this.select(r(e));this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{field_values__procedure__project:e,latest:!0}},n)).flat();return this.dispatch(c(a)),a}}class pR extends v{constructor(){super(...arguments);h(this,"name","Procedure Step Field Values Review");h(this,"url","/procedure-step-field-values-reviews");h(this,"actions",{addOne:lO,addMany:Ln,setOne:oO,setMany:hO,updateOne:mO,updateMany:pO,deleteOne:yO,deleteMany:kn,initialize:uO});h(this,"selectors",{selectById:SO,selectByIds:AO})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=O({...e,created_by:this.select(d=>{var p;return((p=d.userReducer.currentUser)==null?void 0:p.id)??null}),submitted_at:new Date().toISOString()});this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(a),blockers:[a.field_values],blocks:[a.uuid]});return u.then(d=>{this.dispatch(c(d))}).catch(()=>{this.dispatch(r(a.uuid))}),[a,u]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Procedure step field values review with uuid ${e.uuid} not found in store`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Procedure step field values review with uuid ${e} not found in store`);this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{field_values__procedure__project:e}},n)).flat();return this.dispatch(c(a)),a}}class yR extends v{constructor(){super(...arguments);h(this,"name","Procedure Step Field Values");h(this,"url","/procedure-step-field-values");h(this,"actions",{addOne:JT,addMany:XT,setOne:QT,setMany:xT,updateOne:eO,updateMany:tO,deleteOne:sO,deleteMany:iO,initialize:ZT});h(this,"selectors",{selectById:aO,selectByIds:rO})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=O({...e,created_by:a,submitted_at:u}),p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[e.procedure,e.procedure_step,e.fields_revision],blocks:[d.uuid]});return this.dispatch(n(d)),p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,p]}bulkAdd(e,n){const{addMany:c,updateMany:r,deleteMany:a}=this.actions,u=new Date().toISOString(),d=this.select(_=>{var b;return((b=_.userReducer.currentUser)==null?void 0:b.id)??null}),p=[],m=dt(e,Math.min(n??e.length,N)),f=[];for(const _ of m){const b=[],M=[],g=[];for(const E of _){const B=O({...E,values:E.values,created_by:d,submitted_at:u});p.push(B),b.push(R(B)),M.push(B.procedure_step,B.procedure,B.fields_revision),g.push(B.uuid)}f.push({payload:{payloads:b,submitted_at:u},blockers:M,blocks:g})}this.dispatch(c(p));const I=f.map(_=>{const{payload:b,blocks:M,blockers:g}=_;return this.enqueueRequest({description:A(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:b,blockers:g,blocks:M})});return Promise.all(I).then(_=>{this.dispatch(r(_.flat()))}).catch(()=>{this.dispatch(a(w(p)))}),[p,Promise.all(I).then(_=>_.flat())]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Expected ProcedureStepFieldValues with uuid ${e.uuid} to exist`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[a.uuid,a.procedure,a.procedure_step,a.fields_revision],blocks:[a.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Expected ProcedureStepFieldValues with uuid ${e} to exist`);const u=this.select(WT(e)),d=this.select(IO(e));this.dispatch(n(e)),this.dispatch(qn(w(u))),this.dispatch(kn(w(d)));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(p){throw this.dispatch(c(a)),this.dispatch(jn(u)),this.dispatch(Ln(d)),p}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{procedure__project:e}},n)).flat();return this.dispatch(c(a)),a}}class fR extends v{constructor(){super(...arguments);h(this,"name","Procedure Step Reviewer");h(this,"url","/procedure-step-reviewers");h(this,"actions",{addOne:FO,addMany:bO,setOne:_O,setMany:gO,updateOne:MO,updateMany:RO,deleteOne:wO,deleteMany:vO,initialize:PO});h(this,"selectors",{selectById:BO,selectByIds:VO})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=O({...e,created_by:this.select(d=>{var p;return((p=d.userReducer.currentUser)==null?void 0:p.id)??null}),submitted_at:new Date().toISOString()});this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(a),blockers:[a.procedure,a.procedure_step],blocks:[a.uuid]});return u.then(d=>{this.dispatch(c(d))}).catch(()=>{this.dispatch(r(a.uuid))}),[a,u]}bulkAdd(e){const{addMany:n,setMany:c,deleteMany:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=e.map(m=>O({...m,created_by:a,submitted_at:u}));this.dispatch(n(d));const p=this.enqueueRequest({description:A(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:{procedure_step_reviewers:d.map(m=>R(m)),submitted_at:u},blockers:d.flatMap(m=>[m.procedure,m.procedure_step]),blocks:d.map(m=>m.uuid)});return p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(d.map(m=>m.uuid)))}),[d,p]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Expected procedure step reviewer with uuid ${e} to exist`);this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async bulkDelete(e){const{deleteMany:n,addMany:c}=this.actions,{selectByIds:r}=this.selectors,a=this.select(r(e));this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{procedure__project:e}},n)).flat();return this.dispatch(c(a)),a}}class SR extends v{constructor(){super(...arguments);h(this,"name","Procedure Initiative");h(this,"url","/procedure-initiatives");h(this,"actions",{addOne:IA,addMany:TA,setOne:OA,setMany:PA,updateOne:FA,updateMany:bA,deleteOne:_A,deleteMany:gA,initialize:AA});h(this,"selectors",{selectById:wA,selectByIds:vA})}add(e){var p;const{store:n}=this.client,{addOne:c,updateOne:r,deleteOne:a}=this.actions,u=O({...e,created_by:((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,submitted_at:new Date().toISOString()});this.dispatch(c(u));const d=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(u),blockers:[u.procedure_type,u.project],blocks:[u.uuid]});return d.then(m=>{this.dispatch(r(m))}).catch(()=>{this.dispatch(a(u.uuid))}),[u,d]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Expected ${this.name} with uuid ${e.uuid} to exist`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[r.uuid],blocks:[r.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Expected ${this.name} with uuid ${e} to exist`);const u=this.select(WA(e));this.dispatch(n(e)),this.dispatch(_t(w(u)));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(a)),this.dispatch(bt(u)),d}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(c(a)),a}}class AR extends v{constructor(){super(...arguments);h(this,"name","Procedure Step");h(this,"url","/procedure-steps");h(this,"actions",{addOne:$O,addMany:UO,setOne:qO,setMany:CO,updateOne:LO,updateMany:kO,deleteOne:NO,deleteMany:GO,initialize:jO});h(this,"selectors",{selectById:WO,selectByIds:KO})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=O({...e,created_by:this.select(d=>{var p;return((p=d.userReducer.currentUser)==null?void 0:p.id)??null}),submitted_at:new Date().toISOString()});this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(a),blockers:[a.procedure_type],blocks:[a.uuid]});return u.then(d=>{this.dispatch(c(d))}).catch(()=>{this.dispatch(r(a.uuid))}),[a,u]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`No procedure step with uuid ${e.uuid} found in the store`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${r.uuid}/`,payload:e,blockers:[r.uuid],blocks:[r.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{addOne:n,deleteOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`No procedure step with uuid ${e} found in the store`);this.dispatch(c(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(n(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{procedure_type__organization:e}},n);return this.dispatch(c(r)),r}}class IR extends j{constructor(){super(...arguments);h(this,"name","Procedure Type Attachment");h(this,"url","/procedure-type-attachments");h(this,"actions",{addOne:JO,addMany:XO,setOne:QO,setMany:xO,updateOne:eP,updateMany:tP,deleteOne:sP,deleteMany:iP,initialize:ZO});h(this,"selectors",{selectById:aP,selectByIds:rP})}getId(e){return e.uuid}getBlockers(e){return[e.procedure_type]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(r=>{var a;return((a=r.userReducer.currentUser)==null?void 0:a.id)??null}),c=new Date().toISOString();return O({...e,created_by:n,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,procedure_type:e.procedure_type}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,procedure_type:e.procedure_type}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{procedure_type__organization:e}},n);return this.dispatch(c(r)),r}}class TR extends j{constructor(){super(...arguments);h(this,"name","Procedure Type Fields Attachment");h(this,"url","/procedure-type-fields-attachments");h(this,"actions",{addOne:lP,addMany:oP,setOne:hP,setMany:mP,updateOne:pP,updateMany:yP,deleteOne:fP,deleteMany:SP,initialize:uP});h(this,"selectors",{selectById:TP,selectByIds:OP})}getId(e){return e.uuid}getBlockers(e){return[e.fields_revision]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(r=>{var a;return((a=r.userReducer.currentUser)==null?void 0:a.id)??null}),c=new Date().toISOString();return O({...e,created_by:n,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:c,fields_revision:r,file_sha1:a,file_name:u,file_extension:d}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:c,fields_revision:r,file_sha1:a,file_name:u,file_extension:d}}buildBulkPayload(e){const{uuid:n,field_identifier:c,fields_revision:r,file_sha1:a,file_name:u,file_extension:d}=e;return{uuid:n,field_identifier:c,fields_revision:r,file_sha1:a,file_name:u,file_extension:d}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{fields_revision__procedure_type__organization:e}},n);return this.dispatch(c(r)),r}}class OR extends v{constructor(){super(...arguments);h(this,"name","Procedure Type Fields");h(this,"url","/procedure-type-fields");h(this,"actions",{addOne:bP,addMany:_P,setOne:gP,setMany:MP,updateOne:RP,updateMany:wP,deleteOne:vP,deleteMany:EP,initialize:FP});h(this,"selectors",{selectById:zP,selectByIds:DP})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=O({...e,created_by:a,submitted_at:u});this.dispatch(n(d));const p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[d.procedure_type],blocks:[d.uuid]});return p.then(m=>{this.dispatch(c(m))}).catch(m=>{throw this.dispatch(r(d.uuid)),m}),[d,p]}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{procedure_type__organization:e}},n);return this.dispatch(c(r)),r}}class PR extends j{constructor(){super(...arguments);h(this,"name","Procedure Field Values Attachment");h(this,"url","/procedure-field-values-attachments");h(this,"actions",{addOne:CP,addMany:xn,setOne:$P,setMany:UP,updateOne:LP,updateMany:kP,deleteOne:NP,deleteMany:ec,initialize:qP});h(this,"selectors",{selectById:WP,selectByIds:KP})}getId(e){return e.uuid}getBlockers(e){return[e.field_values]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(r=>{var a;return((a=r.userReducer.currentUser)==null?void 0:a.id)??null}),c=new Date().toISOString();return O({...e,created_by:n,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:c,field_values:r,file_sha1:a,file_name:u,file_extension:d}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:c,field_values:r,file_sha1:a,file_name:u,file_extension:d}}buildBulkPayload(e){const{uuid:n,field_identifier:c,field_values:r,file_sha1:a,file_name:u,file_extension:d}=e;return{uuid:n,field_identifier:c,field_values:r,file_sha1:a,file_name:u,file_extension:d}}async bulkDelete(e){const{deleteMany:n,addMany:c}=this.actions,{selectByIds:r}=this.selectors,a=this.select(r(e));this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{field_values__procedure__project:e,latest:!0}},n)).flat();return this.dispatch(c(a)),a}}class FR extends v{constructor(){super(...arguments);h(this,"name","Procedure Field Values");h(this,"url","/procedure-field-values");h(this,"actions",{addOne:XP,addMany:QP,setOne:xP,setMany:eF,updateOne:tF,updateMany:sF,deleteOne:iF,deleteMany:nF,initialize:JP});h(this,"selectors",{selectById:rF,selectByIds:dF})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=O({...e,created_by:a,submitted_at:u}),p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[e.fields_revision,e.procedure],blocks:[d.uuid]});return this.dispatch(n(d)),p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,p]}bulkAdd(e,n){const{addMany:c,updateMany:r,deleteMany:a}=this.actions,u=new Date().toISOString(),d=this.select(_=>{var b;return((b=_.userReducer.currentUser)==null?void 0:b.id)??null}),p=[],m=dt(e,Math.min(n??e.length,N)),f=[];for(const _ of m){const b=[],M=[],g=[];for(const E of _){const B=O({...E,values:E.values,created_by:d,submitted_at:u});p.push(B),b.push(R(B)),M.push(B.procedure,B.fields_revision),g.push(B.uuid)}f.push({payload:{payloads:b,submitted_at:u},blockers:M,blocks:g})}this.dispatch(c(p));const I=f.map(_=>{const{payload:b,blocks:M,blockers:g}=_;return this.enqueueRequest({description:A(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:b,blockers:g,blocks:M})});return Promise.all(I).then(_=>{this.dispatch(r(_.flat()))}).catch(()=>{this.dispatch(a(w(p)))}),[p,Promise.all(I).then(_=>_.flat())]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Expected ProcedureFieldValues with uuid ${e.uuid} to exist`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[a.fields_revision,a.procedure],blocks:[a.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Expected submission with uuid ${e} to exist`);const u=this.select(YP(e));this.dispatch(n(e)),this.dispatch(ec(w(u)));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(a)),this.dispatch(xn(u)),d}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{procedure__project:e,latest:!0}},n)).flat();return this.dispatch(c(a)),a}}class bR extends v{constructor(){super(...arguments);h(this,"name","Procedure Type");h(this,"url","/procedure-types");h(this,"actions",{addOne:oF,addMany:hF,setOne:mF,setMany:pF,updateOne:yF,updateMany:fF,deleteOne:SF,deleteMany:AF,initialize:lF});h(this,"selectors",{selectById:OF,selectByIds:PF})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=O({...e,created_by:this.select(d=>{var p;return((p=d.userReducer.currentUser)==null?void 0:p.id)??null}),submitted_at:new Date().toISOString()});this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(a),blockers:[],blocks:[a.uuid]});return u.then(d=>{this.dispatch(c(d))}).catch(()=>{this.dispatch(r(a.uuid))}),[a,u]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Expected procedure type with uuid ${e.uuid} to exist`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[r.uuid],blocks:[r.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Expected procedure type with uuid ${e} to exist`);const u=this.select(NA(e));this.dispatch(n(e)),this.dispatch(_t(w(u)));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(a)),this.dispatch(bt(u)),d}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{organization:e}},n);return this.dispatch(c(r)),r}}class _R extends v{constructor(){super(...arguments);h(this,"name","Team Membership");h(this,"url","/team-memberships");h(this,"actions",{addOne:gF,addMany:MF,setOne:RF,setMany:wF,updateOne:vF,updateMany:EF,deleteOne:BF,deleteMany:VF,initialize:_F});h(this,"selectors",{selectById:jF,selectByIds:qF})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=O({...e,created_by:this.select(d=>{var p;return((p=d.userReducer.currentUser)==null?void 0:p.id)??null})});this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(a),blockers:[e.team],blocks:[a.uuid]});return u.then(d=>{this.dispatch(c(d))}).catch(()=>{this.dispatch(r(a.uuid))}),[a,u]}bulkAdd(e){const{addMany:n,setMany:c,deleteMany:r}=this.actions,a=this.select(p=>{var m;return((m=p.userReducer.currentUser)==null?void 0:m.id)??null}),u=e.map(p=>O({...p,created_by:a}));this.dispatch(n(u));const d=this.enqueueRequest({description:A(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:{team_memberships:u.map(p=>R(p))},blockers:u.map(p=>p.team),blocks:u.map(p=>p.uuid)});return d.then(p=>{this.dispatch(c(p))}).catch(()=>{this.dispatch(r(u.map(p=>p.uuid)))}),[u,d]}async delete(e){const{addOne:n,deleteOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Expected team membership with uuid ${e} to exist`);this.dispatch(c(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(u){throw this.dispatch(n(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{team__organization:e}},n);return this.dispatch(c(r)),r}}class gR extends v{constructor(){super(...arguments);h(this,"name","Team");h(this,"url","/teams");h(this,"actions",{addOne:UF,addMany:LF,setOne:kF,setMany:NF,updateOne:GF,updateMany:HF,deleteOne:WF,deleteMany:KF,initialize:$F});h(this,"selectors",{selectById:ZF,selectByIds:JF})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=O({...e,submitted_at:new Date().toISOString(),created_by:this.select(d=>{var p;return((p=d.userReducer.currentUser)==null?void 0:p.id)??null})});this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(a),blockers:[],blocks:[a.uuid]});return u.then(d=>{this.dispatch(c(d))}).catch(()=>{this.dispatch(r(a.uuid))}),[a,u]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Expected team with uuid ${e.uuid} to exist`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:R(e),blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{addOne:n,deleteOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Expected team with uuid ${e} to exist`);this.dispatch(c(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(u){throw this.dispatch(n(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{organization:e}},n);return this.dispatch(c(r)),r}}class MR extends ft{constructor(){super(...arguments);h(this,"name","User");h(this,"url","/user");h(this,"actions",{addOne:rn,addMany:mf,setOne:hf,setMany:of,updateOne:yf,updateMany:pf,deleteOne:dn,deleteMany:ff,initialize:lf});h(this,"selectors",{selectById:ss,selectByIds:If})}async list(e,n){const{organizationUuid:c,...r}=e,a=c?`/organizations/${c}${this.url}s/`:`/${this.url}`;return this.performRequest({method:o.GET,url:a,...r},n)}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({organizationUuid:e},n);return this.dispatch(c(r)),r}}async function pc(t,s,e,n,c){const r=n instanceof yt;r&&s.checkAuth!==!1&&await n.auth.prepareAuth();const a={queryParams:"",isAuthNeeded:!0},{s3url:u,payload:d,headers:p,method:m,queryParams:f,attachmentHash:I,isExternalUrl:_,isAuthNeeded:b,isResponseBlob:M}={...a,...s};let g=s.url;const E=I?await e.files.getFileFromCache(I):void 0;if(I&&!E)throw new Error(`Cannot upload file ${I} because it's not cached.`);!_&&!g.startsWith("http")&&(!g.startsWith("/")&&!g.startsWith("blob:")&&(g="/"+g),g=t+g);const B=q=>{if(I){if(!u)throw new Error(`No S3 URL for file ${I}`);if("warning"in u)throw new Error(`S3 URL warning for file ${I}`);if(!E)throw new Error(`No file for file ${I}`);const G=u.fields["x-amz-checksum-sha1"];if(!G)throw new Error(`No checksum for file ${I}`);return q.set("x-amz-checksum-sha1",G).field({...d,...u.fields}).attach("file",E)}return q.send(d)},z={[o.GET]:()=>M?It.get(g.toString()).responseType("blob"):It.get(g.toString()),[o.POST]:()=>{const q=It.post(g.toString());return B(q)},[o.PATCH]:()=>{const q=It.patch(g.toString());return B(q)},[o.PUT]:()=>{const q=It.put(g.toString());return B(q)},[o.DELETE]:()=>{const q=It.delete(g.toString());return B(q)}}[m];let D=z();const At=()=>{console.debug("aborting request:",s.url),D.abort()};if(c==null||c.addEventListener("abort",At),b&&r){const q=n.auth.getAuthHeader();D=D.set("Authorization",q)}p&&(D=D.set(p));try{return await D.query(f)}catch(q){const G=rb(q),ls=G==null?void 0:G.status;if(r&&ls===401)return await n.auth.handleUnauthorized(D,G),D.query(f);throw new U({response:G,innerError:q,discard:oc.includes(ls)})}finally{c==null||c.removeEventListener("abort",At)}}class RR{constructor(s){h(this,"store");this.store=s}_performRequest(s,e,n,c){const r=new os,a={...e,uuid:e.uuid??ut.v4()};return pc(s,a,this,n,c).then(u=>{r.resolve(u.body)}).catch(u=>{u instanceof Error?r.reject(u):r.reject(new Error((u??gt).toString()))}),r}async performRequest(s,e,n,c){return this._performRequest(s,e,n,c).then(r=>{if(r instanceof U)throw r;return r})}async enqueueRequest(s,e,n){return this._enqueueRequest(s,e,n).then(c=>{if(c instanceof U)throw c;return c})}_enqueueRequest(s,e,n){const c=new os,r={...s,BASE_URL:e,serviceName:n},a=this.store.dispatch(Xf(r)),u=p=>{if(p)c.resolve(p.body);else{const m=new U({message:"Could not get a response from the server.",response:p,discard:!0});c.reject(m)}},d=p=>{p instanceof U?p.options.discard=!0:(console.error("Received an unexpected error while processing a request:",p,`
13
+ external URLs and therefore not prepended with VITE_API_URL.`;throw new Error(f)}return await this.cacheFile(p),p}processPresignedUrl(e,n){if("warning"in n){if(n.warning==="already_uploaded")return Promise.resolve(void 0);throw console.error(n.warning),new Error(n.warning)}return this.enqueueRequest({url:n.url,description:"Upload file to S3",method:o.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:e,blockers:[`s3-${n.fields.key}`],blocks:[e],s3url:n})}processPresignedUrls(e){const n={};for(const[c,r]of Object.entries(e))n[c]=this.processPresignedUrl(c,r);return n}async getFilePayload(e){const c={sha1:await Ct(e),file_type:e.type,extension:Ec(e),size:e.size};return await this.client.files.cacheFile(e),c}async cachePresignedUrl(e,n){if(mc.has(e))return;const c=await this.getDB();!!await c.get("presignedUrls",e)?console.warn(`Attempting to add a presigned url already cached, ${n}`):await c.put("presignedUrls",n,e),mc.add(e)}async uncachePresignedUrl(e){await(await this.getDB()).delete("presignedUrls",e),mc.delete(e)}async getPresignedUrlFromCache(e){const n=await(await this.getDB()).get("presignedUrls",e);if(!n)return;if(Cc(n)){await this.uncachePresignedUrl(e);return}return n}}class bM extends v{constructor(){super(...arguments);h(this,"name","Form Identifier");h(this,"url","/form-identifiers");h(this,"actions",{addOne:Wu,addMany:Ku,setOne:Yu,setMany:Zu,updateOne:Ju,updateMany:Xu,deleteOne:Qu,deleteMany:xu,initialize:Hu});h(this,"selectors",{selectById:tl,selectByIds:sl})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=O({...e,created_by:a,submitted_at:u});this.dispatch(n(d));const p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[d.form],blocks:[d.uuid]});return p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,p]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Expected form identifier with uuid ${e.uuid} to exist`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Expected form identifier with uuid ${e} to exist`);this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{form__organization:e}},n);return this.dispatch(c(r)),r}}class _M extends v{constructor(){super(...arguments);h(this,"name","Form Identifier Value");h(this,"url","/form-identifier-values");h(this,"actions",{addOne:al,addMany:rl,setOne:dl,setMany:ul,updateOne:ll,updateMany:ol,deleteOne:hl,deleteMany:ml,initialize:cl});h(this,"selectors",{selectById:yl,selectByIds:fl})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=O({...e,created_by:a,submitted_at:u});this.dispatch(n(d));const p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[e.form_submission,e.form_identifier],blocks:[d.uuid]});return p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,p]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Expected form identifier value with uuid ${e} to exist`);this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await Promise.all([this.listPaginated({queryParams:{limit:this.pageSize,paginate:!0,form_submission__organization:e}},n),this.listPaginated({queryParams:{limit:this.pageSize,paginate:!0,form_submission__project__organization:e}},n)])).flatMap(u=>u.flat());return this.dispatch(c(a)),a}}class gM extends j{constructor(){super(...arguments);h(this,"name","Form Revision Attachment");h(this,"url","/form-revision-attachments");h(this,"actions",{addOne:Tl,addMany:Ol,setOne:Pl,setMany:Fl,updateOne:bl,updateMany:_l,deleteOne:gl,deleteMany:Ml,initialize:Il});h(this,"selectors",{selectById:wl,selectByIds:vl})}getId(e){return e.uuid}getBlockers(e){return[e.form_revision]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(r=>{var a;return((a=r.userReducer.currentUser)==null?void 0:a.id)??null}),c=new Date().toISOString();return O({...e,created_by:n,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:c,form_revision:r,file_sha1:a,file_name:u,file_extension:d}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:c,form_revision:r,file_sha1:a,file_name:u,file_extension:d}}buildBulkPayload(e){const{uuid:n,field_identifier:c,form_revision:r,file_sha1:a,file_name:u,file_extension:d}=e;return{uuid:n,field_identifier:c,form_revision:r,file_sha1:a,file_name:u,file_extension:d}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{form_revision__form__organization:e}},n);return this.dispatch(c(r)),r}}class MM extends v{constructor(){super(...arguments);h(this,"name","Form Revision");h(this,"url","/form-revisions");h(this,"actions",{addOne:zl,addMany:ii,setOne:Dl,setMany:jl,updateOne:ql,updateMany:Cl,deleteOne:$l,deleteMany:ni,initialize:Vl});h(this,"selectors",{selectById:Ll,selectByIds:kl})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=O({...e,created_by:a,submitted_at:u});this.dispatch(n(d));const p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[e.form],blocks:[d.uuid]});return p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,p]}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{form__organization:e}},n);return this.dispatch(c(r)),r}}class RM extends v{constructor(){super(...arguments);h(this,"name","Form");h(this,"url","/forms");h(this,"actions",{addOne:ao,addMany:ro,setOne:uo,setMany:lo,updateOne:oo,updateMany:ho,deleteOne:mo,deleteMany:po,initialize:co});h(this,"selectors",{selectById:So,selectByIds:Ao})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=new Date().toISOString(),u=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),d=O({...e,submitted_at:a,created_by:u});this.dispatch(n(d));const p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[],blocks:[d.uuid]});return p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,p]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Expected form with uuid ${e.uuid} to exist`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[r.uuid],blocks:[r.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error("Expected form to exist");const u=this.select(ko(e)),d=this.select(Nl(e)),p=this.select(so(e));this.dispatch(n(e)),this.dispatch(ot(w(u))),this.dispatch(ni(w(d))),this.dispatch(ri(w(p)));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(m){throw this.dispatch(c(a)),this.dispatch(ii(d)),this.dispatch(lt(u)),this.dispatch(ai(p)),m}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{organization:e}},n);return this.dispatch(c(r)),r}}class wM extends v{constructor(){super(...arguments);h(this,"name","Form Subscriber");h(this,"url","/form-subscribers");h(this,"actions",{addOne:Kl,addMany:ai,setOne:Yl,setMany:Zl,updateOne:Jl,updateMany:Xl,deleteOne:Ql,deleteMany:ri,initialize:Wl});h(this,"selectors",{selectById:eo,selectByIds:to})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=new Date().toISOString(),u=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),d=O({...e,created_by:u,submitted_at:a});this.dispatch(n(d));const p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[d.form],blocks:[d.uuid]});return p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,p]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Expected form subscriber with uuid ${e} to exist`);this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{form__organization:e}},n);return this.dispatch(c(r)),r}}class vM extends j{constructor(){super(...arguments);h(this,"name","Form Submission Attachment");h(this,"url","/form-submission-attachments");h(this,"actions",{addOne:Oo,addMany:oi,setOne:Po,setMany:Fo,updateOne:bo,updateMany:_o,deleteOne:go,deleteMany:hi,initialize:To});h(this,"selectors",{selectById:Mo,selectByIds:Ro})}getId(e){return e.uuid}getBlockers(e){return[e.form_submission]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(r=>{var a;return((a=r.userReducer.currentUser)==null?void 0:a.id)??null}),c=new Date().toISOString();return O({...e,created_by:n,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:c,form_submission:r,file_sha1:a,file_name:u,file_extension:d}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:c,form_submission:r,file_sha1:a,file_name:u,file_extension:d}}buildBulkPayload(e){const{uuid:n,field_identifier:c,form_submission:r,file_sha1:a,file_name:u,file_extension:d}=e;return{uuid:n,field_identifier:c,form_submission:r,file_sha1:a,file_name:u,file_extension:d}}async bulkDelete(e){const{deleteMany:n,addMany:c}=this.actions,r=this.select(yi(e));this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(a){throw this.dispatch(c(r)),a}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await Promise.all([this.listPaginated({queryParams:{limit:this.pageSize,paginate:!0,form_submission__organization:e}},n),this.listPaginated({queryParams:{limit:this.pageSize,paginate:!0,form_submission__project__organization:e}},n)])).flatMap(u=>u.flat());return this.dispatch(c(a)),a}}class EM extends v{constructor(){super(...arguments);h(this,"name","Form Submission");h(this,"url","/form-submissions");h(this,"actions",{addOne:Do,addMany:lt,setOne:Vo,setMany:zo,updateOne:jo,updateMany:qo,deleteOne:Co,deleteMany:ot,initialize:Bo});h(this,"selectors",{selectById:Uo,selectByIds:Lo})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=O({...e,created_by:a,submitted_at:u}),p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[e.form_revision],blocks:[d.uuid]});return this.dispatch(n(d)),p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,p]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Expected submission with uuid ${e.uuid} to exist`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${a.uuid}/`,payload:e,blockers:[a.uuid],blocks:[a.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Expected submission with uuid ${e} to exist`);const u=this.select(wo(e));this.dispatch(n(e)),this.dispatch(hi(w(u)));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(a)),this.dispatch(oi(u)),d}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await Promise.all([this.listPaginated({queryParams:{limit:this.pageSize,paginate:!0,organization:e}},n),this.listPaginated({queryParams:{limit:this.pageSize,paginate:!0,project__organization:e}},n)])).flatMap(u=>u.flat());return this.dispatch(c(a)),a}}class BM extends j{constructor(){super(...arguments);h(this,"name","Geo Image");h(this,"url","/geo-images");h(this,"actions",{addOne:Qo,addMany:xo,setOne:Jo,setMany:Xo,updateOne:eh,updateMany:th,deleteOne:sh,deleteMany:ih,initialize:Zo});h(this,"selectors",{selectById:ch,selectByIds:ah})}getId(e){return e.uuid}getBlockers(e){return[e.project]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(r=>{var a;return((a=r.userReducer.currentUser)==null?void 0:a.id)??null}),c=new Date().toISOString();return O({...e,created_by:n,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_sha1:e.file_sha1,file_name:e.file_name,file_extension:e.file_extension,title:e.title,description:e.description,geo_marker:e.geo_marker,canvas_marker:e.canvas_marker,direction:e.direction,original_date:e.original_date,project:e.project}}buildBulkPayload(e){return{uuid:e.uuid,file_sha1:e.file_sha1,file_name:e.file_name,file_extension:e.file_extension,title:e.title,description:e.description,geo_marker:e.geo_marker,canvas_marker:e.canvas_marker,direction:e.direction,original_date:e.original_date,project:e.project}}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Geo image with uuid ${e.uuid} does not exist in the store`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{project:e}},n);return this.dispatch(c(r)),r}}class VM extends v{constructor(){super(...arguments);h(this,"name","Issue Association");h(this,"url","/issue-associations");h(this,"actions",{addOne:ph,addMany:Ot,setOne:oh,setMany:lh,updateOne:hh,updateMany:mh,deleteOne:yh,deleteMany:Pt,initialize:uh});h(this,"selectors",{selectById:Sh,selectByIds:Ah})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=new Date().toISOString(),u=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),d=O({...e,submitted_at:a,created_by:u});this.dispatch(n(d));const p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[e.issue,e.asset],blocks:[d.uuid]});return p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,p]}bulkAdd(e){const{addMany:n,deleteMany:c,updateMany:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=e.map(m=>O({...m,submitted_at:u,created_by:a}));this.dispatch(n(d));const p=this.enqueueRequest({description:A(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:{payloads:d.map(m=>R(m)),submitted_at:u},blockers:d.flatMap(m=>[m.issue,m.asset]),blocks:w(d)});return p.then(m=>{this.dispatch(r(m))}).catch(()=>{this.dispatch(c(w(d)))}),[d,p]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Issue association with uuid ${e} not found in store.`);this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(c(a)),a}}class zM extends j{constructor(){super(...arguments);h(this,"name","Issue Attachment");h(this,"url","/issue-attachments");h(this,"actions",{addOne:gh,addMany:Oi,setOne:Mh,setMany:Rh,updateOne:wh,updateMany:vh,deleteOne:Eh,deleteMany:Pi,initialize:_h});h(this,"selectors",{selectById:zh,selectByIds:Dh})}getId(e){return e.uuid}getBlockers(e){return[e.issue]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(r=>{var a;return((a=r.userReducer.currentUser)==null?void 0:a.id)??null}),c=new Date().toISOString();return O({...e,created_by:n,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue:e.issue}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue:e.issue}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(c(a)),a}}class DM extends j{constructor(){super(...arguments);h(this,"name","Issue Comment Attachment");h(this,"url","/issue-comment-attachments");h(this,"actions",{addOne:$h,addMany:Uh,setOne:Lh,setMany:kh,updateOne:Nh,updateMany:Gh,deleteOne:Hh,deleteMany:Wh,initialize:Ch});h(this,"selectors",{selectById:Yh,selectByIds:Zh})}getId(e){return e.uuid}getBlockers(e){return[e.issue_comment]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(r=>{var a;return((a=r.userReducer.currentUser)==null?void 0:a.id)??null}),c=new Date().toISOString();return O({...e,created_by:n,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue_comment:e.issue_comment}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue_comment:e.issue_comment}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{issue_comment__issue__project:e}},n)).flat();return this.dispatch(c(a)),a}}class jM extends v{constructor(){super(...arguments);h(this,"name","Issue Comment");h(this,"url","/issue-comments");h(this,"actions",{addOne:xh,addMany:em,setOne:tm,setMany:sm,updateOne:im,updateMany:nm,deleteOne:cm,deleteMany:am,initialize:Qh});h(this,"selectors",{selectById:rm,selectByIds:dm})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=O({...e,created_by:this.select(d=>d.userReducer.currentUser.id),submitted_at:new Date().toISOString()});this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(a),blockers:[e.issue],blocks:[a.uuid]});return u.then(d=>{this.dispatch(c(d))}).catch(()=>{this.dispatch(r(a.uuid))}),[a,u]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Comment with uuid ${e.uuid} not found in store`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Comment with uuid ${e} not found in store`);this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(c(a)),a}}class qM extends v{constructor(){super(...arguments);h(this,"name","Issue");h(this,"url","/issues");h(this,"actions",{addOne:hm,addMany:wi,setOne:mm,setMany:pm,updateOne:ym,updateMany:fm,deleteOne:Sm,deleteMany:vi,initialize:om});h(this,"selectors",{selectById:Im,selectByIds:Tm})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=new Date().toISOString(),u=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),d=O({...e,submitted_at:a,created_by:u});this.dispatch(n(d));const p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[d.project,d.issue_type,d.status,d.priority],blocks:[d.uuid]});return p.then(m=>{this.dispatch(c(m))}).catch(m=>{throw this.dispatch(r(d.uuid)),m}),[d,p]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Attempting to update an issue with uuid ${e.uuid} that doesn't exist in the store`);const a={...r,...e};this.dispatch(n(a));const u={};for(const m of[$.TITLE,$.DESCRIPTION,$.STATUS,$.PRIORITY,$.ASSIGNED_TO,$.DUE_DATE])if(m in e&&e[m]!==r[m])switch(m){case $.PRIORITY:{const f=e[m],I=this.select(Wi(f));if(!I)throw new Error(`Trying to update issue type priority with ${f} which does not exist in store`);u[m]={name:I.name,color:I.color,uuid:I.uuid};break}case $.DUE_DATE:u[m]=e.due_date;break;case $.DESCRIPTION:u[m]=e.description??"";break;case $.TITLE:u[m]=e.title??"";break;case $.STATUS:{const f=e[m],I=this.select(Xi(f));if(!I)throw new Error(`Trying to update issue type status with ${f} which does not exist in store`);u[m]={name:I.name,color:I.color,uuid:I.uuid};break}case $.ASSIGNED_TO:{const f=e[m];if(f===null)u[m]=null;else{const I=this.select(ss(f));if(!I)throw new Error(`Trying to update assigned to with ${f} which does not exist in store.`);u[m]={full_name:I.username,id:I.id}}break}}const d=O({created_by:this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),submitted_at:new Date().toISOString(),issue:r.uuid,changes:u});this.dispatch(xi(d));const p=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return p.then(m=>{this.dispatch(n(m))}).catch(()=>{this.dispatch(n(r)),this.dispatch(tn(d.uuid))}),[a,p]}bulkUpdate(e,n){const{updateMany:c}=this.actions,{selectByIds:r}=this.selectors,a=w(e).toSorted($t);if(a.length!==e.length)throw new Error("payloads contains duplicate uuids.");const u=this.select(r(a)).toSorted(fs);if(a.length!=u.length)throw new Error(`Attempting to bulk update ${a.length-u.length} issues that dont exist in the store`);const d=[];for(let I=0;I<a.length;I++)d.push({...u[I],...e[I]});this.dispatch(c(d));const p=dt(e,Math.min(n??e.length,N)),m=[];let f=null;for(const I of p){const _=ut.v4(),b=w(I),M=I.map(({status:B})=>B).filter(Boolean),g=I.map(({priority:B})=>B).filter(Boolean),E=this.enqueueRequest({description:A(o.PATCH,this.name,!0),method:o.PATCH,url:`${this.url}/bulk/`,payload:{payloads:I},blockers:(f?[f]:[]).concat(b).concat(M).concat(g),blocks:[_].concat(b)});m.push(E),f=_}return Promise.all(m).then(I=>{this.dispatch(c(I.flat()))}).catch(()=>{this.dispatch(c(u))}),[d,m]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`No issue with uuid ${e} found in the store`);const u=this.select(Th(e)),d=this.select(Vh(e)),p=this.select(rf(e)),m=this.select(No(e));this.dispatch(n(e)),this.dispatch(Pi(w(d))),this.dispatch(sn(w(p))),this.dispatch(Pt(w(u))),this.dispatch(ot(w(m)));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(f){throw this.dispatch(c(a)),this.dispatch(Oi(d)),this.dispatch(en(p)),this.dispatch(Ot(u)),this.dispatch(lt(m)),f}}async bulkDelete(e){const{addMany:n,deleteMany:c}=this.actions,{selectByIds:r}=this.selectors,a=this.select(r(e)),u=this.select(Ih(e)),d=this.select(Go(e));this.dispatch(c(e)),this.dispatch(Pt(w(u))),this.dispatch(ot(w(d)));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(p){throw this.dispatch(n(a)),this.dispatch(Ot(u)),this.dispatch(lt(d)),p}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(c(a)),a}}class CM extends j{constructor(){super(...arguments);h(this,"name","Issue Type Attachment");h(this,"url","/issue-type-attachments");h(this,"actions",{addOne:_m,addMany:gm,setOne:Mm,setMany:Rm,updateOne:wm,updateMany:vm,deleteOne:Em,deleteMany:Bm,initialize:bm});h(this,"selectors",{selectById:zm,selectByIds:Dm})}getId(e){return e.uuid}getBlockers(e){return[e.issue_type]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(r=>{var a;return((a=r.userReducer.currentUser)==null?void 0:a.id)??null}),c=new Date().toISOString();return O({...e,created_by:n,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue_type:e.issue_type}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue_type:e.issue_type}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(c(r)),r}}class $M extends j{constructor(){super(...arguments);h(this,"name","Issue Type Fields Attachment");h(this,"url","/issue-type-fields-attachments");h(this,"actions",{addOne:$m,addMany:Um,setOne:Lm,setMany:km,updateOne:Nm,updateMany:Gm,deleteOne:Hm,deleteMany:Wm,initialize:Cm});h(this,"selectors",{selectById:Ym,selectByIds:Zm})}getId(e){return e.uuid}getBlockers(e){return[e.fields_revision]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(r=>{var a;return((a=r.userReducer.currentUser)==null?void 0:a.id)??null}),c=new Date().toISOString();return O({...e,created_by:n,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:c,fields_revision:r,file_sha1:a,file_name:u,file_extension:d}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:c,fields_revision:r,file_sha1:a,file_name:u,file_extension:d}}buildBulkPayload(e){const{uuid:n,field_identifier:c,fields_revision:r,file_sha1:a,file_name:u,file_extension:d}=e;return{uuid:n,field_identifier:c,fields_revision:r,file_sha1:a,file_name:u,file_extension:d}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{fields_revision__issue_type__organization:e}},n);return this.dispatch(c(r)),r}}class UM extends v{constructor(){super(...arguments);h(this,"name","Issue Type Fields");h(this,"url","/issue-type-fields");h(this,"actions",{addOne:mp,addMany:pp,setOne:yp,setMany:fp,updateOne:Sp,updateMany:Ap,deleteOne:Ip,deleteMany:Tp,initialize:hp});h(this,"selectors",{selectById:Pp,selectByIds:Fp})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=O({...e,created_by:a,submitted_at:u});this.dispatch(n(d));const p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[d.issue_type],blocks:[d.uuid]});return p.then(m=>{this.dispatch(c(m))}).catch(m=>{throw this.dispatch(r(d.uuid)),m}),[d,p]}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(c(r)),r}}class LM extends j{constructor(){super(...arguments);h(this,"name","Issue Type Field Values Attachment");h(this,"url","/issue-type-field-values-attachments");h(this,"actions",{addOne:Mp,addMany:Ci,setOne:Rp,setMany:wp,updateOne:vp,updateMany:Ep,deleteOne:Bp,deleteMany:$i,initialize:gp});h(this,"selectors",{selectById:zp,selectByIds:Dp})}getId(e){return e.uuid}getBlockers(e){return[e.field_values]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(r=>{var a;return((a=r.userReducer.currentUser)==null?void 0:a.id)??null}),c=new Date().toISOString();return O({...e,created_by:n,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:c,field_values:r,file_sha1:a,file_name:u,file_extension:d}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:c,field_values:r,file_sha1:a,file_name:u,file_extension:d}}buildBulkPayload(e){const{uuid:n,field_identifier:c,field_values:r,file_sha1:a,file_name:u,file_extension:d}=e;return{uuid:n,field_identifier:c,field_values:r,file_sha1:a,file_name:u,file_extension:d}}async bulkDelete(e){const{deleteMany:n,addMany:c}=this.actions,{selectByIds:r}=this.selectors,a=this.select(r(e));this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{field_values__issue__project:e,latest:!0}},n)).flat();return this.dispatch(c(a)),a}}class kM extends v{constructor(){super(...arguments);h(this,"name","Issue Type Field Values");h(this,"url","/issue-type-field-values");h(this,"actions",{addOne:xm,addMany:ep,setOne:tp,setMany:sp,updateOne:ip,updateMany:np,deleteOne:cp,deleteMany:ap,initialize:Qm});h(this,"selectors",{selectById:dp,selectByIds:up})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=O({...e,created_by:a,submitted_at:u}),p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[e.issue,e.fields_revision],blocks:[d.uuid]});return this.dispatch(n(d)),p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,p]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Expected IssueTypeFieldValues with uuid ${e.uuid} to exist`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[a.uuid,a.fields_revision,a.issue],blocks:[a.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Expected submission with uuid ${e} to exist`);const u=this.select(jp(e));this.dispatch(n(e)),this.dispatch($i(w(u)));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(a)),this.dispatch(Ci(u)),d}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{issue__project:e,latest:!0}},n)).flat();return this.dispatch(c(a)),a}}class NM extends v{constructor(){super(...arguments);h(this,"name","Issue Type Identifier");h(this,"url","/issue-type-identifiers");h(this,"actions",{addOne:Up,addMany:Lp,setOne:kp,setMany:Np,updateOne:Gp,updateMany:Hp,deleteOne:Wp,deleteMany:Kp,initialize:$p});h(this,"selectors",{selectById:Zp,selectByIds:Jp})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=O({...e,created_by:a,submitted_at:u});this.dispatch(n(d));const p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[d.issue_type],blocks:[d.uuid]});return p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,p]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Expected issue type identifier with uuid ${e.uuid} to exist`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Expected issue type identifier with uuid ${e} to exist`);this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(c(r)),r}}class GM extends v{constructor(){super(...arguments);h(this,"name","Issue Type Identifier Value");h(this,"url","/issue-type-identifier-values");h(this,"actions",{addOne:ey,addMany:ty,setOne:sy,setMany:iy,updateOne:ny,updateMany:cy,deleteOne:ay,deleteMany:ry,initialize:xp});h(this,"selectors",{selectById:uy,selectByIds:ly})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=O({...e,created_by:a,submitted_at:u});this.dispatch(n(d));const p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[e.issue,e.issue_type_identifier],blocks:[d.uuid]});return p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,p]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Expected issue type identifier value with uuid ${e} to exist`);this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{issue__project:e,latest:!0}},n)).flat();return this.dispatch(c(a)),a}}class HM extends v{constructor(){super(...arguments);h(this,"name","Issue Type Priority");h(this,"url","/issue-type-priorities");h(this,"actions",{addOne:py,addMany:yy,setOne:fy,setMany:Sy,updateOne:Ay,updateMany:Iy,deleteOne:Ty,deleteMany:Oy,initialize:my});h(this,"selectors",{selectById:Wi,selectByIds:Fy})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=O({...e,created_by:a,submitted_at:u});this.dispatch(n(d));const p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[e.issue_type],blocks:[d.uuid]});return p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,p]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Expected an existing issue type priority with uuid ${e.uuid}`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`No issue type priority with uuid ${e} found in the store`);this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(c(r)),r}}class WM extends v{constructor(){super(...arguments);h(this,"name","Issue Type");h(this,"url","/issue-types");h(this,"actions",{addOne:My,addMany:Ry,setOne:wy,setMany:vy,updateOne:Ey,updateMany:By,deleteOne:Vy,deleteMany:zy,initialize:gy});h(this,"selectors",{selectById:jy,selectByIds:qy})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=O({...e,submitted_at:u,created_by:a});this.dispatch(n(d));const p=this.enqueueRequest({method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[],blocks:[d.uuid]});return p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,p]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`IssueType with uuid ${e.uuid} does not exist in the store.`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{addOne:n,deleteOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`IssueType with uuid ${e} does not exist in the store.`);const u=this.select(Om(e));this.dispatch(c(e)),this.dispatch(vi(w(u)));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(n(a)),this.dispatch(wi(u)),d}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{organization:e}},n);return this.dispatch(c(r)),r}}class KM extends v{constructor(){super(...arguments);h(this,"name","Issue Type Status");h(this,"url","/issue-type-statuses");h(this,"actions",{addOne:Ly,addMany:ky,setOne:Ny,setMany:Gy,updateOne:Hy,updateMany:Wy,deleteOne:Ky,deleteMany:Yy,initialize:Uy});h(this,"selectors",{selectById:Xi,selectByIds:Jy})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=O({...e,created_by:a,submitted_at:u});this.dispatch(n(d));const p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[e.issue_type],blocks:[d.uuid]});return p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,p]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Expected an existing issue type status with uuid ${e.uuid}`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`No issue type status with uuid ${e} found in the store`);this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(c(r)),r}}class YM extends v{constructor(){super(...arguments);h(this,"name","Issue Update");h(this,"url","/issue-updates");h(this,"actions",{addOne:xi,addMany:en,setOne:ef,setMany:tf,updateOne:sf,updateMany:nf,deleteOne:tn,deleteMany:sn,initialize:xy});h(this,"selectors",{selectById:cf,selectByIds:af})}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(c(a)),a}}const ZM=1800;function JM(t){if(!t.access)throw new Error("Missing access token");if(!t.refresh)throw new Error("Missing refresh token");return{accessToken:t.access,refreshToken:t.refresh}}class XM extends cM{constructor(){super(...arguments);h(this,"_getRenewedTokens",async e=>{const n=this.performRequest({method:o.POST,url:this.refreshTokensUrl,payload:{refresh:e},isAuthNeeded:!1,checkAuth:!1});let c;try{c=await n}catch(r){console.error("Could not renew tokens; clearing auth",r),this.clearAuth();return}if(!c.access)throw new Error("Missing access token");return{accessToken:c.access,refreshToken:c.refresh??this.getRefreshToken()}})}clearAuth(){console.debug(this.constructor.name,"clearing auth;"),this.dispatch(eu(!1)),this.clearTokens(),this.dispatch(T()),this.dispatch(T())}async renewTokens(){const e=this.getRefreshToken();if(!e)throw new Error("No refresh token found");console.debug(this.constructor.name,"renewing tokens");try{const n=await this._getRenewedTokens(e);if(!n)return;console.debug("Got renewed tokens"),this.setTokens(n)}catch(n){throw console.error("Could not renew tokens; clearing auth",n),this.clearAuth(),n}}tokenIsExpiringSoon(){const e=this.getAccessToken();if(!e)return!1;const n=Date.now()/1e3;let c;try{c=_b(e).exp??n}catch{c=n}return c-n<ZM}getAuthHeader(){return`Bearer ${this.getAccessToken()}`}async prepareAuth(){if(this.tokenIsExpiringSoon()){console.debug(this.constructor.name,"preparing auth");try{await this.renewTokens()}catch(e){return e instanceof U&&this.clearAuth(),e instanceof Error?Promise.reject(e):Promise.reject(new Error((e??gt).toString()))}}}async handleUnauthorized(e,n){if(e.url.endsWith("/token/refresh/"))throw this.select(c=>c.authReducer.isLoggedIn)&&console.warn("No signed-in user to sign out."),this.clearAuth(),new U({message:"You have been signed out due to inactivity.",response:n,discard:!0});if(this.select(c=>c.authReducer.isLoggedIn))await this.renewTokens();else throw console.debug("Forbidden; user is not logged in."),new U({message:"Incorrect username or password.",response:n,discard:!0})}async initAuth(e){const n=ut.v4();return console.debug(this.constructor.name,"Initiating auth"),this.performRequest({uuid:n,method:o.POST,url:this.initTokensUrl,payload:e,isAuthNeeded:!1,checkAuth:!1}).then(c=>{this.setTokens(JM(c))})}}class QM extends ft{constructor(){super(...arguments);h(this,"name","Organization Access");h(this,"url","/organization-accesses");h(this,"actions",{addOne:Pf,addMany:Ff,setOne:bf,setMany:_f,updateOne:gf,updateMany:Mf,deleteOne:Rf,deleteMany:wf,initialize:Of});h(this,"selectors",{selectById:Ef,selectByIds:Bf})}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid)),a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(d=>{throw this.dispatch(n(r)),d}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e)),u=this.select(ss(a.user));this.dispatch(n(a.uuid)),this.dispatch(dn(a.user));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${a.uuid}/`,blockers:[a.uuid],blocks:[]})}catch(d){throw this.dispatch(c(a)),this.dispatch(rn(u)),d}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{organization:e}},n);return this.dispatch(c(r)),r}}class xM extends ft{constructor(){super(...arguments);h(this,"name","Organization");h(this,"url","/organizations");h(this,"actions",{addOne:$f,addMany:Cf,setOne:qf,setMany:jf,updateOne:Lf,updateMany:Uf,deleteOne:kf,deleteMany:Nf,initialize:Df});h(this,"selectors",{selectById:Wf,selectByIds:Kf})}async add(e){const{addOne:n}=this.actions,c=await this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:e,blockers:[],blocks:[]});return this.dispatch(n(c)),c}async update(e){const{updateOne:n}=this.actions,c=await this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return this.dispatch(n(c)),c}async invite(e,n){return this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/${e}/invite/${n}/`,blockers:[],blocks:[]})}async refreshStore(e){const{initialize:n}=this.actions,c=await this.list({},e);return this.dispatch(n(c)),c}}class eR extends v{constructor(){super(...arguments);h(this,"name","Project Access");h(this,"url","/project-accesses");h(this,"actions",{addOne:iS,addMany:nS,setOne:cS,setMany:aS,updateOne:rS,updateMany:dS,deleteOne:uS,deleteMany:lS,initialize:sS});h(this,"selectors",{selectById:hS,selectByIds:mS})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=O({...e,created_by:this.select(d=>{var p;return((p=d.userReducer.currentUser)==null?void 0:p.id)??null})});this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(a),blockers:[a.organization_access,a.project],blocks:[a.uuid]});return u.then(d=>{this.dispatch(c(d))}).catch(d=>{throw this.dispatch(r(a.uuid)),d}),[a,u]}bulkAdd(e){const{addMany:n,deleteMany:c,updateMany:r}=this.actions,a=this.select(p=>{var m;return((m=p.userReducer.currentUser)==null?void 0:m.id)??null}),u=e.map(p=>O({...p,created_by:a}));this.dispatch(n(u));const d=this.enqueueRequest({description:A(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:{project_accesses:u.map(p=>R(p))},blockers:u.flatMap(p=>[p.project,p.organization_access]),blocks:u.map(p=>p.uuid)});return d.then(p=>{this.dispatch(r(p))}).catch(p=>{throw this.dispatch(c(u.map(m=>m.uuid))),p}),[u,d]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid)),a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[]});return u.then(d=>{this.dispatch(n(d))}).catch(d=>{throw this.dispatch(n(r)),d}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{project__organization:e}},n);return this.dispatch(c(r)),r}}class tR extends j{constructor(){super(...arguments);h(this,"name","Project Attachment");h(this,"url","/project-attachments");h(this,"actions",{addOne:fS,addMany:SS,setOne:AS,setMany:IS,updateOne:TS,updateMany:OS,deleteOne:PS,deleteMany:FS,initialize:yS});h(this,"selectors",{selectById:_S,selectByIds:gS})}getId(e){return e.uuid}getBlockers(e){return[e.project]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(r=>{var a;return((a=r.userReducer.currentUser)==null?void 0:a.id)??null}),c=new Date().toISOString();return O({...e,created_by:n,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,project:e.project}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,project:e.project}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{project__organization:e}},n);return this.dispatch(c(r)),r}}class sR extends v{constructor(){super(...arguments);h(this,"name","Project Comment");h(this,"url","/project-comments");h(this,"actions",{addOne:vS,addMany:ES,setOne:BS,setMany:VS,updateOne:zS,updateMany:DS,deleteOne:jS,deleteMany:qS,initialize:wS});h(this,"selectors",{selectById:$S,selectByIds:US})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=O({...e,created_by:this.select(d=>{var p;return((p=d.userReducer.currentUser)==null?void 0:p.id)??null}),submitted_at:new Date().toISOString()});this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(a),blockers:[a.project],blocks:[a.uuid]});return u.then(d=>{this.dispatch(c(d))}).catch(()=>{this.dispatch(r(a.uuid))}),[a,u]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Project comment with uuid ${e.uuid} not found in store`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Project comment with uuid ${e} not found in store`);this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(c(a)),a}}class iR extends j{constructor(){super(...arguments);h(this,"name","Project File");h(this,"url","/project-files");h(this,"actions",{addOne:WS,addMany:KS,setOne:GS,setMany:HS,updateOne:YS,updateMany:ZS,deleteOne:JS,deleteMany:XS,initialize:NS});h(this,"selectors",{selectById:eA,selectByIds:tA})}getId(e){return e.uuid}getBlockers(e){return[e.project]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(r=>{var a;return((a=r.userReducer.currentUser)==null?void 0:a.id)??null}),c=new Date().toISOString();return O({...e,created_by:n,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_sha1:e.file_sha1,file_name:e.file_name,file_extension:e.file_extension,project:e.project,z_index:e.z_index,canvas_bounds:e.canvas_bounds,bounds:e.bounds}}buildBulkPayload(e){return{uuid:e.uuid,file_sha1:e.file_sha1,file_name:e.file_name,file_extension:e.file_extension,project:e.project,z_index:e.z_index,canvas_bounds:e.canvas_bounds,bounds:e.bounds}}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`${this.name} with uuid ${e.uuid} does not exist in the store`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(c(a)),a}}class nR extends ft{constructor(){super(...arguments);h(this,"name","Project");h(this,"url","/projects");h(this,"actions",{addOne:dA,addMany:rA,setOne:aA,setMany:cA,updateOne:lA,updateMany:uA,deleteOne:oA,deleteMany:hA,initialize:nA});h(this,"selectors",{selectById:yA,selectByIds:fA})}async add(e){const{addOne:n}=this.actions,c=await this.performRequest({method:o.POST,url:`${this.url}/`,payload:R(e)});return this.dispatch(n(c)),c}async update(e){const{updateOne:n}=this.actions,c=await this.performRequest({method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:R(e)});return this.dispatch(n(c)),c}async delete(e){const{deleteOne:n}=this.actions,c=await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return this.dispatch(n(e)),c}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{organization:e}},n);return this.dispatch(c(r)),r}}class cR extends v{constructor(){super(...arguments);h(this,"name","Procedure");h(this,"url","/procedures");h(this,"actions",{addOne:VA,addMany:bt,setOne:zA,setMany:DA,updateOne:jA,updateMany:qA,deleteOne:CA,deleteMany:_t,initialize:BA});h(this,"selectors",{selectById:LA,selectByIds:kA})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=O({...e,created_by:this.select(d=>{var p;return((p=d.userReducer.currentUser)==null?void 0:p.id)??null}),submitted_at:new Date().toISOString()});this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(a),blockers:[a.procedure_type,a.project,a.asset,...a.procedure_initiative?[a.procedure_initiative]:[]],blocks:[a.uuid]});return u.then(d=>{this.dispatch(c(d))}).catch(()=>{this.dispatch(r(a.uuid))}),[a,u]}bulkAdd(e,n){var b;const{store:c}=this.client,{addMany:r,updateMany:a,deleteMany:u}=this.actions,d=new Date().toISOString(),p=((b=c.getState().userReducer.currentUser)==null?void 0:b.id)??null,m=[],f=dt(e,Math.min(n??e.length,N)),I=[];for(const M of f){const g=[],E=[],B=[];for(const z of M){const D=O({...z,submitted_at:d,created_by:p});m.push(D),g.push(R(D)),E.push(D.procedure_type,D.project,D.asset,...D.procedure_initiative?[D.procedure_initiative]:[]),B.push(D.uuid)}const C={payload:{submitted_at:d,payloads:g},blockers:E,blocks:B};I.push(C)}this.dispatch(r(m));const _=I.map(M=>{const{payload:g,blocks:E,blockers:B}=M;return this.enqueueRequest({description:A(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:g,blockers:B,blocks:E})});return Promise.all(_).then(M=>{this.dispatch(a(M.flat()))}).catch(()=>{this.dispatch(u(w(m)))}),[m,Promise.all(_).then(M=>M.flat())]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Expected procedure with uuid ${e.uuid} to exist`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[r.uuid],blocks:[r.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Expected procedure with uuid ${e} to exist`);this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async bulkDelete(e){const{addMany:n,deleteMany:c}=this.actions,{selectByIds:r}=this.selectors,a=this.select(r(e));this.dispatch(c(w(a)));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(n(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(c(a)),a}}class aR extends v{constructor(){super(...arguments);h(this,"name","Procedure Step Assignee");h(this,"url","/procedure-step-assignees");h(this,"actions",{addOne:ZA,addMany:JA,setOne:XA,setMany:QA,updateOne:xA,updateMany:eI,deleteOne:tI,deleteMany:sI,initialize:YA});h(this,"selectors",{selectById:nI,selectByIds:cI})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=O({...e,created_by:this.select(d=>{var p;return((p=d.userReducer.currentUser)==null?void 0:p.id)??null}),submitted_at:new Date().toISOString()});this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(a),blockers:[a.procedure,a.procedure_step],blocks:[a.uuid]});return u.then(d=>{this.dispatch(c(d))}).catch(()=>{this.dispatch(r(a.uuid))}),[a,u]}bulkAdd(e){const{addMany:n,updateMany:c,deleteMany:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=e.map(m=>O({...m,created_by:a,submitted_at:u}));this.dispatch(n(d));const p=this.enqueueRequest({description:A(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:{procedure_step_assignees:d.map(m=>R(m)),submitted_at:u},blockers:d.flatMap(m=>[m.procedure,m.procedure_step]),blocks:w(d)});return p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(w(d)))}),[d,p]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Expected procedure step assignee with uuid ${e} to exist`);this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async bulkDelete(e){const{deleteMany:n,addMany:c}=this.actions,{selectByIds:r}=this.selectors,a=this.select(r(e));this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{procedure__project:e}},n)).flat();return this.dispatch(c(a)),a}}class rR extends v{constructor(){super(...arguments);h(this,"name","Procedure Step Comment");h(this,"url","/procedure-step-comments");h(this,"actions",{addOne:uI,addMany:lI,setOne:oI,setMany:hI,updateOne:mI,updateMany:pI,deleteOne:yI,deleteMany:fI,initialize:dI});h(this,"selectors",{selectById:AI,selectByIds:II})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=O({...e,created_by:this.select(d=>{var p;return((p=d.userReducer.currentUser)==null?void 0:p.id)??null}),submitted_at:new Date().toISOString()});this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(a),blockers:[a.procedure,a.procedure_step],blocks:[a.uuid]});return u.then(d=>{this.dispatch(c(d))}).catch(()=>{this.dispatch(r(a.uuid))}),[a,u]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Procedure step comment with uuid ${e.uuid} not found in store`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Procedure step comment with uuid ${e} not found in store`);this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{procedure__project:e}},n)).flat();return this.dispatch(c(a)),a}}class dR extends v{constructor(){super(...arguments);h(this,"name","Procedure Step Default Assignee");h(this,"url","/procedure-step-default-assignees");h(this,"actions",{addOne:FI,addMany:bI,setOne:_I,setMany:gI,updateOne:MI,updateMany:RI,deleteOne:wI,deleteMany:vI,initialize:PI});h(this,"selectors",{selectById:BI,selectByIds:VI})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=O({...e,created_by:this.select(d=>{var p;return((p=d.userReducer.currentUser)==null?void 0:p.id)??null}),submitted_at:new Date().toISOString()});this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(a),blockers:[a.procedure_step],blocks:[a.uuid]});return u.then(d=>{this.dispatch(c(d))}).catch(()=>{this.dispatch(r(a.uuid))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Expected procedure step default assignee with uuid ${e} to exist`);this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{procedure_step__procedure_type__organization:e}},n);return this.dispatch(c(r)),r}}class uR extends v{constructor(){super(...arguments);h(this,"name","Procedure Step Default Reviewer");h(this,"url","/procedure-step-default-reviewers");h(this,"actions",{addOne:qI,addMany:CI,setOne:$I,setMany:UI,updateOne:LI,updateMany:kI,deleteOne:NI,deleteMany:GI,initialize:jI});h(this,"selectors",{selectById:WI,selectByIds:KI})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=O({...e,created_by:this.select(d=>{var p;return((p=d.userReducer.currentUser)==null?void 0:p.id)??null}),submitted_at:new Date().toISOString()});this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(a),blockers:[a.procedure_step],blocks:[a.uuid]});return u.then(d=>{this.dispatch(c(d))}).catch(()=>{this.dispatch(r(a.uuid))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Expected procedure step default reviewer with uuid ${e} to exist`);this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{procedure_step__procedure_type__organization:e}},n);return this.dispatch(c(r)),r}}class lR extends ft{constructor(){super(...arguments);h(this,"name","Procedure Step Event");h(this,"url","/procedure-step-events");h(this,"actions",{addOne:XI,addMany:QI,setOne:xI,setMany:eT,updateOne:tT,updateMany:sT,deleteOne:iT,deleteMany:nT,initialize:JI});h(this,"selectors",{selectById:aT,selectByIds:rT})}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{procedure__project:e}},n)).flat();return this.dispatch(c(a)),a}}class oR extends j{constructor(){super(...arguments);h(this,"name","Procedure Step Fields Attachment");h(this,"url","/procedure-step-fields-attachments");h(this,"actions",{addOne:oT,addMany:vn,setOne:hT,setMany:mT,updateOne:pT,updateMany:yT,deleteOne:fT,deleteMany:En,initialize:lT});h(this,"selectors",{selectById:IT,selectByIds:TT})}getId(e){return e.uuid}getBlockers(e){return[e.fields_revision]}getBlocks(e){return[e.uuid]}buildModel(e){return O({...e,created_by:this.select(n=>{var c;return((c=n.userReducer.currentUser)==null?void 0:c.id)??null}),submitted_at:new Date().toISOString()})}buildPayload(e){const{uuid:n,field_identifier:c,fields_revision:r,file_sha1:a,file_name:u,file_extension:d}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:c,fields_revision:r,file_sha1:a,file_name:u,file_extension:d}}buildBulkPayload(e){const{uuid:n,field_identifier:c,fields_revision:r,file_sha1:a,file_name:u,file_extension:d}=e;return{uuid:n,field_identifier:c,fields_revision:r,file_sha1:a,file_name:u,file_extension:d}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{fields_revision__procedure_step__procedure_type__organization:e}},n);return this.dispatch(c(r)),r}}class hR extends v{constructor(){super(...arguments);h(this,"name","Procedure Step Fields");h(this,"url","/procedure-step-fields");h(this,"actions",{addOne:bT,addMany:_T,setOne:gT,setMany:MT,updateOne:RT,updateMany:wT,deleteOne:vT,deleteMany:ET,initialize:FT});h(this,"selectors",{selectById:BT,selectByIds:VT})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=O({...e,created_by:this.select(d=>{var p;return((p=d.userReducer.currentUser)==null?void 0:p.id)??null}),submitted_at:new Date().toISOString()});this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(a),blockers:[a.procedure_step],blocks:[a.uuid]});return u.then(d=>{this.dispatch(c(d))}).catch(()=>{this.dispatch(r(a.uuid))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Expected procedure step fields with uuid ${e} to exist`);const u=this.select(AT(e));this.dispatch(n(e)),this.dispatch(En(w(u)));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(a)),this.dispatch(vn(u)),d}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{procedure_step__procedure_type__organization:e}},n);return this.dispatch(c(r)),r}}class mR extends j{constructor(){super(...arguments);h(this,"name","Procedure Step Field Values Attachment");h(this,"url","/procedure-step-field-values-attachments");h(this,"actions",{addOne:qT,addMany:jn,setOne:CT,setMany:$T,updateOne:UT,updateMany:LT,deleteOne:kT,deleteMany:qn,initialize:jT});h(this,"selectors",{selectById:GT,selectByIds:HT})}getId(e){return e.uuid}getBlockers(e){return[e.field_values]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(r=>{var a;return((a=r.userReducer.currentUser)==null?void 0:a.id)??null}),c=new Date().toISOString();return O({...e,created_by:n,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:c,field_values:r,file_sha1:a,file_name:u,file_extension:d}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:c,field_values:r,file_sha1:a,file_name:u,file_extension:d}}buildBulkPayload(e){const{uuid:n,field_identifier:c,field_values:r,file_sha1:a,file_name:u,file_extension:d}=e;return{uuid:n,field_identifier:c,field_values:r,file_sha1:a,file_name:u,file_extension:d}}async bulkDelete(e){const{deleteMany:n,addMany:c}=this.actions,{selectByIds:r}=this.selectors,a=this.select(r(e));this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{field_values__procedure__project:e,latest:!0}},n)).flat();return this.dispatch(c(a)),a}}class pR extends v{constructor(){super(...arguments);h(this,"name","Procedure Step Field Values Review");h(this,"url","/procedure-step-field-values-reviews");h(this,"actions",{addOne:lO,addMany:Ln,setOne:oO,setMany:hO,updateOne:mO,updateMany:pO,deleteOne:yO,deleteMany:kn,initialize:uO});h(this,"selectors",{selectById:SO,selectByIds:AO})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=O({...e,created_by:this.select(d=>{var p;return((p=d.userReducer.currentUser)==null?void 0:p.id)??null}),submitted_at:new Date().toISOString()});this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(a),blockers:[a.field_values],blocks:[a.uuid]});return u.then(d=>{this.dispatch(c(d))}).catch(()=>{this.dispatch(r(a.uuid))}),[a,u]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Procedure step field values review with uuid ${e.uuid} not found in store`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Procedure step field values review with uuid ${e} not found in store`);this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{field_values__procedure__project:e}},n)).flat();return this.dispatch(c(a)),a}}class yR extends v{constructor(){super(...arguments);h(this,"name","Procedure Step Field Values");h(this,"url","/procedure-step-field-values");h(this,"actions",{addOne:JT,addMany:XT,setOne:QT,setMany:xT,updateOne:eO,updateMany:tO,deleteOne:sO,deleteMany:iO,initialize:ZT});h(this,"selectors",{selectById:aO,selectByIds:rO})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=O({...e,created_by:a,submitted_at:u}),p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[e.procedure,e.procedure_step,e.fields_revision],blocks:[d.uuid]});return this.dispatch(n(d)),p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,p]}bulkAdd(e,n){const{addMany:c,updateMany:r,deleteMany:a}=this.actions,u=new Date().toISOString(),d=this.select(_=>{var b;return((b=_.userReducer.currentUser)==null?void 0:b.id)??null}),p=[],m=dt(e,Math.min(n??e.length,N)),f=[];for(const _ of m){const b=[],M=[],g=[];for(const E of _){const B=O({...E,values:E.values,created_by:d,submitted_at:u});p.push(B),b.push(R(B)),M.push(B.procedure_step,B.procedure,B.fields_revision),g.push(B.uuid)}f.push({payload:{payloads:b,submitted_at:u},blockers:M,blocks:g})}this.dispatch(c(p));const I=f.map(_=>{const{payload:b,blocks:M,blockers:g}=_;return this.enqueueRequest({description:A(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:b,blockers:g,blocks:M})});return Promise.all(I).then(_=>{this.dispatch(r(_.flat()))}).catch(()=>{this.dispatch(a(w(p)))}),[p,Promise.all(I).then(_=>_.flat())]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Expected ProcedureStepFieldValues with uuid ${e.uuid} to exist`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[a.uuid,a.procedure,a.procedure_step,a.fields_revision],blocks:[a.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Expected ProcedureStepFieldValues with uuid ${e} to exist`);const u=this.select(WT(e)),d=this.select(IO(e));this.dispatch(n(e)),this.dispatch(qn(w(u))),this.dispatch(kn(w(d)));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(p){throw this.dispatch(c(a)),this.dispatch(jn(u)),this.dispatch(Ln(d)),p}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{procedure__project:e}},n)).flat();return this.dispatch(c(a)),a}}class fR extends v{constructor(){super(...arguments);h(this,"name","Procedure Step Reviewer");h(this,"url","/procedure-step-reviewers");h(this,"actions",{addOne:FO,addMany:bO,setOne:_O,setMany:gO,updateOne:MO,updateMany:RO,deleteOne:wO,deleteMany:vO,initialize:PO});h(this,"selectors",{selectById:BO,selectByIds:VO})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=O({...e,created_by:this.select(d=>{var p;return((p=d.userReducer.currentUser)==null?void 0:p.id)??null}),submitted_at:new Date().toISOString()});this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(a),blockers:[a.procedure,a.procedure_step],blocks:[a.uuid]});return u.then(d=>{this.dispatch(c(d))}).catch(()=>{this.dispatch(r(a.uuid))}),[a,u]}bulkAdd(e){const{addMany:n,updateMany:c,deleteMany:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=e.map(m=>O({...m,created_by:a,submitted_at:u}));this.dispatch(n(d));const p=this.enqueueRequest({description:A(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:{procedure_step_reviewers:d.map(m=>R(m)),submitted_at:u},blockers:d.flatMap(m=>[m.procedure,m.procedure_step]),blocks:d.map(m=>m.uuid)});return p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(w(d)))}),[d,p]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Expected procedure step reviewer with uuid ${e} to exist`);this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async bulkDelete(e){const{deleteMany:n,addMany:c}=this.actions,{selectByIds:r}=this.selectors,a=this.select(r(e));this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{procedure__project:e}},n)).flat();return this.dispatch(c(a)),a}}class SR extends v{constructor(){super(...arguments);h(this,"name","Procedure Initiative");h(this,"url","/procedure-initiatives");h(this,"actions",{addOne:IA,addMany:TA,setOne:OA,setMany:PA,updateOne:FA,updateMany:bA,deleteOne:_A,deleteMany:gA,initialize:AA});h(this,"selectors",{selectById:wA,selectByIds:vA})}add(e){var p;const{store:n}=this.client,{addOne:c,updateOne:r,deleteOne:a}=this.actions,u=O({...e,created_by:((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,submitted_at:new Date().toISOString()});this.dispatch(c(u));const d=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(u),blockers:[u.procedure_type,u.project],blocks:[u.uuid]});return d.then(m=>{this.dispatch(r(m))}).catch(()=>{this.dispatch(a(u.uuid))}),[u,d]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Expected ${this.name} with uuid ${e.uuid} to exist`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[r.uuid],blocks:[r.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Expected ${this.name} with uuid ${e} to exist`);const u=this.select(WA(e));this.dispatch(n(e)),this.dispatch(_t(w(u)));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(a)),this.dispatch(bt(u)),d}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(c(a)),a}}class AR extends v{constructor(){super(...arguments);h(this,"name","Procedure Step");h(this,"url","/procedure-steps");h(this,"actions",{addOne:$O,addMany:UO,setOne:qO,setMany:CO,updateOne:LO,updateMany:kO,deleteOne:NO,deleteMany:GO,initialize:jO});h(this,"selectors",{selectById:WO,selectByIds:KO})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=O({...e,created_by:this.select(d=>{var p;return((p=d.userReducer.currentUser)==null?void 0:p.id)??null}),submitted_at:new Date().toISOString()});this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(a),blockers:[a.procedure_type],blocks:[a.uuid]});return u.then(d=>{this.dispatch(c(d))}).catch(()=>{this.dispatch(r(a.uuid))}),[a,u]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`No procedure step with uuid ${e.uuid} found in the store`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${r.uuid}/`,payload:e,blockers:[r.uuid],blocks:[r.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{addOne:n,deleteOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`No procedure step with uuid ${e} found in the store`);this.dispatch(c(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(n(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{procedure_type__organization:e}},n);return this.dispatch(c(r)),r}}class IR extends j{constructor(){super(...arguments);h(this,"name","Procedure Type Attachment");h(this,"url","/procedure-type-attachments");h(this,"actions",{addOne:JO,addMany:XO,setOne:QO,setMany:xO,updateOne:eP,updateMany:tP,deleteOne:sP,deleteMany:iP,initialize:ZO});h(this,"selectors",{selectById:aP,selectByIds:rP})}getId(e){return e.uuid}getBlockers(e){return[e.procedure_type]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(r=>{var a;return((a=r.userReducer.currentUser)==null?void 0:a.id)??null}),c=new Date().toISOString();return O({...e,created_by:n,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,procedure_type:e.procedure_type}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,procedure_type:e.procedure_type}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{procedure_type__organization:e}},n);return this.dispatch(c(r)),r}}class TR extends j{constructor(){super(...arguments);h(this,"name","Procedure Type Fields Attachment");h(this,"url","/procedure-type-fields-attachments");h(this,"actions",{addOne:lP,addMany:oP,setOne:hP,setMany:mP,updateOne:pP,updateMany:yP,deleteOne:fP,deleteMany:SP,initialize:uP});h(this,"selectors",{selectById:TP,selectByIds:OP})}getId(e){return e.uuid}getBlockers(e){return[e.fields_revision]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(r=>{var a;return((a=r.userReducer.currentUser)==null?void 0:a.id)??null}),c=new Date().toISOString();return O({...e,created_by:n,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:c,fields_revision:r,file_sha1:a,file_name:u,file_extension:d}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:c,fields_revision:r,file_sha1:a,file_name:u,file_extension:d}}buildBulkPayload(e){const{uuid:n,field_identifier:c,fields_revision:r,file_sha1:a,file_name:u,file_extension:d}=e;return{uuid:n,field_identifier:c,fields_revision:r,file_sha1:a,file_name:u,file_extension:d}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{fields_revision__procedure_type__organization:e}},n);return this.dispatch(c(r)),r}}class OR extends v{constructor(){super(...arguments);h(this,"name","Procedure Type Fields");h(this,"url","/procedure-type-fields");h(this,"actions",{addOne:bP,addMany:_P,setOne:gP,setMany:MP,updateOne:RP,updateMany:wP,deleteOne:vP,deleteMany:EP,initialize:FP});h(this,"selectors",{selectById:zP,selectByIds:DP})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=O({...e,created_by:a,submitted_at:u});this.dispatch(n(d));const p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[d.procedure_type],blocks:[d.uuid]});return p.then(m=>{this.dispatch(c(m))}).catch(m=>{throw this.dispatch(r(d.uuid)),m}),[d,p]}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{procedure_type__organization:e}},n);return this.dispatch(c(r)),r}}class PR extends j{constructor(){super(...arguments);h(this,"name","Procedure Field Values Attachment");h(this,"url","/procedure-field-values-attachments");h(this,"actions",{addOne:CP,addMany:xn,setOne:$P,setMany:UP,updateOne:LP,updateMany:kP,deleteOne:NP,deleteMany:ec,initialize:qP});h(this,"selectors",{selectById:WP,selectByIds:KP})}getId(e){return e.uuid}getBlockers(e){return[e.field_values]}getBlocks(e){return[e.uuid]}buildModel(e){const n=this.select(r=>{var a;return((a=r.userReducer.currentUser)==null?void 0:a.id)??null}),c=new Date().toISOString();return O({...e,created_by:n,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:c,field_values:r,file_sha1:a,file_name:u,file_extension:d}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:c,field_values:r,file_sha1:a,file_name:u,file_extension:d}}buildBulkPayload(e){const{uuid:n,field_identifier:c,field_values:r,file_sha1:a,file_name:u,file_extension:d}=e;return{uuid:n,field_identifier:c,field_values:r,file_sha1:a,file_name:u,file_extension:d}}async bulkDelete(e){const{deleteMany:n,addMany:c}=this.actions,{selectByIds:r}=this.selectors,a=this.select(r(e));this.dispatch(n(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(c(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{field_values__procedure__project:e,latest:!0}},n)).flat();return this.dispatch(c(a)),a}}class FR extends v{constructor(){super(...arguments);h(this,"name","Procedure Field Values");h(this,"url","/procedure-field-values");h(this,"actions",{addOne:XP,addMany:QP,setOne:xP,setMany:eF,updateOne:tF,updateMany:sF,deleteOne:iF,deleteMany:nF,initialize:JP});h(this,"selectors",{selectById:rF,selectByIds:dF})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=this.select(m=>{var f;return((f=m.userReducer.currentUser)==null?void 0:f.id)??null}),u=new Date().toISOString(),d=O({...e,created_by:a,submitted_at:u}),p=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(d),blockers:[e.fields_revision,e.procedure],blocks:[d.uuid]});return this.dispatch(n(d)),p.then(m=>{this.dispatch(c(m))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,p]}bulkAdd(e,n){const{addMany:c,updateMany:r,deleteMany:a}=this.actions,u=new Date().toISOString(),d=this.select(_=>{var b;return((b=_.userReducer.currentUser)==null?void 0:b.id)??null}),p=[],m=dt(e,Math.min(n??e.length,N)),f=[];for(const _ of m){const b=[],M=[],g=[];for(const E of _){const B=O({...E,values:E.values,created_by:d,submitted_at:u});p.push(B),b.push(R(B)),M.push(B.procedure,B.fields_revision),g.push(B.uuid)}f.push({payload:{payloads:b,submitted_at:u},blockers:M,blocks:g})}this.dispatch(c(p));const I=f.map(_=>{const{payload:b,blocks:M,blockers:g}=_;return this.enqueueRequest({description:A(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:b,blockers:g,blocks:M})});return Promise.all(I).then(_=>{this.dispatch(r(_.flat()))}).catch(()=>{this.dispatch(a(w(p)))}),[p,Promise.all(I).then(_=>_.flat())]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Expected ProcedureFieldValues with uuid ${e.uuid} to exist`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[a.fields_revision,a.procedure],blocks:[a.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Expected submission with uuid ${e} to exist`);const u=this.select(YP(e));this.dispatch(n(e)),this.dispatch(ec(w(u)));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(a)),this.dispatch(xn(u)),d}}async refreshStore(e,n){const{initialize:c}=this.actions,a=(await this.listPaginated({queryParams:{procedure__project:e,latest:!0}},n)).flat();return this.dispatch(c(a)),a}}class bR extends v{constructor(){super(...arguments);h(this,"name","Procedure Type");h(this,"url","/procedure-types");h(this,"actions",{addOne:oF,addMany:hF,setOne:mF,setMany:pF,updateOne:yF,updateMany:fF,deleteOne:SF,deleteMany:AF,initialize:lF});h(this,"selectors",{selectById:OF,selectByIds:PF})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=O({...e,created_by:this.select(d=>{var p;return((p=d.userReducer.currentUser)==null?void 0:p.id)??null}),submitted_at:new Date().toISOString()});this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(a),blockers:[],blocks:[a.uuid]});return u.then(d=>{this.dispatch(c(d))}).catch(()=>{this.dispatch(r(a.uuid))}),[a,u]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Expected procedure type with uuid ${e.uuid} to exist`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[r.uuid],blocks:[r.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{deleteOne:n,addOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Expected procedure type with uuid ${e} to exist`);const u=this.select(NA(e));this.dispatch(n(e)),this.dispatch(_t(w(u)));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(a)),this.dispatch(bt(u)),d}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{organization:e}},n);return this.dispatch(c(r)),r}}class _R extends v{constructor(){super(...arguments);h(this,"name","Team Membership");h(this,"url","/team-memberships");h(this,"actions",{addOne:gF,addMany:MF,setOne:RF,setMany:wF,updateOne:vF,updateMany:EF,deleteOne:BF,deleteMany:VF,initialize:_F});h(this,"selectors",{selectById:jF,selectByIds:qF})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=O({...e,created_by:this.select(d=>{var p;return((p=d.userReducer.currentUser)==null?void 0:p.id)??null})});this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(a),blockers:[e.team],blocks:[a.uuid]});return u.then(d=>{this.dispatch(c(d))}).catch(()=>{this.dispatch(r(a.uuid))}),[a,u]}bulkAdd(e){const{addMany:n,updateMany:c,deleteMany:r}=this.actions,a=this.select(p=>{var m;return((m=p.userReducer.currentUser)==null?void 0:m.id)??null}),u=e.map(p=>O({...p,created_by:a}));this.dispatch(n(u));const d=this.enqueueRequest({description:A(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:{team_memberships:u.map(p=>R(p))},blockers:u.map(p=>p.team),blocks:u.map(p=>p.uuid)});return d.then(p=>{this.dispatch(c(p))}).catch(()=>{this.dispatch(r(u.map(p=>p.uuid)))}),[u,d]}async delete(e){const{addOne:n,deleteOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Expected team membership with uuid ${e} to exist`);this.dispatch(c(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(u){throw this.dispatch(n(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{team__organization:e}},n);return this.dispatch(c(r)),r}}class gR extends v{constructor(){super(...arguments);h(this,"name","Team");h(this,"url","/teams");h(this,"actions",{addOne:UF,addMany:LF,setOne:kF,setMany:NF,updateOne:GF,updateMany:HF,deleteOne:WF,deleteMany:KF,initialize:$F});h(this,"selectors",{selectById:ZF,selectByIds:JF})}add(e){const{addOne:n,updateOne:c,deleteOne:r}=this.actions,a=O({...e,submitted_at:new Date().toISOString(),created_by:this.select(d=>{var p;return((p=d.userReducer.currentUser)==null?void 0:p.id)??null})});this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:R(a),blockers:[],blocks:[a.uuid]});return u.then(d=>{this.dispatch(c(d))}).catch(()=>{this.dispatch(r(a.uuid))}),[a,u]}update(e){const{updateOne:n}=this.actions,{selectById:c}=this.selectors,r=this.select(c(e.uuid));if(!r)throw new Error(`Expected team with uuid ${e.uuid} to exist`);const a={...r,...e};this.dispatch(n(a));const u=this.enqueueRequest({description:A(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:R(e),blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[a,u]}async delete(e){const{addOne:n,deleteOne:c}=this.actions,{selectById:r}=this.selectors,a=this.select(r(e));if(!a)throw new Error(`Expected team with uuid ${e} to exist`);this.dispatch(c(e));try{return await this.enqueueRequest({description:A(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(u){throw this.dispatch(n(a)),u}}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({queryParams:{organization:e}},n);return this.dispatch(c(r)),r}}class MR extends ft{constructor(){super(...arguments);h(this,"name","User");h(this,"url","/user");h(this,"actions",{addOne:rn,addMany:mf,setOne:hf,setMany:of,updateOne:yf,updateMany:pf,deleteOne:dn,deleteMany:ff,initialize:lf});h(this,"selectors",{selectById:ss,selectByIds:If})}async list(e,n){const{organizationUuid:c,...r}=e,a=c?`/organizations/${c}${this.url}s/`:`/${this.url}`;return this.performRequest({method:o.GET,url:a,...r},n)}async refreshStore(e,n){const{initialize:c}=this.actions,r=await this.list({organizationUuid:e},n);return this.dispatch(c(r)),r}}async function pc(t,s,e,n,c){const r=n instanceof yt;r&&s.checkAuth!==!1&&await n.auth.prepareAuth();const a={queryParams:"",isAuthNeeded:!0},{s3url:u,payload:d,headers:p,method:m,queryParams:f,attachmentHash:I,isExternalUrl:_,isAuthNeeded:b,isResponseBlob:M}={...a,...s};let g=s.url;const E=I?await e.files.getFileFromCache(I):void 0;if(I&&!E)throw new Error(`Cannot upload file ${I} because it's not cached.`);!_&&!g.startsWith("http")&&(!g.startsWith("/")&&!g.startsWith("blob:")&&(g="/"+g),g=t+g);const B=q=>{if(I){if(!u)throw new Error(`No S3 URL for file ${I}`);if("warning"in u)throw new Error(`S3 URL warning for file ${I}`);if(!E)throw new Error(`No file for file ${I}`);const G=u.fields["x-amz-checksum-sha1"];if(!G)throw new Error(`No checksum for file ${I}`);return q.set("x-amz-checksum-sha1",G).field({...d,...u.fields}).attach("file",E)}return q.send(d)},z={[o.GET]:()=>M?It.get(g.toString()).responseType("blob"):It.get(g.toString()),[o.POST]:()=>{const q=It.post(g.toString());return B(q)},[o.PATCH]:()=>{const q=It.patch(g.toString());return B(q)},[o.PUT]:()=>{const q=It.put(g.toString());return B(q)},[o.DELETE]:()=>{const q=It.delete(g.toString());return B(q)}}[m];let D=z();const At=()=>{console.debug("aborting request:",s.url),D.abort()};if(c==null||c.addEventListener("abort",At),b&&r){const q=n.auth.getAuthHeader();D=D.set("Authorization",q)}p&&(D=D.set(p));try{return await D.query(f)}catch(q){const G=rb(q),ls=G==null?void 0:G.status;if(r&&ls===401)return await n.auth.handleUnauthorized(D,G),D.query(f);throw new U({response:G,innerError:q,discard:oc.includes(ls)})}finally{c==null||c.removeEventListener("abort",At)}}class RR{constructor(s){h(this,"store");this.store=s}_performRequest(s,e,n,c){const r=new os,a={...e,uuid:e.uuid??ut.v4()};return pc(s,a,this,n,c).then(u=>{r.resolve(u.body)}).catch(u=>{u instanceof Error?r.reject(u):r.reject(new Error((u??gt).toString()))}),r}async performRequest(s,e,n,c){return this._performRequest(s,e,n,c).then(r=>{if(r instanceof U)throw r;return r})}async enqueueRequest(s,e,n){return this._enqueueRequest(s,e,n).then(c=>{if(c instanceof U)throw c;return c})}_enqueueRequest(s,e,n){const c=new os,r={...s,BASE_URL:e,serviceName:n},a=this.store.dispatch(Xf(r)),u=p=>{if(p)c.resolve(p.body);else{const m=new U({message:"Could not get a response from the server.",response:p,discard:!0});c.reject(m)}},d=p=>{p instanceof U?p.options.discard=!0:(console.error("Received an unexpected error while processing a request:",p,`
14
14
  Converting error to APIError and discarding.`),p=new U({message:"An error occurred while processing the request.",innerError:p,discard:!0})),c.reject(p)};return a.then(u,d),c}async performPagination(s,e,n,c,r){const a={...e,queryParams:{...e.queryParams,paginate:!0,limit:n}},{method:u}=a,d=[];let p=await this.performRequest(s,a,c,r);for(d.push(p.results);p.next;)p=await this.performRequest(s,{url:p.next,method:u},c,r),d.push(p.results);return d}}class Mt{constructor(){h(this,"graph");h(this,"requestAttemptCounter");this.graph=new gb.DepGraph,this.requestAttemptCounter={}}static _fromOutbox(s){const e=new Mt;for(let n=0;n<s.length;n++){const c=s[n];if(!c){console.error("Outbox item was undefined");continue}e.sneakRequest(c);for(let r=0;r<n;r++){const a=s[r];if(!a){console.error("Previous outbox item was undefined");continue}a.payload.uuid!==c.payload.uuid&&a.payload.blocks.some(u=>c.payload.blockers.includes(u))&&Mt._addDependency(c.payload.uuid,a.payload.uuid,e.graph)}}return e}_addDependency(s,e){Mt._addDependency(s,e,this.graph)}static _addDependency(s,e,n){if(s===e)throw new Error(`Tried to add dependency from node to itself: ${s}`);if(!n.hasNode(s))throw new Error(`Tried to add dependency from non-existent node: ${s} (to node: ${e})`);if(!n.hasNode(e))throw new Error(`Tried to add dependency to non-existent node: ${e} (from node: ${s})`);n.addDependency(s,e)}addRequest(s){if(this.graph.addNode(s.payload.uuid,s),!(s.payload.blockers.length===0||this.graph.size()===1))for(const e of this.graph.overallOrder()){if(e===s.payload.uuid)continue;const n=this.graph.getNodeData(e),c=new Set(n.payload.blocks);s.payload.blockers.some(r=>c.has(r))&&this._addDependency(s.payload.uuid,e)}}insertRequest(s){this.graph.addNode(s.payload.uuid,s);for(const e of this.graph.overallOrder()){if(e===s.payload.uuid)continue;const n=this.graph.getNodeData(e),c=new Set(s.payload.blocks);n.payload.blockers.some(r=>c.has(r))&&this._addDependency(e,s.payload.uuid)}}sneakRequest(s){this.graph.addNode(s.payload.uuid,s)}_getNextNode(){const s=this.graph.overallOrder(!0);let e=1/0,n;for(const c of s){const r=this.requestAttemptCounter[c]||0;r<e&&(e=r,n=c)}return n}peek(){const s=this._getNextNode();if(s)return this.graph.getNodeData(s)}remove(s){this.graph.removeNode(s),delete this.requestAttemptCounter[s]}pop(){const s=this.peek();return s&&this.graph.removeNode(s.payload.uuid),s}getQueue(){const s=this.graph.overallOrder().map(n=>this.graph.getNodeData(n)),e=this._getNextNode();if(e){const n=this.graph.getNodeData(e),c=s.findIndex(r=>r.payload.uuid===n.payload.uuid);c!==-1&&(s.splice(c,1),s.unshift(n))}return s}getReady(){let s=this.graph.overallOrder(!0).map(e=>this.graph.getNodeData(e));return s=s.sort((e,n)=>e.meta.offline.effect.timestamp.localeCompare(n.meta.offline.effect.timestamp)),s=s.sort((e,n)=>{const c=this.requestAttemptCounter[e.payload.uuid]||0,r=this.requestAttemptCounter[n.payload.uuid]||0;return c-r}),s}registerRetry(s){this.requestAttemptCounter[s]=(this.requestAttemptCounter[s]||0)+1}}let db;function ub(t){db=t}function Rt(){return db}let lb;function ob(t){lb=t}function hb(){return lb}let yc=null;function St(){const t=Rt();if(!t)return console.warn("Client store not set; cannot get outbox coordinator yet."),null;if(yc)return yc;const s=t.getState().offline.outbox,e=Mt._fromOutbox(s);return yc=e,e}const wR=(t,s)=>{const e=new s(t);return ob(e),ub(t),e};class vR{constructor(s){h(this,"_all");h(this,"_previous");this._all=[s],this._previous=s,this.then=this.then.bind(this),this.compile=this.compile.bind(this)}then(s){return this._previous&&(this._previous.next=s),this._all.push(s),this._previous=s,{then:this.then,compile:this.compile}}compile(){return this._all}}class fc{constructor(){h(this,"next");this.next=null}then(s){return new vR(this).then(s)}async run(s){if(this.next)return this.next.run(s);{if(console.debug("Middleware finished. Performing request:",s.payload.url),!Rt())throw new Error("Client store not set");const n=hb();if(!n)throw new Error("Client SDK not set");return nb(s,n)}}}class mb extends fc{async run(s){return super.run(s)}}class pb extends fc{async run(s){return super.run(s)}}const yb=new mb().then(new pb).compile();function fb(t){var s;return(s=yb[0])==null?void 0:s.run(t)}var Sb=(t=>(t[t.USER_REGISTRATION=0]="USER_REGISTRATION",t[t.APPLICATION_INVITE=2]="APPLICATION_INVITE",t[t.PROJECT_INVITE=4]="PROJECT_INVITE",t[t.ORGANIZATION_INVITE=6]="ORGANIZATION_INVITE",t[t.ADD_EMAIL_DOMAIN=8]="ADD_EMAIL_DOMAIN",t[t.RESET_PASSWORD=10]="RESET_PASSWORD",t))(Sb||{});i.ALL_MIDDLEWARE=yb,i.APIError=U,i.AgentService=aM,i.AssetAttachmentService=rM,i.AssetCommentService=dM,i.AssetService=uM,i.AssetStatusType=_c,i.AssetTypeAttachmentService=lM,i.AssetTypeFieldValuesAttachmentService=mM,i.AssetTypeFieldValuesService=pM,i.AssetTypeFieldsAttachmentService=oM,i.AssetTypeFieldsService=hM,i.AssetTypeIdentifierService=yM,i.AssetTypeIdentifierValueService=fM,i.AssetTypeService=SM,i.AssetTypeStatusService=AM,i.BaseApiService=yt,i.BaseModelApiService=ft,i.BaseOfflineFileModelApiService=j,i.BaseOfflineModelApiService=v,i.BaseSDK=RR,i.COMMON_AUTO_FIELDS=Fc,i.DEFAULT_PAGE_SIZE=xF,i.DISCARD_HTTP_STATUSES=oc,i.DeferredPromise=os,i.DocumentAttachmentService=IM,i.DocumentService=TM,i.EMPTY_ARRAY=Tc,i.EMPTY_OBJECT=Oc,i.EmailDomainsService=OM,i.EmailVerificationService=PM,i.FileService=FM,i.FormIdentifierService=bM,i.FormIdentifierValueService=_M,i.FormRevisionAttachmentService=gM,i.FormRevisionService=MM,i.FormService=RM,i.FormSubmissionAttachmentService=vM,i.FormSubmissionService=EM,i.FormSubscriberService=wM,i.GeoImageService=BM,i.HttpMethod=o,i.IssueAssociationService=VM,i.IssueAttachmentService=zM,i.IssueCommentAttachmentService=DM,i.IssueCommentService=jM,i.IssuePriorityType=Mc,i.IssueService=qM,i.IssueStatusType=gc,i.IssueTypeAttachmentService=CM,i.IssueTypeFieldValuesAttachmentService=LM,i.IssueTypeFieldValuesService=kM,i.IssueTypeFieldsAttachmentService=$M,i.IssueTypeFieldsService=UM,i.IssueTypeIdentifierService=NM,i.IssueTypeIdentifierValueService=GM,i.IssueTypePriorityService=HM,i.IssueTypeService=WM,i.IssueTypeStatusService=KM,i.IssueUpdateChange=$,i.IssueUpdateService=YM,i.JWTService=XM,i.MAX_SERVICE_BATCH_SIZE=N,i.OUTBOX_RETRY_DELAY=Pc,i.OfflineAnalyticsMiddleware=mb,i.OfflineMiddleware=fc,i.OrganizationAccessLevel=bc,i.OrganizationAccessService=QM,i.OrganizationService=xM,i.OutboxCoordinator=Mt,i.ProcdureInitiativeService=SR,i.ProcedureFieldValuesAttachmentService=PR,i.ProcedureFieldValuesService=FR,i.ProcedureService=cR,i.ProcedureStepAssigneeService=aR,i.ProcedureStepCommentService=rR,i.ProcedureStepDefaultAssigneeService=dR,i.ProcedureStepDefaultReviewerService=uR,i.ProcedureStepEventService=lR,i.ProcedureStepEventType=Rc,i.ProcedureStepFieldValuesAttachmentService=mR,i.ProcedureStepFieldValuesReviewService=pR,i.ProcedureStepFieldValuesReviewType=wc,i.ProcedureStepFieldValuesService=yR,i.ProcedureStepFieldsAttachmentService=oR,i.ProcedureStepFieldsService=hR,i.ProcedureStepReviewerService=fR,i.ProcedureStepService=AR,i.ProcedureTypeAttachmentService=IR,i.ProcedureTypeFieldsAttachmentService=TR,i.ProcedureTypeFieldsService=OR,i.ProcedureTypeService=bR,i.ProjectAccessService=eR,i.ProjectAttachmentService=tR,i.ProjectCommentService=sR,i.ProjectFileService=iR,i.ProjectService=nR,i.RESET_ORGANIZATION_STATE=F,i.RESET_PROJECT_STATE=V,i.RESET_STATE=T,i.RateLimitingMiddleware=pb,i.SelectorBuilder=Kb,i.TeamMembershipService=_R,i.TeamService=gR,i.UNKNOWN_ERROR_MESSAGE=gt,i.UserService=MR,i.VerificationCodeType=Sb,i._setLatestRetryTime=xf,i.addAsset=ga,i.addAssetAttachment=xc,i.addAssetAttachments=Ts,i.addAssetComment=ha,i.addAssetComments=Ut,i.addAssetType=wd,i.addAssetTypeAttachment=$a,i.addAssetTypeAttachments=Rs,i.addAssetTypeFieldValues=$r,i.addAssetTypeFieldValuesAttachment=gr,i.addAssetTypeFieldValuesAttachments=Ds,i.addAssetTypeFieldValuesMany=Ur,i.addAssetTypeFields=hr,i.addAssetTypeFieldsAttachment=Qa,i.addAssetTypeFieldsAttachments=xa,i.addAssetTypeFieldsMany=mr,i.addAssetTypeIdentifier=xr,i.addAssetTypeIdentifierValue=md,i.addAssetTypeIdentifierValues=pd,i.addAssetTypeIdentifiers=ed,i.addAssetTypeStatus=Ld,i.addAssetTypeStatuses=kd,i.addAssetTypes=vd,i.addAssets=_s,i.addConversation=Kc,i.addConversations=Yb,i.addDocument=Au,i.addDocumentAttachment=nu,i.addDocumentAttachments=cu,i.addDocuments=Iu,i.addEmailDomain=Bu,i.addEmailDomains=Vu,i.addForm=ao,i.addFormIdentifier=Wu,i.addFormIdentifierValue=al,i.addFormIdentifierValues=rl,i.addFormIdentifiers=Ku,i.addFormRevision=zl,i.addFormRevisionAttachment=Tl,i.addFormRevisionAttachments=Ol,i.addFormRevisions=ii,i.addFormSubmission=Do,i.addFormSubmissionAttachment=Oo,i.addFormSubmissionAttachments=oi,i.addFormSubmissions=lt,i.addFormSubscriber=Kl,i.addFormSubscribers=ai,i.addForms=ro,i.addGeoImage=Qo,i.addGeoImages=xo,i.addIssue=hm,i.addIssueAssociation=ph,i.addIssueAssociations=Ot,i.addIssueAttachment=gh,i.addIssueAttachments=Oi,i.addIssueComment=xh,i.addIssueCommentAttachment=$h,i.addIssueCommentAttachments=Uh,i.addIssueComments=em,i.addIssueType=My,i.addIssueTypeAttachment=_m,i.addIssueTypeAttachments=gm,i.addIssueTypeFieldValues=xm,i.addIssueTypeFieldValuesAttachment=Mp,i.addIssueTypeFieldValuesAttachments=Ci,i.addIssueTypeFieldValuesMany=ep,i.addIssueTypeFields=mp,i.addIssueTypeFieldsAttachment=$m,i.addIssueTypeFieldsAttachments=Um,i.addIssueTypeFieldsMany=pp,i.addIssueTypeIdentifier=Up,i.addIssueTypeIdentifierValue=ey,i.addIssueTypeIdentifierValues=ty,i.addIssueTypeIdentifiers=Lp,i.addIssueTypePriorities=yy,i.addIssueTypePriority=py,i.addIssueTypeStatus=Ly,i.addIssueTypeStatuses=ky,i.addIssueTypes=Ry,i.addIssueUpdate=xi,i.addIssueUpdates=en,i.addIssues=wi,i.addOrganization=$f,i.addOrganizationAccess=Pf,i.addOrganizationAccesses=Ff,i.addOrganizations=Cf,i.addProcedure=VA,i.addProcedureFieldValues=XP,i.addProcedureFieldValuesAttachment=CP,i.addProcedureFieldValuesAttachments=xn,i.addProcedureFieldValuesMany=QP,i.addProcedureInitiative=IA,i.addProcedureInitiatives=TA,i.addProcedureStep=$O,i.addProcedureStepAssignee=ZA,i.addProcedureStepAssignees=JA,i.addProcedureStepComment=uI,i.addProcedureStepComments=lI,i.addProcedureStepDefaultAssignee=FI,i.addProcedureStepDefaultAssignees=bI,i.addProcedureStepDefaultReviewer=qI,i.addProcedureStepDefaultReviewers=CI,i.addProcedureStepEvent=XI,i.addProcedureStepEvents=QI,i.addProcedureStepFieldValues=JT,i.addProcedureStepFieldValuesAttachment=qT,i.addProcedureStepFieldValuesAttachments=jn,i.addProcedureStepFieldValuesMany=XT,i.addProcedureStepFieldValuesReview=lO,i.addProcedureStepFieldValuesReviews=Ln,i.addProcedureStepFields=bT,i.addProcedureStepFieldsAttachment=oT,i.addProcedureStepFieldsAttachments=vn,i.addProcedureStepFieldsMany=_T,i.addProcedureStepReviewer=FO,i.addProcedureStepReviewers=bO,i.addProcedureSteps=UO,i.addProcedureType=oF,i.addProcedureTypeAttachment=JO,i.addProcedureTypeAttachments=XO,i.addProcedureTypeFields=bP,i.addProcedureTypeFieldsAttachment=lP,i.addProcedureTypeFieldsAttachments=oP,i.addProcedureTypeFieldsMany=_P,i.addProcedureTypes=hF,i.addProcedures=bt,i.addProject=dA,i.addProjectAccess=iS,i.addProjectAccesses=nS,i.addProjectAttachment=fS,i.addProjectAttachments=SS,i.addProjectComment=vS,i.addProjectComments=ES,i.addProjectFile=WS,i.addProjectFiles=KS,i.addProjects=rA,i.addTeam=UF,i.addTeamMembership=gF,i.addTeamMemberships=MF,i.addTeams=LF,i.addUser=rn,i.addUsers=mf,i.agentsReducer=Jc,i.agentsSlice=Ss,i.areArraysEqual=vb,i.assetAttachmentReducer=ua,i.assetAttachmentSlice=Is,i.assetCommentReducer=Fa,i.assetCommentSlice=Fs,i.assetReducer=ja,i.assetSlice=bs,i.assetTypeAttachmentReducer=Za,i.assetTypeAttachmentSlice=Ms,i.assetTypeFieldValuesAttachmentReducer=jr,i.assetTypeFieldValuesAttachmentSlice=zs,i.assetTypeFieldValuesReducer=Jr,i.assetTypeFieldValuesSlice=Cs,i.assetTypeFieldsAttachmentReducer=ur,i.assetTypeFieldsAttachmentSlice=Es,i.assetTypeFieldsReducer=Fr,i.assetTypeFieldsSlice=Vs,i.assetTypeIdentifierReducer=ld,i.assetTypeIdentifierSlice=$s,i.assetTypeIdentifierValueReducer=bd,i.assetTypeIdentifierValueSlice=Ls,i.assetTypeReducer=Cd,i.assetTypeSlice=ks,i.assetTypeStatusReducer=Qd,i.assetTypeStatusSlice=Gs,i.assetTypeStatusSortFn=Uc,i.authReducer=tu,i.authSlice=Wt,i.baseReducer=Zg,i.baseReducers=lc,i.clearTokens=m_,i.createModelAdapter=P,i.createOfflineAction=Zf,i.createPayload=R,i.createSelectionAdapter=Mb,i.deleteAsset=wa,i.deleteAssetAttachment=na,i.deleteAssetAttachments=Os,i.deleteAssetComment=Sa,i.deleteAssetComments=Lt,i.deleteAssetType=Vd,i.deleteAssetTypeAttachment=Ga,i.deleteAssetTypeAttachments=ws,i.deleteAssetTypeFieldValues=Hr,i.deleteAssetTypeFieldValuesAttachment=Er,i.deleteAssetTypeFieldValuesAttachments=js,i.deleteAssetTypeFieldValuesMany=Wr,i.deleteAssetTypeFields=Ar,i.deleteAssetTypeFieldsAttachment=nr,i.deleteAssetTypeFieldsAttachments=cr,i.deleteAssetTypeFieldsMany=Ir,i.deleteAssetTypeIdentifier=cd,i.deleteAssetTypeIdentifierValue=Id,i.deleteAssetTypeIdentifierValues=Td,i.deleteAssetTypeIdentifiers=ad,i.deleteAssetTypeStatus=Kd,i.deleteAssetTypeStatuses=Yd,i.deleteAssetTypes=zd,i.deleteAssets=gs,i.deleteConversation=Xb,i.deleteConversations=Qb,i.deleteDocument=bu,i.deleteDocumentAttachment=lu,i.deleteDocumentAttachments=ou,i.deleteDocuments=_u,i.deleteEmailDomain=Cu,i.deleteEmailDomains=$u,i.deleteForm=mo,i.deleteFormIdentifier=Qu,i.deleteFormIdentifierValue=hl,i.deleteFormIdentifierValues=ml,i.deleteFormIdentifiers=xu,i.deleteFormRevision=$l,i.deleteFormRevisionAttachment=gl,i.deleteFormRevisionAttachments=Ml,i.deleteFormRevisions=ni,i.deleteFormSubmission=Co,i.deleteFormSubmissionAttachment=go,i.deleteFormSubmissionAttachments=hi,i.deleteFormSubmissions=ot,i.deleteFormSubscriber=Ql,i.deleteFormSubscribers=ri,i.deleteForms=po,i.deleteGeoImage=sh,i.deleteGeoImages=ih,i.deleteIssue=Sm,i.deleteIssueAssociation=yh,i.deleteIssueAssociations=Pt,i.deleteIssueAttachment=Eh,i.deleteIssueAttachments=Pi,i.deleteIssueComment=cm,i.deleteIssueCommentAttachment=Hh,i.deleteIssueCommentAttachments=Wh,i.deleteIssueComments=am,i.deleteIssueType=Vy,i.deleteIssueTypeAttachment=Em,i.deleteIssueTypeAttachments=Bm,i.deleteIssueTypeFieldValues=cp,i.deleteIssueTypeFieldValuesAttachment=Bp,i.deleteIssueTypeFieldValuesAttachments=$i,i.deleteIssueTypeFieldValuesMany=ap,i.deleteIssueTypeFields=Ip,i.deleteIssueTypeFieldsAttachment=Hm,i.deleteIssueTypeFieldsAttachments=Wm,i.deleteIssueTypeFieldsMany=Tp,i.deleteIssueTypeIdentifier=Wp,i.deleteIssueTypeIdentifierValue=ay,i.deleteIssueTypeIdentifierValues=ry,i.deleteIssueTypeIdentifiers=Kp,i.deleteIssueTypePriorities=Oy,i.deleteIssueTypePriority=Ty,i.deleteIssueTypeStatus=Ky,i.deleteIssueTypeStatuses=Yy,i.deleteIssueTypes=zy,i.deleteIssueUpdate=tn,i.deleteIssueUpdates=sn,i.deleteIssues=vi,i.deleteOrganization=kf,i.deleteOrganizationAccess=Rf,i.deleteOrganizationAccesses=wf,i.deleteOrganizations=Nf,i.deleteProcedure=CA,i.deleteProcedureFieldValues=iF,i.deleteProcedureFieldValuesAttachment=NP,i.deleteProcedureFieldValuesAttachments=ec,i.deleteProcedureFieldValuesMany=nF,i.deleteProcedureInitiative=_A,i.deleteProcedureInitiatives=gA,i.deleteProcedureStep=NO,i.deleteProcedureStepAssignee=tI,i.deleteProcedureStepAssignees=sI,i.deleteProcedureStepComment=yI,i.deleteProcedureStepComments=fI,i.deleteProcedureStepDefaultAssignee=wI,i.deleteProcedureStepDefaultAssignees=vI,i.deleteProcedureStepDefaultReviewer=NI,i.deleteProcedureStepDefaultReviewers=GI,i.deleteProcedureStepEvent=iT,i.deleteProcedureStepEvents=nT,i.deleteProcedureStepFieldValues=sO,i.deleteProcedureStepFieldValuesAttachment=kT,i.deleteProcedureStepFieldValuesAttachments=qn,i.deleteProcedureStepFieldValuesMany=iO,i.deleteProcedureStepFieldValuesReview=yO,i.deleteProcedureStepFieldValuesReviews=kn,i.deleteProcedureStepFields=vT,i.deleteProcedureStepFieldsAttachment=fT,i.deleteProcedureStepFieldsAttachments=En,i.deleteProcedureStepFieldsMany=ET,i.deleteProcedureStepReviewer=wO,i.deleteProcedureStepReviewers=vO,i.deleteProcedureSteps=GO,i.deleteProcedureType=SF,i.deleteProcedureTypeAttachment=sP,i.deleteProcedureTypeAttachments=iP,i.deleteProcedureTypeFields=vP,i.deleteProcedureTypeFieldsAttachment=fP,i.deleteProcedureTypeFieldsAttachments=SP,i.deleteProcedureTypeFieldsMany=EP,i.deleteProcedureTypes=AF,i.deleteProcedures=_t,i.deleteProject=oA,i.deleteProjectAccess=uS,i.deleteProjectAccesses=lS,i.deleteProjectAttachment=PS,i.deleteProjectAttachments=FS,i.deleteProjectComment=jS,i.deleteProjectComments=qS,i.deleteProjectFile=JS,i.deleteProjectFiles=XS,i.deleteProjects=hA,i.deleteTeam=WF,i.deleteTeamMembership=BF,i.deleteTeamMemberships=VF,i.deleteTeams=KF,i.deleteUser=dn,i.deleteUsers=ff,i.dequeue=ib,i.discard=cb,i.documentAttachmentReducer=yu,i.documentAttachmentSlice=Ws,i.documentSlice=Ys,i.documentsReducer=gu,i.emailDomainsReducer=Nu,i.emailDomainsSlice=Js,i.emailRegex=Hb,i.enqueue=sb,i.enqueueRequest=Xf,i.extractResponseFromError=rb,i.fallbackToEmptyArray=S,i.fallbackToEmptyObject=ps,i.fetchBlobFromObjectUrl=Bc,i.fetchFileFromObjectUrl=Vc,i.formIdentifierReducer=il,i.formIdentifierSlice=Qs,i.formIdentifierValueReducer=Sl,i.formIdentifierValueSlice=ei,i.formReducer=yo,i.formRevisionAttachmentReducer=El,i.formRevisionAttachmentSlice=ti,i.formRevisionReducer=Gl,i.formRevisionsSlice=si,i.formSlice=di,i.formSubmissionAttachmentReducer=vo,i.formSubmissionAttachmentSlice=li,i.formSubmissionReducer=Ko,i.formSubmissionSlice=fi,i.formSubscriberReducer=io,i.formSubscriberSlice=ci,i.geoImageReducer=rh,i.geoImageSlice=Si,i.getClientSDK=hb,i.getClientStore=Rt,i.getDocumentSubTree=Gc,i.getDocumentTrees=Wb,i.getFileExtension=Ec,i.getLocalDateString=vc,i.getLocalRelativeDateString=zb,i.getOutboxCoordinator=St,i.getPresignedUrlExpiryDate=qc,i.getRenamedFile=qb,i.getRequestDescription=A,i.getS3FileKey=jb,i.hashFile=Ct,i.initSDK=wR,i.initializeAssetAttachments=Qc,i.initializeAssetComments=oa,i.initializeAssetTypeAttachments=Ca,i.initializeAssetTypeFieldValues=Cr,i.initializeAssetTypeFieldValuesAttachments=_r,i.initializeAssetTypeFields=or,i.initializeAssetTypeFieldsAttachments=Xa,i.initializeAssetTypeIdentifierValues=hd,i.initializeAssetTypeIdentifiers=Qr,i.initializeAssetTypeStatuses=Ud,i.initializeAssetTypes=gd,i.initializeAssets=_a,i.initializeConversations=Wc,i.initializeDocumentAttachments=iu,i.initializeDocuments=Su,i.initializeEmailDomains=Eu,i.initializeFormIdentifierValues=cl,i.initializeFormIdentifiers=Hu,i.initializeFormRevisionAttachments=Il,i.initializeFormRevisions=Vl,i.initializeFormSubmissionAttachments=To,i.initializeFormSubmissions=Bo,i.initializeFormSubscribers=Wl,i.initializeForms=co,i.initializeGeoImages=Zo,i.initializeIssueAssociations=uh,i.initializeIssueAttachments=_h,i.initializeIssueCommentAttachments=Ch,i.initializeIssueComments=Qh,i.initializeIssueTypeAttachments=bm,i.initializeIssueTypeFieldValues=Qm,i.initializeIssueTypeFieldValuesAttachments=gp,i.initializeIssueTypeFields=hp,i.initializeIssueTypeFieldsAttachments=Cm,i.initializeIssueTypeIdentifierValues=xp,i.initializeIssueTypeIdentifiers=$p,i.initializeIssueTypePriorities=my,i.initializeIssueTypeStatuses=Uy,i.initializeIssueTypes=gy,i.initializeIssueUpdates=xy,i.initializeIssues=om,i.initializeOrganizationAccesses=Of,i.initializeOrganizations=Df,i.initializeProcedureFieldValues=JP,i.initializeProcedureFieldValuesAttachments=qP,i.initializeProcedureInitiatives=AA,i.initializeProcedureStepAssignees=YA,i.initializeProcedureStepComments=dI,i.initializeProcedureStepDefaultAssignees=PI,i.initializeProcedureStepDefaultReviewers=jI,i.initializeProcedureStepEvents=JI,i.initializeProcedureStepFieldValues=ZT,i.initializeProcedureStepFieldValuesAttachments=jT,i.initializeProcedureStepFieldValuesReviews=uO,i.initializeProcedureStepFields=FT,i.initializeProcedureStepFieldsAttachments=lT,i.initializeProcedureStepReviewers=PO,i.initializeProcedureSteps=jO,i.initializeProcedureTypeAttachments=ZO,i.initializeProcedureTypeFields=FP,i.initializeProcedureTypeFieldsAttachments=uP,i.initializeProcedureTypes=lF,i.initializeProcedures=BA,i.initializeProjectAccesses=sS,i.initializeProjectAttachments=yS,i.initializeProjectComments=wS,i.initializeProjectFiles=NS,i.initializeProjects=nA,i.initializeTeamMemberships=_F,i.initializeTeams=$F,i.initializeUsers=lf,i.isCloudfrontUrl=Dc,i.isImageFile=Cb,i.isObjectUrl=zc,i.isPresignedUrlExpired=Cc,i.isS3Url=jc,i.isToday=Vb,i.issueAssociationReducer=Fh,i.issueAssociationSlice=Ii,i.issueAttachmentReducer=jh,i.issueAttachmentSlice=Ti,i.issueCommentAttachmentReducer=Jh,i.issueCommentAttachmentSlice=bi,i.issueCommentReducer=um,i.issueCommentSlice=gi,i.issueReducer=Pm,i.issueSlice=Ri,i.issueTypeAttachmentReducer=jm,i.issueTypeAttachmentSlice=Ei,i.issueTypeFieldValuesAttachmentReducer=qp,i.issueTypeFieldValuesAttachmentSlice=qi,i.issueTypeFieldValuesReducer=lp,i.issueTypeFieldValuesSlice=Di,i.issueTypeFieldsAttachmentReducer=Jm,i.issueTypeFieldsAttachmentSlice=Vi,i.issueTypeFieldsReducer=bp,i.issueTypeFieldsSlice=ji,i.issueTypeIdentifierReducer=Xp,i.issueTypeIdentifierSlice=Li,i.issueTypeIdentifierValueReducer=oy,i.issueTypeIdentifierValueSlice=Ni,i.issueTypePriorityReducer=by,i.issueTypePrioritySlice=Gi,i.issueTypePrioritySortFn=kc,i.issueTypeReducer=Cy,i.issueTypeSlice=Ki,i.issueTypeStatusReducer=Xy,i.issueTypeStatusSlice=Zi,i.issueTypeStatusSortFn=Lc,i.issueUpdateReducer=df,i.issueUpdateSlice=Qi,i.logOnlyOnce=$b,i.markAsDeleted=Qf,i.markForDeletion=x_,i.memoize=ms,i.organizationAccessReducer=vf,i.organizationAccessSlice=ln,i.organizationReducer=Yf,i.organizationSlice=on,i.outboxReducer=eS,i.outboxSlice=hn,i.overmapEnhancer=eM,i.overmapReducer=Jg,i.overmapReducers=QF,i.performRequest=pc,i.performRequestFromAction=nb,i.procedureFieldValuesAttachmentReducer=GP,i.procedureFieldValuesAttachmentSlice=Qn,i.procedureFieldValuesReducer=cF,i.procedureFieldValuesSlice=sc,i.procedureInitiativeReducer=MA,i.procedureInitiativeSlice=Tn,i.procedureReducer=$A,i.procedureSlice=On,i.procedureStepAssigneeReducer=aI,i.procedureStepAssigneeSlice=Pn,i.procedureStepCommentReducer=TI,i.procedureStepCommentSlice=Fn,i.procedureStepDefaultAssigneeReducer=zI,i.procedureStepDefaultAssigneeSlice=bn,i.procedureStepDefaultReviewerReducer=YI,i.procedureStepDefaultReviewerSlice=gn,i.procedureStepEventReducer=dT,i.procedureStepEventSlice=Rn,i.procedureStepFieldValuesAttachmentReducer=KT,i.procedureStepFieldValuesAttachmentSlice=Dn,i.procedureStepFieldValuesReducer=nO,i.procedureStepFieldValuesReviewReducer=TO,i.procedureStepFieldValuesReviewSlice=Un,i.procedureStepFieldValuesSlice=$n,i.procedureStepFieldsAttachmentReducer=OT,i.procedureStepFieldsAttachmentSlice=wn,i.procedureStepFieldsReducer=zT,i.procedureStepFieldsSlice=Vn,i.procedureStepReducer=HO,i.procedureStepReviewerReducer=zO,i.procedureStepReviewerSlice=Nn,i.procedureStepSlice=Gn,i.procedureTypeAttachmentReducer=nP,i.procedureTypeAttachmentSlice=Kn,i.procedureTypeFieldsAttachmentReducer=AP,i.procedureTypeFieldsAttachmentSlice=Zn,i.procedureTypeFieldsReducer=BP,i.procedureTypeFieldsSlice=Xn,i.procedureTypeReducer=IF,i.procedureTypeSlice=nc,i.projectAccessReducer=oS,i.projectAccessSlice=mn,i.projectAttachmentReducer=MS,i.projectAttachmentSlice=yn,i.projectCommentReducer=LS,i.projectCommentSlice=Sn,i.projectFileReducer=sA,i.projectFileSlice=An,i.projectReducer=mA,i.projectSlice=In,i.rehydratedReducer=FF,i.rehydratedSlice=ac,i.restructureSelectorWithArgs=y,i.runMiddleware=fb,i.selectAccessToken=p_,i.selectAccessesByUserOfProject=tg,i.selectAccessibleProjects=ag,i.selectActiveOrganizationAccess=Z_,i.selectAllDocumentAttachments=Ks,i.selectAssetAttachmentById=aa,i.selectAssetAttachmentMapping=ca,i.selectAssetAttachments=Ps,i.selectAssetAttachmentsByIds=ra,i.selectAssetById=za,i.selectAssetCommentById=Ia,i.selectAssetCommentMapping=Aa,i.selectAssetComments=kt,i.selectAssetCommentsByIds=Ta,i.selectAssetTypeAttachmentById=Wa,i.selectAssetTypeAttachmentMapping=Ha,i.selectAssetTypeAttachments=vs,i.selectAssetTypeAttachmentsByIds=Ka,i.selectAssetTypeById=jd,i.selectAssetTypeFieldValues=Gt,i.selectAssetTypeFieldValuesAttachmentById=Vr,i.selectAssetTypeFieldValuesAttachments=qs,i.selectAssetTypeFieldValuesAttachmentsByIds=zr,i.selectAssetTypeFieldValuesAttachmentsMapping=Br,i.selectAssetTypeFieldValuesById=Yr,i.selectAssetTypeFieldValuesByIds=Zr,i.selectAssetTypeFieldValuesMapping=Kr,i.selectAssetTypeFieldValuesOfAsset=c_,i.selectAssetTypeFields=vt,i.selectAssetTypeFieldsAttachmentById=rr,i.selectAssetTypeFieldsAttachments=Bs,i.selectAssetTypeFieldsAttachmentsByIds=dr,i.selectAssetTypeFieldsAttachmentsMapping=ar,i.selectAssetTypeFieldsById=Or,i.selectAssetTypeFieldsByIds=Pr,i.selectAssetTypeFieldsMapping=Tr,i.selectAssetTypeFieldsOfAssetType=i_,i.selectAssetTypeIdentifierById=dd,i.selectAssetTypeIdentifierMapping=rd,i.selectAssetTypeIdentifierValueById=Pd,i.selectAssetTypeIdentifierValueMapping=Od,i.selectAssetTypeIdentifierValues=Ht,i.selectAssetTypeIdentifierValuesByIds=Fd,i.selectAssetTypeIdentifierValuesOfAsset=d_,i.selectAssetTypeIdentifierValuesOfIdentifier=u_,i.selectAssetTypeIdentifiers=Us,i.selectAssetTypeIdentifiersByIds=ud,i.selectAssetTypeIdentifiersOfAssetType=r_,i.selectAssetTypeStatusById=Jd,i.selectAssetTypeStatusMapping=Zd,i.selectAssetTypeStatuses=Hs,i.selectAssetTypeStatusesByIds=Xd,i.selectAssetTypeStatusesOfAssetType=o_,i.selectAssetTypeValuesOfAssetType=a_,i.selectAssetTypes=Ns,i.selectAssetTypesByIds=qd,i.selectAssetTypesMapping=Dd,i.selectAssetTypesOfOrganization=l_,i.selectAssets=Nt,i.selectAssetsByIds=Da,i.selectAssetsMapping=Ba,i.selectAssetsOfAssetType=Va,i.selectAssetsOfProject=t_,i.selectAttachmentsOfAsset=da,i.selectAttachmentsOfAssetType=Ya,i.selectAttachmentsOfAssetTypeFieldValues=Dr,i.selectAttachmentsOfAssetTypeFields=s_,i.selectAttachmentsOfDocument=f_,i.selectAttachmentsOfFormRevision=F_,i.selectAttachmentsOfFormSubmission=wo,i.selectAttachmentsOfIssue=Vh,i.selectAttachmentsOfIssueComment=B_,i.selectAttachmentsOfIssueType=D_,i.selectAttachmentsOfIssueTypeFieldValues=jp,i.selectAttachmentsOfIssueTypeFields=j_,i.selectAttachmentsOfProcedureFieldValues=YP,i.selectAttachmentsOfProcedureStepFieldValues=WT,i.selectAttachmentsOfProcedureStepFields=AT,i.selectAttachmentsOfProcedureType=qg,i.selectAttachmentsOfProcedureTypeFields=Cg,i.selectAttachmentsOfProject=ig,i.selectCommentsOfAsset=Oa,i.selectCommentsOfAssets=Pa,i.selectCommentsOfIssue=V_,i.selectCommentsOfProject=ng,i.selectCommentsOfProjects=cg,i.selectConversation=e_,i.selectConversationMapping=As,i.selectConversations=xb,i.selectCurrentUser=Af,i.selectDeletedRequests=X_,i.selectDescendantsOfDocument=wu,i.selectDocumentAttachmentById=mu,i.selectDocumentAttachmentMapping=hu,i.selectDocumentAttachmentsByIds=pu,i.selectDocumentById=Mu,i.selectDocuments=Kt,i.selectDocumentsByIds=Ru,i.selectDocumentsMapping=Zs,i.selectEmailDomainById=Lu,i.selectEmailDomains=Xs,i.selectEmailDomainsAsMapping=Uu,i.selectEmailDomainsByIds=ku,i.selectEmailDomainsOfOrganization=I_,i.selectFieldValuesOfProcedure=Lg,i.selectFormById=So,i.selectFormIdentifierById=tl,i.selectFormIdentifierMapping=el,i.selectFormIdentifierValueById=yl,i.selectFormIdentifierValueMapping=pl,i.selectFormIdentifierValues=Yt,i.selectFormIdentifierValuesByIds=fl,i.selectFormIdentifierValuesOfFormSubmission=O_,i.selectFormIdentifierValuesOfIdentifier=P_,i.selectFormIdentifiers=xs,i.selectFormIdentifiersByIds=sl,i.selectFormIdentifiersOfForm=T_,i.selectFormMapping=fo,i.selectFormRevisionAttachmentById=wl,i.selectFormRevisionAttachments=Rl,i.selectFormRevisionAttachmentsByIds=vl,i.selectFormRevisionAttachmentsMapping=Zt,i.selectFormRevisionById=Ll,i.selectFormRevisionMapping=Ul,i.selectFormRevisions=Jt,i.selectFormRevisionsByIds=kl,i.selectFormRevisionsOfForm=Nl,i.selectFormSubmissionAttachemntsByIds=yi,i.selectFormSubmissionAttachmentById=Mo,i.selectFormSubmissionAttachments=pi,i.selectFormSubmissionAttachmentsByIds=Ro,i.selectFormSubmissionAttachmentsMapping=mi,i.selectFormSubmissionById=Uo,i.selectFormSubmissions=k,i.selectFormSubmissionsByIds=Lo,i.selectFormSubmissionsMapping=$o,i.selectFormSubmissionsOfAsset=Ho,i.selectFormSubmissionsOfAssets=Wo,i.selectFormSubmissionsOfForm=ko,i.selectFormSubmissionsOfIssue=No,i.selectFormSubmissionsOfIssues=Go,i.selectFormSubmissionsOfOrganization=M_,i.selectFormSubmissionsOfOrganizationAndForm=v_,i.selectFormSubmissionsOfProject=R_,i.selectFormSubmissionsOfProjectAndForm=w_,i.selectFormSubscriberById=eo,i.selectFormSubscriberMapping=xl,i.selectFormSubscribers=Xt,i.selectFormSubscribersByIds=to,i.selectFormSubscribersOfForm=so,i.selectFormSubscribersOfUser=__,i.selectForms=ui,i.selectFormsByIds=Ao,i.selectFormsOfOrganization=g_,i.selectGeoImageById=ch,i.selectGeoImageMapping=nh,i.selectGeoImages=Ai,i.selectGeoImagesByIds=ah,i.selectGeoImagesOfProject=E_,i.selectIsLoggedIn=y_,i.selectIssueAssociationById=Sh,i.selectIssueAssociationMapping=fh,i.selectIssueAssociations=Ft,i.selectIssueAssociationsByIds=Ah,i.selectIssueAssociationsOfAsset=Oh,i.selectIssueAssociationsOfAssets=Ph,i.selectIssueAssociationsOfIssue=Th,i.selectIssueAssociationsOfIssues=Ih,i.selectIssueAttachmentById=zh,i.selectIssueAttachmentMapping=Bh,i.selectIssueAttachments=Fi,i.selectIssueAttachmentsByIds=Dh,i.selectIssueById=Im,i.selectIssueCommentAttachmentById=Yh,i.selectIssueCommentAttachmentMapping=Kh,i.selectIssueCommentAttachments=_i,i.selectIssueCommentAttachmentsByIds=Zh,i.selectIssueCommentById=rm,i.selectIssueCommentMapping=Mi,i.selectIssueCommentsByIds=dm,i.selectIssueMapping=Am,i.selectIssueTypeAttachmentById=zm,i.selectIssueTypeAttachmentMapping=Vm,i.selectIssueTypeAttachments=Bi,i.selectIssueTypeAttachmentsByIds=Dm,i.selectIssueTypeById=jy,i.selectIssueTypeFieldValues=xt,i.selectIssueTypeFieldValuesAttachmentById=zp,i.selectIssueTypeFieldValuesAttachments=Ui,i.selectIssueTypeFieldValuesAttachmentsByIds=Dp,i.selectIssueTypeFieldValuesAttachmentsMapping=Vp,i.selectIssueTypeFieldValuesById=dp,i.selectIssueTypeFieldValuesByIds=up,i.selectIssueTypeFieldValuesMapping=rp,i.selectIssueTypeFieldValuesOfIssue=q_,i.selectIssueTypeFields=Et,i.selectIssueTypeFieldsAttachmentById=Ym,i.selectIssueTypeFieldsAttachments=zi,i.selectIssueTypeFieldsAttachmentsByIds=Zm,i.selectIssueTypeFieldsAttachmentsMapping=Km,i.selectIssueTypeFieldsById=Pp,i.selectIssueTypeFieldsByIds=Fp,i.selectIssueTypeFieldsMapping=Op,i.selectIssueTypeFieldsOfIssueType=C_,i.selectIssueTypeIdentifierById=Zp,i.selectIssueTypeIdentifierMapping=Yp,i.selectIssueTypeIdentifierValueById=uy,i.selectIssueTypeIdentifierValueMapping=dy,i.selectIssueTypeIdentifierValues=es,i.selectIssueTypeIdentifierValuesByIds=ly,i.selectIssueTypeIdentifierValuesOfIdentifier=N_,i.selectIssueTypeIdentifierValuesOfIssue=k_,i.selectIssueTypeIdentifiers=ki,i.selectIssueTypeIdentifiersByIds=Jp,i.selectIssueTypeIdentifiersOfIssueType=L_,i.selectIssueTypeMapping=Dy,i.selectIssueTypePriorities=Hi,i.selectIssueTypePrioritiesByIds=Fy,i.selectIssueTypePrioritiesOfIssueType=G_,i.selectIssueTypePriorityById=Wi,i.selectIssueTypePriorityMapping=Py,i.selectIssueTypeStatusById=Xi,i.selectIssueTypeStatusMapping=Zy,i.selectIssueTypeStatuses=Ji,i.selectIssueTypeStatusesByIds=Jy,i.selectIssueTypeStatusesOfIssueType=W_,i.selectIssueTypeValuesOfIssueType=U_,i.selectIssueTypes=Yi,i.selectIssueTypesByIds=qy,i.selectIssueTypesOfOrganization=H_,i.selectIssueUpdateById=cf,i.selectIssueUpdateMapping=nn,i.selectIssueUpdates=cn,i.selectIssueUpdatesByIds=af,i.selectIssueUpdatesOfIssue=rf,i.selectIssues=Qt,i.selectIssuesByIds=Tm,i.selectIssuesOfIssueType=Om,i.selectIssuesOfProject=z_,i.selectLatestAssetTypeFieldsOfAssetType=n_,i.selectLatestFieldsByProcedureStep=bg,i.selectLatestFormRevisionOfForm=b_,i.selectLatestIssueTypeFieldsOfIssueType=$_,i.selectLatestProcedureStepFieldValuesReviewByProcedureStepFieldValues=Eg,i.selectLatestProcedureStepFieldsOfProcedureStep=Fg,i.selectLatestProcedureTypeFieldsOfProcedureType=Ug,i.selectLatestRetryTime=Q_,i.selectLatestReviewOfProcedureStepFieldValues=Rg,i.selectMembershipsByUserOfTeam=Wg,i.selectOrganizationAccessById=Ef,i.selectOrganizationAccessMapping=is,i.selectOrganizationAccessUserMapping=Vf,i.selectOrganizationAccessesByIds=Bf,i.selectOrganizationById=Wf,i.selectOrganizationDocuments=A_,i.selectOrganizations=Hf,i.selectOrganizationsByIds=Kf,i.selectOrganizationsMapping=Gf,i.selectProcedureById=LA,i.selectProcedureFieldValues=ic,i.selectProcedureFieldValuesAttachmentById=WP,i.selectProcedureFieldValuesAttachments=tc,i.selectProcedureFieldValuesAttachmentsByIds=KP,i.selectProcedureFieldValuesAttachmentsMapping=HP,i.selectProcedureFieldValuesById=rF,i.selectProcedureFieldValuesByIds=dF,i.selectProcedureFieldValuesMapping=aF,i.selectProcedureInitiativeById=wA,i.selectProcedureInitiatives=as,i.selectProcedureInitiativesByIds=vA,i.selectProcedureInitiativesMapping=RA,i.selectProcedureInitiativesOfProcedureType=ug,i.selectProcedureInitiativesOfProject=dg,i.selectProcedureStepAssigneeById=nI,i.selectProcedureStepAssignees=Vt,i.selectProcedureStepAssigneesByIds=cI,i.selectProcedureStepAssigneesMapping=iI,i.selectProcedureStepAssigneesOfProcedure=og,i.selectProcedureStepAssigneesOfProcedureAndProcedureStep=mg,i.selectProcedureStepAssigneesOfProcedureStep=hg,i.selectProcedureStepById=WO,i.selectProcedureStepCommentById=AI,i.selectProcedureStepComments=zt,i.selectProcedureStepCommentsByIds=II,i.selectProcedureStepCommentsMapping=SI,i.selectProcedureStepCommentsOfProcedure=pg,i.selectProcedureStepCommentsOfProcedureAndProcedureStep=fg,i.selectProcedureStepCommentsOfProcedureStep=yg,i.selectProcedureStepDefaultAssigneeById=BI,i.selectProcedureStepDefaultAssignees=_n,i.selectProcedureStepDefaultAssigneesByIds=VI,i.selectProcedureStepDefaultAssigneesMapping=EI,i.selectProcedureStepDefaultAssigneesOfProcedureStep=Sg,i.selectProcedureStepDefaultReviewerById=WI,i.selectProcedureStepDefaultReviewers=Mn,i.selectProcedureStepDefaultReviewersByIds=KI,i.selectProcedureStepDefaultReviewersMapping=HI,i.selectProcedureStepDefaultReviewersOfProcedureStep=Ag,i.selectProcedureStepEventById=aT,i.selectProcedureStepEvents=Dt,i.selectProcedureStepEventsByIds=rT,i.selectProcedureStepEventsMapping=cT,i.selectProcedureStepEventsOfProcedure=Ig,i.selectProcedureStepEventsOfProcedureAndProcedureStep=Og,i.selectProcedureStepEventsOfProcedureStep=Tg,i.selectProcedureStepFieldValues=mt,i.selectProcedureStepFieldValuesAttachmentById=GT,i.selectProcedureStepFieldValuesAttachments=Cn,i.selectProcedureStepFieldValuesAttachmentsByIds=HT,i.selectProcedureStepFieldValuesAttachmentsMapping=NT,i.selectProcedureStepFieldValuesById=aO,i.selectProcedureStepFieldValuesByIds=rO,i.selectProcedureStepFieldValuesMapping=cO,i.selectProcedureStepFieldValuesOfProcedure=_g,i.selectProcedureStepFieldValuesOfProcedureAndProcedureStep=Mg,i.selectProcedureStepFieldValuesOfProcedureStep=gg,i.selectProcedureStepFieldValuesReviewById=SO,i.selectProcedureStepFieldValuesReviews=pt,i.selectProcedureStepFieldValuesReviewsByIds=AO,i.selectProcedureStepFieldValuesReviewsMapping=fO,i.selectProcedureStepFieldValuesReviewsOfProcedure=wg,i.selectProcedureStepFieldValuesReviewsOfProcedureAndProcedureStep=vg,i.selectProcedureStepFields=rs,i.selectProcedureStepFieldsAttachmentById=IT,i.selectProcedureStepFieldsAttachments=Bn,i.selectProcedureStepFieldsAttachmentsByIds=TT,i.selectProcedureStepFieldsAttachmentsMapping=ST,i.selectProcedureStepFieldsById=BT,i.selectProcedureStepFieldsByIds=VT,i.selectProcedureStepFieldsMapping=zn,i.selectProcedureStepFieldsOfProcedureStep=Pg,i.selectProcedureStepReviewerById=BO,i.selectProcedureStepReviewers=jt,i.selectProcedureStepReviewersByIds=VO,i.selectProcedureStepReviewersMapping=EO,i.selectProcedureStepReviewersOfProcedure=Bg,i.selectProcedureStepReviewersOfProcedureAndProcedureStep=zg,i.selectProcedureStepReviewersOfProcedureStep=Vg,i.selectProcedureSteps=Wn,i.selectProcedureStepsByIds=KO,i.selectProcedureStepsMapping=Hn,i.selectProcedureStepsMappingOfProcedureType=Dg,i.selectProcedureStepsOfProcedureType=jg,i.selectProcedureTypeAttachmentById=aP,i.selectProcedureTypeAttachmentMapping=cP,i.selectProcedureTypeAttachments=Yn,i.selectProcedureTypeAttachmentsByIds=rP,i.selectProcedureTypeById=OF,i.selectProcedureTypeFields=ds,i.selectProcedureTypeFieldsAttachmentById=TP,i.selectProcedureTypeFieldsAttachments=Jn,i.selectProcedureTypeFieldsAttachmentsByIds=OP,i.selectProcedureTypeFieldsAttachmentsMapping=IP,i.selectProcedureTypeFieldsById=zP,i.selectProcedureTypeFieldsByIds=DP,i.selectProcedureTypeFieldsMapping=VP,i.selectProcedureTypeFieldsOfProcedureType=$g,i.selectProcedureTypes=cc,i.selectProcedureTypesByIds=PF,i.selectProcedureTypesMapping=TF,i.selectProcedureTypesOfOrganization=kg,i.selectProcedures=ht,i.selectProceduresByIds=kA,i.selectProceduresMapping=UA,i.selectProceduresOfAsset=GA,i.selectProceduresOfAssets=HA,i.selectProceduresOfProcedureInitiative=WA,i.selectProceduresOfProcedureType=NA,i.selectProceduresOfProject=lg,i.selectProjectAccessById=hS,i.selectProjectAccessMapping=pn,i.selectProjectAccesses=Bt,i.selectProjectAccessesByIds=mS,i.selectProjectAccessesOfProject=eg,i.selectProjectAttachmentById=_S,i.selectProjectAttachmentMapping=bS,i.selectProjectAttachments=fn,i.selectProjectAttachmentsByIds=gS,i.selectProjectById=yA,i.selectProjectCommentById=$S,i.selectProjectCommentMapping=CS,i.selectProjectComments=ns,i.selectProjectCommentsByIds=US,i.selectProjectDocuments=S_,i.selectProjectFileById=eA,i.selectProjectFileMapping=QS,i.selectProjectFiles=xS,i.selectProjectFilesByIds=tA,i.selectProjectMapping=pA,i.selectProjects=cs,i.selectProjectsByIds=fA,i.selectProjectsOfOrganization=rg,i.selectRehydrated=Hg,i.selectReviewsOfProcedureStepFieldValues=IO,i.selectTeamById=ZF,i.selectTeamMembershipById=jF,i.selectTeamMemberships=us,i.selectTeamMembershipsByIds=qF,i.selectTeamMembershipsMapping=DF,i.selectTeams=uc,i.selectTeamsByIds=JF,i.selectTeamsMapping=YF,i.selectTeamsOfOrganization=Yg,i.selectUserById=ss,i.selectUsers=ts,i.selectUsersByIds=If,i.selectUsersMapping=un,i.selectUsersOfOrganization=J_,i.selectUsersOfProject=sg,i.selectUsersOfTeam=Kg,i.setAsset=va,i.setAssetAttachment=ea,i.setAssetAttachments=ta,i.setAssetComment=ma,i.setAssetComments=pa,i.setAssetType=Md,i.setAssetTypeAttachment=Ua,i.setAssetTypeAttachments=La,i.setAssetTypeFieldValues=Lr,i.setAssetTypeFieldValuesAttachment=Mr,i.setAssetTypeFieldValuesAttachments=Rr,i.setAssetTypeFieldValuesMany=kr,i.setAssetTypeFields=pr,i.setAssetTypeFieldsAttachment=er,i.setAssetTypeFieldsAttachments=tr,i.setAssetTypeFieldsMany=yr,i.setAssetTypeIdentifier=td,i.setAssetTypeIdentifierValue=yd,i.setAssetTypeIdentifierValues=fd,i.setAssetTypeIdentifiers=sd,i.setAssetTypeStatus=Nd,i.setAssetTypeStatuses=Gd,i.setAssetTypes=Rd,i.setAssets=Ea,i.setClientSDK=ob,i.setClientStore=ub,i.setConversation=Yc,i.setConversations=Zb,i.setCurrentUser=K_,i.setCurrentUserProfile=Y_,i.setDocument=Tu,i.setDocumentAttachment=au,i.setDocumentAttachments=ru,i.setDocuments=Ou,i.setEmailDomain=zu,i.setEmailDomains=Du,i.setForm=uo,i.setFormIdentifier=Yu,i.setFormIdentifierValue=dl,i.setFormIdentifierValues=ul,i.setFormIdentifiers=Zu,i.setFormRevision=Dl,i.setFormRevisionAttachment=Pl,i.setFormRevisionAttachments=Fl,i.setFormRevisions=jl,i.setFormSubmission=Vo,i.setFormSubmissionAttachment=Po,i.setFormSubmissionAttachments=Fo,i.setFormSubmissions=zo,i.setFormSubscriber=Yl,i.setFormSubscribers=Zl,i.setForms=lo,i.setGeoImage=Jo,i.setGeoImages=Xo,i.setIssue=mm,i.setIssueAssociation=oh,i.setIssueAssociations=lh,i.setIssueAttachment=Mh,i.setIssueAttachments=Rh,i.setIssueComment=tm,i.setIssueCommentAttachment=Lh,i.setIssueCommentAttachments=kh,i.setIssueComments=sm,i.setIssueType=wy,i.setIssueTypeAttachment=Mm,i.setIssueTypeAttachments=Rm,i.setIssueTypeFieldValues=tp,i.setIssueTypeFieldValuesAttachment=Rp,i.setIssueTypeFieldValuesAttachments=wp,i.setIssueTypeFieldValuesMany=sp,i.setIssueTypeFields=yp,i.setIssueTypeFieldsAttachment=Lm,i.setIssueTypeFieldsAttachments=km,i.setIssueTypeFieldsMany=fp,i.setIssueTypeIdentifier=kp,i.setIssueTypeIdentifierValue=sy,i.setIssueTypeIdentifierValues=iy,i.setIssueTypeIdentifiers=Np,i.setIssueTypePriorities=Sy,i.setIssueTypePriority=fy,i.setIssueTypeStatus=Ny,i.setIssueTypeStatuses=Gy,i.setIssueTypes=vy,i.setIssueUpdate=ef,i.setIssueUpdates=tf,i.setIssues=pm,i.setLoggedIn=eu,i.setOrganization=qf,i.setOrganizationAccess=bf,i.setOrganizationAccesses=_f,i.setOrganizations=jf,i.setProcedure=zA,i.setProcedureFieldValues=xP,i.setProcedureFieldValuesAttachment=$P,i.setProcedureFieldValuesAttachments=UP,i.setProcedureFieldValuesMany=eF,i.setProcedureInitiative=OA,i.setProcedureInitiatives=PA,i.setProcedureStep=qO,i.setProcedureStepAssignee=XA,i.setProcedureStepAssignees=QA,i.setProcedureStepComment=oI,i.setProcedureStepComments=hI,i.setProcedureStepDefaultAssignee=_I,i.setProcedureStepDefaultAssignees=gI,i.setProcedureStepDefaultReviewer=$I,i.setProcedureStepDefaultReviewers=UI,i.setProcedureStepEvent=xI,i.setProcedureStepEvents=eT,i.setProcedureStepFieldValues=QT,i.setProcedureStepFieldValuesAttachment=CT,i.setProcedureStepFieldValuesAttachments=$T,i.setProcedureStepFieldValuesMany=xT,i.setProcedureStepFieldValuesReview=oO,i.setProcedureStepFieldValuesReviews=hO,i.setProcedureStepFields=gT,i.setProcedureStepFieldsAttachment=hT,i.setProcedureStepFieldsAttachments=mT,i.setProcedureStepFieldsMany=MT,i.setProcedureStepReviewer=_O,i.setProcedureStepReviewers=gO,i.setProcedureSteps=CO,i.setProcedureType=mF,i.setProcedureTypeAttachment=QO,i.setProcedureTypeAttachments=xO,i.setProcedureTypeFields=gP,i.setProcedureTypeFieldsAttachment=hP,i.setProcedureTypeFieldsAttachments=mP,i.setProcedureTypeFieldsMany=MP,i.setProcedureTypes=pF,i.setProcedures=DA,i.setProject=aA,i.setProjectAccess=cS,i.setProjectAccesses=aS,i.setProjectAttachment=AS,i.setProjectAttachments=IS,i.setProjectComment=BS,i.setProjectComments=VS,i.setProjectFile=GS,i.setProjectFiles=HS,i.setProjects=cA,i.setRehydrated=Gg,i.setTeam=kF,i.setTeamMembership=RF,i.setTeamMemberships=wF,i.setTeams=NF,i.setTokens=h_,i.setUser=hf,i.setUsers=of,i.shallowEqual=wb,i.slugify=Nb,i.spacesToDashesLower=kb,i.submittedAtModelSortFn=Tt,i.teamMembershipReducer=zF,i.teamMembershipSlice=rc,i.teamReducer=XF,i.teamSlice=dc,i.toFileNameSafeString=Lb,i.toUuidArray=w,i.toUuidIdRecord=Ub,i.truncate=Gb,i.updateAsset=Ma,i.updateAssetAttachment=sa,i.updateAssetAttachments=ia,i.updateAssetComment=ya,i.updateAssetComments=fa,i.updateAssetType=Ed,i.updateAssetTypeAttachment=ka,i.updateAssetTypeAttachments=Na,i.updateAssetTypeFieldValues=Nr,i.updateAssetTypeFieldValuesAttachment=wr,i.updateAssetTypeFieldValuesAttachments=vr,i.updateAssetTypeFieldValuesMany=Gr,i.updateAssetTypeFields=fr,i.updateAssetTypeFieldsAttachment=sr,i.updateAssetTypeFieldsAttachments=ir,i.updateAssetTypeFieldsMany=Sr,i.updateAssetTypeIdentifier=id,i.updateAssetTypeIdentifierValue=Sd,i.updateAssetTypeIdentifierValues=Ad,i.updateAssetTypeIdentifiers=nd,i.updateAssetTypeStatus=Hd,i.updateAssetTypeStatuses=Wd,i.updateAssetTypes=Bd,i.updateAssets=Ra,i.updateConversation=Zc,i.updateConversations=Jb,i.updateDocument=Pu,i.updateDocumentAttachment=du,i.updateDocumentAttachments=uu,i.updateDocuments=Fu,i.updateEmailDomain=ju,i.updateEmailDomains=qu,i.updateForm=oo,i.updateFormIdentifier=Ju,i.updateFormIdentifierValue=ll,i.updateFormIdentifierValues=ol,i.updateFormIdentifiers=Xu,i.updateFormRevision=ql,i.updateFormRevisionAttachment=bl,i.updateFormRevisionAttachments=_l,i.updateFormRevisions=Cl,i.updateFormSubmission=jo,i.updateFormSubmissionAttachment=bo,i.updateFormSubmissionAttachments=_o,i.updateFormSubmissions=qo,i.updateFormSubscriber=Jl,i.updateFormSubscribers=Xl,i.updateForms=ho,i.updateGeoImage=eh,i.updateGeoImages=th,i.updateIssue=ym,i.updateIssueAssociation=hh,i.updateIssueAssociations=mh,i.updateIssueAttachment=wh,i.updateIssueAttachments=vh,i.updateIssueComment=im,i.updateIssueCommentAttachment=Nh,i.updateIssueCommentAttachments=Gh,i.updateIssueComments=nm,i.updateIssueType=Ey,i.updateIssueTypeAttachment=wm,i.updateIssueTypeAttachments=vm,i.updateIssueTypeFieldValues=ip,i.updateIssueTypeFieldValuesAttachment=vp,i.updateIssueTypeFieldValuesAttachments=Ep,i.updateIssueTypeFieldValuesMany=np,i.updateIssueTypeFields=Sp,i.updateIssueTypeFieldsAttachment=Nm,i.updateIssueTypeFieldsAttachments=Gm,i.updateIssueTypeFieldsMany=Ap,i.updateIssueTypeIdentifier=Gp,i.updateIssueTypeIdentifierValue=ny,i.updateIssueTypeIdentifierValues=cy,i.updateIssueTypeIdentifiers=Hp,i.updateIssueTypePriorities=Iy,i.updateIssueTypePriority=Ay,i.updateIssueTypeStatus=Hy,i.updateIssueTypeStatuses=Wy,i.updateIssueTypes=By,i.updateIssueUpdate=sf,i.updateIssueUpdates=nf,i.updateIssues=fm,i.updateOrganization=Lf,i.updateOrganizationAccess=gf,i.updateOrganizationAccesses=Mf,i.updateOrganizations=Uf,i.updateProcedure=jA,i.updateProcedureFieldValues=tF,i.updateProcedureFieldValuesAttachment=LP,i.updateProcedureFieldValuesAttachments=kP,i.updateProcedureFieldValuesMany=sF,i.updateProcedureInitiative=FA,i.updateProcedureInitiatives=bA,i.updateProcedureStep=LO,i.updateProcedureStepAssignee=xA,i.updateProcedureStepAssignees=eI,i.updateProcedureStepComment=mI,i.updateProcedureStepComments=pI,i.updateProcedureStepDefaultAssignee=MI,i.updateProcedureStepDefaultAssignees=RI,i.updateProcedureStepDefaultReviewer=LI,i.updateProcedureStepDefaultReviewers=kI,i.updateProcedureStepEvent=tT,i.updateProcedureStepEvents=sT,i.updateProcedureStepFieldValues=eO,i.updateProcedureStepFieldValuesAttachment=UT,i.updateProcedureStepFieldValuesAttachments=LT,i.updateProcedureStepFieldValuesMany=tO,i.updateProcedureStepFieldValuesReview=mO,i.updateProcedureStepFieldValuesReviews=pO,i.updateProcedureStepFields=RT,i.updateProcedureStepFieldsAttachment=pT,i.updateProcedureStepFieldsAttachments=yT,i.updateProcedureStepFieldsMany=wT,i.updateProcedureStepReviewer=MO,i.updateProcedureStepReviewers=RO,i.updateProcedureSteps=kO,i.updateProcedureType=yF,i.updateProcedureTypeAttachment=eP,i.updateProcedureTypeAttachments=tP,i.updateProcedureTypeFields=RP,i.updateProcedureTypeFieldsAttachment=pP,i.updateProcedureTypeFieldsAttachments=yP,i.updateProcedureTypeFieldsMany=wP,i.updateProcedureTypes=fF,i.updateProcedures=qA,i.updateProject=lA,i.updateProjectAccess=rS,i.updateProjectAccesses=dS,i.updateProjectAttachment=TS,i.updateProjectAttachments=OS,i.updateProjectComment=zS,i.updateProjectComments=DS,i.updateProjectFile=YS,i.updateProjectFiles=ZS,i.updateProjects=uA,i.updateTeam=GF,i.updateTeamMembership=vF,i.updateTeamMemberships=EF,i.updateTeams=HF,i.updateUser=yf,i.updateUsers=pf,i.useSelectorBuilder=Rb,i.userReducer=Sf,i.userSlice=an,i.uuidObj=O,i.uuidObjSortFn=fs,i.uuidSortFn=$t,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@overmap-ai/core",
3
- "version": "1.0.81-fix-model-reducers.1",
3
+ "version": "1.0.81-fix-model-reducers.2",
4
4
  "description": "Core functionality for Overmap",
5
5
  "keywords": [
6
6
  "components",