@overmap-ai/core 1.0.78-identifiers.0 → 1.0.78-identifiers.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/overmap-core.js +33 -0
- package/dist/overmap-core.umd.cjs +2 -2
- package/package.json +1 -1
package/dist/overmap-core.js
CHANGED
|
@@ -3667,6 +3667,7 @@ class BI extends He {
|
|
|
3667
3667
|
async refreshStore(s, i) {
|
|
3668
3668
|
const n = await this.enqueueRequest(
|
|
3669
3669
|
{
|
|
3670
|
+
immediate: !0,
|
|
3670
3671
|
description: "Get asset procedure attachments",
|
|
3671
3672
|
method: o.GET,
|
|
3672
3673
|
url: `${this.url}/`,
|
|
@@ -3735,6 +3736,7 @@ class LI extends V {
|
|
|
3735
3736
|
async refreshStore(e, s) {
|
|
3736
3737
|
const i = await this.enqueueRequest(
|
|
3737
3738
|
{
|
|
3739
|
+
immediate: !0,
|
|
3738
3740
|
description: "Get asset procedure fields attachments",
|
|
3739
3741
|
method: o.GET,
|
|
3740
3742
|
url: "/asset-procedure-fields-attachments/",
|
|
@@ -3775,6 +3777,7 @@ class NI extends v {
|
|
|
3775
3777
|
async refreshStore(e, s) {
|
|
3776
3778
|
const i = await this.enqueueRequest(
|
|
3777
3779
|
{
|
|
3780
|
+
immediate: !0,
|
|
3778
3781
|
description: "Get Asset Procedure Fields",
|
|
3779
3782
|
method: o.GET,
|
|
3780
3783
|
url: "/asset-procedure-fields/",
|
|
@@ -4197,6 +4200,7 @@ class YI extends v {
|
|
|
4197
4200
|
async refreshStore(e, s) {
|
|
4198
4201
|
const i = await this.enqueueRequest(
|
|
4199
4202
|
{
|
|
4203
|
+
immediate: !0,
|
|
4200
4204
|
description: "Get asset procedures",
|
|
4201
4205
|
method: o.GET,
|
|
4202
4206
|
url: "/asset-procedures/",
|
|
@@ -4265,6 +4269,7 @@ class ZI extends V {
|
|
|
4265
4269
|
async refreshStore(e, s) {
|
|
4266
4270
|
const i = await this.enqueueRequest(
|
|
4267
4271
|
{
|
|
4272
|
+
immediate: !0,
|
|
4268
4273
|
description: "Get asset procedure step fields attachments",
|
|
4269
4274
|
method: o.GET,
|
|
4270
4275
|
url: "/asset-procedure-step-fields-attachments/",
|
|
@@ -4344,6 +4349,7 @@ class JI extends v {
|
|
|
4344
4349
|
async refreshStore(e, s) {
|
|
4345
4350
|
const i = await this.enqueueRequest(
|
|
4346
4351
|
{
|
|
4352
|
+
immediate: !0,
|
|
4347
4353
|
description: "Get Asset Procedure Step Fields",
|
|
4348
4354
|
method: o.GET,
|
|
4349
4355
|
url: "/asset-procedure-step-fields/",
|
|
@@ -4673,6 +4679,7 @@ class e_ extends v {
|
|
|
4673
4679
|
async refreshStore(e, s) {
|
|
4674
4680
|
const i = await this.enqueueRequest(
|
|
4675
4681
|
{
|
|
4682
|
+
immediate: !0,
|
|
4676
4683
|
description: "Get asset procedure steps",
|
|
4677
4684
|
method: o.GET,
|
|
4678
4685
|
url: "/asset-procedure-steps/",
|
|
@@ -5016,6 +5023,7 @@ class i_ extends v {
|
|
|
5016
5023
|
async refreshStore(e, s) {
|
|
5017
5024
|
const i = await this.enqueueRequest(
|
|
5018
5025
|
{
|
|
5026
|
+
immediate: !0,
|
|
5019
5027
|
description: "Get asset stages",
|
|
5020
5028
|
method: o.GET,
|
|
5021
5029
|
url: "/asset-stages/",
|
|
@@ -5069,6 +5077,7 @@ class n_ extends He {
|
|
|
5069
5077
|
async refreshStore(s, i) {
|
|
5070
5078
|
const n = await this.enqueueRequest(
|
|
5071
5079
|
{
|
|
5080
|
+
immediate: !0,
|
|
5072
5081
|
description: "Get asset type attachments",
|
|
5073
5082
|
method: o.GET,
|
|
5074
5083
|
url: `${this.url}/`,
|
|
@@ -5137,6 +5146,7 @@ class a_ extends V {
|
|
|
5137
5146
|
async refreshStore(e, s) {
|
|
5138
5147
|
const i = await this.enqueueRequest(
|
|
5139
5148
|
{
|
|
5149
|
+
immediate: !0,
|
|
5140
5150
|
description: "Get asset type fields attachments",
|
|
5141
5151
|
method: o.GET,
|
|
5142
5152
|
url: "/asset-type-fields-attachments/",
|
|
@@ -5177,6 +5187,7 @@ class r_ extends v {
|
|
|
5177
5187
|
async refreshStore(e, s) {
|
|
5178
5188
|
const i = await this.enqueueRequest(
|
|
5179
5189
|
{
|
|
5190
|
+
immediate: !0,
|
|
5180
5191
|
description: "Get Asset Type Fields",
|
|
5181
5192
|
method: o.GET,
|
|
5182
5193
|
url: "/asset-type-fields/",
|
|
@@ -5672,6 +5683,7 @@ class l_ extends v {
|
|
|
5672
5683
|
async refreshStore(e, s) {
|
|
5673
5684
|
const i = await this.enqueueRequest(
|
|
5674
5685
|
{
|
|
5686
|
+
immediate: !0,
|
|
5675
5687
|
description: "Get asset types",
|
|
5676
5688
|
method: o.GET,
|
|
5677
5689
|
url: "/asset-types/",
|
|
@@ -5740,6 +5752,7 @@ class h_ extends v {
|
|
|
5740
5752
|
async refreshStore(e, s) {
|
|
5741
5753
|
const i = await this.enqueueRequest(
|
|
5742
5754
|
{
|
|
5755
|
+
immediate: !0,
|
|
5743
5756
|
description: "Get categories",
|
|
5744
5757
|
method: o.GET,
|
|
5745
5758
|
url: "/categories/",
|
|
@@ -5853,6 +5866,7 @@ class p_ extends He {
|
|
|
5853
5866
|
async refreshStore(s, i) {
|
|
5854
5867
|
const n = await this.enqueueRequest(
|
|
5855
5868
|
{
|
|
5869
|
+
immediate: !0,
|
|
5856
5870
|
description: "Get document attachments",
|
|
5857
5871
|
method: o.GET,
|
|
5858
5872
|
url: "/document-attachments/",
|
|
@@ -5865,6 +5879,7 @@ class p_ extends He {
|
|
|
5865
5879
|
i
|
|
5866
5880
|
), a = await this.enqueueRequest(
|
|
5867
5881
|
{
|
|
5882
|
+
immediate: !0,
|
|
5868
5883
|
description: "Get document attachments",
|
|
5869
5884
|
method: o.GET,
|
|
5870
5885
|
url: "/document-attachments/",
|
|
@@ -5949,6 +5964,7 @@ class m_ extends v {
|
|
|
5949
5964
|
async refreshStore(e, s) {
|
|
5950
5965
|
const i = this.enqueueRequest(
|
|
5951
5966
|
{
|
|
5967
|
+
immediate: !0,
|
|
5952
5968
|
description: "Get project documents",
|
|
5953
5969
|
method: o.GET,
|
|
5954
5970
|
url: "/documents/",
|
|
@@ -5961,6 +5977,7 @@ class m_ extends v {
|
|
|
5961
5977
|
s
|
|
5962
5978
|
), n = this.enqueueRequest(
|
|
5963
5979
|
{
|
|
5980
|
+
immediate: !0,
|
|
5964
5981
|
description: "Get organization documents",
|
|
5965
5982
|
method: o.GET,
|
|
5966
5983
|
url: "/documents/",
|
|
@@ -6000,6 +6017,7 @@ class f_ extends v {
|
|
|
6000
6017
|
async refreshStore(e, s) {
|
|
6001
6018
|
const i = await this.enqueueRequest(
|
|
6002
6019
|
{
|
|
6020
|
+
immediate: !0,
|
|
6003
6021
|
description: "Fetch email domains for organization",
|
|
6004
6022
|
method: o.GET,
|
|
6005
6023
|
url: "/organization-email-domains/",
|
|
@@ -6420,6 +6438,7 @@ class S_ extends V {
|
|
|
6420
6438
|
async refreshStore(e, s) {
|
|
6421
6439
|
const i = await this.enqueueRequest(
|
|
6422
6440
|
{
|
|
6441
|
+
immediate: !0,
|
|
6423
6442
|
description: "Fetch organization form revision attachments",
|
|
6424
6443
|
method: o.GET,
|
|
6425
6444
|
url: "/form-revision-attachments/",
|
|
@@ -6460,6 +6479,7 @@ class T_ extends V {
|
|
|
6460
6479
|
async refreshStore(e, s) {
|
|
6461
6480
|
const i = await this.enqueueRequest(
|
|
6462
6481
|
{
|
|
6482
|
+
immediate: !0,
|
|
6463
6483
|
description: "Get organization form revisions",
|
|
6464
6484
|
method: o.GET,
|
|
6465
6485
|
url: "/form-revisions/",
|
|
@@ -6532,6 +6552,7 @@ class I_ extends V {
|
|
|
6532
6552
|
async refreshStore(e, s) {
|
|
6533
6553
|
const i = await this.enqueueRequest(
|
|
6534
6554
|
{
|
|
6555
|
+
immediate: !0,
|
|
6535
6556
|
description: "Fetch organization forms",
|
|
6536
6557
|
method: o.GET,
|
|
6537
6558
|
url: "/forms/",
|
|
@@ -7345,6 +7366,7 @@ class E_ extends He {
|
|
|
7345
7366
|
async refreshStore(s, i) {
|
|
7346
7367
|
const n = await this.enqueueRequest(
|
|
7347
7368
|
{
|
|
7369
|
+
immediate: !0,
|
|
7348
7370
|
description: "Get issue type attachments",
|
|
7349
7371
|
method: o.GET,
|
|
7350
7372
|
url: `${this.url}/`,
|
|
@@ -7413,6 +7435,7 @@ class M_ extends V {
|
|
|
7413
7435
|
async refreshStore(e, s) {
|
|
7414
7436
|
const i = await this.enqueueRequest(
|
|
7415
7437
|
{
|
|
7438
|
+
immediate: !0,
|
|
7416
7439
|
description: "get issue type fields attachments",
|
|
7417
7440
|
method: o.GET,
|
|
7418
7441
|
url: "/issue-type-fields-attachments/",
|
|
@@ -7453,6 +7476,7 @@ class q_ extends v {
|
|
|
7453
7476
|
async refreshStore(e, s) {
|
|
7454
7477
|
const i = await this.enqueueRequest(
|
|
7455
7478
|
{
|
|
7479
|
+
immediate: !0,
|
|
7456
7480
|
description: "Get Issue Type Fields",
|
|
7457
7481
|
method: o.GET,
|
|
7458
7482
|
url: "/issue-type-fields/",
|
|
@@ -7888,6 +7912,7 @@ class x_ extends v {
|
|
|
7888
7912
|
async refreshStore(e, s) {
|
|
7889
7913
|
const i = await this.enqueueRequest(
|
|
7890
7914
|
{
|
|
7915
|
+
immediate: !0,
|
|
7891
7916
|
method: o.GET,
|
|
7892
7917
|
url: "/issue-types/",
|
|
7893
7918
|
queryParams: {
|
|
@@ -8098,6 +8123,7 @@ class $_ extends v {
|
|
|
8098
8123
|
async refreshStore(e, s) {
|
|
8099
8124
|
const i = await this.enqueueRequest(
|
|
8100
8125
|
{
|
|
8126
|
+
immediate: !0,
|
|
8101
8127
|
description: "Get organization accesses",
|
|
8102
8128
|
method: o.GET,
|
|
8103
8129
|
url: "/organization-accesses/",
|
|
@@ -8147,6 +8173,7 @@ class G_ extends v {
|
|
|
8147
8173
|
async refreshStore(e) {
|
|
8148
8174
|
const s = await this.enqueueRequest(
|
|
8149
8175
|
{
|
|
8176
|
+
immediate: !0,
|
|
8150
8177
|
description: "Fetch organizations",
|
|
8151
8178
|
method: o.GET,
|
|
8152
8179
|
url: "/organizations/",
|
|
@@ -8214,6 +8241,7 @@ class B_ extends v {
|
|
|
8214
8241
|
async refreshStore(e, s) {
|
|
8215
8242
|
const i = await this.enqueueRequest(
|
|
8216
8243
|
{
|
|
8244
|
+
immediate: !0,
|
|
8217
8245
|
description: "Get project accesses",
|
|
8218
8246
|
method: o.GET,
|
|
8219
8247
|
url: "/project-accesses/",
|
|
@@ -8267,6 +8295,7 @@ class L_ extends He {
|
|
|
8267
8295
|
async refreshStore(s, i) {
|
|
8268
8296
|
const n = await this.enqueueRequest(
|
|
8269
8297
|
{
|
|
8298
|
+
immediate: !0,
|
|
8270
8299
|
description: "Get project attachments",
|
|
8271
8300
|
method: o.GET,
|
|
8272
8301
|
url: `${this.url}/`,
|
|
@@ -8428,6 +8457,7 @@ class H_ extends v {
|
|
|
8428
8457
|
async refreshStore(e, s) {
|
|
8429
8458
|
const i = await this.enqueueRequest(
|
|
8430
8459
|
{
|
|
8460
|
+
immediate: !0,
|
|
8431
8461
|
description: "Fetch projects",
|
|
8432
8462
|
method: o.GET,
|
|
8433
8463
|
url: "/projects/",
|
|
@@ -8480,6 +8510,7 @@ class W_ extends v {
|
|
|
8480
8510
|
async refreshStore(e, s) {
|
|
8481
8511
|
const i = await this.enqueueRequest(
|
|
8482
8512
|
{
|
|
8513
|
+
immediate: !0,
|
|
8483
8514
|
description: "Fetch team memberships",
|
|
8484
8515
|
method: o.GET,
|
|
8485
8516
|
url: "/team-memberships/",
|
|
@@ -8560,6 +8591,7 @@ class K_ extends v {
|
|
|
8560
8591
|
async refreshStore(e, s) {
|
|
8561
8592
|
const i = await this.enqueueRequest(
|
|
8562
8593
|
{
|
|
8594
|
+
immediate: !0,
|
|
8563
8595
|
description: "Fetch teams",
|
|
8564
8596
|
method: o.GET,
|
|
8565
8597
|
url: "/teams/",
|
|
@@ -8578,6 +8610,7 @@ class Y_ extends v {
|
|
|
8578
8610
|
async refreshStore(e, s) {
|
|
8579
8611
|
const i = await this.enqueueRequest(
|
|
8580
8612
|
{
|
|
8613
|
+
immediate: !0,
|
|
8581
8614
|
description: "Fetch organization users",
|
|
8582
8615
|
method: o.GET,
|
|
8583
8616
|
url: `/organizations/${e}/users/`,
|
|
@@ -5,11 +5,11 @@ Retries:`,i),!(t instanceof Error))throw console.error("ENCOUNTERED NON-ERROR ER
|
|
|
5
5
|
Action:`,e);const p=Ye();if(!p)throw new Error("Outbox coordinator not set");p.remove(e.payload.uuid),t.options.discard=!0,l()}}console.debug("Registering a retry for request:",e.payload.uuid);const m=Ye();if(!m)throw new Error("Outbox coordinator not set");return m.registerRetry(e.payload.uuid),!1}function cb(t,e,i){var a;return(a=Ye())==null?void 0:a.peek()}function rb(t,e){return bt().dispatch(hm(new Date().getTime())),nc}const xe="An unknown error occurred",db=500,Fp=["non_field_errors","detail"];function ub(t,e){let i;if(t!=null&&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"?Fp.includes(n)?c:`${n}: ${c}`:Array.isArray(c)?Fp.includes(n)?c.join(`
|
|
6
6
|
`):c.map(r=>`${n}: ${r}`).join(`
|
|
7
7
|
`):`${n}: ${JSON.stringify(c)}`).join(`
|
|
8
|
-
`)}catch(n){console.error("Failed to extract error message from response body",n)}}else typeof t.body=="string"&&(i=t.body);else t!=null&&t.text?i=t.text:e instanceof Error&&(i=e.message);return!i||i.length>db?xe:i}class D extends Error{constructor(i){super(xe);S(this,"status");S(this,"response");S(this,"message");S(this,"options");const{response:a,innerError:n}=i;this.message=i.message??ub(a,n)??xe,this.status=(a==null?void 0:a.status)??0,this.response=a,i.discard=i.discard??!1,this.options=i}}class ob extends pp{constructor(e){super(e)}}class R extends pp{constructor(i,a){super(i);S(this,"auth");this.auth=a}}class lb extends R{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(fc(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(Sc(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(yc(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 refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get agent conversation history",method:o.GET,url:"/agents/conversations/",queryParams:{project:e},blockers:["agent-conversations"],blocks:["agent-conversations"]},i);return this.dispatch(Ac(a)),a}}const hb=5e4,E=1e3,mb="limit";class j extends R{getNumberOfAttachmentsWithSha1(e){const{issueAttachmentReducer:i,assetAttachmentReducer:a,assetTypeAttachmentReducer:n,documentAttachmentReducer:c,projectAttachmentReducer:r,formRevisionAttachmentReducer:l,formSubmissionAttachmentReducer:m,geoImageReducer:u,assetTypeFieldsAttachmentReducer:h,assetTypeFieldValuesAttachmentReducer:p,issueTypeFieldsAttachmentReducer:A,issueTypeFieldValuesAttachmentReducer:f}=this.client.store.getState();return[].concat(Object.values(i.instances),Object.values(a.instances),Object.values(n.instances),Object.values(c.instances),Object.values(r.instances),Object.values(l.instances),Object.values(m.instances),Object.values(u.instances),Object.values(h.instances),Object.values(p.instances),Object.values(A.instances),Object.values(f.instances)).filter(b=>b.file_sha1===e).length}processPresignedUrls(e){const i={};for(const[a,n]of Object.entries(e))i[a]=this.enqueueRequest({url:n.url,description:"Upload file to S3",method:o.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:a,blockers:[`s3-${n.fields.key}`],blocks:[a],s3url:n});return i}async getFilePayload(e){const i=await Xe(e),a={sha1:i,file_type:e.type,extension:e.name.split(".").pop(),size:e.size};return await this.client.files.addCache(e,i),a}}class He extends j{async _bulkAdd(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=[],r=[],l={};for(const h of e){const{modelUuid:p,file:A}=h,f=await this.getFilePayload(A);f.sha1 in l||(l[f.sha1]=f);const T=this.buildOfflineAttachment({file:A,file_sha1:f.sha1,submitted_at:n,created_by:a,description:"",modelUuid:p});c.push(T),r.push(this.buildAttachmentPayload({uuid:T.uuid,file_name:T.file_name,file_sha1:T.file_sha1,file_extension:f.extension,description:T.description,modelUuid:p}))}this.dispatch(this.addAttachments(c));const m=this.enqueueRequest({description:`Add ${this.name}`,method:o.POST,url:`${this.url}/bulk/`,payload:{submitted_at:n,attachments:r,files:Object.values(l)},blocks:c.map(h=>h.uuid),blockers:c.map(h=>h.file_sha1)});return m.then(({attachments:h,presigned_urls:p})=>{this.dispatch(this.updateAttachments(h)),this.processPresignedUrls(p)}).catch(()=>{this.dispatch(this.removeAttachments(c.map(h=>h.uuid)))}),[c,m.then(({attachments:h})=>h)]}async _delete(e){const{store:i}=this.client,a=this.selectAttachment(e)(i.getState());if(!a)throw new Error(`Attempting to delete attachment with uuid ${e} that does not exist in the store`);this.dispatch(this.removeAttachment(a.uuid));const n=this.enqueueRequest({description:`Delete ${this.name}`,method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return n.then(()=>{this.getNumberOfAttachmentsWithSha1(a.file_sha1)===0&&this.client.files.removeCache(a.file_sha1)}).catch(()=>{this.dispatch(this.setAttachment(a))}),n}}class pb extends He{constructor(){super(...arguments);S(this,"name","Asset Attachment");S(this,"url","/asset-attachments");S(this,"initializeAttachments",us);S(this,"addAttachments",os);S(this,"updateAttachments",bc);S(this,"removeAttachments",ls);S(this,"removeAttachment",Fc);S(this,"setAttachment",gc);S(this,"selectAttachment",_c)}buildOfflineAttachment(i){return F({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,asset:i.modelUuid})}buildAttachmentPayload(i){return{...i,asset:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.assetUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const c=(await this.performPagination({immediate:!0,description:"Get asset attachments",method:o.GET,url:`${this.url}/`,queryParams:{limit:E,paginate:!0,asset__project:i},blocks:[],blockers:[]},r=>({immediate:!0,description:"Get asset attachments",method:o.GET,url:r,blockers:[],blocks:[]}),a)).flat();return this.dispatch(us(c)),c}}class Ab extends He{constructor(){super(...arguments);S(this,"name","Asset Procedure Attachment");S(this,"url","/asset-procedure-attachments");S(this,"addAttachments",Ec);S(this,"updateAttachments",jc);S(this,"removeAttachments",zc);S(this,"removeAttachment",qc);S(this,"setAttachment",Vc);S(this,"selectAttachment",kc)}buildOfflineAttachment(i){return F({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,asset_procedure:i.modelUuid})}buildAttachmentPayload(i){return{...i,asset_procedure:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.assetProcedureUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const n=await this.enqueueRequest({description:"Get asset procedure attachments",method:o.GET,url:`${this.url}/`,queryParams:{asset_procedure__organization:i},blocks:[],blockers:[]},a);return this.dispatch(Mc(n)),n}}class fb extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const u of e){const{fieldsRevisionUuid:h,fieldIdentifier:p,file:A}=u,f=await this.getFilePayload(A);f.sha1 in n||(n[f.sha1]=f);const T=F({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:f.sha1,created_by:a,fields_revision:h,submitted_at:i,field_identifier:p});c.push(T);const b={uuid:T.uuid,file_name:A.name,field_identifier:p,file_extension:f.extension,file_sha1:f.sha1,fields_revision:h};r.push(b)}this.dispatch($c(c));const l=this.enqueueRequest({description:"Add asset procedure fields attachments",method:o.POST,url:"/asset-procedure-fields-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(u=>u.fields_revision),blocks:c.map(u=>u.uuid)});return l.then(u=>{this.processPresignedUrls(u.presigned_urls),this.dispatch(Lc(u.attachments))}).catch(()=>{this.dispatch(Nc(c.map(u=>u.uuid)))}),[c,l.then(({attachments:u})=>u)]}async refreshStore(e,i){const a=await this.enqueueRequest({description:"Get asset procedure fields attachments",method:o.GET,url:"/asset-procedure-fields-attachments/",queryParams:{fields_revision__asset_procedure__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Gc(a)),a}}class yb extends R{add(e){var l;const{store:i}=this.client,a=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(Jc(c));const r=this.enqueueRequest({description:"Add Asset Procedure Fields",method:o.POST,url:"/asset-procedure-fields/",payload:w(c),blockers:[c.asset_procedure],blocks:[c.uuid]});return r.then(m=>{this.dispatch(Xc(m))}).catch(m=>{throw this.dispatch(Qc(c.uuid)),m}),[c,r]}async refreshStore(e,i){const a=await this.enqueueRequest({description:"Get Asset Procedure Fields",method:o.GET,url:"/asset-procedure-fields/",queryParams:{asset_procedure__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Zc(a)),a}}function Ke(t,e){const i=[];let a=0;const n=t.length;for(;a<n;)i.push(t.slice(a,a+=e));return i}class Sb extends j{async bulkAdd(e,i){var u;const a=new Date().toISOString(),n=(u=this.client.store.getState().userReducer.currentUser)==null?void 0:u.id,c=Ke(e,i??e.length),r=[],l=[];for(const h of c){const p={},A=[];for(const f of h){const{fieldValuesUuid:T,fieldIdentifier:b,file:_}=f,v=await this.getFilePayload(_);v.sha1 in p||(p[v.sha1]=v);const z=F({file:URL.createObjectURL(_),file_type:_.type,file_name:_.name,file_sha1:v.sha1,created_by:n,field_values:T,submitted_at:a,field_identifier:b});r.push(z);const Le={uuid:z.uuid,file_name:_.name,file_sha1:v.sha1,file_extension:v.extension,field_identifier:b,field_values:T};A.push(Le)}l.push({submitted_at:a,attachments:A,files:Object.values(p)})}this.dispatch(Ot(r));const m=l.map(h=>this.enqueueRequest({description:"Add asset procedure field values attachments",method:o.POST,url:"/asset-procedure-field-values-attachments/bulk/",payload:h,blockers:h.attachments.map(p=>p.field_values),blocks:h.attachments.map(p=>p.uuid)}));return Promise.all(m).then(h=>{for(const A of h)this.processPresignedUrls(A.presigned_urls);const p=h.flatMap(A=>A.attachments);this.dispatch(ir(p))}).catch(h=>{throw this.dispatch(_t(r.map(p=>p.uuid))),h}),[r,m.map(h=>h.then(({attachments:p})=>p))]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),n=nr(e)(a);this.dispatch(_t(e));try{await this.enqueueRequest({description:"Delete asset procedure field values attachments",method:o.DELETE,url:"/asset-procedure-field-values-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(Ot(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset procedure field values attachments",method:o.GET,url:"/asset-procedure-field-values-attachments/",queryParams:{limit:E,paginate:!0,field_values__asset_procedure_instance__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset procedure field values attachments",method:o.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(sr(n)),n}}class Ib extends R{add(e){var r;const{store:i}=this.client,a=i.getState(),n=F({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),c=this.enqueueRequest({description:"Add asset procedure field values",method:o.POST,url:"/asset-procedure-field-values/",payload:w(n),blockers:[e.asset,e.fields_revision,e.asset_procedure_instance],blocks:[n.uuid]});return this.dispatch(Is(n)),c.then(l=>(this.dispatch(st(l)),l)).catch(()=>{this.dispatch(Ts(n.uuid))}),[n,c]}bulkAdd(e,i){var m;const a=new Date().toISOString(),n=[],c=Ke(e.payloads,i??e.payloads.length),r=[];for(const u of c){const h=[];for(const p of u){const A=F({...p,values:p.values,created_by:(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,submitted_at:a});n.push(A),h.push({uuid:A.uuid,asset:p.asset,fields_revision:p.fields_revision,asset_procedure_instance:p.asset_procedure_instance,published_at:p.published_at,values:A.values})}r.push({submitted_at:a,values:e.values,field_values:h})}this.dispatch(or(n));const l=[];for(const u of r){const h=u.field_values.map(b=>b.asset),p=u.field_values.map(b=>b.fields_revision),A=u.field_values.map(b=>b.asset_procedure_instance),f=u.field_values.map(b=>b.uuid),T=this.enqueueRequest({description:"Bulk add asset procedure field values",method:o.POST,url:"/asset-procedure-field-values/bulk/",payload:u,blockers:[...h,...p,...A],blocks:f});l.push(T)}return Promise.all(l).then(u=>{this.dispatch(lr(u.flat()))}).catch(()=>{this.dispatch(hr(n.map(u=>u.uuid)))}),[n,l]}update(e){const{store:i}=this.client,a=i.getState(),n=bs(e.uuid)(a);if(!n)throw new Error(`Expected AssetProcedureFieldValues with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(st(c));const r=this.enqueueRequest({description:"Update asset procedure field values",method:o.PATCH,url:`/asset-procedure-field-values/${e.uuid}/`,payload:e,blockers:[c.fields_revision,c.asset,c.asset_procedure_instance],blocks:[c.uuid]});return r.then(l=>{this.dispatch(st(l))}).catch(()=>{this.dispatch(st(n))}),[c,r]}async delete(e){const{store:i}=this.client,a=i.getState(),n=bs(e)(a);if(!n)throw new Error(`Expected submission with uuid ${e} to exist`);const c=cr(e)(a);this.dispatch(Ts(e)),this.dispatch(_t(c.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete asset procedure field values",method:o.DELETE,url:`/asset-procedure-field-values/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(Is(n)),this.dispatch(Ot(c)),r}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset procedure field values",method:o.GET,url:"/asset-procedure-field-values/",queryParams:{limit:E,paginate:!0,asset_procedure_instance__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset procedure field values",method:o.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(ur(n)),n}}class Tb extends R{add(e){var l;const{store:i}=this.client,a=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(Ps(c));const r=this.enqueueRequest({description:"Create asset procedure instance",method:o.POST,url:"/asset-procedure-instances/",payload:w(c),blockers:[e.asset_procedure,e.asset_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(it(m))}).catch(()=>{this.dispatch(Os(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=vs(e.uuid)(i.getState());if(!a)throw new Error(`Expected asset procedure instance with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(it(n));const c=this.enqueueRequest({description:"Update asset procedure instance",method:o.PATCH,url:`/asset-procedure-instances/${e.uuid}/`,payload:e,blockers:[a.uuid],blocks:[a.uuid]});return c.then(r=>{this.dispatch(it(r))}).catch(()=>{this.dispatch(it(a))}),[n,c]}async remove(e){const{store:i}=this.client,a=i.getState(),n=vs(e)(a);if(!n)throw new Error(`Expected asset procedure instance with uuid ${e} to exist`);return this.dispatch(Os(e)),this.enqueueRequest({description:"Delete asset procedure instance",method:o.DELETE,url:`/asset-procedure-instances/${e}/`,blockers:[e],blocks:[]}).catch(c=>{throw this.dispatch(Ps(n)),c})}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset procedure instances",method:o.GET,url:"/asset-procedure-instances/",queryParams:{limit:E,paginate:!0,project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset procedure instances",method:o.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(fr(n)),n}}class gb extends R{add(e){var l;const{store:i}=this.client,a=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(Ms(c));const r=this.enqueueRequest({description:"Create asset procedure",method:o.POST,url:"/asset-procedures/",payload:w(c),blockers:[],blocks:[c.uuid]});return r.then(m=>{this.dispatch(at(m))}).catch(()=>{this.dispatch(Es(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=js(e.uuid)(i.getState());if(!a)throw new Error(`Expected asset procedure with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(at(n));const c=this.enqueueRequest({description:"Update asset procedure",method:o.PATCH,url:`/asset-procedures/${e.uuid}/`,payload:e,blockers:[a.uuid],blocks:[a.uuid]});return c.then(r=>{this.dispatch(at(r))}).catch(()=>{this.dispatch(at(a))}),[n,c]}async remove(e){const{store:i}=this.client,a=i.getState(),n=js(e)(a);if(!n)throw new Error(`Expected asset procedure with uuid ${e} to exist`);const c=Tr(e)(a);return this.dispatch(Es(e)),this.dispatch(Sr(c.map(r=>r.uuid))),this.enqueueRequest({description:"Delete asset procedure",method:o.DELETE,url:`/asset-procedures/${e}/`,blockers:[e],blocks:[]}).catch(r=>{throw this.dispatch(Ms(n)),this.dispatch(yr(c)),r})}async refreshStore(e,i){const a=await this.enqueueRequest({description:"Get asset procedures",method:o.GET,url:"/asset-procedures/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(br(a)),a}}class bb extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const u of e){const{fieldsRevisionUuid:h,fieldIdentifier:p,file:A}=u,f=await this.getFilePayload(A);f.sha1 in n||(n[f.sha1]=f);const T=F({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:f.sha1,created_by:a,fields_revision:h,submitted_at:i,field_identifier:p});c.push(T);const b={uuid:T.uuid,file_name:A.name,field_identifier:p,file_extension:f.extension,file_sha1:f.sha1,fields_revision:h};r.push(b)}this.dispatch(Rr(c));const l=this.enqueueRequest({description:"Add asset procedure step fields attachments",method:o.POST,url:"/asset-procedure-step-fields-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(u=>u.fields_revision),blocks:c.map(u=>u.uuid)});return l.then(u=>{this.processPresignedUrls(u.presigned_urls),this.dispatch(vr(u.attachments))}).catch(()=>{this.dispatch(wr(c.map(u=>u.uuid)))}),[c,l.then(({attachments:u})=>u)]}async refreshStore(e,i){const a=await this.enqueueRequest({description:"Get asset procedure step fields attachments",method:o.GET,url:"/asset-procedure-step-fields-attachments/",queryParams:{fields_revision__asset_procedure_step__organization:e},blockers:[],blocks:[]},i);return this.dispatch(_r(a)),a}}class Fb extends R{add(e){var l;const{store:i}=this.client,a=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(Us(c));const r=this.enqueueRequest({description:"Add Asset Procedure Step Fields",method:o.POST,url:"/asset-procedure-step-fields/",payload:w(c),blockers:[c.asset_procedure_step],blocks:[c.uuid]});return r.then(m=>{this.dispatch(nt(m))}).catch(m=>{throw this.dispatch(Ds(c.uuid)),m}),[c,r]}update(e){const{store:i}=this.client,a=i.getState().assetProcedureStepFieldsReducer.instances[e.uuid];if(!a)throw new Error(`AssetProcedureStepFields with uuid ${e.uuid} not found`);const n={...a,...e};this.dispatch(nt(n));const c=this.enqueueRequest({description:"Update Asset Procedure Step Fields",method:o.PATCH,url:`/asset-procedure-step-fields/${a.uuid}/`,payload:e,blockers:[a.uuid],blocks:[a.uuid]});return c.then(r=>{this.dispatch(nt(r))}).catch(r=>{throw this.dispatch(nt(a)),r}),[n,c]}delete(e){const{store:i}=this.client,a=i.getState().assetProcedureStepFieldsReducer.instances[e];if(!a)throw new Error(`AssetProcedureStepFields with uuid ${e} not found`);this.dispatch(Ds(e));const n=this.enqueueRequest({description:"Delete Asset Procedure Step Fields",method:o.DELETE,url:`/asset-procedure-step-fields/${e}/`,blockers:[e],blocks:[e]});return n.catch(c=>{throw this.dispatch(Us(a)),c}),n}async refreshStore(e,i){const a=await this.enqueueRequest({description:"Get Asset Procedure Step Fields",method:o.GET,url:"/asset-procedure-step-fields/",queryParams:{asset_procedure_step__asset_procedure__organization:e},blockers:[],blocks:[]},i);return this.dispatch(qr(a)),a}}class Pb extends j{async bulkAdd(e,i){var u;const a=new Date().toISOString(),n=(u=this.client.store.getState().userReducer.currentUser)==null?void 0:u.id,c=Ke(e,i??e.length),r=[],l=[];for(const h of c){const p={},A=[];for(const f of h){const{fieldValuesUuid:T,fieldIdentifier:b,file:_}=f,v=await this.getFilePayload(_);v.sha1 in p||(p[v.sha1]=v);const z=F({file:URL.createObjectURL(_),file_type:_.type,file_name:_.name,file_sha1:v.sha1,created_by:n,field_values:T,submitted_at:a,field_identifier:b});r.push(z);const Le={uuid:z.uuid,file_name:_.name,file_sha1:v.sha1,file_extension:v.extension,field_identifier:b,field_values:T};A.push(Le)}l.push({submitted_at:a,attachments:A,files:Object.values(p)})}this.dispatch(Rt(r));const m=l.map(h=>this.enqueueRequest({description:"Add asset procedure step field values attachments",method:o.POST,url:"/asset-procedure-step-field-values-attachments/bulk/",payload:h,blockers:h.attachments.map(p=>p.field_values),blocks:h.attachments.map(p=>p.uuid)}));return Promise.all(m).then(h=>{for(const A of h)this.processPresignedUrls(A.presigned_urls);const p=h.flatMap(A=>A.attachments);this.dispatch(Cr(p))}).catch(h=>{throw this.dispatch(vt(r.map(p=>p.uuid))),h}),[r,m.map(h=>h.then(({attachments:p})=>p))]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),n=Br(e)(a);this.dispatch(vt(e));try{await this.enqueueRequest({description:"Delete asset procedure step field values attachments",method:o.DELETE,url:"/asset-procedure-step-field-values-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(Rt(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset procedure step field values attachments",method:o.GET,url:"/asset-procedure-step-field-values-attachments/",queryParams:{limit:E,paginate:!0,field_values__asset_procedure_instance__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset procedure step field values attachments",method:o.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Dr(n)),n}}class Ob extends R{add(e){var r;const{store:i}=this.client,a=i.getState(),n=F({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),c=this.enqueueRequest({description:"Add asset procedure step field values",method:o.POST,url:"/asset-procedure-step-field-values/",payload:w(n),blockers:[e.asset,e.fields_revision,e.asset_procedure_instance],blocks:[n.uuid]});return this.dispatch(Ls(n)),c.then(l=>(this.dispatch(ct(l)),l)).catch(()=>{this.dispatch(Ns(n.uuid))}),[n,c]}bulkAdd(e,i){var m;const a=new Date().toISOString(),n=[],c=Ke(e.payloads,i??e.payloads.length),r=[];for(const u of c){const h=[];for(const p of u){const A=F({...p,values:p.values,created_by:(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,submitted_at:a});n.push(A),h.push({uuid:A.uuid,asset:p.asset,fields_revision:p.fields_revision,asset_procedure_instance:p.asset_procedure_instance,asset_procedure_step:p.asset_procedure_step,published_at:p.published_at,values:A.values})}r.push({submitted_at:a,values:e.values,field_values:h})}this.dispatch(Hr(n));const l=[];for(const u of r){const h=u.field_values.map(b=>b.asset),p=u.field_values.map(b=>b.fields_revision),A=u.field_values.map(b=>b.asset_procedure_instance),f=u.field_values.map(b=>b.uuid),T=this.enqueueRequest({description:"Bulk add asset procedure step field values",method:o.POST,url:"/asset-procedure-step-field-values/bulk/",payload:u,blockers:[...h,...p,...A],blocks:f});l.push(T)}return Promise.all(l).then(u=>{this.dispatch(Wr(u.flat()))}).catch(()=>{this.dispatch(Yr(n.map(u=>u.uuid)))}),[n,l]}update(e){const{store:i}=this.client,a=i.getState(),n=Hs(e.uuid)(a);if(!n)throw new Error(`Expected AssetProcedureStepFieldValues with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(ct(c));const r=this.enqueueRequest({description:"Update asset procedure step field values",method:o.PATCH,url:`/asset-procedure-step-field-values/${e.uuid}/`,payload:e,blockers:[c.fields_revision,c.asset,c.asset_procedure_instance],blocks:[c.uuid]});return r.then(l=>{this.dispatch(ct(l))}).catch(()=>{this.dispatch(ct(n))}),[c,r]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Hs(e)(a);if(!n)throw new Error(`Expected submission with uuid ${e} to exist`);const c=Gr(e)(a);this.dispatch(Ns(e)),this.dispatch(vt(c.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete asset procedure step field values",method:o.DELETE,url:`/asset-procedure-step-field-values/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(Ls(n)),this.dispatch(Rt(c)),r}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset procedure step field values",method:o.GET,url:"/asset-procedure-step-field-values/",queryParams:{limit:E,paginate:!0,asset_procedure_instance__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset procedure step field values",method:o.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Nr(n)),n}}class _b extends R{add(e){var l;const{store:i}=this.client,a=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(Ys(c));const r=this.enqueueRequest({description:"Create asset procedure step",method:o.POST,url:"/asset-procedure-steps/",payload:w(c),blockers:[c.asset_procedure],blocks:[c.uuid]});return r.then(m=>{this.dispatch(Mt(m))}).catch(()=>{this.dispatch(Ks(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=Zs(e.uuid)(i.getState());if(!a)throw new Error(`No asset procedure step with uuid ${e.uuid} found in the store`);const n={...a,...e};this.dispatch(Mt(n));const c=this.enqueueRequest({description:"Update asset procedure step",method:o.PATCH,url:`/asset-procedure-steps/${a.uuid}/`,payload:{name:e.name,description:e.description,priority:e.order,color:e.color},blockers:[a.uuid],blocks:[a.uuid]});return c.then(r=>{this.dispatch(Mt(r))}).catch(()=>{this.dispatch(Qr(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Zs(e)(a);if(!n)throw new Error(`No asset procedure step with uuid ${e} found in the store`);return this.dispatch(Ks(e)),this.enqueueRequest({description:"Delete asset stage",method:o.DELETE,url:`/asset-stages/${e}/`,blockers:[e],blocks:[]}).catch(c=>{throw this.dispatch(Ys(n)),c})}async refreshStore(e,i){const a=await this.enqueueRequest({description:"Get asset procedure steps",method:o.GET,url:"/asset-procedure-steps/",queryParams:{asset_procedure__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Xr(a)),a}}class Rb extends R{add(e){var l;const{store:i}=this.client;if(!e.canvas_marker&&!e.geo_marker)throw new Error("Asset must have either a canvas_marker or geo_marker");const a=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(Xs(c));const r=this.enqueueRequest({description:"Create asset",method:o.POST,url:"/assets/",payload:w(c),blockers:[c.asset_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(rt(m))}).catch(()=>{this.dispatch(Qs(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=si(e.uuid)(i.getState());if(!a)throw new Error(`No asset with uuid ${e.uuid} found in the store`);const n={...a,...e};if(!n.canvas_marker&&!n.geo_marker)throw new Error("Asset must have either a canvas_marker or geo_marker");this.dispatch(rt(n));const c=this.enqueueRequest({description:"Edit asset",method:o.PATCH,url:`/assets/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(rt(r))}).catch(()=>{this.dispatch(rt(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=si(e)(a);if(!n)throw new Error(`No asset with uuid ${e} found in the store`);const c=Rc(e)(a),r=Go(e)(a),l=nl(e)(a);if(this.dispatch(Qs(e)),c.length>0){const m=c.map(({uuid:u})=>u);this.dispatch(ls(m))}if(r.length>0){const m=r.map(({uuid:u})=>u);this.dispatch(Nt(m))}if(l.length>0){const m=l.map(({uuid:u})=>u);this.dispatch(va(m))}return this.enqueueRequest({description:"Delete asset",method:o.DELETE,url:`/assets/${e}/`,blockers:[e],blocks:[]}).catch(m=>{throw this.dispatch(Xs(n)),this.dispatch(os(c)),this.dispatch(Lt(r)),this.dispatch(_a(l)),m})}bulkAdd(e,i,a,n){const c=new Date().toISOString(),r=Je.v4(),l=Ke(e,n).map(h=>{const p=h.map(A=>F(A));return{batchId:Je.v4(),payload:{transaction_id:r,submitted_at:c,asset_type:i,project:a,assets:p}}}),m=[];let u=null;for(const h of l){const{batchId:p,payload:A}=h,f=A.assets.map(v=>v.uuid),T=[i];u&&T.push(u);const b=f;b.push(p);const _=this.enqueueRequest({description:"Batch create assets",method:o.POST,url:"/assets/bulk/",payload:A,blockers:T,blocks:b});u=h.batchId,m.push(_)}return Promise.all(m).then(h=>{const p=h.flat();this.dispatch(Vt(p))}),m}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),n=ad(e)(a);this.dispatch(xs(e));try{await this.enqueueRequest({description:"Bulk delete assets",method:o.DELETE,url:"/assets/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(Vt(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get assets",method:o.GET,url:"/assets/",queryParams:{limit:E,paginate:!0,project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get assets",method:o.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(sd(n)),n}}class vb extends R{add(e){var l;const{store:i}=this.client,a=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(ai(c));const r=this.enqueueRequest({description:"Add asset stage completion",method:o.POST,url:"/asset-stage-completions/",payload:w(c),blockers:[e.asset,e.stage],blocks:[c.uuid]});return r.then(m=>{this.dispatch(dd(m))}).catch(()=>{this.dispatch(ci(c.uuid))}),[c,r]}delete(e){const{store:i}=this.client,a=ld(e)(i.getState());if(!a)throw new Error(`Expected asset stage completion with uuid ${e} to exist`);this.dispatch(ci(e));const n=this.enqueueRequest({description:"Delete asset stage completion",method:o.DELETE,url:`/asset-stage-completions/${e}/`,blockers:[e],blocks:[]});return n.catch(()=>{this.dispatch(ai(a))}),n}bulkAdd(e){var u;const{store:i}=this.client,a=new Date().toISOString(),n=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,c=e.map(h=>F(h)),r=c.map(h=>({...h,created_by:n,submitted_at:a})),l=r.map(({uuid:h})=>h);this.dispatch(ni(r));const m=this.enqueueRequest({description:"Bulk create asset stage completions",method:o.POST,url:"/asset-stage-completions/bulk/",payload:{submitted_at:a,completions:c},blockers:[...e.map(h=>h.asset_procedure_instance),...e.map(h=>h.stage),...e.map(h=>h.asset)],blocks:l});return m.then(h=>{this.dispatch(ud(h))}).catch(()=>{this.dispatch(ri(l))}),[r,m]}bulkDelete(e){const{store:i}=this.client,a=hd(e)(i.getState());this.dispatch(ri(e));const n=this.enqueueRequest({description:"Deleting asset stage completions",method:o.DELETE,url:"/asset-stage-completions/bulk/",payload:{uuids:e},blockers:e,blocks:[]});return n.catch(()=>{this.dispatch(ni(a))}),n}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset stage completions",method:o.GET,url:"/asset-stage-completions/",queryParams:{limit:E,paginate:!0,asset_procedure_instance__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset stage completions",method:o.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(rd(n)),n}}class wb extends R{add(e){var l;const{store:i}=this.client,a=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(oi(c));const r=this.enqueueRequest({description:"Create asset",method:o.POST,url:"/asset-stages/",payload:w(c),blockers:[c.asset_procedure],blocks:[c.uuid]});return r.then(m=>{this.dispatch(jt(m))}).catch(()=>{this.dispatch(li(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=hi(e.uuid)(i.getState());if(!a)throw new Error(`No asset stage with uuid ${e.uuid} found in the store`);const n={...a,...e};this.dispatch(jt(n));const c=this.enqueueRequest({description:"Update asset stage",method:o.PATCH,url:`/asset-stages/${a.uuid}/`,payload:e,blockers:[a.uuid],blocks:[a.uuid]});return c.then(r=>{this.dispatch(jt(r))}).catch(()=>{this.dispatch(Ad(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=hi(e)(a);if(!n)throw new Error(`No asset stage with uuid ${e} found in the store`);return this.dispatch(li(e)),this.enqueueRequest({description:"Delete asset stage",method:o.DELETE,url:`/asset-stages/${e}/`,blockers:[e],blocks:[]}).catch(c=>{throw this.dispatch(oi(n)),c})}async refreshStore(e,i){const a=await this.enqueueRequest({description:"Get asset stages",method:o.GET,url:"/asset-stages/",queryParams:{asset_procedure__organization:e},blockers:[],blocks:[]},i);return this.dispatch(pd(a)),a}}class Mb extends He{constructor(){super(...arguments);S(this,"name","Asset Type Attachment");S(this,"url","/asset-type-attachments");S(this,"addAttachments",pi);S(this,"updateAttachments",gd);S(this,"removeAttachments",Ai);S(this,"removeAttachment",bd);S(this,"setAttachment",Td);S(this,"selectAttachment",Od)}buildOfflineAttachment(i){return F({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,asset_type:i.modelUuid})}buildAttachmentPayload(i){return{...i,asset_type:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.assetTypeUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const n=await this.enqueueRequest({description:"Get asset type attachments",method:o.GET,url:`${this.url}/`,queryParams:{asset_type__organization:i},blocks:[],blockers:[]},a);return this.dispatch(Id(n)),n}}class Eb extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const u of e){const{fieldsRevisionUuid:h,fieldIdentifier:p,file:A}=u,f=await this.getFilePayload(A);f.sha1 in n||(n[f.sha1]=f);const T=F({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:f.sha1,created_by:a,fields_revision:h,submitted_at:i,field_identifier:p});c.push(T);const b={uuid:T.uuid,file_name:A.name,field_identifier:p,file_extension:f.extension,file_sha1:f.sha1,fields_revision:h};r.push(b)}this.dispatch(Md(c));const l=this.enqueueRequest({description:"Add asset type fields attachments",method:o.POST,url:"/asset-type-fields-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(u=>u.fields_revision),blocks:c.map(u=>u.uuid)});return l.then(u=>{this.processPresignedUrls(u.presigned_urls),this.dispatch(Ed(u.attachments))}).catch(()=>{this.dispatch(Vd(c.map(u=>u.uuid)))}),[c,l.then(({attachments:u})=>u)]}async refreshStore(e,i){const a=await this.enqueueRequest({description:"Get asset type fields attachments",method:o.GET,url:"/asset-type-fields-attachments/",queryParams:{fields_revision__asset_type__organization:e},blockers:[e],blocks:[]},i);return this.dispatch(wd(a)),a}}class Vb extends R{add(e){var l;const{store:i}=this.client,a=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(Cd(c));const r=this.enqueueRequest({description:"Add Asset Type Fields",method:o.POST,url:"/asset-type-fields/",payload:w(c),blockers:[c.asset_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(kd(m))}).catch(m=>{throw this.dispatch(Bd(c.uuid)),m}),[c,r]}async refreshStore(e,i){const a=await this.enqueueRequest({description:"Get Asset Type Fields",method:o.GET,url:"/asset-type-fields/",queryParams:{asset_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Dd(a)),a}}class jb extends j{async bulkAdd(e,i){var u;const a=new Date().toISOString(),n=(u=this.client.store.getState().userReducer.currentUser)==null?void 0:u.id,c=Ke(e,i??e.length),r=[],l=[];for(const h of c){const p={},A=[];for(const f of h){const{fieldValuesUuid:T,fieldIdentifier:b,file:_}=f,v=await this.getFilePayload(_);v.sha1 in p||(p[v.sha1]=v);const z=F({file:URL.createObjectURL(_),file_type:_.type,file_name:_.name,file_sha1:v.sha1,created_by:n,field_values:T,submitted_at:a,field_identifier:b});r.push(z);const Le={uuid:z.uuid,file_name:_.name,file_sha1:v.sha1,file_extension:v.extension,field_identifier:b,field_values:T};A.push(Le)}l.push({submitted_at:a,attachments:A,files:Object.values(p)})}this.dispatch(Ut(r));const m=l.map(h=>this.enqueueRequest({description:"Add asset type field values attachments",method:o.POST,url:"/asset-type-field-values-attachments/bulk/",payload:h,blockers:h.attachments.map(p=>p.field_values),blocks:h.attachments.map(p=>p.uuid)}));return Promise.all(m).then(h=>{for(const A of h)this.processPresignedUrls(A.presigned_urls);const p=h.flatMap(A=>A.attachments);this.dispatch(Hd(p))}).catch(h=>{throw this.dispatch(Dt(r.map(p=>p.uuid))),h}),[r,m.map(h=>h.then(({attachments:p})=>p))]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),n=Yd(e)(a);this.dispatch(Dt(e));try{await this.enqueueRequest({description:"Delete asset type field values attachments",method:o.DELETE,url:"/asset-type-field-values-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(Ut(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset type field values attachments",method:o.GET,url:"/asset-type-field-values-attachments/",queryParams:{limit:E,paginate:!0,field_values__asset__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset type field values attachments",method:o.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Nd(n)),n}}class qb extends R{add(e){var r;const{store:i}=this.client,a=i.getState(),n=F({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),c=this.enqueueRequest({description:"Add asset type field values",method:o.POST,url:"/asset-type-field-values/",payload:w(n),blockers:[e.asset,e.fields_revision],blocks:[n.uuid]});return this.dispatch(gi(n)),c.then(l=>(this.dispatch(dt(l)),l)).catch(()=>{this.dispatch(bi(n.uuid))}),[n,c]}bulkAdd(e,i){var m;const a=new Date().toISOString(),n=[],c=Ke(e.payloads,i??e.payloads.length),r=[];for(const u of c){const h=[];for(const p of u){const A=F({...p,values:p.values,created_by:(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,submitted_at:a});n.push(A),h.push({uuid:A.uuid,asset:p.asset,fields_revision:p.fields_revision,published_at:p.published_at,values:A.values})}r.push({submitted_at:a,values:e.values,field_values:h})}this.dispatch(Qd(n));const l=[];for(const u of r){const h=u.field_values.map(T=>T.asset),p=u.field_values.map(T=>T.fields_revision),A=u.field_values.map(T=>T.uuid),f=this.enqueueRequest({description:"Bulk add asset type field values",method:o.POST,url:"/asset-type-field-values/bulk/",payload:u,blockers:[...h,...p],blocks:A});l.push(f)}return Promise.all(l).then(u=>{this.dispatch(xd(u.flat()))}).catch(()=>{this.dispatch(eu(n.map(u=>u.uuid)))}),[n,l]}update(e){const{store:i}=this.client,a=i.getState(),n=Pi(e.uuid)(a);if(!n)throw new Error(`Expected AssetTypeFieldValues with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(dt(c));const r=this.enqueueRequest({description:"Delete asset type field values",method:o.PATCH,url:`/asset-type-field-values/${e.uuid}/`,payload:e,blockers:[c.uuid,c.fields_revision,c.asset],blocks:[c.uuid]});return r.then(l=>{this.dispatch(dt(l))}).catch(()=>{this.dispatch(dt(n))}),[c,r]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Pi(e)(a);if(!n)throw new Error(`Expected submission with uuid ${e} to exist`);const c=Kd(e)(a);this.dispatch(bi(e)),this.dispatch(Dt(c.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete asset type field values",method:o.DELETE,url:`/asset-type-field-values/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(gi(n)),this.dispatch(Ut(c)),r}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset type field values",method:o.GET,url:"/asset-type-field-values/",queryParams:{limit:E,paginate:!0,asset__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset type field values",method:o.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Xd(n)),n}}class zb extends R{add(e){var l;const{store:i}=this.client,a=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(_i(c));const r=this.enqueueRequest({description:"Create asset type identifier",method:o.POST,url:"/asset-type-identifiers/",payload:w(c),blockers:[c.asset_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(ut(m))}).catch(()=>{this.dispatch(Ri(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=vi(e.uuid)(i.getState());if(!a)throw new Error(`Expected asset type identifier with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(ut(n));const c=this.enqueueRequest({description:"Update asset type identifier",method:o.PATCH,url:`/asset-type-identifiers/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(ut(r))}).catch(()=>{this.dispatch(ut(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=vi(e)(a);if(!n)throw new Error(`Expected asset type identifier with uuid ${e} to exist`);this.dispatch(Ri(e));try{return await this.enqueueRequest({description:"Delete asset type identifier",method:o.DELETE,url:`/asset-type-identifiers/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(_i(n)),c}}async refreshStore(e,i){const a=await this.enqueueRequest({description:"Get asset type identifiers",method:o.GET,url:"/asset-type-identifiers/",queryParams:{asset_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(au(a)),a}}class Ub extends R{add(e){var l;const{store:i}=this.client,a=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(Mi(c));const r=this.enqueueRequest({description:"Create asset type identifier value",method:o.POST,url:"/asset-type-identifier-values/",payload:w(c),blockers:[e.asset,e.asset_type_identifier],blocks:[c.uuid]});return r.then(m=>{this.dispatch(ot(m))}).catch(()=>{this.dispatch(Ei(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=ji(e.uuid)(i.getState());if(!a)throw new Error(`Expected asset type identifier value with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(ot(n));const c=this.enqueueRequest({description:"Update asset type identifier value",method:o.PATCH,url:`/asset-type-identifier-values/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(ot(r))}).catch(()=>{this.dispatch(ot(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=ji(e)(a);if(!n)throw new Error(`Expected asset type identifier value with uuid ${e} to exist`);this.dispatch(Ei(e));try{return await this.enqueueRequest({description:"Delete asset type identifier value",method:o.DELETE,url:`/asset-type-identifier-values/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(Mi(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset type identifier values",method:o.GET,url:"/asset-type-identifier-values/",queryParams:{limit:E,paginate:!0,asset__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset type identifier values",method:o.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(uu(n)),n}}class Db extends R{add(e){var l;const{store:i}=this.client,a=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(zi(c));const r=this.enqueueRequest({description:"Create asset type",method:o.POST,url:"/asset-types/",payload:w(c),blockers:[],blocks:[c.uuid]});return r.then(m=>{this.dispatch(lt(m))}).catch(()=>{this.dispatch(Ui(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=Ci(e.uuid)(i.getState());if(!a)throw new Error(`Expected asset type with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(lt(n));const c=this.enqueueRequest({description:"Update asset type",method:o.PATCH,url:`/asset-types/${e.uuid}/`,payload:{icon:e.icon,color:e.color,name:e.name,description:e.description},blockers:[a.uuid],blocks:[a.uuid]});return c.then(r=>{this.dispatch(lt(r))}).catch(()=>{this.dispatch(lt(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Ci(e)(a);if(!n)throw new Error(`Expected asset type with uuid ${e} to exist`);const c=ti(e)(a),r=_d(e)(a);return this.dispatch(Ui(e)),this.dispatch(xs(c.map(l=>l.uuid))),this.dispatch(Ai(r.map(({uuid:l})=>l))),this.enqueueRequest({description:"Delete asset type",method:o.DELETE,url:`/asset-types/${e}/`,blockers:[e],blocks:[]}).catch(l=>{throw this.dispatch(zi(n)),this.dispatch(Vt(c)),this.dispatch(pi(r)),l})}async refreshStore(e,i){const a=await this.enqueueRequest({description:"Get asset types",method:o.GET,url:"/asset-types/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(mu(a)),a}}class Cb extends R{add(e){var l;const{store:i}=this.client,a=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(Bi(c));const r=this.enqueueRequest({description:"Create Category",method:o.POST,url:"/categories/",payload:w(c),blockers:[e.project],blocks:[c.uuid]});return[c,r]}update(e){const i=this.client.store.getState(),a=$i(e.uuid)(i);if(!a)throw new Error(`Expected an existing category with uuid ${e.uuid}`);const n={...a,...e};this.dispatch(gu(n));const c=this.enqueueRequest({description:"Edit Category",method:o.PATCH,url:`/categories/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return[n,c]}remove(e){const{store:i}=this.client,a=$i(e)(i.getState());if(!a)throw new Error(`No category with uuid ${e} found in the store`);this.dispatch(bu(e));const n=this.enqueueRequest({description:"Delete Category",method:o.DELETE,url:`/categories/${a.uuid}/`,blockers:[a.uuid],blocks:[]});return n.catch(()=>{this.dispatch(Bi(a))}),n}async refreshStore(e,i){const a=await this.enqueueRequest({description:"Get categories",method:o.GET,url:"/categories/",queryParams:{project__organization_owner:e},blocks:[],blockers:[]},i);return this.dispatch(Tu(a)),a}}class kb extends He{constructor(){super(...arguments);S(this,"name","Document Attachment");S(this,"url","/document-attachments");S(this,"addAttachments",Ru);S(this,"updateAttachments",wu);S(this,"removeAttachments",Eu);S(this,"removeAttachment",Mu);S(this,"setAttachment",vu);S(this,"selectAttachment",qu)}buildOfflineAttachment(i){return F({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,document:i.modelUuid})}buildAttachmentPayload(i){return{...i,document:i.modelUuid}}async bulkAdd(i){var p;const{store:a}=this.client,n=(p=a.getState().userReducer.currentUser)==null?void 0:p.id,c=new Date().toISOString(),r=[],l=[],m={},u={};for(const A of i){const{documentUuid:f,file:T}=A,b=await this.getFilePayload(T);b.sha1 in m||(m[b.sha1]=b,u[b.sha1]=[]);const _=this.buildOfflineAttachment({file:T,file_sha1:b.sha1,submitted_at:c,created_by:n,description:"",modelUuid:f});r.push(_),l.push({uuid:_.uuid,file_name:_.file_name,file_sha1:_.file_sha1,file_extension:b.extension,description:_.description,document:f}),u[b.sha1].push(_.uuid)}this.dispatch(this.addAttachments(r));const h=this.enqueueRequest({description:"Attach files to document",method:o.POST,url:"/document-attachments/bulk/",payload:{submitted_at:c,attachments:l,files:Object.values(m)},blocks:r.map(A=>A.uuid),blockers:r.map(A=>A.file_sha1)});return h.then(({attachments:A,presigned_urls:f})=>{this.dispatch(this.updateAttachments(A));const T=this.processPresignedUrls(f);for(const[b,_]of Object.entries(T))_.then(()=>{const v=u[b];for(const z of v)this.makeReadable(z)})}).catch(()=>{this.dispatch(this.removeAttachments(r.map(A=>A.uuid)))}),[r,h.then(({attachments:A})=>A)]}async delete(i){return this._delete(i)}makeReadable(i){this.enqueueRequest({description:"Add attachment to AI assistant",method:o.PATCH,url:`/document-attachments/${i}/`,payload:{readable_to_assistant:!0},blockers:["index-document-attachment",i],blocks:["index-document-attachment"]})}async refreshStore(i,a){const n=await this.enqueueRequest({description:"Get document attachments",method:o.GET,url:"/document-attachments/",queryParams:{document__project__organization_owner:i},blocks:[],blockers:[]},a),c=await this.enqueueRequest({description:"Get document attachments",method:o.GET,url:"/document-attachments/",queryParams:{document__organization:i},blocks:[],blockers:[]},a),r=[...n,...c];return this.dispatch(_u(r)),r}}class Bb extends R{add(e){var l;const{store:i}=this.client,a=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(Cu([c]));const r=this.enqueueRequest({description:"Create Document",method:o.POST,url:"/documents/",payload:w(c),queryParams:{parent_document:c.parent_document??void 0},blockers:c.parent_document?[c.parent_document]:[],blocks:[c.uuid]});return r.catch(()=>{this.dispatch(Hi([c.uuid]))}),[c,r]}update(e){const{store:i}=this.client,a=i.getState().documentsReducer.documents[e.uuid];if(!a)throw new Error(`attempting to update a document with uuid ${e.uuid} that does not exist in store.documents`);const n={...a,...e};this.dispatch(Qe([n]));const c=this.enqueueRequest({description:"Update Document",method:o.PATCH,url:`/documents/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.catch(()=>{Qe([a])}),[n,c]}delete(e){const{store:i}=this.client,a=kt(i.getState()),n=ku(e)(i.getState());if(!n)throw new Error(`attempting to delete a document with uuid ${e} that does not exist in store.documents`);const c=n.parent_document?a[n.parent_document]:void 0;this.dispatch(Hi([e]));const r=this.enqueueRequest({description:"Delete Document",method:o.DELETE,url:`/documents/${e}/`,blockers:[e],blocks:[]});return r.then(l=>{this.dispatch(Qe(l))}).catch(()=>{this.dispatch(Qe([n])),c&&this.dispatch(Qe([c]))}),r}async refreshStore(e,i){const a=this.enqueueRequest({description:"Get project documents",method:o.GET,url:"/documents/",queryParams:{project__organization_owner:e},blockers:[],blocks:[]},i),n=this.enqueueRequest({description:"Get organization documents",method:o.GET,url:"/documents/",queryParams:{organization:e},blockers:[],blocks:[]},i),c=[...await a,...await n];return this.dispatch(Du(c)),c}}class Gb extends R{async add(e,i){return this.enqueueRequest({description:"Add email domain to organization",method:o.POST,url:"/organization-email-domains/",payload:{email:i,organization:e},blockers:[e,"create-org"],blocks:[]})}async remove(e){return this.dispatch(Nu(e.uuid)),this.enqueueRequest({description:"Remove email domain from organization",method:o.DELETE,url:`/organization-email-domains/${e.uuid}/`,blockers:[e.domain],blocks:[]}).catch(i=>{throw this.dispatch(Lu(e)),i})}async refreshStore(e,i){const a=await this.enqueueRequest({description:"Fetch email domains for organization",method:o.GET,url:"/organization-email-domains/",queryParams:{organization:e},blockers:[e],blocks:[]},i);return this.dispatch($u(a)),a}}class $b extends R{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=void 0){return this.enqueueRequest({description:"Validate verification code",method:o.POST,url:`/verification/email-verification/${e}/`,isAuthNeeded:!1,payload:i,blockers:[],blocks:[]})}}const Qt={},Xn=new Set;let xt=0,Qn=0,xn=0;const Lb=20;class Nb extends R{constructor(){super(...arguments);S(this,"host");S(this,"_dbPromise",Ep.openDB("fileCache",1,{upgrade(i){i.createObjectStore("files")}}))}async renewUploadUrl(i){const a=await this.fetchCache(i);if(!a)throw new Error(`File with sha1 ${i} not found in cache`);const n=await ns(a,i),c=await this.enqueueRequest({description:"Get S3 URL",method:o.GET,url:"/authentication/files/presigned-upload-url/",queryParams:{sha1:await Xe(a),file_type:a.type,extension:a.name.split(".").pop(),size:a.size.toString()},blockers:[],blocks:[`s3-${n}`]});return"url"in c&&this.dispatch(Ju({sha1:i,...c})),c}async addCache(i,a){if(Xn.has(a))return;if(!i.type){const r=i.name.split("."),l=r[r.length-1];i=new File([i],i.name,{type:l})}if(!i.name||!i.size||!i.type)throw new Error("Cannot add files to cache that do not have a name, size and type.");const n=await this._dbPromise;!!await n.get("files",a)?(console.error("File already cached (this is unexpected at this point):",i.name,a),xt++):(await n.put("files",i,a),Qn++),Xn.add(a),xn++,xn%Lb===0&&console.debug(`File cache summary: ${xt} hits and ${Qn} misses, ${xt/(xt+Qn)*100}% hit rate over ${xn} calls to addCache.`)}async removeCache(i){await(await this._dbPromise).delete("files",i),Xn.delete(i)}async fetchCache(i){return(await this._dbPromise).get("files",i)}async getOrRenewUploadUrl(i){const a=this.client.store.getState();return Xu(i)(a)??await this.renewUploadUrl(i)}async uploadFileToS3(i){const a=await this.fetchCache(i);if(!a)throw new Error(`File with sha1 ${i} not found in cache`);const n=await ns(a,i),c={file_name:a.name,file_sha1:i,file:n},r=await this.getOrRenewUploadUrl(i);if("warning"in r){if(r.warning==="already_uploaded")return[c,Promise.resolve(void 0).then()];throw new Error(r.warning)}const l=r.url,m=this.enqueueRequest({url:l,description:"Upload file",method:o.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:i,blockers:[`s3-${n}`],blocks:[i],s3url:r});return[c,m]}async fetchFileFromUrl(i,a,n){const c=i.split("?")[0]??i,r=await this.fetchCache(a);if(r){if(!r.name)throw new Error("Cached file unexpectedly has no name.");return r}if(i.startsWith("blob:")){const h=await uc(i),p=new File([h],n??a,{type:h.type});return await this.addCache(p,a),p}let l=Qt[c],m=!0;l?m=!1:(l=new Promise(h=>{this.enqueueRequest({description:"Download file",method:o.GET,url:i,isExternalUrl:!0,isResponseBlob:!0,isAuthNeeded:!1,blockers:[a],blocks:[a]}).then(p=>{const A=new File([p],n??a,{type:p.type});h(A)})}),Qt[c]=l);let u;try{u=await l}catch(h){throw m&&h instanceof D&&delete Qt[c],h}if(m){const h=await Xe(u);if(h!==a){const f=`The hash of the file returned from the server (${h}) does not match the
|
|
8
|
+
`)}catch(n){console.error("Failed to extract error message from response body",n)}}else typeof t.body=="string"&&(i=t.body);else t!=null&&t.text?i=t.text:e instanceof Error&&(i=e.message);return!i||i.length>db?xe:i}class D extends Error{constructor(i){super(xe);S(this,"status");S(this,"response");S(this,"message");S(this,"options");const{response:a,innerError:n}=i;this.message=i.message??ub(a,n)??xe,this.status=(a==null?void 0:a.status)??0,this.response=a,i.discard=i.discard??!1,this.options=i}}class ob extends pp{constructor(e){super(e)}}class R extends pp{constructor(i,a){super(i);S(this,"auth");this.auth=a}}class lb extends R{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(fc(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(Sc(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(yc(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 refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get agent conversation history",method:o.GET,url:"/agents/conversations/",queryParams:{project:e},blockers:["agent-conversations"],blocks:["agent-conversations"]},i);return this.dispatch(Ac(a)),a}}const hb=5e4,E=1e3,mb="limit";class j extends R{getNumberOfAttachmentsWithSha1(e){const{issueAttachmentReducer:i,assetAttachmentReducer:a,assetTypeAttachmentReducer:n,documentAttachmentReducer:c,projectAttachmentReducer:r,formRevisionAttachmentReducer:l,formSubmissionAttachmentReducer:m,geoImageReducer:u,assetTypeFieldsAttachmentReducer:h,assetTypeFieldValuesAttachmentReducer:p,issueTypeFieldsAttachmentReducer:A,issueTypeFieldValuesAttachmentReducer:f}=this.client.store.getState();return[].concat(Object.values(i.instances),Object.values(a.instances),Object.values(n.instances),Object.values(c.instances),Object.values(r.instances),Object.values(l.instances),Object.values(m.instances),Object.values(u.instances),Object.values(h.instances),Object.values(p.instances),Object.values(A.instances),Object.values(f.instances)).filter(b=>b.file_sha1===e).length}processPresignedUrls(e){const i={};for(const[a,n]of Object.entries(e))i[a]=this.enqueueRequest({url:n.url,description:"Upload file to S3",method:o.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:a,blockers:[`s3-${n.fields.key}`],blocks:[a],s3url:n});return i}async getFilePayload(e){const i=await Xe(e),a={sha1:i,file_type:e.type,extension:e.name.split(".").pop(),size:e.size};return await this.client.files.addCache(e,i),a}}class He extends j{async _bulkAdd(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=[],r=[],l={};for(const h of e){const{modelUuid:p,file:A}=h,f=await this.getFilePayload(A);f.sha1 in l||(l[f.sha1]=f);const T=this.buildOfflineAttachment({file:A,file_sha1:f.sha1,submitted_at:n,created_by:a,description:"",modelUuid:p});c.push(T),r.push(this.buildAttachmentPayload({uuid:T.uuid,file_name:T.file_name,file_sha1:T.file_sha1,file_extension:f.extension,description:T.description,modelUuid:p}))}this.dispatch(this.addAttachments(c));const m=this.enqueueRequest({description:`Add ${this.name}`,method:o.POST,url:`${this.url}/bulk/`,payload:{submitted_at:n,attachments:r,files:Object.values(l)},blocks:c.map(h=>h.uuid),blockers:c.map(h=>h.file_sha1)});return m.then(({attachments:h,presigned_urls:p})=>{this.dispatch(this.updateAttachments(h)),this.processPresignedUrls(p)}).catch(()=>{this.dispatch(this.removeAttachments(c.map(h=>h.uuid)))}),[c,m.then(({attachments:h})=>h)]}async _delete(e){const{store:i}=this.client,a=this.selectAttachment(e)(i.getState());if(!a)throw new Error(`Attempting to delete attachment with uuid ${e} that does not exist in the store`);this.dispatch(this.removeAttachment(a.uuid));const n=this.enqueueRequest({description:`Delete ${this.name}`,method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return n.then(()=>{this.getNumberOfAttachmentsWithSha1(a.file_sha1)===0&&this.client.files.removeCache(a.file_sha1)}).catch(()=>{this.dispatch(this.setAttachment(a))}),n}}class pb extends He{constructor(){super(...arguments);S(this,"name","Asset Attachment");S(this,"url","/asset-attachments");S(this,"initializeAttachments",us);S(this,"addAttachments",os);S(this,"updateAttachments",bc);S(this,"removeAttachments",ls);S(this,"removeAttachment",Fc);S(this,"setAttachment",gc);S(this,"selectAttachment",_c)}buildOfflineAttachment(i){return F({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,asset:i.modelUuid})}buildAttachmentPayload(i){return{...i,asset:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.assetUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const c=(await this.performPagination({immediate:!0,description:"Get asset attachments",method:o.GET,url:`${this.url}/`,queryParams:{limit:E,paginate:!0,asset__project:i},blocks:[],blockers:[]},r=>({immediate:!0,description:"Get asset attachments",method:o.GET,url:r,blockers:[],blocks:[]}),a)).flat();return this.dispatch(us(c)),c}}class Ab extends He{constructor(){super(...arguments);S(this,"name","Asset Procedure Attachment");S(this,"url","/asset-procedure-attachments");S(this,"addAttachments",Ec);S(this,"updateAttachments",jc);S(this,"removeAttachments",zc);S(this,"removeAttachment",qc);S(this,"setAttachment",Vc);S(this,"selectAttachment",kc)}buildOfflineAttachment(i){return F({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,asset_procedure:i.modelUuid})}buildAttachmentPayload(i){return{...i,asset_procedure:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.assetProcedureUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const n=await this.enqueueRequest({immediate:!0,description:"Get asset procedure attachments",method:o.GET,url:`${this.url}/`,queryParams:{asset_procedure__organization:i},blocks:[],blockers:[]},a);return this.dispatch(Mc(n)),n}}class fb extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const u of e){const{fieldsRevisionUuid:h,fieldIdentifier:p,file:A}=u,f=await this.getFilePayload(A);f.sha1 in n||(n[f.sha1]=f);const T=F({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:f.sha1,created_by:a,fields_revision:h,submitted_at:i,field_identifier:p});c.push(T);const b={uuid:T.uuid,file_name:A.name,field_identifier:p,file_extension:f.extension,file_sha1:f.sha1,fields_revision:h};r.push(b)}this.dispatch($c(c));const l=this.enqueueRequest({description:"Add asset procedure fields attachments",method:o.POST,url:"/asset-procedure-fields-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(u=>u.fields_revision),blocks:c.map(u=>u.uuid)});return l.then(u=>{this.processPresignedUrls(u.presigned_urls),this.dispatch(Lc(u.attachments))}).catch(()=>{this.dispatch(Nc(c.map(u=>u.uuid)))}),[c,l.then(({attachments:u})=>u)]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset procedure fields attachments",method:o.GET,url:"/asset-procedure-fields-attachments/",queryParams:{fields_revision__asset_procedure__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Gc(a)),a}}class yb extends R{add(e){var l;const{store:i}=this.client,a=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(Jc(c));const r=this.enqueueRequest({description:"Add Asset Procedure Fields",method:o.POST,url:"/asset-procedure-fields/",payload:w(c),blockers:[c.asset_procedure],blocks:[c.uuid]});return r.then(m=>{this.dispatch(Xc(m))}).catch(m=>{throw this.dispatch(Qc(c.uuid)),m}),[c,r]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get Asset Procedure Fields",method:o.GET,url:"/asset-procedure-fields/",queryParams:{asset_procedure__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Zc(a)),a}}function Ke(t,e){const i=[];let a=0;const n=t.length;for(;a<n;)i.push(t.slice(a,a+=e));return i}class Sb extends j{async bulkAdd(e,i){var u;const a=new Date().toISOString(),n=(u=this.client.store.getState().userReducer.currentUser)==null?void 0:u.id,c=Ke(e,i??e.length),r=[],l=[];for(const h of c){const p={},A=[];for(const f of h){const{fieldValuesUuid:T,fieldIdentifier:b,file:_}=f,v=await this.getFilePayload(_);v.sha1 in p||(p[v.sha1]=v);const z=F({file:URL.createObjectURL(_),file_type:_.type,file_name:_.name,file_sha1:v.sha1,created_by:n,field_values:T,submitted_at:a,field_identifier:b});r.push(z);const Le={uuid:z.uuid,file_name:_.name,file_sha1:v.sha1,file_extension:v.extension,field_identifier:b,field_values:T};A.push(Le)}l.push({submitted_at:a,attachments:A,files:Object.values(p)})}this.dispatch(Ot(r));const m=l.map(h=>this.enqueueRequest({description:"Add asset procedure field values attachments",method:o.POST,url:"/asset-procedure-field-values-attachments/bulk/",payload:h,blockers:h.attachments.map(p=>p.field_values),blocks:h.attachments.map(p=>p.uuid)}));return Promise.all(m).then(h=>{for(const A of h)this.processPresignedUrls(A.presigned_urls);const p=h.flatMap(A=>A.attachments);this.dispatch(ir(p))}).catch(h=>{throw this.dispatch(_t(r.map(p=>p.uuid))),h}),[r,m.map(h=>h.then(({attachments:p})=>p))]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),n=nr(e)(a);this.dispatch(_t(e));try{await this.enqueueRequest({description:"Delete asset procedure field values attachments",method:o.DELETE,url:"/asset-procedure-field-values-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(Ot(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset procedure field values attachments",method:o.GET,url:"/asset-procedure-field-values-attachments/",queryParams:{limit:E,paginate:!0,field_values__asset_procedure_instance__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset procedure field values attachments",method:o.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(sr(n)),n}}class Ib extends R{add(e){var r;const{store:i}=this.client,a=i.getState(),n=F({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),c=this.enqueueRequest({description:"Add asset procedure field values",method:o.POST,url:"/asset-procedure-field-values/",payload:w(n),blockers:[e.asset,e.fields_revision,e.asset_procedure_instance],blocks:[n.uuid]});return this.dispatch(Is(n)),c.then(l=>(this.dispatch(st(l)),l)).catch(()=>{this.dispatch(Ts(n.uuid))}),[n,c]}bulkAdd(e,i){var m;const a=new Date().toISOString(),n=[],c=Ke(e.payloads,i??e.payloads.length),r=[];for(const u of c){const h=[];for(const p of u){const A=F({...p,values:p.values,created_by:(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,submitted_at:a});n.push(A),h.push({uuid:A.uuid,asset:p.asset,fields_revision:p.fields_revision,asset_procedure_instance:p.asset_procedure_instance,published_at:p.published_at,values:A.values})}r.push({submitted_at:a,values:e.values,field_values:h})}this.dispatch(or(n));const l=[];for(const u of r){const h=u.field_values.map(b=>b.asset),p=u.field_values.map(b=>b.fields_revision),A=u.field_values.map(b=>b.asset_procedure_instance),f=u.field_values.map(b=>b.uuid),T=this.enqueueRequest({description:"Bulk add asset procedure field values",method:o.POST,url:"/asset-procedure-field-values/bulk/",payload:u,blockers:[...h,...p,...A],blocks:f});l.push(T)}return Promise.all(l).then(u=>{this.dispatch(lr(u.flat()))}).catch(()=>{this.dispatch(hr(n.map(u=>u.uuid)))}),[n,l]}update(e){const{store:i}=this.client,a=i.getState(),n=bs(e.uuid)(a);if(!n)throw new Error(`Expected AssetProcedureFieldValues with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(st(c));const r=this.enqueueRequest({description:"Update asset procedure field values",method:o.PATCH,url:`/asset-procedure-field-values/${e.uuid}/`,payload:e,blockers:[c.fields_revision,c.asset,c.asset_procedure_instance],blocks:[c.uuid]});return r.then(l=>{this.dispatch(st(l))}).catch(()=>{this.dispatch(st(n))}),[c,r]}async delete(e){const{store:i}=this.client,a=i.getState(),n=bs(e)(a);if(!n)throw new Error(`Expected submission with uuid ${e} to exist`);const c=cr(e)(a);this.dispatch(Ts(e)),this.dispatch(_t(c.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete asset procedure field values",method:o.DELETE,url:`/asset-procedure-field-values/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(Is(n)),this.dispatch(Ot(c)),r}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset procedure field values",method:o.GET,url:"/asset-procedure-field-values/",queryParams:{limit:E,paginate:!0,asset_procedure_instance__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset procedure field values",method:o.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(ur(n)),n}}class Tb extends R{add(e){var l;const{store:i}=this.client,a=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(Ps(c));const r=this.enqueueRequest({description:"Create asset procedure instance",method:o.POST,url:"/asset-procedure-instances/",payload:w(c),blockers:[e.asset_procedure,e.asset_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(it(m))}).catch(()=>{this.dispatch(Os(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=vs(e.uuid)(i.getState());if(!a)throw new Error(`Expected asset procedure instance with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(it(n));const c=this.enqueueRequest({description:"Update asset procedure instance",method:o.PATCH,url:`/asset-procedure-instances/${e.uuid}/`,payload:e,blockers:[a.uuid],blocks:[a.uuid]});return c.then(r=>{this.dispatch(it(r))}).catch(()=>{this.dispatch(it(a))}),[n,c]}async remove(e){const{store:i}=this.client,a=i.getState(),n=vs(e)(a);if(!n)throw new Error(`Expected asset procedure instance with uuid ${e} to exist`);return this.dispatch(Os(e)),this.enqueueRequest({description:"Delete asset procedure instance",method:o.DELETE,url:`/asset-procedure-instances/${e}/`,blockers:[e],blocks:[]}).catch(c=>{throw this.dispatch(Ps(n)),c})}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset procedure instances",method:o.GET,url:"/asset-procedure-instances/",queryParams:{limit:E,paginate:!0,project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset procedure instances",method:o.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(fr(n)),n}}class gb extends R{add(e){var l;const{store:i}=this.client,a=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(Ms(c));const r=this.enqueueRequest({description:"Create asset procedure",method:o.POST,url:"/asset-procedures/",payload:w(c),blockers:[],blocks:[c.uuid]});return r.then(m=>{this.dispatch(at(m))}).catch(()=>{this.dispatch(Es(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=js(e.uuid)(i.getState());if(!a)throw new Error(`Expected asset procedure with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(at(n));const c=this.enqueueRequest({description:"Update asset procedure",method:o.PATCH,url:`/asset-procedures/${e.uuid}/`,payload:e,blockers:[a.uuid],blocks:[a.uuid]});return c.then(r=>{this.dispatch(at(r))}).catch(()=>{this.dispatch(at(a))}),[n,c]}async remove(e){const{store:i}=this.client,a=i.getState(),n=js(e)(a);if(!n)throw new Error(`Expected asset procedure with uuid ${e} to exist`);const c=Tr(e)(a);return this.dispatch(Es(e)),this.dispatch(Sr(c.map(r=>r.uuid))),this.enqueueRequest({description:"Delete asset procedure",method:o.DELETE,url:`/asset-procedures/${e}/`,blockers:[e],blocks:[]}).catch(r=>{throw this.dispatch(Ms(n)),this.dispatch(yr(c)),r})}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset procedures",method:o.GET,url:"/asset-procedures/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(br(a)),a}}class bb extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const u of e){const{fieldsRevisionUuid:h,fieldIdentifier:p,file:A}=u,f=await this.getFilePayload(A);f.sha1 in n||(n[f.sha1]=f);const T=F({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:f.sha1,created_by:a,fields_revision:h,submitted_at:i,field_identifier:p});c.push(T);const b={uuid:T.uuid,file_name:A.name,field_identifier:p,file_extension:f.extension,file_sha1:f.sha1,fields_revision:h};r.push(b)}this.dispatch(Rr(c));const l=this.enqueueRequest({description:"Add asset procedure step fields attachments",method:o.POST,url:"/asset-procedure-step-fields-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(u=>u.fields_revision),blocks:c.map(u=>u.uuid)});return l.then(u=>{this.processPresignedUrls(u.presigned_urls),this.dispatch(vr(u.attachments))}).catch(()=>{this.dispatch(wr(c.map(u=>u.uuid)))}),[c,l.then(({attachments:u})=>u)]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset procedure step fields attachments",method:o.GET,url:"/asset-procedure-step-fields-attachments/",queryParams:{fields_revision__asset_procedure_step__organization:e},blockers:[],blocks:[]},i);return this.dispatch(_r(a)),a}}class Fb extends R{add(e){var l;const{store:i}=this.client,a=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(Us(c));const r=this.enqueueRequest({description:"Add Asset Procedure Step Fields",method:o.POST,url:"/asset-procedure-step-fields/",payload:w(c),blockers:[c.asset_procedure_step],blocks:[c.uuid]});return r.then(m=>{this.dispatch(nt(m))}).catch(m=>{throw this.dispatch(Ds(c.uuid)),m}),[c,r]}update(e){const{store:i}=this.client,a=i.getState().assetProcedureStepFieldsReducer.instances[e.uuid];if(!a)throw new Error(`AssetProcedureStepFields with uuid ${e.uuid} not found`);const n={...a,...e};this.dispatch(nt(n));const c=this.enqueueRequest({description:"Update Asset Procedure Step Fields",method:o.PATCH,url:`/asset-procedure-step-fields/${a.uuid}/`,payload:e,blockers:[a.uuid],blocks:[a.uuid]});return c.then(r=>{this.dispatch(nt(r))}).catch(r=>{throw this.dispatch(nt(a)),r}),[n,c]}delete(e){const{store:i}=this.client,a=i.getState().assetProcedureStepFieldsReducer.instances[e];if(!a)throw new Error(`AssetProcedureStepFields with uuid ${e} not found`);this.dispatch(Ds(e));const n=this.enqueueRequest({description:"Delete Asset Procedure Step Fields",method:o.DELETE,url:`/asset-procedure-step-fields/${e}/`,blockers:[e],blocks:[e]});return n.catch(c=>{throw this.dispatch(Us(a)),c}),n}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get Asset Procedure Step Fields",method:o.GET,url:"/asset-procedure-step-fields/",queryParams:{asset_procedure_step__asset_procedure__organization:e},blockers:[],blocks:[]},i);return this.dispatch(qr(a)),a}}class Pb extends j{async bulkAdd(e,i){var u;const a=new Date().toISOString(),n=(u=this.client.store.getState().userReducer.currentUser)==null?void 0:u.id,c=Ke(e,i??e.length),r=[],l=[];for(const h of c){const p={},A=[];for(const f of h){const{fieldValuesUuid:T,fieldIdentifier:b,file:_}=f,v=await this.getFilePayload(_);v.sha1 in p||(p[v.sha1]=v);const z=F({file:URL.createObjectURL(_),file_type:_.type,file_name:_.name,file_sha1:v.sha1,created_by:n,field_values:T,submitted_at:a,field_identifier:b});r.push(z);const Le={uuid:z.uuid,file_name:_.name,file_sha1:v.sha1,file_extension:v.extension,field_identifier:b,field_values:T};A.push(Le)}l.push({submitted_at:a,attachments:A,files:Object.values(p)})}this.dispatch(Rt(r));const m=l.map(h=>this.enqueueRequest({description:"Add asset procedure step field values attachments",method:o.POST,url:"/asset-procedure-step-field-values-attachments/bulk/",payload:h,blockers:h.attachments.map(p=>p.field_values),blocks:h.attachments.map(p=>p.uuid)}));return Promise.all(m).then(h=>{for(const A of h)this.processPresignedUrls(A.presigned_urls);const p=h.flatMap(A=>A.attachments);this.dispatch(Cr(p))}).catch(h=>{throw this.dispatch(vt(r.map(p=>p.uuid))),h}),[r,m.map(h=>h.then(({attachments:p})=>p))]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),n=Br(e)(a);this.dispatch(vt(e));try{await this.enqueueRequest({description:"Delete asset procedure step field values attachments",method:o.DELETE,url:"/asset-procedure-step-field-values-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(Rt(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset procedure step field values attachments",method:o.GET,url:"/asset-procedure-step-field-values-attachments/",queryParams:{limit:E,paginate:!0,field_values__asset_procedure_instance__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset procedure step field values attachments",method:o.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Dr(n)),n}}class Ob extends R{add(e){var r;const{store:i}=this.client,a=i.getState(),n=F({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),c=this.enqueueRequest({description:"Add asset procedure step field values",method:o.POST,url:"/asset-procedure-step-field-values/",payload:w(n),blockers:[e.asset,e.fields_revision,e.asset_procedure_instance],blocks:[n.uuid]});return this.dispatch(Ls(n)),c.then(l=>(this.dispatch(ct(l)),l)).catch(()=>{this.dispatch(Ns(n.uuid))}),[n,c]}bulkAdd(e,i){var m;const a=new Date().toISOString(),n=[],c=Ke(e.payloads,i??e.payloads.length),r=[];for(const u of c){const h=[];for(const p of u){const A=F({...p,values:p.values,created_by:(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,submitted_at:a});n.push(A),h.push({uuid:A.uuid,asset:p.asset,fields_revision:p.fields_revision,asset_procedure_instance:p.asset_procedure_instance,asset_procedure_step:p.asset_procedure_step,published_at:p.published_at,values:A.values})}r.push({submitted_at:a,values:e.values,field_values:h})}this.dispatch(Hr(n));const l=[];for(const u of r){const h=u.field_values.map(b=>b.asset),p=u.field_values.map(b=>b.fields_revision),A=u.field_values.map(b=>b.asset_procedure_instance),f=u.field_values.map(b=>b.uuid),T=this.enqueueRequest({description:"Bulk add asset procedure step field values",method:o.POST,url:"/asset-procedure-step-field-values/bulk/",payload:u,blockers:[...h,...p,...A],blocks:f});l.push(T)}return Promise.all(l).then(u=>{this.dispatch(Wr(u.flat()))}).catch(()=>{this.dispatch(Yr(n.map(u=>u.uuid)))}),[n,l]}update(e){const{store:i}=this.client,a=i.getState(),n=Hs(e.uuid)(a);if(!n)throw new Error(`Expected AssetProcedureStepFieldValues with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(ct(c));const r=this.enqueueRequest({description:"Update asset procedure step field values",method:o.PATCH,url:`/asset-procedure-step-field-values/${e.uuid}/`,payload:e,blockers:[c.fields_revision,c.asset,c.asset_procedure_instance],blocks:[c.uuid]});return r.then(l=>{this.dispatch(ct(l))}).catch(()=>{this.dispatch(ct(n))}),[c,r]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Hs(e)(a);if(!n)throw new Error(`Expected submission with uuid ${e} to exist`);const c=Gr(e)(a);this.dispatch(Ns(e)),this.dispatch(vt(c.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete asset procedure step field values",method:o.DELETE,url:`/asset-procedure-step-field-values/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(Ls(n)),this.dispatch(Rt(c)),r}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset procedure step field values",method:o.GET,url:"/asset-procedure-step-field-values/",queryParams:{limit:E,paginate:!0,asset_procedure_instance__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset procedure step field values",method:o.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Nr(n)),n}}class _b extends R{add(e){var l;const{store:i}=this.client,a=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(Ys(c));const r=this.enqueueRequest({description:"Create asset procedure step",method:o.POST,url:"/asset-procedure-steps/",payload:w(c),blockers:[c.asset_procedure],blocks:[c.uuid]});return r.then(m=>{this.dispatch(Mt(m))}).catch(()=>{this.dispatch(Ks(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=Zs(e.uuid)(i.getState());if(!a)throw new Error(`No asset procedure step with uuid ${e.uuid} found in the store`);const n={...a,...e};this.dispatch(Mt(n));const c=this.enqueueRequest({description:"Update asset procedure step",method:o.PATCH,url:`/asset-procedure-steps/${a.uuid}/`,payload:{name:e.name,description:e.description,priority:e.order,color:e.color},blockers:[a.uuid],blocks:[a.uuid]});return c.then(r=>{this.dispatch(Mt(r))}).catch(()=>{this.dispatch(Qr(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Zs(e)(a);if(!n)throw new Error(`No asset procedure step with uuid ${e} found in the store`);return this.dispatch(Ks(e)),this.enqueueRequest({description:"Delete asset stage",method:o.DELETE,url:`/asset-stages/${e}/`,blockers:[e],blocks:[]}).catch(c=>{throw this.dispatch(Ys(n)),c})}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset procedure steps",method:o.GET,url:"/asset-procedure-steps/",queryParams:{asset_procedure__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Xr(a)),a}}class Rb extends R{add(e){var l;const{store:i}=this.client;if(!e.canvas_marker&&!e.geo_marker)throw new Error("Asset must have either a canvas_marker or geo_marker");const a=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(Xs(c));const r=this.enqueueRequest({description:"Create asset",method:o.POST,url:"/assets/",payload:w(c),blockers:[c.asset_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(rt(m))}).catch(()=>{this.dispatch(Qs(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=si(e.uuid)(i.getState());if(!a)throw new Error(`No asset with uuid ${e.uuid} found in the store`);const n={...a,...e};if(!n.canvas_marker&&!n.geo_marker)throw new Error("Asset must have either a canvas_marker or geo_marker");this.dispatch(rt(n));const c=this.enqueueRequest({description:"Edit asset",method:o.PATCH,url:`/assets/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(rt(r))}).catch(()=>{this.dispatch(rt(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=si(e)(a);if(!n)throw new Error(`No asset with uuid ${e} found in the store`);const c=Rc(e)(a),r=Go(e)(a),l=nl(e)(a);if(this.dispatch(Qs(e)),c.length>0){const m=c.map(({uuid:u})=>u);this.dispatch(ls(m))}if(r.length>0){const m=r.map(({uuid:u})=>u);this.dispatch(Nt(m))}if(l.length>0){const m=l.map(({uuid:u})=>u);this.dispatch(va(m))}return this.enqueueRequest({description:"Delete asset",method:o.DELETE,url:`/assets/${e}/`,blockers:[e],blocks:[]}).catch(m=>{throw this.dispatch(Xs(n)),this.dispatch(os(c)),this.dispatch(Lt(r)),this.dispatch(_a(l)),m})}bulkAdd(e,i,a,n){const c=new Date().toISOString(),r=Je.v4(),l=Ke(e,n).map(h=>{const p=h.map(A=>F(A));return{batchId:Je.v4(),payload:{transaction_id:r,submitted_at:c,asset_type:i,project:a,assets:p}}}),m=[];let u=null;for(const h of l){const{batchId:p,payload:A}=h,f=A.assets.map(v=>v.uuid),T=[i];u&&T.push(u);const b=f;b.push(p);const _=this.enqueueRequest({description:"Batch create assets",method:o.POST,url:"/assets/bulk/",payload:A,blockers:T,blocks:b});u=h.batchId,m.push(_)}return Promise.all(m).then(h=>{const p=h.flat();this.dispatch(Vt(p))}),m}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),n=ad(e)(a);this.dispatch(xs(e));try{await this.enqueueRequest({description:"Bulk delete assets",method:o.DELETE,url:"/assets/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(Vt(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get assets",method:o.GET,url:"/assets/",queryParams:{limit:E,paginate:!0,project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get assets",method:o.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(sd(n)),n}}class vb extends R{add(e){var l;const{store:i}=this.client,a=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(ai(c));const r=this.enqueueRequest({description:"Add asset stage completion",method:o.POST,url:"/asset-stage-completions/",payload:w(c),blockers:[e.asset,e.stage],blocks:[c.uuid]});return r.then(m=>{this.dispatch(dd(m))}).catch(()=>{this.dispatch(ci(c.uuid))}),[c,r]}delete(e){const{store:i}=this.client,a=ld(e)(i.getState());if(!a)throw new Error(`Expected asset stage completion with uuid ${e} to exist`);this.dispatch(ci(e));const n=this.enqueueRequest({description:"Delete asset stage completion",method:o.DELETE,url:`/asset-stage-completions/${e}/`,blockers:[e],blocks:[]});return n.catch(()=>{this.dispatch(ai(a))}),n}bulkAdd(e){var u;const{store:i}=this.client,a=new Date().toISOString(),n=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,c=e.map(h=>F(h)),r=c.map(h=>({...h,created_by:n,submitted_at:a})),l=r.map(({uuid:h})=>h);this.dispatch(ni(r));const m=this.enqueueRequest({description:"Bulk create asset stage completions",method:o.POST,url:"/asset-stage-completions/bulk/",payload:{submitted_at:a,completions:c},blockers:[...e.map(h=>h.asset_procedure_instance),...e.map(h=>h.stage),...e.map(h=>h.asset)],blocks:l});return m.then(h=>{this.dispatch(ud(h))}).catch(()=>{this.dispatch(ri(l))}),[r,m]}bulkDelete(e){const{store:i}=this.client,a=hd(e)(i.getState());this.dispatch(ri(e));const n=this.enqueueRequest({description:"Deleting asset stage completions",method:o.DELETE,url:"/asset-stage-completions/bulk/",payload:{uuids:e},blockers:e,blocks:[]});return n.catch(()=>{this.dispatch(ni(a))}),n}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset stage completions",method:o.GET,url:"/asset-stage-completions/",queryParams:{limit:E,paginate:!0,asset_procedure_instance__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset stage completions",method:o.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(rd(n)),n}}class wb extends R{add(e){var l;const{store:i}=this.client,a=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(oi(c));const r=this.enqueueRequest({description:"Create asset",method:o.POST,url:"/asset-stages/",payload:w(c),blockers:[c.asset_procedure],blocks:[c.uuid]});return r.then(m=>{this.dispatch(jt(m))}).catch(()=>{this.dispatch(li(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=hi(e.uuid)(i.getState());if(!a)throw new Error(`No asset stage with uuid ${e.uuid} found in the store`);const n={...a,...e};this.dispatch(jt(n));const c=this.enqueueRequest({description:"Update asset stage",method:o.PATCH,url:`/asset-stages/${a.uuid}/`,payload:e,blockers:[a.uuid],blocks:[a.uuid]});return c.then(r=>{this.dispatch(jt(r))}).catch(()=>{this.dispatch(Ad(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=hi(e)(a);if(!n)throw new Error(`No asset stage with uuid ${e} found in the store`);return this.dispatch(li(e)),this.enqueueRequest({description:"Delete asset stage",method:o.DELETE,url:`/asset-stages/${e}/`,blockers:[e],blocks:[]}).catch(c=>{throw this.dispatch(oi(n)),c})}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset stages",method:o.GET,url:"/asset-stages/",queryParams:{asset_procedure__organization:e},blockers:[],blocks:[]},i);return this.dispatch(pd(a)),a}}class Mb extends He{constructor(){super(...arguments);S(this,"name","Asset Type Attachment");S(this,"url","/asset-type-attachments");S(this,"addAttachments",pi);S(this,"updateAttachments",gd);S(this,"removeAttachments",Ai);S(this,"removeAttachment",bd);S(this,"setAttachment",Td);S(this,"selectAttachment",Od)}buildOfflineAttachment(i){return F({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,asset_type:i.modelUuid})}buildAttachmentPayload(i){return{...i,asset_type:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.assetTypeUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const n=await this.enqueueRequest({immediate:!0,description:"Get asset type attachments",method:o.GET,url:`${this.url}/`,queryParams:{asset_type__organization:i},blocks:[],blockers:[]},a);return this.dispatch(Id(n)),n}}class Eb extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const u of e){const{fieldsRevisionUuid:h,fieldIdentifier:p,file:A}=u,f=await this.getFilePayload(A);f.sha1 in n||(n[f.sha1]=f);const T=F({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:f.sha1,created_by:a,fields_revision:h,submitted_at:i,field_identifier:p});c.push(T);const b={uuid:T.uuid,file_name:A.name,field_identifier:p,file_extension:f.extension,file_sha1:f.sha1,fields_revision:h};r.push(b)}this.dispatch(Md(c));const l=this.enqueueRequest({description:"Add asset type fields attachments",method:o.POST,url:"/asset-type-fields-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(u=>u.fields_revision),blocks:c.map(u=>u.uuid)});return l.then(u=>{this.processPresignedUrls(u.presigned_urls),this.dispatch(Ed(u.attachments))}).catch(()=>{this.dispatch(Vd(c.map(u=>u.uuid)))}),[c,l.then(({attachments:u})=>u)]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset type fields attachments",method:o.GET,url:"/asset-type-fields-attachments/",queryParams:{fields_revision__asset_type__organization:e},blockers:[e],blocks:[]},i);return this.dispatch(wd(a)),a}}class Vb extends R{add(e){var l;const{store:i}=this.client,a=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(Cd(c));const r=this.enqueueRequest({description:"Add Asset Type Fields",method:o.POST,url:"/asset-type-fields/",payload:w(c),blockers:[c.asset_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(kd(m))}).catch(m=>{throw this.dispatch(Bd(c.uuid)),m}),[c,r]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get Asset Type Fields",method:o.GET,url:"/asset-type-fields/",queryParams:{asset_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Dd(a)),a}}class jb extends j{async bulkAdd(e,i){var u;const a=new Date().toISOString(),n=(u=this.client.store.getState().userReducer.currentUser)==null?void 0:u.id,c=Ke(e,i??e.length),r=[],l=[];for(const h of c){const p={},A=[];for(const f of h){const{fieldValuesUuid:T,fieldIdentifier:b,file:_}=f,v=await this.getFilePayload(_);v.sha1 in p||(p[v.sha1]=v);const z=F({file:URL.createObjectURL(_),file_type:_.type,file_name:_.name,file_sha1:v.sha1,created_by:n,field_values:T,submitted_at:a,field_identifier:b});r.push(z);const Le={uuid:z.uuid,file_name:_.name,file_sha1:v.sha1,file_extension:v.extension,field_identifier:b,field_values:T};A.push(Le)}l.push({submitted_at:a,attachments:A,files:Object.values(p)})}this.dispatch(Ut(r));const m=l.map(h=>this.enqueueRequest({description:"Add asset type field values attachments",method:o.POST,url:"/asset-type-field-values-attachments/bulk/",payload:h,blockers:h.attachments.map(p=>p.field_values),blocks:h.attachments.map(p=>p.uuid)}));return Promise.all(m).then(h=>{for(const A of h)this.processPresignedUrls(A.presigned_urls);const p=h.flatMap(A=>A.attachments);this.dispatch(Hd(p))}).catch(h=>{throw this.dispatch(Dt(r.map(p=>p.uuid))),h}),[r,m.map(h=>h.then(({attachments:p})=>p))]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),n=Yd(e)(a);this.dispatch(Dt(e));try{await this.enqueueRequest({description:"Delete asset type field values attachments",method:o.DELETE,url:"/asset-type-field-values-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(Ut(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset type field values attachments",method:o.GET,url:"/asset-type-field-values-attachments/",queryParams:{limit:E,paginate:!0,field_values__asset__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset type field values attachments",method:o.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Nd(n)),n}}class qb extends R{add(e){var r;const{store:i}=this.client,a=i.getState(),n=F({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),c=this.enqueueRequest({description:"Add asset type field values",method:o.POST,url:"/asset-type-field-values/",payload:w(n),blockers:[e.asset,e.fields_revision],blocks:[n.uuid]});return this.dispatch(gi(n)),c.then(l=>(this.dispatch(dt(l)),l)).catch(()=>{this.dispatch(bi(n.uuid))}),[n,c]}bulkAdd(e,i){var m;const a=new Date().toISOString(),n=[],c=Ke(e.payloads,i??e.payloads.length),r=[];for(const u of c){const h=[];for(const p of u){const A=F({...p,values:p.values,created_by:(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,submitted_at:a});n.push(A),h.push({uuid:A.uuid,asset:p.asset,fields_revision:p.fields_revision,published_at:p.published_at,values:A.values})}r.push({submitted_at:a,values:e.values,field_values:h})}this.dispatch(Qd(n));const l=[];for(const u of r){const h=u.field_values.map(T=>T.asset),p=u.field_values.map(T=>T.fields_revision),A=u.field_values.map(T=>T.uuid),f=this.enqueueRequest({description:"Bulk add asset type field values",method:o.POST,url:"/asset-type-field-values/bulk/",payload:u,blockers:[...h,...p],blocks:A});l.push(f)}return Promise.all(l).then(u=>{this.dispatch(xd(u.flat()))}).catch(()=>{this.dispatch(eu(n.map(u=>u.uuid)))}),[n,l]}update(e){const{store:i}=this.client,a=i.getState(),n=Pi(e.uuid)(a);if(!n)throw new Error(`Expected AssetTypeFieldValues with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(dt(c));const r=this.enqueueRequest({description:"Delete asset type field values",method:o.PATCH,url:`/asset-type-field-values/${e.uuid}/`,payload:e,blockers:[c.uuid,c.fields_revision,c.asset],blocks:[c.uuid]});return r.then(l=>{this.dispatch(dt(l))}).catch(()=>{this.dispatch(dt(n))}),[c,r]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Pi(e)(a);if(!n)throw new Error(`Expected submission with uuid ${e} to exist`);const c=Kd(e)(a);this.dispatch(bi(e)),this.dispatch(Dt(c.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete asset type field values",method:o.DELETE,url:`/asset-type-field-values/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(gi(n)),this.dispatch(Ut(c)),r}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset type field values",method:o.GET,url:"/asset-type-field-values/",queryParams:{limit:E,paginate:!0,asset__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset type field values",method:o.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Xd(n)),n}}class zb extends R{add(e){var l;const{store:i}=this.client,a=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(_i(c));const r=this.enqueueRequest({description:"Create asset type identifier",method:o.POST,url:"/asset-type-identifiers/",payload:w(c),blockers:[c.asset_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(ut(m))}).catch(()=>{this.dispatch(Ri(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=vi(e.uuid)(i.getState());if(!a)throw new Error(`Expected asset type identifier with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(ut(n));const c=this.enqueueRequest({description:"Update asset type identifier",method:o.PATCH,url:`/asset-type-identifiers/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(ut(r))}).catch(()=>{this.dispatch(ut(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=vi(e)(a);if(!n)throw new Error(`Expected asset type identifier with uuid ${e} to exist`);this.dispatch(Ri(e));try{return await this.enqueueRequest({description:"Delete asset type identifier",method:o.DELETE,url:`/asset-type-identifiers/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(_i(n)),c}}async refreshStore(e,i){const a=await this.enqueueRequest({description:"Get asset type identifiers",method:o.GET,url:"/asset-type-identifiers/",queryParams:{asset_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(au(a)),a}}class Ub extends R{add(e){var l;const{store:i}=this.client,a=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(Mi(c));const r=this.enqueueRequest({description:"Create asset type identifier value",method:o.POST,url:"/asset-type-identifier-values/",payload:w(c),blockers:[e.asset,e.asset_type_identifier],blocks:[c.uuid]});return r.then(m=>{this.dispatch(ot(m))}).catch(()=>{this.dispatch(Ei(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=ji(e.uuid)(i.getState());if(!a)throw new Error(`Expected asset type identifier value with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(ot(n));const c=this.enqueueRequest({description:"Update asset type identifier value",method:o.PATCH,url:`/asset-type-identifier-values/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(ot(r))}).catch(()=>{this.dispatch(ot(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=ji(e)(a);if(!n)throw new Error(`Expected asset type identifier value with uuid ${e} to exist`);this.dispatch(Ei(e));try{return await this.enqueueRequest({description:"Delete asset type identifier value",method:o.DELETE,url:`/asset-type-identifier-values/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(Mi(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset type identifier values",method:o.GET,url:"/asset-type-identifier-values/",queryParams:{limit:E,paginate:!0,asset__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset type identifier values",method:o.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(uu(n)),n}}class Db extends R{add(e){var l;const{store:i}=this.client,a=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(zi(c));const r=this.enqueueRequest({description:"Create asset type",method:o.POST,url:"/asset-types/",payload:w(c),blockers:[],blocks:[c.uuid]});return r.then(m=>{this.dispatch(lt(m))}).catch(()=>{this.dispatch(Ui(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=Ci(e.uuid)(i.getState());if(!a)throw new Error(`Expected asset type with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(lt(n));const c=this.enqueueRequest({description:"Update asset type",method:o.PATCH,url:`/asset-types/${e.uuid}/`,payload:{icon:e.icon,color:e.color,name:e.name,description:e.description},blockers:[a.uuid],blocks:[a.uuid]});return c.then(r=>{this.dispatch(lt(r))}).catch(()=>{this.dispatch(lt(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Ci(e)(a);if(!n)throw new Error(`Expected asset type with uuid ${e} to exist`);const c=ti(e)(a),r=_d(e)(a);return this.dispatch(Ui(e)),this.dispatch(xs(c.map(l=>l.uuid))),this.dispatch(Ai(r.map(({uuid:l})=>l))),this.enqueueRequest({description:"Delete asset type",method:o.DELETE,url:`/asset-types/${e}/`,blockers:[e],blocks:[]}).catch(l=>{throw this.dispatch(zi(n)),this.dispatch(Vt(c)),this.dispatch(pi(r)),l})}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset types",method:o.GET,url:"/asset-types/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(mu(a)),a}}class Cb extends R{add(e){var l;const{store:i}=this.client,a=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(Bi(c));const r=this.enqueueRequest({description:"Create Category",method:o.POST,url:"/categories/",payload:w(c),blockers:[e.project],blocks:[c.uuid]});return[c,r]}update(e){const i=this.client.store.getState(),a=$i(e.uuid)(i);if(!a)throw new Error(`Expected an existing category with uuid ${e.uuid}`);const n={...a,...e};this.dispatch(gu(n));const c=this.enqueueRequest({description:"Edit Category",method:o.PATCH,url:`/categories/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return[n,c]}remove(e){const{store:i}=this.client,a=$i(e)(i.getState());if(!a)throw new Error(`No category with uuid ${e} found in the store`);this.dispatch(bu(e));const n=this.enqueueRequest({description:"Delete Category",method:o.DELETE,url:`/categories/${a.uuid}/`,blockers:[a.uuid],blocks:[]});return n.catch(()=>{this.dispatch(Bi(a))}),n}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get categories",method:o.GET,url:"/categories/",queryParams:{project__organization_owner:e},blocks:[],blockers:[]},i);return this.dispatch(Tu(a)),a}}class kb extends He{constructor(){super(...arguments);S(this,"name","Document Attachment");S(this,"url","/document-attachments");S(this,"addAttachments",Ru);S(this,"updateAttachments",wu);S(this,"removeAttachments",Eu);S(this,"removeAttachment",Mu);S(this,"setAttachment",vu);S(this,"selectAttachment",qu)}buildOfflineAttachment(i){return F({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,document:i.modelUuid})}buildAttachmentPayload(i){return{...i,document:i.modelUuid}}async bulkAdd(i){var p;const{store:a}=this.client,n=(p=a.getState().userReducer.currentUser)==null?void 0:p.id,c=new Date().toISOString(),r=[],l=[],m={},u={};for(const A of i){const{documentUuid:f,file:T}=A,b=await this.getFilePayload(T);b.sha1 in m||(m[b.sha1]=b,u[b.sha1]=[]);const _=this.buildOfflineAttachment({file:T,file_sha1:b.sha1,submitted_at:c,created_by:n,description:"",modelUuid:f});r.push(_),l.push({uuid:_.uuid,file_name:_.file_name,file_sha1:_.file_sha1,file_extension:b.extension,description:_.description,document:f}),u[b.sha1].push(_.uuid)}this.dispatch(this.addAttachments(r));const h=this.enqueueRequest({description:"Attach files to document",method:o.POST,url:"/document-attachments/bulk/",payload:{submitted_at:c,attachments:l,files:Object.values(m)},blocks:r.map(A=>A.uuid),blockers:r.map(A=>A.file_sha1)});return h.then(({attachments:A,presigned_urls:f})=>{this.dispatch(this.updateAttachments(A));const T=this.processPresignedUrls(f);for(const[b,_]of Object.entries(T))_.then(()=>{const v=u[b];for(const z of v)this.makeReadable(z)})}).catch(()=>{this.dispatch(this.removeAttachments(r.map(A=>A.uuid)))}),[r,h.then(({attachments:A})=>A)]}async delete(i){return this._delete(i)}makeReadable(i){this.enqueueRequest({description:"Add attachment to AI assistant",method:o.PATCH,url:`/document-attachments/${i}/`,payload:{readable_to_assistant:!0},blockers:["index-document-attachment",i],blocks:["index-document-attachment"]})}async refreshStore(i,a){const n=await this.enqueueRequest({immediate:!0,description:"Get document attachments",method:o.GET,url:"/document-attachments/",queryParams:{document__project__organization_owner:i},blocks:[],blockers:[]},a),c=await this.enqueueRequest({immediate:!0,description:"Get document attachments",method:o.GET,url:"/document-attachments/",queryParams:{document__organization:i},blocks:[],blockers:[]},a),r=[...n,...c];return this.dispatch(_u(r)),r}}class Bb extends R{add(e){var l;const{store:i}=this.client,a=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(Cu([c]));const r=this.enqueueRequest({description:"Create Document",method:o.POST,url:"/documents/",payload:w(c),queryParams:{parent_document:c.parent_document??void 0},blockers:c.parent_document?[c.parent_document]:[],blocks:[c.uuid]});return r.catch(()=>{this.dispatch(Hi([c.uuid]))}),[c,r]}update(e){const{store:i}=this.client,a=i.getState().documentsReducer.documents[e.uuid];if(!a)throw new Error(`attempting to update a document with uuid ${e.uuid} that does not exist in store.documents`);const n={...a,...e};this.dispatch(Qe([n]));const c=this.enqueueRequest({description:"Update Document",method:o.PATCH,url:`/documents/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.catch(()=>{Qe([a])}),[n,c]}delete(e){const{store:i}=this.client,a=kt(i.getState()),n=ku(e)(i.getState());if(!n)throw new Error(`attempting to delete a document with uuid ${e} that does not exist in store.documents`);const c=n.parent_document?a[n.parent_document]:void 0;this.dispatch(Hi([e]));const r=this.enqueueRequest({description:"Delete Document",method:o.DELETE,url:`/documents/${e}/`,blockers:[e],blocks:[]});return r.then(l=>{this.dispatch(Qe(l))}).catch(()=>{this.dispatch(Qe([n])),c&&this.dispatch(Qe([c]))}),r}async refreshStore(e,i){const a=this.enqueueRequest({immediate:!0,description:"Get project documents",method:o.GET,url:"/documents/",queryParams:{project__organization_owner:e},blockers:[],blocks:[]},i),n=this.enqueueRequest({immediate:!0,description:"Get organization documents",method:o.GET,url:"/documents/",queryParams:{organization:e},blockers:[],blocks:[]},i),c=[...await a,...await n];return this.dispatch(Du(c)),c}}class Gb extends R{async add(e,i){return this.enqueueRequest({description:"Add email domain to organization",method:o.POST,url:"/organization-email-domains/",payload:{email:i,organization:e},blockers:[e,"create-org"],blocks:[]})}async remove(e){return this.dispatch(Nu(e.uuid)),this.enqueueRequest({description:"Remove email domain from organization",method:o.DELETE,url:`/organization-email-domains/${e.uuid}/`,blockers:[e.domain],blocks:[]}).catch(i=>{throw this.dispatch(Lu(e)),i})}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch email domains for organization",method:o.GET,url:"/organization-email-domains/",queryParams:{organization:e},blockers:[e],blocks:[]},i);return this.dispatch($u(a)),a}}class $b extends R{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=void 0){return this.enqueueRequest({description:"Validate verification code",method:o.POST,url:`/verification/email-verification/${e}/`,isAuthNeeded:!1,payload:i,blockers:[],blocks:[]})}}const Qt={},Xn=new Set;let xt=0,Qn=0,xn=0;const Lb=20;class Nb extends R{constructor(){super(...arguments);S(this,"host");S(this,"_dbPromise",Ep.openDB("fileCache",1,{upgrade(i){i.createObjectStore("files")}}))}async renewUploadUrl(i){const a=await this.fetchCache(i);if(!a)throw new Error(`File with sha1 ${i} not found in cache`);const n=await ns(a,i),c=await this.enqueueRequest({description:"Get S3 URL",method:o.GET,url:"/authentication/files/presigned-upload-url/",queryParams:{sha1:await Xe(a),file_type:a.type,extension:a.name.split(".").pop(),size:a.size.toString()},blockers:[],blocks:[`s3-${n}`]});return"url"in c&&this.dispatch(Ju({sha1:i,...c})),c}async addCache(i,a){if(Xn.has(a))return;if(!i.type){const r=i.name.split("."),l=r[r.length-1];i=new File([i],i.name,{type:l})}if(!i.name||!i.size||!i.type)throw new Error("Cannot add files to cache that do not have a name, size and type.");const n=await this._dbPromise;!!await n.get("files",a)?(console.error("File already cached (this is unexpected at this point):",i.name,a),xt++):(await n.put("files",i,a),Qn++),Xn.add(a),xn++,xn%Lb===0&&console.debug(`File cache summary: ${xt} hits and ${Qn} misses, ${xt/(xt+Qn)*100}% hit rate over ${xn} calls to addCache.`)}async removeCache(i){await(await this._dbPromise).delete("files",i),Xn.delete(i)}async fetchCache(i){return(await this._dbPromise).get("files",i)}async getOrRenewUploadUrl(i){const a=this.client.store.getState();return Xu(i)(a)??await this.renewUploadUrl(i)}async uploadFileToS3(i){const a=await this.fetchCache(i);if(!a)throw new Error(`File with sha1 ${i} not found in cache`);const n=await ns(a,i),c={file_name:a.name,file_sha1:i,file:n},r=await this.getOrRenewUploadUrl(i);if("warning"in r){if(r.warning==="already_uploaded")return[c,Promise.resolve(void 0).then()];throw new Error(r.warning)}const l=r.url,m=this.enqueueRequest({url:l,description:"Upload file",method:o.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:i,blockers:[`s3-${n}`],blocks:[i],s3url:r});return[c,m]}async fetchFileFromUrl(i,a,n){const c=i.split("?")[0]??i,r=await this.fetchCache(a);if(r){if(!r.name)throw new Error("Cached file unexpectedly has no name.");return r}if(i.startsWith("blob:")){const h=await uc(i),p=new File([h],n??a,{type:h.type});return await this.addCache(p,a),p}let l=Qt[c],m=!0;l?m=!1:(l=new Promise(h=>{this.enqueueRequest({description:"Download file",method:o.GET,url:i,isExternalUrl:!0,isResponseBlob:!0,isAuthNeeded:!1,blockers:[a],blocks:[a]}).then(p=>{const A=new File([p],n??a,{type:p.type});h(A)})}),Qt[c]=l);let u;try{u=await l}catch(h){throw m&&h instanceof D&&delete Qt[c],h}if(m){const h=await Xe(u);if(h!==a){const f=`The hash of the file returned from the server (${h}) does not match the
|
|
9
9
|
expected hash (${a}). This can happen if you're using a local development server and the
|
|
10
10
|
isExternalUrl flag in the request details is set to true, because instead of requesting the local
|
|
11
11
|
REST API, you will be requesting localhost:80 (where this app runs), resulting in a transformed blob
|
|
12
12
|
(with an uuid attached) being returned. Alternatively, you may be running with
|
|
13
13
|
import.meta.env.PROD, which will result in some file requests being treated as
|
|
14
|
-
external URLs and therefore not prepended with VITE_API_URL.`;throw new Error(f)}const p=u.type.split("/")[1];if(!p)throw new Error("File has no extension");const A=n??h+"."+p;if(u=dc(u,A),!u.name)throw new Error("Failed to set file's name");await this.addCache(u,h),Qt[c]=new Promise(f=>{f(u)})}return u}}class Hb extends R{add(e){var l;const{store:i}=this.client,a=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(Ji(c));const r=this.enqueueRequest({description:"Create form identifier",method:o.POST,url:"/form-identifiers/",payload:w(c),blockers:[c.form],blocks:[c.uuid]});return r.then(m=>{this.dispatch(ht(m))}).catch(()=>{this.dispatch(Xi(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=Qi(e.uuid)(i.getState());if(!a)throw new Error(`Expected form identifier with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(ht(n));const c=this.enqueueRequest({description:"Update form identifier",method:o.PATCH,url:`/form-identifiers/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(ht(r))}).catch(()=>{this.dispatch(ht(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Qi(e)(a);if(!n)throw new Error(`Expected form identifier with uuid ${e} to exist`);this.dispatch(Xi(e));try{return await this.enqueueRequest({description:"Delete form identifier",method:o.DELETE,url:`/form-identifiers/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(Ji(n)),c}}async refreshStore(e,i){const a=await this.enqueueRequest({description:"Get form identifiers",method:o.GET,url:"/form-identifiers/",queryParams:{form__organization:e},blockers:[],blocks:[]},i);return this.dispatch(eo(a)),a}}class Wb extends R{add(e){var l;const{store:i}=this.client,a=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(ea(c));const r=this.enqueueRequest({description:"Create form identifier value",method:o.POST,url:"/form-identifier-values/",payload:w(c),blockers:[e.form_submission,e.form_identifier],blocks:[c.uuid]});return r.then(m=>{this.dispatch(mt(m))}).catch(()=>{this.dispatch(ta(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=ia(e.uuid)(i.getState());if(!a)throw new Error(`Expected form identifier value with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(mt(n));const c=this.enqueueRequest({description:"Update form identifier value",method:o.PATCH,url:`/form-identifier-values/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(mt(r))}).catch(()=>{this.dispatch(mt(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=ia(e)(a);if(!n)throw new Error(`Expected form identifier value with uuid ${e} to exist`);this.dispatch(ta(e));try{return await this.enqueueRequest({description:"Delete form identifier value",method:o.DELETE,url:`/form-identifier-values/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(ea(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get form identifier values",method:o.GET,url:"/form-identifier-values/",queryParams:{limit:E,paginate:!0,form_submission__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get form identifier values",method:o.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(no(n)),n}}class Yb extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const u of e){const{revisionUuid:h,fieldIdentifier:p,file:A}=u,f=await this.getFilePayload(A);f.sha1 in n||(n[f.sha1]=f);const T=F({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:f.sha1,created_by:a,form_revision:h,submitted_at:i,field_identifier:p});c.push(T);const b={uuid:T.uuid,file_name:A.name,field_identifier:p,file_extension:f.extension,file_sha1:f.sha1,form_revision:h};r.push(b)}this.dispatch(lo(c));const l=this.enqueueRequest({description:"Attach files to form revision",method:o.POST,url:"/form-revision-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(u=>u.form_revision),blocks:c.map(u=>u.uuid)});return l.then(u=>{this.processPresignedUrls(u.presigned_urls),this.dispatch(ho(u.attachments))}).catch(()=>{this.dispatch(mo(c.map(u=>u.uuid)))}),[c,l.then(({attachments:u})=>u)]}async refreshStore(e,i){const a=await this.enqueueRequest({description:"Fetch organization form revision attachments",method:o.GET,url:"/form-revision-attachments/",queryParams:{form_revision__form__organization:e},blockers:[e],blocks:[]},i);return this.dispatch(oo(a)),a}}class Kb extends j{add(e){var l;const{store:i}=this.client,n=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,c=F({...e,created_by:n,submitted_at:new Date().toISOString()});this.dispatch(ca(c));const r=this.enqueueRequest({description:"Create form revision",method:o.POST,url:"/form-revisions/",payload:w(c),blockers:[e.form],blocks:[c.uuid]});return r.then(m=>{this.dispatch(Io(m))}).catch(()=>{this.dispatch(ra(c.uuid))}),[c,r]}async refreshStore(e,i){const a=await this.enqueueRequest({description:"Get organization form revisions",method:o.GET,url:"/form-revisions/",queryParams:{form__organization:e},blockers:[e],blocks:[]},i);return this.dispatch(yo(a)),a}}class Zb extends j{add(e,i){var u;const{store:a}=this.client,n=new Date().toISOString(),c=(u=a.getState().userReducer.currentUser)==null?void 0:u.id,r=F({...e,submitted_at:n,created_by:c}),l=F({...i,form:r.uuid,submitted_at:n,created_by:c});this.dispatch(la(r)),this.dispatch(ca(l));const m=this.enqueueRequest({description:"Create form",method:o.POST,url:"/forms/",payload:{...w(r),initial_revision:{uuid:l.uuid,submitted_at:l.submitted_at,title:l.title,description:l.description,fields:l.fields}},blockers:[],blocks:[r.uuid,l.uuid]});return m.catch(h=>{throw this.dispatch(ha(r.uuid)),this.dispatch(ra(l.uuid)),h}),[r,l,m]}async delete(e){const{store:i}=this.client,a=i.getState(),n=vo(e)(a);if(!n)throw new Error("Expected form to exist");const c=ko(e)(a);c.length>0&&this.dispatch(Nt(c.map(({uuid:l})=>l)));const r=go(e)(a);r.length>0&&this.dispatch(To(r.map(({uuid:l})=>l))),this.dispatch(ha(e));try{return await this.enqueueRequest({description:"Delete form",method:o.DELETE,url:`/forms/${e}/`,blockers:[e],blocks:[]})}catch(l){throw this.dispatch(la(n)),r.length>0&&this.dispatch(So(r)),c.length>0&&this.dispatch(Lt(c)),l}}async refreshStore(e,i){const a=await this.enqueueRequest({description:"Fetch organization forms",method:o.GET,url:"/forms/",queryParams:{organization:e},blockers:[e],blocks:[]},i);return this.dispatch(Po(a)),a}}class Jb extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const u of e){const{submissionUuid:h,fieldIdentifier:p,file:A}=u,f=await this.getFilePayload(A);f.sha1 in n||(n[f.sha1]=f);const T=F({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:f.sha1,created_by:a,form_submission:h,submitted_at:i,field_identifier:p});c.push(T);const b={uuid:T.uuid,file_name:A.name,file_sha1:f.sha1,file_extension:f.extension,field_identifier:p,form_submission:h};r.push(b)}this.dispatch(Bt(c));const l=this.enqueueRequest({description:"Attach files to form submission",method:o.POST,url:"/form-submission-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(u=>u.form_submission),blocks:c.map(u=>u.uuid)});return l.then(u=>{this.processPresignedUrls(u.presigned_urls),this.dispatch(Eo(u.attachments))}).catch(u=>{throw this.dispatch(Gt(c.map(h=>h.uuid))),u}),[c,l.then(({attachments:u})=>u)]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),n=jo(e)(a);this.dispatch(Gt(e));try{await this.enqueueRequest({description:"Delete form submission attachments",method:o.DELETE,url:"/form-submission-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(Bt(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get form submission attachments",method:o.GET,url:"/form-submission-attachments/",queryParams:{limit:E,paginate:!0,form_submission__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get form submission attachments",method:o.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Mo(n)),n}}class Xb extends j{add(e){var r;const{store:i}=this.client,a=i.getState(),n=F({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),c=this.enqueueRequest({description:"Add form submission",method:o.POST,url:"/form-submissions/",payload:w(n),blockers:[e.form_revision,...e.issue?[e.issue]:[],...e.asset?[e.asset]:[]],blocks:[n.uuid]});return this.dispatch(fa(n)),c.then(l=>(this.dispatch($t(l)),l)).catch(()=>{this.dispatch(ya(n.uuid))}),[n,c]}update(e){const{store:i}=this.client,a=i.getState(),n=Ta(e.uuid)(a);if(!n)throw new Error(`Expected submission with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(Co(c));const r=this.enqueueRequest({description:"Delete user form submissions",method:o.PATCH,url:`/form-submissions/${c.uuid}/`,payload:e,blockers:[c.uuid],blocks:[c.uuid]});return r.then(l=>{this.dispatch($t(l))}).catch(()=>{this.dispatch($t(n))}),[c,r]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Ta(e)(a);if(!n)throw new Error(`Expected submission with uuid ${e} to exist`);const c=qo(e)(a);this.dispatch(ya(e)),this.dispatch(Gt(c.map(r=>r.uuid)));try{return await this.enqueueRequest({description:"Delete user form submissions",method:o.DELETE,url:`/form-submissions/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(fa(n)),this.dispatch(Bt(c)),r}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Fetch form submissions",method:o.GET,url:"/form-submissions/",queryParams:{limit:E,paginate:!0,project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Fetch form submissions",method:o.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Do(n)),n}}class Qb extends j{async add(e){var p;const{store:i}=this.client,{file:a,...n}=e,c=new Date().toISOString(),r=(p=i.getState().userReducer.currentUser)==null?void 0:p.id,l=n.project,m=await this.getFilePayload(a),u=F({...n,file_name:a.name,file_sha1:m.sha1,file:URL.createObjectURL(a),submitted_at:c,created_by:r});this.dispatch(Wo(u));const h=this.enqueueRequest({description:"Add geo image",method:o.POST,url:"/geo-images/",payload:{uuid:u.uuid,submitted_at:c,title:u.title,description:u.description,geo_marker:u.geo_marker,canvas_marker:u.canvas_marker,sha1:u.file_sha1,project:u.project,file_name:u.file_name,direction:u.direction,original_date:u.original_date,file:m},blocks:[l],blockers:[l]});return h.then(A=>{this.processPresignedUrls(A.presigned_urls),this.dispatch(pt(A.geo_image))}).catch(()=>{this.dispatch(ba(u.uuid))}),[u,h.then(A=>A.geo_image)]}async bulkAdd(e,i){var p;const{store:a}=this.client,n=new Date().toISOString(),c=(p=a.getState().userReducer.currentUser)==null?void 0:p.id,r=[],l=[],m=[],u={};for(const A of e){const{file:f,...T}=A,b=await this.getFilePayload(f);b.sha1 in u||(u[b.sha1]=b);const _=F({...T,file_name:f.name,file_sha1:b.sha1,file:URL.createObjectURL(f),submitted_at:n,created_by:c,project:i});r.push(_),l.push(_.uuid),m.push({uuid:_.uuid,sha1:_.file_sha1,file_name:_.file_name,title:_.title,description:_.description,geo_marker:_.geo_marker,canvas_marker:_.canvas_marker,direction:_.direction,original_date:_.original_date})}this.dispatch(Yo(r));const h=this.enqueueRequest({description:"Bulk add geo images",method:o.POST,url:"/geo-images/bulk/",payload:{submitted_at:n,project:i,geo_images:m,files:Object.values(u)},blocks:[i],blockers:l});return h.then(A=>{this.processPresignedUrls(A.presigned_urls),this.dispatch(Ho(A.geo_images))}).catch(()=>{this.dispatch(Zo(l))}),[r,h.then(A=>A.geo_images)]}update(e){const{store:i}=this.client,a=i.getState(),n=Fa(e.uuid)(a);if(!n)throw new Error(`Map image with uuid ${e.uuid} does not exist in the store`);const c={...n,...e};this.dispatch(Ko(c));const r=this.enqueueRequest({description:"Update geo image",method:o.PATCH,url:`/geo-images/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return r.then(l=>{this.dispatch(pt(l))}).catch(()=>{this.dispatch(pt(n))}),[c,r]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Fa(e)(a);if(!n)throw new Error(`Map image with uuid ${e} does not exist in the store`);this.dispatch(ba(e));const c=this.enqueueRequest({description:"Delete geo image",method:o.DELETE,url:`/geo-images/${e}/`,blocks:[e],blockers:[e]});return c.catch(()=>{this.dispatch(pt(n))}),c}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get geo images",method:o.GET,url:"/geo-images/",queryParams:{project:e},blocks:[e],blockers:[]},i);return this.dispatch(No(a)),a}}class xb extends R{add(e){var l;const{store:i}=this.client,a=new Date().toISOString(),n=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,c=F({...e,submitted_at:a,created_by:n});this.dispatch(Oa(c));const r=this.enqueueRequest({description:"Add issue association",method:o.POST,url:"/issue-associations/",payload:w(c),blockers:[e.associated_issue,...e.issue?[e.issue]:[],...e.asset?[e.asset]:[]],blocks:[c.uuid]});return r.then(m=>{this.dispatch(tl(m))}).catch(()=>{this.dispatch(Ra(c.uuid))}),[c,r]}async delete(e){const{store:i}=this.client,a=sl(e)(i.getState());if(!a)throw new Error(`Issue association with uuid ${e} not found in store.`);this.dispatch(Ra(e));const n=this.enqueueRequest({description:"Delete issue association",method:o.DELETE,url:`/issue-associations/${e}/`,blockers:[e],blocks:[]});return n.catch(()=>{this.dispatch(Oa(a))}),n}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Fetch issue associations",method:o.GET,url:"/issue-associations/",queryParams:{limit:E,paginate:!0,associated_issue__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Fetch issue associations",method:o.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(el(n)),n}}class eF extends He{constructor(){super(...arguments);S(this,"name","Issue Attachment");S(this,"url","/issue-attachments");S(this,"initializeAttachments",Ma);S(this,"addAttachments",Ea);S(this,"updateAttachments",ul);S(this,"removeAttachments",Va);S(this,"removeAttachment",ol);S(this,"setAttachment",dl);S(this,"selectAttachment",pl)}buildOfflineAttachment(i){return F({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,issue:i.modelUuid})}buildAttachmentPayload(i){return{...i,issue:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.issueUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const c=(await this.performPagination({immediate:!0,description:"Get issue attachments",method:o.GET,url:`${this.url}/`,queryParams:{limit:E,paginate:!0,issue__project:i},blocks:[],blockers:[]},r=>({immediate:!0,description:"Get issue attachments",method:o.GET,url:r,blockers:[],blocks:[]}),a)).flat();return this.dispatch(Ma(c)),c}}class tF extends He{constructor(){super(...arguments);S(this,"name","Issue Comment Attachment");S(this,"url","/issue-comment-attachments");S(this,"initializeAttachments",qa);S(this,"addAttachments",yl);S(this,"updateAttachments",Il);S(this,"removeAttachments",gl);S(this,"removeAttachment",Tl);S(this,"setAttachment",Sl);S(this,"selectAttachment",Pl)}buildOfflineAttachment(i){return F({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,issue_comment:i.modelUuid})}buildAttachmentPayload(i){return{...i,issue_comment:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.issueCommentUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const c=(await this.performPagination({immediate:!0,description:"Get issue comment attachments",method:o.GET,url:`${this.url}/`,queryParams:{limit:E,paginate:!0,issue_comment__issue__project:i},blocks:[],blockers:[]},r=>({immediate:!0,description:"Get issue comment attachments",method:o.GET,url:r,blockers:[],blocks:[]}),a)).flat();return this.dispatch(qa(c)),c}}class sF extends R{add(e){var c;const{store:i}=this.client,a=F({...e,author:(c=i.getState().userReducer.currentUser)==null?void 0:c.id,submitted_at:new Date().toISOString()});this.dispatch(Ua(a));const n=this.enqueueRequest({description:"Add issue comment",method:o.POST,url:"/issue-comments/",payload:w(a),blockers:[e.issue],blocks:[a.uuid]});return n.catch(()=>{this.dispatch(Ca(a.uuid))}),[a,n]}update(e){const{store:i}=this.client,a=ka(e.uuid)(i.getState());if(!a)throw new Error(`Comment with uuid ${e.uuid} not found in store`);const n={...a,...e};this.dispatch(Da(n));const c=this.enqueueRequest({description:"Edit issue comment",method:o.PATCH,url:`/issue-comments/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.catch(()=>{this.dispatch(Da(a))}),[n,c]}remove(e){const{store:i}=this.client,a=ka(e)(i.getState());if(!a)throw new Error(`Comment with uuid ${e} not found in store`);this.dispatch(Ca(e));const n=this.enqueueRequest({description:"Delete comment",method:o.DELETE,url:`/issue-comments/${e}/`,blockers:[e],blocks:[]});return n.catch(()=>{this.dispatch(Ua(a))}),n}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get comments",method:o.GET,url:"/issue-comments/",queryParams:{issue__project:e},blockers:[],blocks:[]},i);return this.dispatch(Rl(a)),a}}class iF extends R{add(e){var m;const{store:i}=this.client,a=i.getState(),n=new Date().toISOString(),c=(m=a.userReducer.currentUser)==null?void 0:m.id,r=F({...e,submitted_at:n,created_by:c});this.dispatch(Ga(r));const l=this.enqueueRequest({description:"Create issue",method:o.POST,url:"/issues/",payload:w(r),blockers:[r.project,r.issue_type,...r.category?[r.category]:[]],blocks:[r.uuid]});return l.then(u=>{this.dispatch(Ht(u))}).catch(u=>{throw this.dispatch($a(r.uuid)),u}),[r,l]}update(e){var m;const i=this.client.store.getState(),a=Ha(e.uuid)(i);if(!a)throw new Error(`Attempting to update an issue with uuid ${e.uuid} that doesn't exist in the store`);const n={...a,...e};this.dispatch(Ht(n));const c={};for(const u of[V.TITLE,V.DESCRIPTION,V.STATUS,V.CATEGORY,V.PRIORITY,V.ASSIGNED_TO,V.DUE_DATE])if(u in e&&e[u]!==a[u])switch(u){case V.PRIORITY:case V.STATUS:{const h=e[u];c[u]=h!==void 0?Number(h):null;break}case V.DUE_DATE:case V.DESCRIPTION:case V.TITLE:c[u]=e[u]??null;break;case V.CATEGORY:{let h=null;const p=e[u];if(p&&(h=i.categoryReducer.instances[p]??null,!h))throw new Error(`Trying to update issue category to ${p} which does not exist in store`);c[u]=h?{name:h.name,color:h.color,uuid:h.uuid}:null;break}case V.ASSIGNED_TO:{let h=null;const p=e[u];if(p&&(h=i.userReducer.instances[p]??null,!h))throw new Error(`Trying to update issue assigned_to to ${p} which does not exist in store`);c[u]=h?{full_name:h.username,id:h.id}:null;break}}const r=F({created_by:(m=i.userReducer.currentUser)==null?void 0:m.id,submitted_at:new Date().toISOString(),issue:a.uuid,changes:c});this.dispatch(zh(r));const l=this.enqueueRequest({description:"Edit issue",method:o.PATCH,url:`/issues/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return l.catch(()=>{this.dispatch(Ht(a)),this.dispatch(Dh(r.uuid))}),[n,l]}async remove(e){const{store:i}=this.client,a=i.getState(),n=Ha(e)(a);if(!n)throw new Error(`No issue with uuid ${e} found in the store`);const c=ml(e)(a),r=Gh(e)(a),l=Bo(e)(a),m={};for(const h of il(e)(a))m[h.uuid]=h;for(const h of al(e)(a))m[h.uuid]=h;const u=Object.values(m);this.dispatch($a(e)),c.length>0&&this.dispatch(Va(c.map(({uuid:h})=>h))),r.length>0&&this.dispatch(Ch(r.map(({uuid:h})=>h))),l.length>0&&this.dispatch(Nt(l.map(({uuid:h})=>h))),u.length>0&&this.dispatch(va(u.map(({uuid:h})=>h)));try{return await this.enqueueRequest({description:"Delete issue",method:o.DELETE,url:`/issues/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(Ga(n)),this.dispatch(Ea(c)),this.dispatch(Uh(r)),this.dispatch(Lt(l)),this.dispatch(_a(u)),h}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get issues",method:o.GET,url:"/issues/",queryParams:{limit:E,paginate:!0,project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get issues",method:o.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(El(n)),n}}class aF extends He{constructor(){super(...arguments);S(this,"name","Issue Type Attachment");S(this,"url","/issue-type-attachments");S(this,"initializeAttachments",Ya);S(this,"addAttachments",Dl);S(this,"updateAttachments",kl);S(this,"removeAttachments",Gl);S(this,"removeAttachment",Bl);S(this,"setAttachment",Cl);S(this,"selectAttachment",Nl)}buildOfflineAttachment(i){return F({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,issue_type:i.modelUuid})}buildAttachmentPayload(i){return{...i,issue_type:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.issueTypeUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const n=await this.enqueueRequest({description:"Get issue type attachments",method:o.GET,url:`${this.url}/`,queryParams:{issue_type__organization:i},blocks:[],blockers:[]},a);return this.dispatch(Ya(n)),n}}class nF extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const u of e){const{fieldsRevisionUuid:h,fieldIdentifier:p,file:A}=u,f=await this.getFilePayload(A);f.sha1 in n||(n[f.sha1]=f);const T=F({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:f.sha1,created_by:a,fields_revision:h,submitted_at:i,field_identifier:p});c.push(T);const b={uuid:T.uuid,file_name:A.name,file_extension:f.extension,field_identifier:p,file_sha1:f.sha1,fields_revision:h};r.push(b)}this.dispatch(Kl(c));const l=this.enqueueRequest({description:"Add issue type fields attachments",method:o.POST,url:"/issue-type-fields-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(u=>u.fields_revision),blocks:c.map(u=>u.uuid)});return l.then(u=>{this.processPresignedUrls(u.presigned_urls),this.dispatch(Zl(u.attachments))}).catch(()=>{this.dispatch(Jl(c.map(u=>u.uuid)))}),[c,l.then(({attachments:u})=>u)]}async refreshStore(e,i){const a=await this.enqueueRequest({description:"get issue type fields attachments",method:o.GET,url:"/issue-type-fields-attachments/",queryParams:{fields_revision__issue_type__organization:e},blockers:[e],blocks:[]},i);return this.dispatch(Yl(a)),a}}class cF extends R{add(e){var l;const{store:i}=this.client,a=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(ch(c));const r=this.enqueueRequest({description:"Add Issue Type Fields",method:o.POST,url:"/issue-type-fields/",payload:w(c),blockers:[c.issue_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(rh(m))}).catch(m=>{throw this.dispatch(dh(c.uuid)),m}),[c,r]}async refreshStore(e,i){const a=await this.enqueueRequest({description:"Get Issue Type Fields",method:o.GET,url:"/issue-type-fields/",queryParams:{issue_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(nh(a)),a}}class rF extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const u of e){const{fieldValuesUuid:h,fieldIdentifier:p,file:A}=u,f=await this.getFilePayload(A);f.sha1 in n||(n[f.sha1]=f);const T=F({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:f.sha1,created_by:a,field_values:h,submitted_at:i,field_identifier:p});c.push(T);const b={uuid:T.uuid,file_name:A.name,file_sha1:f.sha1,file_extension:f.extension,field_identifier:p,field_values:h};r.push(b)}this.dispatch(Yt(c));const l=this.enqueueRequest({description:"Add issue type field values attachments",method:o.POST,url:"/issue-type-field-values-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(u=>u.field_values),blocks:c.map(u=>u.uuid)});return l.then(({presigned_urls:u,attachments:h})=>{this.processPresignedUrls(u),this.dispatch(mh(h))}).catch(u=>{throw this.dispatch(Kt(c.map(h=>h.uuid))),u}),[c,l.then(({attachments:u})=>u)]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),n=Ah(e)(a);this.dispatch(Kt(e));try{await this.enqueueRequest({description:"Delete issue type field values attachments",method:o.DELETE,url:"/issue-type-field-values-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(Yt(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get issue type field values attachments",method:o.GET,url:"/issue-type-field-values-attachments/",queryParams:{limit:E,paginate:!0,field_values__issue__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get issue type field values attachments",method:o.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(hh(n)),n}}class dF extends R{add(e){var r;const{store:i}=this.client,a=i.getState(),n=F({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),c=this.enqueueRequest({description:"Add issue type field values",method:o.POST,url:"/issue-type-field-values/",payload:w(n),blockers:[e.issue,e.fields_revision],blocks:[n.uuid]});return this.dispatch(Ja(n)),c.then(l=>(this.dispatch(ft(l)),l)).catch(()=>{this.dispatch(Xa(n.uuid))}),[n,c]}update(e){const{store:i}=this.client,a=i.getState(),n=xa(e.uuid)(a);if(!n)throw new Error(`Expected IssueTypeFieldValues with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(ft(c));const r=this.enqueueRequest({description:"Update issue type field values",method:o.PATCH,url:`/issue-type-field-values/${e.uuid}/`,payload:e,blockers:[c.uuid,c.fields_revision,c.issue],blocks:[c.uuid]});return r.then(l=>{this.dispatch(ft(l))}).catch(()=>{this.dispatch(ft(n))}),[c,r]}async delete(e){const{store:i}=this.client,a=i.getState(),n=xa(e)(a);if(!n)throw new Error(`Expected submission with uuid ${e} to exist`);const c=fh(e)(a);this.dispatch(Xa(e)),this.dispatch(Kt(c.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete issue type field values",method:o.DELETE,url:`/issue-type-field-values/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(Ja(n)),this.dispatch(Yt(c)),r}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get issue type field values",method:o.GET,url:"/issue-type-field-values/",queryParams:{limit:E,paginate:!0,issue__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get issue type field values",method:o.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(th(n)),n}}class uF extends R{add(e){var l;const{store:i}=this.client,a=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(nn(c));const r=this.enqueueRequest({description:"Create issue type identifier",method:o.POST,url:"/issue-type-identifiers/",payload:w(c),blockers:[c.issue_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(yt(m))}).catch(()=>{this.dispatch(cn(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=rn(e.uuid)(i.getState());if(!a)throw new Error(`Expected issue type identifier with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(yt(n));const c=this.enqueueRequest({description:"Update issue type identifier",method:o.PATCH,url:`/issue-type-identifiers/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(yt(r))}).catch(()=>{this.dispatch(yt(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=rn(e)(a);if(!n)throw new Error(`Expected issue type identifier with uuid ${e} to exist`);this.dispatch(cn(e));try{return await this.enqueueRequest({description:"Delete issue type identifier",method:o.DELETE,url:`/issue-type-identifiers/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(nn(n)),c}}async refreshStore(e,i){const a=await this.enqueueRequest({description:"Get issue type identifiers",method:o.GET,url:"/issue-type-identifiers/",queryParams:{issue_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Ih(a)),a}}class oF extends R{add(e){var l;const{store:i}=this.client,a=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(un(c));const r=this.enqueueRequest({description:"Create issue type identifier value",method:o.POST,url:"/issue-type-identifier-values/",payload:w(c),blockers:[e.issue,e.issue_type_identifier],blocks:[c.uuid]});return r.then(m=>{this.dispatch(St(m))}).catch(()=>{this.dispatch(on(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=hn(e.uuid)(i.getState());if(!a)throw new Error(`Expected issue type identifier value with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(St(n));const c=this.enqueueRequest({description:"Update issue type identifier value",method:o.PATCH,url:`/issue-type-identifier-values/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(St(r))}).catch(()=>{this.dispatch(St(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=hn(e)(a);if(!n)throw new Error(`Expected issue type identifier value with uuid ${e} to exist`);this.dispatch(on(e));try{return await this.enqueueRequest({description:"Delete issue type identifier value",method:o.DELETE,url:`/issue-type-identifier-values/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(un(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get issue type identifier values",method:o.GET,url:"/issue-type-identifier-values/",queryParams:{limit:E,paginate:!0,issue__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get issue type identifier values",method:o.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Ph(n)),n}}class lF extends R{add(e){var r;const{store:i}=this.client,a=i.getState(),n=F({...e,submitted_at:new Date().toISOString(),created_by:(r=a.userReducer.currentUser)==null?void 0:r.id});this.dispatch(wh(n));const c=this.enqueueRequest({method:o.POST,url:"/issue-types/",payload:w(n),blockers:[],blocks:[n.uuid]});return c.then(l=>{this.dispatch(It(l))}).catch(()=>{this.dispatch(pn(n.uuid))}),[n,c]}update(e){const{store:i}=this.client,a=i.getState(),n=fn(e.uuid)(a);if(!n)throw new Error(`IssueType with uuid ${e.uuid} does not exist in the store.`);const c={...n,...e};this.dispatch(Mh(c));const r=this.enqueueRequest({method:o.PATCH,url:`/issue-types/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(l=>{this.dispatch(It(l))}).catch(()=>{this.dispatch(It(n))}),[c,r]}delete(e){const{store:i}=this.client,a=i.getState(),n=fn(e)(a);if(!n)throw new Error(`IssueType with uuid ${e} does not exist in the store.`);const c=ql(e)(a);this.dispatch(pn(e)),this.dispatch(jl(c.map(l=>l.uuid)));const r=this.enqueueRequest({method:o.DELETE,url:`/issue-types/${e}/`,blockers:[e],blocks:[]});return r.catch(()=>{this.dispatch(It(n)),this.dispatch(Vl(c))}),r}async refreshStore(e,i){const a=await this.enqueueRequest({method:o.GET,url:"/issue-types/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(vh(a)),a}}class hF extends R{async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get issue updates",method:o.GET,url:"/issue-updates/",queryParams:{limit:E,paginate:!0,issue__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get issue updates",method:o.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(qh(n)),n}}const mF=1800;function pF(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 AF extends ob{constructor(){super(...arguments);S(this,"_getRenewedTokens",async i=>{const a=this.enqueueRequest({description:"Get renewed tokens",method:o.POST,url:this.refreshTokensUrl,payload:{refresh:i},isAuthNeeded:!1,blockers:[],blocks:[],checkAuth:!1,immediate:!0});let n;try{n=await a}catch(c){console.error("Could not renew tokens; clearing auth",c),this.clearAuth();return}if(!n.access)throw new Error("Missing access token");return{accessToken:n.access,refreshToken:n.refresh??this.getRefreshToken()}})}clearAuth(){console.debug(this.constructor.name,"clearing auth;"),this.dispatch(yu(!1)),this.clearTokens(),this.dispatch(g()),this.dispatch(g())}async renewTokens(){const i=this.getRefreshToken();if(!i)throw new Error("No refresh token found");console.debug(this.constructor.name,"renewing tokens");try{const a=await this._getRenewedTokens(i);if(!a)return;console.log("Got renewed tokens"),this.setTokens(a)}catch(a){throw console.error("Could not renew tokens; clearing auth",a),this.clearAuth(),a}}tokenIsExpiringSoon(){const i=this.getAccessToken();if(!i)return!1;const a=Date.now()/1e3;let n;try{n=Vp(i).exp??a}catch{n=a}return n-a<mF}getAuthHeader(){return`Bearer ${this.getAccessToken()}`}async prepareAuth(){if(this.tokenIsExpiringSoon()){console.debug(this.constructor.name,"preparing auth");try{await this.renewTokens()}catch(i){return i instanceof D&&this.clearAuth(),i instanceof Error?Promise.reject(i):Promise.reject(new Error((i??xe).toString()))}}}async handleUnauthorized(i,a){const n=this.client.store.getState();if(i.url.endsWith("/token/refresh/"))throw n.authReducer.isLoggedIn&&console.warn("No signed-in user to sign out."),this.clearAuth(),new D({message:"You have been signed out due to inactivity.",response:a,discard:!0});if(n.authReducer.isLoggedIn)await this.renewTokens();else throw console.debug("Forbidden; user is not logged in."),new D({message:"Incorrect username or password.",response:a,discard:!0})}async initAuth(i){const a=Je.v4();return console.debug(this.constructor.name,"Initiating auth"),this.enqueueRequest({uuid:a,description:"Get token pair",method:o.POST,url:this.initTokensUrl,payload:i,isAuthNeeded:!1,checkAuth:!1,immediate:!0,blockers:[],blocks:[]}).then(n=>{this.setTokens(pF(n))})}}class fF extends R{update(e){const{store:i}=this.client,a=bn(e.uuid)(i.getState()),n={...a,...e};this.dispatch(Jt(n));const c=this.enqueueRequest({description:"Edit organization access",method:o.PATCH,url:`/organization-accesses/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(Jt(r))}).catch(r=>{throw this.dispatch(Jt(a)),r}),[n,c]}async remove(e){const{store:i}=this.client,a=i.getState(),n=bn(e)(a),c=Zh(n.user)(a);this.dispatch(xh(n.uuid)),this.dispatch(Wh(n.user));try{await this.enqueueRequest({description:"Remove organization access",method:o.DELETE,url:`/organization-accesses/${n.uuid}/`,blockers:[n.uuid],blocks:[]})}catch(r){throw this.dispatch(Qh(n)),this.dispatch(Hh(c)),r}}async refreshStore(e,i){const a=await this.enqueueRequest({description:"Get organization accesses",method:o.GET,url:"/organization-accesses/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(Xh(a)),a}}class yF extends R{async add(e){const i=await this.enqueueRequest({description:"Create organization",method:o.POST,url:"/organizations/",payload:e,blockers:[],blocks:[]});return this.dispatch(am(i)),i}async update(e){const i=await this.enqueueRequest({description:"Edit organization",method:o.PATCH,url:`/organizations/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return this.dispatch(nm(i)),i}async invite(e,i){return this.enqueueRequest({description:"Invite user to organization",method:o.POST,url:`/organizations/${e}/invite/${i}/`,blockers:[],blocks:[]})}async refreshStore(e){const i=await this.enqueueRequest({description:"Fetch organizations",method:o.GET,url:"/organizations/",blockers:[],blocks:[]},e);return this.dispatch(im(i)),i}}class SF extends R{add(e){const i=F(e);this.dispatch(_n(i));const a=this.enqueueRequest({description:"Add project access",method:o.POST,url:"/project-accesses/",payload:w(i),blockers:[i.organization_access,i.project],blocks:[i.uuid]});return a.then(n=>{this.dispatch(Tt(n))}).catch(n=>{throw this.dispatch(Rn(i.uuid)),n}),[i,a]}update(e){const{store:i}=this.client,a=wn(e.uuid)(i.getState()),n={...a,...e};this.dispatch(Tt(n));const c=this.enqueueRequest({description:"Edit project access",method:o.PATCH,url:`/project-accesses/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[]});return c.then(r=>{this.dispatch(Tt(r))}).catch(r=>{throw this.dispatch(Tt(a)),r}),[n,c]}async remove(e){const{store:i}=this.client,a=wn(e)(i.getState());this.dispatch(Rn(e));try{await this.enqueueRequest({description:"Delete project access",method:o.DELETE,url:`/project-accesses/${e}/`,blockers:[e],blocks:[]})}catch(n){throw this.dispatch(_n(a)),n}}async refreshStore(e,i){const a=await this.enqueueRequest({description:"Get project accesses",method:o.GET,url:"/project-accesses/",queryParams:{project__organization_owner:e},blockers:[],blocks:[]},i);return this.dispatch(Am(a)),a}}class IF extends He{constructor(){super(...arguments);S(this,"name","Project Attachment");S(this,"url","/project-attachments");S(this,"addAttachments",bm);S(this,"updateAttachments",Om);S(this,"removeAttachments",En);S(this,"removeAttachment",_m);S(this,"setAttachment",Fm);S(this,"selectAttachment",wm)}buildOfflineAttachment(i){return F({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,project:i.modelUuid})}buildAttachmentPayload(i){return{...i,project:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.projectUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const n=await this.enqueueRequest({description:"Get project attachments",method:o.GET,url:`${this.url}/`,queryParams:{project__organization_owner:i},blockers:[],blocks:[]},a);return this.dispatch(gm(n)),n}}class TF extends R{async saveExisting(e){if(!e.uuid)throw new Error("You can only use this method to save existing project files. The one provided has no uuid.");const i={...e};delete i.file;const a=this.enqueueRequest({method:o.PATCH,url:`/project-files/${e.uuid}/`,payload:i,blockers:[e.uuid],blocks:[e.uuid]});return a.then(n=>{this.dispatch(jn(n))}),a}saveActive(){const{store:e}=this.client,i=e.getState(),a=i.projectFileReducer.activeProjectFileId;if(!a)throw new Error("No active project file");const n=i.projectFileReducer.instances[a];if(!n)throw new Error("No active project file");if(!n.bounds&&!n.canvas_bounds)throw new Error("Project file must either have bounds or canvas_bounds set");let c;if(typeof n.file=="string"&&!n.file.startsWith("blob:")){const m={...n};delete m.file,c={method:o.PATCH,url:`/project-files/${a}/`,payload:m,blockers:[a],blocks:[a]}}else c=new Promise((m,u)=>{this.client.files.uploadFileToS3(n.file_sha1).then(([h])=>{m({method:o.POST,url:`/project-files${n.project}/`,payload:{...n,...h},blockers:[a],blocks:[a]})}).catch(u)});const l=Promise.resolve(c).then(m=>this.enqueueRequest(m));return l.then(m=>{this.dispatch(jn(m))}),this.dispatch(km),this.dispatch(Cm(null)),this.dispatch(Dm(!1)),[n,l]}delete(e){return this.dispatch(zm(e)),this.enqueueRequest({method:o.DELETE,url:`/project-files/${e}`,blockers:[e],blocks:[]})}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get project files",method:o.GET,url:"/project-files/",queryParams:{limit:E,paginate:!0,project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get project files",method:o.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(jm(n)),n}}class gF extends R{async add(e){const i=await this.enqueueRequest({description:"Create project",method:o.POST,url:"/projects/",payload:w(e),blockers:[],blocks:[]});return this.dispatch(zn(i)),i}async update(e){if(!e.bounds&&!e.canvas_bounds)throw new Error("Project must either have bounds or canvas_bounds set");return this.dispatch(Hm(e)),await this.enqueueRequest({description:"Update project",method:o.PATCH,url:`/projects/${e.uuid}/`,payload:{name:e.name,bounds:e.bounds},blockers:[e.uuid],blocks:[e.uuid]})}async delete(e){const{store:i}=this.client,a=i.getState(),n=Km(e)(a);if(!n)throw new Error("Expected project to exist");const c=Gm(a).filter(m=>m.project===e);this.dispatch(Um(c.map(({uuid:m})=>m)));const r=Mm(n.uuid)(a);this.dispatch(En(r.map(({uuid:m})=>m)));const l=Im(e)(a);this.dispatch(ym(l.map(({uuid:m})=>m))),this.dispatch(Un(n.uuid));try{await this.enqueueRequest({description:"Delete project",method:o.DELETE,url:`/projects/${e}/`,blockers:[e],blocks:[]}),this.dispatch(Un(n.uuid))}catch(m){throw this.dispatch(zn(n)),this.dispatch(fm(Object.values(l))),this.dispatch(qm(c)),this.dispatch(Pm(r)),m}}async refreshStore(e,i){const a=await this.enqueueRequest({description:"Fetch projects",method:o.GET,url:"/projects/",queryParams:{organization_owner:e},blockers:[],blocks:[]},i);return this.dispatch(Nm(a)),a}}class bF extends R{add(e){const i=F(e);this.dispatch(Qm(i));const a=this.enqueueRequest({description:"Create team membership",method:o.POST,url:"/team-memberships/",payload:w(i),blockers:[e.team],blocks:[i.uuid]});return a.then(n=>{this.dispatch(Bn(n))}).catch(()=>{this.dispatch(Gn(i.uuid))}),[i,a]}async delete(e){const{store:i}=this.client,a=i.getState(),n=tp(e)(a);if(!n)throw new Error(`Expected team membership with uuid ${e} to exist`);this.dispatch(Gn(e));try{return await this.enqueueRequest({description:"Delete team membership",method:o.DELETE,url:`/team-memberships/${e}/`,blockers:[e],blocks:[e]})}catch(c){throw this.dispatch(Bn(n)),c}}async refreshStore(e,i){const a=await this.enqueueRequest({description:"Fetch team memberships",method:o.GET,url:"/team-memberships/",queryParams:{team__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Xm(a)),a}}class FF extends R{add(e){const i=F({...e,submitted_at:new Date().toISOString()});this.dispatch(ap(i));const a=this.enqueueRequest({description:"Create team",method:o.POST,url:"/teams/",payload:w(i),blockers:[],blocks:[i.uuid]});return a.then(n=>{this.dispatch(gt(n))}).catch(()=>{this.dispatch(Nn(i.uuid))}),[i,a]}update(e){const{store:i}=this.client,a=Wn(e.uuid)(i.getState());if(!a)throw new Error(`Expected team with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(np(n));const c=this.enqueueRequest({description:"Update team",method:o.PATCH,url:`/teams/${e.uuid}/`,payload:w(e),blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(gt(r))}).catch(()=>{this.dispatch(gt(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Wn(e)(a);if(!n)throw new Error(`Expected team with uuid ${e} to exist`);this.dispatch(Nn(e));try{return await this.enqueueRequest({description:"Delete team",method:o.DELETE,url:`/teams/${e}/`,blockers:[e],blocks:[e]})}catch(c){throw this.dispatch(gt(n)),c}}async refreshStore(e,i){const a=await this.enqueueRequest({description:"Fetch teams",method:o.GET,url:"/teams/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(ip(a)),a}}class PF extends R{async refreshStore(e,i){const a=await this.enqueueRequest({description:"Fetch organization users",method:o.GET,url:`/organizations/${e}/users/`,blockers:[],blocks:[]},i);return this.dispatch(Nh(a)),a}}class OF{constructor(e){S(this,"store");this.store=e}async enqueueRequest(e,i,a,n){return this._enqueueRequest(e,i,a,n).then(c=>{if(c instanceof D)throw c;return c})}_enqueueRequest(e,i,a,n){const c=new cc,r={...e,BASE_URL:i,serviceName:a};if(e.immediate){const l={...r,uuid:e.uuid??Je.v4()},m={payload:l,type:"",meta:{offline:{effect:{timestamp:new Date().toISOString(),request:l,BASE_URL:i,serviceName:a}}}};Zn(m,this,n).then(u=>{c.resolve(u.body)}).catch(u=>{Jn(u,m),u instanceof Error?c.reject(u):c.reject(new Error((u??xe).toString()))})}else{const l=this.store.dispatch(om(r)),m=h=>{if(h)c.resolve(h.body);else{const p=new D({message:"Could not get a response from the server.",response:h,discard:!0});c.reject(p)}},u=h=>{h instanceof D?h.options.discard=!0:(console.error("Received an unexpected error while processing a request:",h,`
|
|
14
|
+
external URLs and therefore not prepended with VITE_API_URL.`;throw new Error(f)}const p=u.type.split("/")[1];if(!p)throw new Error("File has no extension");const A=n??h+"."+p;if(u=dc(u,A),!u.name)throw new Error("Failed to set file's name");await this.addCache(u,h),Qt[c]=new Promise(f=>{f(u)})}return u}}class Hb extends R{add(e){var l;const{store:i}=this.client,a=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(Ji(c));const r=this.enqueueRequest({description:"Create form identifier",method:o.POST,url:"/form-identifiers/",payload:w(c),blockers:[c.form],blocks:[c.uuid]});return r.then(m=>{this.dispatch(ht(m))}).catch(()=>{this.dispatch(Xi(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=Qi(e.uuid)(i.getState());if(!a)throw new Error(`Expected form identifier with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(ht(n));const c=this.enqueueRequest({description:"Update form identifier",method:o.PATCH,url:`/form-identifiers/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(ht(r))}).catch(()=>{this.dispatch(ht(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Qi(e)(a);if(!n)throw new Error(`Expected form identifier with uuid ${e} to exist`);this.dispatch(Xi(e));try{return await this.enqueueRequest({description:"Delete form identifier",method:o.DELETE,url:`/form-identifiers/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(Ji(n)),c}}async refreshStore(e,i){const a=await this.enqueueRequest({description:"Get form identifiers",method:o.GET,url:"/form-identifiers/",queryParams:{form__organization:e},blockers:[],blocks:[]},i);return this.dispatch(eo(a)),a}}class Wb extends R{add(e){var l;const{store:i}=this.client,a=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(ea(c));const r=this.enqueueRequest({description:"Create form identifier value",method:o.POST,url:"/form-identifier-values/",payload:w(c),blockers:[e.form_submission,e.form_identifier],blocks:[c.uuid]});return r.then(m=>{this.dispatch(mt(m))}).catch(()=>{this.dispatch(ta(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=ia(e.uuid)(i.getState());if(!a)throw new Error(`Expected form identifier value with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(mt(n));const c=this.enqueueRequest({description:"Update form identifier value",method:o.PATCH,url:`/form-identifier-values/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(mt(r))}).catch(()=>{this.dispatch(mt(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=ia(e)(a);if(!n)throw new Error(`Expected form identifier value with uuid ${e} to exist`);this.dispatch(ta(e));try{return await this.enqueueRequest({description:"Delete form identifier value",method:o.DELETE,url:`/form-identifier-values/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(ea(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get form identifier values",method:o.GET,url:"/form-identifier-values/",queryParams:{limit:E,paginate:!0,form_submission__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get form identifier values",method:o.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(no(n)),n}}class Yb extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const u of e){const{revisionUuid:h,fieldIdentifier:p,file:A}=u,f=await this.getFilePayload(A);f.sha1 in n||(n[f.sha1]=f);const T=F({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:f.sha1,created_by:a,form_revision:h,submitted_at:i,field_identifier:p});c.push(T);const b={uuid:T.uuid,file_name:A.name,field_identifier:p,file_extension:f.extension,file_sha1:f.sha1,form_revision:h};r.push(b)}this.dispatch(lo(c));const l=this.enqueueRequest({description:"Attach files to form revision",method:o.POST,url:"/form-revision-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(u=>u.form_revision),blocks:c.map(u=>u.uuid)});return l.then(u=>{this.processPresignedUrls(u.presigned_urls),this.dispatch(ho(u.attachments))}).catch(()=>{this.dispatch(mo(c.map(u=>u.uuid)))}),[c,l.then(({attachments:u})=>u)]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch organization form revision attachments",method:o.GET,url:"/form-revision-attachments/",queryParams:{form_revision__form__organization:e},blockers:[e],blocks:[]},i);return this.dispatch(oo(a)),a}}class Kb extends j{add(e){var l;const{store:i}=this.client,n=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,c=F({...e,created_by:n,submitted_at:new Date().toISOString()});this.dispatch(ca(c));const r=this.enqueueRequest({description:"Create form revision",method:o.POST,url:"/form-revisions/",payload:w(c),blockers:[e.form],blocks:[c.uuid]});return r.then(m=>{this.dispatch(Io(m))}).catch(()=>{this.dispatch(ra(c.uuid))}),[c,r]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get organization form revisions",method:o.GET,url:"/form-revisions/",queryParams:{form__organization:e},blockers:[e],blocks:[]},i);return this.dispatch(yo(a)),a}}class Zb extends j{add(e,i){var u;const{store:a}=this.client,n=new Date().toISOString(),c=(u=a.getState().userReducer.currentUser)==null?void 0:u.id,r=F({...e,submitted_at:n,created_by:c}),l=F({...i,form:r.uuid,submitted_at:n,created_by:c});this.dispatch(la(r)),this.dispatch(ca(l));const m=this.enqueueRequest({description:"Create form",method:o.POST,url:"/forms/",payload:{...w(r),initial_revision:{uuid:l.uuid,submitted_at:l.submitted_at,title:l.title,description:l.description,fields:l.fields}},blockers:[],blocks:[r.uuid,l.uuid]});return m.catch(h=>{throw this.dispatch(ha(r.uuid)),this.dispatch(ra(l.uuid)),h}),[r,l,m]}async delete(e){const{store:i}=this.client,a=i.getState(),n=vo(e)(a);if(!n)throw new Error("Expected form to exist");const c=ko(e)(a);c.length>0&&this.dispatch(Nt(c.map(({uuid:l})=>l)));const r=go(e)(a);r.length>0&&this.dispatch(To(r.map(({uuid:l})=>l))),this.dispatch(ha(e));try{return await this.enqueueRequest({description:"Delete form",method:o.DELETE,url:`/forms/${e}/`,blockers:[e],blocks:[]})}catch(l){throw this.dispatch(la(n)),r.length>0&&this.dispatch(So(r)),c.length>0&&this.dispatch(Lt(c)),l}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch organization forms",method:o.GET,url:"/forms/",queryParams:{organization:e},blockers:[e],blocks:[]},i);return this.dispatch(Po(a)),a}}class Jb extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const u of e){const{submissionUuid:h,fieldIdentifier:p,file:A}=u,f=await this.getFilePayload(A);f.sha1 in n||(n[f.sha1]=f);const T=F({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:f.sha1,created_by:a,form_submission:h,submitted_at:i,field_identifier:p});c.push(T);const b={uuid:T.uuid,file_name:A.name,file_sha1:f.sha1,file_extension:f.extension,field_identifier:p,form_submission:h};r.push(b)}this.dispatch(Bt(c));const l=this.enqueueRequest({description:"Attach files to form submission",method:o.POST,url:"/form-submission-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(u=>u.form_submission),blocks:c.map(u=>u.uuid)});return l.then(u=>{this.processPresignedUrls(u.presigned_urls),this.dispatch(Eo(u.attachments))}).catch(u=>{throw this.dispatch(Gt(c.map(h=>h.uuid))),u}),[c,l.then(({attachments:u})=>u)]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),n=jo(e)(a);this.dispatch(Gt(e));try{await this.enqueueRequest({description:"Delete form submission attachments",method:o.DELETE,url:"/form-submission-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(Bt(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get form submission attachments",method:o.GET,url:"/form-submission-attachments/",queryParams:{limit:E,paginate:!0,form_submission__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get form submission attachments",method:o.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Mo(n)),n}}class Xb extends j{add(e){var r;const{store:i}=this.client,a=i.getState(),n=F({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),c=this.enqueueRequest({description:"Add form submission",method:o.POST,url:"/form-submissions/",payload:w(n),blockers:[e.form_revision,...e.issue?[e.issue]:[],...e.asset?[e.asset]:[]],blocks:[n.uuid]});return this.dispatch(fa(n)),c.then(l=>(this.dispatch($t(l)),l)).catch(()=>{this.dispatch(ya(n.uuid))}),[n,c]}update(e){const{store:i}=this.client,a=i.getState(),n=Ta(e.uuid)(a);if(!n)throw new Error(`Expected submission with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(Co(c));const r=this.enqueueRequest({description:"Delete user form submissions",method:o.PATCH,url:`/form-submissions/${c.uuid}/`,payload:e,blockers:[c.uuid],blocks:[c.uuid]});return r.then(l=>{this.dispatch($t(l))}).catch(()=>{this.dispatch($t(n))}),[c,r]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Ta(e)(a);if(!n)throw new Error(`Expected submission with uuid ${e} to exist`);const c=qo(e)(a);this.dispatch(ya(e)),this.dispatch(Gt(c.map(r=>r.uuid)));try{return await this.enqueueRequest({description:"Delete user form submissions",method:o.DELETE,url:`/form-submissions/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(fa(n)),this.dispatch(Bt(c)),r}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Fetch form submissions",method:o.GET,url:"/form-submissions/",queryParams:{limit:E,paginate:!0,project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Fetch form submissions",method:o.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Do(n)),n}}class Qb extends j{async add(e){var p;const{store:i}=this.client,{file:a,...n}=e,c=new Date().toISOString(),r=(p=i.getState().userReducer.currentUser)==null?void 0:p.id,l=n.project,m=await this.getFilePayload(a),u=F({...n,file_name:a.name,file_sha1:m.sha1,file:URL.createObjectURL(a),submitted_at:c,created_by:r});this.dispatch(Wo(u));const h=this.enqueueRequest({description:"Add geo image",method:o.POST,url:"/geo-images/",payload:{uuid:u.uuid,submitted_at:c,title:u.title,description:u.description,geo_marker:u.geo_marker,canvas_marker:u.canvas_marker,sha1:u.file_sha1,project:u.project,file_name:u.file_name,direction:u.direction,original_date:u.original_date,file:m},blocks:[l],blockers:[l]});return h.then(A=>{this.processPresignedUrls(A.presigned_urls),this.dispatch(pt(A.geo_image))}).catch(()=>{this.dispatch(ba(u.uuid))}),[u,h.then(A=>A.geo_image)]}async bulkAdd(e,i){var p;const{store:a}=this.client,n=new Date().toISOString(),c=(p=a.getState().userReducer.currentUser)==null?void 0:p.id,r=[],l=[],m=[],u={};for(const A of e){const{file:f,...T}=A,b=await this.getFilePayload(f);b.sha1 in u||(u[b.sha1]=b);const _=F({...T,file_name:f.name,file_sha1:b.sha1,file:URL.createObjectURL(f),submitted_at:n,created_by:c,project:i});r.push(_),l.push(_.uuid),m.push({uuid:_.uuid,sha1:_.file_sha1,file_name:_.file_name,title:_.title,description:_.description,geo_marker:_.geo_marker,canvas_marker:_.canvas_marker,direction:_.direction,original_date:_.original_date})}this.dispatch(Yo(r));const h=this.enqueueRequest({description:"Bulk add geo images",method:o.POST,url:"/geo-images/bulk/",payload:{submitted_at:n,project:i,geo_images:m,files:Object.values(u)},blocks:[i],blockers:l});return h.then(A=>{this.processPresignedUrls(A.presigned_urls),this.dispatch(Ho(A.geo_images))}).catch(()=>{this.dispatch(Zo(l))}),[r,h.then(A=>A.geo_images)]}update(e){const{store:i}=this.client,a=i.getState(),n=Fa(e.uuid)(a);if(!n)throw new Error(`Map image with uuid ${e.uuid} does not exist in the store`);const c={...n,...e};this.dispatch(Ko(c));const r=this.enqueueRequest({description:"Update geo image",method:o.PATCH,url:`/geo-images/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return r.then(l=>{this.dispatch(pt(l))}).catch(()=>{this.dispatch(pt(n))}),[c,r]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Fa(e)(a);if(!n)throw new Error(`Map image with uuid ${e} does not exist in the store`);this.dispatch(ba(e));const c=this.enqueueRequest({description:"Delete geo image",method:o.DELETE,url:`/geo-images/${e}/`,blocks:[e],blockers:[e]});return c.catch(()=>{this.dispatch(pt(n))}),c}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get geo images",method:o.GET,url:"/geo-images/",queryParams:{project:e},blocks:[e],blockers:[]},i);return this.dispatch(No(a)),a}}class xb extends R{add(e){var l;const{store:i}=this.client,a=new Date().toISOString(),n=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,c=F({...e,submitted_at:a,created_by:n});this.dispatch(Oa(c));const r=this.enqueueRequest({description:"Add issue association",method:o.POST,url:"/issue-associations/",payload:w(c),blockers:[e.associated_issue,...e.issue?[e.issue]:[],...e.asset?[e.asset]:[]],blocks:[c.uuid]});return r.then(m=>{this.dispatch(tl(m))}).catch(()=>{this.dispatch(Ra(c.uuid))}),[c,r]}async delete(e){const{store:i}=this.client,a=sl(e)(i.getState());if(!a)throw new Error(`Issue association with uuid ${e} not found in store.`);this.dispatch(Ra(e));const n=this.enqueueRequest({description:"Delete issue association",method:o.DELETE,url:`/issue-associations/${e}/`,blockers:[e],blocks:[]});return n.catch(()=>{this.dispatch(Oa(a))}),n}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Fetch issue associations",method:o.GET,url:"/issue-associations/",queryParams:{limit:E,paginate:!0,associated_issue__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Fetch issue associations",method:o.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(el(n)),n}}class eF extends He{constructor(){super(...arguments);S(this,"name","Issue Attachment");S(this,"url","/issue-attachments");S(this,"initializeAttachments",Ma);S(this,"addAttachments",Ea);S(this,"updateAttachments",ul);S(this,"removeAttachments",Va);S(this,"removeAttachment",ol);S(this,"setAttachment",dl);S(this,"selectAttachment",pl)}buildOfflineAttachment(i){return F({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,issue:i.modelUuid})}buildAttachmentPayload(i){return{...i,issue:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.issueUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const c=(await this.performPagination({immediate:!0,description:"Get issue attachments",method:o.GET,url:`${this.url}/`,queryParams:{limit:E,paginate:!0,issue__project:i},blocks:[],blockers:[]},r=>({immediate:!0,description:"Get issue attachments",method:o.GET,url:r,blockers:[],blocks:[]}),a)).flat();return this.dispatch(Ma(c)),c}}class tF extends He{constructor(){super(...arguments);S(this,"name","Issue Comment Attachment");S(this,"url","/issue-comment-attachments");S(this,"initializeAttachments",qa);S(this,"addAttachments",yl);S(this,"updateAttachments",Il);S(this,"removeAttachments",gl);S(this,"removeAttachment",Tl);S(this,"setAttachment",Sl);S(this,"selectAttachment",Pl)}buildOfflineAttachment(i){return F({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,issue_comment:i.modelUuid})}buildAttachmentPayload(i){return{...i,issue_comment:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.issueCommentUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const c=(await this.performPagination({immediate:!0,description:"Get issue comment attachments",method:o.GET,url:`${this.url}/`,queryParams:{limit:E,paginate:!0,issue_comment__issue__project:i},blocks:[],blockers:[]},r=>({immediate:!0,description:"Get issue comment attachments",method:o.GET,url:r,blockers:[],blocks:[]}),a)).flat();return this.dispatch(qa(c)),c}}class sF extends R{add(e){var c;const{store:i}=this.client,a=F({...e,author:(c=i.getState().userReducer.currentUser)==null?void 0:c.id,submitted_at:new Date().toISOString()});this.dispatch(Ua(a));const n=this.enqueueRequest({description:"Add issue comment",method:o.POST,url:"/issue-comments/",payload:w(a),blockers:[e.issue],blocks:[a.uuid]});return n.catch(()=>{this.dispatch(Ca(a.uuid))}),[a,n]}update(e){const{store:i}=this.client,a=ka(e.uuid)(i.getState());if(!a)throw new Error(`Comment with uuid ${e.uuid} not found in store`);const n={...a,...e};this.dispatch(Da(n));const c=this.enqueueRequest({description:"Edit issue comment",method:o.PATCH,url:`/issue-comments/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.catch(()=>{this.dispatch(Da(a))}),[n,c]}remove(e){const{store:i}=this.client,a=ka(e)(i.getState());if(!a)throw new Error(`Comment with uuid ${e} not found in store`);this.dispatch(Ca(e));const n=this.enqueueRequest({description:"Delete comment",method:o.DELETE,url:`/issue-comments/${e}/`,blockers:[e],blocks:[]});return n.catch(()=>{this.dispatch(Ua(a))}),n}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get comments",method:o.GET,url:"/issue-comments/",queryParams:{issue__project:e},blockers:[],blocks:[]},i);return this.dispatch(Rl(a)),a}}class iF extends R{add(e){var m;const{store:i}=this.client,a=i.getState(),n=new Date().toISOString(),c=(m=a.userReducer.currentUser)==null?void 0:m.id,r=F({...e,submitted_at:n,created_by:c});this.dispatch(Ga(r));const l=this.enqueueRequest({description:"Create issue",method:o.POST,url:"/issues/",payload:w(r),blockers:[r.project,r.issue_type,...r.category?[r.category]:[]],blocks:[r.uuid]});return l.then(u=>{this.dispatch(Ht(u))}).catch(u=>{throw this.dispatch($a(r.uuid)),u}),[r,l]}update(e){var m;const i=this.client.store.getState(),a=Ha(e.uuid)(i);if(!a)throw new Error(`Attempting to update an issue with uuid ${e.uuid} that doesn't exist in the store`);const n={...a,...e};this.dispatch(Ht(n));const c={};for(const u of[V.TITLE,V.DESCRIPTION,V.STATUS,V.CATEGORY,V.PRIORITY,V.ASSIGNED_TO,V.DUE_DATE])if(u in e&&e[u]!==a[u])switch(u){case V.PRIORITY:case V.STATUS:{const h=e[u];c[u]=h!==void 0?Number(h):null;break}case V.DUE_DATE:case V.DESCRIPTION:case V.TITLE:c[u]=e[u]??null;break;case V.CATEGORY:{let h=null;const p=e[u];if(p&&(h=i.categoryReducer.instances[p]??null,!h))throw new Error(`Trying to update issue category to ${p} which does not exist in store`);c[u]=h?{name:h.name,color:h.color,uuid:h.uuid}:null;break}case V.ASSIGNED_TO:{let h=null;const p=e[u];if(p&&(h=i.userReducer.instances[p]??null,!h))throw new Error(`Trying to update issue assigned_to to ${p} which does not exist in store`);c[u]=h?{full_name:h.username,id:h.id}:null;break}}const r=F({created_by:(m=i.userReducer.currentUser)==null?void 0:m.id,submitted_at:new Date().toISOString(),issue:a.uuid,changes:c});this.dispatch(zh(r));const l=this.enqueueRequest({description:"Edit issue",method:o.PATCH,url:`/issues/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return l.catch(()=>{this.dispatch(Ht(a)),this.dispatch(Dh(r.uuid))}),[n,l]}async remove(e){const{store:i}=this.client,a=i.getState(),n=Ha(e)(a);if(!n)throw new Error(`No issue with uuid ${e} found in the store`);const c=ml(e)(a),r=Gh(e)(a),l=Bo(e)(a),m={};for(const h of il(e)(a))m[h.uuid]=h;for(const h of al(e)(a))m[h.uuid]=h;const u=Object.values(m);this.dispatch($a(e)),c.length>0&&this.dispatch(Va(c.map(({uuid:h})=>h))),r.length>0&&this.dispatch(Ch(r.map(({uuid:h})=>h))),l.length>0&&this.dispatch(Nt(l.map(({uuid:h})=>h))),u.length>0&&this.dispatch(va(u.map(({uuid:h})=>h)));try{return await this.enqueueRequest({description:"Delete issue",method:o.DELETE,url:`/issues/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(Ga(n)),this.dispatch(Ea(c)),this.dispatch(Uh(r)),this.dispatch(Lt(l)),this.dispatch(_a(u)),h}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get issues",method:o.GET,url:"/issues/",queryParams:{limit:E,paginate:!0,project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get issues",method:o.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(El(n)),n}}class aF extends He{constructor(){super(...arguments);S(this,"name","Issue Type Attachment");S(this,"url","/issue-type-attachments");S(this,"initializeAttachments",Ya);S(this,"addAttachments",Dl);S(this,"updateAttachments",kl);S(this,"removeAttachments",Gl);S(this,"removeAttachment",Bl);S(this,"setAttachment",Cl);S(this,"selectAttachment",Nl)}buildOfflineAttachment(i){return F({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,issue_type:i.modelUuid})}buildAttachmentPayload(i){return{...i,issue_type:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.issueTypeUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const n=await this.enqueueRequest({immediate:!0,description:"Get issue type attachments",method:o.GET,url:`${this.url}/`,queryParams:{issue_type__organization:i},blocks:[],blockers:[]},a);return this.dispatch(Ya(n)),n}}class nF extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const u of e){const{fieldsRevisionUuid:h,fieldIdentifier:p,file:A}=u,f=await this.getFilePayload(A);f.sha1 in n||(n[f.sha1]=f);const T=F({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:f.sha1,created_by:a,fields_revision:h,submitted_at:i,field_identifier:p});c.push(T);const b={uuid:T.uuid,file_name:A.name,file_extension:f.extension,field_identifier:p,file_sha1:f.sha1,fields_revision:h};r.push(b)}this.dispatch(Kl(c));const l=this.enqueueRequest({description:"Add issue type fields attachments",method:o.POST,url:"/issue-type-fields-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(u=>u.fields_revision),blocks:c.map(u=>u.uuid)});return l.then(u=>{this.processPresignedUrls(u.presigned_urls),this.dispatch(Zl(u.attachments))}).catch(()=>{this.dispatch(Jl(c.map(u=>u.uuid)))}),[c,l.then(({attachments:u})=>u)]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"get issue type fields attachments",method:o.GET,url:"/issue-type-fields-attachments/",queryParams:{fields_revision__issue_type__organization:e},blockers:[e],blocks:[]},i);return this.dispatch(Yl(a)),a}}class cF extends R{add(e){var l;const{store:i}=this.client,a=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(ch(c));const r=this.enqueueRequest({description:"Add Issue Type Fields",method:o.POST,url:"/issue-type-fields/",payload:w(c),blockers:[c.issue_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(rh(m))}).catch(m=>{throw this.dispatch(dh(c.uuid)),m}),[c,r]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get Issue Type Fields",method:o.GET,url:"/issue-type-fields/",queryParams:{issue_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(nh(a)),a}}class rF extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const u of e){const{fieldValuesUuid:h,fieldIdentifier:p,file:A}=u,f=await this.getFilePayload(A);f.sha1 in n||(n[f.sha1]=f);const T=F({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:f.sha1,created_by:a,field_values:h,submitted_at:i,field_identifier:p});c.push(T);const b={uuid:T.uuid,file_name:A.name,file_sha1:f.sha1,file_extension:f.extension,field_identifier:p,field_values:h};r.push(b)}this.dispatch(Yt(c));const l=this.enqueueRequest({description:"Add issue type field values attachments",method:o.POST,url:"/issue-type-field-values-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(u=>u.field_values),blocks:c.map(u=>u.uuid)});return l.then(({presigned_urls:u,attachments:h})=>{this.processPresignedUrls(u),this.dispatch(mh(h))}).catch(u=>{throw this.dispatch(Kt(c.map(h=>h.uuid))),u}),[c,l.then(({attachments:u})=>u)]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),n=Ah(e)(a);this.dispatch(Kt(e));try{await this.enqueueRequest({description:"Delete issue type field values attachments",method:o.DELETE,url:"/issue-type-field-values-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(Yt(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get issue type field values attachments",method:o.GET,url:"/issue-type-field-values-attachments/",queryParams:{limit:E,paginate:!0,field_values__issue__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get issue type field values attachments",method:o.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(hh(n)),n}}class dF extends R{add(e){var r;const{store:i}=this.client,a=i.getState(),n=F({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),c=this.enqueueRequest({description:"Add issue type field values",method:o.POST,url:"/issue-type-field-values/",payload:w(n),blockers:[e.issue,e.fields_revision],blocks:[n.uuid]});return this.dispatch(Ja(n)),c.then(l=>(this.dispatch(ft(l)),l)).catch(()=>{this.dispatch(Xa(n.uuid))}),[n,c]}update(e){const{store:i}=this.client,a=i.getState(),n=xa(e.uuid)(a);if(!n)throw new Error(`Expected IssueTypeFieldValues with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(ft(c));const r=this.enqueueRequest({description:"Update issue type field values",method:o.PATCH,url:`/issue-type-field-values/${e.uuid}/`,payload:e,blockers:[c.uuid,c.fields_revision,c.issue],blocks:[c.uuid]});return r.then(l=>{this.dispatch(ft(l))}).catch(()=>{this.dispatch(ft(n))}),[c,r]}async delete(e){const{store:i}=this.client,a=i.getState(),n=xa(e)(a);if(!n)throw new Error(`Expected submission with uuid ${e} to exist`);const c=fh(e)(a);this.dispatch(Xa(e)),this.dispatch(Kt(c.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete issue type field values",method:o.DELETE,url:`/issue-type-field-values/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(Ja(n)),this.dispatch(Yt(c)),r}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get issue type field values",method:o.GET,url:"/issue-type-field-values/",queryParams:{limit:E,paginate:!0,issue__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get issue type field values",method:o.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(th(n)),n}}class uF extends R{add(e){var l;const{store:i}=this.client,a=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(nn(c));const r=this.enqueueRequest({description:"Create issue type identifier",method:o.POST,url:"/issue-type-identifiers/",payload:w(c),blockers:[c.issue_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(yt(m))}).catch(()=>{this.dispatch(cn(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=rn(e.uuid)(i.getState());if(!a)throw new Error(`Expected issue type identifier with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(yt(n));const c=this.enqueueRequest({description:"Update issue type identifier",method:o.PATCH,url:`/issue-type-identifiers/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(yt(r))}).catch(()=>{this.dispatch(yt(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=rn(e)(a);if(!n)throw new Error(`Expected issue type identifier with uuid ${e} to exist`);this.dispatch(cn(e));try{return await this.enqueueRequest({description:"Delete issue type identifier",method:o.DELETE,url:`/issue-type-identifiers/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(nn(n)),c}}async refreshStore(e,i){const a=await this.enqueueRequest({description:"Get issue type identifiers",method:o.GET,url:"/issue-type-identifiers/",queryParams:{issue_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Ih(a)),a}}class oF extends R{add(e){var l;const{store:i}=this.client,a=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(un(c));const r=this.enqueueRequest({description:"Create issue type identifier value",method:o.POST,url:"/issue-type-identifier-values/",payload:w(c),blockers:[e.issue,e.issue_type_identifier],blocks:[c.uuid]});return r.then(m=>{this.dispatch(St(m))}).catch(()=>{this.dispatch(on(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=hn(e.uuid)(i.getState());if(!a)throw new Error(`Expected issue type identifier value with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(St(n));const c=this.enqueueRequest({description:"Update issue type identifier value",method:o.PATCH,url:`/issue-type-identifier-values/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(St(r))}).catch(()=>{this.dispatch(St(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=hn(e)(a);if(!n)throw new Error(`Expected issue type identifier value with uuid ${e} to exist`);this.dispatch(on(e));try{return await this.enqueueRequest({description:"Delete issue type identifier value",method:o.DELETE,url:`/issue-type-identifier-values/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(un(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get issue type identifier values",method:o.GET,url:"/issue-type-identifier-values/",queryParams:{limit:E,paginate:!0,issue__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get issue type identifier values",method:o.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Ph(n)),n}}class lF extends R{add(e){var r;const{store:i}=this.client,a=i.getState(),n=F({...e,submitted_at:new Date().toISOString(),created_by:(r=a.userReducer.currentUser)==null?void 0:r.id});this.dispatch(wh(n));const c=this.enqueueRequest({method:o.POST,url:"/issue-types/",payload:w(n),blockers:[],blocks:[n.uuid]});return c.then(l=>{this.dispatch(It(l))}).catch(()=>{this.dispatch(pn(n.uuid))}),[n,c]}update(e){const{store:i}=this.client,a=i.getState(),n=fn(e.uuid)(a);if(!n)throw new Error(`IssueType with uuid ${e.uuid} does not exist in the store.`);const c={...n,...e};this.dispatch(Mh(c));const r=this.enqueueRequest({method:o.PATCH,url:`/issue-types/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(l=>{this.dispatch(It(l))}).catch(()=>{this.dispatch(It(n))}),[c,r]}delete(e){const{store:i}=this.client,a=i.getState(),n=fn(e)(a);if(!n)throw new Error(`IssueType with uuid ${e} does not exist in the store.`);const c=ql(e)(a);this.dispatch(pn(e)),this.dispatch(jl(c.map(l=>l.uuid)));const r=this.enqueueRequest({method:o.DELETE,url:`/issue-types/${e}/`,blockers:[e],blocks:[]});return r.catch(()=>{this.dispatch(It(n)),this.dispatch(Vl(c))}),r}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,method:o.GET,url:"/issue-types/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(vh(a)),a}}class hF extends R{async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get issue updates",method:o.GET,url:"/issue-updates/",queryParams:{limit:E,paginate:!0,issue__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get issue updates",method:o.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(qh(n)),n}}const mF=1800;function pF(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 AF extends ob{constructor(){super(...arguments);S(this,"_getRenewedTokens",async i=>{const a=this.enqueueRequest({description:"Get renewed tokens",method:o.POST,url:this.refreshTokensUrl,payload:{refresh:i},isAuthNeeded:!1,blockers:[],blocks:[],checkAuth:!1,immediate:!0});let n;try{n=await a}catch(c){console.error("Could not renew tokens; clearing auth",c),this.clearAuth();return}if(!n.access)throw new Error("Missing access token");return{accessToken:n.access,refreshToken:n.refresh??this.getRefreshToken()}})}clearAuth(){console.debug(this.constructor.name,"clearing auth;"),this.dispatch(yu(!1)),this.clearTokens(),this.dispatch(g()),this.dispatch(g())}async renewTokens(){const i=this.getRefreshToken();if(!i)throw new Error("No refresh token found");console.debug(this.constructor.name,"renewing tokens");try{const a=await this._getRenewedTokens(i);if(!a)return;console.log("Got renewed tokens"),this.setTokens(a)}catch(a){throw console.error("Could not renew tokens; clearing auth",a),this.clearAuth(),a}}tokenIsExpiringSoon(){const i=this.getAccessToken();if(!i)return!1;const a=Date.now()/1e3;let n;try{n=Vp(i).exp??a}catch{n=a}return n-a<mF}getAuthHeader(){return`Bearer ${this.getAccessToken()}`}async prepareAuth(){if(this.tokenIsExpiringSoon()){console.debug(this.constructor.name,"preparing auth");try{await this.renewTokens()}catch(i){return i instanceof D&&this.clearAuth(),i instanceof Error?Promise.reject(i):Promise.reject(new Error((i??xe).toString()))}}}async handleUnauthorized(i,a){const n=this.client.store.getState();if(i.url.endsWith("/token/refresh/"))throw n.authReducer.isLoggedIn&&console.warn("No signed-in user to sign out."),this.clearAuth(),new D({message:"You have been signed out due to inactivity.",response:a,discard:!0});if(n.authReducer.isLoggedIn)await this.renewTokens();else throw console.debug("Forbidden; user is not logged in."),new D({message:"Incorrect username or password.",response:a,discard:!0})}async initAuth(i){const a=Je.v4();return console.debug(this.constructor.name,"Initiating auth"),this.enqueueRequest({uuid:a,description:"Get token pair",method:o.POST,url:this.initTokensUrl,payload:i,isAuthNeeded:!1,checkAuth:!1,immediate:!0,blockers:[],blocks:[]}).then(n=>{this.setTokens(pF(n))})}}class fF extends R{update(e){const{store:i}=this.client,a=bn(e.uuid)(i.getState()),n={...a,...e};this.dispatch(Jt(n));const c=this.enqueueRequest({description:"Edit organization access",method:o.PATCH,url:`/organization-accesses/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(Jt(r))}).catch(r=>{throw this.dispatch(Jt(a)),r}),[n,c]}async remove(e){const{store:i}=this.client,a=i.getState(),n=bn(e)(a),c=Zh(n.user)(a);this.dispatch(xh(n.uuid)),this.dispatch(Wh(n.user));try{await this.enqueueRequest({description:"Remove organization access",method:o.DELETE,url:`/organization-accesses/${n.uuid}/`,blockers:[n.uuid],blocks:[]})}catch(r){throw this.dispatch(Qh(n)),this.dispatch(Hh(c)),r}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get organization accesses",method:o.GET,url:"/organization-accesses/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(Xh(a)),a}}class yF extends R{async add(e){const i=await this.enqueueRequest({description:"Create organization",method:o.POST,url:"/organizations/",payload:e,blockers:[],blocks:[]});return this.dispatch(am(i)),i}async update(e){const i=await this.enqueueRequest({description:"Edit organization",method:o.PATCH,url:`/organizations/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return this.dispatch(nm(i)),i}async invite(e,i){return this.enqueueRequest({description:"Invite user to organization",method:o.POST,url:`/organizations/${e}/invite/${i}/`,blockers:[],blocks:[]})}async refreshStore(e){const i=await this.enqueueRequest({immediate:!0,description:"Fetch organizations",method:o.GET,url:"/organizations/",blockers:[],blocks:[]},e);return this.dispatch(im(i)),i}}class SF extends R{add(e){const i=F(e);this.dispatch(_n(i));const a=this.enqueueRequest({description:"Add project access",method:o.POST,url:"/project-accesses/",payload:w(i),blockers:[i.organization_access,i.project],blocks:[i.uuid]});return a.then(n=>{this.dispatch(Tt(n))}).catch(n=>{throw this.dispatch(Rn(i.uuid)),n}),[i,a]}update(e){const{store:i}=this.client,a=wn(e.uuid)(i.getState()),n={...a,...e};this.dispatch(Tt(n));const c=this.enqueueRequest({description:"Edit project access",method:o.PATCH,url:`/project-accesses/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[]});return c.then(r=>{this.dispatch(Tt(r))}).catch(r=>{throw this.dispatch(Tt(a)),r}),[n,c]}async remove(e){const{store:i}=this.client,a=wn(e)(i.getState());this.dispatch(Rn(e));try{await this.enqueueRequest({description:"Delete project access",method:o.DELETE,url:`/project-accesses/${e}/`,blockers:[e],blocks:[]})}catch(n){throw this.dispatch(_n(a)),n}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get project accesses",method:o.GET,url:"/project-accesses/",queryParams:{project__organization_owner:e},blockers:[],blocks:[]},i);return this.dispatch(Am(a)),a}}class IF extends He{constructor(){super(...arguments);S(this,"name","Project Attachment");S(this,"url","/project-attachments");S(this,"addAttachments",bm);S(this,"updateAttachments",Om);S(this,"removeAttachments",En);S(this,"removeAttachment",_m);S(this,"setAttachment",Fm);S(this,"selectAttachment",wm)}buildOfflineAttachment(i){return F({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,project:i.modelUuid})}buildAttachmentPayload(i){return{...i,project:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.projectUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const n=await this.enqueueRequest({immediate:!0,description:"Get project attachments",method:o.GET,url:`${this.url}/`,queryParams:{project__organization_owner:i},blockers:[],blocks:[]},a);return this.dispatch(gm(n)),n}}class TF extends R{async saveExisting(e){if(!e.uuid)throw new Error("You can only use this method to save existing project files. The one provided has no uuid.");const i={...e};delete i.file;const a=this.enqueueRequest({method:o.PATCH,url:`/project-files/${e.uuid}/`,payload:i,blockers:[e.uuid],blocks:[e.uuid]});return a.then(n=>{this.dispatch(jn(n))}),a}saveActive(){const{store:e}=this.client,i=e.getState(),a=i.projectFileReducer.activeProjectFileId;if(!a)throw new Error("No active project file");const n=i.projectFileReducer.instances[a];if(!n)throw new Error("No active project file");if(!n.bounds&&!n.canvas_bounds)throw new Error("Project file must either have bounds or canvas_bounds set");let c;if(typeof n.file=="string"&&!n.file.startsWith("blob:")){const m={...n};delete m.file,c={method:o.PATCH,url:`/project-files/${a}/`,payload:m,blockers:[a],blocks:[a]}}else c=new Promise((m,u)=>{this.client.files.uploadFileToS3(n.file_sha1).then(([h])=>{m({method:o.POST,url:`/project-files${n.project}/`,payload:{...n,...h},blockers:[a],blocks:[a]})}).catch(u)});const l=Promise.resolve(c).then(m=>this.enqueueRequest(m));return l.then(m=>{this.dispatch(jn(m))}),this.dispatch(km),this.dispatch(Cm(null)),this.dispatch(Dm(!1)),[n,l]}delete(e){return this.dispatch(zm(e)),this.enqueueRequest({method:o.DELETE,url:`/project-files/${e}`,blockers:[e],blocks:[]})}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get project files",method:o.GET,url:"/project-files/",queryParams:{limit:E,paginate:!0,project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get project files",method:o.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(jm(n)),n}}class gF extends R{async add(e){const i=await this.enqueueRequest({description:"Create project",method:o.POST,url:"/projects/",payload:w(e),blockers:[],blocks:[]});return this.dispatch(zn(i)),i}async update(e){if(!e.bounds&&!e.canvas_bounds)throw new Error("Project must either have bounds or canvas_bounds set");return this.dispatch(Hm(e)),await this.enqueueRequest({description:"Update project",method:o.PATCH,url:`/projects/${e.uuid}/`,payload:{name:e.name,bounds:e.bounds},blockers:[e.uuid],blocks:[e.uuid]})}async delete(e){const{store:i}=this.client,a=i.getState(),n=Km(e)(a);if(!n)throw new Error("Expected project to exist");const c=Gm(a).filter(m=>m.project===e);this.dispatch(Um(c.map(({uuid:m})=>m)));const r=Mm(n.uuid)(a);this.dispatch(En(r.map(({uuid:m})=>m)));const l=Im(e)(a);this.dispatch(ym(l.map(({uuid:m})=>m))),this.dispatch(Un(n.uuid));try{await this.enqueueRequest({description:"Delete project",method:o.DELETE,url:`/projects/${e}/`,blockers:[e],blocks:[]}),this.dispatch(Un(n.uuid))}catch(m){throw this.dispatch(zn(n)),this.dispatch(fm(Object.values(l))),this.dispatch(qm(c)),this.dispatch(Pm(r)),m}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch projects",method:o.GET,url:"/projects/",queryParams:{organization_owner:e},blockers:[],blocks:[]},i);return this.dispatch(Nm(a)),a}}class bF extends R{add(e){const i=F(e);this.dispatch(Qm(i));const a=this.enqueueRequest({description:"Create team membership",method:o.POST,url:"/team-memberships/",payload:w(i),blockers:[e.team],blocks:[i.uuid]});return a.then(n=>{this.dispatch(Bn(n))}).catch(()=>{this.dispatch(Gn(i.uuid))}),[i,a]}async delete(e){const{store:i}=this.client,a=i.getState(),n=tp(e)(a);if(!n)throw new Error(`Expected team membership with uuid ${e} to exist`);this.dispatch(Gn(e));try{return await this.enqueueRequest({description:"Delete team membership",method:o.DELETE,url:`/team-memberships/${e}/`,blockers:[e],blocks:[e]})}catch(c){throw this.dispatch(Bn(n)),c}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch team memberships",method:o.GET,url:"/team-memberships/",queryParams:{team__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Xm(a)),a}}class FF extends R{add(e){const i=F({...e,submitted_at:new Date().toISOString()});this.dispatch(ap(i));const a=this.enqueueRequest({description:"Create team",method:o.POST,url:"/teams/",payload:w(i),blockers:[],blocks:[i.uuid]});return a.then(n=>{this.dispatch(gt(n))}).catch(()=>{this.dispatch(Nn(i.uuid))}),[i,a]}update(e){const{store:i}=this.client,a=Wn(e.uuid)(i.getState());if(!a)throw new Error(`Expected team with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(np(n));const c=this.enqueueRequest({description:"Update team",method:o.PATCH,url:`/teams/${e.uuid}/`,payload:w(e),blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(gt(r))}).catch(()=>{this.dispatch(gt(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Wn(e)(a);if(!n)throw new Error(`Expected team with uuid ${e} to exist`);this.dispatch(Nn(e));try{return await this.enqueueRequest({description:"Delete team",method:o.DELETE,url:`/teams/${e}/`,blockers:[e],blocks:[e]})}catch(c){throw this.dispatch(gt(n)),c}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch teams",method:o.GET,url:"/teams/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(ip(a)),a}}class PF extends R{async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch organization users",method:o.GET,url:`/organizations/${e}/users/`,blockers:[],blocks:[]},i);return this.dispatch(Nh(a)),a}}class OF{constructor(e){S(this,"store");this.store=e}async enqueueRequest(e,i,a,n){return this._enqueueRequest(e,i,a,n).then(c=>{if(c instanceof D)throw c;return c})}_enqueueRequest(e,i,a,n){const c=new cc,r={...e,BASE_URL:i,serviceName:a};if(e.immediate){const l={...r,uuid:e.uuid??Je.v4()},m={payload:l,type:"",meta:{offline:{effect:{timestamp:new Date().toISOString(),request:l,BASE_URL:i,serviceName:a}}}};Zn(m,this,n).then(u=>{c.resolve(u.body)}).catch(u=>{Jn(u,m),u instanceof Error?c.reject(u):c.reject(new Error((u??xe).toString()))})}else{const l=this.store.dispatch(om(r)),m=h=>{if(h)c.resolve(h.body);else{const p=new D({message:"Could not get a response from the server.",response:h,discard:!0});c.reject(p)}},u=h=>{h instanceof D?h.options.discard=!0:(console.error("Received an unexpected error while processing a request:",h,`
|
|
15
15
|
Converting error to APIError and discarding.`),h=new D({message:"An error occurred while processing the request.",innerError:h,discard:!0})),c.reject(h)};l.then(m,u)}return c}}class et{constructor(){S(this,"graph");S(this,"requestAttemptCounter");this.graph=new jp.DepGraph,this.requestAttemptCounter={}}static _fromOutbox(e){const i=new et;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 r=e[c];if(!r){console.error("Previous outbox item was undefined");continue}r.payload.uuid!==n.payload.uuid&&r.payload.blocks.some(l=>n.payload.blockers.includes(l))&&et._addDependency(n.payload.uuid,r.payload.uuid,i.graph)}}return i}_addDependency(e,i){et._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);e.payload.blockers.some(n=>a.payload.blocks.includes(n))&&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;this.graph.getNodeData(i).payload.blockers.some(n=>e.payload.blocks.includes(n))&&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}}const _F=(t,e)=>{const i=new e(t);return Ng(i),Lg(t),i};var Pp=(t=>(t[t.USER_REGISTRATION=0]="USER_REGISTRATION",t[t.APPLICATION_INVITE=2]="APPLICATION_INVITE",t[t.PROJECT_INVITE=4]="PROJECT_INVITE",t[t.ORGANIZATION_INVITE=6]="ORGANIZATION_INVITE",t[t.ADD_EMAIL_DOMAIN=8]="ADD_EMAIL_DOMAIN",t[t.RESET_PASSWORD=10]="RESET_PASSWORD",t))(Pp||{});s.APIError=D,s.AgentService=lb,s.AssetAttachmentService=pb,s.AssetProcedureAttachmentService=Ab,s.AssetProcedureFieldValuesAttachmentService=Sb,s.AssetProcedureFieldValuesService=Ib,s.AssetProcedureFieldsAttachmentService=fb,s.AssetProcedureFieldsService=yb,s.AssetProcedureInstanceService=Tb,s.AssetProcedureService=gb,s.AssetProcedureStepFieldValuesAttachmentService=Pb,s.AssetProcedureStepFieldValuesService=Ob,s.AssetProcedureStepFieldsAttachmentService=bb,s.AssetProcedureStepFieldsService=Fb,s.AssetProcedureStepService=_b,s.AssetService=Rb,s.AssetStageCompletionService=vb,s.AssetStageService=wb,s.AssetTypeAttachmentService=Mb,s.AssetTypeFieldValuesAttachmentService=jb,s.AssetTypeFieldValuesService=qb,s.AssetTypeFieldsAttachmentService=Eb,s.AssetTypeFieldsService=Vb,s.AssetTypeIdentifierService=zb,s.AssetTypeIdentifierValueService=Ub,s.AssetTypeService=Db,s.AttachmentModel=ac,s.BaseApiService=R,s.BaseSDK=OF,s.COMMON_AUTO_FIELDS=lc,s.CategoryService=Cb,s.DEFAULT_ISSUE_PRIORITY=zp,s.DEFAULT_ISSUE_STATUS=qp,s.DEFAULT_PAGINATION_PAGE_SIZE=E,s.DeferredPromise=cc,s.DocumentAttachmentService=kb,s.DocumentService=Bb,s.EMPTY_ARRAY=tc,s.EMPTY_OBJECT=sc,s.EmailDomainsService=Gb,s.EmailVerificationService=$b,s.FileService=Nb,s.FormIdentifierService=Hb,s.FormIdentifierValueService=Wb,s.FormRevisionAttachmentService=Yb,s.FormRevisionService=Kb,s.FormService=Zb,s.FormSubmissionAttachmentService=Jb,s.FormSubmissionService=Xb,s.GeoImageService=Qb,s.HttpMethod=o,s.IssueAssociationService=xb,s.IssueAttachmentService=eF,s.IssueCommentAttachmentService=tF,s.IssueCommentService=sF,s.IssuePriority=es,s.IssueService=iF,s.IssueStatus=ts,s.IssueTypeAttachmentService=aF,s.IssueTypeFieldValuesAttachmentService=rF,s.IssueTypeFieldValuesService=dF,s.IssueTypeFieldsAttachmentService=nF,s.IssueTypeFieldsService=cF,s.IssueTypeIdentifierService=uF,s.IssueTypeIdentifierValueService=oF,s.IssueTypeService=lF,s.IssueUpdateChange=V,s.IssueUpdateService=hF,s.JWTService=AF,s.OUTBOX_RETRY_DELAY=nc,s.OrganizationAccessLevel=ic,s.OrganizationAccessService=fF,s.OrganizationService=yF,s.OutboxCoordinator=et,s.PAGINATION_MAX_PAGE_SIZE=hb,s.PAGINATION_PAGE_SIZE_QUERY_PARAM=mb,s.ProjectAccessService=SF,s.ProjectAttachmentService=IF,s.ProjectFileService=TF,s.ProjectService=gF,s.RESET_ORGANIZATION_STATE=O,s.RESET_PROJECT_STATE=M,s.RESET_STATE=g,s.SelectorBuilder=$g,s.TeamMembershipService=bF,s.TeamService=FF,s.UNKNOWN_ERROR_MESSAGE=xe,s.UserService=PF,s.VERSION_REDUCER_KEY=tt,s.VerificationCodeType=Pp,s._setLatestRetryTime=hm,s.addAsset=Xs,s.addAssetAttachment=hA,s.addAssetAttachments=os,s.addAssetProcedure=Ms,s.addAssetProcedureAttachment=AA,s.addAssetProcedureAttachments=Ec,s.addAssetProcedureFieldValues=Is,s.addAssetProcedureFieldValuesAttachment=qA,s.addAssetProcedureFieldValuesAttachments=Ot,s.addAssetProcedureFieldValuesMany=or,s.addAssetProcedureFields=Jc,s.addAssetProcedureFieldsAttachment=IA,s.addAssetProcedureFieldsAttachments=$c,s.addAssetProcedureFieldsMany=_A,s.addAssetProcedureInstance=Ps,s.addAssetProcedureInstances=yr,s.addAssetProcedureStep=Ys,s.addAssetProcedureStepFieldValues=Ls,s.addAssetProcedureStepFieldValuesAttachment=If,s.addAssetProcedureStepFieldValuesAttachments=Rt,s.addAssetProcedureStepFieldValuesMany=Hr,s.addAssetProcedureStepFields=Us,s.addAssetProcedureStepFieldsAttachment=sf,s.addAssetProcedureStepFieldsAttachments=Rr,s.addAssetProcedureStepFieldsMany=of,s.addAssetProcedureSteps=Ef,s.addAssetProcedures=ZA,s.addAssetStage=oi,s.addAssetStageCompletion=ai,s.addAssetStageCompletions=ni,s.addAssetStages=Hf,s.addAssetType=zi,s.addAssetTypeAttachment=Xf,s.addAssetTypeAttachments=pi,s.addAssetTypeFieldValues=gi,s.addAssetTypeFieldValuesAttachment=Ay,s.addAssetTypeFieldValuesAttachments=Ut,s.addAssetTypeFieldValuesMany=Qd,s.addAssetTypeFields=Cd,s.addAssetTypeFieldsAttachment=ey,s.addAssetTypeFieldsAttachments=Md,s.addAssetTypeFieldsMany=ry,s.addAssetTypeIdentifier=_i,s.addAssetTypeIdentifierValue=Mi,s.addAssetTypeIdentifierValues=Ey,s.addAssetTypeIdentifiers=Oy,s.addAssetTypes=By,s.addAssets=Vt,s.addCategories=Zy,s.addCategory=Bi,s.addConversation=fc,s.addConversations=nA,s.addDocumentAttachment=sS,s.addDocumentAttachments=Ru,s.addDocuments=Cu,s.addEmailDomain=Lu,s.addEmailDomains=uS,s.addForm=la,s.addFormIdentifier=Ji,s.addFormIdentifierValue=ea,s.addFormIdentifierValues=FS,s.addFormIdentifiers=yS,s.addFormRevision=ca,s.addFormRevisionAttachment=MS,s.addFormRevisionAttachments=lo,s.addFormRevisions=So,s.addFormSubmission=fa,s.addFormSubmissionAttachment=KS,s.addFormSubmissionAttachments=Bt,s.addFormSubmissions=Lt,s.addForms=GS,s.addGeoImage=Wo,s.addGeoImages=Yo,s.addIssue=Ga,s.addIssueAssociation=Oa,s.addIssueAssociations=_a,s.addIssueAttachment=rI,s.addIssueAttachments=Ea,s.addIssueComment=Ua,s.addIssueCommentAttachment=oI,s.addIssueCommentAttachments=yl,s.addIssueComments=AI,s.addIssueType=wh,s.addIssueTypeAttachment=OI,s.addIssueTypeAttachments=Dl,s.addIssueTypeFieldValues=Ja,s.addIssueTypeFieldValuesAttachment=XI,s.addIssueTypeFieldValuesAttachments=Yt,s.addIssueTypeFieldValuesMany=UI,s.addIssueTypeFields=ch,s.addIssueTypeFieldsAttachment=wI,s.addIssueTypeFieldsAttachments=Kl,s.addIssueTypeFieldsMany=$I,s.addIssueTypeIdentifier=nn,s.addIssueTypeIdentifierValue=un,s.addIssueTypeIdentifierValues=uT,s.addIssueTypeIdentifiers=iT,s.addIssueTypes=fT,s.addIssueUpdate=zh,s.addIssueUpdates=Uh,s.addIssues=Vl,s.addOrganization=am,s.addOrganizationAccess=Qh,s.addOrganizationAccesses=UT,s.addOrganizations=HT,s.addProject=zn,s.addProjectAccess=_n,s.addProjectAccesses=fm,s.addProjectAttachment=ng,s.addProjectAttachments=bm,s.addProjectFile=ug,s.addProjectFiles=qm,s.addProjects=yg,s.addTeam=ap,s.addTeamMembership=Qm,s.addTeamMemberships=Og,s.addTeams=Vg,s.addUser=Hh,s.addUsers=wT,s.agentsReducer=Ic,s.agentsSlice=cs,s.areArraysEqual=Gp,s.assetAttachmentReducer=vc,s.assetAttachmentSlice=ds,s.assetProcedureAttachmentReducer=Uc,s.assetProcedureAttachmentSlice=hs,s.assetProcedureFieldValuesAttachmentReducer=rr,s.assetProcedureFieldValuesAttachmentSlice=fs,s.assetProcedureFieldValuesReducer=mr,s.assetProcedureFieldValuesSlice=Ss,s.assetProcedureFieldsAttachmentReducer=Yc,s.assetProcedureFieldsAttachmentSlice=ms,s.assetProcedureFieldsReducer=er,s.assetProcedureFieldsSlice=ps,s.assetProcedureInstanceReducer=Ir,s.assetProcedureInstanceSlice=Fs,s.assetProcedureReducer=Fr,s.assetProcedureSlice=ws,s.assetProcedureStepFieldValuesAttachmentReducer=$r,s.assetProcedureStepFieldValuesAttachmentSlice=Bs,s.assetProcedureStepFieldValuesReducer=Zr,s.assetProcedureStepFieldValuesSlice=$s,s.assetProcedureStepFieldsAttachmentReducer=Vr,s.assetProcedureStepFieldsAttachmentSlice=qs,s.assetProcedureStepFieldsReducer=zr,s.assetProcedureStepFieldsSlice=zs,s.assetProcedureStepReducer=xr,s.assetProcedureStepSlice=Ws,s.assetReducer=nd,s.assetSlice=Js,s.assetStageCompletionReducer=od,s.assetStageCompletionSlice=ii,s.assetStageReducer=fd,s.assetStageSlice=ui,s.assetTypeAttachmentReducer=Rd,s.assetTypeAttachmentSlice=mi,s.assetTypeFieldValuesAttachmentReducer=Zd,s.assetTypeFieldValuesAttachmentSlice=Si,s.assetTypeFieldValuesReducer=su,s.assetTypeFieldValuesSlice=Ti,s.assetTypeFieldsAttachmentReducer=zd,s.assetTypeFieldsAttachmentSlice=fi,s.assetTypeFieldsReducer=$d,s.assetTypeFieldsSlice=yi,s.assetTypeIdentifierReducer=ru,s.assetTypeIdentifierSlice=Oi,s.assetTypeIdentifierValueReducer=lu,s.assetTypeIdentifierValueSlice=wi,s.assetTypeReducer=Au,s.assetTypeSlice=qi,s.authReducer=Su,s.authSlice=Ct,s.baseReducer=kg,s.baseReducers=Yn,s.blobToBase64=Jp,s.categoryReducer=Pu,s.categorySlice=ki,s.clearTokens=Wy,s.constructUploadedFilePayloads=Zp,s.coordinatesAreEqual=kp,s.createModelAdapter=P,s.createMultiPointGeometry=Cp,s.createOfflineAction=dm,s.createPayload=w,s.createPointGeometry=Dp,s.createSelectionAdapter=Up,s.deleteAsset=Qs,s.deleteAssetAttachment=Fc,s.deleteAssetAttachments=ls,s.deleteAssetProcedure=Es,s.deleteAssetProcedureAttachment=qc,s.deleteAssetProcedureAttachments=zc,s.deleteAssetProcedureFieldValues=Ts,s.deleteAssetProcedureFieldValuesAttachment=CA,s.deleteAssetProcedureFieldValuesAttachments=_t,s.deleteAssetProcedureFieldValuesMany=hr,s.deleteAssetProcedureFields=Qc,s.deleteAssetProcedureFieldsAttachment=FA,s.deleteAssetProcedureFieldsAttachments=Nc,s.deleteAssetProcedureFieldsMany=MA,s.deleteAssetProcedureInstance=Os,s.deleteAssetProcedureInstances=Sr,s.deleteAssetProcedureStep=Ks,s.deleteAssetProcedureStepFieldValues=Ns,s.deleteAssetProcedureStepFieldValuesAttachment=Ff,s.deleteAssetProcedureStepFieldValuesAttachments=vt,s.deleteAssetProcedureStepFieldValuesMany=Yr,s.deleteAssetProcedureStepFields=Ds,s.deleteAssetProcedureStepFieldsAttachment=rf,s.deleteAssetProcedureStepFieldsAttachments=wr,s.deleteAssetProcedureStepFieldsMany=pf,s.deleteAssetProcedureSteps=jf,s.deleteAssetProcedures=XA,s.deleteAssetStage=li,s.deleteAssetStageCompletion=ci,s.deleteAssetStageCompletions=ri,s.deleteAssetStages=Yf,s.deleteAssetType=Ui,s.deleteAssetTypeAttachment=bd,s.deleteAssetTypeAttachments=Ai,s.deleteAssetTypeFieldValues=bi,s.deleteAssetTypeFieldValuesAttachment=Iy,s.deleteAssetTypeFieldValuesAttachments=Dt,s.deleteAssetTypeFieldValuesMany=eu,s.deleteAssetTypeFields=Bd,s.deleteAssetTypeFieldsAttachment=ay,s.deleteAssetTypeFieldsAttachments=Vd,s.deleteAssetTypeFieldsMany=ly,s.deleteAssetTypeIdentifier=Ri,s.deleteAssetTypeIdentifierValue=Ei,s.deleteAssetTypeIdentifierValues=zy,s.deleteAssetTypeIdentifiers=wy,s.deleteAssetTypes=$y,s.deleteAssets=xs,s.deleteCategories=xy,s.deleteCategory=bu,s.deleteConversation=dA,s.deleteConversations=uA,s.deleteDocumentAttachment=Mu,s.deleteDocumentAttachments=Eu,s.deleteEmailDomain=Nu,s.deleteEmailDomains=pS,s.deleteForm=ha,s.deleteFormIdentifier=Xi,s.deleteFormIdentifierValue=ta,s.deleteFormIdentifierValues=RS,s.deleteFormIdentifiers=gS,s.deleteFormRevision=ra,s.deleteFormRevisionAttachment=qS,s.deleteFormRevisionAttachments=mo,s.deleteFormRevisions=To,s.deleteFormSubmission=ya,s.deleteFormSubmissionAttachment=QS,s.deleteFormSubmissionAttachments=Gt,s.deleteFormSubmissions=Nt,s.deleteForms=WS,s.deleteGeoImage=ba,s.deleteGeoImages=Zo,s.deleteIssue=$a,s.deleteIssueAssociation=Ra,s.deleteIssueAssociations=va,s.deleteIssueAttachment=ol,s.deleteIssueAttachments=Va,s.deleteIssueComment=Ca,s.deleteIssueCommentAttachment=Tl,s.deleteIssueCommentAttachments=gl,s.deleteIssueComments=SI,s.deleteIssueType=IT,s.deleteIssueTypeAttachment=Bl,s.deleteIssueTypeAttachments=Gl,s.deleteIssueTypeFieldValues=Xa,s.deleteIssueTypeFieldValuesAttachment=tT,s.deleteIssueTypeFieldValuesAttachments=Kt,s.deleteIssueTypeFieldValuesMany=BI,s.deleteIssueTypeFields=dh,s.deleteIssueTypeFieldsAttachment=jI,s.deleteIssueTypeFieldsAttachments=Jl,s.deleteIssueTypeFieldsMany=WI,s.deleteIssueTypeIdentifier=cn,s.deleteIssueTypeIdentifierValue=on,s.deleteIssueTypeIdentifierValues=mT,s.deleteIssueTypeIdentifiers=rT,s.deleteIssueTypes=TT,s.deleteIssueUpdate=Dh,s.deleteIssueUpdates=Ch,s.deleteIssues=jl,s.deleteOrganization=YT,s.deleteOrganizationAccess=xh,s.deleteOrganizationAccesses=BT,s.deleteOrganizations=KT,s.deleteProject=Un,s.deleteProjectAccess=Rn,s.deleteProjectAccesses=ym,s.deleteProjectAttachment=_m,s.deleteProjectAttachments=En,s.deleteProjectFile=zm,s.deleteProjectFiles=Um,s.deleteProjects=Ig,s.deleteTeam=Nn,s.deleteTeamMembership=Gn,s.deleteTeamMemberships=wg,s.deleteTeams=zg,s.deleteUser=Wh,s.deleteUsers=VT,s.dequeue=Tp,s.discard=Jn,s.documentAttachmentReducer=zu,s.documentAttachmentSlice=Li,s.documentSlice=Ni,s.documentsReducer=Bu,s.downloadFile=Xp,s.downloadInMemoryFile=Kp,s.emailDomainsReducer=Yu,s.emailDomainsSlice=Yi,s.emailRegex=aA,s.enqueue=Ip,s.enqueueRequest=om,s.fallbackToEmptyArray=I,s.fallbackToEmptyObject=Pt,s.fileReducer=Qu,s.fileSlice=Ki,s.fileToBlob=uc,s.formIdentifierReducer=io,s.formIdentifierSlice=Zi,s.formIdentifierValueReducer=ro,s.formIdentifierValueSlice=xi,s.formReducer=Oo,s.formRevisionAttachmentReducer=Ao,s.formRevisionAttachmentSlice=aa,s.formRevisionReducer=bo,s.formRevisionsSlice=na,s.formSlice=oa,s.formSubmissionAttachmentReducer=zo,s.formSubmissionAttachmentSlice=ma,s.formSubmissionReducer=$o,s.formSubmissionSlice=Aa,s.geoImageReducer=Qo,s.geoImageSlice=ga,s.getFileIdentifier=Yp,s.getFileS3Key=ns,s.getLocalDateString=rc,s.getLocalRelativeDateString=Hp,s.getOutboxCoordinator=Ye,s.getRenamedFile=dc,s.hashFile=Xe,s.initSDK=_F,s.initializeAssetAttachments=us,s.initializeAssetProcedureAttachments=Mc,s.initializeAssetProcedureFieldValues=ur,s.initializeAssetProcedureFieldValuesAttachments=sr,s.initializeAssetProcedureFields=Zc,s.initializeAssetProcedureFieldsAttachments=Gc,s.initializeAssetProcedureInstances=fr,s.initializeAssetProcedureStepFieldValues=Nr,s.initializeAssetProcedureStepFieldValuesAttachments=Dr,s.initializeAssetProcedureStepFields=qr,s.initializeAssetProcedureStepFieldsAttachments=_r,s.initializeAssetProcedureSteps=Xr,s.initializeAssetProcedures=br,s.initializeAssetStageCompletions=rd,s.initializeAssetStages=pd,s.initializeAssetTypeAttachments=Id,s.initializeAssetTypeFieldValues=Xd,s.initializeAssetTypeFieldValuesAttachments=Nd,s.initializeAssetTypeFields=Dd,s.initializeAssetTypeFieldsAttachments=wd,s.initializeAssetTypeIdentifierValues=uu,s.initializeAssetTypeIdentifiers=au,s.initializeAssetTypes=mu,s.initializeAssets=sd,s.initializeCategories=Tu,s.initializeConversations=Ac,s.initializeDocumentAttachments=_u,s.initializeEmailDomains=$u,s.initializeFormIdentifierValues=no,s.initializeFormIdentifiers=eo,s.initializeFormRevisionAttachments=oo,s.initializeFormRevisions=yo,s.initializeFormSubmissionAttachments=Mo,s.initializeFormSubmissions=Do,s.initializeForms=Po,s.initializeGeoImages=No,s.initializeIssueAssociations=el,s.initializeIssueAttachments=Ma,s.initializeIssueCommentAttachments=qa,s.initializeIssueComments=pI,s.initializeIssueTypeAttachments=Ya,s.initializeIssueTypeFieldValues=th,s.initializeIssueTypeFieldValuesAttachments=hh,s.initializeIssueTypeFields=nh,s.initializeIssueTypeFieldsAttachments=Yl,s.initializeIssueTypeIdentifierValues=Ph,s.initializeIssueTypeIdentifiers=Ih,s.initializeIssueTypes=vh,s.initializeIssueUpdates=qh,s.initializeIssues=El,s.initializeOrganizationAccesses=Xh,s.initializeOrganizations=im,s.initializeProjectAccesses=Am,s.initializeProjectAttachments=gm,s.initializeProjectFiles=jm,s.initializeProjects=Nm,s.initializeTeamMemberships=Xm,s.initializeTeams=ip,s.initializeUsers=Nh,s.isToday=Np,s.issueAssociationReducer=cl,s.issueAssociationSlice=Pa,s.issueAttachmentReducer=Al,s.issueAttachmentSlice=wa,s.issueCommentAttachmentReducer=Ol,s.issueCommentAttachmentSlice=ja,s.issueCommentReducer=wl,s.issueCommentSlice=za,s.issueReducer=zl,s.issueSlice=Ba,s.issueTypeAttachmentReducer=Hl,s.issueTypeAttachmentSlice=Wa,s.issueTypeFieldValuesAttachmentReducer=yh,s.issueTypeFieldValuesAttachmentSlice=tn,s.issueTypeFieldValuesReducer=ih,s.issueTypeFieldValuesSlice=Za,s.issueTypeFieldsAttachmentReducer=xl,s.issueTypeFieldsAttachmentSlice=Ka,s.issueTypeFieldsReducer=oh,s.issueTypeFieldsSlice=en,s.issueTypeIdentifierReducer=bh,s.issueTypeIdentifierSlice=an,s.issueTypeIdentifierValueReducer=_h,s.issueTypeIdentifierValueSlice=dn,s.issueTypeReducer=Vh,s.issueTypeSlice=mn,s.issueUpdateReducer=$h,s.issueUpdateSlice=yn,s.logOnlyOnce=Qp,s.markAsDeleted=lm,s.markForDeletion=xT,s.memoize=is,s.offline=F,s.onlyUniqueHashes=iA,s.onlyUniqueOfflineIds=mc,s.organizationAccessReducer=em,s.organizationAccessSlice=Tn,s.organizationReducer=rm,s.organizationSlice=Fn,s.outboxReducer=mm,s.outboxSlice=Pn,s.overmapEnhancer=xg,s.overmapReducer=Bg,s.overmapReducers=op,s.performRequest=Zn,s.projectAccessReducer=Sm,s.projectAccessSlice=On,s.projectAttachmentReducer=Em,s.projectAttachmentSlice=Mn,s.projectFileReducer=$m,s.projectFileSlice=Vn,s.projectReducer=Wm,s.projectSlice=qn,s.rehydratedReducer=Zm,s.rehydratedSlice=Cn,s.removeDocuments=Hi,s.removeIssueType=pn,s.resetProjectFileObjectUrls=lg,s.restructureCreateSelectorWithArgs=y,s.saveActiveProjectFileBounds=km,s.selectAccessToken=Yy,s.selectAccessesByUserOfProject=ig,s.selectAccessibleProjects=Tg,s.selectActiveOrganizationAccess=GT,s.selectActiveProjectFileId=mg,s.selectAllDocumentAttachments=ju,s.selectAllProjectAttachments=vm,s.selectAssetAttachmentById=_c,s.selectAssetAttachmentMapping=Pc,s.selectAssetAttachments=Oc,s.selectAssetById=si,s.selectAssetProcedureAttachmentById=kc,s.selectAssetProcedureAttachmentMapping=Dc,s.selectAssetProcedureAttachments=Cc,s.selectAssetProcedureById=js,s.selectAssetProcedureFieldValues=gs,s.selectAssetProcedureFieldValuesAttachmentById=kA,s.selectAssetProcedureFieldValuesAttachments=ar,s.selectAssetProcedureFieldValuesAttachmentsByIds=nr,s.selectAssetProcedureFieldValuesAttachmentsMapping=ys,s.selectAssetProcedureFieldValuesById=bs,s.selectAssetProcedureFieldValuesMapping=pr,s.selectAssetProcedureFieldValuesOfAsset=$A,s.selectAssetProcedureFields=As,s.selectAssetProcedureFieldsAttachmentById=OA,s.selectAssetProcedureFieldsAttachments=Wc,s.selectAssetProcedureFieldsAttachmentsMapping=Hc,s.selectAssetProcedureFieldsById=jA,s.selectAssetProcedureFieldsMapping=xc,s.selectAssetProcedureFieldsOfAssetProcedure=EA,s.selectAssetProcedureInstanceById=vs,s.selectAssetProcedureInstances=Rs,s.selectAssetProcedureInstancesByIds=KA,s.selectAssetProcedureInstancesMapping=_s,s.selectAssetProcedureInstancesOfAssetProcedure=Tr,s.selectAssetProcedureInstancesOfAssetType=YA,s.selectAssetProcedureStepById=Zs,s.selectAssetProcedureStepFieldValues=wt,s.selectAssetProcedureStepFieldValuesAttachmentById=Pf,s.selectAssetProcedureStepFieldValuesAttachments=kr,s.selectAssetProcedureStepFieldValuesAttachmentsByIds=Br,s.selectAssetProcedureStepFieldValuesAttachmentsMapping=Gs,s.selectAssetProcedureStepFieldValuesById=Hs,s.selectAssetProcedureStepFieldValuesMapping=Kr,s.selectAssetProcedureStepFieldValuesOfAsset=Rf,s.selectAssetProcedureStepFieldValuesOfAssetProcedureInstance=vf,s.selectAssetProcedureStepFieldValuesOfAssetProcedureStep=wf,s.selectAssetProcedureStepFields=ks,s.selectAssetProcedureStepFieldsAttachmentById=uf,s.selectAssetProcedureStepFieldsAttachments=Er,s.selectAssetProcedureStepFieldsAttachmentsMapping=Mr,s.selectAssetProcedureStepFieldsById=Sf,s.selectAssetProcedureStepFieldsMapping=Cs,s.selectAssetProcedureStepFieldsOfAssetProcedureStep=Af,s.selectAssetProcedureStepMapping=Et,s.selectAssetProcedureSteps=ed,s.selectAssetProcedureStepsByIds=Uf,s.selectAssetProcedureStepsMappingOfAssetProcedure=qf,s.selectAssetProcedureStepsOfAssetProcedure=zf,s.selectAssetProcedures=Pr,s.selectAssetProceduresByIds=ef,s.selectAssetProceduresMapping=Vs,s.selectAssetProceduresOfOrganization=tf,s.selectAssetStageById=hi,s.selectAssetStageCompletionById=ld,s.selectAssetStageCompletionMapping=di,s.selectAssetStageCompletions=Lf,s.selectAssetStageCompletionsByIds=hd,s.selectAssetStages=yd,s.selectAssetStagesByIds=Jf,s.selectAssetStagesMappingOfAssetProcedure=Kf,s.selectAssetStagesOfAssetProcedure=Zf,s.selectAssetTypeAttachmentById=Od,s.selectAssetTypeAttachmentMapping=Fd,s.selectAssetTypeAttachments=Pd,s.selectAssetTypeById=Ci,s.selectAssetTypeFieldValues=Fi,s.selectAssetTypeFieldValuesAttachmentById=Ty,s.selectAssetTypeFieldValuesAttachments=Wd,s.selectAssetTypeFieldValuesAttachmentsByIds=Yd,s.selectAssetTypeFieldValuesAttachmentsMapping=Ii,s.selectAssetTypeFieldValuesById=Pi,s.selectAssetTypeFieldValuesMapping=tu,s.selectAssetTypeFieldValuesOfAsset=Fy,s.selectAssetTypeFields=zt,s.selectAssetTypeFieldsAttachmentById=cy,s.selectAssetTypeFieldsAttachments=qd,s.selectAssetTypeFieldsAttachmentsMapping=jd,s.selectAssetTypeFieldsById=py,s.selectAssetTypeFieldsMapping=Gd,s.selectAssetTypeFieldsOfAssetType=hy,s.selectAssetTypeIdentifierById=vi,s.selectAssetTypeIdentifierMapping=nu,s.selectAssetTypeIdentifierValueById=ji,s.selectAssetTypeIdentifierValueMapping=ou,s.selectAssetTypeIdentifierValues=Vi,s.selectAssetTypeIdentifierValuesOfAsset=Uy,s.selectAssetTypeIdentifierValuesOfIdentifier=Dy,s.selectAssetTypeIdentifiers=cu,s.selectAssetTypeIdentifiersOfAssetType=My,s.selectAssetTypeValuesOfAssetType=Py,s.selectAssetTypes=pu,s.selectAssetTypesByIds=Ly,s.selectAssetTypesMapping=Di,s.selectAssetTypesOfOrganization=Ny,s.selectAssets=id,s.selectAssetsByIds=ad,s.selectAssetsMapping=ei,s.selectAssetsOfAssetType=ti,s.selectAttachmentsOfAsset=Rc,s.selectAttachmentsOfAssetProcedure=SA,s.selectAttachmentsOfAssetProcedureFieldValues=cr,s.selectAttachmentsOfAssetProcedureFields=PA,s.selectAttachmentsOfAssetProcedureStepFieldValues=Gr,s.selectAttachmentsOfAssetProcedureStepFields=df,s.selectAttachmentsOfAssetType=_d,s.selectAttachmentsOfAssetTypeFieldValues=Kd,s.selectAttachmentsOfAssetTypeFields=ny,s.selectAttachmentsOfDocument=nS,s.selectAttachmentsOfFormRevision=zS,s.selectAttachmentsOfFormSubmission=qo,s.selectAttachmentsOfIssue=ml,s.selectAttachmentsOfIssueComment=mI,s.selectAttachmentsOfIssueType=vI,s.selectAttachmentsOfIssueTypeFieldValues=fh,s.selectAttachmentsOfIssueTypeFields=qI,s.selectAttachmentsOfProject=Mm,s.selectCategories=Fu,s.selectCategoriesByIds=eS,s.selectCategoriesOfProject=tS,s.selectCategoryById=$i,s.selectCategoryMapping=Gi,s.selectCommentsOfIssue=II,s.selectConversation=lA,s.selectConversationMapping=rs,s.selectConversations=oA,s.selectCurrentUser=Kh,s.selectDeletedRequests=XT,s.selectDocumentAttachmentById=qu,s.selectDocumentAttachmentMapping=Vu,s.selectDocumentById=ku,s.selectDocuments=Wi,s.selectDocumentsByIds=cS,s.selectDocumentsMapping=kt,s.selectEmailDomains=Wu,s.selectEmailDomainsAsMapping=Hu,s.selectEmailDomainsOfOrganization=AS,s.selectFieldValuesOfAssetProcedureInstance=LA,s.selectFormById=vo,s.selectFormIdentifierById=Qi,s.selectFormIdentifierMapping=to,s.selectFormIdentifierValueById=ia,s.selectFormIdentifierValueMapping=co,s.selectFormIdentifierValues=sa,s.selectFormIdentifierValuesOfFormSubmission=vS,s.selectFormIdentifierValuesOfIdentifier=wS,s.selectFormIdentifiers=so,s.selectFormIdentifiersOfForm=bS,s.selectFormMapping=_o,s.selectFormRevisionAttachmentsMapping=po,s.selectFormRevisionById=kS,s.selectFormRevisionMapping=da,s.selectFormRevisions=ua,s.selectFormRevisionsOfForm=go,s.selectFormSubmissionAttachemntsByIds=jo,s.selectFormSubmissionAttachments=pa,s.selectFormSubmissionAttachmentsMapping=Vo,s.selectFormSubmissionById=Ta,s.selectFormSubmissions=Ia,s.selectFormSubmissionsMapping=Sa,s.selectFormSubmissionsOfAsset=Go,s.selectFormSubmissionsOfForm=ko,s.selectFormSubmissionsOfIssue=Bo,s.selectForms=Ro,s.selectFormsOfOrganization=YS,s.selectGeoImageById=Fa,s.selectGeoImageMapping=Jo,s.selectGeoImages=Xo,s.selectGeoImagesOfProject=sI,s.selectIsImportingProjectFile=pg,s.selectIsLoggedIn=Ky,s.selectIssueAssociationById=sl,s.selectIssueAssociationMapping=At,s.selectIssueAssociations=cI,s.selectIssueAssociationsOfAsset=nl,s.selectIssueAssociationsOfIssue=al,s.selectIssueAssociationsToIssue=il,s.selectIssueAttachmentById=pl,s.selectIssueAttachmentMapping=ll,s.selectIssueAttachments=hl,s.selectIssueById=Ha,s.selectIssueCommentAttachmentById=Pl,s.selectIssueCommentAttachmentMapping=bl,s.selectIssueCommentAttachments=Fl,s.selectIssueCommentById=ka,s.selectIssueCommentMapping=vl,s.selectIssueMapping=La,s.selectIssueTypeAttachmentById=Nl,s.selectIssueTypeAttachmentMapping=$l,s.selectIssueTypeAttachments=Ll,s.selectIssueTypeById=fn,s.selectIssueTypeFieldValues=Qa,s.selectIssueTypeFieldValuesAttachmentById=sT,s.selectIssueTypeFieldValuesAttachments=sn,s.selectIssueTypeFieldValuesAttachmentsByIds=Ah,s.selectIssueTypeFieldValuesAttachmentsMapping=ph,s.selectIssueTypeFieldValuesById=xa,s.selectIssueTypeFieldValuesMapping=sh,s.selectIssueTypeFieldValuesOfIssue=GI,s.selectIssueTypeFields=Wt,s.selectIssueTypeFieldsAttachmentById=zI,s.selectIssueTypeFieldsAttachments=Ql,s.selectIssueTypeFieldsAttachmentsMapping=Xl,s.selectIssueTypeFieldsById=JI,s.selectIssueTypeFieldsMapping=uh,s.selectIssueTypeFieldsOfIssueType=YI,s.selectIssueTypeIdentifierById=rn,s.selectIssueTypeIdentifierMapping=Th,s.selectIssueTypeIdentifierValueById=hn,s.selectIssueTypeIdentifierValueMapping=Oh,s.selectIssueTypeIdentifierValues=ln,s.selectIssueTypeIdentifierValuesOfIdentifier=AT,s.selectIssueTypeIdentifierValuesOfIssue=pT,s.selectIssueTypeIdentifiers=gh,s.selectIssueTypeIdentifiersOfIssueType=dT,s.selectIssueTypeMapping=An,s.selectIssueTypeValuesOfIssueType=ZI,s.selectIssueTypes=Eh,s.selectIssueTypesByIds=gT,s.selectIssueTypesOfOrganization=bT,s.selectIssueUpdateMapping=kh,s.selectIssueUpdates=Bh,s.selectIssueUpdatesOfIssue=Gh,s.selectIssues=Na,s.selectIssuesByIds=FI,s.selectIssuesOfIssueType=ql,s.selectIssuesOfProject=PI,s.selectLatestAssetProcedureFieldsOfAssetProcedure=VA,s.selectLatestAssetProcedureStepFieldsOfAssetProcedureStep=ff,s.selectLatestAssetTypeFieldsOfAssetType=my,s.selectLatestFieldsByAssetProcedureStep=yf,s.selectLatestFormRevisionOfForm=BS,s.selectLatestIssueTypeFieldsOfIssueType=KI,s.selectLatestRetryTime=QT,s.selectMembershipsByUserOfTeam=Mg,s.selectNumberOfAssetsOfAssetType=Bf,s.selectOrganizationAccessById=bn,s.selectOrganizationAccessMapping=gn,s.selectOrganizationAccessUserMapping=tm,s.selectOrganizationById=JT,s.selectOrganizationDocuments=dS,s.selectOrganizations=ZT,s.selectOrganizationsMapping=cm,s.selectProjectAccessById=wn,s.selectProjectAccessMapping=vn,s.selectProjectAccesses=Xt,s.selectProjectAccessesOfProject=Im,s.selectProjectAttachmentById=wm,s.selectProjectAttachmentMapping=Rm,s.selectProjectById=Km,s.selectProjectDocuments=rS,s.selectProjectFileById=hg,s.selectProjectFileMapping=Bm,s.selectProjectFiles=Gm,s.selectProjectMapping=Ym,s.selectProjects=Dn,s.selectProjectsOfOrganization=gg,s.selectRehydrated=Pg,s.selectStageMapping=qt,s.selectTeamById=Wn,s.selectTeamMembershipById=tp,s.selectTeamMemberships=$n,s.selectTeamMembershipsMapping=ep,s.selectTeams=cp,s.selectTeamsByIds=Ug,s.selectTeamsMapping=Hn,s.selectTeamsOfOrganization=Dg,s.selectUploadUrl=Xu,s.selectUserById=Zh,s.selectUsers=In,s.selectUsersByIds=zT,s.selectUsersMapping=Zt,s.selectUsersOfOrganization=$T,s.selectUsersOfProject=ag,s.selectUsersOfTeam=Eg,s.setActiveProjectFileId=Cm,s.setAsset=Cf,s.setAssetAttachment=gc,s.setAssetAttachments=mA,s.setAssetProcedure=QA,s.setAssetProcedureAttachment=Vc,s.setAssetProcedureAttachments=fA,s.setAssetProcedureFieldValues=BA,s.setAssetProcedureFieldValuesAttachment=zA,s.setAssetProcedureFieldValuesAttachments=UA,s.setAssetProcedureFieldValuesMany=GA,s.setAssetProcedureFields=RA,s.setAssetProcedureFieldsAttachment=TA,s.setAssetProcedureFieldsAttachments=gA,s.setAssetProcedureFieldsMany=vA,s.setAssetProcedureInstance=HA,s.setAssetProcedureInstances=WA,s.setAssetProcedureStep=Qr,s.setAssetProcedureStepFieldValues=Of,s.setAssetProcedureStepFieldValuesAttachment=Tf,s.setAssetProcedureStepFieldValuesAttachments=gf,s.setAssetProcedureStepFieldValuesMany=_f,s.setAssetProcedureStepFields=lf,s.setAssetProcedureStepFieldsAttachment=af,s.setAssetProcedureStepFieldsAttachments=nf,s.setAssetProcedureStepFieldsMany=hf,s.setAssetProcedureSteps=Mf,s.setAssetProcedures=xA,s.setAssetStage=Ad,s.setAssetStageCompletion=Gf,s.setAssetStageCompletions=$f,s.setAssetStages=Nf,s.setAssetType=Cy,s.setAssetTypeAttachment=Td,s.setAssetTypeAttachments=Qf,s.setAssetTypeFieldValues=gy,s.setAssetTypeFieldValuesAttachment=fy,s.setAssetTypeFieldValuesAttachments=yy,s.setAssetTypeFieldValuesMany=by,s.setAssetTypeFields=dy,s.setAssetTypeFieldsAttachment=ty,s.setAssetTypeFieldsAttachments=sy,s.setAssetTypeFieldsMany=uy,s.setAssetTypeIdentifier=_y,s.setAssetTypeIdentifierValue=Vy,s.setAssetTypeIdentifierValues=jy,s.setAssetTypeIdentifiers=Ry,s.setAssetTypes=ky,s.setAssets=kf,s.setCategories=Xy,s.setCategory=Jy,s.setConversation=yc,s.setConversations=cA,s.setCurrentUser=jT,s.setDocumentAttachment=vu,s.setDocumentAttachments=iS,s.setDocuments=Du,s.setEmailDomain=oS,s.setEmailDomains=lS,s.setForm=$S,s.setFormIdentifier=SS,s.setFormIdentifierValue=PS,s.setFormIdentifierValues=OS,s.setFormIdentifiers=IS,s.setFormRevision=Io,s.setFormRevisionAttachment=ES,s.setFormRevisionAttachments=VS,s.setFormRevisions=US,s.setFormSubmission=$t,s.setFormSubmissionAttachment=ZS,s.setFormSubmissionAttachments=JS,s.setFormSubmissions=xS,s.setForms=LS,s.setGeoImage=pt,s.setGeoImages=Ho,s.setIsImportingProjectFile=Dm,s.setIssue=TI,s.setIssueAssociation=aI,s.setIssueAssociations=iI,s.setIssueAttachment=dl,s.setIssueAttachments=dI,s.setIssueComment=Da,s.setIssueCommentAttachment=Sl,s.setIssueCommentAttachments=lI,s.setIssueComments=Rl,s.setIssueType=It,s.setIssueTypeAttachment=Cl,s.setIssueTypeAttachments=_I,s.setIssueTypeFieldValues=DI,s.setIssueTypeFieldValuesAttachment=QI,s.setIssueTypeFieldValuesAttachments=xI,s.setIssueTypeFieldValuesMany=CI,s.setIssueTypeFields=LI,s.setIssueTypeFieldsAttachment=MI,s.setIssueTypeFieldsAttachments=EI,s.setIssueTypeFieldsMany=NI,s.setIssueTypeIdentifier=aT,s.setIssueTypeIdentifierValue=oT,s.setIssueTypeIdentifierValues=lT,s.setIssueTypeIdentifiers=nT,s.setIssueTypes=yT,s.setIssueUpdate=FT,s.setIssueUpdates=PT,s.setIssues=gI,s.setLoggedIn=yu,s.setOrganization=NT,s.setOrganizationAccess=DT,s.setOrganizationAccesses=CT,s.setOrganizations=LT,s.setProfilePicture=qT,s.setProject=fg,s.setProjectAccess=eg,s.setProjectAccesses=tg,s.setProjectAttachment=Fm,s.setProjectAttachments=Pm,s.setProjectFile=rg,s.setProjectFiles=dg,s.setProjects=Ag,s.setRehydrated=Fg,s.setTeam=gt,s.setTeamMembership=Bn,s.setTeamMemberships=_g,s.setTeams=jg,s.setTokens=Hy,s.setUploadUrl=Ju,s.setUser=vT,s.setUsers=RT,s.shallowEqual=Bp,s.slugify=tA,s.spacesToDashesLower=eA,s.teamMembershipReducer=xm,s.teamMembershipSlice=kn,s.teamReducer=rp,s.teamSlice=Ln,s.toFileNameSafeString=xp,s.toOfflineIdRecord=hc,s.truncate=sA,s.updateAsset=rt,s.updateAssetAttachment=pA,s.updateAssetAttachments=bc,s.updateAssetProcedure=at,s.updateAssetProcedureAttachment=yA,s.updateAssetProcedureAttachments=jc,s.updateAssetProcedureFieldValues=st,s.updateAssetProcedureFieldValuesAttachment=DA,s.updateAssetProcedureFieldValuesAttachments=ir,s.updateAssetProcedureFieldValuesMany=lr,s.updateAssetProcedureFields=Xc,s.updateAssetProcedureFieldsAttachment=bA,s.updateAssetProcedureFieldsAttachments=Lc,s.updateAssetProcedureFieldsMany=wA,s.updateAssetProcedureInstance=it,s.updateAssetProcedureInstances=NA,s.updateAssetProcedureStep=Mt,s.updateAssetProcedureStepFieldValues=ct,s.updateAssetProcedureStepFieldValuesAttachment=bf,s.updateAssetProcedureStepFieldValuesAttachments=Cr,s.updateAssetProcedureStepFieldValuesMany=Wr,s.updateAssetProcedureStepFields=nt,s.updateAssetProcedureStepFieldsAttachment=cf,s.updateAssetProcedureStepFieldsAttachments=vr,s.updateAssetProcedureStepFieldsMany=mf,s.updateAssetProcedureSteps=Vf,s.updateAssetProcedures=JA,s.updateAssetStage=jt,s.updateAssetStageCompletion=dd,s.updateAssetStageCompletions=ud,s.updateAssetStages=Wf,s.updateAssetType=lt,s.updateAssetTypeAttachment=xf,s.updateAssetTypeAttachments=gd,s.updateAssetTypeFieldValues=dt,s.updateAssetTypeFieldValuesAttachment=Sy,s.updateAssetTypeFieldValuesAttachments=Hd,s.updateAssetTypeFieldValuesMany=xd,s.updateAssetTypeFields=kd,s.updateAssetTypeFieldsAttachment=iy,s.updateAssetTypeFieldsAttachments=Ed,s.updateAssetTypeFieldsMany=oy,s.updateAssetTypeIdentifier=ut,s.updateAssetTypeIdentifierValue=ot,s.updateAssetTypeIdentifierValues=qy,s.updateAssetTypeIdentifiers=vy,s.updateAssetTypes=Gy,s.updateAssets=Df,s.updateCategories=Qy,s.updateCategory=gu,s.updateConversation=Sc,s.updateConversations=rA,s.updateDocumentAttachment=aS,s.updateDocumentAttachments=wu,s.updateDocuments=Qe,s.updateEmailDomain=hS,s.updateEmailDomains=mS,s.updateForm=NS,s.updateFormIdentifier=ht,s.updateFormIdentifierValue=mt,s.updateFormIdentifierValues=_S,s.updateFormIdentifiers=TS,s.updateFormRevision=DS,s.updateFormRevisionAttachment=jS,s.updateFormRevisionAttachments=ho,s.updateFormRevisions=CS,s.updateFormSubmission=Co,s.updateFormSubmissionAttachment=XS,s.updateFormSubmissionAttachments=Eo,s.updateFormSubmissions=eI,s.updateForms=HS,s.updateGeoImage=Ko,s.updateGeoImages=tI,s.updateIssue=Ht,s.updateIssueAssociation=tl,s.updateIssueAssociations=nI,s.updateIssueAttachment=uI,s.updateIssueAttachments=ul,s.updateIssueComment=fI,s.updateIssueCommentAttachment=hI,s.updateIssueCommentAttachments=Il,s.updateIssueComments=yI,s.updateIssueType=Mh,s.updateIssueTypeAttachment=RI,s.updateIssueTypeAttachments=kl,s.updateIssueTypeFieldValues=ft,s.updateIssueTypeFieldValuesAttachment=eT,s.updateIssueTypeFieldValuesAttachments=mh,s.updateIssueTypeFieldValuesMany=kI,s.updateIssueTypeFields=rh,s.updateIssueTypeFieldsAttachment=VI,s.updateIssueTypeFieldsAttachments=Zl,s.updateIssueTypeFieldsMany=HI,s.updateIssueTypeIdentifier=yt,s.updateIssueTypeIdentifierValue=St,s.updateIssueTypeIdentifierValues=hT,s.updateIssueTypeIdentifiers=cT,s.updateIssueTypes=ST,s.updateIssueUpdate=OT,s.updateIssueUpdates=_T,s.updateIssues=bI,s.updateOrganization=nm,s.updateOrganizationAccess=Jt,s.updateOrganizationAccesses=kT,s.updateOrganizations=WT,s.updateProject=Hm,s.updateProjectAccess=Tt,s.updateProjectAccesses=sg,s.updateProjectAttachment=cg,s.updateProjectAttachments=Om,s.updateProjectFile=jn,s.updateProjectFiles=og,s.updateProjects=Sg,s.updateTeam=np,s.updateTeamMembership=Rg,s.updateTeamMemberships=vg,s.updateTeams=qg,s.updateUser=ET,s.updateUsers=MT,s.useSelectorBuilder=Gg,s.userReducer=Yh,s.userSlice=Sn,s.versioningReducer=up,s.versioningSlice=dp,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Core functionality for Overmap",
|
|
4
4
|
"author": "Wôrdn Inc.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
|
-
"version": "1.0.78-identifiers.
|
|
6
|
+
"version": "1.0.78-identifiers.1",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "dist/overmap-core.umd.cjs",
|
|
9
9
|
"module": "dist/overmap-core.js",
|