@overmap-ai/core 2.0.6 → 2.0.7-project-annotated-models.0

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.
@@ -4463,7 +4463,7 @@ class Pg extends z {
4463
4463
  const { initialize: i } = this.actions, a = (await this.listPaginated(
4464
4464
  {
4465
4465
  queryParams: {
4466
- asset__project: e
4466
+ project: e
4467
4467
  }
4468
4468
  },
4469
4469
  s
@@ -4545,7 +4545,7 @@ class _g extends z {
4545
4545
  const { initialize: i } = this.actions, a = (await this.listPaginated(
4546
4546
  {
4547
4547
  queryParams: {
4548
- asset_comment__asset__project: e
4548
+ project: e
4549
4549
  }
4550
4550
  },
4551
4551
  s
@@ -4636,7 +4636,7 @@ class Fg extends E {
4636
4636
  const { initialize: i } = this.actions, a = (await this.listPaginated(
4637
4637
  {
4638
4638
  queryParams: {
4639
- asset__project: e
4639
+ project: e
4640
4640
  }
4641
4641
  },
4642
4642
  s
@@ -5084,7 +5084,7 @@ class Eg extends z {
5084
5084
  const { initialize: i } = this.actions, a = (await this.listPaginated(
5085
5085
  {
5086
5086
  queryParams: {
5087
- field_values__asset__project: e,
5087
+ project: e,
5088
5088
  latest: !0
5089
5089
  }
5090
5090
  },
@@ -5223,7 +5223,7 @@ class vg extends E {
5223
5223
  const { initialize: i } = this.actions, a = (await this.listPaginated(
5224
5224
  {
5225
5225
  queryParams: {
5226
- asset__project: e,
5226
+ project: e,
5227
5227
  latest: !0
5228
5228
  }
5229
5229
  },
@@ -5433,7 +5433,7 @@ class kg extends E {
5433
5433
  const { initialize: i } = this.actions, a = (await this.listPaginated(
5434
5434
  {
5435
5435
  queryParams: {
5436
- asset__project: e,
5436
+ project: e,
5437
5437
  latest: !0
5438
5438
  }
5439
5439
  },
@@ -7141,7 +7141,7 @@ class Qg extends E {
7141
7141
  const { initialize: i } = this.actions, a = (await this.listPaginated(
7142
7142
  {
7143
7143
  queryParams: {
7144
- issue__project: e
7144
+ project: e
7145
7145
  }
7146
7146
  },
7147
7147
  s
@@ -7207,7 +7207,7 @@ class eR extends z {
7207
7207
  const { initialize: i } = this.actions, a = (await this.listPaginated(
7208
7208
  {
7209
7209
  queryParams: {
7210
- issue__project: e
7210
+ project: e
7211
7211
  }
7212
7212
  },
7213
7213
  s
@@ -7289,7 +7289,7 @@ class tR extends z {
7289
7289
  const { initialize: i } = this.actions, a = (await this.listPaginated(
7290
7290
  {
7291
7291
  queryParams: {
7292
- issue_comment__issue__project: e
7292
+ project: e
7293
7293
  }
7294
7294
  },
7295
7295
  s
@@ -7380,7 +7380,7 @@ class sR extends E {
7380
7380
  const { initialize: i } = this.actions, a = (await this.listPaginated(
7381
7381
  {
7382
7382
  queryParams: {
7383
- issue__project: e
7383
+ project: e
7384
7384
  }
7385
7385
  },
7386
7386
  s
@@ -7862,7 +7862,7 @@ class cR extends z {
7862
7862
  const { initialize: i } = this.actions, a = (await this.listPaginated(
7863
7863
  {
7864
7864
  queryParams: {
7865
- field_values__issue__project: e,
7865
+ project: e,
7866
7866
  latest: !0
7867
7867
  }
7868
7868
  },
@@ -7957,7 +7957,7 @@ class dR extends E {
7957
7957
  const { initialize: i } = this.actions, a = (await this.listPaginated(
7958
7958
  {
7959
7959
  queryParams: {
7960
- issue__project: e,
7960
+ project: e,
7961
7961
  latest: !0
7962
7962
  }
7963
7963
  },
@@ -8117,7 +8117,7 @@ class uR extends E {
8117
8117
  const { initialize: i } = this.actions, a = (await this.listPaginated(
8118
8118
  {
8119
8119
  queryParams: {
8120
- issue__project: e,
8120
+ project: e,
8121
8121
  latest: !0
8122
8122
  }
8123
8123
  },
@@ -8414,7 +8414,7 @@ class mR extends E {
8414
8414
  const { initialize: i } = this.actions, a = (await this.listPaginated(
8415
8415
  {
8416
8416
  queryParams: {
8417
- issue__project: e
8417
+ project: e
8418
8418
  }
8419
8419
  },
8420
8420
  s
@@ -9366,7 +9366,7 @@ class FR extends E {
9366
9366
  const { initialize: i } = this.actions, a = (await this.listPaginated(
9367
9367
  {
9368
9368
  queryParams: {
9369
- procedure__project: e
9369
+ project: e
9370
9370
  }
9371
9371
  },
9372
9372
  s
@@ -9457,7 +9457,7 @@ class MR extends E {
9457
9457
  const { initialize: i } = this.actions, a = (await this.listPaginated(
9458
9458
  {
9459
9459
  queryParams: {
9460
- procedure__project: e
9460
+ project: e
9461
9461
  }
9462
9462
  },
9463
9463
  s
@@ -9623,7 +9623,7 @@ class RR extends mt {
9623
9623
  const { initialize: i } = this.actions, a = (await this.listPaginated(
9624
9624
  {
9625
9625
  queryParams: {
9626
- procedure__project: e
9626
+ project: e
9627
9627
  }
9628
9628
  },
9629
9629
  s
@@ -9870,7 +9870,7 @@ class BR extends z {
9870
9870
  const { initialize: i } = this.actions, a = (await this.listPaginated(
9871
9871
  {
9872
9872
  queryParams: {
9873
- field_values__procedure__project: e,
9873
+ project: e,
9874
9874
  latest: !0
9875
9875
  }
9876
9876
  },
@@ -9962,7 +9962,7 @@ class kR extends E {
9962
9962
  const { initialize: i } = this.actions, a = (await this.listPaginated(
9963
9963
  {
9964
9964
  queryParams: {
9965
- field_values__procedure__project: e
9965
+ project: e
9966
9966
  }
9967
9967
  },
9968
9968
  s
@@ -10104,7 +10104,7 @@ class zR extends E {
10104
10104
  const { initialize: i } = this.actions, a = (await this.listPaginated(
10105
10105
  {
10106
10106
  queryParams: {
10107
- procedure__project: e
10107
+ project: e
10108
10108
  }
10109
10109
  },
10110
10110
  s
@@ -10214,7 +10214,7 @@ class VR extends E {
10214
10214
  const { initialize: i } = this.actions, a = (await this.listPaginated(
10215
10215
  {
10216
10216
  queryParams: {
10217
- procedure__project: e
10217
+ project: e
10218
10218
  }
10219
10219
  },
10220
10220
  s
@@ -10705,7 +10705,7 @@ class xR extends z {
10705
10705
  const { initialize: i } = this.actions, a = (await this.listPaginated(
10706
10706
  {
10707
10707
  queryParams: {
10708
- field_values__procedure__project: e,
10708
+ project: e,
10709
10709
  latest: !0
10710
10710
  }
10711
10711
  },
@@ -10839,7 +10839,7 @@ class UR extends E {
10839
10839
  const { initialize: i } = this.actions, a = (await this.listPaginated(
10840
10840
  {
10841
10841
  queryParams: {
10842
- procedure__project: e,
10842
+ project: e,
10843
10843
  latest: !0
10844
10844
  }
10845
10845
  },
@@ -4,11 +4,11 @@ Retries:`,i),!(t instanceof Error))throw console.error("ENCOUNTERED NON-ERROR ER
4
4
  Action:`,e);const f=ft();if(!f)throw new Error("Outbox coordinator not set");f.remove(e.payload.uuid),t.options.discard=!0,r()}}console.debug("Registering a retry for request:",e.payload.uuid);const p=ft();if(!p)throw new Error("Outbox coordinator not set");return p.registerRetry(e.payload.uuid),!1}function Cg(t,e,i){return ft()?.peek()}function Dg(t,e){return Ft().dispatch(ES(new Date().getTime())),6e4}const qg=500,QF=["non_field_errors","detail"];function $g(t,e){let i;if(t?.body)if(typeof t.body=="object"){const a=t.body;if(typeof a.error=="string")i=a.error;else if(typeof a.message=="string")i=a.message;else try{i=Object.entries(a).map(([n,c])=>typeof c=="string"?QF.includes(n)?c:`${n}: ${c}`:Array.isArray(c)?QF.includes(n)?c.join(`
5
5
  `):c.map(d=>`${n}: ${d}`).join(`
6
6
  `):`${n}: ${JSON.stringify(c)}`).join(`
7
- `)}catch(n){console.error("Failed to extract error message from response body",n)}}else typeof t.body=="string"&&(i=t.body);else t?.text?i=t.text:e instanceof Error&&(i=e.message);return!i||i.length>qg?l.ERROR_MSG_UNEXPECTED:i}class z extends Error{status;response;message;options;constructor(e){super(l.ERROR_MSG_UNEXPECTED);const{response:i,innerError:a}=e;this.message=e.message??$g(i,a)??l.ERROR_MSG_UNEXPECTED,this.status=i?.status??0,this.response=i,this.options=e}}function xF(t){function e(i){return typeof i=="object"&&i!==null&&["ok","redirect","clientError","serverError","error"].every(n=>n in i)}if(e(t))return t;if(typeof t=="object"&&t!==null){const i=t;if(e(i.response))return i.response;if(i.response&&e(i.response.response))return i.response.response}}function Ug(t){return new Uint8Array(t).reduce((i,a)=>i+a.toString(16).padStart(2,"0"),"")}function rs(t){return new Promise((e,i)=>{const a=new FileReader;a.onload=()=>{const n=a.result;if(!n){i(new Error("FileReader did not return a valid ArrayBuffer."));return}crypto.subtle.digest("SHA-1",n).then(c=>{const d=Ug(c);e(d)})},a.readAsArrayBuffer(t)})}const e_=async t=>{const e=await t.arrayBuffer();return new Blob([e],{type:t.type})},kg=(t,e)=>`${t}${e?`.${e}`:""}`;function Lg(t,e){return new File([t],e,{type:t.type})}function t_(t){const e=t.name;return e.includes(".")?e.split(".").pop():""}const s_=async t=>(await fetch(t)).blob(),i_=async(t,e)=>{const i=await s_(t);return new File([i],e,{type:i.type})};function a_(t){return typeof t=="string"&&t.startsWith("blob:")}function n_(t){return typeof t=="string"&&URL.canParse(t)&&t.startsWith("https://")&&t.includes(".cloudfront.net/")}function c_(t){return typeof t=="string"&&URL.canParse(t)&&t.startsWith("https://")&&t.includes(".s3.amazonaws.com/")}function r_(t){if(n_(t)){const i=new URLSearchParams(t).get("Expires");if(!i)return null;const a=parseInt(i,10);return new Date(a*1e3)}if(c_(t)){const e=new URLSearchParams(t),i=e.get("X-Amz-Date"),a=e.get("X-Amz-Expires");if(!i||!a)return null;const n=new Date(i.replace(/^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})Z$/,"$1-$2-$3T$4:$5:$6Z")),c=parseInt(a);return new Date(n.getTime()+c*1e3)}return null}function d_(t,e=30){const i=r_(t);if(!i)return!1;const a=Date.now(),n=i.getTime(),c=e*1e3;return a+c>=n}function Hg(t){return t.type.startsWith("image/")}class u_ extends WF{constructor(e){super(e)}applyAuth(e){const i=this.getAuthHeader();return i?e.set("Authorization",i):e}isAuthFailure(e){return e.status===401}}class yt extends WF{auth;constructor(e,i){super(e),this.auth=i}}class Gg extends yt{async startConversation(e,i){return this.enqueueRequest({description:"Start agent conversation",method:o.POST,url:"/agents/prompt/",payload:{prompt:e,active_project:i},blockers:["prompt"],blocks:["prompt"]}).then(a=>(this.dispatch(_n(a)),a))}async continueConversation(e,i,a){return this.enqueueRequest({description:"Prompt agent",method:o.POST,url:"/agents/prompt/",payload:{prompt:e,active_project:a},blockers:["prompt"],blocks:["prompt"],queryParams:{conversation_id:i}}).then(n=>{this.dispatch(gn(n))})}async fetchDetails(e){return this.enqueueRequest({description:"Get agent conversation",method:o.GET,url:`/agents/conversations/${e}/`,blockers:["conversation"],blocks:["conversation"]}).then(i=>{this.dispatch(Mn(i))})}async rate(e,i){return this.enqueueRequest({description:"Rate agent response",method:o.PUT,url:`/agents/responses/${e}/rate/`,payload:{rating:i},blockers:["rate"],blocks:["rate"]})}async list(e,i){return this.performRequest({method:o.GET,url:"/agents/conversations/",...e},i)}async refreshStore(e,i){const a=await this.list({queryParams:{project:e}},i);return this.dispatch(Fn(a)),a}}function y(t,e,i){const a=`${e}${i?"s":""}`;switch(t){case o.GET:return`Get ${a}`;case o.POST:return`Create ${a}`;case o.PATCH:return`Update ${a}`;case o.PUT:return`Update ${a}`;case o.DELETE:return`Delete ${a}`}}function M(t){const e={...t};for(const i of[...On,"created_by"])i in e&&delete e[i];return e}class g extends yt{async get(e,i){return this.performRequest({url:`${this.url}/${e}/`,method:o.GET},i)}async list(e,i){return this.performRequest({url:`${this.url}/`,method:o.GET,...e},i)}async listPaginated(e,i){return this.performPagination({url:`${this.url}/`,method:o.GET,...e},i)}}class v extends g{async getPresignedUrl(e,i){const{selectById:a}=this.selectors,n=this.select(a(e));if(!n)throw new Error(`Could not find ${this.name}: ${e} in store.`);if(n.object_url)return n.object_url;const c=await this.client.files.getPresignedUrlFromCache(n.file_sha1);if(c)return c;const d=await this.performRequest({url:`${this.url}/${e}/presigned-url/`,method:o.GET},i);return await this.client.files.cachePresignedUrl(n.file_sha1,d),d}async add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions;let c,d=null,r=null;if("file"in e){const{file:S,...P}=e;d=await this.client.files.getFilePayload(S),r=URL.createObjectURL(S),c={...P,file_sha1:d.sha1,file_type:d.file_type,file_name:S.name,file_extension:d.extension,object_url:r}}else c=e;const p=this.buildModel(c),h=this.buildPayload(p);this.dispatch(i(p));const f=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:{...h,...d?{file:d}:{}},blockers:this.getBlockers(p),blocks:this.getBlocks(p)});f.then(({instance:S})=>{this.dispatch(a(S))}).catch(()=>{this.dispatch(n(this.getId(p)))}).finally(()=>{r&&URL.revokeObjectURL(r)});const A=f.then(({instance:S})=>S),I=f.then(async({instance:S,presigned_url:P})=>{try{return P&&await this.client.files.processPresignedUrl(S.file_sha1,P),S.file_sha1}catch(_){throw console.error("Upload to s3 using presigned url failed.",_),_}});return[p,A,I]}async bulkAdd(e,i){const{addMany:a,updateMany:n,deleteMany:c}=this.actions,d=new Date().toISOString(),r=[],p=new Set,h=l.chunkArray(e,Math.min(i??e.length,D)),f=[];for(const P of h){const _=[],F={},w=[],V=[];for(const rt of P){let zt;if("file"in rt){const{file:jt,...Iw}=rt,_t=await this.client.files.getFilePayload(jt);_t.sha1 in F||(F[_t.sha1]=_t);const T_=URL.createObjectURL(jt);p.add(T_),zt={...Iw,file_sha1:_t.sha1,file_type:_t.file_type,file_name:jt.name,file_extension:_t.extension,object_url:T_}}else zt=rt;const j=this.buildModel(zt);r.push(j);const ds=this.buildBulkPayload(j);_.push(ds);const B=this.getBlockers(j);w.push(...B);const q=this.getBlocks(j);V.push(...q)}const R={payloads:_,submittedAt:d,files:Object.values(F),blockers:w,blocks:V};f.push(R)}this.dispatch(a(r));const A=f.map(P=>{const{submittedAt:_,files:F,payloads:w,blocks:V,blockers:R}=P;return this.enqueueRequest({description:y(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:{submitted_at:_,files:F,payloads:w},blockers:R,blocks:V})});Promise.all(A).then(P=>{const _=P.flatMap(F=>F.instances);this.dispatch(n(_))}).catch(P=>{throw this.dispatch(c(r.map(_=>this.getId(_)))),console.error(P),P}).finally(()=>{for(const P of p)URL.revokeObjectURL(P)});const I=Promise.all(A).then(P=>P.flatMap(({instances:_})=>_)),S=Promise.all(A).then(async P=>{const _=[];for(const{presigned_urls:F}of P){const w=this.client.files.processPresignedUrls(F);for(const[V,R]of Object.entries(w))try{await R,_.push(V)}catch(rt){throw console.error("Upload to s3 using presigned url failed.",rt),rt}}return _});return[r,I,S]}async delete(e){const{addOne:i,deleteOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Attempting to delete ${this.name} with pk ${e} that does not exist in the store`);this.dispatch(a(this.getId(c)));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(i(c)),d}}}class Ng extends v{name="Asset attachment";url="/asset-attachments";actions={addOne:vn,addMany:hs,setOne:Vn,setMany:Bn,updateOne:zn,updateMany:jn,deleteOne:Cn,deleteMany:ps,initialize:En};selectors={selectById:qn,selectByIds:$n};getId(e){return e.uuid}getBlockers(e){const{asset:i}=e;return[i]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}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,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{asset__project:e}},i)).flat();return this.dispatch(a(c)),c}}class Kg extends v{name="Asset Comment Attachment";url="/asset-comment-attachments";actions={addOne:Gn,addMany:Nn,setOne:Kn,setMany:Wn,updateOne:Xn,updateMany:Yn,deleteOne:Zn,deleteMany:Jn,initialize:Hn};selectors={selectById:xn,selectByIds:ec};getId(e){return e.uuid}getBlockers(e){return[e.asset_comment]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}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_comment:e.asset_comment}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,asset_comment:e.asset_comment}}async bulkDelete(e){const{deleteMany:i,addMany:a}=this.actions,{selectByIds:n}=this.selectors,c=this.select(n(e));this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{asset_comment__asset__project:e}},i)).flat();return this.dispatch(a(c)),c}}class Wg extends g{name="Asset Comment";url="/asset-comments";actions={addOne:ac,addMany:Ct,setOne:nc,setMany:cc,updateOne:rc,updateMany:dc,deleteOne:uc,deleteMany:Dt,initialize:ic};selectors={selectById:oc,selectByIds:hc};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(c),blockers:[c.asset],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Asset comment with uuid ${e.uuid} not found in store`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Asset comment with uuid ${e} not found in store`);this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{asset__project:e}},i)).flat();return this.dispatch(a(c)),c}}class Xg extends g{url="/assets";name="Asset";actions={addOne:Ac,addMany:Ts,setOne:Oc,setMany:Pc,updateOne:Tc,updateMany:Ic,deleteOne:bc,deleteMany:Is,initialize:Sc};selectors={selectById:Mc,selectByIds:gc};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[r.asset_type],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`No asset with uuid ${e.uuid} found in the store`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{addOne:i,deleteOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`No asset with uuid ${e} found in the store`);const d=this.select(Un(e)),r=this.select(pc(e)),p=this.select(Qh(e)),h=this.select(bT(e)),f=this.select(Oh(e));this.dispatch(a(e)),this.dispatch(ps(l.toUuidArray(d))),this.dispatch(Dt(l.toUuidArray(r))),this.dispatch(Tt(l.toUuidArray(p))),this.dispatch(Ot(l.toUuidArray(h))),this.dispatch(ot(l.toUuidArray(f)));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(A){throw this.dispatch(i(c)),this.dispatch(hs(d)),this.dispatch(Ct(r)),this.dispatch(At(p)),this.dispatch(bt(h)),this.dispatch(lt(f)),A}}bulkAdd(e,i){const{addMany:a}=this.actions,n=new Date().toISOString(),c=l.chunkArray(e,Math.min(i??e.length,D)).map(p=>{const h=p.map(f=>l.uuidObj(f));return{batchId:ut.v4(),payload:{submitted_at:n,assets:h}}}),d=[];let r=null;for(const p of c){const{batchId:h,payload:f}=p,A=f.assets.map(({uuid:F})=>F),I=f.assets.map(({asset_type:F})=>F),S=f.assets.map(({project:F})=>F),P=f.assets.map(({status:F})=>F),_=this.enqueueRequest({description:y(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:f,blockers:(r?[r]:[]).concat(I).concat(S).concat(P),blocks:[h].concat(A)});r=p.batchId,d.push(_)}return Promise.all(d).then(p=>{const h=p.flat();this.dispatch(a(h))}),d}bulkUpdate(e,i){const{updateMany:a}=this.actions,{selectByIds:n}=this.selectors,c=l.toUuidArray(e);if(new Set(c).size!==e.length)throw new Error("payloads contains duplicate uuids.");const d=this.select(n(c));if(c.length!=d.length)throw new Error(`Attempting to bulk update ${c.length-d.length} assets that dont exist in the store`);const r=d.toSorted((S,P)=>l.uuidSortFn(S.uuid,P.uuid)),p=e.toSorted((S,P)=>l.uuidSortFn(S.uuid,P.uuid)),h=[];for(let S=0;S<c.length;S++)h.push({...r[S],...p[S]});this.dispatch(a(h));const f=l.chunkArray(e,Math.min(i??e.length,D)),A=[];let I=null;for(const S of f){const P=ut.v4(),_=l.toUuidArray(S),F=S.map(({status:V})=>V).filter(Boolean),w=this.enqueueRequest({description:y(o.PATCH,this.name,!0),method:o.PATCH,url:`${this.url}/bulk/`,payload:{payloads:S},blockers:(I?[I]:[]).concat(_).concat(F),blocks:[P].concat(_)});A.push(w),I=P}return Promise.all(A).then(S=>{this.dispatch(a(S.flat()))}).catch(()=>{this.dispatch(a(d))}),[h,A]}async bulkDelete(e){const{addMany:i,deleteMany:a}=this.actions,{selectByIds:n}=this.selectors,c=this.select(n(e)),d=this.select(mc(e)),r=this.select(xh(e)),p=this.select(OT(e)),h=this.select(Ph(e));this.dispatch(a(e)),this.dispatch(Dt(l.toUuidArray(d))),this.dispatch(Tt(l.toUuidArray(r))),this.dispatch(Ot(l.toUuidArray(p))),this.dispatch(ot(l.toUuidArray(h)));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(f){throw this.dispatch(i(c)),this.dispatch(Ct(d)),this.dispatch(At(r)),this.dispatch(bt(p)),this.dispatch(lt(h)),f}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e}},i)).flat();return this.dispatch(a(c)),c}}class Yg extends v{name="Asset Type Attachment";url="/asset-type-attachments";actions={addOne:vc,addMany:Os,setOne:Vc,setMany:Bc,updateOne:zc,updateMany:jc,deleteOne:Cc,deleteMany:Ps,initialize:Ec};selectors={selectById:qc,selectByIds:$c};getId(e){return e.uuid}getBlockers(e){return[e.asset_type]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}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,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{asset_type__organization:e}},i);return this.dispatch(a(n)),n}}class Zg extends v{name="Asset Type Fields Attachment";url="/asset-type-fields-attachments";actions={addOne:Gc,addMany:Nc,setOne:Kc,setMany:Wc,updateOne:Xc,updateMany:Yc,deleteOne:Zc,deleteMany:Jc,initialize:Hc};selectors={selectById:xc,selectByIds:er};getId(e){return e.uuid}getBlockers(e){return[e.fields_revision]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){const{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,submitted_at:e.submitted_at,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}}buildBulkPayload(e){const{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{fields_revision__asset_type__organization:e}},i);return this.dispatch(a(n)),n}}class Jg extends g{name="Asset Type Fields";url="/asset-type-fields";actions={addOne:ar,addMany:nr,setOne:cr,setMany:rr,updateOne:dr,updateMany:ur,deleteOne:lr,deleteMany:or,initialize:ir};selectors={selectById:pr,selectByIds:mr};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[r.asset_type],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{asset_type__organization:e}},i);return this.dispatch(a(n)),n}}class Qg extends v{name="Asset Type Field Values Attachment";url="/asset-type-field-values-attachments";actions={addOne:Ar,addMany:ws,setOne:Tr,setMany:Ir,updateOne:br,updateMany:Or,deleteOne:Pr,deleteMany:Es,initialize:Sr};selectors={selectById:_r,selectByIds:Mr};getId(e){return e.uuid}getBlockers(e){return[e.field_values]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){const{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,submitted_at:e.submitted_at,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}}buildBulkPayload(e){const{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}}async bulkDelete(e){const{deleteMany:i,addMany:a}=this.actions,{selectByIds:n}=this.selectors,c=this.select(n(e));this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{field_values__asset__project:e,latest:!0}},i)).flat();return this.dispatch(a(c)),c}}class xg extends g{name="Asset Type Field Values";url="/asset-type-field-values";actions={addOne:vr,addMany:Vr,setOne:Br,setMany:zr,updateOne:jr,updateMany:Cr,deleteOne:Dr,deleteMany:qr,initialize:Er};selectors={selectById:Ur,selectByIds:kr};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d}),p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[e.asset,e.fields_revision],blocks:[r.uuid]});return this.dispatch(i(r)),p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}bulkAdd(e,i){const{payloads:a,values:n}=e,{addMany:c,updateMany:d,deleteMany:r}=this.actions,p=new Date().toISOString(),h=[],f=l.chunkArray(a,Math.min(i??a.length,D)),A=[];for(const S of f){const P=[];for(const _ of S){const F=l.uuidObj({..._,values:_.values,created_by:this.select(w=>w.userReducer.currentUser?.id??null),submitted_at:p});h.push(F),P.push({uuid:F.uuid,asset:_.asset,fields_revision:_.fields_revision,published_at:_.published_at,values:F.values})}A.push({submitted_at:p,values:n,field_values:P})}this.dispatch(c(h));const I=[];for(const S of A){const{field_values:P}=S,_=P.map(({asset:R})=>R),F=P.map(({fields_revision:R})=>R),w=P.map(({uuid:R})=>R),V=this.enqueueRequest({description:y(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:S,blockers:_.concat(F),blocks:w});I.push(V)}return Promise.all(I).then(S=>{this.dispatch(d(S.flat()))}).catch(()=>{this.dispatch(r(l.toUuidArray(h)))}),[h,I]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected AssetTypeFieldValues with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[c.uuid,c.fields_revision,c.asset],blocks:[c.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const d=this.select(gr(e));this.dispatch(i(e)),this.dispatch(Es(l.toUuidArray(d)));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(a(c)),this.dispatch(ws(d)),r}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{asset__project:e,latest:!0}},i)).flat();return this.dispatch(a(c)),c}}class eR extends g{name="Asset Type Identifier";url="/asset-type-identifiers";actions={addOne:Nr,addMany:Kr,setOne:Wr,setMany:Xr,updateOne:Yr,updateMany:Zr,deleteOne:Jr,deleteMany:Qr,initialize:Gr};selectors={selectById:ed,selectByIds:td};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[r.asset_type],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected asset type identifier with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected asset type identifier with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{asset_type__organization:e}},i);return this.dispatch(a(n)),n}}class tR extends g{name="Asset Type Identifier Value";url="/asset-type-identifier-values";actions={addOne:nd,addMany:cd,setOne:rd,setMany:dd,updateOne:ud,updateMany:ld,deleteOne:od,deleteMany:hd,initialize:ad};selectors={selectById:md,selectByIds:yd};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[e.asset,e.asset_type_identifier],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}bulkAdd(e,i){const{addMany:a,updateMany:n,deleteMany:c}=this.actions,d=new Date().toISOString(),r=this.select(S=>S.userReducer.currentUser?.id??null),p=l.chunkArray(e,Math.min(i??e.length,D)),h=[],f=[];for(const S of p){const P=[],_=[],F=[];for(const V of S){const R=l.uuidObj({...V,submitted_at:d,created_by:r});f.push(R);const rt={uuid:R.uuid,asset:R.asset,asset_type_identifier:R.asset_type_identifier,value:R.value};P.push(rt),_.push(R.asset),_.push(R.asset_type_identifier),F.push(R.uuid)}const w={payloads:P,submitted_at:d,blockers:_,blocks:F};h.push(w)}this.dispatch(a(f));const A=h.map(S=>{const{payloads:P,submitted_at:_,blockers:F,blocks:w}=S;return this.enqueueRequest({description:y(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:{submitted_at:_,payloads:P},blockers:F,blocks:w})});Promise.all(A).then(S=>{this.dispatch(n(S.flat()))}).catch(S=>{throw this.dispatch(c(l.toUuidArray(f))),S});const I=Promise.all(A).then(S=>S.flat());return[f,I]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected asset type identifier value with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{asset__project:e,latest:!0}},i)).flat();return this.dispatch(a(c)),c}}class sR extends g{name="Asset Type";url="/asset-types";actions={addOne:bd,addMany:Od,setOne:Td,setMany:Id,updateOne:Pd,updateMany:Fd,deleteOne:_d,deleteMany:Md,initialize:Ad};selectors={selectById:Rd,selectByIds:wd};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected asset type with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[n.uuid],blocks:[n.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected asset type with uuid ${e} to exist`);const d=this.select(_c(e)),r=this.select(Uc(e));this.dispatch(i(e)),this.dispatch(Is(l.toUuidArray(d))),this.dispatch(Ps(l.toUuidArray(r)));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(p){throw this.dispatch(a(c)),this.dispatch(Ts(d)),this.dispatch(Os(r)),p}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{organization:e}},i);return this.dispatch(a(n)),n}}class iR extends g{name="Asset Type Status";url="/asset-type-statuses";actions={addOne:Bd,addMany:zd,setOne:jd,setMany:Cd,updateOne:Dd,updateMany:qd,deleteOne:$d,deleteMany:Ud,initialize:Vd};selectors={selectById:Ld,selectByIds:Hd};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[e.asset_type],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected an existing asset type status with uuid ${e.uuid}`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`No asset type status with uuid ${e} found in the store`);this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{asset_type__organization:e}},i);return this.dispatch(a(n)),n}}class aR extends v{name="Document Attachment";url="/document-attachments";actions={addOne:Zd,addMany:Jd,setOne:Qd,setMany:xd,updateOne:eu,updateMany:tu,deleteOne:su,deleteMany:iu,initialize:Yd};selectors={selectById:nu,selectByIds:cu};getId(e){return e.uuid}getBlockers(e){return[e.document]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}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,i){const[a,n,c]=await super.bulkAdd(e,i),d={};for(const{file_sha1:r,uuid:p}of a)r in d||(d[r]=[]),d[r].push(p);return c.then(r=>{const p=r.flatMap(h=>d[h]??[]);for(const h of p)this.makeReadable(h)}),[a,n,c]}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,i){const{initialize:a}=this.actions,n=this.list({queryParams:{document__project__organization:e}},i),c=this.list({queryParams:{document__organization:e}},i),r=(await Promise.all([n,c])).flat();return this.dispatch(a(r)),r}}class nR extends g{name="Document";url="/documents";actions={addOne:lu,addMany:ou,setOne:hu,setMany:pu,updateOne:mu,updateMany:yu,deleteOne:fu,deleteMany:Su,initialize:uu};selectors={selectById:Tu,selectByIds:Iu};add(e){const{addOne:i,deleteOne:a,updateOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:r.parent_document?[r.parent_document]:[],blocks:[r.uuid]});return p.then(h=>{this.dispatch(n(h))}).catch(()=>{this.dispatch(a(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`attempting to update a document with uuid ${e.uuid} that does not exist in store.documents`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a,addMany:n,deleteMany:c}=this.actions,{selectById:d}=this.selectors,r=this.select(d(e));if(!r)throw new Error(`attempting to delete a document with uuid ${e} that does not exist in store.documents`);const p=this.select(bu(e));this.dispatch(i(e)),this.dispatch(c(l.toUuidArray(p)));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(a(r)),this.dispatch(n(p)),h}}async refreshStore(e,i){const{initialize:a}=this.actions,n=this.list({queryParams:{project__organization:e}},i),c=this.list({queryParams:{organization:e}},i),r=(await Promise.all([n,c])).flat();return this.dispatch(a(r)),r}}class dt extends yt{async get(e,i){return this.performRequest({url:`${this.url}/${e}/`,method:o.GET},i)}async list(e,i){return this.performRequest({url:`${this.url}/`,method:o.GET,...e},i)}async listPaginated(e,i){return this.performPagination({url:`${this.url}/`,method:o.GET,...e},i)}}class cR extends dt{name="Email Domains";url="/organization-email-domains";actions={addOne:Fu,addMany:_u,setOne:Mu,setMany:gu,updateOne:Ru,updateMany:wu,deleteOne:Eu,deleteMany:vu,initialize:Pu};selectors={selectById:Bu,selectByIds:zu};async add(e,i){return this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:{email:i,organization:e},blockers:[e,"create-org"],blocks:[]})}async delete(e){const{deleteOne:i,addOne:a}=this.actions;this.dispatch(i(e.uuid));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e.uuid}/`,blockers:[e.domain],blocks:[]})}catch(n){throw this.dispatch(a(e)),n}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{organization:e}},i);return this.dispatch(a(n)),n}}class rR extends yt{async getVerificationCode(e){return this.enqueueRequest({description:"Get verification code",method:o.GET,url:`/verification/email-verification/${e}/`,isAuthNeeded:!1,blockers:[],blocks:[]})}validateVerificationCode(e,i){return this.enqueueRequest({description:"Validate verification code",method:o.POST,url:`/verification/email-verification/${e}/`,isAuthNeeded:!1,payload:i,blockers:[],blocks:[]})}}const Bt={},fn=new Set,Sn=new Set;class dR extends yt{host=void 0;dbPromise=O_.openDB("fileCache",2,{upgrade(e,i){i<1&&e.createObjectStore("files"),i<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 i=await rs(e);if(fn.has(i))return;const a=await this.getDB();!!await a.get("files",i)?console.warn(`Attempting to add a file already cached, ${e.name}`):await a.put("files",e,i),fn.add(i)}async uncacheFile(e){await(await this.getDB()).delete("files",e),fn.delete(e)}async getFileFromCache(e){return(await this.getDB()).get("files",e)}async fetchFileFromUrl(e,i,a=i,n){const c=e.split("?")[0]??e,d=await this.getFileFromCache(i);if(d)return d;let r;c in Bt?r=Bt[c]:a_(e)?(r=i_(e,a),Bt[c]=r):(r=this.performRequest({method:o.GET,url:e,isExternalUrl:!0,isResponseBlob:!0,isAuthNeeded:!1},n).then(f=>new File([f],a,{type:f.type})),Bt[c]=r);let p;try{p=await r}catch(f){throw f instanceof z&&delete Bt[c],f}const h=await rs(p);if(h!==i){const f=`The hash of the file returned from the server (${h}) does not match the
7
+ `)}catch(n){console.error("Failed to extract error message from response body",n)}}else typeof t.body=="string"&&(i=t.body);else t?.text?i=t.text:e instanceof Error&&(i=e.message);return!i||i.length>qg?l.ERROR_MSG_UNEXPECTED:i}class z extends Error{status;response;message;options;constructor(e){super(l.ERROR_MSG_UNEXPECTED);const{response:i,innerError:a}=e;this.message=e.message??$g(i,a)??l.ERROR_MSG_UNEXPECTED,this.status=i?.status??0,this.response=i,this.options=e}}function xF(t){function e(i){return typeof i=="object"&&i!==null&&["ok","redirect","clientError","serverError","error"].every(n=>n in i)}if(e(t))return t;if(typeof t=="object"&&t!==null){const i=t;if(e(i.response))return i.response;if(i.response&&e(i.response.response))return i.response.response}}function Ug(t){return new Uint8Array(t).reduce((i,a)=>i+a.toString(16).padStart(2,"0"),"")}function rs(t){return new Promise((e,i)=>{const a=new FileReader;a.onload=()=>{const n=a.result;if(!n){i(new Error("FileReader did not return a valid ArrayBuffer."));return}crypto.subtle.digest("SHA-1",n).then(c=>{const d=Ug(c);e(d)})},a.readAsArrayBuffer(t)})}const e_=async t=>{const e=await t.arrayBuffer();return new Blob([e],{type:t.type})},kg=(t,e)=>`${t}${e?`.${e}`:""}`;function Lg(t,e){return new File([t],e,{type:t.type})}function t_(t){const e=t.name;return e.includes(".")?e.split(".").pop():""}const s_=async t=>(await fetch(t)).blob(),i_=async(t,e)=>{const i=await s_(t);return new File([i],e,{type:i.type})};function a_(t){return typeof t=="string"&&t.startsWith("blob:")}function n_(t){return typeof t=="string"&&URL.canParse(t)&&t.startsWith("https://")&&t.includes(".cloudfront.net/")}function c_(t){return typeof t=="string"&&URL.canParse(t)&&t.startsWith("https://")&&t.includes(".s3.amazonaws.com/")}function r_(t){if(n_(t)){const i=new URLSearchParams(t).get("Expires");if(!i)return null;const a=parseInt(i,10);return new Date(a*1e3)}if(c_(t)){const e=new URLSearchParams(t),i=e.get("X-Amz-Date"),a=e.get("X-Amz-Expires");if(!i||!a)return null;const n=new Date(i.replace(/^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})Z$/,"$1-$2-$3T$4:$5:$6Z")),c=parseInt(a);return new Date(n.getTime()+c*1e3)}return null}function d_(t,e=30){const i=r_(t);if(!i)return!1;const a=Date.now(),n=i.getTime(),c=e*1e3;return a+c>=n}function Hg(t){return t.type.startsWith("image/")}class u_ extends WF{constructor(e){super(e)}applyAuth(e){const i=this.getAuthHeader();return i?e.set("Authorization",i):e}isAuthFailure(e){return e.status===401}}class yt extends WF{auth;constructor(e,i){super(e),this.auth=i}}class Gg extends yt{async startConversation(e,i){return this.enqueueRequest({description:"Start agent conversation",method:o.POST,url:"/agents/prompt/",payload:{prompt:e,active_project:i},blockers:["prompt"],blocks:["prompt"]}).then(a=>(this.dispatch(_n(a)),a))}async continueConversation(e,i,a){return this.enqueueRequest({description:"Prompt agent",method:o.POST,url:"/agents/prompt/",payload:{prompt:e,active_project:a},blockers:["prompt"],blocks:["prompt"],queryParams:{conversation_id:i}}).then(n=>{this.dispatch(gn(n))})}async fetchDetails(e){return this.enqueueRequest({description:"Get agent conversation",method:o.GET,url:`/agents/conversations/${e}/`,blockers:["conversation"],blocks:["conversation"]}).then(i=>{this.dispatch(Mn(i))})}async rate(e,i){return this.enqueueRequest({description:"Rate agent response",method:o.PUT,url:`/agents/responses/${e}/rate/`,payload:{rating:i},blockers:["rate"],blocks:["rate"]})}async list(e,i){return this.performRequest({method:o.GET,url:"/agents/conversations/",...e},i)}async refreshStore(e,i){const a=await this.list({queryParams:{project:e}},i);return this.dispatch(Fn(a)),a}}function y(t,e,i){const a=`${e}${i?"s":""}`;switch(t){case o.GET:return`Get ${a}`;case o.POST:return`Create ${a}`;case o.PATCH:return`Update ${a}`;case o.PUT:return`Update ${a}`;case o.DELETE:return`Delete ${a}`}}function M(t){const e={...t};for(const i of[...On,"created_by"])i in e&&delete e[i];return e}class g extends yt{async get(e,i){return this.performRequest({url:`${this.url}/${e}/`,method:o.GET},i)}async list(e,i){return this.performRequest({url:`${this.url}/`,method:o.GET,...e},i)}async listPaginated(e,i){return this.performPagination({url:`${this.url}/`,method:o.GET,...e},i)}}class v extends g{async getPresignedUrl(e,i){const{selectById:a}=this.selectors,n=this.select(a(e));if(!n)throw new Error(`Could not find ${this.name}: ${e} in store.`);if(n.object_url)return n.object_url;const c=await this.client.files.getPresignedUrlFromCache(n.file_sha1);if(c)return c;const d=await this.performRequest({url:`${this.url}/${e}/presigned-url/`,method:o.GET},i);return await this.client.files.cachePresignedUrl(n.file_sha1,d),d}async add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions;let c,d=null,r=null;if("file"in e){const{file:S,...P}=e;d=await this.client.files.getFilePayload(S),r=URL.createObjectURL(S),c={...P,file_sha1:d.sha1,file_type:d.file_type,file_name:S.name,file_extension:d.extension,object_url:r}}else c=e;const p=this.buildModel(c),h=this.buildPayload(p);this.dispatch(i(p));const f=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:{...h,...d?{file:d}:{}},blockers:this.getBlockers(p),blocks:this.getBlocks(p)});f.then(({instance:S})=>{this.dispatch(a(S))}).catch(()=>{this.dispatch(n(this.getId(p)))}).finally(()=>{r&&URL.revokeObjectURL(r)});const A=f.then(({instance:S})=>S),I=f.then(async({instance:S,presigned_url:P})=>{try{return P&&await this.client.files.processPresignedUrl(S.file_sha1,P),S.file_sha1}catch(_){throw console.error("Upload to s3 using presigned url failed.",_),_}});return[p,A,I]}async bulkAdd(e,i){const{addMany:a,updateMany:n,deleteMany:c}=this.actions,d=new Date().toISOString(),r=[],p=new Set,h=l.chunkArray(e,Math.min(i??e.length,D)),f=[];for(const P of h){const _=[],F={},w=[],V=[];for(const rt of P){let zt;if("file"in rt){const{file:jt,...Iw}=rt,_t=await this.client.files.getFilePayload(jt);_t.sha1 in F||(F[_t.sha1]=_t);const T_=URL.createObjectURL(jt);p.add(T_),zt={...Iw,file_sha1:_t.sha1,file_type:_t.file_type,file_name:jt.name,file_extension:_t.extension,object_url:T_}}else zt=rt;const j=this.buildModel(zt);r.push(j);const ds=this.buildBulkPayload(j);_.push(ds);const B=this.getBlockers(j);w.push(...B);const q=this.getBlocks(j);V.push(...q)}const R={payloads:_,submittedAt:d,files:Object.values(F),blockers:w,blocks:V};f.push(R)}this.dispatch(a(r));const A=f.map(P=>{const{submittedAt:_,files:F,payloads:w,blocks:V,blockers:R}=P;return this.enqueueRequest({description:y(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:{submitted_at:_,files:F,payloads:w},blockers:R,blocks:V})});Promise.all(A).then(P=>{const _=P.flatMap(F=>F.instances);this.dispatch(n(_))}).catch(P=>{throw this.dispatch(c(r.map(_=>this.getId(_)))),console.error(P),P}).finally(()=>{for(const P of p)URL.revokeObjectURL(P)});const I=Promise.all(A).then(P=>P.flatMap(({instances:_})=>_)),S=Promise.all(A).then(async P=>{const _=[];for(const{presigned_urls:F}of P){const w=this.client.files.processPresignedUrls(F);for(const[V,R]of Object.entries(w))try{await R,_.push(V)}catch(rt){throw console.error("Upload to s3 using presigned url failed.",rt),rt}}return _});return[r,I,S]}async delete(e){const{addOne:i,deleteOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Attempting to delete ${this.name} with pk ${e} that does not exist in the store`);this.dispatch(a(this.getId(c)));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(i(c)),d}}}class Ng extends v{name="Asset attachment";url="/asset-attachments";actions={addOne:vn,addMany:hs,setOne:Vn,setMany:Bn,updateOne:zn,updateMany:jn,deleteOne:Cn,deleteMany:ps,initialize:En};selectors={selectById:qn,selectByIds:$n};getId(e){return e.uuid}getBlockers(e){const{asset:i}=e;return[i]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}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,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e}},i)).flat();return this.dispatch(a(c)),c}}class Kg extends v{name="Asset Comment Attachment";url="/asset-comment-attachments";actions={addOne:Gn,addMany:Nn,setOne:Kn,setMany:Wn,updateOne:Xn,updateMany:Yn,deleteOne:Zn,deleteMany:Jn,initialize:Hn};selectors={selectById:xn,selectByIds:ec};getId(e){return e.uuid}getBlockers(e){return[e.asset_comment]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}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_comment:e.asset_comment}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,asset_comment:e.asset_comment}}async bulkDelete(e){const{deleteMany:i,addMany:a}=this.actions,{selectByIds:n}=this.selectors,c=this.select(n(e));this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e}},i)).flat();return this.dispatch(a(c)),c}}class Wg extends g{name="Asset Comment";url="/asset-comments";actions={addOne:ac,addMany:Ct,setOne:nc,setMany:cc,updateOne:rc,updateMany:dc,deleteOne:uc,deleteMany:Dt,initialize:ic};selectors={selectById:oc,selectByIds:hc};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(c),blockers:[c.asset],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Asset comment with uuid ${e.uuid} not found in store`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Asset comment with uuid ${e} not found in store`);this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e}},i)).flat();return this.dispatch(a(c)),c}}class Xg extends g{url="/assets";name="Asset";actions={addOne:Ac,addMany:Ts,setOne:Oc,setMany:Pc,updateOne:Tc,updateMany:Ic,deleteOne:bc,deleteMany:Is,initialize:Sc};selectors={selectById:Mc,selectByIds:gc};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[r.asset_type],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`No asset with uuid ${e.uuid} found in the store`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{addOne:i,deleteOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`No asset with uuid ${e} found in the store`);const d=this.select(Un(e)),r=this.select(pc(e)),p=this.select(Qh(e)),h=this.select(bT(e)),f=this.select(Oh(e));this.dispatch(a(e)),this.dispatch(ps(l.toUuidArray(d))),this.dispatch(Dt(l.toUuidArray(r))),this.dispatch(Tt(l.toUuidArray(p))),this.dispatch(Ot(l.toUuidArray(h))),this.dispatch(ot(l.toUuidArray(f)));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(A){throw this.dispatch(i(c)),this.dispatch(hs(d)),this.dispatch(Ct(r)),this.dispatch(At(p)),this.dispatch(bt(h)),this.dispatch(lt(f)),A}}bulkAdd(e,i){const{addMany:a}=this.actions,n=new Date().toISOString(),c=l.chunkArray(e,Math.min(i??e.length,D)).map(p=>{const h=p.map(f=>l.uuidObj(f));return{batchId:ut.v4(),payload:{submitted_at:n,assets:h}}}),d=[];let r=null;for(const p of c){const{batchId:h,payload:f}=p,A=f.assets.map(({uuid:F})=>F),I=f.assets.map(({asset_type:F})=>F),S=f.assets.map(({project:F})=>F),P=f.assets.map(({status:F})=>F),_=this.enqueueRequest({description:y(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:f,blockers:(r?[r]:[]).concat(I).concat(S).concat(P),blocks:[h].concat(A)});r=p.batchId,d.push(_)}return Promise.all(d).then(p=>{const h=p.flat();this.dispatch(a(h))}),d}bulkUpdate(e,i){const{updateMany:a}=this.actions,{selectByIds:n}=this.selectors,c=l.toUuidArray(e);if(new Set(c).size!==e.length)throw new Error("payloads contains duplicate uuids.");const d=this.select(n(c));if(c.length!=d.length)throw new Error(`Attempting to bulk update ${c.length-d.length} assets that dont exist in the store`);const r=d.toSorted((S,P)=>l.uuidSortFn(S.uuid,P.uuid)),p=e.toSorted((S,P)=>l.uuidSortFn(S.uuid,P.uuid)),h=[];for(let S=0;S<c.length;S++)h.push({...r[S],...p[S]});this.dispatch(a(h));const f=l.chunkArray(e,Math.min(i??e.length,D)),A=[];let I=null;for(const S of f){const P=ut.v4(),_=l.toUuidArray(S),F=S.map(({status:V})=>V).filter(Boolean),w=this.enqueueRequest({description:y(o.PATCH,this.name,!0),method:o.PATCH,url:`${this.url}/bulk/`,payload:{payloads:S},blockers:(I?[I]:[]).concat(_).concat(F),blocks:[P].concat(_)});A.push(w),I=P}return Promise.all(A).then(S=>{this.dispatch(a(S.flat()))}).catch(()=>{this.dispatch(a(d))}),[h,A]}async bulkDelete(e){const{addMany:i,deleteMany:a}=this.actions,{selectByIds:n}=this.selectors,c=this.select(n(e)),d=this.select(mc(e)),r=this.select(xh(e)),p=this.select(OT(e)),h=this.select(Ph(e));this.dispatch(a(e)),this.dispatch(Dt(l.toUuidArray(d))),this.dispatch(Tt(l.toUuidArray(r))),this.dispatch(Ot(l.toUuidArray(p))),this.dispatch(ot(l.toUuidArray(h)));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(f){throw this.dispatch(i(c)),this.dispatch(Ct(d)),this.dispatch(At(r)),this.dispatch(bt(p)),this.dispatch(lt(h)),f}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e}},i)).flat();return this.dispatch(a(c)),c}}class Yg extends v{name="Asset Type Attachment";url="/asset-type-attachments";actions={addOne:vc,addMany:Os,setOne:Vc,setMany:Bc,updateOne:zc,updateMany:jc,deleteOne:Cc,deleteMany:Ps,initialize:Ec};selectors={selectById:qc,selectByIds:$c};getId(e){return e.uuid}getBlockers(e){return[e.asset_type]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}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,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{asset_type__organization:e}},i);return this.dispatch(a(n)),n}}class Zg extends v{name="Asset Type Fields Attachment";url="/asset-type-fields-attachments";actions={addOne:Gc,addMany:Nc,setOne:Kc,setMany:Wc,updateOne:Xc,updateMany:Yc,deleteOne:Zc,deleteMany:Jc,initialize:Hc};selectors={selectById:xc,selectByIds:er};getId(e){return e.uuid}getBlockers(e){return[e.fields_revision]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){const{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,submitted_at:e.submitted_at,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}}buildBulkPayload(e){const{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{fields_revision__asset_type__organization:e}},i);return this.dispatch(a(n)),n}}class Jg extends g{name="Asset Type Fields";url="/asset-type-fields";actions={addOne:ar,addMany:nr,setOne:cr,setMany:rr,updateOne:dr,updateMany:ur,deleteOne:lr,deleteMany:or,initialize:ir};selectors={selectById:pr,selectByIds:mr};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[r.asset_type],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{asset_type__organization:e}},i);return this.dispatch(a(n)),n}}class Qg extends v{name="Asset Type Field Values Attachment";url="/asset-type-field-values-attachments";actions={addOne:Ar,addMany:ws,setOne:Tr,setMany:Ir,updateOne:br,updateMany:Or,deleteOne:Pr,deleteMany:Es,initialize:Sr};selectors={selectById:_r,selectByIds:Mr};getId(e){return e.uuid}getBlockers(e){return[e.field_values]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){const{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,submitted_at:e.submitted_at,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}}buildBulkPayload(e){const{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}}async bulkDelete(e){const{deleteMany:i,addMany:a}=this.actions,{selectByIds:n}=this.selectors,c=this.select(n(e));this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e,latest:!0}},i)).flat();return this.dispatch(a(c)),c}}class xg extends g{name="Asset Type Field Values";url="/asset-type-field-values";actions={addOne:vr,addMany:Vr,setOne:Br,setMany:zr,updateOne:jr,updateMany:Cr,deleteOne:Dr,deleteMany:qr,initialize:Er};selectors={selectById:Ur,selectByIds:kr};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d}),p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[e.asset,e.fields_revision],blocks:[r.uuid]});return this.dispatch(i(r)),p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}bulkAdd(e,i){const{payloads:a,values:n}=e,{addMany:c,updateMany:d,deleteMany:r}=this.actions,p=new Date().toISOString(),h=[],f=l.chunkArray(a,Math.min(i??a.length,D)),A=[];for(const S of f){const P=[];for(const _ of S){const F=l.uuidObj({..._,values:_.values,created_by:this.select(w=>w.userReducer.currentUser?.id??null),submitted_at:p});h.push(F),P.push({uuid:F.uuid,asset:_.asset,fields_revision:_.fields_revision,published_at:_.published_at,values:F.values})}A.push({submitted_at:p,values:n,field_values:P})}this.dispatch(c(h));const I=[];for(const S of A){const{field_values:P}=S,_=P.map(({asset:R})=>R),F=P.map(({fields_revision:R})=>R),w=P.map(({uuid:R})=>R),V=this.enqueueRequest({description:y(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:S,blockers:_.concat(F),blocks:w});I.push(V)}return Promise.all(I).then(S=>{this.dispatch(d(S.flat()))}).catch(()=>{this.dispatch(r(l.toUuidArray(h)))}),[h,I]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected AssetTypeFieldValues with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[c.uuid,c.fields_revision,c.asset],blocks:[c.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const d=this.select(gr(e));this.dispatch(i(e)),this.dispatch(Es(l.toUuidArray(d)));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(a(c)),this.dispatch(ws(d)),r}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e,latest:!0}},i)).flat();return this.dispatch(a(c)),c}}class eR extends g{name="Asset Type Identifier";url="/asset-type-identifiers";actions={addOne:Nr,addMany:Kr,setOne:Wr,setMany:Xr,updateOne:Yr,updateMany:Zr,deleteOne:Jr,deleteMany:Qr,initialize:Gr};selectors={selectById:ed,selectByIds:td};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[r.asset_type],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected asset type identifier with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected asset type identifier with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{asset_type__organization:e}},i);return this.dispatch(a(n)),n}}class tR extends g{name="Asset Type Identifier Value";url="/asset-type-identifier-values";actions={addOne:nd,addMany:cd,setOne:rd,setMany:dd,updateOne:ud,updateMany:ld,deleteOne:od,deleteMany:hd,initialize:ad};selectors={selectById:md,selectByIds:yd};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[e.asset,e.asset_type_identifier],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}bulkAdd(e,i){const{addMany:a,updateMany:n,deleteMany:c}=this.actions,d=new Date().toISOString(),r=this.select(S=>S.userReducer.currentUser?.id??null),p=l.chunkArray(e,Math.min(i??e.length,D)),h=[],f=[];for(const S of p){const P=[],_=[],F=[];for(const V of S){const R=l.uuidObj({...V,submitted_at:d,created_by:r});f.push(R);const rt={uuid:R.uuid,asset:R.asset,asset_type_identifier:R.asset_type_identifier,value:R.value};P.push(rt),_.push(R.asset),_.push(R.asset_type_identifier),F.push(R.uuid)}const w={payloads:P,submitted_at:d,blockers:_,blocks:F};h.push(w)}this.dispatch(a(f));const A=h.map(S=>{const{payloads:P,submitted_at:_,blockers:F,blocks:w}=S;return this.enqueueRequest({description:y(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:{submitted_at:_,payloads:P},blockers:F,blocks:w})});Promise.all(A).then(S=>{this.dispatch(n(S.flat()))}).catch(S=>{throw this.dispatch(c(l.toUuidArray(f))),S});const I=Promise.all(A).then(S=>S.flat());return[f,I]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected asset type identifier value with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e,latest:!0}},i)).flat();return this.dispatch(a(c)),c}}class sR extends g{name="Asset Type";url="/asset-types";actions={addOne:bd,addMany:Od,setOne:Td,setMany:Id,updateOne:Pd,updateMany:Fd,deleteOne:_d,deleteMany:Md,initialize:Ad};selectors={selectById:Rd,selectByIds:wd};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected asset type with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[n.uuid],blocks:[n.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected asset type with uuid ${e} to exist`);const d=this.select(_c(e)),r=this.select(Uc(e));this.dispatch(i(e)),this.dispatch(Is(l.toUuidArray(d))),this.dispatch(Ps(l.toUuidArray(r)));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(p){throw this.dispatch(a(c)),this.dispatch(Ts(d)),this.dispatch(Os(r)),p}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{organization:e}},i);return this.dispatch(a(n)),n}}class iR extends g{name="Asset Type Status";url="/asset-type-statuses";actions={addOne:Bd,addMany:zd,setOne:jd,setMany:Cd,updateOne:Dd,updateMany:qd,deleteOne:$d,deleteMany:Ud,initialize:Vd};selectors={selectById:Ld,selectByIds:Hd};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[e.asset_type],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected an existing asset type status with uuid ${e.uuid}`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`No asset type status with uuid ${e} found in the store`);this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{asset_type__organization:e}},i);return this.dispatch(a(n)),n}}class aR extends v{name="Document Attachment";url="/document-attachments";actions={addOne:Zd,addMany:Jd,setOne:Qd,setMany:xd,updateOne:eu,updateMany:tu,deleteOne:su,deleteMany:iu,initialize:Yd};selectors={selectById:nu,selectByIds:cu};getId(e){return e.uuid}getBlockers(e){return[e.document]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}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,i){const[a,n,c]=await super.bulkAdd(e,i),d={};for(const{file_sha1:r,uuid:p}of a)r in d||(d[r]=[]),d[r].push(p);return c.then(r=>{const p=r.flatMap(h=>d[h]??[]);for(const h of p)this.makeReadable(h)}),[a,n,c]}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,i){const{initialize:a}=this.actions,n=this.list({queryParams:{document__project__organization:e}},i),c=this.list({queryParams:{document__organization:e}},i),r=(await Promise.all([n,c])).flat();return this.dispatch(a(r)),r}}class nR extends g{name="Document";url="/documents";actions={addOne:lu,addMany:ou,setOne:hu,setMany:pu,updateOne:mu,updateMany:yu,deleteOne:fu,deleteMany:Su,initialize:uu};selectors={selectById:Tu,selectByIds:Iu};add(e){const{addOne:i,deleteOne:a,updateOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:r.parent_document?[r.parent_document]:[],blocks:[r.uuid]});return p.then(h=>{this.dispatch(n(h))}).catch(()=>{this.dispatch(a(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`attempting to update a document with uuid ${e.uuid} that does not exist in store.documents`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a,addMany:n,deleteMany:c}=this.actions,{selectById:d}=this.selectors,r=this.select(d(e));if(!r)throw new Error(`attempting to delete a document with uuid ${e} that does not exist in store.documents`);const p=this.select(bu(e));this.dispatch(i(e)),this.dispatch(c(l.toUuidArray(p)));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(a(r)),this.dispatch(n(p)),h}}async refreshStore(e,i){const{initialize:a}=this.actions,n=this.list({queryParams:{project__organization:e}},i),c=this.list({queryParams:{organization:e}},i),r=(await Promise.all([n,c])).flat();return this.dispatch(a(r)),r}}class dt extends yt{async get(e,i){return this.performRequest({url:`${this.url}/${e}/`,method:o.GET},i)}async list(e,i){return this.performRequest({url:`${this.url}/`,method:o.GET,...e},i)}async listPaginated(e,i){return this.performPagination({url:`${this.url}/`,method:o.GET,...e},i)}}class cR extends dt{name="Email Domains";url="/organization-email-domains";actions={addOne:Fu,addMany:_u,setOne:Mu,setMany:gu,updateOne:Ru,updateMany:wu,deleteOne:Eu,deleteMany:vu,initialize:Pu};selectors={selectById:Bu,selectByIds:zu};async add(e,i){return this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:{email:i,organization:e},blockers:[e,"create-org"],blocks:[]})}async delete(e){const{deleteOne:i,addOne:a}=this.actions;this.dispatch(i(e.uuid));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e.uuid}/`,blockers:[e.domain],blocks:[]})}catch(n){throw this.dispatch(a(e)),n}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{organization:e}},i);return this.dispatch(a(n)),n}}class rR extends yt{async getVerificationCode(e){return this.enqueueRequest({description:"Get verification code",method:o.GET,url:`/verification/email-verification/${e}/`,isAuthNeeded:!1,blockers:[],blocks:[]})}validateVerificationCode(e,i){return this.enqueueRequest({description:"Validate verification code",method:o.POST,url:`/verification/email-verification/${e}/`,isAuthNeeded:!1,payload:i,blockers:[],blocks:[]})}}const Bt={},fn=new Set,Sn=new Set;class dR extends yt{host=void 0;dbPromise=O_.openDB("fileCache",2,{upgrade(e,i){i<1&&e.createObjectStore("files"),i<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 i=await rs(e);if(fn.has(i))return;const a=await this.getDB();!!await a.get("files",i)?console.warn(`Attempting to add a file already cached, ${e.name}`):await a.put("files",e,i),fn.add(i)}async uncacheFile(e){await(await this.getDB()).delete("files",e),fn.delete(e)}async getFileFromCache(e){return(await this.getDB()).get("files",e)}async fetchFileFromUrl(e,i,a=i,n){const c=e.split("?")[0]??e,d=await this.getFileFromCache(i);if(d)return d;let r;c in Bt?r=Bt[c]:a_(e)?(r=i_(e,a),Bt[c]=r):(r=this.performRequest({method:o.GET,url:e,isExternalUrl:!0,isResponseBlob:!0,isAuthNeeded:!1},n).then(f=>new File([f],a,{type:f.type})),Bt[c]=r);let p;try{p=await r}catch(f){throw f instanceof z&&delete Bt[c],f}const h=await rs(p);if(h!==i){const f=`The hash of the file returned from the server (${h}) does not match the
8
8
  expected hash (${i}). 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,i){if("warning"in i){if(i.warning==="already_uploaded")return Promise.resolve(void 0);throw console.error(i.warning),new Error(i.warning)}return this.enqueueRequest({url:i.url,description:"Upload file to S3",method:o.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:e,blockers:[`s3-${i.fields.key}`,"s3-presigned-upload"],blocks:[e,"s3-presigned-upload"],s3url:i})}processPresignedUrls(e){const i={};for(const[a,n]of Object.entries(e))i[a]=this.processPresignedUrl(a,n);return i}async getFilePayload(e){const a={sha1:await rs(e),file_type:e.type,extension:t_(e),size:e.size};return await this.client.files.cacheFile(e),a}async cachePresignedUrl(e,i){if(Sn.has(e))return;const a=await this.getDB();!!await a.get("presignedUrls",e)?console.warn(`Attempting to add a presigned url already cached, ${i}`):await a.put("presignedUrls",i,e),Sn.add(e)}async uncachePresignedUrl(e){await(await this.getDB()).delete("presignedUrls",e),Sn.delete(e)}async getPresignedUrlFromCache(e){const i=await(await this.getDB()).get("presignedUrls",e);if(!i)return;if(d_(i)){await this.uncachePresignedUrl(e);return}return i}}class uR extends g{name="Form Identifier";url="/form-identifiers";actions={addOne:qu,addMany:$u,setOne:Uu,setMany:ku,updateOne:Lu,updateMany:Hu,deleteOne:Gu,deleteMany:Nu,initialize:Du};selectors={selectById:Wu,selectByIds:Xu};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[r.form],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected form identifier with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected form identifier with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{form__organization:e}},i);return this.dispatch(a(n)),n}}class lR extends g{name="Form Identifier Value";url="/form-identifier-values";actions={addOne:Qu,addMany:xu,setOne:el,setMany:tl,updateOne:sl,updateMany:il,deleteOne:al,deleteMany:nl,initialize:Ju};selectors={selectById:rl,selectByIds:dl};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[e.form_submission,e.form_identifier],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected form identifier value with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await Promise.all([this.listPaginated({queryParams:{latest:!0,form_submission__organization:e}},i),this.listPaginated({queryParams:{latest:!0,form_submission__project__organization:e}},i)])).flatMap(d=>d.flat());return this.dispatch(a(c)),c}}class oR extends v{name="Form Revision Attachment";url="/form-revision-attachments";actions={addOne:hl,addMany:pl,setOne:ml,setMany:yl,updateOne:fl,updateMany:Sl,deleteOne:Al,deleteMany:Tl,initialize:ol};selectors={selectById:bl,selectByIds:Ol};getId(e){return e.uuid}getBlockers(e){return[e.form_revision]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){const{uuid:i,field_identifier:a,form_revision:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,submitted_at:e.submitted_at,field_identifier:a,form_revision:n,file_sha1:c,file_name:d,file_extension:r}}buildBulkPayload(e){const{uuid:i,field_identifier:a,form_revision:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,field_identifier:a,form_revision:n,file_sha1:c,file_name:d,file_extension:r}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{form_revision__form__organization:e}},i);return this.dispatch(a(n)),n}}class hR extends g{name="Form Revision";url="/form-revisions";actions={addOne:Ml,addMany:Js,setOne:gl,setMany:Rl,updateOne:wl,updateMany:El,deleteOne:vl,deleteMany:Qs,initialize:_l};selectors={selectById:Bl,selectByIds:zl};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[e.form],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{form__organization:e}},i);return this.dispatch(a(n)),n}}class pR extends g{name="Form";url="/forms";actions={addOne:Ql,addMany:xl,setOne:eo,setMany:to,updateOne:so,updateMany:io,deleteOne:ao,deleteMany:no,initialize:Jl};selectors={selectById:uo,selectByIds:lo};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=new Date().toISOString(),d=this.select(h=>h.userReducer.currentUser?.id??null),r=l.uuidObj({...e,submitted_at:c,created_by:d});this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected form with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[n.uuid],blocks:[n.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error("Expected form to exist");const d=this.select(Th(e)),r=this.select(jl(e)),p=this.select(Xl(e));this.dispatch(i(e)),this.dispatch(ot(l.toUuidArray(d))),this.dispatch(Qs(l.toUuidArray(r))),this.dispatch(ti(l.toUuidArray(p)));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(a(c)),this.dispatch(Js(r)),this.dispatch(lt(d)),this.dispatch(ei(p)),h}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{organization:e}},i);return this.dispatch(a(n)),n}}class mR extends g{name="Form Subscriber";url="/form-subscribers";actions={addOne:$l,addMany:ei,setOne:Ul,setMany:kl,updateOne:Ll,updateMany:Hl,deleteOne:Gl,deleteMany:ti,initialize:ql};selectors={selectById:Kl,selectByIds:Wl};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=new Date().toISOString(),d=this.select(h=>h.userReducer.currentUser?.id??null),r=l.uuidObj({...e,created_by:d,submitted_at:c});this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[r.form],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected form subscriber with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{form__organization:e}},i);return this.dispatch(a(n)),n}}class yR extends v{name="Form Submission Field Values Attachment";url="/form-submission-field-values-attachments";actions={addOne:po,addMany:ni,setOne:mo,setMany:yo,updateOne:fo,updateMany:So,deleteOne:Ao,deleteMany:ci,initialize:ho};selectors={selectById:To,selectByIds:ui};getId(e){return e.uuid}getBlockers(e){return[e.field_values]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){const{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,submitted_at:e.submitted_at,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}}buildBulkPayload(e){const{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}}async bulkDelete(e){const{deleteMany:i,addMany:a}=this.actions,n=this.select(ui(e));this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(a(n)),c}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await Promise.all([this.listPaginated({queryParams:{latest:!0,field_values__form_submission__organization:e}},i),this.listPaginated({queryParams:{latest:!0,field_values__form_submission__project__organization:e}},i)])).flatMap(d=>d.flat());return this.dispatch(a(c)),c}}class fR extends g{name="Form Submission Field Values";url="/form-submission-field-values";actions={addOne:Fo,addMany:oi,setOne:_o,setMany:Mo,updateOne:go,updateMany:Ro,deleteOne:wo,deleteMany:hi,initialize:Po};selectors={selectById:vo,selectByIds:Vo};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[r.form_submission],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await Promise.all([this.listPaginated({queryParams:{latest:!0,form_submission__organization:e}},i),this.listPaginated({queryParams:{latest:!0,form_submission__project__organization:e}},i)])).flatMap(d=>d.flat());return this.dispatch(a(c)),c}}class SR extends v{name="Form Submission Comment Attachment";url="/form-submission-comment-attachments";actions={addOne:Do,addMany:qo,setOne:$o,setMany:Uo,updateOne:ko,updateMany:Lo,deleteOne:Ho,deleteMany:Go,initialize:Co};selectors={selectById:Ko,selectByIds:Wo};getId(e){return e.uuid}getBlockers(e){return[e.form_submission_comment]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}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,form_submission_comment:e.form_submission_comment}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,form_submission_comment:e.form_submission_comment}}async bulkDelete(e){const{deleteMany:i,addMany:a}=this.actions,{selectByIds:n}=this.selectors,c=this.select(n(e));this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await Promise.all([this.listPaginated({queryParams:{form_submission_comment__form_submission__organization:e}},i),this.listPaginated({queryParams:{form_submission_comment__form_submission__project__organization:e}},i)])).flatMap(d=>d.flat());return this.dispatch(a(c)),c}}class AR extends g{name="Form Submission Comment";url="/form-submission-comments";actions={addOne:Jo,addMany:Si,setOne:Qo,setMany:xo,updateOne:eh,updateMany:th,deleteOne:sh,deleteMany:Ai,initialize:Zo};selectors={selectById:ah,selectByIds:nh};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(c),blockers:[c.form_submission],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Form submission comment with uuid ${e.uuid} not found in store`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Form submission comment with uuid ${e} not found in store`);this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await Promise.all([this.listPaginated({queryParams:{form_submission__organization:e}},i),this.listPaginated({queryParams:{form_submission__project__organization:e}},i)])).flatMap(d=>d.flat());return this.dispatch(a(c)),c}}class TR extends g{name="Form Submission";url="/form-submissions";actions={addOne:hh,addMany:lt,setOne:lh,setMany:oh,updateOne:ph,updateMany:mh,deleteOne:yh,deleteMany:ot,initialize:uh};selectors={selectById:Sh,selectByIds:Ah};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d}),p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[e.form_revision],blocks:[r.uuid]});return this.dispatch(i(r)),p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected submission with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${c.uuid}/`,payload:e,blockers:[c.uuid],blocks:[c.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const d=this.select(Bo(e)),r=d.flatMap(({uuid:h})=>this.select(Io(h))),p=this.select(ch(e));this.dispatch(i(e)),this.dispatch(hi(l.toUuidArray(d))),this.dispatch(ci(l.toUuidArray(r))),this.dispatch(Ai(l.toUuidArray(p)));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(a(c)),this.dispatch(oi(d)),this.dispatch(ni(r)),this.dispatch(Si(p)),h}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await Promise.all([this.listPaginated({queryParams:{organization:e}},i),this.listPaginated({queryParams:{project__organization:e}},i)])).flatMap(d=>d.flat());return this.dispatch(a(c)),c}}class IR extends v{name="Geo Image";url="/geo-images";actions={addOne:wh,addMany:Eh,setOne:gh,setMany:Rh,updateOne:vh,updateMany:Vh,deleteOne:Bh,deleteMany:zh,initialize:Mh};selectors={selectById:Ch,selectByIds:Dh};getId(e){return e.uuid}getBlockers(e){return[e.project]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}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,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,direction:e.direction,original_date:e.original_date,project:e.project}}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Geo image with uuid ${e.uuid} does not exist in the store`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{project:e}},i);return this.dispatch(a(n)),n}}class bR extends g{name="Issue Association";url="/issue-associations";actions={addOne:Nh,addMany:At,setOne:Lh,setMany:kh,updateOne:Hh,updateMany:Gh,deleteOne:Kh,deleteMany:Tt,initialize:Uh};selectors={selectById:Xh,selectByIds:Yh};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=new Date().toISOString(),d=this.select(h=>h.userReducer.currentUser?.id??null),r=l.uuidObj({...e,submitted_at:c,created_by:d});this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[e.issue,e.asset],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}bulkAdd(e){const{addMany:i,deleteMany:a,updateMany:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=e.map(h=>l.uuidObj({...h,submitted_at:d,created_by:c}));this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:{payloads:r.map(h=>M(h)),submitted_at:d},blockers:r.flatMap(h=>[h.issue,h.asset]),blocks:l.toUuidArray(r)});return p.then(h=>{this.dispatch(n(h))}).catch(()=>{this.dispatch(a(l.toUuidArray(r)))}),[r,p]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Issue association with uuid ${e} not found in store.`);this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{issue__project:e}},i)).flat();return this.dispatch(a(c)),c}}class OR extends v{name="Issue Attachment";url="/issue-attachments";actions={addOne:ip,addMany:Fi,setOne:ap,setMany:np,updateOne:cp,updateMany:rp,deleteOne:dp,deleteMany:_i,initialize:sp};selectors={selectById:op,selectByIds:hp};getId(e){return e.uuid}getBlockers(e){return[e.issue]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}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,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{issue__project:e}},i)).flat();return this.dispatch(a(c)),c}}class PR extends v{name="Issue Comment Attachment";url="/issue-comment-attachments";actions={addOne:fp,addMany:Sp,setOne:Ap,setMany:Tp,updateOne:Ip,updateMany:bp,deleteOne:Op,deleteMany:Pp,initialize:yp};selectors={selectById:_p,selectByIds:Mp};getId(e){return e.uuid}getBlockers(e){return[e.issue_comment]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}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 bulkDelete(e){const{deleteMany:i,addMany:a}=this.actions,{selectByIds:n}=this.selectors,c=this.select(n(e));this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{issue_comment__issue__project:e}},i)).flat();return this.dispatch(a(c)),c}}class FR extends g{name="Issue Comment";url="/issue-comments";actions={addOne:Ep,addMany:vp,setOne:Vp,setMany:Bp,updateOne:zp,updateMany:jp,deleteOne:Cp,deleteMany:Dp,initialize:wp};selectors={selectById:qp,selectByIds:$p};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser.id),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(c),blockers:[e.issue],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Comment with uuid ${e.uuid} not found in store`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Comment with uuid ${e} not found in store`);this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{issue__project:e}},i)).flat();return this.dispatch(a(c)),c}}class _R extends g{name="Issue";url="/issues";actions={addOne:Hp,addMany:Vi,setOne:Gp,setMany:Np,updateOne:Kp,updateMany:Wp,deleteOne:Xp,deleteMany:Bi,initialize:Lp};selectors={selectById:Zp,selectByIds:Jp};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=new Date().toISOString(),d=this.select(h=>h.userReducer.currentUser?.id??null),r=l.uuidObj({...e,submitted_at:c,created_by:d});this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[r.project,r.issue_type,r.status,r.priority],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(h=>{throw this.dispatch(n(r.uuid)),h}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Attempting to update an issue with uuid ${e.uuid} that doesn't exist in the store`);const c={...n,...e};this.dispatch(i(c));const d={};for(const h of[l.IssueUpdateChange.TITLE,l.IssueUpdateChange.DESCRIPTION,l.IssueUpdateChange.STATUS,l.IssueUpdateChange.PRIORITY,l.IssueUpdateChange.ASSIGNED_TO,l.IssueUpdateChange.DUE_DATE])if(h in e&&e[h]!==n[h])switch(h){case l.IssueUpdateChange.PRIORITY:{const f=e[h],A=this.select(Yi(f));if(!A)throw new Error(`Trying to update issue type priority with ${f} which does not exist in store`);d[h]={name:A.name,color:A.color,uuid:A.uuid};break}case l.IssueUpdateChange.DUE_DATE:d[h]=e.due_date;break;case l.IssueUpdateChange.DESCRIPTION:d[h]=e.description??"";break;case l.IssueUpdateChange.TITLE:d[h]=e.title??"";break;case l.IssueUpdateChange.STATUS:{const f=e[h],A=this.select(ea(f));if(!A)throw new Error(`Trying to update issue type status with ${f} which does not exist in store`);d[h]={name:A.name,color:A.color,uuid:A.uuid};break}case l.IssueUpdateChange.ASSIGNED_TO:{const f=e[h];if(f===null)d[h]=null;else{const A=this.select(xt(f));if(!A)throw new Error(`Trying to update assigned to with ${f} which does not exist in store.`);d[h]={full_name:A.username,id:A.id}}break}}const r=l.uuidObj({created_by:this.select(h=>h.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString(),issue:n.uuid,changes:d});this.dispatch(sa(r));const p=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return p.then(h=>{this.dispatch(i(h))}).catch(()=>{this.dispatch(i(n)),this.dispatch(aa(r.uuid))}),[c,p]}bulkUpdate(e,i){const{updateMany:a}=this.actions,{selectByIds:n}=this.selectors,c=l.toUuidArray(e);if(new Set(c).size!==e.length)throw new Error("payloads contains duplicate uuids.");const d=this.select(n(c));if(c.length!=d.length)throw new Error(`Attempting to bulk update ${c.length-d.length} issues that dont exist in the store`);const r=d.toSorted((S,P)=>l.uuidSortFn(S.uuid,P.uuid)),p=e.toSorted((S,P)=>l.uuidSortFn(S.uuid,P.uuid)),h=[];for(let S=0;S<c.length;S++)h.push({...r[S],...p[S]});this.dispatch(a(h));const f=l.chunkArray(e,Math.min(i??e.length,D)),A=[];let I=null;for(const S of f){const P=ut.v4(),_=l.toUuidArray(S),F=S.map(({status:R})=>R).filter(Boolean),w=S.map(({priority:R})=>R).filter(Boolean),V=this.enqueueRequest({description:y(o.PATCH,this.name,!0),method:o.PATCH,url:`${this.url}/bulk/`,payload:{payloads:S},blockers:(I?[I]:[]).concat(_).concat(F).concat(w),blocks:[P].concat(_)});A.push(V),I=P}return Promise.all(A).then(S=>{this.dispatch(a(S.flat()))}).catch(()=>{this.dispatch(a(d))}),[h,A]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`No issue with uuid ${e} found in the store`);const d=this.select(Jh(e)),r=this.select(lp(e)),p=this.select(qf(e)),h=this.select(Ih(e));this.dispatch(i(e)),this.dispatch(_i(l.toUuidArray(r))),this.dispatch(na(l.toUuidArray(p))),this.dispatch(Tt(l.toUuidArray(d))),this.dispatch(ot(l.toUuidArray(h)));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(f){throw this.dispatch(a(c)),this.dispatch(Fi(r)),this.dispatch(ia(p)),this.dispatch(At(d)),this.dispatch(lt(h)),f}}async bulkDelete(e){const{addMany:i,deleteMany:a}=this.actions,{selectByIds:n}=this.selectors,c=this.select(n(e)),d=this.select(Zh(e)),r=this.select(bh(e));this.dispatch(a(e)),this.dispatch(Tt(l.toUuidArray(d))),this.dispatch(ot(l.toUuidArray(r)));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(p){throw this.dispatch(i(c)),this.dispatch(At(d)),this.dispatch(lt(r)),p}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e}},i)).flat();return this.dispatch(a(c)),c}}class MR extends v{name="Issue Type Attachment";url="/issue-type-attachments";actions={addOne:sm,addMany:im,setOne:am,setMany:nm,updateOne:cm,updateMany:rm,deleteOne:dm,deleteMany:um,initialize:tm};selectors={selectById:om,selectByIds:hm};getId(e){return e.uuid}getBlockers(e){return[e.issue_type]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}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,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{issue_type__organization:e}},i);return this.dispatch(a(n)),n}}class gR extends v{name="Issue Type Fields Attachment";url="/issue-type-fields-attachments";actions={addOne:fm,addMany:Sm,setOne:Am,setMany:Tm,updateOne:Im,updateMany:bm,deleteOne:Om,deleteMany:Pm,initialize:ym};selectors={selectById:_m,selectByIds:Mm};getId(e){return e.uuid}getBlockers(e){return[e.fields_revision]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){const{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,submitted_at:e.submitted_at,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}}buildBulkPayload(e){const{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{fields_revision__issue_type__organization:e}},i);return this.dispatch(a(n)),n}}class RR extends g{name="Issue Type Fields";url="/issue-type-fields";actions={addOne:Gm,addMany:Nm,setOne:Km,setMany:Wm,updateOne:Xm,updateMany:Ym,deleteOne:Zm,deleteMany:Jm,initialize:Hm};selectors={selectById:xm,selectByIds:ey};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[r.issue_type],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(h=>{throw this.dispatch(n(r.uuid)),h}),[r,p]}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{issue_type__organization:e}},i);return this.dispatch(a(n)),n}}class wR extends v{name="Issue Type Field Values Attachment";url="/issue-type-field-values-attachments";actions={addOne:ay,addMany:ki,setOne:ny,setMany:cy,updateOne:ry,updateMany:dy,deleteOne:uy,deleteMany:Li,initialize:iy};selectors={selectById:oy,selectByIds:hy};getId(e){return e.uuid}getBlockers(e){return[e.field_values]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){const{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,submitted_at:e.submitted_at,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}}buildBulkPayload(e){const{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}}async bulkDelete(e){const{deleteMany:i,addMany:a}=this.actions,{selectByIds:n}=this.selectors,c=this.select(n(e));this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{field_values__issue__project:e,latest:!0}},i)).flat();return this.dispatch(a(c)),c}}class ER extends g{name="Issue Type Field Values";url="/issue-type-field-values";actions={addOne:Em,addMany:vm,setOne:Vm,setMany:Bm,updateOne:zm,updateMany:jm,deleteOne:Cm,deleteMany:Dm,initialize:wm};selectors={selectById:$m,selectByIds:Um};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d}),p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[e.issue,e.fields_revision],blocks:[r.uuid]});return this.dispatch(i(r)),p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected IssueTypeFieldValues with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[c.uuid,c.fields_revision,c.issue],blocks:[c.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const d=this.select(py(e));this.dispatch(i(e)),this.dispatch(Li(l.toUuidArray(d)));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(a(c)),this.dispatch(ki(d)),r}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{issue__project:e,latest:!0}},i)).flat();return this.dispatch(a(c)),c}}class vR extends g{name="Issue Type Identifier";url="/issue-type-identifiers";actions={addOne:Sy,addMany:Ay,setOne:Ty,setMany:Iy,updateOne:by,updateMany:Oy,deleteOne:Py,deleteMany:Fy,initialize:fy};selectors={selectById:My,selectByIds:gy};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[r.issue_type],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected issue type identifier with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected issue type identifier with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{issue_type__organization:e}},i);return this.dispatch(a(n)),n}}class VR extends g{name="Issue Type Identifier Value";url="/issue-type-identifier-values";actions={addOne:vy,addMany:Vy,setOne:By,setMany:zy,updateOne:jy,updateMany:Cy,deleteOne:Dy,deleteMany:qy,initialize:Ey};selectors={selectById:Uy,selectByIds:ky};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[e.issue,e.issue_type_identifier],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected issue type identifier value with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{issue__project:e,latest:!0}},i)).flat();return this.dispatch(a(c)),c}}class BR extends g{name="Issue Type Priority";url="/issue-type-priorities";actions={addOne:Ny,addMany:Ky,setOne:Wy,setMany:Xy,updateOne:Yy,updateMany:Zy,deleteOne:Jy,deleteMany:Qy,initialize:Gy};selectors={selectById:Yi,selectByIds:ef};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[e.issue_type],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected an existing issue type priority with uuid ${e.uuid}`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`No issue type priority with uuid ${e} found in the store`);this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{issue_type__organization:e}},i);return this.dispatch(a(n)),n}}class zR extends g{name="Issue Type";url="/issue-types";actions={addOne:nf,addMany:cf,setOne:rf,setMany:df,updateOne:uf,updateMany:lf,deleteOne:of,deleteMany:hf,initialize:af};selectors={selectById:mf,selectByIds:yf};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,submitted_at:d,created_by:c});this.dispatch(i(r));const p=this.enqueueRequest({method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`IssueType with uuid ${e.uuid} does not exist in the store.`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{addOne:i,deleteOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`IssueType with uuid ${e} does not exist in the store.`);const d=this.select(Qp(e));this.dispatch(a(e)),this.dispatch(Bi(l.toUuidArray(d)));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(i(c)),this.dispatch(Vi(d)),r}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{organization:e}},i);return this.dispatch(a(n)),n}}class jR extends g{name="Issue Type Status";url="/issue-type-statuses";actions={addOne:Tf,addMany:If,setOne:bf,setMany:Of,updateOne:Pf,updateMany:Ff,deleteOne:_f,deleteMany:Mf,initialize:Af};selectors={selectById:ea,selectByIds:Rf};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[e.issue_type],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected an existing issue type status with uuid ${e.uuid}`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`No issue type status with uuid ${e} found in the store`);this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{issue_type__organization:e}},i);return this.dispatch(a(n)),n}}class CR extends g{name="Issue Update";url="/issue-updates";actions={addOne:sa,addMany:ia,setOne:Vf,setMany:Bf,updateOne:zf,updateMany:jf,deleteOne:aa,deleteMany:na,initialize:vf};selectors={selectById:Cf,selectByIds:Df};async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{issue__project:e}},i)).flat();return this.dispatch(a(c)),c}}const DR=1800;function qR(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 $R extends u_{_getRenewedTokens=async e=>{const i=this.performRequest({method:o.POST,url:this.refreshTokensUrl,payload:{refresh:e},isAuthNeeded:!1,checkAuth:!1});let a;try{a=await i}catch(n){console.error("Could not renew tokens; clearing auth",n),this.clearAuth();return}if(!a.access)throw new Error("Missing access token");return{accessToken:a.access,refreshToken:a.refresh??this.getRefreshToken()}};clearAuth(){console.debug(this.constructor.name,"clearing auth;"),this.dispatch(Kd(!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 i=await this._getRenewedTokens(e);if(!i)return;console.debug("Got renewed tokens"),this.setTokens(i)}catch(i){throw console.error("Could not renew tokens; clearing auth",i),this.clearAuth(),i}}tokenIsExpiringSoon(){const e=this.getAccessToken();if(!e)return!1;const i=Date.now()/1e3;let a;try{a=P_(e).exp??i}catch{a=i}return a-i<DR}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 z&&this.clearAuth(),e instanceof Error?Promise.reject(e):Promise.reject(new Error((e??l.ERROR_MSG_UNEXPECTED).toString()))}}}async handleUnauthorized(e,i){if(e.url.endsWith("/token/refresh/"))throw this.select(a=>a.authReducer.isLoggedIn)&&console.warn("No signed-in user to sign out."),this.clearAuth(),new z({message:"You have been signed out due to inactivity.",response:i,discard:!0});if(this.select(a=>a.authReducer.isLoggedIn))await this.renewTokens();else throw console.debug("Forbidden; user is not logged in."),new z({message:"Incorrect username or password.",response:i,discard:!0})}async initAuth(e){const i=ut.v4();return console.debug(this.constructor.name,"Initiating auth"),this.performRequest({uuid:i,method:o.POST,url:this.initTokensUrl,payload:e,isAuthNeeded:!1,checkAuth:!1}).then(a=>{this.setTokens(qR(a))})}}class UR extends dt{name="Organization Access";url="/organization-accesses";actions={addOne:xf,addMany:eS,setOne:tS,setMany:sS,updateOne:iS,updateMany:aS,deleteOne:nS,deleteMany:cS,initialize:Qf};selectors={selectById:dS,selectByIds:uS};update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid)),c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(r=>{throw this.dispatch(i(n)),r}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e)),d=this.select(xt(c.user));this.dispatch(i(c.uuid)),this.dispatch(la(c.user));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${c.uuid}/`,blockers:[c.uuid],blocks:[]})}catch(r){throw this.dispatch(a(c)),this.dispatch(ua(d)),r}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{organization:e}},i);return this.dispatch(a(n)),n}}class kR extends dt{name="Organization";url="/organizations";actions={addOne:fS,addMany:yS,setOne:mS,setMany:pS,updateOne:AS,updateMany:SS,deleteOne:TS,deleteMany:IS,initialize:hS};selectors={selectById:PS,selectByIds:FS};async add(e){const{addOne:i}=this.actions,a=await this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:e,blockers:[],blocks:[]});return this.dispatch(i(a)),a}async update(e){const{updateOne:i}=this.actions,a=await this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return this.dispatch(i(a)),a}async invite(e,i){return this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/${e}/invite/${i}/`,blockers:[],blocks:[]})}async refreshStore(e){const{initialize:i}=this.actions,a=await this.list({},e);return this.dispatch(i(a)),a}}class LR extends g{name="Project Access";url="/project-accesses";actions={addOne:zS,addMany:jS,setOne:CS,setMany:DS,updateOne:qS,updateMany:$S,deleteOne:US,deleteMany:kS,initialize:BS};selectors={selectById:HS,selectByIds:GS};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null)});this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(c),blockers:[c.organization_access,c.project],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(r=>{throw this.dispatch(n(c.uuid)),r}),[c,d]}bulkAdd(e){const{addMany:i,deleteMany:a,updateMany:n}=this.actions,c=this.select(p=>p.userReducer.currentUser?.id??null),d=e.map(p=>l.uuidObj({...p,created_by:c}));this.dispatch(i(d));const r=this.enqueueRequest({description:y(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:{project_accesses:d.map(p=>M(p))},blockers:d.flatMap(p=>[p.project,p.organization_access]),blocks:d.map(p=>p.uuid)});return r.then(p=>{this.dispatch(n(p))}).catch(p=>{throw this.dispatch(a(d.map(h=>h.uuid))),p}),[d,r]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid)),c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[]});return d.then(r=>{this.dispatch(i(r))}).catch(r=>{throw this.dispatch(i(n)),r}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{project__organization:e}},i);return this.dispatch(a(n)),n}}class HR extends v{name="Project Attachment";url="/project-attachments";actions={addOne:WS,addMany:XS,setOne:YS,setMany:ZS,updateOne:JS,updateMany:QS,deleteOne:xS,deleteMany:eA,initialize:KS};selectors={selectById:sA,selectByIds:iA};getId(e){return e.uuid}getBlockers(e){return[e.project]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}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,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{project__organization:e}},i);return this.dispatch(a(n)),n}}class GR extends g{name="Project Comment";url="/project-comments";actions={addOne:rA,addMany:dA,setOne:uA,setMany:lA,updateOne:oA,updateMany:hA,deleteOne:pA,deleteMany:mA,initialize:cA};selectors={selectById:fA,selectByIds:SA};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(c),blockers:[c.project],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Project comment with uuid ${e.uuid} not found in store`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Project comment with uuid ${e} not found in store`);this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e}},i)).flat();return this.dispatch(a(c)),c}}class NR extends v{name="Project File";url="/project-files";actions={addOne:PA,addMany:FA,setOne:bA,setMany:OA,updateOne:_A,updateMany:MA,deleteOne:gA,deleteMany:RA,initialize:IA};selectors={selectById:vA,selectByIds:VA};getId(e){return e.uuid}getBlockers(e){return[e.project]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}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,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,bounds:e.bounds}}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`${this.name} with uuid ${e.uuid} does not exist in the store`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e}},i)).flat();return this.dispatch(a(c)),c}}class KR extends dt{name="Project";url="/projects";actions={addOne:$A,addMany:qA,setOne:DA,setMany:CA,updateOne:kA,updateMany:UA,deleteOne:LA,deleteMany:HA,initialize:jA};selectors={selectById:KA,selectByIds:WA};async add(e){const{addOne:i}=this.actions,a=await this.performRequest({method:o.POST,url:`${this.url}/`,payload:M(e)});return this.dispatch(i(a)),a}async update(e){const{updateOne:i}=this.actions,a=await this.performRequest({method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:M(e)});return this.dispatch(i(a)),a}async delete(e){const{deleteOne:i}=this.actions,a=await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return this.dispatch(i(e)),a}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{organization:e}},i);return this.dispatch(a(n)),n}}class WR extends dt{name="Report";url="/reports";actions={addOne:iF,addMany:aF,setOne:nF,setMany:cF,updateOne:rF,updateMany:dF,deleteOne:uF,deleteMany:lF,initialize:sF};selectors={selectById:pF,selectByIds:mF};async getPresignedUrl(e,i){return this.performRequest({url:`${this.url}/${e}/presigned-url/`,method:o.GET},i)}async refreshStore(e,i){const n=(await this.listPaginated({queryParams:{organization:e}},i)).flat();return this.dispatch(this.actions.initialize(n)),n}}class XR extends g{name="Procedure";url="/procedures";actions={addOne:lT,addMany:bt,setOne:oT,setMany:hT,updateOne:pT,updateMany:mT,deleteOne:yT,deleteMany:Ot,initialize:uT};selectors={selectById:AT,selectByIds:TT};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(c),blockers:[c.procedure_type,c.project,c.asset,...c.procedure_initiative?[c.procedure_initiative]:[]],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}bulkAdd(e,i){const{store:a}=this.client,{addMany:n,updateMany:c,deleteMany:d}=this.actions,r=new Date().toISOString(),p=a.getState().userReducer.currentUser?.id??null,h=[],f=l.chunkArray(e,Math.min(i??e.length,D)),A=[];for(const S of f){const P=[],_=[],F=[];for(const V of S){const R=l.uuidObj({...V,submitted_at:r,created_by:p});h.push(R),P.push(M(R)),_.push(R.procedure_type,R.project,R.asset,...R.procedure_initiative?[R.procedure_initiative]:[]),F.push(R.uuid)}const w={payload:{submitted_at:r,payloads:P},blockers:_,blocks:F};A.push(w)}this.dispatch(n(h));const I=A.map(S=>{const{payload:P,blocks:_,blockers:F}=S;return this.enqueueRequest({description:y(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:P,blockers:F,blocks:_})});return Promise.all(I).then(S=>{this.dispatch(c(S.flat()))}).catch(()=>{this.dispatch(d(l.toUuidArray(h)))}),[h,Promise.all(I).then(S=>S.flat())]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected procedure with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[n.uuid],blocks:[n.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected procedure with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async bulkDelete(e){const{addMany:i,deleteMany:a}=this.actions,{selectByIds:n}=this.selectors,c=this.select(n(e));this.dispatch(a(l.toUuidArray(c)));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(i(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e}},i)).flat();return this.dispatch(a(c)),c}}class YR extends g{name="Procedure Step Assignee";url="/procedure-step-assignees";actions={addOne:MT,addMany:gT,setOne:RT,setMany:wT,updateOne:ET,updateMany:vT,deleteOne:VT,deleteMany:BT,initialize:_T};selectors={selectById:jT,selectByIds:CT};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(c),blockers:[c.procedure,c.procedure_step],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}bulkAdd(e){const{addMany:i,updateMany:a,deleteMany:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=e.map(h=>l.uuidObj({...h,created_by:c,submitted_at:d}));this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:{procedure_step_assignees:r.map(h=>M(h)),submitted_at:d},blockers:r.flatMap(h=>[h.procedure,h.procedure_step]),blocks:l.toUuidArray(r)});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(l.toUuidArray(r)))}),[r,p]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected procedure step assignee with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async bulkDelete(e){const{deleteMany:i,addMany:a}=this.actions,{selectByIds:n}=this.selectors,c=this.select(n(e));this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{procedure__project:e}},i)).flat();return this.dispatch(a(c)),c}}class ZR extends g{name="Procedure Step Comment";url="/procedure-step-comments";actions={addOne:UT,addMany:kT,setOne:LT,setMany:HT,updateOne:GT,updateMany:NT,deleteOne:KT,deleteMany:WT,initialize:$T};selectors={selectById:YT,selectByIds:ZT};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(c),blockers:[c.procedure,c.procedure_step],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Procedure step comment with uuid ${e.uuid} not found in store`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Procedure step comment with uuid ${e} not found in store`);this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{procedure__project:e}},i)).flat();return this.dispatch(a(c)),c}}class JR extends g{name="Procedure Step Default Assignee";url="/procedure-step-default-assignees";actions={addOne:eI,addMany:tI,setOne:sI,setMany:iI,updateOne:aI,updateMany:nI,deleteOne:cI,deleteMany:rI,initialize:xT};selectors={selectById:uI,selectByIds:lI};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(c),blockers:[c.procedure_step],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected procedure step default assignee with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{procedure_step__procedure_type__organization:e}},i);return this.dispatch(a(n)),n}}class QR extends g{name="Procedure Step Default Reviewer";url="/procedure-step-default-reviewers";actions={addOne:mI,addMany:yI,setOne:fI,setMany:SI,updateOne:AI,updateMany:TI,deleteOne:II,deleteMany:bI,initialize:pI};selectors={selectById:PI,selectByIds:FI};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(c),blockers:[c.procedure_step],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected procedure step default reviewer with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{procedure_step__procedure_type__organization:e}},i);return this.dispatch(a(n)),n}}class xR extends dt{name="Procedure Step Event";url="/procedure-step-events";actions={addOne:RI,addMany:wI,setOne:EI,setMany:vI,updateOne:VI,updateMany:BI,deleteOne:zI,deleteMany:jI,initialize:gI};selectors={selectById:DI,selectByIds:qI};async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{procedure__project:e}},i)).flat();return this.dispatch(a(c)),c}}class ew extends v{name="Procedure Step Fields Attachment";url="/procedure-step-fields-attachments";actions={addOne:LI,addMany:Va,setOne:HI,setMany:GI,updateOne:NI,updateMany:KI,deleteOne:WI,deleteMany:Ba,initialize:kI};selectors={selectById:ZI,selectByIds:JI};getId(e){return e.uuid}getBlockers(e){return[e.fields_revision]}getBlocks(e){return[e.uuid]}buildModel(e){return l.uuidObj({...e,created_by:this.select(i=>i.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()})}buildPayload(e){const{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,submitted_at:e.submitted_at,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}}buildBulkPayload(e){const{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{fields_revision__procedure_step__procedure_type__organization:e}},i);return this.dispatch(a(n)),n}}class tw extends g{name="Procedure Step Fields";url="/procedure-step-fields";actions={addOne:tb,addMany:sb,setOne:ib,setMany:ab,updateOne:nb,updateMany:cb,deleteOne:rb,deleteMany:db,initialize:eb};selectors={selectById:ub,selectByIds:lb};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(c),blockers:[c.procedure_step],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`No procedure step fields with uuid ${e.uuid} found in the store`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected procedure step fields with uuid ${e} to exist`);const d=this.select(YI(e));this.dispatch(i(e)),this.dispatch(Ba(l.toUuidArray(d)));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(a(c)),this.dispatch(Va(d)),r}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{procedure_step__procedure_type__organization:e}},i);return this.dispatch(a(n)),n}}class sw extends v{name="Procedure Step Field Values Attachment";url="/procedure-step-field-values-attachments";actions={addOne:mb,addMany:qa,setOne:yb,setMany:fb,updateOne:Sb,updateMany:Ab,deleteOne:Tb,deleteMany:$a,initialize:pb};selectors={selectById:bb,selectByIds:Ob};getId(e){return e.uuid}getBlockers(e){return[e.field_values]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){const{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,submitted_at:e.submitted_at,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}}buildBulkPayload(e){const{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}}async bulkDelete(e){const{deleteMany:i,addMany:a}=this.actions,{selectByIds:n}=this.selectors,c=this.select(n(e));this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{field_values__procedure__project:e,latest:!0}},i)).flat();return this.dispatch(a(c)),c}}class iw extends g{name="Procedure Step Field Values Review";url="/procedure-step-field-values-reviews";actions={addOne:kb,addMany:Ha,setOne:Lb,setMany:Hb,updateOne:Gb,updateMany:Nb,deleteOne:Kb,deleteMany:Ga,initialize:Ub};selectors={selectById:Xb,selectByIds:Yb};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(c),blockers:[c.field_values],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Procedure step field values review with uuid ${e.uuid} not found in store`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Procedure step field values review with uuid ${e} not found in store`);this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{field_values__procedure__project:e}},i)).flat();return this.dispatch(a(c)),c}}class aw extends g{name="Procedure Step Field Values";url="/procedure-step-field-values";actions={addOne:gb,addMany:Rb,setOne:wb,setMany:Eb,updateOne:vb,updateMany:Vb,deleteOne:Bb,deleteMany:zb,initialize:Mb};selectors={selectById:Db,selectByIds:qb};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d}),p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[e.procedure,e.procedure_step,e.fields_revision],blocks:[r.uuid]});return this.dispatch(i(r)),p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}bulkAdd(e,i){const{addMany:a,updateMany:n,deleteMany:c}=this.actions,d=new Date().toISOString(),r=this.select(I=>I.userReducer.currentUser?.id??null),p=[],h=l.chunkArray(e,Math.min(i??e.length,D)),f=[];for(const I of h){const S=[],P=[],_=[];for(const F of I){const w=l.uuidObj({...F,values:F.values,created_by:r,submitted_at:d});p.push(w),S.push(M(w)),P.push(w.procedure_step,w.procedure,w.fields_revision),_.push(w.uuid)}f.push({payload:{payloads:S,submitted_at:d},blockers:P,blocks:_})}this.dispatch(a(p));const A=f.map(I=>{const{payload:S,blocks:P,blockers:_}=I;return this.enqueueRequest({description:y(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:S,blockers:_,blocks:P})});return Promise.all(A).then(I=>{this.dispatch(n(I.flat()))}).catch(()=>{this.dispatch(c(l.toUuidArray(p)))}),[p,Promise.all(A).then(I=>I.flat())]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected ProcedureStepFieldValues with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[c.uuid,c.procedure,c.procedure_step,c.fields_revision],blocks:[c.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected ProcedureStepFieldValues with uuid ${e} to exist`);const d=this.select(Pb(e)),r=this.select(Zb(e));this.dispatch(i(e)),this.dispatch($a(l.toUuidArray(d))),this.dispatch(Ga(l.toUuidArray(r)));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(p){throw this.dispatch(a(c)),this.dispatch(qa(d)),this.dispatch(Ha(r)),p}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{procedure__project:e}},i)).flat();return this.dispatch(a(c)),c}}class nw extends g{name="Procedure Step Reviewer";url="/procedure-step-reviewers";actions={addOne:eO,addMany:tO,setOne:sO,setMany:iO,updateOne:aO,updateMany:nO,deleteOne:cO,deleteMany:rO,initialize:xb};selectors={selectById:uO,selectByIds:lO};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(c),blockers:[c.procedure,c.procedure_step],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}bulkAdd(e){const{addMany:i,updateMany:a,deleteMany:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=e.map(h=>l.uuidObj({...h,created_by:c,submitted_at:d}));this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:{procedure_step_reviewers:r.map(h=>M(h)),submitted_at:d},blockers:r.flatMap(h=>[h.procedure,h.procedure_step]),blocks:r.map(h=>h.uuid)});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(l.toUuidArray(r)))}),[r,p]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected procedure step reviewer with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async bulkDelete(e){const{deleteMany:i,addMany:a}=this.actions,{selectByIds:n}=this.selectors,c=this.select(n(e));this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{procedure__project:e}},i)).flat();return this.dispatch(a(c)),c}}class cw extends g{name="Procedure Initiative";url="/procedure-initiatives";actions={addOne:ZA,addMany:JA,setOne:QA,setMany:xA,updateOne:eT,updateMany:tT,deleteOne:sT,deleteMany:iT,initialize:YA};selectors={selectById:cT,selectByIds:rT};add(e){const{store:i}=this.client,{addOne:a,updateOne:n,deleteOne:c}=this.actions,d=l.uuidObj({...e,created_by:i.getState().userReducer.currentUser?.id??null,submitted_at:new Date().toISOString()});this.dispatch(a(d));const r=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(d),blockers:[d.procedure_type,d.project],blocks:[d.uuid]});return r.then(p=>{this.dispatch(n(p))}).catch(()=>{this.dispatch(c(d.uuid))}),[d,r]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected ${this.name} with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[n.uuid],blocks:[n.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected ${this.name} with uuid ${e} to exist`);const d=this.select(PT(e));this.dispatch(i(e)),this.dispatch(Ot(l.toUuidArray(d)));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(a(c)),this.dispatch(bt(d)),r}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e}},i)).flat();return this.dispatch(a(c)),c}}class rw extends g{name="Procedure Step";url="/procedure-steps";actions={addOne:fO,addMany:SO,setOne:mO,setMany:yO,updateOne:AO,updateMany:TO,deleteOne:IO,deleteMany:bO,initialize:pO};selectors={selectById:PO,selectByIds:FO};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(c),blockers:[c.procedure_type],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`No procedure step with uuid ${e.uuid} found in the store`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${n.uuid}/`,payload:e,blockers:[n.uuid],blocks:[n.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{addOne:i,deleteOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`No procedure step with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(i(c)),d}}bulkUpdate(e,i){const{updateMany:a}=this.actions,{selectByIds:n}=this.selectors,c=l.toUuidArray(e);if(new Set(c).size!==e.length)throw new Error("payloads contains duplicate uuids.");const d=this.select(n(c));if(c.length!=d.length)throw new Error(`Attempting to bulk update ${c.length-d.length} ${this.name} that dont exist in the store`);const r=d.toSorted((S,P)=>l.uuidSortFn(S.uuid,P.uuid)),p=e.toSorted((S,P)=>l.uuidSortFn(S.uuid,P.uuid)),h=[];for(let S=0;S<c.length;S++)h.push({...r[S],...p[S]});this.dispatch(a(h));const f=l.chunkArray(e,Math.min(i??e.length,D)),A=[];let I=null;for(const S of f){const P=ut.v4(),_=l.toUuidArray(S),F=this.enqueueRequest({description:y(o.PATCH,this.name,!0),method:o.PATCH,url:`${this.url}/bulk/`,payload:{payloads:S},blockers:(I?[I]:[]).concat(_),blocks:[P].concat(_)});A.push(F),I=P}return Promise.all(A).then(S=>{this.dispatch(a(S.flat()))}).catch(()=>{this.dispatch(a(d))}),[h,A]}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{procedure_type__organization:e}},i);return this.dispatch(a(n)),n}}class dw extends v{name="Procedure Type Attachment";url="/procedure-type-attachments";actions={addOne:gO,addMany:RO,setOne:wO,setMany:EO,updateOne:vO,updateMany:VO,deleteOne:BO,deleteMany:zO,initialize:MO};selectors={selectById:DO,selectByIds:qO};getId(e){return e.uuid}getBlockers(e){return[e.procedure_type]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}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,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{procedure_type__organization:e}},i);return this.dispatch(a(n)),n}}class uw extends v{name="Procedure Type Fields Attachment";url="/procedure-type-fields-attachments";actions={addOne:kO,addMany:LO,setOne:HO,setMany:GO,updateOne:NO,updateMany:KO,deleteOne:WO,deleteMany:XO,initialize:UO};selectors={selectById:JO,selectByIds:QO};getId(e){return e.uuid}getBlockers(e){return[e.fields_revision]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){const{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,submitted_at:e.submitted_at,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}}buildBulkPayload(e){const{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{fields_revision__procedure_type__organization:e}},i);return this.dispatch(a(n)),n}}class lw extends g{name="Procedure Type Fields";url="/procedure-type-fields";actions={addOne:tP,addMany:sP,setOne:iP,setMany:aP,updateOne:nP,updateMany:cP,deleteOne:rP,deleteMany:dP,initialize:eP};selectors={selectById:oP,selectByIds:hP};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[r.procedure_type],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(h=>{throw this.dispatch(n(r.uuid)),h}),[r,p]}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{procedure_type__organization:e}},i);return this.dispatch(a(n)),n}}class ow extends v{name="Procedure Field Values Attachment";url="/procedure-field-values-attachments";actions={addOne:yP,addMany:tn,setOne:fP,setMany:SP,updateOne:AP,updateMany:TP,deleteOne:IP,deleteMany:sn,initialize:mP};selectors={selectById:PP,selectByIds:FP};getId(e){return e.uuid}getBlockers(e){return[e.field_values]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){const{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,submitted_at:e.submitted_at,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}}buildBulkPayload(e){const{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}}async bulkDelete(e){const{deleteMany:i,addMany:a}=this.actions,{selectByIds:n}=this.selectors,c=this.select(n(e));this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{field_values__procedure__project:e,latest:!0}},i)).flat();return this.dispatch(a(c)),c}}class hw extends g{name="Procedure Field Values";url="/procedure-field-values";actions={addOne:RP,addMany:wP,setOne:EP,setMany:vP,updateOne:VP,updateMany:BP,deleteOne:zP,deleteMany:jP,initialize:gP};selectors={selectById:qP,selectByIds:$P};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d}),p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[e.fields_revision,e.procedure],blocks:[r.uuid]});return this.dispatch(i(r)),p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}bulkAdd(e,i){const{addMany:a,updateMany:n,deleteMany:c}=this.actions,d=new Date().toISOString(),r=this.select(I=>I.userReducer.currentUser?.id??null),p=[],h=l.chunkArray(e,Math.min(i??e.length,D)),f=[];for(const I of h){const S=[],P=[],_=[];for(const F of I){const w=l.uuidObj({...F,values:F.values,created_by:r,submitted_at:d});p.push(w),S.push(M(w)),P.push(w.procedure,w.fields_revision),_.push(w.uuid)}f.push({payload:{payloads:S,submitted_at:d},blockers:P,blocks:_})}this.dispatch(a(p));const A=f.map(I=>{const{payload:S,blocks:P,blockers:_}=I;return this.enqueueRequest({description:y(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:S,blockers:_,blocks:P})});return Promise.all(A).then(I=>{this.dispatch(n(I.flat()))}).catch(()=>{this.dispatch(c(l.toUuidArray(p)))}),[p,Promise.all(A).then(I=>I.flat())]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected ProcedureFieldValues with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[c.fields_revision,c.procedure],blocks:[c.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const d=this.select(_P(e));this.dispatch(i(e)),this.dispatch(sn(l.toUuidArray(d)));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(a(c)),this.dispatch(tn(d)),r}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{procedure__project:e,latest:!0}},i)).flat();return this.dispatch(a(c)),c}}class pw extends g{name="Procedure Type";url="/procedure-types";actions={addOne:LP,addMany:HP,setOne:GP,setMany:NP,updateOne:KP,updateMany:WP,deleteOne:XP,deleteMany:YP,initialize:kP};selectors={selectById:QP,selectByIds:xP};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(c),blockers:[],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected procedure type with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[n.uuid],blocks:[n.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected procedure type with uuid ${e} to exist`);const d=this.select(IT(e));this.dispatch(i(e)),this.dispatch(Ot(l.toUuidArray(d)));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(a(c)),this.dispatch(bt(d)),r}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{organization:e}},i);return this.dispatch(a(n)),n}}class mw extends g{name="Team Membership";url="/team-memberships";actions={addOne:AF,addMany:TF,setOne:IF,setMany:bF,updateOne:OF,updateMany:PF,deleteOne:FF,deleteMany:_F,initialize:SF};selectors={selectById:RF,selectByIds:wF};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null)});this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(c),blockers:[e.team],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}bulkAdd(e){const{addMany:i,updateMany:a,deleteMany:n}=this.actions,c=this.select(p=>p.userReducer.currentUser?.id??null),d=e.map(p=>l.uuidObj({...p,created_by:c}));this.dispatch(i(d));const r=this.enqueueRequest({description:y(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:{team_memberships:d.map(p=>M(p))},blockers:d.map(p=>p.team),blocks:d.map(p=>p.uuid)});return r.then(p=>{this.dispatch(a(p))}).catch(()=>{this.dispatch(n(d.map(p=>p.uuid)))}),[d,r]}async delete(e){const{addOne:i,deleteOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected team membership with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(d){throw this.dispatch(i(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{team__organization:e}},i);return this.dispatch(a(n)),n}}class yw extends g{name="Team";url="/teams";actions={addOne:VF,addMany:BF,setOne:zF,setMany:jF,updateOne:CF,updateMany:DF,deleteOne:qF,deleteMany:$F,initialize:vF};selectors={selectById:kF,selectByIds:LF};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,submitted_at:new Date().toISOString(),created_by:this.select(r=>r.userReducer.currentUser?.id??null)});this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(c),blockers:[],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected team with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:M(e),blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{addOne:i,deleteOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected team with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(d){throw this.dispatch(i(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{organization:e}},i);return this.dispatch(a(n)),n}}class fw extends dt{name="User";url="/user";actions={addOne:ua,addMany:Gf,setOne:Hf,setMany:Lf,updateOne:Kf,updateMany:Nf,deleteOne:la,deleteMany:Wf,initialize:kf};selectors={selectById:xt,selectByIds:Zf};async list(e,i){const{organizationUuid:a,...n}=e,c=a?`/organizations/${a}${this.url}s/`:`/${this.url}`;return this.performRequest({method:o.GET,url:c,...n},i)}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({organizationUuid:e},i);return this.dispatch(a(n)),n}}async function An(t,e,i,a,n){const c=a instanceof yt;c&&e.checkAuth!==!1&&await a.auth.prepareAuth();const d={queryParams:"",isAuthNeeded:!0},{s3url:r,payload:p,headers:h,method:f,queryParams:A,attachmentHash:I,isExternalUrl:S,isAuthNeeded:P,isResponseBlob:_}={...d,...e};let F=e.url;const w=I?await i.files.getFileFromCache(I):void 0,V=w?await e_(w):void 0;if(I){if(!V)throw new Error(`Cannot upload file ${I} because it's not cached.`);if(V.size===0)throw new Error(`Cannot upload file ${I} because its has a size of 0.`)}!S&&!F.startsWith("http")&&(!F.startsWith("/")&&!F.startsWith("blob:")&&(F="/"+F),F=t+F);const R=B=>{if(I){if(!r)throw new Error(`No S3 URL for file ${I}`);if("warning"in r)throw new Error(`S3 URL warning for file ${I}`);if(!V)throw new Error(`No file for file ${I}`);const q=r.fields["x-amz-checksum-sha1"];if(!q)throw new Error(`No checksum for file ${I}`);return B.set("x-amz-checksum-sha1",q).field({...p,...r.fields}).attach("file",V)}return B.send(p)},zt={[o.GET]:()=>_?St.get(F.toString()).responseType("blob"):St.get(F.toString()),[o.POST]:()=>{const B=St.post(F.toString());return R(B)},[o.PATCH]:()=>{const B=St.patch(F.toString());return R(B)},[o.PUT]:()=>{const B=St.put(F.toString());return R(B)},[o.DELETE]:()=>{const B=St.delete(F.toString());return R(B)}}[f];let j=zt();const ds=()=>{console.debug("aborting request:",e.url),j.abort()};n?.addEventListener("abort",ds),P&&c&&(j=a.auth.applyAuth(j)),h&&(j=j.set(h));try{return await j.query(A)}catch(B){const q=xF(B),jt=q?.status;throw c&&q&&a.auth.isAuthFailure(q)?(await a.auth.handleUnauthorized(j,q),new z({response:q,innerError:B,discard:!1})):new z({response:q,innerError:B,discard:yn.includes(jt)})}finally{n?.removeEventListener("abort",ds)}}class Sw{store;constructor(e){this.store=e}_performRequest(e,i,a,n){const c=new l.DeferredPromise,d={...i,uuid:i.uuid??ut.v4()};return An(e,d,this,a,n).then(r=>{c.resolve(r.body)}).catch(r=>{r instanceof Error?c.reject(r):c.reject(new Error((r??l.ERROR_MSG_UNEXPECTED).toString()))}),c}async performRequest(e,i,a,n){return this._performRequest(e,i,a,n).then(c=>{if(c instanceof z)throw c;return c})}async enqueueRequest(e,i,a){return this._enqueueRequest(e,i,a).then(n=>{if(n instanceof z)throw n;return n})}_enqueueRequest(e,i,a){const n=new l.DeferredPromise,c={...e,BASE_URL:i,serviceName:a},d=this.store.dispatch(RS(c)),r=h=>{if(h)n.resolve(h.body);else{const f=new z({message:"Could not get a response from the server.",response:h,discard:!0});n.reject(f)}},p=h=>{h instanceof z?h.options.discard=!0:(console.error("Received an unexpected error while processing a request:",h,`
13
+ external URLs and therefore not prepended with VITE_API_URL.`;throw new Error(f)}return await this.cacheFile(p),p}processPresignedUrl(e,i){if("warning"in i){if(i.warning==="already_uploaded")return Promise.resolve(void 0);throw console.error(i.warning),new Error(i.warning)}return this.enqueueRequest({url:i.url,description:"Upload file to S3",method:o.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:e,blockers:[`s3-${i.fields.key}`,"s3-presigned-upload"],blocks:[e,"s3-presigned-upload"],s3url:i})}processPresignedUrls(e){const i={};for(const[a,n]of Object.entries(e))i[a]=this.processPresignedUrl(a,n);return i}async getFilePayload(e){const a={sha1:await rs(e),file_type:e.type,extension:t_(e),size:e.size};return await this.client.files.cacheFile(e),a}async cachePresignedUrl(e,i){if(Sn.has(e))return;const a=await this.getDB();!!await a.get("presignedUrls",e)?console.warn(`Attempting to add a presigned url already cached, ${i}`):await a.put("presignedUrls",i,e),Sn.add(e)}async uncachePresignedUrl(e){await(await this.getDB()).delete("presignedUrls",e),Sn.delete(e)}async getPresignedUrlFromCache(e){const i=await(await this.getDB()).get("presignedUrls",e);if(!i)return;if(d_(i)){await this.uncachePresignedUrl(e);return}return i}}class uR extends g{name="Form Identifier";url="/form-identifiers";actions={addOne:qu,addMany:$u,setOne:Uu,setMany:ku,updateOne:Lu,updateMany:Hu,deleteOne:Gu,deleteMany:Nu,initialize:Du};selectors={selectById:Wu,selectByIds:Xu};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[r.form],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected form identifier with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected form identifier with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{form__organization:e}},i);return this.dispatch(a(n)),n}}class lR extends g{name="Form Identifier Value";url="/form-identifier-values";actions={addOne:Qu,addMany:xu,setOne:el,setMany:tl,updateOne:sl,updateMany:il,deleteOne:al,deleteMany:nl,initialize:Ju};selectors={selectById:rl,selectByIds:dl};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[e.form_submission,e.form_identifier],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected form identifier value with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await Promise.all([this.listPaginated({queryParams:{latest:!0,form_submission__organization:e}},i),this.listPaginated({queryParams:{latest:!0,form_submission__project__organization:e}},i)])).flatMap(d=>d.flat());return this.dispatch(a(c)),c}}class oR extends v{name="Form Revision Attachment";url="/form-revision-attachments";actions={addOne:hl,addMany:pl,setOne:ml,setMany:yl,updateOne:fl,updateMany:Sl,deleteOne:Al,deleteMany:Tl,initialize:ol};selectors={selectById:bl,selectByIds:Ol};getId(e){return e.uuid}getBlockers(e){return[e.form_revision]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){const{uuid:i,field_identifier:a,form_revision:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,submitted_at:e.submitted_at,field_identifier:a,form_revision:n,file_sha1:c,file_name:d,file_extension:r}}buildBulkPayload(e){const{uuid:i,field_identifier:a,form_revision:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,field_identifier:a,form_revision:n,file_sha1:c,file_name:d,file_extension:r}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{form_revision__form__organization:e}},i);return this.dispatch(a(n)),n}}class hR extends g{name="Form Revision";url="/form-revisions";actions={addOne:Ml,addMany:Js,setOne:gl,setMany:Rl,updateOne:wl,updateMany:El,deleteOne:vl,deleteMany:Qs,initialize:_l};selectors={selectById:Bl,selectByIds:zl};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[e.form],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{form__organization:e}},i);return this.dispatch(a(n)),n}}class pR extends g{name="Form";url="/forms";actions={addOne:Ql,addMany:xl,setOne:eo,setMany:to,updateOne:so,updateMany:io,deleteOne:ao,deleteMany:no,initialize:Jl};selectors={selectById:uo,selectByIds:lo};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=new Date().toISOString(),d=this.select(h=>h.userReducer.currentUser?.id??null),r=l.uuidObj({...e,submitted_at:c,created_by:d});this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected form with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[n.uuid],blocks:[n.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error("Expected form to exist");const d=this.select(Th(e)),r=this.select(jl(e)),p=this.select(Xl(e));this.dispatch(i(e)),this.dispatch(ot(l.toUuidArray(d))),this.dispatch(Qs(l.toUuidArray(r))),this.dispatch(ti(l.toUuidArray(p)));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(a(c)),this.dispatch(Js(r)),this.dispatch(lt(d)),this.dispatch(ei(p)),h}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{organization:e}},i);return this.dispatch(a(n)),n}}class mR extends g{name="Form Subscriber";url="/form-subscribers";actions={addOne:$l,addMany:ei,setOne:Ul,setMany:kl,updateOne:Ll,updateMany:Hl,deleteOne:Gl,deleteMany:ti,initialize:ql};selectors={selectById:Kl,selectByIds:Wl};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=new Date().toISOString(),d=this.select(h=>h.userReducer.currentUser?.id??null),r=l.uuidObj({...e,created_by:d,submitted_at:c});this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[r.form],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected form subscriber with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{form__organization:e}},i);return this.dispatch(a(n)),n}}class yR extends v{name="Form Submission Field Values Attachment";url="/form-submission-field-values-attachments";actions={addOne:po,addMany:ni,setOne:mo,setMany:yo,updateOne:fo,updateMany:So,deleteOne:Ao,deleteMany:ci,initialize:ho};selectors={selectById:To,selectByIds:ui};getId(e){return e.uuid}getBlockers(e){return[e.field_values]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){const{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,submitted_at:e.submitted_at,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}}buildBulkPayload(e){const{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}}async bulkDelete(e){const{deleteMany:i,addMany:a}=this.actions,n=this.select(ui(e));this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(a(n)),c}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await Promise.all([this.listPaginated({queryParams:{latest:!0,field_values__form_submission__organization:e}},i),this.listPaginated({queryParams:{latest:!0,field_values__form_submission__project__organization:e}},i)])).flatMap(d=>d.flat());return this.dispatch(a(c)),c}}class fR extends g{name="Form Submission Field Values";url="/form-submission-field-values";actions={addOne:Fo,addMany:oi,setOne:_o,setMany:Mo,updateOne:go,updateMany:Ro,deleteOne:wo,deleteMany:hi,initialize:Po};selectors={selectById:vo,selectByIds:Vo};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[r.form_submission],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await Promise.all([this.listPaginated({queryParams:{latest:!0,form_submission__organization:e}},i),this.listPaginated({queryParams:{latest:!0,form_submission__project__organization:e}},i)])).flatMap(d=>d.flat());return this.dispatch(a(c)),c}}class SR extends v{name="Form Submission Comment Attachment";url="/form-submission-comment-attachments";actions={addOne:Do,addMany:qo,setOne:$o,setMany:Uo,updateOne:ko,updateMany:Lo,deleteOne:Ho,deleteMany:Go,initialize:Co};selectors={selectById:Ko,selectByIds:Wo};getId(e){return e.uuid}getBlockers(e){return[e.form_submission_comment]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}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,form_submission_comment:e.form_submission_comment}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,form_submission_comment:e.form_submission_comment}}async bulkDelete(e){const{deleteMany:i,addMany:a}=this.actions,{selectByIds:n}=this.selectors,c=this.select(n(e));this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await Promise.all([this.listPaginated({queryParams:{form_submission_comment__form_submission__organization:e}},i),this.listPaginated({queryParams:{form_submission_comment__form_submission__project__organization:e}},i)])).flatMap(d=>d.flat());return this.dispatch(a(c)),c}}class AR extends g{name="Form Submission Comment";url="/form-submission-comments";actions={addOne:Jo,addMany:Si,setOne:Qo,setMany:xo,updateOne:eh,updateMany:th,deleteOne:sh,deleteMany:Ai,initialize:Zo};selectors={selectById:ah,selectByIds:nh};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(c),blockers:[c.form_submission],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Form submission comment with uuid ${e.uuid} not found in store`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Form submission comment with uuid ${e} not found in store`);this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await Promise.all([this.listPaginated({queryParams:{form_submission__organization:e}},i),this.listPaginated({queryParams:{form_submission__project__organization:e}},i)])).flatMap(d=>d.flat());return this.dispatch(a(c)),c}}class TR extends g{name="Form Submission";url="/form-submissions";actions={addOne:hh,addMany:lt,setOne:lh,setMany:oh,updateOne:ph,updateMany:mh,deleteOne:yh,deleteMany:ot,initialize:uh};selectors={selectById:Sh,selectByIds:Ah};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d}),p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[e.form_revision],blocks:[r.uuid]});return this.dispatch(i(r)),p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected submission with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${c.uuid}/`,payload:e,blockers:[c.uuid],blocks:[c.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const d=this.select(Bo(e)),r=d.flatMap(({uuid:h})=>this.select(Io(h))),p=this.select(ch(e));this.dispatch(i(e)),this.dispatch(hi(l.toUuidArray(d))),this.dispatch(ci(l.toUuidArray(r))),this.dispatch(Ai(l.toUuidArray(p)));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(a(c)),this.dispatch(oi(d)),this.dispatch(ni(r)),this.dispatch(Si(p)),h}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await Promise.all([this.listPaginated({queryParams:{organization:e}},i),this.listPaginated({queryParams:{project__organization:e}},i)])).flatMap(d=>d.flat());return this.dispatch(a(c)),c}}class IR extends v{name="Geo Image";url="/geo-images";actions={addOne:wh,addMany:Eh,setOne:gh,setMany:Rh,updateOne:vh,updateMany:Vh,deleteOne:Bh,deleteMany:zh,initialize:Mh};selectors={selectById:Ch,selectByIds:Dh};getId(e){return e.uuid}getBlockers(e){return[e.project]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}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,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,direction:e.direction,original_date:e.original_date,project:e.project}}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Geo image with uuid ${e.uuid} does not exist in the store`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{project:e}},i);return this.dispatch(a(n)),n}}class bR extends g{name="Issue Association";url="/issue-associations";actions={addOne:Nh,addMany:At,setOne:Lh,setMany:kh,updateOne:Hh,updateMany:Gh,deleteOne:Kh,deleteMany:Tt,initialize:Uh};selectors={selectById:Xh,selectByIds:Yh};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=new Date().toISOString(),d=this.select(h=>h.userReducer.currentUser?.id??null),r=l.uuidObj({...e,submitted_at:c,created_by:d});this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[e.issue,e.asset],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}bulkAdd(e){const{addMany:i,deleteMany:a,updateMany:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=e.map(h=>l.uuidObj({...h,submitted_at:d,created_by:c}));this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:{payloads:r.map(h=>M(h)),submitted_at:d},blockers:r.flatMap(h=>[h.issue,h.asset]),blocks:l.toUuidArray(r)});return p.then(h=>{this.dispatch(n(h))}).catch(()=>{this.dispatch(a(l.toUuidArray(r)))}),[r,p]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Issue association with uuid ${e} not found in store.`);this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e}},i)).flat();return this.dispatch(a(c)),c}}class OR extends v{name="Issue Attachment";url="/issue-attachments";actions={addOne:ip,addMany:Fi,setOne:ap,setMany:np,updateOne:cp,updateMany:rp,deleteOne:dp,deleteMany:_i,initialize:sp};selectors={selectById:op,selectByIds:hp};getId(e){return e.uuid}getBlockers(e){return[e.issue]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}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,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e}},i)).flat();return this.dispatch(a(c)),c}}class PR extends v{name="Issue Comment Attachment";url="/issue-comment-attachments";actions={addOne:fp,addMany:Sp,setOne:Ap,setMany:Tp,updateOne:Ip,updateMany:bp,deleteOne:Op,deleteMany:Pp,initialize:yp};selectors={selectById:_p,selectByIds:Mp};getId(e){return e.uuid}getBlockers(e){return[e.issue_comment]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}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 bulkDelete(e){const{deleteMany:i,addMany:a}=this.actions,{selectByIds:n}=this.selectors,c=this.select(n(e));this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e}},i)).flat();return this.dispatch(a(c)),c}}class FR extends g{name="Issue Comment";url="/issue-comments";actions={addOne:Ep,addMany:vp,setOne:Vp,setMany:Bp,updateOne:zp,updateMany:jp,deleteOne:Cp,deleteMany:Dp,initialize:wp};selectors={selectById:qp,selectByIds:$p};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser.id),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(c),blockers:[e.issue],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Comment with uuid ${e.uuid} not found in store`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Comment with uuid ${e} not found in store`);this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e}},i)).flat();return this.dispatch(a(c)),c}}class _R extends g{name="Issue";url="/issues";actions={addOne:Hp,addMany:Vi,setOne:Gp,setMany:Np,updateOne:Kp,updateMany:Wp,deleteOne:Xp,deleteMany:Bi,initialize:Lp};selectors={selectById:Zp,selectByIds:Jp};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=new Date().toISOString(),d=this.select(h=>h.userReducer.currentUser?.id??null),r=l.uuidObj({...e,submitted_at:c,created_by:d});this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[r.project,r.issue_type,r.status,r.priority],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(h=>{throw this.dispatch(n(r.uuid)),h}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Attempting to update an issue with uuid ${e.uuid} that doesn't exist in the store`);const c={...n,...e};this.dispatch(i(c));const d={};for(const h of[l.IssueUpdateChange.TITLE,l.IssueUpdateChange.DESCRIPTION,l.IssueUpdateChange.STATUS,l.IssueUpdateChange.PRIORITY,l.IssueUpdateChange.ASSIGNED_TO,l.IssueUpdateChange.DUE_DATE])if(h in e&&e[h]!==n[h])switch(h){case l.IssueUpdateChange.PRIORITY:{const f=e[h],A=this.select(Yi(f));if(!A)throw new Error(`Trying to update issue type priority with ${f} which does not exist in store`);d[h]={name:A.name,color:A.color,uuid:A.uuid};break}case l.IssueUpdateChange.DUE_DATE:d[h]=e.due_date;break;case l.IssueUpdateChange.DESCRIPTION:d[h]=e.description??"";break;case l.IssueUpdateChange.TITLE:d[h]=e.title??"";break;case l.IssueUpdateChange.STATUS:{const f=e[h],A=this.select(ea(f));if(!A)throw new Error(`Trying to update issue type status with ${f} which does not exist in store`);d[h]={name:A.name,color:A.color,uuid:A.uuid};break}case l.IssueUpdateChange.ASSIGNED_TO:{const f=e[h];if(f===null)d[h]=null;else{const A=this.select(xt(f));if(!A)throw new Error(`Trying to update assigned to with ${f} which does not exist in store.`);d[h]={full_name:A.username,id:A.id}}break}}const r=l.uuidObj({created_by:this.select(h=>h.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString(),issue:n.uuid,changes:d});this.dispatch(sa(r));const p=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return p.then(h=>{this.dispatch(i(h))}).catch(()=>{this.dispatch(i(n)),this.dispatch(aa(r.uuid))}),[c,p]}bulkUpdate(e,i){const{updateMany:a}=this.actions,{selectByIds:n}=this.selectors,c=l.toUuidArray(e);if(new Set(c).size!==e.length)throw new Error("payloads contains duplicate uuids.");const d=this.select(n(c));if(c.length!=d.length)throw new Error(`Attempting to bulk update ${c.length-d.length} issues that dont exist in the store`);const r=d.toSorted((S,P)=>l.uuidSortFn(S.uuid,P.uuid)),p=e.toSorted((S,P)=>l.uuidSortFn(S.uuid,P.uuid)),h=[];for(let S=0;S<c.length;S++)h.push({...r[S],...p[S]});this.dispatch(a(h));const f=l.chunkArray(e,Math.min(i??e.length,D)),A=[];let I=null;for(const S of f){const P=ut.v4(),_=l.toUuidArray(S),F=S.map(({status:R})=>R).filter(Boolean),w=S.map(({priority:R})=>R).filter(Boolean),V=this.enqueueRequest({description:y(o.PATCH,this.name,!0),method:o.PATCH,url:`${this.url}/bulk/`,payload:{payloads:S},blockers:(I?[I]:[]).concat(_).concat(F).concat(w),blocks:[P].concat(_)});A.push(V),I=P}return Promise.all(A).then(S=>{this.dispatch(a(S.flat()))}).catch(()=>{this.dispatch(a(d))}),[h,A]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`No issue with uuid ${e} found in the store`);const d=this.select(Jh(e)),r=this.select(lp(e)),p=this.select(qf(e)),h=this.select(Ih(e));this.dispatch(i(e)),this.dispatch(_i(l.toUuidArray(r))),this.dispatch(na(l.toUuidArray(p))),this.dispatch(Tt(l.toUuidArray(d))),this.dispatch(ot(l.toUuidArray(h)));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(f){throw this.dispatch(a(c)),this.dispatch(Fi(r)),this.dispatch(ia(p)),this.dispatch(At(d)),this.dispatch(lt(h)),f}}async bulkDelete(e){const{addMany:i,deleteMany:a}=this.actions,{selectByIds:n}=this.selectors,c=this.select(n(e)),d=this.select(Zh(e)),r=this.select(bh(e));this.dispatch(a(e)),this.dispatch(Tt(l.toUuidArray(d))),this.dispatch(ot(l.toUuidArray(r)));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(p){throw this.dispatch(i(c)),this.dispatch(At(d)),this.dispatch(lt(r)),p}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e}},i)).flat();return this.dispatch(a(c)),c}}class MR extends v{name="Issue Type Attachment";url="/issue-type-attachments";actions={addOne:sm,addMany:im,setOne:am,setMany:nm,updateOne:cm,updateMany:rm,deleteOne:dm,deleteMany:um,initialize:tm};selectors={selectById:om,selectByIds:hm};getId(e){return e.uuid}getBlockers(e){return[e.issue_type]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}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,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{issue_type__organization:e}},i);return this.dispatch(a(n)),n}}class gR extends v{name="Issue Type Fields Attachment";url="/issue-type-fields-attachments";actions={addOne:fm,addMany:Sm,setOne:Am,setMany:Tm,updateOne:Im,updateMany:bm,deleteOne:Om,deleteMany:Pm,initialize:ym};selectors={selectById:_m,selectByIds:Mm};getId(e){return e.uuid}getBlockers(e){return[e.fields_revision]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){const{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,submitted_at:e.submitted_at,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}}buildBulkPayload(e){const{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{fields_revision__issue_type__organization:e}},i);return this.dispatch(a(n)),n}}class RR extends g{name="Issue Type Fields";url="/issue-type-fields";actions={addOne:Gm,addMany:Nm,setOne:Km,setMany:Wm,updateOne:Xm,updateMany:Ym,deleteOne:Zm,deleteMany:Jm,initialize:Hm};selectors={selectById:xm,selectByIds:ey};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[r.issue_type],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(h=>{throw this.dispatch(n(r.uuid)),h}),[r,p]}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{issue_type__organization:e}},i);return this.dispatch(a(n)),n}}class wR extends v{name="Issue Type Field Values Attachment";url="/issue-type-field-values-attachments";actions={addOne:ay,addMany:ki,setOne:ny,setMany:cy,updateOne:ry,updateMany:dy,deleteOne:uy,deleteMany:Li,initialize:iy};selectors={selectById:oy,selectByIds:hy};getId(e){return e.uuid}getBlockers(e){return[e.field_values]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){const{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,submitted_at:e.submitted_at,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}}buildBulkPayload(e){const{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}}async bulkDelete(e){const{deleteMany:i,addMany:a}=this.actions,{selectByIds:n}=this.selectors,c=this.select(n(e));this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e,latest:!0}},i)).flat();return this.dispatch(a(c)),c}}class ER extends g{name="Issue Type Field Values";url="/issue-type-field-values";actions={addOne:Em,addMany:vm,setOne:Vm,setMany:Bm,updateOne:zm,updateMany:jm,deleteOne:Cm,deleteMany:Dm,initialize:wm};selectors={selectById:$m,selectByIds:Um};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d}),p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[e.issue,e.fields_revision],blocks:[r.uuid]});return this.dispatch(i(r)),p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected IssueTypeFieldValues with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[c.uuid,c.fields_revision,c.issue],blocks:[c.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const d=this.select(py(e));this.dispatch(i(e)),this.dispatch(Li(l.toUuidArray(d)));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(a(c)),this.dispatch(ki(d)),r}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e,latest:!0}},i)).flat();return this.dispatch(a(c)),c}}class vR extends g{name="Issue Type Identifier";url="/issue-type-identifiers";actions={addOne:Sy,addMany:Ay,setOne:Ty,setMany:Iy,updateOne:by,updateMany:Oy,deleteOne:Py,deleteMany:Fy,initialize:fy};selectors={selectById:My,selectByIds:gy};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[r.issue_type],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected issue type identifier with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected issue type identifier with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{issue_type__organization:e}},i);return this.dispatch(a(n)),n}}class VR extends g{name="Issue Type Identifier Value";url="/issue-type-identifier-values";actions={addOne:vy,addMany:Vy,setOne:By,setMany:zy,updateOne:jy,updateMany:Cy,deleteOne:Dy,deleteMany:qy,initialize:Ey};selectors={selectById:Uy,selectByIds:ky};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[e.issue,e.issue_type_identifier],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected issue type identifier value with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e,latest:!0}},i)).flat();return this.dispatch(a(c)),c}}class BR extends g{name="Issue Type Priority";url="/issue-type-priorities";actions={addOne:Ny,addMany:Ky,setOne:Wy,setMany:Xy,updateOne:Yy,updateMany:Zy,deleteOne:Jy,deleteMany:Qy,initialize:Gy};selectors={selectById:Yi,selectByIds:ef};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[e.issue_type],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected an existing issue type priority with uuid ${e.uuid}`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`No issue type priority with uuid ${e} found in the store`);this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{issue_type__organization:e}},i);return this.dispatch(a(n)),n}}class zR extends g{name="Issue Type";url="/issue-types";actions={addOne:nf,addMany:cf,setOne:rf,setMany:df,updateOne:uf,updateMany:lf,deleteOne:of,deleteMany:hf,initialize:af};selectors={selectById:mf,selectByIds:yf};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,submitted_at:d,created_by:c});this.dispatch(i(r));const p=this.enqueueRequest({method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`IssueType with uuid ${e.uuid} does not exist in the store.`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{addOne:i,deleteOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`IssueType with uuid ${e} does not exist in the store.`);const d=this.select(Qp(e));this.dispatch(a(e)),this.dispatch(Bi(l.toUuidArray(d)));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(i(c)),this.dispatch(Vi(d)),r}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{organization:e}},i);return this.dispatch(a(n)),n}}class jR extends g{name="Issue Type Status";url="/issue-type-statuses";actions={addOne:Tf,addMany:If,setOne:bf,setMany:Of,updateOne:Pf,updateMany:Ff,deleteOne:_f,deleteMany:Mf,initialize:Af};selectors={selectById:ea,selectByIds:Rf};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[e.issue_type],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected an existing issue type status with uuid ${e.uuid}`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`No issue type status with uuid ${e} found in the store`);this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{issue_type__organization:e}},i);return this.dispatch(a(n)),n}}class CR extends g{name="Issue Update";url="/issue-updates";actions={addOne:sa,addMany:ia,setOne:Vf,setMany:Bf,updateOne:zf,updateMany:jf,deleteOne:aa,deleteMany:na,initialize:vf};selectors={selectById:Cf,selectByIds:Df};async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e}},i)).flat();return this.dispatch(a(c)),c}}const DR=1800;function qR(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 $R extends u_{_getRenewedTokens=async e=>{const i=this.performRequest({method:o.POST,url:this.refreshTokensUrl,payload:{refresh:e},isAuthNeeded:!1,checkAuth:!1});let a;try{a=await i}catch(n){console.error("Could not renew tokens; clearing auth",n),this.clearAuth();return}if(!a.access)throw new Error("Missing access token");return{accessToken:a.access,refreshToken:a.refresh??this.getRefreshToken()}};clearAuth(){console.debug(this.constructor.name,"clearing auth;"),this.dispatch(Kd(!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 i=await this._getRenewedTokens(e);if(!i)return;console.debug("Got renewed tokens"),this.setTokens(i)}catch(i){throw console.error("Could not renew tokens; clearing auth",i),this.clearAuth(),i}}tokenIsExpiringSoon(){const e=this.getAccessToken();if(!e)return!1;const i=Date.now()/1e3;let a;try{a=P_(e).exp??i}catch{a=i}return a-i<DR}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 z&&this.clearAuth(),e instanceof Error?Promise.reject(e):Promise.reject(new Error((e??l.ERROR_MSG_UNEXPECTED).toString()))}}}async handleUnauthorized(e,i){if(e.url.endsWith("/token/refresh/"))throw this.select(a=>a.authReducer.isLoggedIn)&&console.warn("No signed-in user to sign out."),this.clearAuth(),new z({message:"You have been signed out due to inactivity.",response:i,discard:!0});if(this.select(a=>a.authReducer.isLoggedIn))await this.renewTokens();else throw console.debug("Forbidden; user is not logged in."),new z({message:"Incorrect username or password.",response:i,discard:!0})}async initAuth(e){const i=ut.v4();return console.debug(this.constructor.name,"Initiating auth"),this.performRequest({uuid:i,method:o.POST,url:this.initTokensUrl,payload:e,isAuthNeeded:!1,checkAuth:!1}).then(a=>{this.setTokens(qR(a))})}}class UR extends dt{name="Organization Access";url="/organization-accesses";actions={addOne:xf,addMany:eS,setOne:tS,setMany:sS,updateOne:iS,updateMany:aS,deleteOne:nS,deleteMany:cS,initialize:Qf};selectors={selectById:dS,selectByIds:uS};update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid)),c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(r=>{throw this.dispatch(i(n)),r}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e)),d=this.select(xt(c.user));this.dispatch(i(c.uuid)),this.dispatch(la(c.user));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${c.uuid}/`,blockers:[c.uuid],blocks:[]})}catch(r){throw this.dispatch(a(c)),this.dispatch(ua(d)),r}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{organization:e}},i);return this.dispatch(a(n)),n}}class kR extends dt{name="Organization";url="/organizations";actions={addOne:fS,addMany:yS,setOne:mS,setMany:pS,updateOne:AS,updateMany:SS,deleteOne:TS,deleteMany:IS,initialize:hS};selectors={selectById:PS,selectByIds:FS};async add(e){const{addOne:i}=this.actions,a=await this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:e,blockers:[],blocks:[]});return this.dispatch(i(a)),a}async update(e){const{updateOne:i}=this.actions,a=await this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return this.dispatch(i(a)),a}async invite(e,i){return this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/${e}/invite/${i}/`,blockers:[],blocks:[]})}async refreshStore(e){const{initialize:i}=this.actions,a=await this.list({},e);return this.dispatch(i(a)),a}}class LR extends g{name="Project Access";url="/project-accesses";actions={addOne:zS,addMany:jS,setOne:CS,setMany:DS,updateOne:qS,updateMany:$S,deleteOne:US,deleteMany:kS,initialize:BS};selectors={selectById:HS,selectByIds:GS};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null)});this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(c),blockers:[c.organization_access,c.project],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(r=>{throw this.dispatch(n(c.uuid)),r}),[c,d]}bulkAdd(e){const{addMany:i,deleteMany:a,updateMany:n}=this.actions,c=this.select(p=>p.userReducer.currentUser?.id??null),d=e.map(p=>l.uuidObj({...p,created_by:c}));this.dispatch(i(d));const r=this.enqueueRequest({description:y(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:{project_accesses:d.map(p=>M(p))},blockers:d.flatMap(p=>[p.project,p.organization_access]),blocks:d.map(p=>p.uuid)});return r.then(p=>{this.dispatch(n(p))}).catch(p=>{throw this.dispatch(a(d.map(h=>h.uuid))),p}),[d,r]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid)),c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[]});return d.then(r=>{this.dispatch(i(r))}).catch(r=>{throw this.dispatch(i(n)),r}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{project__organization:e}},i);return this.dispatch(a(n)),n}}class HR extends v{name="Project Attachment";url="/project-attachments";actions={addOne:WS,addMany:XS,setOne:YS,setMany:ZS,updateOne:JS,updateMany:QS,deleteOne:xS,deleteMany:eA,initialize:KS};selectors={selectById:sA,selectByIds:iA};getId(e){return e.uuid}getBlockers(e){return[e.project]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}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,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{project__organization:e}},i);return this.dispatch(a(n)),n}}class GR extends g{name="Project Comment";url="/project-comments";actions={addOne:rA,addMany:dA,setOne:uA,setMany:lA,updateOne:oA,updateMany:hA,deleteOne:pA,deleteMany:mA,initialize:cA};selectors={selectById:fA,selectByIds:SA};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(c),blockers:[c.project],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Project comment with uuid ${e.uuid} not found in store`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Project comment with uuid ${e} not found in store`);this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e}},i)).flat();return this.dispatch(a(c)),c}}class NR extends v{name="Project File";url="/project-files";actions={addOne:PA,addMany:FA,setOne:bA,setMany:OA,updateOne:_A,updateMany:MA,deleteOne:gA,deleteMany:RA,initialize:IA};selectors={selectById:vA,selectByIds:VA};getId(e){return e.uuid}getBlockers(e){return[e.project]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}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,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,bounds:e.bounds}}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`${this.name} with uuid ${e.uuid} does not exist in the store`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e}},i)).flat();return this.dispatch(a(c)),c}}class KR extends dt{name="Project";url="/projects";actions={addOne:$A,addMany:qA,setOne:DA,setMany:CA,updateOne:kA,updateMany:UA,deleteOne:LA,deleteMany:HA,initialize:jA};selectors={selectById:KA,selectByIds:WA};async add(e){const{addOne:i}=this.actions,a=await this.performRequest({method:o.POST,url:`${this.url}/`,payload:M(e)});return this.dispatch(i(a)),a}async update(e){const{updateOne:i}=this.actions,a=await this.performRequest({method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:M(e)});return this.dispatch(i(a)),a}async delete(e){const{deleteOne:i}=this.actions,a=await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return this.dispatch(i(e)),a}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{organization:e}},i);return this.dispatch(a(n)),n}}class WR extends dt{name="Report";url="/reports";actions={addOne:iF,addMany:aF,setOne:nF,setMany:cF,updateOne:rF,updateMany:dF,deleteOne:uF,deleteMany:lF,initialize:sF};selectors={selectById:pF,selectByIds:mF};async getPresignedUrl(e,i){return this.performRequest({url:`${this.url}/${e}/presigned-url/`,method:o.GET},i)}async refreshStore(e,i){const n=(await this.listPaginated({queryParams:{organization:e}},i)).flat();return this.dispatch(this.actions.initialize(n)),n}}class XR extends g{name="Procedure";url="/procedures";actions={addOne:lT,addMany:bt,setOne:oT,setMany:hT,updateOne:pT,updateMany:mT,deleteOne:yT,deleteMany:Ot,initialize:uT};selectors={selectById:AT,selectByIds:TT};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(c),blockers:[c.procedure_type,c.project,c.asset,...c.procedure_initiative?[c.procedure_initiative]:[]],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}bulkAdd(e,i){const{store:a}=this.client,{addMany:n,updateMany:c,deleteMany:d}=this.actions,r=new Date().toISOString(),p=a.getState().userReducer.currentUser?.id??null,h=[],f=l.chunkArray(e,Math.min(i??e.length,D)),A=[];for(const S of f){const P=[],_=[],F=[];for(const V of S){const R=l.uuidObj({...V,submitted_at:r,created_by:p});h.push(R),P.push(M(R)),_.push(R.procedure_type,R.project,R.asset,...R.procedure_initiative?[R.procedure_initiative]:[]),F.push(R.uuid)}const w={payload:{submitted_at:r,payloads:P},blockers:_,blocks:F};A.push(w)}this.dispatch(n(h));const I=A.map(S=>{const{payload:P,blocks:_,blockers:F}=S;return this.enqueueRequest({description:y(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:P,blockers:F,blocks:_})});return Promise.all(I).then(S=>{this.dispatch(c(S.flat()))}).catch(()=>{this.dispatch(d(l.toUuidArray(h)))}),[h,Promise.all(I).then(S=>S.flat())]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected procedure with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[n.uuid],blocks:[n.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected procedure with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async bulkDelete(e){const{addMany:i,deleteMany:a}=this.actions,{selectByIds:n}=this.selectors,c=this.select(n(e));this.dispatch(a(l.toUuidArray(c)));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(i(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e}},i)).flat();return this.dispatch(a(c)),c}}class YR extends g{name="Procedure Step Assignee";url="/procedure-step-assignees";actions={addOne:MT,addMany:gT,setOne:RT,setMany:wT,updateOne:ET,updateMany:vT,deleteOne:VT,deleteMany:BT,initialize:_T};selectors={selectById:jT,selectByIds:CT};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(c),blockers:[c.procedure,c.procedure_step],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}bulkAdd(e){const{addMany:i,updateMany:a,deleteMany:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=e.map(h=>l.uuidObj({...h,created_by:c,submitted_at:d}));this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:{procedure_step_assignees:r.map(h=>M(h)),submitted_at:d},blockers:r.flatMap(h=>[h.procedure,h.procedure_step]),blocks:l.toUuidArray(r)});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(l.toUuidArray(r)))}),[r,p]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected procedure step assignee with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async bulkDelete(e){const{deleteMany:i,addMany:a}=this.actions,{selectByIds:n}=this.selectors,c=this.select(n(e));this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e}},i)).flat();return this.dispatch(a(c)),c}}class ZR extends g{name="Procedure Step Comment";url="/procedure-step-comments";actions={addOne:UT,addMany:kT,setOne:LT,setMany:HT,updateOne:GT,updateMany:NT,deleteOne:KT,deleteMany:WT,initialize:$T};selectors={selectById:YT,selectByIds:ZT};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(c),blockers:[c.procedure,c.procedure_step],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Procedure step comment with uuid ${e.uuid} not found in store`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Procedure step comment with uuid ${e} not found in store`);this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e}},i)).flat();return this.dispatch(a(c)),c}}class JR extends g{name="Procedure Step Default Assignee";url="/procedure-step-default-assignees";actions={addOne:eI,addMany:tI,setOne:sI,setMany:iI,updateOne:aI,updateMany:nI,deleteOne:cI,deleteMany:rI,initialize:xT};selectors={selectById:uI,selectByIds:lI};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(c),blockers:[c.procedure_step],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected procedure step default assignee with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{procedure_step__procedure_type__organization:e}},i);return this.dispatch(a(n)),n}}class QR extends g{name="Procedure Step Default Reviewer";url="/procedure-step-default-reviewers";actions={addOne:mI,addMany:yI,setOne:fI,setMany:SI,updateOne:AI,updateMany:TI,deleteOne:II,deleteMany:bI,initialize:pI};selectors={selectById:PI,selectByIds:FI};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(c),blockers:[c.procedure_step],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected procedure step default reviewer with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{procedure_step__procedure_type__organization:e}},i);return this.dispatch(a(n)),n}}class xR extends dt{name="Procedure Step Event";url="/procedure-step-events";actions={addOne:RI,addMany:wI,setOne:EI,setMany:vI,updateOne:VI,updateMany:BI,deleteOne:zI,deleteMany:jI,initialize:gI};selectors={selectById:DI,selectByIds:qI};async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e}},i)).flat();return this.dispatch(a(c)),c}}class ew extends v{name="Procedure Step Fields Attachment";url="/procedure-step-fields-attachments";actions={addOne:LI,addMany:Va,setOne:HI,setMany:GI,updateOne:NI,updateMany:KI,deleteOne:WI,deleteMany:Ba,initialize:kI};selectors={selectById:ZI,selectByIds:JI};getId(e){return e.uuid}getBlockers(e){return[e.fields_revision]}getBlocks(e){return[e.uuid]}buildModel(e){return l.uuidObj({...e,created_by:this.select(i=>i.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()})}buildPayload(e){const{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,submitted_at:e.submitted_at,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}}buildBulkPayload(e){const{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{fields_revision__procedure_step__procedure_type__organization:e}},i);return this.dispatch(a(n)),n}}class tw extends g{name="Procedure Step Fields";url="/procedure-step-fields";actions={addOne:tb,addMany:sb,setOne:ib,setMany:ab,updateOne:nb,updateMany:cb,deleteOne:rb,deleteMany:db,initialize:eb};selectors={selectById:ub,selectByIds:lb};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(c),blockers:[c.procedure_step],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`No procedure step fields with uuid ${e.uuid} found in the store`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected procedure step fields with uuid ${e} to exist`);const d=this.select(YI(e));this.dispatch(i(e)),this.dispatch(Ba(l.toUuidArray(d)));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(a(c)),this.dispatch(Va(d)),r}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{procedure_step__procedure_type__organization:e}},i);return this.dispatch(a(n)),n}}class sw extends v{name="Procedure Step Field Values Attachment";url="/procedure-step-field-values-attachments";actions={addOne:mb,addMany:qa,setOne:yb,setMany:fb,updateOne:Sb,updateMany:Ab,deleteOne:Tb,deleteMany:$a,initialize:pb};selectors={selectById:bb,selectByIds:Ob};getId(e){return e.uuid}getBlockers(e){return[e.field_values]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){const{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,submitted_at:e.submitted_at,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}}buildBulkPayload(e){const{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}}async bulkDelete(e){const{deleteMany:i,addMany:a}=this.actions,{selectByIds:n}=this.selectors,c=this.select(n(e));this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e,latest:!0}},i)).flat();return this.dispatch(a(c)),c}}class iw extends g{name="Procedure Step Field Values Review";url="/procedure-step-field-values-reviews";actions={addOne:kb,addMany:Ha,setOne:Lb,setMany:Hb,updateOne:Gb,updateMany:Nb,deleteOne:Kb,deleteMany:Ga,initialize:Ub};selectors={selectById:Xb,selectByIds:Yb};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(c),blockers:[c.field_values],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Procedure step field values review with uuid ${e.uuid} not found in store`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Procedure step field values review with uuid ${e} not found in store`);this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e}},i)).flat();return this.dispatch(a(c)),c}}class aw extends g{name="Procedure Step Field Values";url="/procedure-step-field-values";actions={addOne:gb,addMany:Rb,setOne:wb,setMany:Eb,updateOne:vb,updateMany:Vb,deleteOne:Bb,deleteMany:zb,initialize:Mb};selectors={selectById:Db,selectByIds:qb};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d}),p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[e.procedure,e.procedure_step,e.fields_revision],blocks:[r.uuid]});return this.dispatch(i(r)),p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}bulkAdd(e,i){const{addMany:a,updateMany:n,deleteMany:c}=this.actions,d=new Date().toISOString(),r=this.select(I=>I.userReducer.currentUser?.id??null),p=[],h=l.chunkArray(e,Math.min(i??e.length,D)),f=[];for(const I of h){const S=[],P=[],_=[];for(const F of I){const w=l.uuidObj({...F,values:F.values,created_by:r,submitted_at:d});p.push(w),S.push(M(w)),P.push(w.procedure_step,w.procedure,w.fields_revision),_.push(w.uuid)}f.push({payload:{payloads:S,submitted_at:d},blockers:P,blocks:_})}this.dispatch(a(p));const A=f.map(I=>{const{payload:S,blocks:P,blockers:_}=I;return this.enqueueRequest({description:y(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:S,blockers:_,blocks:P})});return Promise.all(A).then(I=>{this.dispatch(n(I.flat()))}).catch(()=>{this.dispatch(c(l.toUuidArray(p)))}),[p,Promise.all(A).then(I=>I.flat())]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected ProcedureStepFieldValues with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[c.uuid,c.procedure,c.procedure_step,c.fields_revision],blocks:[c.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected ProcedureStepFieldValues with uuid ${e} to exist`);const d=this.select(Pb(e)),r=this.select(Zb(e));this.dispatch(i(e)),this.dispatch($a(l.toUuidArray(d))),this.dispatch(Ga(l.toUuidArray(r)));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(p){throw this.dispatch(a(c)),this.dispatch(qa(d)),this.dispatch(Ha(r)),p}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e}},i)).flat();return this.dispatch(a(c)),c}}class nw extends g{name="Procedure Step Reviewer";url="/procedure-step-reviewers";actions={addOne:eO,addMany:tO,setOne:sO,setMany:iO,updateOne:aO,updateMany:nO,deleteOne:cO,deleteMany:rO,initialize:xb};selectors={selectById:uO,selectByIds:lO};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(c),blockers:[c.procedure,c.procedure_step],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}bulkAdd(e){const{addMany:i,updateMany:a,deleteMany:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=e.map(h=>l.uuidObj({...h,created_by:c,submitted_at:d}));this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:{procedure_step_reviewers:r.map(h=>M(h)),submitted_at:d},blockers:r.flatMap(h=>[h.procedure,h.procedure_step]),blocks:r.map(h=>h.uuid)});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(l.toUuidArray(r)))}),[r,p]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected procedure step reviewer with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async bulkDelete(e){const{deleteMany:i,addMany:a}=this.actions,{selectByIds:n}=this.selectors,c=this.select(n(e));this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e}},i)).flat();return this.dispatch(a(c)),c}}class cw extends g{name="Procedure Initiative";url="/procedure-initiatives";actions={addOne:ZA,addMany:JA,setOne:QA,setMany:xA,updateOne:eT,updateMany:tT,deleteOne:sT,deleteMany:iT,initialize:YA};selectors={selectById:cT,selectByIds:rT};add(e){const{store:i}=this.client,{addOne:a,updateOne:n,deleteOne:c}=this.actions,d=l.uuidObj({...e,created_by:i.getState().userReducer.currentUser?.id??null,submitted_at:new Date().toISOString()});this.dispatch(a(d));const r=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(d),blockers:[d.procedure_type,d.project],blocks:[d.uuid]});return r.then(p=>{this.dispatch(n(p))}).catch(()=>{this.dispatch(c(d.uuid))}),[d,r]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected ${this.name} with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[n.uuid],blocks:[n.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected ${this.name} with uuid ${e} to exist`);const d=this.select(PT(e));this.dispatch(i(e)),this.dispatch(Ot(l.toUuidArray(d)));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(a(c)),this.dispatch(bt(d)),r}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e}},i)).flat();return this.dispatch(a(c)),c}}class rw extends g{name="Procedure Step";url="/procedure-steps";actions={addOne:fO,addMany:SO,setOne:mO,setMany:yO,updateOne:AO,updateMany:TO,deleteOne:IO,deleteMany:bO,initialize:pO};selectors={selectById:PO,selectByIds:FO};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(c),blockers:[c.procedure_type],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`No procedure step with uuid ${e.uuid} found in the store`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${n.uuid}/`,payload:e,blockers:[n.uuid],blocks:[n.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{addOne:i,deleteOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`No procedure step with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(i(c)),d}}bulkUpdate(e,i){const{updateMany:a}=this.actions,{selectByIds:n}=this.selectors,c=l.toUuidArray(e);if(new Set(c).size!==e.length)throw new Error("payloads contains duplicate uuids.");const d=this.select(n(c));if(c.length!=d.length)throw new Error(`Attempting to bulk update ${c.length-d.length} ${this.name} that dont exist in the store`);const r=d.toSorted((S,P)=>l.uuidSortFn(S.uuid,P.uuid)),p=e.toSorted((S,P)=>l.uuidSortFn(S.uuid,P.uuid)),h=[];for(let S=0;S<c.length;S++)h.push({...r[S],...p[S]});this.dispatch(a(h));const f=l.chunkArray(e,Math.min(i??e.length,D)),A=[];let I=null;for(const S of f){const P=ut.v4(),_=l.toUuidArray(S),F=this.enqueueRequest({description:y(o.PATCH,this.name,!0),method:o.PATCH,url:`${this.url}/bulk/`,payload:{payloads:S},blockers:(I?[I]:[]).concat(_),blocks:[P].concat(_)});A.push(F),I=P}return Promise.all(A).then(S=>{this.dispatch(a(S.flat()))}).catch(()=>{this.dispatch(a(d))}),[h,A]}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{procedure_type__organization:e}},i);return this.dispatch(a(n)),n}}class dw extends v{name="Procedure Type Attachment";url="/procedure-type-attachments";actions={addOne:gO,addMany:RO,setOne:wO,setMany:EO,updateOne:vO,updateMany:VO,deleteOne:BO,deleteMany:zO,initialize:MO};selectors={selectById:DO,selectByIds:qO};getId(e){return e.uuid}getBlockers(e){return[e.procedure_type]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}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,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{procedure_type__organization:e}},i);return this.dispatch(a(n)),n}}class uw extends v{name="Procedure Type Fields Attachment";url="/procedure-type-fields-attachments";actions={addOne:kO,addMany:LO,setOne:HO,setMany:GO,updateOne:NO,updateMany:KO,deleteOne:WO,deleteMany:XO,initialize:UO};selectors={selectById:JO,selectByIds:QO};getId(e){return e.uuid}getBlockers(e){return[e.fields_revision]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){const{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,submitted_at:e.submitted_at,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}}buildBulkPayload(e){const{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{fields_revision__procedure_type__organization:e}},i);return this.dispatch(a(n)),n}}class lw extends g{name="Procedure Type Fields";url="/procedure-type-fields";actions={addOne:tP,addMany:sP,setOne:iP,setMany:aP,updateOne:nP,updateMany:cP,deleteOne:rP,deleteMany:dP,initialize:eP};selectors={selectById:oP,selectByIds:hP};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[r.procedure_type],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(h=>{throw this.dispatch(n(r.uuid)),h}),[r,p]}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{procedure_type__organization:e}},i);return this.dispatch(a(n)),n}}class ow extends v{name="Procedure Field Values Attachment";url="/procedure-field-values-attachments";actions={addOne:yP,addMany:tn,setOne:fP,setMany:SP,updateOne:AP,updateMany:TP,deleteOne:IP,deleteMany:sn,initialize:mP};selectors={selectById:PP,selectByIds:FP};getId(e){return e.uuid}getBlockers(e){return[e.field_values]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){const{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,submitted_at:e.submitted_at,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}}buildBulkPayload(e){const{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}}async bulkDelete(e){const{deleteMany:i,addMany:a}=this.actions,{selectByIds:n}=this.selectors,c=this.select(n(e));this.dispatch(i(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e,latest:!0}},i)).flat();return this.dispatch(a(c)),c}}class hw extends g{name="Procedure Field Values";url="/procedure-field-values";actions={addOne:RP,addMany:wP,setOne:EP,setMany:vP,updateOne:VP,updateMany:BP,deleteOne:zP,deleteMany:jP,initialize:gP};selectors={selectById:qP,selectByIds:$P};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d}),p=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(r),blockers:[e.fields_revision,e.procedure],blocks:[r.uuid]});return this.dispatch(i(r)),p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}bulkAdd(e,i){const{addMany:a,updateMany:n,deleteMany:c}=this.actions,d=new Date().toISOString(),r=this.select(I=>I.userReducer.currentUser?.id??null),p=[],h=l.chunkArray(e,Math.min(i??e.length,D)),f=[];for(const I of h){const S=[],P=[],_=[];for(const F of I){const w=l.uuidObj({...F,values:F.values,created_by:r,submitted_at:d});p.push(w),S.push(M(w)),P.push(w.procedure,w.fields_revision),_.push(w.uuid)}f.push({payload:{payloads:S,submitted_at:d},blockers:P,blocks:_})}this.dispatch(a(p));const A=f.map(I=>{const{payload:S,blocks:P,blockers:_}=I;return this.enqueueRequest({description:y(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:S,blockers:_,blocks:P})});return Promise.all(A).then(I=>{this.dispatch(n(I.flat()))}).catch(()=>{this.dispatch(c(l.toUuidArray(p)))}),[p,Promise.all(A).then(I=>I.flat())]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected ProcedureFieldValues with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[c.fields_revision,c.procedure],blocks:[c.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const d=this.select(_P(e));this.dispatch(i(e)),this.dispatch(sn(l.toUuidArray(d)));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(a(c)),this.dispatch(tn(d)),r}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e,latest:!0}},i)).flat();return this.dispatch(a(c)),c}}class pw extends g{name="Procedure Type";url="/procedure-types";actions={addOne:LP,addMany:HP,setOne:GP,setMany:NP,updateOne:KP,updateMany:WP,deleteOne:XP,deleteMany:YP,initialize:kP};selectors={selectById:QP,selectByIds:xP};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(c),blockers:[],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected procedure type with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[n.uuid],blocks:[n.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected procedure type with uuid ${e} to exist`);const d=this.select(IT(e));this.dispatch(i(e)),this.dispatch(Ot(l.toUuidArray(d)));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(a(c)),this.dispatch(bt(d)),r}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{organization:e}},i);return this.dispatch(a(n)),n}}class mw extends g{name="Team Membership";url="/team-memberships";actions={addOne:AF,addMany:TF,setOne:IF,setMany:bF,updateOne:OF,updateMany:PF,deleteOne:FF,deleteMany:_F,initialize:SF};selectors={selectById:RF,selectByIds:wF};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null)});this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(c),blockers:[e.team],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}bulkAdd(e){const{addMany:i,updateMany:a,deleteMany:n}=this.actions,c=this.select(p=>p.userReducer.currentUser?.id??null),d=e.map(p=>l.uuidObj({...p,created_by:c}));this.dispatch(i(d));const r=this.enqueueRequest({description:y(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:{team_memberships:d.map(p=>M(p))},blockers:d.map(p=>p.team),blocks:d.map(p=>p.uuid)});return r.then(p=>{this.dispatch(a(p))}).catch(()=>{this.dispatch(n(d.map(p=>p.uuid)))}),[d,r]}async delete(e){const{addOne:i,deleteOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected team membership with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(d){throw this.dispatch(i(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{team__organization:e}},i);return this.dispatch(a(n)),n}}class yw extends g{name="Team";url="/teams";actions={addOne:VF,addMany:BF,setOne:zF,setMany:jF,updateOne:CF,updateMany:DF,deleteOne:qF,deleteMany:$F,initialize:vF};selectors={selectById:kF,selectByIds:LF};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,submitted_at:new Date().toISOString(),created_by:this.select(r=>r.userReducer.currentUser?.id??null)});this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:M(c),blockers:[],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected team with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:y(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:M(e),blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{addOne:i,deleteOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected team with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:y(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(d){throw this.dispatch(i(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{organization:e}},i);return this.dispatch(a(n)),n}}class fw extends dt{name="User";url="/user";actions={addOne:ua,addMany:Gf,setOne:Hf,setMany:Lf,updateOne:Kf,updateMany:Nf,deleteOne:la,deleteMany:Wf,initialize:kf};selectors={selectById:xt,selectByIds:Zf};async list(e,i){const{organizationUuid:a,...n}=e,c=a?`/organizations/${a}${this.url}s/`:`/${this.url}`;return this.performRequest({method:o.GET,url:c,...n},i)}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({organizationUuid:e},i);return this.dispatch(a(n)),n}}async function An(t,e,i,a,n){const c=a instanceof yt;c&&e.checkAuth!==!1&&await a.auth.prepareAuth();const d={queryParams:"",isAuthNeeded:!0},{s3url:r,payload:p,headers:h,method:f,queryParams:A,attachmentHash:I,isExternalUrl:S,isAuthNeeded:P,isResponseBlob:_}={...d,...e};let F=e.url;const w=I?await i.files.getFileFromCache(I):void 0,V=w?await e_(w):void 0;if(I){if(!V)throw new Error(`Cannot upload file ${I} because it's not cached.`);if(V.size===0)throw new Error(`Cannot upload file ${I} because its has a size of 0.`)}!S&&!F.startsWith("http")&&(!F.startsWith("/")&&!F.startsWith("blob:")&&(F="/"+F),F=t+F);const R=B=>{if(I){if(!r)throw new Error(`No S3 URL for file ${I}`);if("warning"in r)throw new Error(`S3 URL warning for file ${I}`);if(!V)throw new Error(`No file for file ${I}`);const q=r.fields["x-amz-checksum-sha1"];if(!q)throw new Error(`No checksum for file ${I}`);return B.set("x-amz-checksum-sha1",q).field({...p,...r.fields}).attach("file",V)}return B.send(p)},zt={[o.GET]:()=>_?St.get(F.toString()).responseType("blob"):St.get(F.toString()),[o.POST]:()=>{const B=St.post(F.toString());return R(B)},[o.PATCH]:()=>{const B=St.patch(F.toString());return R(B)},[o.PUT]:()=>{const B=St.put(F.toString());return R(B)},[o.DELETE]:()=>{const B=St.delete(F.toString());return R(B)}}[f];let j=zt();const ds=()=>{console.debug("aborting request:",e.url),j.abort()};n?.addEventListener("abort",ds),P&&c&&(j=a.auth.applyAuth(j)),h&&(j=j.set(h));try{return await j.query(A)}catch(B){const q=xF(B),jt=q?.status;throw c&&q&&a.auth.isAuthFailure(q)?(await a.auth.handleUnauthorized(j,q),new z({response:q,innerError:B,discard:!1})):new z({response:q,innerError:B,discard:yn.includes(jt)})}finally{n?.removeEventListener("abort",ds)}}class Sw{store;constructor(e){this.store=e}_performRequest(e,i,a,n){const c=new l.DeferredPromise,d={...i,uuid:i.uuid??ut.v4()};return An(e,d,this,a,n).then(r=>{c.resolve(r.body)}).catch(r=>{r instanceof Error?c.reject(r):c.reject(new Error((r??l.ERROR_MSG_UNEXPECTED).toString()))}),c}async performRequest(e,i,a,n){return this._performRequest(e,i,a,n).then(c=>{if(c instanceof z)throw c;return c})}async enqueueRequest(e,i,a){return this._enqueueRequest(e,i,a).then(n=>{if(n instanceof z)throw n;return n})}_enqueueRequest(e,i,a){const n=new l.DeferredPromise,c={...e,BASE_URL:i,serviceName:a},d=this.store.dispatch(RS(c)),r=h=>{if(h)n.resolve(h.body);else{const f=new z({message:"Could not get a response from the server.",response:h,discard:!0});n.reject(f)}},p=h=>{h instanceof z?h.options.discard=!0:(console.error("Received an unexpected error while processing a request:",h,`
14
14
  Converting error to APIError and discarding.`),h=new z({message:"An error occurred while processing the request.",innerError:h,discard:!0})),n.reject(h)};return d.then(r,p),n}async performPagination(e,i,a,n,c){const d={...i,queryParams:{...i.queryParams,paginate:!0,limit:a}},{method:r}=d,p=[];let h=await this.performRequest(e,d,n,c);for(p.push(h.results);h.next;)h=await this.performRequest(e,{url:h.next,method:r},n,c),p.push(h.results);return p}}class Pt{graph;requestAttemptCounter;constructor(){this.graph=new F_.DepGraph,this.requestAttemptCounter={}}static _fromOutbox(e){const i=new Pt;for(let a=0;a<e.length;a++){const n=e[a];if(!n){console.error("Outbox item was undefined");continue}i.sneakRequest(n);for(let c=0;c<a;c++){const d=e[c];if(!d){console.error("Previous outbox item was undefined");continue}d.payload.uuid!==n.payload.uuid&&d.payload.blocks.some(r=>n.payload.blockers.includes(r))&&Pt._addDependency(n.payload.uuid,d.payload.uuid,i.graph)}}return i}_addDependency(e,i){Pt._addDependency(e,i,this.graph)}static _addDependency(e,i,a){if(e===i)throw new Error(`Tried to add dependency from node to itself: ${e}`);if(!a.hasNode(e))throw new Error(`Tried to add dependency from non-existent node: ${e} (to node: ${i})`);if(!a.hasNode(i))throw new Error(`Tried to add dependency to non-existent node: ${i} (from node: ${e})`);a.addDependency(e,i)}addRequest(e){if(this.graph.addNode(e.payload.uuid,e),!(e.payload.blockers.length===0||this.graph.size()===1))for(const i of this.graph.overallOrder()){if(i===e.payload.uuid)continue;const a=this.graph.getNodeData(i),n=new Set(a.payload.blocks);e.payload.blockers.some(c=>n.has(c))&&this._addDependency(e.payload.uuid,i)}}insertRequest(e){this.graph.addNode(e.payload.uuid,e);for(const i of this.graph.overallOrder()){if(i===e.payload.uuid)continue;const a=this.graph.getNodeData(i),n=new Set(e.payload.blocks);a.payload.blockers.some(c=>n.has(c))&&this._addDependency(i,e.payload.uuid)}}sneakRequest(e){this.graph.addNode(e.payload.uuid,e)}_getNextNode(){const e=this.graph.overallOrder(!0);let i=1/0,a;for(const n of e){const c=this.requestAttemptCounter[n]||0;c<i&&(i=c,a=n)}return a}peek(){const e=this._getNextNode();if(e)return this.graph.getNodeData(e)}remove(e){this.graph.removeNode(e),delete this.requestAttemptCounter[e]}pop(){const e=this.peek();return e&&this.graph.removeNode(e.payload.uuid),e}getQueue(){const e=this.graph.overallOrder().map(a=>this.graph.getNodeData(a)),i=this._getNextNode();if(i){const a=this.graph.getNodeData(i),n=e.findIndex(c=>c.payload.uuid===a.payload.uuid);n!==-1&&(e.splice(n,1),e.unshift(a))}return e}getReady(){let e=this.graph.overallOrder(!0).map(i=>this.graph.getNodeData(i));return e=e.sort((i,a)=>i.meta.offline.effect.timestamp.localeCompare(a.meta.offline.effect.timestamp)),e=e.sort((i,a)=>{const n=this.requestAttemptCounter[i.payload.uuid]||0,c=this.requestAttemptCounter[a.payload.uuid]||0;return n-c}),e}registerRetry(e){this.requestAttemptCounter[e]=(this.requestAttemptCounter[e]||0)+1}}let l_;function o_(t){l_=t}function Ft(){return l_}let h_;function p_(t){h_=t}function m_(){return h_}let Tn=null;function ft(){const t=Ft();if(!t)return console.warn("Client store not set; cannot get outbox coordinator yet."),null;if(Tn)return Tn;const e=t.getState().offline.outbox,i=Pt._fromOutbox(e);return Tn=i,i}const Aw=(t,e)=>{const i=new e(t);return p_(i),o_(t),i};class Tw{_all;_previous;constructor(e){this._all=[e],this._previous=e,this.then=this.then.bind(this),this.compile=this.compile.bind(this)}then(e){return this._previous&&(this._previous.next=e),this._all.push(e),this._previous=e,{then:this.then,compile:this.compile}}compile(){return this._all}}class In{next;constructor(){this.next=null}then(e){return new Tw(this).then(e)}async run(e){if(this.next)return this.next.run(e);{if(console.debug("Middleware finished. Performing request:",e.payload.url),!Ft())throw new Error("Client store not set");const a=m_();if(!a)throw new Error("Client SDK not set");return ZF(e,a)}}}class y_ extends In{async run(e){return super.run(e)}}class f_ extends In{async run(e){return super.run(e)}}const S_=new y_().then(new f_).compile();function A_(t){return S_[0]?.run(t)}s.ALL_MIDDLEWARE=S_,s.APIError=z,s.AgentService=Gg,s.AssetAttachmentService=Ng,s.AssetCommentAttachmentService=Kg,s.AssetCommentService=Wg,s.AssetService=Xg,s.AssetTypeAttachmentService=Yg,s.AssetTypeFieldValuesAttachmentService=Qg,s.AssetTypeFieldValuesService=xg,s.AssetTypeFieldsAttachmentService=Zg,s.AssetTypeFieldsService=Jg,s.AssetTypeIdentifierService=eR,s.AssetTypeIdentifierValueService=tR,s.AssetTypeService=sR,s.AssetTypeStatusService=iR,s.BaseApiService=yt,s.BaseAuthService=u_,s.BaseModelApiService=dt,s.BaseOfflineFileModelApiService=v,s.BaseOfflineModelApiService=g,s.BaseSDK=Sw,s.COMMON_AUTO_FIELDS=On,s.DEFAULT_PAGE_SIZE=NF,s.DISCARD_HTTP_STATUSES=yn,s.DocumentAttachmentService=aR,s.DocumentService=nR,s.EmailDomainsService=cR,s.EmailVerificationService=rR,s.FileService=dR,s.FormIdentifierService=uR,s.FormIdentifierValueService=lR,s.FormRevisionAttachmentService=oR,s.FormRevisionService=hR,s.FormService=pR,s.FormSubmissionCommentAttachmentService=SR,s.FormSubmissionCommentService=AR,s.FormSubmissionFieldValuesAttachmentService=yR,s.FormSubmissionFieldValuesService=fR,s.FormSubmissionService=TR,s.FormSubscriberService=mR,s.GeoImageService=IR,s.HttpMethod=o,s.IssueAssociationService=bR,s.IssueAttachmentService=OR,s.IssueCommentAttachmentService=PR,s.IssueCommentService=FR,s.IssueService=_R,s.IssueTypeAttachmentService=MR,s.IssueTypeFieldValuesAttachmentService=wR,s.IssueTypeFieldValuesService=ER,s.IssueTypeFieldsAttachmentService=gR,s.IssueTypeFieldsService=RR,s.IssueTypeIdentifierService=vR,s.IssueTypeIdentifierValueService=VR,s.IssueTypePriorityService=BR,s.IssueTypeService=zR,s.IssueTypeStatusService=jR,s.IssueUpdateService=CR,s.JWTService=$R,s.MAX_SERVICE_BATCH_SIZE=D,s.OUTBOX_RETRY_DELAY=6e4,s.OfflineAnalyticsMiddleware=y_,s.OfflineMiddleware=In,s.OrganizationAccessService=UR,s.OrganizationService=kR,s.OutboxCoordinator=Pt,s.ProcdureInitiativeService=cw,s.ProcedureFieldValuesAttachmentService=ow,s.ProcedureFieldValuesService=hw,s.ProcedureService=XR,s.ProcedureStepAssigneeService=YR,s.ProcedureStepCommentService=ZR,s.ProcedureStepDefaultAssigneeService=JR,s.ProcedureStepDefaultReviewerService=QR,s.ProcedureStepEventService=xR,s.ProcedureStepFieldValuesAttachmentService=sw,s.ProcedureStepFieldValuesReviewService=iw,s.ProcedureStepFieldValuesService=aw,s.ProcedureStepFieldsAttachmentService=ew,s.ProcedureStepFieldsService=tw,s.ProcedureStepReviewerService=nw,s.ProcedureStepService=rw,s.ProcedureTypeAttachmentService=dw,s.ProcedureTypeFieldsAttachmentService=uw,s.ProcedureTypeFieldsService=lw,s.ProcedureTypeService=pw,s.ProjectAccessService=LR,s.ProjectAttachmentService=HR,s.ProjectCommentService=GR,s.ProjectFileService=NR,s.ProjectService=KR,s.RESET_ORGANIZATION_STATE=O,s.RESET_PROJECT_STATE=E,s.RESET_STATE=T,s.RateLimitingMiddleware=f_,s.ReportService=WR,s.TeamMembershipService=mw,s.TeamService=yw,s.UserService=fw,s._setLatestRetryTime=ES,s.addAsset=Ac,s.addAssetAttachment=vn,s.addAssetAttachments=hs,s.addAssetComment=ac,s.addAssetCommentAttachment=Gn,s.addAssetCommentAttachments=Nn,s.addAssetComments=Ct,s.addAssetType=bd,s.addAssetTypeAttachment=vc,s.addAssetTypeAttachments=Os,s.addAssetTypeFieldValues=vr,s.addAssetTypeFieldValuesAttachment=Ar,s.addAssetTypeFieldValuesAttachments=ws,s.addAssetTypeFieldValuesMany=Vr,s.addAssetTypeFields=ar,s.addAssetTypeFieldsAttachment=Gc,s.addAssetTypeFieldsAttachments=Nc,s.addAssetTypeFieldsMany=nr,s.addAssetTypeIdentifier=Nr,s.addAssetTypeIdentifierValue=nd,s.addAssetTypeIdentifierValues=cd,s.addAssetTypeIdentifiers=Kr,s.addAssetTypeStatus=Bd,s.addAssetTypeStatuses=zd,s.addAssetTypes=Od,s.addAssets=Ts,s.addConversation=_n,s.addConversations=M_,s.addDocument=lu,s.addDocumentAttachment=Zd,s.addDocumentAttachments=Jd,s.addDocuments=ou,s.addEmailDomain=Fu,s.addEmailDomains=_u,s.addForm=Ql,s.addFormIdentifier=qu,s.addFormIdentifierValue=Qu,s.addFormIdentifierValues=xu,s.addFormIdentifiers=$u,s.addFormRevision=Ml,s.addFormRevisionAttachment=hl,s.addFormRevisionAttachments=pl,s.addFormRevisions=Js,s.addFormSubmission=hh,s.addFormSubmissionComment=Jo,s.addFormSubmissionCommentAttachment=Do,s.addFormSubmissionCommentAttachments=qo,s.addFormSubmissionComments=Si,s.addFormSubmissionFieldValues=Fo,s.addFormSubmissionFieldValuesAttachment=po,s.addFormSubmissionFieldValuesAttachments=ni,s.addFormSubmissionFieldValuesMany=oi,s.addFormSubmissions=lt,s.addFormSubscriber=$l,s.addFormSubscribers=ei,s.addForms=xl,s.addGeoImage=wh,s.addGeoImages=Eh,s.addIssue=Hp,s.addIssueAssociation=Nh,s.addIssueAssociations=At,s.addIssueAttachment=ip,s.addIssueAttachments=Fi,s.addIssueComment=Ep,s.addIssueCommentAttachment=fp,s.addIssueCommentAttachments=Sp,s.addIssueComments=vp,s.addIssueType=nf,s.addIssueTypeAttachment=sm,s.addIssueTypeAttachments=im,s.addIssueTypeFieldValues=Em,s.addIssueTypeFieldValuesAttachment=ay,s.addIssueTypeFieldValuesAttachments=ki,s.addIssueTypeFieldValuesMany=vm,s.addIssueTypeFields=Gm,s.addIssueTypeFieldsAttachment=fm,s.addIssueTypeFieldsAttachments=Sm,s.addIssueTypeFieldsMany=Nm,s.addIssueTypeIdentifier=Sy,s.addIssueTypeIdentifierValue=vy,s.addIssueTypeIdentifierValues=Vy,s.addIssueTypeIdentifiers=Ay,s.addIssueTypePriorities=Ky,s.addIssueTypePriority=Ny,s.addIssueTypeStatus=Tf,s.addIssueTypeStatuses=If,s.addIssueTypes=cf,s.addIssueUpdate=sa,s.addIssueUpdates=ia,s.addIssues=Vi,s.addOrganization=fS,s.addOrganizationAccess=xf,s.addOrganizationAccesses=eS,s.addOrganizations=yS,s.addProcedure=lT,s.addProcedureFieldValues=RP,s.addProcedureFieldValuesAttachment=yP,s.addProcedureFieldValuesAttachments=tn,s.addProcedureFieldValuesMany=wP,s.addProcedureInitiative=ZA,s.addProcedureInitiatives=JA,s.addProcedureStep=fO,s.addProcedureStepAssignee=MT,s.addProcedureStepAssignees=gT,s.addProcedureStepComment=UT,s.addProcedureStepComments=kT,s.addProcedureStepDefaultAssignee=eI,s.addProcedureStepDefaultAssignees=tI,s.addProcedureStepDefaultReviewer=mI,s.addProcedureStepDefaultReviewers=yI,s.addProcedureStepEvent=RI,s.addProcedureStepEvents=wI,s.addProcedureStepFieldValues=gb,s.addProcedureStepFieldValuesAttachment=mb,s.addProcedureStepFieldValuesAttachments=qa,s.addProcedureStepFieldValuesMany=Rb,s.addProcedureStepFieldValuesReview=kb,s.addProcedureStepFieldValuesReviews=Ha,s.addProcedureStepFields=tb,s.addProcedureStepFieldsAttachment=LI,s.addProcedureStepFieldsAttachments=Va,s.addProcedureStepFieldsMany=sb,s.addProcedureStepReviewer=eO,s.addProcedureStepReviewers=tO,s.addProcedureSteps=SO,s.addProcedureType=LP,s.addProcedureTypeAttachment=gO,s.addProcedureTypeAttachments=RO,s.addProcedureTypeFields=tP,s.addProcedureTypeFieldsAttachment=kO,s.addProcedureTypeFieldsAttachments=LO,s.addProcedureTypeFieldsMany=sP,s.addProcedureTypes=HP,s.addProcedures=bt,s.addProject=$A,s.addProjectAccess=zS,s.addProjectAccesses=jS,s.addProjectAttachment=WS,s.addProjectAttachments=XS,s.addProjectComment=rA,s.addProjectComments=dA,s.addProjectFile=PA,s.addProjectFiles=FA,s.addProjects=qA,s.addReport=iF,s.addReports=aF,s.addTeam=VF,s.addTeamMembership=AF,s.addTeamMemberships=TF,s.addTeams=BF,s.addUser=ua,s.addUsers=Gf,s.agentsReducer=Rn,s.agentsSlice=us,s.assetAttachmentReducer=kn,s.assetAttachmentSlice=os,s.assetCommentAttachmentReducer=tc,s.assetCommentAttachmentSlice=ys,s.assetCommentReducer=yc,s.assetCommentSlice=Ss,s.assetReducer=Rc,s.assetSlice=As,s.assetTypeAttachmentReducer=kc,s.assetTypeAttachmentSlice=bs,s.assetTypeFieldValuesAttachmentReducer=Rr,s.assetTypeFieldValuesAttachmentSlice=Rs,s.assetTypeFieldValuesReducer=Lr,s.assetTypeFieldValuesSlice=Vs,s.assetTypeFieldsAttachmentReducer=tr,s.assetTypeFieldsAttachmentSlice=_s,s.assetTypeFieldsReducer=yr,s.assetTypeFieldsSlice=gs,s.assetTypeIdentifierReducer=sd,s.assetTypeIdentifierSlice=Bs,s.assetTypeIdentifierValueReducer=fd,s.assetTypeIdentifierValueSlice=js,s.assetTypeReducer=Ed,s.assetTypeSlice=Cs,s.assetTypeStatusReducer=Gd,s.assetTypeStatusSlice=qs,s.authReducer=Wd,s.authSlice=Lt,s.baseReducer=Eg,s.baseReducers=mn,s.clearTokens=K_,s.createModelAdapter=b,s.createOfflineAction=MS,s.createPayload=M,s.createSelectionAdapter=__,s.deleteAsset=bc,s.deleteAssetAttachment=Cn,s.deleteAssetAttachments=ps,s.deleteAssetComment=uc,s.deleteAssetCommentAttachment=Zn,s.deleteAssetCommentAttachments=Jn,s.deleteAssetComments=Dt,s.deleteAssetType=_d,s.deleteAssetTypeAttachment=Cc,s.deleteAssetTypeAttachments=Ps,s.deleteAssetTypeFieldValues=Dr,s.deleteAssetTypeFieldValuesAttachment=Pr,s.deleteAssetTypeFieldValuesAttachments=Es,s.deleteAssetTypeFieldValuesMany=qr,s.deleteAssetTypeFields=lr,s.deleteAssetTypeFieldsAttachment=Zc,s.deleteAssetTypeFieldsAttachments=Jc,s.deleteAssetTypeFieldsMany=or,s.deleteAssetTypeIdentifier=Jr,s.deleteAssetTypeIdentifierValue=od,s.deleteAssetTypeIdentifierValues=hd,s.deleteAssetTypeIdentifiers=Qr,s.deleteAssetTypeStatus=$d,s.deleteAssetTypeStatuses=Ud,s.deleteAssetTypes=Md,s.deleteAssets=Is,s.deleteConversation=w_,s.deleteConversations=E_,s.deleteDocument=fu,s.deleteDocumentAttachment=su,s.deleteDocumentAttachments=iu,s.deleteDocuments=Su,s.deleteEmailDomain=Eu,s.deleteEmailDomains=vu,s.deleteForm=ao,s.deleteFormIdentifier=Gu,s.deleteFormIdentifierValue=al,s.deleteFormIdentifierValues=nl,s.deleteFormIdentifiers=Nu,s.deleteFormRevision=vl,s.deleteFormRevisionAttachment=Al,s.deleteFormRevisionAttachments=Tl,s.deleteFormRevisions=Qs,s.deleteFormSubmission=yh,s.deleteFormSubmissionComment=sh,s.deleteFormSubmissionCommentAttachment=Ho,s.deleteFormSubmissionCommentAttachments=Go,s.deleteFormSubmissionComments=Ai,s.deleteFormSubmissionFieldValues=wo,s.deleteFormSubmissionFieldValuesAttachment=Ao,s.deleteFormSubmissionFieldValuesAttachments=ci,s.deleteFormSubmissionFieldValuesMany=hi,s.deleteFormSubmissions=ot,s.deleteFormSubscriber=Gl,s.deleteFormSubscribers=ti,s.deleteForms=no,s.deleteGeoImage=Bh,s.deleteGeoImages=zh,s.deleteIssue=Xp,s.deleteIssueAssociation=Kh,s.deleteIssueAssociations=Tt,s.deleteIssueAttachment=dp,s.deleteIssueAttachments=_i,s.deleteIssueComment=Cp,s.deleteIssueCommentAttachment=Op,s.deleteIssueCommentAttachments=Pp,s.deleteIssueComments=Dp,s.deleteIssueType=of,s.deleteIssueTypeAttachment=dm,s.deleteIssueTypeAttachments=um,s.deleteIssueTypeFieldValues=Cm,s.deleteIssueTypeFieldValuesAttachment=uy,s.deleteIssueTypeFieldValuesAttachments=Li,s.deleteIssueTypeFieldValuesMany=Dm,s.deleteIssueTypeFields=Zm,s.deleteIssueTypeFieldsAttachment=Om,s.deleteIssueTypeFieldsAttachments=Pm,s.deleteIssueTypeFieldsMany=Jm,s.deleteIssueTypeIdentifier=Py,s.deleteIssueTypeIdentifierValue=Dy,s.deleteIssueTypeIdentifierValues=qy,s.deleteIssueTypeIdentifiers=Fy,s.deleteIssueTypePriorities=Qy,s.deleteIssueTypePriority=Jy,s.deleteIssueTypeStatus=_f,s.deleteIssueTypeStatuses=Mf,s.deleteIssueTypes=hf,s.deleteIssueUpdate=aa,s.deleteIssueUpdates=na,s.deleteIssues=Bi,s.deleteOrganization=TS,s.deleteOrganizationAccess=nS,s.deleteOrganizationAccesses=cS,s.deleteOrganizations=IS,s.deleteProcedure=yT,s.deleteProcedureFieldValues=zP,s.deleteProcedureFieldValuesAttachment=IP,s.deleteProcedureFieldValuesAttachments=sn,s.deleteProcedureFieldValuesMany=jP,s.deleteProcedureInitiative=sT,s.deleteProcedureInitiatives=iT,s.deleteProcedureStep=IO,s.deleteProcedureStepAssignee=VT,s.deleteProcedureStepAssignees=BT,s.deleteProcedureStepComment=KT,s.deleteProcedureStepComments=WT,s.deleteProcedureStepDefaultAssignee=cI,s.deleteProcedureStepDefaultAssignees=rI,s.deleteProcedureStepDefaultReviewer=II,s.deleteProcedureStepDefaultReviewers=bI,s.deleteProcedureStepEvent=zI,s.deleteProcedureStepEvents=jI,s.deleteProcedureStepFieldValues=Bb,s.deleteProcedureStepFieldValuesAttachment=Tb,s.deleteProcedureStepFieldValuesAttachments=$a,s.deleteProcedureStepFieldValuesMany=zb,s.deleteProcedureStepFieldValuesReview=Kb,s.deleteProcedureStepFieldValuesReviews=Ga,s.deleteProcedureStepFields=rb,s.deleteProcedureStepFieldsAttachment=WI,s.deleteProcedureStepFieldsAttachments=Ba,s.deleteProcedureStepFieldsMany=db,s.deleteProcedureStepReviewer=cO,s.deleteProcedureStepReviewers=rO,s.deleteProcedureSteps=bO,s.deleteProcedureType=XP,s.deleteProcedureTypeAttachment=BO,s.deleteProcedureTypeAttachments=zO,s.deleteProcedureTypeFields=rP,s.deleteProcedureTypeFieldsAttachment=WO,s.deleteProcedureTypeFieldsAttachments=XO,s.deleteProcedureTypeFieldsMany=dP,s.deleteProcedureTypes=YP,s.deleteProcedures=Ot,s.deleteProject=LA,s.deleteProjectAccess=US,s.deleteProjectAccesses=kS,s.deleteProjectAttachment=xS,s.deleteProjectAttachments=eA,s.deleteProjectComment=pA,s.deleteProjectComments=mA,s.deleteProjectFile=gA,s.deleteProjectFiles=RA,s.deleteProjects=HA,s.deleteReport=uF,s.deleteReports=lF,s.deleteTeam=qF,s.deleteTeamMembership=FF,s.deleteTeamMemberships=_F,s.deleteTeams=$F,s.deleteUser=la,s.deleteUsers=Wf,s.dequeue=YF,s.discard=JF,s.documentAttachmentReducer=ru,s.documentAttachmentSlice=Us,s.documentSlice=Ls,s.documentsReducer=Au,s.emailDomainsReducer=ju,s.emailDomainsSlice=Gs,s.enqueue=XF,s.enqueueRequest=RS,s.extractResponseFromError=xF,s.fetchBlobFromObjectUrl=s_,s.fetchFileFromObjectUrl=i_,s.fileToBlob=e_,s.formIdentifierReducer=Yu,s.formIdentifierSlice=Ks,s.formIdentifierValueReducer=ul,s.formIdentifierValueSlice=Xs,s.formReducer=co,s.formRevisionAttachmentReducer=Pl,s.formRevisionAttachmentSlice=Ys,s.formRevisionReducer=Cl,s.formRevisionsSlice=Zs,s.formSlice=si,s.formSubmissionCommentAttachmentReducer=Xo,s.formSubmissionCommentAttachmentSlice=mi,s.formSubmissionCommentReducer=rh,s.formSubmissionCommentSlice=fi,s.formSubmissionFieldValuesAttachmentReducer=bo,s.formSubmissionFieldValuesAttachmentSlice=ai,s.formSubmissionFieldValuesReducer=zo,s.formSubmissionFieldValuesSlice=li,s.formSubmissionReducer=Fh,s.formSubmissionSlice=Ti,s.formSubscriberReducer=Yl,s.formSubscriberSlice=xs,s.geoImageReducer=qh,s.geoImageSlice=Ii,s.getClientSDK=m_,s.getClientStore=Ft,s.getFileExtension=t_,s.getOutboxCoordinator=ft,s.getPresignedUrlExpiryDate=r_,s.getRenamedFile=Lg,s.getRequestDescription=y,s.getS3FileKey=kg,s.hashFile=rs,s.initSDK=Aw,s.initializeAssetAttachments=En,s.initializeAssetCommentAttachments=Hn,s.initializeAssetComments=ic,s.initializeAssetTypeAttachments=Ec,s.initializeAssetTypeFieldValues=Er,s.initializeAssetTypeFieldValuesAttachments=Sr,s.initializeAssetTypeFields=ir,s.initializeAssetTypeFieldsAttachments=Hc,s.initializeAssetTypeIdentifierValues=ad,s.initializeAssetTypeIdentifiers=Gr,s.initializeAssetTypeStatuses=Vd,s.initializeAssetTypes=Ad,s.initializeAssets=Sc,s.initializeConversations=Fn,s.initializeDocumentAttachments=Yd,s.initializeDocuments=uu,s.initializeEmailDomains=Pu,s.initializeFormIdentifierValues=Ju,s.initializeFormIdentifiers=Du,s.initializeFormRevisionAttachments=ol,s.initializeFormRevisions=_l,s.initializeFormSubmissionCommentAttachments=Co,s.initializeFormSubmissionComments=Zo,s.initializeFormSubmissionFieldValues=Po,s.initializeFormSubmissionFieldValuesAttachments=ho,s.initializeFormSubmissions=uh,s.initializeFormSubscribers=ql,s.initializeForms=Jl,s.initializeGeoImages=Mh,s.initializeIssueAssociations=Uh,s.initializeIssueAttachments=sp,s.initializeIssueCommentAttachments=yp,s.initializeIssueComments=wp,s.initializeIssueTypeAttachments=tm,s.initializeIssueTypeFieldValues=wm,s.initializeIssueTypeFieldValuesAttachments=iy,s.initializeIssueTypeFields=Hm,s.initializeIssueTypeFieldsAttachments=ym,s.initializeIssueTypeIdentifierValues=Ey,s.initializeIssueTypeIdentifiers=fy,s.initializeIssueTypePriorities=Gy,s.initializeIssueTypeStatuses=Af,s.initializeIssueTypes=af,s.initializeIssueUpdates=vf,s.initializeIssues=Lp,s.initializeOrganizationAccesses=Qf,s.initializeOrganizations=hS,s.initializeProcedureFieldValues=gP,s.initializeProcedureFieldValuesAttachments=mP,s.initializeProcedureInitiatives=YA,s.initializeProcedureStepAssignees=_T,s.initializeProcedureStepComments=$T,s.initializeProcedureStepDefaultAssignees=xT,s.initializeProcedureStepDefaultReviewers=pI,s.initializeProcedureStepEvents=gI,s.initializeProcedureStepFieldValues=Mb,s.initializeProcedureStepFieldValuesAttachments=pb,s.initializeProcedureStepFieldValuesReviews=Ub,s.initializeProcedureStepFields=eb,s.initializeProcedureStepFieldsAttachments=kI,s.initializeProcedureStepReviewers=xb,s.initializeProcedureSteps=pO,s.initializeProcedureTypeAttachments=MO,s.initializeProcedureTypeFields=eP,s.initializeProcedureTypeFieldsAttachments=UO,s.initializeProcedureTypes=kP,s.initializeProcedures=uT,s.initializeProjectAccesses=BS,s.initializeProjectAttachments=KS,s.initializeProjectComments=cA,s.initializeProjectFiles=IA,s.initializeProjects=jA,s.initializeReports=sF,s.initializeTeamMemberships=SF,s.initializeTeams=vF,s.initializeUsers=kf,s.isCloudfrontUrl=n_,s.isImageFile=Hg,s.isObjectUrl=a_,s.isPresignedUrlExpired=d_,s.isS3Url=c_,s.issueAssociationReducer=ep,s.issueAssociationSlice=Oi,s.issueAttachmentReducer=pp,s.issueAttachmentSlice=Pi,s.issueCommentAttachmentReducer=gp,s.issueCommentAttachmentSlice=gi,s.issueCommentReducer=Up,s.issueCommentSlice=wi,s.issueReducer=xp,s.issueSlice=vi,s.issueTypeAttachmentReducer=pm,s.issueTypeAttachmentSlice=zi,s.issueTypeFieldValuesAttachmentReducer=my,s.issueTypeFieldValuesAttachmentSlice=Ui,s.issueTypeFieldValuesReducer=km,s.issueTypeFieldValuesSlice=qi,s.issueTypeFieldsAttachmentReducer=gm,s.issueTypeFieldsAttachmentSlice=Ci,s.issueTypeFieldsReducer=ty,s.issueTypeFieldsSlice=$i,s.issueTypeIdentifierReducer=Ry,s.issueTypeIdentifierSlice=Gi,s.issueTypeIdentifierValueReducer=Ly,s.issueTypeIdentifierValueSlice=Ki,s.issueTypePriorityReducer=tf,s.issueTypePrioritySlice=Wi,s.issueTypeReducer=ff,s.issueTypeSlice=Zi,s.issueTypeStatusReducer=wf,s.issueTypeStatusSlice=Qi,s.issueUpdateReducer=$f,s.issueUpdateSlice=ta,s.markAsDeleted=wS,s.markForDeletion=zM,s.organizationAccessReducer=rS,s.organizationAccessSlice=ha,s.organizationReducer=_S,s.organizationSlice=pa,s.outboxReducer=vS,s.outboxSlice=ma,s.overmapEnhancer=jg,s.overmapReducer=vg,s.overmapReducers=GF,s.performRequest=An,s.performRequestFromAction=ZF,s.procedureFieldValuesAttachmentReducer=bP,s.procedureFieldValuesAttachmentSlice=en,s.procedureFieldValuesReducer=CP,s.procedureFieldValuesSlice=nn,s.procedureInitiativeReducer=aT,s.procedureInitiativeSlice=Oa,s.procedureReducer=fT,s.procedureSlice=Pa,s.procedureStepAssigneeReducer=DT,s.procedureStepAssigneeSlice=Fa,s.procedureStepCommentReducer=JT,s.procedureStepCommentSlice=_a,s.procedureStepDefaultAssigneeReducer=oI,s.procedureStepDefaultAssigneeSlice=Ma,s.procedureStepDefaultReviewerReducer=_I,s.procedureStepDefaultReviewerSlice=Ra,s.procedureStepEventReducer=$I,s.procedureStepEventSlice=Ea,s.procedureStepFieldValuesAttachmentReducer=Fb,s.procedureStepFieldValuesAttachmentSlice=Da,s.procedureStepFieldValuesReducer=jb,s.procedureStepFieldValuesReviewReducer=Jb,s.procedureStepFieldValuesReviewSlice=La,s.procedureStepFieldValuesSlice=ka,s.procedureStepFieldsAttachmentReducer=QI,s.procedureStepFieldsAttachmentSlice=va,s.procedureStepFieldsReducer=ob,s.procedureStepFieldsSlice=ja,s.procedureStepReducer=OO,s.procedureStepReviewerReducer=oO,s.procedureStepReviewerSlice=Na,s.procedureStepSlice=Ka,s.procedureTypeAttachmentReducer=jO,s.procedureTypeAttachmentSlice=Ya,s.procedureTypeFieldsAttachmentReducer=YO,s.procedureTypeFieldsAttachmentSlice=Ja,s.procedureTypeFieldsReducer=uP,s.procedureTypeFieldsSlice=xa,s.procedureTypeReducer=ZP,s.procedureTypeSlice=rn,s.projectAccessReducer=LS,s.projectAccessSlice=ya,s.projectAttachmentReducer=aA,s.projectAttachmentSlice=Sa,s.projectCommentReducer=AA,s.projectCommentSlice=Ta,s.projectFileReducer=BA,s.projectFileSlice=Ia,s.projectReducer=GA,s.projectSlice=ba,s.rehydratedReducer=eF,s.rehydratedSlice=un,s.reportReducer=yF,s.reportSlice=ln,s.restructureSelectorWithArgs=m,s.runMiddleware=A_,s.selectAccessToken=W_,s.selectAccessesByUserOfProject=CM,s.selectAccessibleProjects=kM,s.selectActiveOrganizationAccess=EM,s.selectAllDocumentAttachments=ks,s.selectAssetAttachmentById=qn,s.selectAssetAttachmentMapping=Dn,s.selectAssetAttachments=ms,s.selectAssetAttachmentsByIds=$n,s.selectAssetById=Mc,s.selectAssetCommentAttachmentById=xn,s.selectAssetCommentAttachmentMapping=Qn,s.selectAssetCommentAttachments=fs,s.selectAssetCommentAttachmentsByIds=ec,s.selectAssetCommentById=oc,s.selectAssetCommentMapping=lc,s.selectAssetComments=qt,s.selectAssetCommentsByIds=hc,s.selectAssetTypeAttachmentById=qc,s.selectAssetTypeAttachmentMapping=Dc,s.selectAssetTypeAttachments=Fs,s.selectAssetTypeAttachmentsByIds=$c,s.selectAssetTypeById=Rd,s.selectAssetTypeFieldValues=Ut,s.selectAssetTypeFieldValuesAttachmentById=_r,s.selectAssetTypeFieldValuesAttachments=vs,s.selectAssetTypeFieldValuesAttachmentsByIds=Mr,s.selectAssetTypeFieldValuesAttachmentsMapping=Fr,s.selectAssetTypeFieldValuesById=Ur,s.selectAssetTypeFieldValuesByIds=kr,s.selectAssetTypeFieldValuesMapping=$r,s.selectAssetTypeFieldValuesOfAsset=q_,s.selectAssetTypeFields=Mt,s.selectAssetTypeFieldsAttachmentById=xc,s.selectAssetTypeFieldsAttachments=Ms,s.selectAssetTypeFieldsAttachmentsByIds=er,s.selectAssetTypeFieldsAttachmentsMapping=Qc,s.selectAssetTypeFieldsById=pr,s.selectAssetTypeFieldsByIds=mr,s.selectAssetTypeFieldsMapping=hr,s.selectAssetTypeFieldsOfAssetType=C_,s.selectAssetTypeIdentifierById=ed,s.selectAssetTypeIdentifierMapping=xr,s.selectAssetTypeIdentifierValueById=md,s.selectAssetTypeIdentifierValueMapping=pd,s.selectAssetTypeIdentifierValues=kt,s.selectAssetTypeIdentifierValuesByIds=yd,s.selectAssetTypeIdentifierValuesOfAsset=k_,s.selectAssetTypeIdentifierValuesOfIdentifier=L_,s.selectAssetTypeIdentifiers=zs,s.selectAssetTypeIdentifiersByIds=td,s.selectAssetTypeIdentifiersOfAssetType=U_,s.selectAssetTypeStatusById=Ld,s.selectAssetTypeStatusMapping=kd,s.selectAssetTypeStatuses=$s,s.selectAssetTypeStatusesByIds=Hd,s.selectAssetTypeStatusesOfAssetType=G_,s.selectAssetTypeValuesOfAssetType=$_,s.selectAssetTypes=Ds,s.selectAssetTypesByIds=wd,s.selectAssetTypesMapping=gd,s.selectAssetTypesOfOrganization=H_,s.selectAssets=$t,s.selectAssetsByIds=gc,s.selectAssetsMapping=Fc,s.selectAssetsOfAssetType=_c,s.selectAssetsOfProject=z_,s.selectAttachmentsOfAsset=Un,s.selectAttachmentsOfAssetComment=B_,s.selectAttachmentsOfAssetType=Uc,s.selectAttachmentsOfAssetTypeFieldValues=gr,s.selectAttachmentsOfAssetTypeFields=j_,s.selectAttachmentsOfDocument=Y_,s.selectAttachmentsOfFormRevision=sM,s.selectAttachmentsOfFormSubmissionComment=cM,s.selectAttachmentsOfFormSubmissionFieldValues=Io,s.selectAttachmentsOfIssue=lp,s.selectAttachmentsOfIssueComment=pM,s.selectAttachmentsOfIssueType=fM,s.selectAttachmentsOfIssueTypeFieldValues=py,s.selectAttachmentsOfIssueTypeFields=SM,s.selectAttachmentsOfProcedureFieldValues=_P,s.selectAttachmentsOfProcedureStepFieldValues=Pb,s.selectAttachmentsOfProcedureStepFields=YI,s.selectAttachmentsOfProcedureType=Ag,s.selectAttachmentsOfProcedureTypeFields=Tg,s.selectAttachmentsOfProject=qM,s.selectCommentsOfAsset=pc,s.selectCommentsOfAssets=mc,s.selectCommentsOfFormSubmission=ch,s.selectCommentsOfFormSubmissions=rM,s.selectCommentsOfIssue=mM,s.selectCommentsOfProject=$M,s.selectCommentsOfProjects=UM,s.selectConversation=V_,s.selectConversationMapping=ls,s.selectConversations=v_,s.selectCurrentUser=Yf,s.selectDeletedRequests=VM,s.selectDescendantsOfDocument=bu,s.selectDocumentAttachmentById=nu,s.selectDocumentAttachmentMapping=au,s.selectDocumentAttachmentsByIds=cu,s.selectDocumentById=Tu,s.selectDocuments=Ht,s.selectDocumentsByIds=Iu,s.selectDocumentsMapping=Hs,s.selectEmailDomainById=Bu,s.selectEmailDomains=Ns,s.selectEmailDomainsAsMapping=Vu,s.selectEmailDomainsByIds=zu,s.selectEmailDomainsOfOrganization=Q_,s.selectFieldValuesOfProcedure=Og,s.selectFormById=uo,s.selectFormIdentifierById=Wu,s.selectFormIdentifierMapping=Ku,s.selectFormIdentifierValueById=rl,s.selectFormIdentifierValueMapping=cl,s.selectFormIdentifierValues=Gt,s.selectFormIdentifierValuesByIds=dl,s.selectFormIdentifierValuesOfFormSubmission=eM,s.selectFormIdentifierValuesOfIdentifier=tM,s.selectFormIdentifiers=Ws,s.selectFormIdentifiersByIds=Xu,s.selectFormIdentifiersOfForm=x_,s.selectFormMapping=ro,s.selectFormRevisionAttachmentById=bl,s.selectFormRevisionAttachments=Il,s.selectFormRevisionAttachmentsByIds=Ol,s.selectFormRevisionAttachmentsMapping=Nt,s.selectFormRevisionById=Bl,s.selectFormRevisionMapping=Vl,s.selectFormRevisions=Kt,s.selectFormRevisionsByIds=zl,s.selectFormRevisionsOfForm=jl,s.selectFormSubmissionById=Sh,s.selectFormSubmissionCommentAttachmentById=Ko,s.selectFormSubmissionCommentAttachmentMapping=No,s.selectFormSubmissionCommentAttachments=yi,s.selectFormSubmissionCommentAttachmentsByIds=Wo,s.selectFormSubmissionCommentById=ah,s.selectFormSubmissionCommentMapping=ih,s.selectFormSubmissionComments=Xt,s.selectFormSubmissionCommentsByIds=nh,s.selectFormSubmissionFieldValues=pi,s.selectFormSubmissionFieldValuesAttachmentById=To,s.selectFormSubmissionFieldValuesAttachments=di,s.selectFormSubmissionFieldValuesAttachmentsByIds=ui,s.selectFormSubmissionFieldValuesAttachmentsMapping=ri,s.selectFormSubmissionFieldValuesById=vo,s.selectFormSubmissionFieldValuesByIds=Vo,s.selectFormSubmissionFieldValuesMapping=Eo,s.selectFormSubmissionFieldValuesOfFormSubmission=Bo,s.selectFormSubmissions=C,s.selectFormSubmissionsByIds=Ah,s.selectFormSubmissionsMapping=fh,s.selectFormSubmissionsOfAsset=Oh,s.selectFormSubmissionsOfAssets=Ph,s.selectFormSubmissionsOfForm=Th,s.selectFormSubmissionsOfIssue=Ih,s.selectFormSubmissionsOfIssues=bh,s.selectFormSubmissionsOfOrganization=dM,s.selectFormSubmissionsOfOrganizationAndForm=oM,s.selectFormSubmissionsOfProject=uM,s.selectFormSubmissionsOfProjectAndForm=lM,s.selectFormSubscriberById=Kl,s.selectFormSubscriberMapping=Nl,s.selectFormSubscribers=Wt,s.selectFormSubscribersByIds=Wl,s.selectFormSubscribersOfForm=Xl,s.selectFormSubscribersOfUser=aM,s.selectForms=ii,s.selectFormsByIds=lo,s.selectFormsOfOrganization=nM,s.selectGeoImageById=Ch,s.selectGeoImageMapping=jh,s.selectGeoImages=bi,s.selectGeoImagesByIds=Dh,s.selectGeoImagesOfProject=hM,s.selectIsLoggedIn=X_,s.selectIssueAssociationById=Xh,s.selectIssueAssociationMapping=Wh,s.selectIssueAssociations=It,s.selectIssueAssociationsByIds=Yh,s.selectIssueAssociationsOfAsset=Qh,s.selectIssueAssociationsOfAssets=xh,s.selectIssueAssociationsOfIssue=Jh,s.selectIssueAssociationsOfIssues=Zh,s.selectIssueAttachmentById=op,s.selectIssueAttachmentMapping=up,s.selectIssueAttachments=Mi,s.selectIssueAttachmentsByIds=hp,s.selectIssueById=Zp,s.selectIssueCommentAttachmentById=_p,s.selectIssueCommentAttachmentMapping=Fp,s.selectIssueCommentAttachments=Ri,s.selectIssueCommentAttachmentsByIds=Mp,s.selectIssueCommentById=qp,s.selectIssueCommentMapping=Ei,s.selectIssueCommentsByIds=$p,s.selectIssueMapping=Yp,s.selectIssueTypeAttachmentById=om,s.selectIssueTypeAttachmentMapping=lm,s.selectIssueTypeAttachments=ji,s.selectIssueTypeAttachmentsByIds=hm,s.selectIssueTypeById=mf,s.selectIssueTypeFieldValues=Zt,s.selectIssueTypeFieldValuesAttachmentById=oy,s.selectIssueTypeFieldValuesAttachments=Hi,s.selectIssueTypeFieldValuesAttachmentsByIds=hy,s.selectIssueTypeFieldValuesAttachmentsMapping=ly,s.selectIssueTypeFieldValuesById=$m,s.selectIssueTypeFieldValuesByIds=Um,s.selectIssueTypeFieldValuesMapping=qm,s.selectIssueTypeFieldValuesOfIssue=AM,s.selectIssueTypeFields=gt,s.selectIssueTypeFieldsAttachmentById=_m,s.selectIssueTypeFieldsAttachments=Di,s.selectIssueTypeFieldsAttachmentsByIds=Mm,s.selectIssueTypeFieldsAttachmentsMapping=Fm,s.selectIssueTypeFieldsById=xm,s.selectIssueTypeFieldsByIds=ey,s.selectIssueTypeFieldsMapping=Qm,s.selectIssueTypeFieldsOfIssueType=TM,s.selectIssueTypeIdentifierById=My,s.selectIssueTypeIdentifierMapping=_y,s.selectIssueTypeIdentifierValueById=Uy,s.selectIssueTypeIdentifierValueMapping=$y,s.selectIssueTypeIdentifierValues=Jt,s.selectIssueTypeIdentifierValuesByIds=ky,s.selectIssueTypeIdentifierValuesOfIdentifier=FM,s.selectIssueTypeIdentifierValuesOfIssue=PM,s.selectIssueTypeIdentifiers=Ni,s.selectIssueTypeIdentifiersByIds=gy,s.selectIssueTypeIdentifiersOfIssueType=OM,s.selectIssueTypeMapping=pf,s.selectIssueTypePriorities=Xi,s.selectIssueTypePrioritiesByIds=ef,s.selectIssueTypePrioritiesOfIssueType=_M,s.selectIssueTypePriorityById=Yi,s.selectIssueTypePriorityMapping=xy,s.selectIssueTypeStatusById=ea,s.selectIssueTypeStatusMapping=gf,s.selectIssueTypeStatuses=xi,s.selectIssueTypeStatusesByIds=Rf,s.selectIssueTypeStatusesOfIssueType=gM,s.selectIssueTypeValuesOfIssueType=bM,s.selectIssueTypes=Ji,s.selectIssueTypesByIds=yf,s.selectIssueTypesOfOrganization=MM,s.selectIssueUpdateById=Cf,s.selectIssueUpdateMapping=ca,s.selectIssueUpdates=ra,s.selectIssueUpdatesByIds=Df,s.selectIssueUpdatesOfIssue=qf,s.selectIssues=Yt,s.selectIssuesByIds=Jp,s.selectIssuesOfIssueType=Qp,s.selectIssuesOfProject=yM,s.selectLatestAssetTypeFieldsOfAssetType=D_,s.selectLatestFieldsByProcedureStep=ng,s.selectLatestFormRevisionOfForm=iM,s.selectLatestIssueTypeFieldsOfIssueType=IM,s.selectLatestProcedureStepFieldValuesReviewByProcedureStepFieldValues=hg,s.selectLatestProcedureStepFieldsOfProcedureStep=ag,s.selectLatestProcedureTypeFieldsOfProcedureType=bg,s.selectLatestRetryTime=BM,s.selectLatestReviewOfProcedureStepFieldValues=ug,s.selectMembershipsByUserOfTeam=gg,s.selectOrganizationAccessById=dS,s.selectOrganizationAccessMapping=es,s.selectOrganizationAccessUserMapping=lS,s.selectOrganizationAccessesByIds=uS,s.selectOrganizationById=PS,s.selectOrganizationDocuments=J_,s.selectOrganizations=OS,s.selectOrganizationsByIds=FS,s.selectOrganizationsMapping=bS,s.selectProcedureById=AT,s.selectProcedureFieldValues=cn,s.selectProcedureFieldValuesAttachmentById=PP,s.selectProcedureFieldValuesAttachments=an,s.selectProcedureFieldValuesAttachmentsByIds=FP,s.selectProcedureFieldValuesAttachmentsMapping=OP,s.selectProcedureFieldValuesById=qP,s.selectProcedureFieldValuesByIds=$P,s.selectProcedureFieldValuesMapping=DP,s.selectProcedureInitiativeById=cT,s.selectProcedureInitiatives=is,s.selectProcedureInitiativesByIds=rT,s.selectProcedureInitiativesMapping=nT,s.selectProcedureInitiativesOfProcedureType=GM,s.selectProcedureInitiativesOfProject=HM,s.selectProcedureStepAssigneeById=jT,s.selectProcedureStepAssignees=wt,s.selectProcedureStepAssigneesByIds=CT,s.selectProcedureStepAssigneesMapping=zT,s.selectProcedureStepAssigneesOfProcedure=KM,s.selectProcedureStepAssigneesOfProcedureAndProcedureStep=XM,s.selectProcedureStepAssigneesOfProcedureStep=WM,s.selectProcedureStepById=PO,s.selectProcedureStepCommentById=YT,s.selectProcedureStepComments=Et,s.selectProcedureStepCommentsByIds=ZT,s.selectProcedureStepCommentsMapping=XT,s.selectProcedureStepCommentsOfProcedure=YM,s.selectProcedureStepCommentsOfProcedureAndProcedureStep=JM,s.selectProcedureStepCommentsOfProcedureStep=ZM,s.selectProcedureStepDefaultAssigneeById=uI,s.selectProcedureStepDefaultAssignees=ga,s.selectProcedureStepDefaultAssigneesByIds=lI,s.selectProcedureStepDefaultAssigneesMapping=dI,s.selectProcedureStepDefaultAssigneesOfProcedureStep=QM,s.selectProcedureStepDefaultReviewerById=PI,s.selectProcedureStepDefaultReviewers=wa,s.selectProcedureStepDefaultReviewersByIds=FI,s.selectProcedureStepDefaultReviewersMapping=OI,s.selectProcedureStepDefaultReviewersOfProcedureStep=xM,s.selectProcedureStepEventById=DI,s.selectProcedureStepEvents=vt,s.selectProcedureStepEventsByIds=qI,s.selectProcedureStepEventsMapping=CI,s.selectProcedureStepEventsOfProcedure=eg,s.selectProcedureStepEventsOfProcedureAndProcedureStep=sg,s.selectProcedureStepEventsOfProcedureStep=tg,s.selectProcedureStepFieldValues=pt,s.selectProcedureStepFieldValuesAttachmentById=bb,s.selectProcedureStepFieldValuesAttachments=Ua,s.selectProcedureStepFieldValuesAttachmentsByIds=Ob,s.selectProcedureStepFieldValuesAttachmentsMapping=Ib,s.selectProcedureStepFieldValuesById=Db,s.selectProcedureStepFieldValuesByIds=qb,s.selectProcedureStepFieldValuesMapping=Cb,s.selectProcedureStepFieldValuesOfProcedure=cg,s.selectProcedureStepFieldValuesOfProcedureAndProcedureStep=dg,s.selectProcedureStepFieldValuesOfProcedureStep=rg,s.selectProcedureStepFieldValuesReviewById=Xb,s.selectProcedureStepFieldValuesReviews=mt,s.selectProcedureStepFieldValuesReviewsByIds=Yb,s.selectProcedureStepFieldValuesReviewsMapping=Wb,s.selectProcedureStepFieldValuesReviewsOfProcedure=lg,s.selectProcedureStepFieldValuesReviewsOfProcedureAndProcedureStep=og,s.selectProcedureStepFields=as,s.selectProcedureStepFieldsAttachmentById=ZI,s.selectProcedureStepFieldsAttachments=za,s.selectProcedureStepFieldsAttachmentsByIds=JI,s.selectProcedureStepFieldsAttachmentsMapping=XI,s.selectProcedureStepFieldsById=ub,s.selectProcedureStepFieldsByIds=lb,s.selectProcedureStepFieldsMapping=Ca,s.selectProcedureStepFieldsOfProcedureStep=ig,s.selectProcedureStepReviewerById=uO,s.selectProcedureStepReviewers=Vt,s.selectProcedureStepReviewersByIds=lO,s.selectProcedureStepReviewersMapping=dO,s.selectProcedureStepReviewersOfProcedure=pg,s.selectProcedureStepReviewersOfProcedureAndProcedureStep=yg,s.selectProcedureStepReviewersOfProcedureStep=mg,s.selectProcedureSteps=Xa,s.selectProcedureStepsByIds=FO,s.selectProcedureStepsMapping=Wa,s.selectProcedureStepsMappingOfProcedureType=fg,s.selectProcedureStepsOfProcedureType=Sg,s.selectProcedureTypeAttachmentById=DO,s.selectProcedureTypeAttachmentMapping=CO,s.selectProcedureTypeAttachments=Za,s.selectProcedureTypeAttachmentsByIds=qO,s.selectProcedureTypeById=QP,s.selectProcedureTypeFields=ns,s.selectProcedureTypeFieldsAttachmentById=JO,s.selectProcedureTypeFieldsAttachments=Qa,s.selectProcedureTypeFieldsAttachmentsByIds=QO,s.selectProcedureTypeFieldsAttachmentsMapping=ZO,s.selectProcedureTypeFieldsById=oP,s.selectProcedureTypeFieldsByIds=hP,s.selectProcedureTypeFieldsMapping=lP,s.selectProcedureTypeFieldsOfProcedureType=Ig,s.selectProcedureTypes=dn,s.selectProcedureTypesByIds=xP,s.selectProcedureTypesMapping=JP,s.selectProcedureTypesOfOrganization=Pg,s.selectProcedures=ht,s.selectProceduresByIds=TT,s.selectProceduresMapping=ST,s.selectProceduresOfAsset=bT,s.selectProceduresOfAssets=OT,s.selectProceduresOfProcedureInitiative=PT,s.selectProceduresOfProcedureType=IT,s.selectProceduresOfProject=NM,s.selectProjectAccessById=HS,s.selectProjectAccessMapping=fa,s.selectProjectAccesses=Rt,s.selectProjectAccessesByIds=GS,s.selectProjectAccessesOfProject=jM,s.selectProjectAttachmentById=sA,s.selectProjectAttachmentMapping=tA,s.selectProjectAttachments=Aa,s.selectProjectAttachmentsByIds=iA,s.selectProjectById=KA,s.selectProjectCommentById=fA,s.selectProjectCommentMapping=yA,s.selectProjectComments=ts,s.selectProjectCommentsByIds=SA,s.selectProjectDocuments=Z_,s.selectProjectFileById=vA,s.selectProjectFileMapping=wA,s.selectProjectFiles=EA,s.selectProjectFilesByIds=VA,s.selectProjectMapping=NA,s.selectProjects=ss,s.selectProjectsByIds=WA,s.selectProjectsOfOrganization=LM,s.selectRehydrated=Mg,s.selectReportById=pF,s.selectReportMapping=oF,s.selectReports=hF,s.selectReportsByIds=mF,s.selectReviewsOfProcedureStepFieldValues=Zb,s.selectTeamById=kF,s.selectTeamMembershipById=RF,s.selectTeamMemberships=cs,s.selectTeamMembershipsByIds=wF,s.selectTeamMembershipsMapping=gF,s.selectTeams=pn,s.selectTeamsByIds=LF,s.selectTeamsMapping=UF,s.selectTeamsOfOrganization=wg,s.selectUserById=xt,s.selectUsers=Qt,s.selectUsersByIds=Zf,s.selectUsersMapping=oa,s.selectUsersOfOrganization=vM,s.selectUsersOfProject=DM,s.selectUsersOfTeam=Rg,s.setAsset=Oc,s.setAssetAttachment=Vn,s.setAssetAttachments=Bn,s.setAssetComment=nc,s.setAssetCommentAttachment=Kn,s.setAssetCommentAttachments=Wn,s.setAssetComments=cc,s.setAssetType=Td,s.setAssetTypeAttachment=Vc,s.setAssetTypeAttachments=Bc,s.setAssetTypeFieldValues=Br,s.setAssetTypeFieldValuesAttachment=Tr,s.setAssetTypeFieldValuesAttachments=Ir,s.setAssetTypeFieldValuesMany=zr,s.setAssetTypeFields=cr,s.setAssetTypeFieldsAttachment=Kc,s.setAssetTypeFieldsAttachments=Wc,s.setAssetTypeFieldsMany=rr,s.setAssetTypeIdentifier=Wr,s.setAssetTypeIdentifierValue=rd,s.setAssetTypeIdentifierValues=dd,s.setAssetTypeIdentifiers=Xr,s.setAssetTypeStatus=jd,s.setAssetTypeStatuses=Cd,s.setAssetTypes=Id,s.setAssets=Pc,s.setClientSDK=p_,s.setClientStore=o_,s.setConversation=Mn,s.setConversations=g_,s.setCurrentUser=RM,s.setCurrentUserProfile=wM,s.setDocument=hu,s.setDocumentAttachment=Qd,s.setDocumentAttachments=xd,s.setDocuments=pu,s.setEmailDomain=Mu,s.setEmailDomains=gu,s.setForm=eo,s.setFormIdentifier=Uu,s.setFormIdentifierValue=el,s.setFormIdentifierValues=tl,s.setFormIdentifiers=ku,s.setFormRevision=gl,s.setFormRevisionAttachment=ml,s.setFormRevisionAttachments=yl,s.setFormRevisions=Rl,s.setFormSubmission=lh,s.setFormSubmissionComment=Qo,s.setFormSubmissionCommentAttachment=$o,s.setFormSubmissionCommentAttachments=Uo,s.setFormSubmissionComments=xo,s.setFormSubmissionFieldValues=_o,s.setFormSubmissionFieldValuesAttachment=mo,s.setFormSubmissionFieldValuesAttachments=yo,s.setFormSubmissionFieldValuesMany=Mo,s.setFormSubmissions=oh,s.setFormSubscriber=Ul,s.setFormSubscribers=kl,s.setForms=to,s.setGeoImage=gh,s.setGeoImages=Rh,s.setIssue=Gp,s.setIssueAssociation=Lh,s.setIssueAssociations=kh,s.setIssueAttachment=ap,s.setIssueAttachments=np,s.setIssueComment=Vp,s.setIssueCommentAttachment=Ap,s.setIssueCommentAttachments=Tp,s.setIssueComments=Bp,s.setIssueType=rf,s.setIssueTypeAttachment=am,s.setIssueTypeAttachments=nm,s.setIssueTypeFieldValues=Vm,s.setIssueTypeFieldValuesAttachment=ny,s.setIssueTypeFieldValuesAttachments=cy,s.setIssueTypeFieldValuesMany=Bm,s.setIssueTypeFields=Km,s.setIssueTypeFieldsAttachment=Am,s.setIssueTypeFieldsAttachments=Tm,s.setIssueTypeFieldsMany=Wm,s.setIssueTypeIdentifier=Ty,s.setIssueTypeIdentifierValue=By,s.setIssueTypeIdentifierValues=zy,s.setIssueTypeIdentifiers=Iy,s.setIssueTypePriorities=Xy,s.setIssueTypePriority=Wy,s.setIssueTypeStatus=bf,s.setIssueTypeStatuses=Of,s.setIssueTypes=df,s.setIssueUpdate=Vf,s.setIssueUpdates=Bf,s.setIssues=Np,s.setLoggedIn=Kd,s.setOrganization=mS,s.setOrganizationAccess=tS,s.setOrganizationAccesses=sS,s.setOrganizations=pS,s.setProcedure=oT,s.setProcedureFieldValues=EP,s.setProcedureFieldValuesAttachment=fP,s.setProcedureFieldValuesAttachments=SP,s.setProcedureFieldValuesMany=vP,s.setProcedureInitiative=QA,s.setProcedureInitiatives=xA,s.setProcedureStep=mO,s.setProcedureStepAssignee=RT,s.setProcedureStepAssignees=wT,s.setProcedureStepComment=LT,s.setProcedureStepComments=HT,s.setProcedureStepDefaultAssignee=sI,s.setProcedureStepDefaultAssignees=iI,s.setProcedureStepDefaultReviewer=fI,s.setProcedureStepDefaultReviewers=SI,s.setProcedureStepEvent=EI,s.setProcedureStepEvents=vI,s.setProcedureStepFieldValues=wb,s.setProcedureStepFieldValuesAttachment=yb,s.setProcedureStepFieldValuesAttachments=fb,s.setProcedureStepFieldValuesMany=Eb,s.setProcedureStepFieldValuesReview=Lb,s.setProcedureStepFieldValuesReviews=Hb,s.setProcedureStepFields=ib,s.setProcedureStepFieldsAttachment=HI,s.setProcedureStepFieldsAttachments=GI,s.setProcedureStepFieldsMany=ab,s.setProcedureStepReviewer=sO,s.setProcedureStepReviewers=iO,s.setProcedureSteps=yO,s.setProcedureType=GP,s.setProcedureTypeAttachment=wO,s.setProcedureTypeAttachments=EO,s.setProcedureTypeFields=iP,s.setProcedureTypeFieldsAttachment=HO,s.setProcedureTypeFieldsAttachments=GO,s.setProcedureTypeFieldsMany=aP,s.setProcedureTypes=NP,s.setProcedures=hT,s.setProject=DA,s.setProjectAccess=CS,s.setProjectAccesses=DS,s.setProjectAttachment=YS,s.setProjectAttachments=ZS,s.setProjectComment=uA,s.setProjectComments=lA,s.setProjectFile=bA,s.setProjectFiles=OA,s.setProjects=CA,s.setRehydrated=_g,s.setReport=nF,s.setReports=cF,s.setTeam=zF,s.setTeamMembership=IF,s.setTeamMemberships=bF,s.setTeams=jF,s.setTokens=N_,s.setUser=Hf,s.setUsers=Lf,s.teamMembershipReducer=MF,s.teamMembershipSlice=on,s.teamReducer=HF,s.teamSlice=hn,s.updateAsset=Tc,s.updateAssetAttachment=zn,s.updateAssetAttachments=jn,s.updateAssetComment=rc,s.updateAssetCommentAttachment=Xn,s.updateAssetCommentAttachments=Yn,s.updateAssetComments=dc,s.updateAssetType=Pd,s.updateAssetTypeAttachment=zc,s.updateAssetTypeAttachments=jc,s.updateAssetTypeFieldValues=jr,s.updateAssetTypeFieldValuesAttachment=br,s.updateAssetTypeFieldValuesAttachments=Or,s.updateAssetTypeFieldValuesMany=Cr,s.updateAssetTypeFields=dr,s.updateAssetTypeFieldsAttachment=Xc,s.updateAssetTypeFieldsAttachments=Yc,s.updateAssetTypeFieldsMany=ur,s.updateAssetTypeIdentifier=Yr,s.updateAssetTypeIdentifierValue=ud,s.updateAssetTypeIdentifierValues=ld,s.updateAssetTypeIdentifiers=Zr,s.updateAssetTypeStatus=Dd,s.updateAssetTypeStatuses=qd,s.updateAssetTypes=Fd,s.updateAssets=Ic,s.updateConversation=gn,s.updateConversations=R_,s.updateDocument=mu,s.updateDocumentAttachment=eu,s.updateDocumentAttachments=tu,s.updateDocuments=yu,s.updateEmailDomain=Ru,s.updateEmailDomains=wu,s.updateForm=so,s.updateFormIdentifier=Lu,s.updateFormIdentifierValue=sl,s.updateFormIdentifierValues=il,s.updateFormIdentifiers=Hu,s.updateFormRevision=wl,s.updateFormRevisionAttachment=fl,s.updateFormRevisionAttachments=Sl,s.updateFormRevisions=El,s.updateFormSubmission=ph,s.updateFormSubmissionComment=eh,s.updateFormSubmissionCommentAttachment=ko,s.updateFormSubmissionCommentAttachments=Lo,s.updateFormSubmissionComments=th,s.updateFormSubmissionFieldValues=go,s.updateFormSubmissionFieldValuesAttachment=fo,s.updateFormSubmissionFieldValuesAttachments=So,s.updateFormSubmissionFieldValuesMany=Ro,s.updateFormSubmissions=mh,s.updateFormSubscriber=Ll,s.updateFormSubscribers=Hl,s.updateForms=io,s.updateGeoImage=vh,s.updateGeoImages=Vh,s.updateIssue=Kp,s.updateIssueAssociation=Hh,s.updateIssueAssociations=Gh,s.updateIssueAttachment=cp,s.updateIssueAttachments=rp,s.updateIssueComment=zp,s.updateIssueCommentAttachment=Ip,s.updateIssueCommentAttachments=bp,s.updateIssueComments=jp,s.updateIssueType=uf,s.updateIssueTypeAttachment=cm,s.updateIssueTypeAttachments=rm,s.updateIssueTypeFieldValues=zm,s.updateIssueTypeFieldValuesAttachment=ry,s.updateIssueTypeFieldValuesAttachments=dy,s.updateIssueTypeFieldValuesMany=jm,s.updateIssueTypeFields=Xm,s.updateIssueTypeFieldsAttachment=Im,s.updateIssueTypeFieldsAttachments=bm,s.updateIssueTypeFieldsMany=Ym,s.updateIssueTypeIdentifier=by,s.updateIssueTypeIdentifierValue=jy,s.updateIssueTypeIdentifierValues=Cy,s.updateIssueTypeIdentifiers=Oy,s.updateIssueTypePriorities=Zy,s.updateIssueTypePriority=Yy,s.updateIssueTypeStatus=Pf,s.updateIssueTypeStatuses=Ff,s.updateIssueTypes=lf,s.updateIssueUpdate=zf,s.updateIssueUpdates=jf,s.updateIssues=Wp,s.updateOrganization=AS,s.updateOrganizationAccess=iS,s.updateOrganizationAccesses=aS,s.updateOrganizations=SS,s.updateProcedure=pT,s.updateProcedureFieldValues=VP,s.updateProcedureFieldValuesAttachment=AP,s.updateProcedureFieldValuesAttachments=TP,s.updateProcedureFieldValuesMany=BP,s.updateProcedureInitiative=eT,s.updateProcedureInitiatives=tT,s.updateProcedureStep=AO,s.updateProcedureStepAssignee=ET,s.updateProcedureStepAssignees=vT,s.updateProcedureStepComment=GT,s.updateProcedureStepComments=NT,s.updateProcedureStepDefaultAssignee=aI,s.updateProcedureStepDefaultAssignees=nI,s.updateProcedureStepDefaultReviewer=AI,s.updateProcedureStepDefaultReviewers=TI,s.updateProcedureStepEvent=VI,s.updateProcedureStepEvents=BI,s.updateProcedureStepFieldValues=vb,s.updateProcedureStepFieldValuesAttachment=Sb,s.updateProcedureStepFieldValuesAttachments=Ab,s.updateProcedureStepFieldValuesMany=Vb,s.updateProcedureStepFieldValuesReview=Gb,s.updateProcedureStepFieldValuesReviews=Nb,s.updateProcedureStepFields=nb,s.updateProcedureStepFieldsAttachment=NI,s.updateProcedureStepFieldsAttachments=KI,s.updateProcedureStepFieldsMany=cb,s.updateProcedureStepReviewer=aO,s.updateProcedureStepReviewers=nO,s.updateProcedureSteps=TO,s.updateProcedureType=KP,s.updateProcedureTypeAttachment=vO,s.updateProcedureTypeAttachments=VO,s.updateProcedureTypeFields=nP,s.updateProcedureTypeFieldsAttachment=NO,s.updateProcedureTypeFieldsAttachments=KO,s.updateProcedureTypeFieldsMany=cP,s.updateProcedureTypes=WP,s.updateProcedures=mT,s.updateProject=kA,s.updateProjectAccess=qS,s.updateProjectAccesses=$S,s.updateProjectAttachment=JS,s.updateProjectAttachments=QS,s.updateProjectComment=oA,s.updateProjectComments=hA,s.updateProjectFile=_A,s.updateProjectFiles=MA,s.updateProjects=UA,s.updateReport=rF,s.updateReports=dF,s.updateTeam=CF,s.updateTeamMembership=OF,s.updateTeamMemberships=PF,s.updateTeams=DF,s.updateUser=Kf,s.updateUsers=Nf,s.userReducer=Xf,s.userSlice=da,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@overmap-ai/core",
3
- "version": "2.0.6",
3
+ "version": "2.0.7-project-annotated-models.0",
4
4
  "description": "Core functionality for Overmap",
5
5
  "keywords": [
6
6
  "components",