@overmap-ai/core 1.0.74 → 1.0.75-issues-requiring-type.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/overmap-core.js
CHANGED
|
@@ -4718,7 +4718,12 @@ class df extends w {
|
|
|
4718
4718
|
method: d.POST,
|
|
4719
4719
|
url: "/issues/",
|
|
4720
4720
|
payload: o,
|
|
4721
|
-
blockers: [
|
|
4721
|
+
blockers: [
|
|
4722
|
+
"add-issue",
|
|
4723
|
+
o.project.toString(),
|
|
4724
|
+
o.issue_type,
|
|
4725
|
+
...o.category ? [o.category] : []
|
|
4726
|
+
],
|
|
4722
4727
|
blocks: [o.offline_id]
|
|
4723
4728
|
});
|
|
4724
4729
|
return r.then((c) => {
|
|
@@ -12,4 +12,4 @@ Converting error to APIError and discarding.`),r=new j({message:"An error occurr
|
|
|
12
12
|
REST API, you will be requesting localhost:80 (where this app runs), resulting in a transformed blob
|
|
13
13
|
(with an offline_id attached) being returned. Alternatively, you may be running with
|
|
14
14
|
import.meta.env.PROD, which will result in some file requests being treated as
|
|
15
|
-
external URLs and therefore not prepended with VITE_API_URL.`;throw new Error(y)}const f=r.type.split("/")[1];if(!f)throw new Error("File has no extension");const p=a??h+"."+f;if(r=Ji(r,p),!r.name)throw new Error("Failed to set file's name");await this.addCache(r,h),at[c]=new Promise(y=>{y(r)})}return r}}class qf extends P{async bulkAdd(e){var m;const s=new Date().toISOString(),n=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,a={},c=[],o=[];for(const r of e){const{revisionId:h,fieldIdentifier:f,file:p}=r,y=await this.getFilePayload(p);y.sha1 in a||(a[y.sha1]=y);const T=R({file:URL.createObjectURL(p),file_type:p.type,file_name:p.name,file_sha1:y.sha1,created_by:n,form_revision:h,submitted_at:s,field_identifier:f});c.push(T);const _={offline_id:T.offline_id,file_name:p.name,field_identifier:f,file_extension:y.extension,file_sha1:y.sha1,form_revision:h};o.push(_)}this.dispatch(ac(c));const d=this.enqueueRequest({description:"Attach files to form revision",method:l.POST,url:"/form-revision-attachments/bulk/",payload:{submitted_at:s,attachments:o,files:Object.values(a)},blockers:c.map(r=>r.form_revision),blocks:c.map(r=>r.offline_id)});return d.then(r=>{this.processPresignedUrls(r.presigned_urls),this.dispatch(cc(r.attachments))}).catch(()=>{this.dispatch(oc(c.map(r=>r.offline_id)))}),[c,d.then(({attachments:r})=>r)]}async refreshStore(e){const s=await this.enqueueRequest({description:"Fetch organization form revision attachments",method:l.GET,url:"/form-revision-attachments/",queryParams:{organization:e.toString()},blockers:[e.toString()],blocks:[]});this.dispatch(nc(s))}}class kf extends P{add(e){var d;const{store:s}=this.client,a=(d=s.getState().userReducer.currentUser)==null?void 0:d.id,c=R({...e,created_by:a,revision:"Pending",submitted_at:new Date().toISOString()});this.dispatch(fs(c));const o=this.enqueueRequest({description:"Create form revision",method:l.POST,url:"/form-revisions/",payload:c,blockers:[e.form],blocks:[c.offline_id]});return o.then(m=>{this.dispatch(uc(m))}).catch(()=>{this.dispatch(ps(c.offline_id))}),[c,o]}async refreshStore(e){const s=await this.enqueueRequest({description:"Get organization form revisions",method:l.GET,url:"/form-revisions/",queryParams:{organization:e.toString()},blockers:[e.toString()],blocks:[]});this.dispatch(hc(s))}}const Df=async t=>{const e={},s=[];for(const n of t){if(n.type!=="section")throw new Error(`Expected ISerializedField type to be a section. Got ${n.type} instead.`);const{fields:a}=n,c=[];for(const o of a){if(o.image){if(o.image instanceof Promise)try{e[o.identifier]=await o.image}catch(d){console.error("Failed to get image from promise",d)}else e[o.identifier]=o.image;delete o.image}c.push(o)}s.push({...n,fields:c})}return{fields:s,images:e}};class Cf extends P{add(e,s){var r;const{store:n}=this.client,a=new Date().toISOString(),c=(r=n.getState().userReducer.currentUser)==null?void 0:r.id,o=R({...e,submitted_at:a,created_by:c}),d=R({...s,form:o.offline_id,revision:"Pending",submitted_at:a,created_by:c});this.dispatch(As(o)),this.dispatch(fs(d));const m=this.enqueueRequest({description:"Create form",method:l.POST,url:"/forms/",payload:{...o,initial_revision:{offline_id:d.offline_id,submitted_at:d.submitted_at,title:d.title,description:d.description,fields:d.fields}},blockers:[],blocks:[o.offline_id,d.offline_id]});return m.catch(h=>{throw this.dispatch(gs(o.offline_id)),this.dispatch(ps(d.offline_id)),h}),[o,d,m]}async delete(e){const{store:s}=this.client,n=s.getState(),a=Ic(e)(n);if(!a)throw new Error("Expected form to exist");const c=kc(e)(n);c.length>0&&this.dispatch(Je(c.map(({offline_id:d})=>d)));const o=Ac(e)(n);o.length>0&&this.dispatch(fc(o.map(({offline_id:d})=>d))),this.dispatch(gs(e));try{return await this.enqueueRequest({description:"Delete form",method:l.DELETE,url:`/forms/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(As(a)),o.length>0&&this.dispatch(mc(o)),c.length>0&&this.dispatch(Ke(c)),d}}async refreshStore(e){const s=await this.enqueueRequest({description:"Fetch organization forms",method:l.GET,url:"/forms/",queryParams:{organization:e.toString()},blockers:[e.toString()],blocks:[]});this.dispatch(Tc(s))}}class Mf extends P{async bulkAdd(e){var m;const s=new Date().toISOString(),n=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,a={},c=[],o=[];for(const r of e){const{submissionId:h,fieldIdentifier:f,file:p}=r,y=await this.getFilePayload(p);y.sha1 in a||(a[y.sha1]=y);const T=R({file:URL.createObjectURL(p),file_type:p.type,file_name:p.name,file_sha1:y.sha1,created_by:n,form_submission:h,submitted_at:s,field_identifier:f});c.push(T);const _={offline_id:T.offline_id,file_name:p.name,file_sha1:y.sha1,file_extension:y.extension,field_identifier:f,form_submission:h};o.push(_)}this.dispatch(He(c));const d=this.enqueueRequest({description:"Attach files to form submission",method:l.POST,url:"/form-submission-attachments/bulk/",payload:{submitted_at:s,attachments:o,files:Object.values(a)},blockers:c.map(r=>r.form_submission),blocks:c.map(r=>r.offline_id)});return d.then(r=>{this.processPresignedUrls(r.presigned_urls),this.dispatch(Oc(r.attachments))}).catch(r=>{throw this.dispatch(We(c.map(h=>h.offline_id))),r}),[c,d.then(({attachments:r})=>r)]}async bulkDelete(e){const{store:s}=this.client,n=s.getState(),a=vc(e)(n);this.dispatch(We(e));try{await this.enqueueRequest({description:"Delete form submission attachments",method:l.DELETE,url:"/form-submission-attachments/bulk/",payload:{attachment_ids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(He(a)),c}}async refreshStore(e){const s=await this.enqueueRequest({description:"Get form submission attachments",method:l.GET,url:"/form-submission-attachments/",queryParams:{project:e.toString()},blockers:[],blocks:[]});this.dispatch(Fc(s))}}class zf extends P{async add(e){var f;const{store:s}=this.client,{file:n,...a}=e,c=new Date().toISOString(),o=(f=s.getState().userReducer.currentUser)==null?void 0:f.id,d=a.project,m=await this.getFilePayload(n),r=R({...a,file_name:n.name,file_sha1:m.sha1,file:URL.createObjectURL(n),submitted_at:c,created_by:o});this.dispatch($c(r));const h=this.enqueueRequest({description:"Add geo image",method:l.POST,url:"/geo-images/",payload:{offline_id:r.offline_id,submitted_at:c,title:r.title,description:r.description,geo_marker:r.geo_marker,canvas_marker:r.canvas_marker,sha1:r.file_sha1,project:r.project,file_name:r.file_name,direction:r.direction,original_date:r.original_date,file:m},blocks:[d.toString()],blockers:[d.toString()]});return h.then(p=>{this.processPresignedUrls(p.presigned_urls),this.dispatch(ve(p.geo_image))}).catch(()=>{this.dispatch(ws(r.offline_id))}),[r,h.then(p=>p.geo_image)]}async bulkAdd(e,s){var f;const{store:n}=this.client,a=new Date().toISOString(),c=(f=n.getState().userReducer.currentUser)==null?void 0:f.id,o=[],d=[],m=[],r={};for(const p of e){const{file:y,...T}=p,_=await this.getFilePayload(y);_.sha1 in r||(r[_.sha1]=_);const b=R({...T,file_name:y.name,file_sha1:_.sha1,file:URL.createObjectURL(y),submitted_at:a,created_by:c,project:s});o.push(b),d.push(b.offline_id),m.push({offline_id:b.offline_id,sha1:b.file_sha1,file_name:b.file_name,title:b.title,description:b.description,geo_marker:b.geo_marker,canvas_marker:b.canvas_marker,direction:b.direction,original_date:b.original_date})}this.dispatch(Bc(o));const h=this.enqueueRequest({description:"Bulk add geo images",method:l.POST,url:"/geo-images/bulk/",payload:{submitted_at:a,project:s,geo_images:m,files:Object.values(r)},blocks:[s.toString()],blockers:d});return h.then(p=>{this.processPresignedUrls(p.presigned_urls),this.dispatch(Vc(p.geo_images))}).catch(()=>{this.dispatch(Lc(d))}),[o,h.then(p=>p.geo_images)]}update(e){const{store:s}=this.client,n=s.getState(),a=Es(e.offline_id)(n);if(!a)throw new Error(`Map image with offline_id ${e.offline_id} does not exist in the store`);const c={...a,...e};this.dispatch(Gc(c));const o=this.enqueueRequest({description:"Update geo image",method:l.PATCH,url:`/geo-images/${e.offline_id}/`,payload:e,blocks:[e.offline_id],blockers:[e.offline_id]});return o.then(d=>{this.dispatch(ve(d))}).catch(()=>{this.dispatch(ve(a))}),[c,o]}async delete(e){const{store:s}=this.client,n=s.getState(),a=Es(e)(n);if(!a)throw new Error(`Map image with offline_id ${e} does not exist in the store`);this.dispatch(ws(e));const c=this.enqueueRequest({description:"Delete geo image",method:l.DELETE,url:`/geo-images/${e}/`,blocks:[e],blockers:[e]});return c.catch(()=>{this.dispatch(ve(a))}),c}async refreshStore(e){const s=await this.enqueueRequest({description:"Get geo images",method:l.GET,url:`/projects/${e}/geo-images/`,blocks:[e.toString()],blockers:[]});this.dispatch(Uc(s))}}class Uf extends F{add(e){var d;const{store:s}=this.client,n=new Date().toISOString(),a=(d=s.getState().userReducer.currentUser)==null?void 0:d.id,c=R({...e,submitted_at:n,created_by:a});this.dispatch(Ps(c));const o=this.enqueueRequest({description:"Add issue association",method:l.POST,url:"/issue-associations/",payload:{offline_id:c.offline_id,submitted_at:n,...e},blockers:[e.associated_issue,...e.issue?[e.issue]:[],...e.asset?[e.asset]:[]],blocks:[c.offline_id]});return o.then(m=>{this.dispatch(Jc(m))}).catch(()=>{this.dispatch(ks(c.offline_id))}),[c,o]}async delete(e){const{store:s}=this.client,n=Xc(e)(s.getState());if(!n)throw new Error(`Issue association with id ${e} not found in store.`);this.dispatch(ks(e));const a=this.enqueueRequest({description:"Delete issue association",method:l.DELETE,url:`/issue-associations/${e}/`,blockers:[e],blocks:[]});return a.catch(()=>{this.dispatch(Ps(n))}),a}async refreshStore(e){const s=await this.enqueueRequest({description:"Fetch issue associations",method:l.GET,url:"/issue-associations/",queryParams:{project:e.toString()},blockers:[],blocks:[]});this.dispatch(Kc(s))}}class Vf extends ke{constructor(){super(...arguments);A(this,"name","Issue Attachment");A(this,"url","/issue-attachments");A(this,"addAttachments",Ms);A(this,"updateAttachments",no);A(this,"removeAttachments",zs);A(this,"removeAttachment",ao);A(this,"setAttachment",io);A(this,"selectAttachment",ro)}buildOfflineAttachment(s){return R({file:URL.createObjectURL(s.file),file_sha1:s.file_sha1,created_by:s.created_by,file_name:s.file.name,file_type:s.file.type,submitted_at:s.submitted_at,description:s.description,issue:s.modelId})}buildAttachmentPayload(s){return{...s,issue:s.modelId}}async bulkAdd(s){return this._bulkAdd(s.map(n=>({modelId:n.issueId,file:n.file})))}async delete(s){return this._delete(s)}async refreshStore(s){const n=await this.enqueueRequest({description:"Get issue attachments",method:l.GET,url:`${this.url}/`,queryParams:{project:s.toString()},blocks:[],blockers:[]});this.dispatch(so(n))}}class $f extends F{add(e){var c;const{store:s}=this.client,n=R({...e,author:(c=s.getState().userReducer.currentUser)==null?void 0:c.id,submitted_at:new Date().toISOString()});this.dispatch(Bs(n));const a=this.enqueueRequest({description:"Add issue comment",method:l.POST,url:"/issue-comments/",payload:n,blockers:[e.issue],blocks:[n.offline_id]});return a.catch(()=>{this.dispatch(Gs(n.offline_id))}),[n,a]}update(e){const{store:s}=this.client,n=fo(e.offline_id)(s.getState());if(!n)throw new Error(`Comment with offline_id ${e.offline_id} not found in store`);const a={...n,...e};this.dispatch($s(a));const c=this.enqueueRequest({description:"Edit issue comment",method:l.PATCH,url:`/issue-comments/${e.offline_id}/`,payload:e,blockers:[e.offline_id],blocks:[e.offline_id]});return c.catch(()=>{this.dispatch($s(n))}),[a,c]}remove(e){const s=this.client.store.getState().issueCommentReducer.instances[e];if(!s)throw new Error(`Comment with offline_id ${e} not found in store`);this.dispatch(Gs(e));const n=this.enqueueRequest({description:"Delete comment",method:l.DELETE,url:`/issue-comments/${e}/`,blockers:[e],blocks:[]});return n.catch(()=>{this.dispatch(Bs(s))}),n}async refreshStore(e){const s=await this.enqueueRequest({description:"Get comments",method:l.GET,url:"/issue-comments/",queryParams:{project:e.toString()},blockers:[],blocks:[]});this.dispatch(ho(s))}}class Bf extends F{add(e){var m;const{store:s}=this.client,n=s.getState(),a=new Date().toISOString(),c=(m=n.userReducer.currentUser)==null?void 0:m.id,o=R({...e,submitted_at:a,created_by:c});this.dispatch(Ns(o));const d=this.enqueueRequest({description:"Create issue",method:l.POST,url:"/issues/",payload:o,blockers:["add-issue",o.project.toString()],blocks:[o.offline_id]});return d.then(r=>{this.dispatch(Xe(r))}).catch(r=>{throw this.dispatch(Hs(o.offline_id)),r}),[o,d]}update(e){var m;const s=this.client.store.getState(),n=Ws(e.offline_id)(s);if(!n)throw new Error(`Attempting to update an issue with offline_id ${e.offline_id} that doesn't exist in the store`);const a={...n,...e};this.dispatch(Xe(a));const c={};for(const r of[v.TITLE,v.DESCRIPTION,v.STATUS,v.CATEGORY,v.PRIORITY,v.ASSIGNED_TO,v.DUE_DATE])if(r in e&&e[r]!==n[r])switch(r){case v.PRIORITY:case v.STATUS:{const h=e[r];c[r]=h!==void 0?Number(h):null;break}case v.DUE_DATE:case v.DESCRIPTION:case v.TITLE:c[r]=e[r]??null;break;case v.CATEGORY:{let h=null;const f=e[r];if(f&&(h=s.categoryReducer.instances[f]??null,!h))throw new Error(`Trying to update issue category to ${f} which does not exist in store`);c[r]=h?{name:h.name,color:h.color,offline_id:h.offline_id}:null;break}case v.ASSIGNED_TO:{let h=null;const f=e[r];if(f&&(h=s.userReducer.users[f]??null,!h))throw new Error(`Trying to update issue assigned_to to ${f} which does not exist in store`);c[r]=h?{full_name:h.username,id:h.id}:null;break}}const o=R({created_by:(m=s.userReducer.currentUser)==null?void 0:m.id,submitted_at:new Date().toISOString(),issue:n.offline_id,changes:c});this.dispatch(ir(o));const d=this.enqueueRequest({description:"Edit issue",method:l.PATCH,url:`/issues/${e.offline_id}/`,payload:e,blockers:[e.offline_id],blocks:[e.offline_id]});return d.catch(()=>{this.dispatch(Xe(n)),this.dispatch(ar(o.offline_id))}),[a,d]}async remove(e){const{store:s}=this.client,n=s.getState(),a=Ws(e)(n);if(!a)throw new Error(`No issue with id ${e} found in the store`);const c=oo(e)(n),o=rr(e)(n),d=Dc(e)(n),m={};for(const h of Zc(e)(n))m[h.offline_id]=h;for(const h of Qc(e)(n))m[h.offline_id]=h;const r=Object.values(m);this.dispatch(Hs(e)),c.length>0&&this.dispatch(zs(c.map(({offline_id:h})=>h))),o.length>0&&this.dispatch(cr(o.map(({offline_id:h})=>h))),d.length>0&&this.dispatch(Je(d.map(({offline_id:h})=>h))),r.length>0&&this.dispatch(Ds(r.map(({offline_id:h})=>h)));try{return await this.enqueueRequest({description:"Delete issue",method:l.DELETE,url:`/issues/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(Ns(a)),this.dispatch(Ms(c)),this.dispatch(nr(o)),this.dispatch(Ke(d)),this.dispatch(qs(r)),h}}async refreshStore(e){const s=await this.enqueueRequest({description:"Get issues",method:l.GET,url:"/issues/",queryParams:{project:e.toString()},blockers:[],blocks:[]});this.dispatch(Ao(s))}}class Gf extends P{async bulkAdd(e){var m;const s=new Date().toISOString(),n=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,a={},c=[],o=[];for(const r of e){const{fieldsRevisionId:h,fieldIdentifier:f,file:p}=r,y=await this.getFilePayload(p);y.sha1 in a||(a[y.sha1]=y);const T=R({file:URL.createObjectURL(p),file_type:p.type,file_name:p.name,file_sha1:y.sha1,created_by:n,fields_revision:h,submitted_at:s,field_identifier:f});c.push(T);const _={offline_id:T.offline_id,file_name:p.name,file_extension:y.extension,field_identifier:f,file_sha1:y.sha1,fields_revision:h};o.push(_)}this.dispatch(Ro(c));const d=this.enqueueRequest({description:"Add issue type fields attachments",method:l.POST,url:"/issue-type-fields-attachments/bulk/",payload:{submitted_at:s,attachments:o,files:Object.values(a)},blockers:c.map(r=>r.fields_revision),blocks:c.map(r=>r.offline_id)});return d.then(r=>{this.processPresignedUrls(r.presigned_urls),this.dispatch(Fo(r.attachments))}).catch(()=>{this.dispatch(Oo(c.map(r=>r.offline_id)))}),[c,d.then(({attachments:r})=>r)]}async refreshStore(e){const s=await this.enqueueRequest({description:"get issue type fields attachments",method:l.GET,url:"/issue-type-fields-attachments/",queryParams:{organization:e.toString()},blockers:[e.toString()],blocks:[]});this.dispatch(Io(s))}}class Lf extends F{add(e){var d;const{store:s}=this.client,n=(d=s.getState().userReducer.currentUser)==null?void 0:d.id,a=new Date().toISOString(),c=R({...e,created_by:n,submitted_at:a});this.dispatch(Mo(c));const o=this.enqueueRequest({description:"Add Issue Type Fields",method:l.POST,url:"/issue-type-fields/",payload:c,blockers:[c.issue_type],blocks:[c.offline_id]});return o.then(m=>{this.dispatch(zo(m))}).catch(m=>{throw this.dispatch(Uo(c.offline_id)),m}),[c,o]}async refreshStore(e){const s=await this.enqueueRequest({description:"Get Issue Type Fields",method:l.GET,url:"/issue-type-fields/",queryParams:{organization:e.toString()},blockers:[],blocks:[]});this.dispatch(Co(s))}}class Nf extends P{async bulkAdd(e){var m;const s=new Date().toISOString(),n=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,a={},c=[],o=[];for(const r of e){const{fieldValuesId:h,fieldIdentifier:f,file:p}=r,y=await this.getFilePayload(p);y.sha1 in a||(a[y.sha1]=y);const T=R({file:URL.createObjectURL(p),file_type:p.type,file_name:p.name,file_sha1:y.sha1,created_by:n,field_values:h,submitted_at:s,field_identifier:f});c.push(T);const _={offline_id:T.offline_id,file_name:p.name,file_sha1:y.sha1,file_extension:y.extension,field_identifier:f,field_values:h};o.push(_)}this.dispatch(Qe(c));const d=this.enqueueRequest({description:"Add issue type field values attachments",method:l.POST,url:"/issue-type-field-values-attachments/bulk/",payload:{submitted_at:s,attachments:o,files:Object.values(a)},blockers:c.map(r=>r.field_values),blocks:c.map(r=>r.offline_id)});return d.then(({presigned_urls:r,attachments:h})=>{this.processPresignedUrls(r),this.dispatch(Lo(h))}).catch(r=>{throw this.dispatch(xe(c.map(h=>h.offline_id))),r}),[c,d.then(({attachments:r})=>r)]}async bulkDelete(e){const{store:s}=this.client,n=s.getState(),a=Ho(e)(n);this.dispatch(xe(e));try{await this.enqueueRequest({description:"Delete issue type field values attachments",method:l.DELETE,url:"/issue-type-field-values-attachments/bulk/",payload:{attachment_ids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(Qe(a)),c}}async refreshStore(e){const s=await this.enqueueRequest({description:"Get issue type field values attachments",method:l.GET,url:"/issue-type-field-values-attachments/",queryParams:{project:e.toString()},blockers:[],blocks:[]});this.dispatch(Go(s))}}class Hf extends F{add(e){var o;const{store:s}=this.client,n=s.getState(),a=R({...e,created_by:(o=n.userReducer.currentUser)==null?void 0:o.id,submitted_at:new Date().toISOString()}),c=this.enqueueRequest({description:"Add issue type field values",method:l.POST,url:"/issue-type-field-values/",payload:a,blockers:[e.issue,e.fields_revision],blocks:[a.offline_id]});return this.dispatch(Js(a)),c.then(d=>(this.dispatch(Ee(d)),d)).catch(()=>{this.dispatch(Xs(a.offline_id))}),[a,c]}update(e){const{store:s}=this.client,n=s.getState(),a=Qs(e.offline_id)(n);if(!a)throw new Error(`Expected IssueTypeFieldValues with offline_id ${e.offline_id} to exist`);const c={...a,...e};this.dispatch(Ee(c));const o=this.enqueueRequest({description:"Update issue type field values",method:l.PATCH,url:`/issue-type-field-values/${e.offline_id}/`,payload:e,blockers:[c.offline_id,c.fields_revision,c.issue],blocks:[c.offline_id]});return o.then(d=>{this.dispatch(Ee(d))}).catch(()=>{this.dispatch(Ee(a))}),[c,o]}async delete(e){const{store:s}=this.client,n=s.getState(),a=Qs(e)(n);if(!a)throw new Error(`Expected submission with offline_id ${e} to exist`);const c=Wo(e)(n);this.dispatch(Xs(e)),this.dispatch(xe(c.map(o=>o.offline_id)));try{await this.enqueueRequest({description:"Delete issue type field values",method:l.DELETE,url:`/issue-type-field-values/${e}/`,blockers:[e],blocks:[]})}catch(o){throw this.dispatch(Js(a)),this.dispatch(Qe(c)),o}}async refreshStore(e){const s=await this.enqueueRequest({description:"Get issue type field values",method:l.GET,url:"/issue-type-field-values/",queryParams:{project:e.toString()},blockers:[],blocks:[]});this.dispatch(Po(s))}}class Wf extends F{add(e){var o;const{store:s}=this.client,n=s.getState(),a=R({...e,submitted_at:new Date().toISOString(),created_by:(o=n.userReducer.currentUser)==null?void 0:o.id});this.dispatch(Xo(a));const c=this.enqueueRequest({method:l.POST,url:"/issue-types/",payload:a,blockers:[],blocks:[a.offline_id]});return c.then(d=>{this.dispatch(je(d))}).catch(()=>{this.dispatch(ii(a.offline_id))}),[a,c]}update(e){const{store:s}=this.client,n=s.getState(),a=ni(e.offline_id)(n);if(!a)throw new Error(`IssueType with offline_id ${e.offline_id} does not exist in the store.`);const c={...a,...e};this.dispatch(Zo(c));const o=this.enqueueRequest({method:l.PATCH,url:`/issue-types/${e.offline_id}/`,payload:e,blockers:[e.offline_id],blocks:[e.offline_id]});return o.then(d=>{this.dispatch(je(d))}).catch(()=>{this.dispatch(je(a))}),[c,o]}delete(e){const{store:s}=this.client,n=s.getState(),a=ni(e)(n);if(!a)throw new Error(`IssueType with offline_id ${e} does not exist in the store.`);const c=ai(e)(n);this.dispatch(ii(e)),this.dispatch(So(c.map(d=>d.offline_id)));const o=this.enqueueRequest({method:l.DELETE,url:`/issue-types/${e}/`,blockers:[e],blocks:[]});return o.catch(()=>{this.dispatch(je(a)),this.dispatch(go(c))}),o}async refreshStore(e){const s=await this.enqueueRequest({method:l.GET,url:"/issue-types/",queryParams:{organization:e.toString()},blockers:[],blocks:[]});this.dispatch(Jo(s))}}class Yf extends F{async refreshStore(e){const s=await this.enqueueRequest({description:"Get issue updates",method:l.GET,url:"/issue-updates/",queryParams:{project:e.toString()},blockers:[],blocks:[]});this.dispatch(sr(s))}}class Kf extends jd{constructor(e){super(e)}}const Jf=1800;function Xf(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 Zf extends Kf{constructor(){super(...arguments);A(this,"_getRenewedTokens",async s=>{const n=this.enqueueRequest({description:"Get renewed tokens",method:l.POST,url:this.refreshTokensUrl,payload:{refresh:s},isAuthNeeded:!1,blockers:[],blocks:[],checkAuth:!1,immediate:!0});let a;try{a=await n}catch(c){console.error("Could not renew tokens; clearing auth",c),this.clearAuth();return}if(!a.access)throw new Error("Missing access token");return{accessToken:a.access,refreshToken:a.refresh??this.getRefreshToken()}})}clearAuth(){console.debug(this.constructor.name,"clearing auth;"),this.dispatch(_a(!1)),this.clearTokens(),this.dispatch({type:xd.RESET_STATE}),this.dispatch({type:Ud})}async renewTokens(){const s=this.getRefreshToken();if(!s)throw new Error("No refresh token found");console.debug(this.constructor.name,"renewing tokens");try{const n=await this._getRenewedTokens(s);if(!n)return;console.log("Got renewed tokens"),this.setTokens(n)}catch(n){throw console.error("Could not renew tokens; clearing auth",n),this.clearAuth(),n}}tokenIsExpiringSoon(){const s=this.getAccessToken();if(!s)return!1;const n=Date.now()/1e3;let a;try{a=el(s).exp??n}catch{a=n}return a-n<Jf}getAuthHeader(){return`Bearer ${this.getAccessToken()}`}async prepareAuth(){if(this.tokenIsExpiringSoon()){console.debug(this.constructor.name,"preparing auth");try{await this.renewTokens()}catch(s){return s instanceof j&&this.clearAuth(),s instanceof Error?Promise.reject(s):Promise.reject(new Error((s??Te).toString()))}}}async handleUnauthorized(s,n){const a=this.client.store.getState();if(s.url.endsWith("/token/refresh/"))throw a.authReducer.isLoggedIn&&console.warn("No signed-in user to sign out."),this.clearAuth(),new j({message:"You have been signed out due to inactivity.",response:n,discard:!0});if(a.authReducer.isLoggedIn)await this.renewTokens();else throw console.debug("Forbidden; user is not logged in."),new j({message:"Incorrect username or password.",response:n,discard:!0})}async initAuth(s){const n=O.v4();return console.debug(this.constructor.name,"Initiating auth"),this.enqueueRequest({uuid:n,description:"Get token pair",method:l.POST,url:this.initTokensUrl,payload:s,isAuthNeeded:!1,checkAuth:!1,immediate:!0,blockers:[],blocks:[]}).then(a=>{this.setTokens(Xf(a))})}}class Qf extends F{async getLicense(e){const s=await this.enqueueRequest({description:"Get license",method:l.GET,url:`/billing/${e.offline_id}/`,isAuthNeeded:!0,blockers:[e.organization_owner?e.organization_owner.toString():""],blocks:[]});return this.dispatch(te(s)),s}async pauseLicense(e){const s=await this.enqueueRequest({description:"Pause license",method:l.DELETE,url:`/billing/${e.offline_id}/suspend/`,isAuthNeeded:!0,blockers:[e.organization_owner?e.organization_owner.toString():""],blocks:[]});return this.dispatch(te(s)),s}async resumeLicense(e){const s=await this.enqueueRequest({description:"Resume license",method:l.PATCH,url:`/billing/${e.offline_id}/suspend/`,isAuthNeeded:!0,blockers:[e.organization_owner?e.organization_owner.toString():""],blocks:[]});return this.dispatch(te(s)),s}async cancelLicense(e){const s=await this.enqueueRequest({description:"Cancel license",method:l.DELETE,url:`/billing/${e.offline_id}/`,isAuthNeeded:!0,blockers:[e.organization_owner?e.organization_owner.toString():""],blocks:[]});return this.dispatch(te(s)),s}async attachLicenseToProject(e,s){const n=await this.enqueueRequest({description:"Attach license",method:l.PATCH,url:`/billing/${e.offline_id}/project/`,isAuthNeeded:!0,payload:{project:s.id},blockers:[e.organization_owner?e.organization_owner.toString():"",s.id?s.id.toString():""],blocks:["add-issue","add-form-entry","change-access-level","add-workspace"]});return this.dispatch(te(n)),n}async detachLicenseFromProject(e){const s=await this.enqueueRequest({description:"Detach license",method:l.DELETE,url:`/billing/${e.offline_id}/project/`,isAuthNeeded:!0,blockers:[e.organization_owner?e.organization_owner.toString():""],blocks:["add-issue","add-form-entry","change-access-level","add-workspace"]});return this.dispatch(te(s)),s}async getLatestTransaction(e){return await this.enqueueRequest({description:"Get latest transaction",method:l.GET,url:`/billing/${e.offline_id}/transaction/`,isAuthNeeded:!0,blockers:[e.offline_id],blocks:[e.offline_id]})}async refreshStore(e,s){const n={},a=await this.enqueueRequest({description:"Get licenses",method:l.GET,url:`/organizations/${s}/licenses/`,isAuthNeeded:!0,blockers:[s.toString()],blocks:["add-issue","add-form-entry","change-access-level","add-workspace"]});for(const o of a)n[o.offline_id]=o;const c=await this.enqueueRequest({description:"Get licenses",method:l.GET,url:`/projects/${e}/licenses/`,isAuthNeeded:!0,blockers:[e.toString()],blocks:["add-issue","add-form-entry","change-access-level","add-workspace"]});for(const o of c)n[o.offline_id]=o;this.dispatch(ur(Object.values(n)))}}class xf extends F{async update(e){const s=this.enqueueRequest({description:"Edit organization access",method:l.PATCH,url:`/organizations/${e.organization}/access/${e.offline_id}/`,payload:e,blockers:[e.offline_id],blocks:[e.offline_id]});return s.then(()=>{this.dispatch(Tr(e))}),s}async remove(e){return this.dispatch(br(e.offline_id)),this.dispatch(yr(e.user)),this.enqueueRequest({description:"Remove organization access",method:l.DELETE,url:`/organizations/${e.organization}/access/${e.offline_id}/`,blockers:[e.offline_id],blocks:[]})}async refreshStore(e){const s=await this.enqueueRequest({description:"Get organization accesses",method:l.GET,url:`/organizations/${e}/access/`,blockers:[],blocks:[]});this.dispatch(Sr(s))}}class ep extends F{create(e){return this.enqueueRequest({description:"Create organization",method:l.POST,url:"/organizations/",payload:{name:e},blockers:[],blocks:[`add-org-${e}`,"create-org"]})}async update(e){return this.enqueueRequest({description:"Edit organization",method:l.PATCH,url:`/organizations/${e.id}/`,payload:e,blockers:[`add-org-${e.name}`,e.id.toString()],blocks:[e.id.toString()]})}async invite(e,s){return this.enqueueRequest({description:"Invite user to organization",method:l.POST,url:`/organizations/${e}/invite/${s}/`,blockers:[],blocks:[]})}async refreshStore(e,s){const n={},a=await this.enqueueRequest({description:"Get organizations",method:l.GET,url:`/projects/${e}/organizations/`,blockers:[],blocks:[]});for(const o of a)n[o.id]=o;const c=await this.enqueueRequest({description:"Get organization",method:l.GET,url:`/organizations/${s}/`,blockers:[],blocks:[]});n[c.id]=c,this.dispatch($r(Object.values(n)))}}class tp extends F{async update(e){return this.dispatch(Fr(e)),this.enqueueRequest({description:"Edit project access",method:l.PATCH,url:`/access/${e.offline_id}/`,payload:e,blockers:[e.offline_id,"change-access-level"],blocks:[e.offline_id]})}async remove(e){return this.dispatch(Or(e)),this.enqueueRequest({description:"Delete project access",method:l.DELETE,url:`/access/${e}/`,blockers:[e],blocks:[]})}async refreshStore(e){const s=await this.enqueueRequest({description:"Get project accesses",method:l.GET,url:`/projects/${e}/access/`,blockers:[],blocks:[]});this.dispatch(hi(s))}}class sp extends ke{constructor(){super(...arguments);A(this,"name","Project Attachment");A(this,"url","/project-attachments");A(this,"addAttachments",ed);A(this,"updateAttachments",id);A(this,"removeAttachments",Si);A(this,"removeAttachment",nd);A(this,"setAttachment",td);A(this,"selectAttachment",cd)}buildOfflineAttachment(s){return R({file:URL.createObjectURL(s.file),file_sha1:s.file_sha1,created_by:s.created_by,file_name:s.file.name,file_type:s.file.type,submitted_at:s.submitted_at,description:s.description,project:s.modelId})}buildAttachmentPayload(s){return{...s,project:s.modelId}}async bulkAdd(s){return this._bulkAdd(s.map(n=>({modelId:n.projectId,file:n.file})))}async delete(s){return this._delete(s)}async refreshStore(s){const n=await this.enqueueRequest({description:"Get project attachments",method:l.GET,url:`${this.url}/`,queryParams:{project:s.toString()},blockers:[],blocks:[]});this.dispatch(xr(n))}}class ip extends F{async saveExisting(e){if(!e.offline_id)throw new Error("You can only use this method to save existing project files. The one provided has no offline_id.");const s={...e};delete s.file;const n=this.enqueueRequest({method:l.PATCH,url:`/projects/files/${e.offline_id}/`,payload:s,blockers:[e.offline_id],blocks:[e.offline_id]});return n.then(a=>{this.dispatch(_i(a))}),n}saveActive(){const{store:e}=this.client,s=e.getState(),n=s.projectFileReducer.activeProjectFileId;if(!n)throw new Error("No active project file");const a=s.projectFileReducer.instances[n];if(!a)throw new Error("No active project file");if(!a.bounds&&!a.canvas_bounds)throw new Error("Project file must either have bounds or canvas_bounds set");let c;if(typeof a.file=="string"&&!a.file.startsWith("blob:")){const m={...a};delete m.file,c={method:l.PATCH,url:`/projects/files/${n}/`,payload:m,blockers:[n],blocks:[n]}}else c=new Promise((m,r)=>{this.client.files.uploadFileToS3(a.file_sha1).then(([h])=>{m({method:l.POST,url:`/projects/${a.project}/files/`,payload:{...a,...h},blockers:[n],blocks:[n]})}).catch(r)});const d=Promise.resolve(c).then(m=>this.enqueueRequest(m));return d.then(m=>{this.dispatch(_i(m))}),this.dispatch(yd),this.dispatch(pd(null)),this.dispatch(fd(!1)),[a,d]}delete(e){return this.dispatch(hd(e)),this.enqueueRequest({method:l.DELETE,url:`/projects/files/${e}`,blockers:[e],blocks:[]})}async refreshStore(e){const s=await this.enqueueRequest({description:"Get project files",method:l.GET,url:`/projects/${e}/files/`,blockers:[],blocks:[]});this.dispatch(ld(s))}}class np extends F{async add(e){if(!e.bounds&&!e.canvas_bounds)throw new Error("Project must either have bounds or canvas_bounds set");return await this.enqueueRequest({description:"Create project",method:l.POST,url:"/projects/",payload:{name:e.name,bounds:e.bounds,organization_owner:e.organization_owner},blockers:[],blocks:[]})}async update(e){if(!e.bounds&&!e.canvas_bounds)throw new Error("Project must either have bounds or canvas_bounds set");return this.dispatch(kr(e)),await this.enqueueRequest({description:"Update project",method:l.PATCH,url:`/projects/${e.id}/`,payload:{name:e.name,bounds:e.bounds},blockers:[e.id.toString()],blocks:[e.id.toString()]})}async delete(e){const{store:s}=this.client,n=s.getState(),a=pi(n),c=a[e];if(!c)throw new Error("Expected project to exist");const o=gd(n).filter(h=>h.project===e);this.dispatch(md(o.map(({offline_id:h})=>h)));const d=od(c.id)(n);this.dispatch(Si(d.map(({offline_id:h})=>h)));const m=wr(n);this.dispatch(vr(m.map(({offline_id:h})=>h))),this.dispatch({type:"rehydrated/setRehydrated",payload:!1}),this.dispatch(Dr(c));const r=hr(c.id)(n);r&&this.dispatch(te({...r,project:null}));try{await this.enqueueRequest({description:"Delete project",method:l.DELETE,url:`/projects/${e}/`,blockers:[e.toString()],blocks:[]}),this.dispatch({type:"rehydrated/setRehydrated",payload:!0})}catch(h){throw this.dispatch(qr(Object.values(a))),this.dispatch(hi(Object.values(m))),this.dispatch(ud(o)),this.dispatch(sd(d)),this.dispatch({type:"rehydrated/setRehydrated",payload:!0}),r&&this.dispatch(te({...r,project:c.id})),h}}invite(e,s){const n=O.v4();return this.enqueueRequest({description:"Invite user to project",method:l.POST,url:`/projects/${e}/invite/${s}/`,payload:{offline_id:n},blockers:[],blocks:[n]})}joinProject(e,s,n){return this.enqueueRequest({description:"Join project",method:l.GET,url:`/projects/${e}/join-project/${s}/${n}/`,isAuthNeeded:!1,blockers:[],blocks:[]})}async acceptInvite(e){return this.enqueueRequest({description:"Accept project invite",method:l.PATCH,url:`/projects/${e}/accept-invite/`,blockers:[e.toString()],blocks:[e.toString()]}).then(()=>{this.dispatch(Cr(e))})}}class ap extends F{add(e){const s=R({...e,submitted_at:new Date().toISOString()});this.dispatch(Id(s));const n=this.enqueueRequest({description:"Create team",method:l.POST,url:`/organizations/${e.organization}/teams/`,payload:s,blockers:[],blocks:[s.offline_id]});return n.then(a=>{this.dispatch(ge(a))}).catch(()=>{this.dispatch(Oi(s.offline_id))}),[s,n]}update(e){const{store:s}=this.client,n=Se(e.offline_id)(s.getState());if(!n)throw new Error(`Expected team with offline_id ${e.offline_id} to exist`);const a={...n,...e};this.dispatch(Fi(a));const c=this.enqueueRequest({description:"Update team",method:l.PATCH,url:`/organizations/teams/${e.offline_id}/`,payload:e,blockers:[e.offline_id],blocks:[e.offline_id]});return c.then(o=>{this.dispatch(ge(o))}).catch(()=>{this.dispatch(ge(n))}),[a,c]}async delete(e){const{store:s}=this.client,n=s.getState(),a=Se(e)(n);if(!a)throw new Error(`Expected team with id ${e} to exist`);this.dispatch(Oi(e));try{return await this.enqueueRequest({description:"Delete team",method:l.DELETE,url:`/organizations/teams/${e}/`,blockers:[e],blocks:[e]})}catch(c){throw this.dispatch(ge(a)),c}}async setMembers(e,s){const{store:n}=this.client,a=Se(e)(n.getState());if(!a)throw new Error(`Expected team with id ${e} to exist`);if(s.length!==new Set(s).size)throw new Error("Duplicate members found in the list");this.dispatch(Fi({...a,members:s}));const c=this.enqueueRequest({description:"Set team members",method:l.PUT,url:`/organizations/teams/${e}/set-members/`,payload:{users:s},blockers:[e],blocks:[e]});return c.catch(()=>{this.dispatch(ge(a))}),c}async addMembers(e,s){const{store:n}=this.client,a=Se(e)(n.getState());if(!a)throw new Error(`Expected team with id ${e} to exist`);const c=[...a.members,...s];return this.setMembers(e,c)}async removeMembers(e,s){const{store:n}=this.client,a=Se(e)(n.getState());if(!a)throw new Error(`Expected team with id ${e} to exist`);const c=a.members.filter(o=>!s.includes(o));return this.setMembers(e,c)}async refreshStore(e){const s=await this.enqueueRequest({description:"Fetch teams",method:l.GET,url:`/organizations/${e}/teams/`,blockers:[],blocks:[]});this.dispatch(_d(s))}}class cp extends F{async refreshStore(e,s){const n={},a=await this.enqueueRequest({description:"Fetch organization users",method:l.GET,url:`/organizations/${s}/users/`,blockers:[],blocks:[]});for(const o of a)n[o.id]=o;const c=await this.enqueueRequest({description:"Fetch project users",method:l.GET,url:`/projects/${e}/users/`,blockers:[],blocks:[]});for(const o of c)n[o.id]=o;this.dispatch(pr(Object.values(n)))}}var Nd=(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))(Nd||{});i.APIError=j,i.AgentService=hf,i.AssetAttachmentService=mf,i.AssetService=ff,i.AssetStageCompletionService=pf,i.AssetStageService=yf,i.AssetTypeAttachmentService=Af,i.AssetTypeFieldValuesAttachmentService=Tf,i.AssetTypeFieldValuesService=If,i.AssetTypeFieldsAttachmentService=gf,i.AssetTypeFieldsService=Sf,i.AssetTypeService=Rf,i.AttachmentModel=Bi,i.BaseApiService=F,i.BaseSDK=lf,i.CategoryService=Ff,i.DEFAULT_ISSUE_PRIORITY=sl,i.DEFAULT_ISSUE_STATUS=tl,i.DeferredPromise=Wi,i.DocumentAttachmentService=Of,i.DocumentService=vf,i.EMPTY_ARRAY=Vi,i.EMPTY_OBJECT=$i,i.EmailDomainsService=wf,i.EmailVerificationService=Ef,i.FileService=Pf,i.FormRevisionAttachmentService=qf,i.FormRevisionService=kf,i.FormService=Cf,i.FormSubmissionAttachmentService=Mf,i.FormSubmissionService=_f,i.GeoImageService=zf,i.HttpMethod=l,i.IssueAssociationService=Uf,i.IssueAttachmentService=Vf,i.IssueCommentService=$f,i.IssuePriority=dt,i.IssueService=Bf,i.IssueStatus=lt,i.IssueTypeFieldValuesAttachmentService=Nf,i.IssueTypeFieldValuesService=Hf,i.IssueTypeFieldsAttachmentService=Gf,i.IssueTypeFieldsService=Lf,i.IssueTypeService=Wf,i.IssueUpdateChange=v,i.IssueUpdateService=Yf,i.JWTService=Zf,i.LicenseLevel=Li,i.LicenseService=Qf,i.LicenseStatus=Ni,i.OUTBOX_RETRY_DELAY=Hi,i.OrganizationAccessLevel=rt,i.OrganizationAccessService=xf,i.OrganizationService=ep,i.OutboxCoordinator=be,i.PaddleCheckoutEvent=Gi,i.ProjectAccessLevel=ot,i.ProjectAccessService=tp,i.ProjectAttachmentService=sp,i.ProjectFileService=ip,i.ProjectService=np,i.TeamService=ap,i.UNKNOWN_ERROR_MESSAGE=Te,i.UserService=cp,i.VERSION_REDUCER_KEY=Ei,i.VerificationCodeType=Nd,i._selectLatestFormRevision=yc,i._setLatestRetryTime=Xr,i.acceptProjectInvite=Cr,i.addAsset=It,i.addAssetAttachment=Ol,i.addAssetAttachments=St,i.addAssetStage=zl,i.addAssetStageCompletion=jt,i.addAssetStageCompletions=Pt,i.addAssetStages=Ce,i.addAssetType=Qt,i.addAssetTypeAttachment=$l,i.addAssetTypeAttachments=Vt,i.addAssetTypeFieldValues=Yt,i.addAssetTypeFieldValuesAttachment=au,i.addAssetTypeFieldValuesAttachments=$e,i.addAssetTypeFieldValuesMany=ma,i.addAssetTypeFields=xn,i.addAssetTypeFieldsAttachment=Nl,i.addAssetTypeFieldsAttachments=Hn,i.addAssetTypeFieldsMany=Zl,i.addAssetTypes=Au,i.addAssets=Rt,i.addCategory=is,i.addConversation=sn,i.addDocumentAttachment=Eu,i.addDocumentAttachments=Pa,i.addDocuments=Ba,i.addEmailDomain=Ya,i.addForm=As,i.addFormRevision=fs,i.addFormRevisionAttachment=$u,i.addFormRevisionAttachments=ac,i.addFormRevisions=mc,i.addFormSubmission=_s,i.addFormSubmissionAttachment=eh,i.addFormSubmissionAttachments=He,i.addFormSubmissions=Ke,i.addForms=Xu,i.addGeoImage=$c,i.addGeoImages=Bc,i.addIssue=Ns,i.addIssueAssociation=Ps,i.addIssueAssociations=qs,i.addIssueAttachment=mh,i.addIssueAttachments=Ms,i.addIssueComment=Bs,i.addIssueComments=Ah,i.addIssueType=Xo,i.addIssueTypeFieldValues=Js,i.addIssueTypeFieldValuesAttachment=Lh,i.addIssueTypeFieldValuesAttachments=Qe,i.addIssueTypeFieldValuesMany=wh,i.addIssueTypeFields=Mo,i.addIssueTypeFieldsAttachment=bh,i.addIssueTypeFieldsAttachments=Ro,i.addIssueTypeFieldsMany=Dh,i.addIssueUpdate=ir,i.addIssueUpdates=nr,i.addIssues=go,i.addLicenses=xh,i.addProjectAttachment=Im,i.addProjectAttachments=ed,i.addProjectFile=wm,i.addProjectFiles=ud,i.addTeam=Id,i.addUsers=am,i.agentsReducer=cn,i.agentsSlice=pt,i.areArraysEqual=cl,i.assetAttachmentReducer=fn,i.assetAttachmentSlice=At,i.assetReducer=Sn,i.assetSlice=_t,i.assetStageCompletionReducer=On,i.assetStageCompletionSlice=Et,i.assetStageReducer=jn,i.assetStageSlice=Ct,i.assetTypeAttachmentReducer=Gn,i.assetTypeAttachmentSlice=Ut,i.assetTypeFieldValuesAttachmentReducer=la,i.assetTypeFieldValuesAttachmentSlice=Nt,i.assetTypeFieldValuesReducer=Aa,i.assetTypeFieldValuesSlice=Wt,i.assetTypeFieldsAttachmentReducer=Xn,i.assetTypeFieldsAttachmentSlice=Gt,i.assetTypeFieldsReducer=ia,i.assetTypeFieldsSlice=Lt,i.assetTypeReducer=Ta,i.assetTypeSlice=Zt,i.authReducer=Ia,i.authSlice=Ge,i.blobToBase64=pl,i.categoryReducer=wa,i.categorySlice=ss,i.clearTokens=Iu,i.constructUploadedFilePayloads=fl,i.coordinatesAreEqual=al,i.createModelAdapter=I,i.createMultiPointGeometry=nl,i.createOfflineAction=Wr,i.createPointGeometry=il,i.deleteAsset=Ft,i.deleteAssetAttachment=ln,i.deleteAssetAttachments=Tt,i.deleteAssetStage=Ul,i.deleteAssetStageCompletion=qt,i.deleteAssetStageCompletions=kt,i.deleteAssetStages=ze,i.deleteAssetType=xt,i.deleteAssetTypeAttachment=Un,i.deleteAssetTypeAttachments=$t,i.deleteAssetTypeFieldValues=Kt,i.deleteAssetTypeFieldValuesAttachment=du,i.deleteAssetTypeFieldValuesAttachments=Be,i.deleteAssetTypeFieldValuesMany=pa,i.deleteAssetTypeFields=ta,i.deleteAssetTypeFieldsAttachment=Kl,i.deleteAssetTypeFieldsAttachments=Yn,i.deleteAssetTypeFieldsMany=tu,i.deleteAssetTypes=Su,i.deleteAssets=An,i.deleteCategory=va,i.deleteDocumentAttachment=Da,i.deleteDocumentAttachments=Ca,i.deleteEmailDomain=Ka,i.deleteForm=gs,i.deleteFormRevision=ps,i.deleteFormRevisionAttachment=Nu,i.deleteFormRevisionAttachments=oc,i.deleteFormRevisions=fc,i.deleteFormSubmission=Is,i.deleteFormSubmissionAttachment=nh,i.deleteFormSubmissionAttachments=We,i.deleteFormSubmissions=Je,i.deleteGeoImage=ws,i.deleteGeoImages=Lc,i.deleteIssue=Hs,i.deleteIssueAssociation=ks,i.deleteIssueAssociations=Ds,i.deleteIssueAttachment=ao,i.deleteIssueAttachments=zs,i.deleteIssueComment=Gs,i.deleteIssueComments=gh,i.deleteIssueTypeFieldValues=Xs,i.deleteIssueTypeFieldValuesAttachment=Yh,i.deleteIssueTypeFieldValuesAttachments=xe,i.deleteIssueTypeFieldValuesMany=qh,i.deleteIssueTypeFields=Uo,i.deleteIssueTypeFieldsAttachment=Fh,i.deleteIssueTypeFieldsAttachments=Oo,i.deleteIssueTypeFieldsMany=Uh,i.deleteIssueUpdate=ar,i.deleteIssueUpdates=cr,i.deleteIssues=So,i.deleteOrganizationAccess=br,i.deleteProject=Dr,i.deleteProjectAccess=Or,i.deleteProjectAccesses=vr,i.deleteProjectAttachment=nd,i.deleteProjectAttachments=Si,i.deleteProjectFile=hd,i.deleteProjectFiles=md,i.deleteTeam=Oi,i.dequeue=$d,i.discard=qi,i.documentAttachmentReducer=Ua,i.documentAttachmentSlice=cs,i.documentSlice=rs,i.documentsReducer=Ha,i.downloadFile=yl,i.downloadInMemoryFile=ml,i.emailDomainsReducer=Za,i.emailDomainsSlice=ls,i.emailRegex=Il,i.enqueue=Vd,i.enqueueRequest=Kr,i.fallbackToEmptyArray=S,i.fallbackToEmptyObject=ae,i.fileReducer=sc,i.fileSlice=us,i.fileToBlob=Xi,i.formReducer=bc,i.formRevisionAttachmentReducer=dc,i.formRevisionAttachmentSlice=hs,i.formRevisionReducer=gc,i.formRevisionsSlice=ms,i.formSlice=ys,i.formSubmissionAttachmentReducer=Ec,i.formSubmissionAttachmentSlice=Ss,i.formSubmissionReducer=Mc,i.formSubmissionSlice=bs,i.geoImageReducer=Wc,i.geoImageSlice=vs,i.getFileIdentifier=hl,i.getFileS3Key=ft,i.getLocalDateString=Ki,i.getLocalRelativeDateString=ll,i.getOutboxCoordinator=ue,i.getRenamedFile=Ji,i.hashFile=fe,i.initSDK=uf,i.initializeAssetAttachments=gt,i.initializeAssetStageCompletions=bn,i.initializeAssetStages=wn,i.initializeAssetTypeAttachments=Cn,i.initializeAssetTypeFieldValues=ha,i.initializeAssetTypeFieldValuesAttachments=aa,i.initializeAssetTypeFields=Qn,i.initializeAssetTypeFieldsAttachments=Nn,i.initializeAssetTypes=Sa,i.initializeAssets=yn,i.initializeCategories=Fa,i.initializeConversations=tn,i.initializeDocumentAttachments=ja,i.initializeEmailDomains=Wa,i.initializeFormRevisionAttachments=nc,i.initializeFormRevisions=hc,i.initializeFormSubmissionAttachments=Fc,i.initializeFormSubmissions=Pc,i.initializeForms=Tc,i.initializeGeoImages=Uc,i.initializeIssueAssociations=Kc,i.initializeIssueAttachments=so,i.initializeIssueTypeFieldValues=Po,i.initializeIssueTypeFieldValuesAttachments=Go,i.initializeIssueTypeFields=Co,i.initializeIssueTypeFieldsAttachments=Io,i.initializeIssueTypes=Jo,i.initializeIssueUpdates=sr,i.initializeIssues=Ao,i.initializeLicences=ur,i.initializeOrganizationAccesses=Sr,i.initializeProjectAccesses=hi,i.initializeProjectAttachments=xr,i.initializeProjectFiles=ld,i.initializeTeams=_d,i.isToday=dl,i.issueAssociationReducer=eo,i.issueAssociationSlice=js,i.issueAttachmentReducer=lo,i.issueAttachmentSlice=Cs,i.issueCommentReducer=po,i.issueCommentSlice=Vs,i.issueReducer=bo,i.issueSlice=Ls,i.issueTypeFieldValuesAttachmentReducer=Yo,i.issueTypeFieldValuesAttachmentSlice=ei,i.issueTypeFieldValuesReducer=ko,i.issueTypeFieldValuesSlice=Ks,i.issueTypeFieldsAttachmentReducer=Eo,i.issueTypeFieldsAttachmentSlice=Ys,i.issueTypeFieldsReducer=$o,i.issueTypeFieldsSlice=xs,i.issueTypeReducer=er,i.issueTypeSlice=si,i.issueUpdateReducer=dr,i.issueUpdateSlice=ci,i.licenseReducer=mr,i.licenseSlice=oi,i.logOnlyOnce=Al,i.markAsDeleted=Jr,i.markForDeletion=_m,i.memoize=ht,i.moveDocument=Ga,i.offline=R,i.onlyUniqueHashes=_l,i.onlyUniqueOfflineIds=xi,i.organizationAccessReducer=Ir,i.organizationAccessSlice=di,i.organizationReducer=Hr,i.organizationSlice=yi,i.outboxReducer=Zr,i.outboxSlice=Ai,i.overmapEnhancer=Qm,i.overmapReducers=Md,i.overmapRootReducer=Ym,i.performRequest=Pi,i.projectAccessReducer=jr,i.projectAccessSlice=ui,i.projectAttachmentReducer=rd,i.projectAttachmentSlice=gi,i.projectFileReducer=Sd,i.projectFileSlice=bi,i.projectReducer=Mr,i.projectSlice=fi,i.rehydratedReducer=Td,i.rehydratedSlice=Ii,i.removeDocuments=ds,i.removeIssueType=ii,i.removeUser=yr,i.resetProjectFileObjectUrls=jm,i.resetStore=Ud,i.restructureCreateSelectorWithArgs=g,i.saveActiveProjectFileBounds=yd,i.selectAccessToken=Ru,i.selectActiveOrganizationAccess=dm,i.selectActiveProjectFileId=qm,i.selectActiveStatusLicenses=tm,i.selectAllDocumentAttachments=os,i.selectAllProjectAttachments=Ti,i.selectAncestorIdsOfDocument=Cu,i.selectAssetAttachmentById=hn,i.selectAssetAttachmentMapping=un,i.selectAssetAttachments=bt,i.selectAssetById=wt,i.selectAssetStageById=Pn,i.selectAssetStageCompletionById=Rn,i.selectAssetStageCompletionMapping=Dt,i.selectAssetStageCompletionsByIds=Fn,i.selectAssetStages=qn,i.selectAssetStagesByIds=zt,i.selectAssetTypeAttachmentById=$n,i.selectAssetTypeAttachmentMapping=Vn,i.selectAssetTypeAttachments=Bt,i.selectAssetTypeById=ts,i.selectAssetTypeFieldValues=Jt,i.selectAssetTypeFieldValuesAttachmentById=lu,i.selectAssetTypeFieldValuesAttachments=oa,i.selectAssetTypeFieldValuesAttachmentsByIds=ra,i.selectAssetTypeFieldValuesAttachmentsMapping=Ht,i.selectAssetTypeFieldValuesById=Xt,i.selectAssetTypeFieldValuesMapping=ya,i.selectAssetTypeFieldValuesOfAsset=mu,i.selectAssetTypeFields=Ve,i.selectAssetTypeFieldsAttachmentById=Xl,i.selectAssetTypeFieldsAttachments=Jn,i.selectAssetTypeFieldsAttachmentsMapping=Kn,i.selectAssetTypeFieldsById=nu,i.selectAssetTypeFieldsMapping=sa,i.selectAssetTypeFieldsOfAssetType=su,i.selectAssetTypeStagesMapping=Vl,i.selectAssetTypeValuesOfAssetType=fu,i.selectAssetTypes=Tu,i.selectAssetTypesByIds=bu,i.selectAssetTypesMapping=es,i.selectAssets=gn,i.selectAssetsByIds=kl,i.selectAssetsMapping=Ot,i.selectAssetsOfAssetType=vt,i.selectAttachmentsOfAsset=mn,i.selectAttachmentsOfAssetByType=El,i.selectAttachmentsOfAssetType=Bn,i.selectAttachmentsOfAssetTypeByType=Ll,i.selectAttachmentsOfAssetTypeFieldValues=da,i.selectAttachmentsOfAssetTypeFields=Jl,i.selectAttachmentsOfDocument=qu,i.selectAttachmentsOfDocumentByType=ku,i.selectAttachmentsOfFormRevision=Hu,i.selectAttachmentsOfFormSubmission=wc,i.selectAttachmentsOfIssue=oo,i.selectAttachmentsOfIssueByType=yh,i.selectAttachmentsOfIssueTypeFieldValues=Wo,i.selectAttachmentsOfIssueTypeFields=Oh,i.selectAttachmentsOfProject=od,i.selectAttachmentsOfProjectByType=Fm,i.selectCategories=Ou,i.selectCategoriesByIds=vu,i.selectCategoryById=as,i.selectCategoryMapping=ns,i.selectCommentsOfIssue=Sh,i.selectCompletedStagesByAsset=Cl,i.selectConversation=Fl,i.selectConversationMapping=yt,i.selectConversations=Rl,i.selectCurrentUser=st,i.selectDeletedRequests=Tm,i.selectDocumentAttachmentById=za,i.selectDocumentAttachmentMapping=Ma,i.selectDocumentById=Na,i.selectDocuments=La,i.selectDocumentsByIds=Du,i.selectDocumentsMapping=pe,i.selectEmailDomains=Xa,i.selectEmailDomainsAsMapping=Ja,i.selectEmailDomainsOfOrganization=Uu,i.selectFilteredForms=xu,i.selectFormById=Ic,i.selectFormMapping=_c,i.selectFormRevisionAttachmentsMapping=rc,i.selectFormRevisionById=Yu,i.selectFormRevisionMapping=Ne,i.selectFormRevisions=pc,i.selectFormRevisionsOfForm=Ac,i.selectFormSubmissionAttachemntsByIds=vc,i.selectFormSubmissionAttachmentsMapping=Ts,i.selectFormSubmissionById=Os,i.selectFormSubmissions=Fs,i.selectFormSubmissionsMapping=Rs,i.selectFormSubmissionsOfAsset=Cc,i.selectFormSubmissionsOfForm=kc,i.selectFormSubmissionsOfIssue=Dc,i.selectForms=Qu,i.selectGeoImageById=Es,i.selectGeoImageMapping=Nc,i.selectGeoImages=Hc,i.selectGeoImagesOfProject=rh,i.selectIsImportingProjectFile=km,i.selectIsLoggedIn=Fu,i.selectIssueAssociationById=Xc,i.selectIssueAssociationMapping=we,i.selectIssueAssociations=hh,i.selectIssueAssociationsOfAsset=xc,i.selectIssueAssociationsOfIssue=Qc,i.selectIssueAssociationsToIssue=Zc,i.selectIssueAttachmentById=ro,i.selectIssueAttachmentMapping=co,i.selectIssueAttachments=Us,i.selectIssueById=Ws,i.selectIssueCommentById=fo,i.selectIssueCommentMapping=mo,i.selectIssueCountOfCategory=wu,i.selectIssueMapping=To,i.selectIssueTypeById=ni,i.selectIssueTypeFieldValues=Zs,i.selectIssueTypeFieldValuesAttachmentById=Kh,i.selectIssueTypeFieldValuesAttachments=No,i.selectIssueTypeFieldValuesAttachmentsByIds=Ho,i.selectIssueTypeFieldValuesAttachmentsMapping=ti,i.selectIssueTypeFieldValuesById=Qs,i.selectIssueTypeFieldValuesMapping=qo,i.selectIssueTypeFieldValuesOfIssue=kh,i.selectIssueTypeFields=Ze,i.selectIssueTypeFieldsAttachmentById=vh,i.selectIssueTypeFieldsAttachments=wo,i.selectIssueTypeFieldsAttachmentsMapping=vo,i.selectIssueTypeFieldsById=Gh,i.selectIssueTypeFieldsMapping=Vo,i.selectIssueTypeFieldsOfIssueType=Vh,i.selectIssueTypeMapping=Qo,i.selectIssueTypeValuesOfIssueType=Bh,i.selectIssueTypes=xo,i.selectIssueTypesByIds=Jh,i.selectIssueTypesOfOrganization=Xh,i.selectIssueUpdateMapping=or,i.selectIssueUpdatesOfIssue=rr,i.selectIssuesByIds=Th,i.selectIssuesOfIssueType=ai,i.selectIssuesOfIssueTypeCount=Zh,i.selectLatestAssetTypeFieldsOfAssetType=iu,i.selectLatestFormRevisionOfForm=Ku,i.selectLatestIssueTypeFieldsOfIssueType=$h,i.selectLatestRetryTime=bm,i.selectLicense=em,i.selectLicenseForProject=hr,i.selectLicenses=tt,i.selectLicensesForProjectsMapping=sm,i.selectLicensesOfOrganization=gm,i.selectNumberOfAssetsOfAssetType=Dl,i.selectOrganizationAccessById=rm,i.selectOrganizationAccessForUser=lm,i.selectOrganizationAccessUserMapping=_r,i.selectOrganizationAccesses=li,i.selectOrganizationById=pm,i.selectOrganizationUsersAsMapping=Nr,i.selectOrganizationUsersIds=Lr,i.selectOrganizations=Gr,i.selectOrganizationsMapping=Br,i.selectOrganizationsWithAccess=ym,i.selectProjectAccessById=um,i.selectProjectAccessForUser=hm,i.selectProjectAccessMapping=mi,i.selectProjectAccessUserMapping=Er,i.selectProjectAccesses=wr,i.selectProjectAttachmentById=cd,i.selectProjectAttachmentMapping=ad,i.selectProjectById=mm,i.selectProjectFileById=Pm,i.selectProjectFileMapping=Ad,i.selectProjectFiles=gd,i.selectProjectMapping=pi,i.selectProjectUsersAsMapping=Ur,i.selectProjectUsersIds=zr,i.selectProjectsOfOrganization=Am,i.selectRehydrated=Mm,i.selectRootDocuments=Mu,i.selectSortedOrganizationUsers=Sm,i.selectSortedProjectUsers=fm,i.selectStageMapping=Ue,i.selectStagesOfAssetType=kn,i.selectTeamById=Se,i.selectTeams=wi,i.selectTeamsByIds=zm,i.selectTeamsMapping=vi,i.selectTeamsOfOrganization=Um,i.selectTeamsOfUser=Vm,i.selectUploadUrl=tc,i.selectUserById=cm,i.selectUsersByIds=om,i.selectUsersMapping=it,i.separateFilesFromValues=Di,i.separateImageFromFields=Df,i.setActiveProjectFileId=pd,i.setAsset=Pl,i.setAssetAttachment=rn,i.setAssetAttachments=vl,i.setAssetStage=En,i.setAssetStages=Ml,i.setAssetType=pu,i.setAssetTypeAttachment=Mn,i.setAssetTypeAttachments=Bl,i.setAssetTypeFieldValues=uu,i.setAssetTypeFieldValuesAttachment=cu,i.setAssetTypeFieldValuesAttachments=ou,i.setAssetTypeFieldValuesMany=hu,i.setAssetTypeFields=Ql,i.setAssetTypeFieldsAttachment=Hl,i.setAssetTypeFieldsAttachments=Wl,i.setAssetTypeFieldsMany=xl,i.setAssetTypes=yu,i.setAssets=ql,i.setConversation=nn,i.setCurrentUser=im,i.setDocumentAttachment=qa,i.setDocumentAttachments=ju,i.setDocuments=$a,i.setForm=Ju,i.setFormRevision=uc,i.setFormRevisionAttachment=Bu,i.setFormRevisionAttachments=Gu,i.setFormSubmission=Ye,i.setFormSubmissionAttachment=th,i.setFormSubmissionAttachments=sh,i.setFormSubmissions=ah,i.setGeoImage=ve,i.setGeoImages=Vc,i.setIsImportingProjectFile=fd,i.setIssueAssociation=lh,i.setIssueAssociations=dh,i.setIssueAttachment=io,i.setIssueAttachments=fh,i.setIssueComment=$s,i.setIssueComments=ho,i.setIssueType=je,i.setIssueTypeFieldValues=Eh,i.setIssueTypeFieldValuesAttachment=Nh,i.setIssueTypeFieldValuesAttachments=Hh,i.setIssueTypeFieldValuesMany=jh,i.setIssueTypeFields=Ch,i.setIssueTypeFieldsAttachment=_h,i.setIssueTypeFieldsAttachments=Ih,i.setIssueTypeFieldsMany=Mh,i.setIssueUpdate=Qh,i.setLoggedIn=_a,i.setOrganizations=$r,i.setProfilePicture=nm,i.setProjectAttachment=td,i.setProjectAttachments=sd,i.setProjectFile=Om,i.setProjectFiles=vm,i.setProjects=qr,i.setRehydrated=Cm,i.setTeam=ge,i.setTokens=_u,i.setUploadUrl=ec,i.setUsers=pr,i.shallowEqual=Yi,i.slugify=Tl,i.spacesToDashesLower=Sl,i.teamReducer=Rd,i.teamSlice=Ri,i.toFileNameSafeString=gl,i.toOfflineIdRecord=Qi,i.truncate=bl,i.updateAsset=Ie,i.updateAssetAttachment=wl,i.updateAssetAttachments=dn,i.updateAssetStage=Mt,i.updateAssetStageCompletion=_n,i.updateAssetStageCompletions=In,i.updateAssetStages=Me,i.updateAssetType=Fe,i.updateAssetTypeAttachment=Gl,i.updateAssetTypeAttachments=zn,i.updateAssetTypeFieldValues=Re,i.updateAssetTypeFieldValuesAttachment=ru,i.updateAssetTypeFieldValuesAttachments=ca,i.updateAssetTypeFieldValuesMany=fa,i.updateAssetTypeFields=ea,i.updateAssetTypeFieldsAttachment=Yl,i.updateAssetTypeFieldsAttachments=Wn,i.updateAssetTypeFieldsMany=eu,i.updateAssetTypes=gu,i.updateAssets=jl,i.updateCategory=Oa,i.updateConversation=an,i.updateDocumentAttachment=Pu,i.updateDocumentAttachments=ka,i.updateDocuments=ne,i.updateForm=Zu,i.updateFormRevisionAttachment=Lu,i.updateFormRevisionAttachments=cc,i.updateFormSubmission=qc,i.updateFormSubmissionAttachment=ih,i.updateFormSubmissionAttachments=Oc,i.updateFormSubmissions=ch,i.updateGeoImage=Gc,i.updateGeoImages=oh,i.updateIssue=Xe,i.updateIssueAssociation=Jc,i.updateIssueAssociations=uh,i.updateIssueAttachment=ph,i.updateIssueAttachments=no,i.updateIssueType=Zo,i.updateIssueTypeFieldValues=Ee,i.updateIssueTypeFieldValuesAttachment=Wh,i.updateIssueTypeFieldValuesAttachments=Lo,i.updateIssueTypeFieldValuesMany=Ph,i.updateIssueTypeFields=zo,i.updateIssueTypeFieldsAttachment=Rh,i.updateIssueTypeFieldsAttachments=Fo,i.updateIssueTypeFieldsMany=zh,i.updateLicense=te,i.updateOrganizationAccess=Tr,i.updateProject=kr,i.updateProjectAccess=Fr,i.updateProjectAttachment=Rm,i.updateProjectAttachments=id,i.updateProjectFile=_i,i.updateProjectFiles=Em,i.updateTeam=Fi,i.userReducer=Ar,i.userSlice=ri,i.versioningReducer=Od,i.versioningSlice=Fd,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
|
|
15
|
+
external URLs and therefore not prepended with VITE_API_URL.`;throw new Error(y)}const f=r.type.split("/")[1];if(!f)throw new Error("File has no extension");const p=a??h+"."+f;if(r=Ji(r,p),!r.name)throw new Error("Failed to set file's name");await this.addCache(r,h),at[c]=new Promise(y=>{y(r)})}return r}}class qf extends P{async bulkAdd(e){var m;const s=new Date().toISOString(),n=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,a={},c=[],o=[];for(const r of e){const{revisionId:h,fieldIdentifier:f,file:p}=r,y=await this.getFilePayload(p);y.sha1 in a||(a[y.sha1]=y);const T=R({file:URL.createObjectURL(p),file_type:p.type,file_name:p.name,file_sha1:y.sha1,created_by:n,form_revision:h,submitted_at:s,field_identifier:f});c.push(T);const _={offline_id:T.offline_id,file_name:p.name,field_identifier:f,file_extension:y.extension,file_sha1:y.sha1,form_revision:h};o.push(_)}this.dispatch(ac(c));const d=this.enqueueRequest({description:"Attach files to form revision",method:l.POST,url:"/form-revision-attachments/bulk/",payload:{submitted_at:s,attachments:o,files:Object.values(a)},blockers:c.map(r=>r.form_revision),blocks:c.map(r=>r.offline_id)});return d.then(r=>{this.processPresignedUrls(r.presigned_urls),this.dispatch(cc(r.attachments))}).catch(()=>{this.dispatch(oc(c.map(r=>r.offline_id)))}),[c,d.then(({attachments:r})=>r)]}async refreshStore(e){const s=await this.enqueueRequest({description:"Fetch organization form revision attachments",method:l.GET,url:"/form-revision-attachments/",queryParams:{organization:e.toString()},blockers:[e.toString()],blocks:[]});this.dispatch(nc(s))}}class kf extends P{add(e){var d;const{store:s}=this.client,a=(d=s.getState().userReducer.currentUser)==null?void 0:d.id,c=R({...e,created_by:a,revision:"Pending",submitted_at:new Date().toISOString()});this.dispatch(fs(c));const o=this.enqueueRequest({description:"Create form revision",method:l.POST,url:"/form-revisions/",payload:c,blockers:[e.form],blocks:[c.offline_id]});return o.then(m=>{this.dispatch(uc(m))}).catch(()=>{this.dispatch(ps(c.offline_id))}),[c,o]}async refreshStore(e){const s=await this.enqueueRequest({description:"Get organization form revisions",method:l.GET,url:"/form-revisions/",queryParams:{organization:e.toString()},blockers:[e.toString()],blocks:[]});this.dispatch(hc(s))}}const Df=async t=>{const e={},s=[];for(const n of t){if(n.type!=="section")throw new Error(`Expected ISerializedField type to be a section. Got ${n.type} instead.`);const{fields:a}=n,c=[];for(const o of a){if(o.image){if(o.image instanceof Promise)try{e[o.identifier]=await o.image}catch(d){console.error("Failed to get image from promise",d)}else e[o.identifier]=o.image;delete o.image}c.push(o)}s.push({...n,fields:c})}return{fields:s,images:e}};class Cf extends P{add(e,s){var r;const{store:n}=this.client,a=new Date().toISOString(),c=(r=n.getState().userReducer.currentUser)==null?void 0:r.id,o=R({...e,submitted_at:a,created_by:c}),d=R({...s,form:o.offline_id,revision:"Pending",submitted_at:a,created_by:c});this.dispatch(As(o)),this.dispatch(fs(d));const m=this.enqueueRequest({description:"Create form",method:l.POST,url:"/forms/",payload:{...o,initial_revision:{offline_id:d.offline_id,submitted_at:d.submitted_at,title:d.title,description:d.description,fields:d.fields}},blockers:[],blocks:[o.offline_id,d.offline_id]});return m.catch(h=>{throw this.dispatch(gs(o.offline_id)),this.dispatch(ps(d.offline_id)),h}),[o,d,m]}async delete(e){const{store:s}=this.client,n=s.getState(),a=Ic(e)(n);if(!a)throw new Error("Expected form to exist");const c=kc(e)(n);c.length>0&&this.dispatch(Je(c.map(({offline_id:d})=>d)));const o=Ac(e)(n);o.length>0&&this.dispatch(fc(o.map(({offline_id:d})=>d))),this.dispatch(gs(e));try{return await this.enqueueRequest({description:"Delete form",method:l.DELETE,url:`/forms/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(As(a)),o.length>0&&this.dispatch(mc(o)),c.length>0&&this.dispatch(Ke(c)),d}}async refreshStore(e){const s=await this.enqueueRequest({description:"Fetch organization forms",method:l.GET,url:"/forms/",queryParams:{organization:e.toString()},blockers:[e.toString()],blocks:[]});this.dispatch(Tc(s))}}class Mf extends P{async bulkAdd(e){var m;const s=new Date().toISOString(),n=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,a={},c=[],o=[];for(const r of e){const{submissionId:h,fieldIdentifier:f,file:p}=r,y=await this.getFilePayload(p);y.sha1 in a||(a[y.sha1]=y);const T=R({file:URL.createObjectURL(p),file_type:p.type,file_name:p.name,file_sha1:y.sha1,created_by:n,form_submission:h,submitted_at:s,field_identifier:f});c.push(T);const _={offline_id:T.offline_id,file_name:p.name,file_sha1:y.sha1,file_extension:y.extension,field_identifier:f,form_submission:h};o.push(_)}this.dispatch(He(c));const d=this.enqueueRequest({description:"Attach files to form submission",method:l.POST,url:"/form-submission-attachments/bulk/",payload:{submitted_at:s,attachments:o,files:Object.values(a)},blockers:c.map(r=>r.form_submission),blocks:c.map(r=>r.offline_id)});return d.then(r=>{this.processPresignedUrls(r.presigned_urls),this.dispatch(Oc(r.attachments))}).catch(r=>{throw this.dispatch(We(c.map(h=>h.offline_id))),r}),[c,d.then(({attachments:r})=>r)]}async bulkDelete(e){const{store:s}=this.client,n=s.getState(),a=vc(e)(n);this.dispatch(We(e));try{await this.enqueueRequest({description:"Delete form submission attachments",method:l.DELETE,url:"/form-submission-attachments/bulk/",payload:{attachment_ids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(He(a)),c}}async refreshStore(e){const s=await this.enqueueRequest({description:"Get form submission attachments",method:l.GET,url:"/form-submission-attachments/",queryParams:{project:e.toString()},blockers:[],blocks:[]});this.dispatch(Fc(s))}}class zf extends P{async add(e){var f;const{store:s}=this.client,{file:n,...a}=e,c=new Date().toISOString(),o=(f=s.getState().userReducer.currentUser)==null?void 0:f.id,d=a.project,m=await this.getFilePayload(n),r=R({...a,file_name:n.name,file_sha1:m.sha1,file:URL.createObjectURL(n),submitted_at:c,created_by:o});this.dispatch($c(r));const h=this.enqueueRequest({description:"Add geo image",method:l.POST,url:"/geo-images/",payload:{offline_id:r.offline_id,submitted_at:c,title:r.title,description:r.description,geo_marker:r.geo_marker,canvas_marker:r.canvas_marker,sha1:r.file_sha1,project:r.project,file_name:r.file_name,direction:r.direction,original_date:r.original_date,file:m},blocks:[d.toString()],blockers:[d.toString()]});return h.then(p=>{this.processPresignedUrls(p.presigned_urls),this.dispatch(ve(p.geo_image))}).catch(()=>{this.dispatch(ws(r.offline_id))}),[r,h.then(p=>p.geo_image)]}async bulkAdd(e,s){var f;const{store:n}=this.client,a=new Date().toISOString(),c=(f=n.getState().userReducer.currentUser)==null?void 0:f.id,o=[],d=[],m=[],r={};for(const p of e){const{file:y,...T}=p,_=await this.getFilePayload(y);_.sha1 in r||(r[_.sha1]=_);const b=R({...T,file_name:y.name,file_sha1:_.sha1,file:URL.createObjectURL(y),submitted_at:a,created_by:c,project:s});o.push(b),d.push(b.offline_id),m.push({offline_id:b.offline_id,sha1:b.file_sha1,file_name:b.file_name,title:b.title,description:b.description,geo_marker:b.geo_marker,canvas_marker:b.canvas_marker,direction:b.direction,original_date:b.original_date})}this.dispatch(Bc(o));const h=this.enqueueRequest({description:"Bulk add geo images",method:l.POST,url:"/geo-images/bulk/",payload:{submitted_at:a,project:s,geo_images:m,files:Object.values(r)},blocks:[s.toString()],blockers:d});return h.then(p=>{this.processPresignedUrls(p.presigned_urls),this.dispatch(Vc(p.geo_images))}).catch(()=>{this.dispatch(Lc(d))}),[o,h.then(p=>p.geo_images)]}update(e){const{store:s}=this.client,n=s.getState(),a=Es(e.offline_id)(n);if(!a)throw new Error(`Map image with offline_id ${e.offline_id} does not exist in the store`);const c={...a,...e};this.dispatch(Gc(c));const o=this.enqueueRequest({description:"Update geo image",method:l.PATCH,url:`/geo-images/${e.offline_id}/`,payload:e,blocks:[e.offline_id],blockers:[e.offline_id]});return o.then(d=>{this.dispatch(ve(d))}).catch(()=>{this.dispatch(ve(a))}),[c,o]}async delete(e){const{store:s}=this.client,n=s.getState(),a=Es(e)(n);if(!a)throw new Error(`Map image with offline_id ${e} does not exist in the store`);this.dispatch(ws(e));const c=this.enqueueRequest({description:"Delete geo image",method:l.DELETE,url:`/geo-images/${e}/`,blocks:[e],blockers:[e]});return c.catch(()=>{this.dispatch(ve(a))}),c}async refreshStore(e){const s=await this.enqueueRequest({description:"Get geo images",method:l.GET,url:`/projects/${e}/geo-images/`,blocks:[e.toString()],blockers:[]});this.dispatch(Uc(s))}}class Uf extends F{add(e){var d;const{store:s}=this.client,n=new Date().toISOString(),a=(d=s.getState().userReducer.currentUser)==null?void 0:d.id,c=R({...e,submitted_at:n,created_by:a});this.dispatch(Ps(c));const o=this.enqueueRequest({description:"Add issue association",method:l.POST,url:"/issue-associations/",payload:{offline_id:c.offline_id,submitted_at:n,...e},blockers:[e.associated_issue,...e.issue?[e.issue]:[],...e.asset?[e.asset]:[]],blocks:[c.offline_id]});return o.then(m=>{this.dispatch(Jc(m))}).catch(()=>{this.dispatch(ks(c.offline_id))}),[c,o]}async delete(e){const{store:s}=this.client,n=Xc(e)(s.getState());if(!n)throw new Error(`Issue association with id ${e} not found in store.`);this.dispatch(ks(e));const a=this.enqueueRequest({description:"Delete issue association",method:l.DELETE,url:`/issue-associations/${e}/`,blockers:[e],blocks:[]});return a.catch(()=>{this.dispatch(Ps(n))}),a}async refreshStore(e){const s=await this.enqueueRequest({description:"Fetch issue associations",method:l.GET,url:"/issue-associations/",queryParams:{project:e.toString()},blockers:[],blocks:[]});this.dispatch(Kc(s))}}class Vf extends ke{constructor(){super(...arguments);A(this,"name","Issue Attachment");A(this,"url","/issue-attachments");A(this,"addAttachments",Ms);A(this,"updateAttachments",no);A(this,"removeAttachments",zs);A(this,"removeAttachment",ao);A(this,"setAttachment",io);A(this,"selectAttachment",ro)}buildOfflineAttachment(s){return R({file:URL.createObjectURL(s.file),file_sha1:s.file_sha1,created_by:s.created_by,file_name:s.file.name,file_type:s.file.type,submitted_at:s.submitted_at,description:s.description,issue:s.modelId})}buildAttachmentPayload(s){return{...s,issue:s.modelId}}async bulkAdd(s){return this._bulkAdd(s.map(n=>({modelId:n.issueId,file:n.file})))}async delete(s){return this._delete(s)}async refreshStore(s){const n=await this.enqueueRequest({description:"Get issue attachments",method:l.GET,url:`${this.url}/`,queryParams:{project:s.toString()},blocks:[],blockers:[]});this.dispatch(so(n))}}class $f extends F{add(e){var c;const{store:s}=this.client,n=R({...e,author:(c=s.getState().userReducer.currentUser)==null?void 0:c.id,submitted_at:new Date().toISOString()});this.dispatch(Bs(n));const a=this.enqueueRequest({description:"Add issue comment",method:l.POST,url:"/issue-comments/",payload:n,blockers:[e.issue],blocks:[n.offline_id]});return a.catch(()=>{this.dispatch(Gs(n.offline_id))}),[n,a]}update(e){const{store:s}=this.client,n=fo(e.offline_id)(s.getState());if(!n)throw new Error(`Comment with offline_id ${e.offline_id} not found in store`);const a={...n,...e};this.dispatch($s(a));const c=this.enqueueRequest({description:"Edit issue comment",method:l.PATCH,url:`/issue-comments/${e.offline_id}/`,payload:e,blockers:[e.offline_id],blocks:[e.offline_id]});return c.catch(()=>{this.dispatch($s(n))}),[a,c]}remove(e){const s=this.client.store.getState().issueCommentReducer.instances[e];if(!s)throw new Error(`Comment with offline_id ${e} not found in store`);this.dispatch(Gs(e));const n=this.enqueueRequest({description:"Delete comment",method:l.DELETE,url:`/issue-comments/${e}/`,blockers:[e],blocks:[]});return n.catch(()=>{this.dispatch(Bs(s))}),n}async refreshStore(e){const s=await this.enqueueRequest({description:"Get comments",method:l.GET,url:"/issue-comments/",queryParams:{project:e.toString()},blockers:[],blocks:[]});this.dispatch(ho(s))}}class Bf extends F{add(e){var m;const{store:s}=this.client,n=s.getState(),a=new Date().toISOString(),c=(m=n.userReducer.currentUser)==null?void 0:m.id,o=R({...e,submitted_at:a,created_by:c});this.dispatch(Ns(o));const d=this.enqueueRequest({description:"Create issue",method:l.POST,url:"/issues/",payload:o,blockers:["add-issue",o.project.toString(),o.issue_type,...o.category?[o.category]:[]],blocks:[o.offline_id]});return d.then(r=>{this.dispatch(Xe(r))}).catch(r=>{throw this.dispatch(Hs(o.offline_id)),r}),[o,d]}update(e){var m;const s=this.client.store.getState(),n=Ws(e.offline_id)(s);if(!n)throw new Error(`Attempting to update an issue with offline_id ${e.offline_id} that doesn't exist in the store`);const a={...n,...e};this.dispatch(Xe(a));const c={};for(const r of[v.TITLE,v.DESCRIPTION,v.STATUS,v.CATEGORY,v.PRIORITY,v.ASSIGNED_TO,v.DUE_DATE])if(r in e&&e[r]!==n[r])switch(r){case v.PRIORITY:case v.STATUS:{const h=e[r];c[r]=h!==void 0?Number(h):null;break}case v.DUE_DATE:case v.DESCRIPTION:case v.TITLE:c[r]=e[r]??null;break;case v.CATEGORY:{let h=null;const f=e[r];if(f&&(h=s.categoryReducer.instances[f]??null,!h))throw new Error(`Trying to update issue category to ${f} which does not exist in store`);c[r]=h?{name:h.name,color:h.color,offline_id:h.offline_id}:null;break}case v.ASSIGNED_TO:{let h=null;const f=e[r];if(f&&(h=s.userReducer.users[f]??null,!h))throw new Error(`Trying to update issue assigned_to to ${f} which does not exist in store`);c[r]=h?{full_name:h.username,id:h.id}:null;break}}const o=R({created_by:(m=s.userReducer.currentUser)==null?void 0:m.id,submitted_at:new Date().toISOString(),issue:n.offline_id,changes:c});this.dispatch(ir(o));const d=this.enqueueRequest({description:"Edit issue",method:l.PATCH,url:`/issues/${e.offline_id}/`,payload:e,blockers:[e.offline_id],blocks:[e.offline_id]});return d.catch(()=>{this.dispatch(Xe(n)),this.dispatch(ar(o.offline_id))}),[a,d]}async remove(e){const{store:s}=this.client,n=s.getState(),a=Ws(e)(n);if(!a)throw new Error(`No issue with id ${e} found in the store`);const c=oo(e)(n),o=rr(e)(n),d=Dc(e)(n),m={};for(const h of Zc(e)(n))m[h.offline_id]=h;for(const h of Qc(e)(n))m[h.offline_id]=h;const r=Object.values(m);this.dispatch(Hs(e)),c.length>0&&this.dispatch(zs(c.map(({offline_id:h})=>h))),o.length>0&&this.dispatch(cr(o.map(({offline_id:h})=>h))),d.length>0&&this.dispatch(Je(d.map(({offline_id:h})=>h))),r.length>0&&this.dispatch(Ds(r.map(({offline_id:h})=>h)));try{return await this.enqueueRequest({description:"Delete issue",method:l.DELETE,url:`/issues/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(Ns(a)),this.dispatch(Ms(c)),this.dispatch(nr(o)),this.dispatch(Ke(d)),this.dispatch(qs(r)),h}}async refreshStore(e){const s=await this.enqueueRequest({description:"Get issues",method:l.GET,url:"/issues/",queryParams:{project:e.toString()},blockers:[],blocks:[]});this.dispatch(Ao(s))}}class Gf extends P{async bulkAdd(e){var m;const s=new Date().toISOString(),n=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,a={},c=[],o=[];for(const r of e){const{fieldsRevisionId:h,fieldIdentifier:f,file:p}=r,y=await this.getFilePayload(p);y.sha1 in a||(a[y.sha1]=y);const T=R({file:URL.createObjectURL(p),file_type:p.type,file_name:p.name,file_sha1:y.sha1,created_by:n,fields_revision:h,submitted_at:s,field_identifier:f});c.push(T);const _={offline_id:T.offline_id,file_name:p.name,file_extension:y.extension,field_identifier:f,file_sha1:y.sha1,fields_revision:h};o.push(_)}this.dispatch(Ro(c));const d=this.enqueueRequest({description:"Add issue type fields attachments",method:l.POST,url:"/issue-type-fields-attachments/bulk/",payload:{submitted_at:s,attachments:o,files:Object.values(a)},blockers:c.map(r=>r.fields_revision),blocks:c.map(r=>r.offline_id)});return d.then(r=>{this.processPresignedUrls(r.presigned_urls),this.dispatch(Fo(r.attachments))}).catch(()=>{this.dispatch(Oo(c.map(r=>r.offline_id)))}),[c,d.then(({attachments:r})=>r)]}async refreshStore(e){const s=await this.enqueueRequest({description:"get issue type fields attachments",method:l.GET,url:"/issue-type-fields-attachments/",queryParams:{organization:e.toString()},blockers:[e.toString()],blocks:[]});this.dispatch(Io(s))}}class Lf extends F{add(e){var d;const{store:s}=this.client,n=(d=s.getState().userReducer.currentUser)==null?void 0:d.id,a=new Date().toISOString(),c=R({...e,created_by:n,submitted_at:a});this.dispatch(Mo(c));const o=this.enqueueRequest({description:"Add Issue Type Fields",method:l.POST,url:"/issue-type-fields/",payload:c,blockers:[c.issue_type],blocks:[c.offline_id]});return o.then(m=>{this.dispatch(zo(m))}).catch(m=>{throw this.dispatch(Uo(c.offline_id)),m}),[c,o]}async refreshStore(e){const s=await this.enqueueRequest({description:"Get Issue Type Fields",method:l.GET,url:"/issue-type-fields/",queryParams:{organization:e.toString()},blockers:[],blocks:[]});this.dispatch(Co(s))}}class Nf extends P{async bulkAdd(e){var m;const s=new Date().toISOString(),n=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,a={},c=[],o=[];for(const r of e){const{fieldValuesId:h,fieldIdentifier:f,file:p}=r,y=await this.getFilePayload(p);y.sha1 in a||(a[y.sha1]=y);const T=R({file:URL.createObjectURL(p),file_type:p.type,file_name:p.name,file_sha1:y.sha1,created_by:n,field_values:h,submitted_at:s,field_identifier:f});c.push(T);const _={offline_id:T.offline_id,file_name:p.name,file_sha1:y.sha1,file_extension:y.extension,field_identifier:f,field_values:h};o.push(_)}this.dispatch(Qe(c));const d=this.enqueueRequest({description:"Add issue type field values attachments",method:l.POST,url:"/issue-type-field-values-attachments/bulk/",payload:{submitted_at:s,attachments:o,files:Object.values(a)},blockers:c.map(r=>r.field_values),blocks:c.map(r=>r.offline_id)});return d.then(({presigned_urls:r,attachments:h})=>{this.processPresignedUrls(r),this.dispatch(Lo(h))}).catch(r=>{throw this.dispatch(xe(c.map(h=>h.offline_id))),r}),[c,d.then(({attachments:r})=>r)]}async bulkDelete(e){const{store:s}=this.client,n=s.getState(),a=Ho(e)(n);this.dispatch(xe(e));try{await this.enqueueRequest({description:"Delete issue type field values attachments",method:l.DELETE,url:"/issue-type-field-values-attachments/bulk/",payload:{attachment_ids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(Qe(a)),c}}async refreshStore(e){const s=await this.enqueueRequest({description:"Get issue type field values attachments",method:l.GET,url:"/issue-type-field-values-attachments/",queryParams:{project:e.toString()},blockers:[],blocks:[]});this.dispatch(Go(s))}}class Hf extends F{add(e){var o;const{store:s}=this.client,n=s.getState(),a=R({...e,created_by:(o=n.userReducer.currentUser)==null?void 0:o.id,submitted_at:new Date().toISOString()}),c=this.enqueueRequest({description:"Add issue type field values",method:l.POST,url:"/issue-type-field-values/",payload:a,blockers:[e.issue,e.fields_revision],blocks:[a.offline_id]});return this.dispatch(Js(a)),c.then(d=>(this.dispatch(Ee(d)),d)).catch(()=>{this.dispatch(Xs(a.offline_id))}),[a,c]}update(e){const{store:s}=this.client,n=s.getState(),a=Qs(e.offline_id)(n);if(!a)throw new Error(`Expected IssueTypeFieldValues with offline_id ${e.offline_id} to exist`);const c={...a,...e};this.dispatch(Ee(c));const o=this.enqueueRequest({description:"Update issue type field values",method:l.PATCH,url:`/issue-type-field-values/${e.offline_id}/`,payload:e,blockers:[c.offline_id,c.fields_revision,c.issue],blocks:[c.offline_id]});return o.then(d=>{this.dispatch(Ee(d))}).catch(()=>{this.dispatch(Ee(a))}),[c,o]}async delete(e){const{store:s}=this.client,n=s.getState(),a=Qs(e)(n);if(!a)throw new Error(`Expected submission with offline_id ${e} to exist`);const c=Wo(e)(n);this.dispatch(Xs(e)),this.dispatch(xe(c.map(o=>o.offline_id)));try{await this.enqueueRequest({description:"Delete issue type field values",method:l.DELETE,url:`/issue-type-field-values/${e}/`,blockers:[e],blocks:[]})}catch(o){throw this.dispatch(Js(a)),this.dispatch(Qe(c)),o}}async refreshStore(e){const s=await this.enqueueRequest({description:"Get issue type field values",method:l.GET,url:"/issue-type-field-values/",queryParams:{project:e.toString()},blockers:[],blocks:[]});this.dispatch(Po(s))}}class Wf extends F{add(e){var o;const{store:s}=this.client,n=s.getState(),a=R({...e,submitted_at:new Date().toISOString(),created_by:(o=n.userReducer.currentUser)==null?void 0:o.id});this.dispatch(Xo(a));const c=this.enqueueRequest({method:l.POST,url:"/issue-types/",payload:a,blockers:[],blocks:[a.offline_id]});return c.then(d=>{this.dispatch(je(d))}).catch(()=>{this.dispatch(ii(a.offline_id))}),[a,c]}update(e){const{store:s}=this.client,n=s.getState(),a=ni(e.offline_id)(n);if(!a)throw new Error(`IssueType with offline_id ${e.offline_id} does not exist in the store.`);const c={...a,...e};this.dispatch(Zo(c));const o=this.enqueueRequest({method:l.PATCH,url:`/issue-types/${e.offline_id}/`,payload:e,blockers:[e.offline_id],blocks:[e.offline_id]});return o.then(d=>{this.dispatch(je(d))}).catch(()=>{this.dispatch(je(a))}),[c,o]}delete(e){const{store:s}=this.client,n=s.getState(),a=ni(e)(n);if(!a)throw new Error(`IssueType with offline_id ${e} does not exist in the store.`);const c=ai(e)(n);this.dispatch(ii(e)),this.dispatch(So(c.map(d=>d.offline_id)));const o=this.enqueueRequest({method:l.DELETE,url:`/issue-types/${e}/`,blockers:[e],blocks:[]});return o.catch(()=>{this.dispatch(je(a)),this.dispatch(go(c))}),o}async refreshStore(e){const s=await this.enqueueRequest({method:l.GET,url:"/issue-types/",queryParams:{organization:e.toString()},blockers:[],blocks:[]});this.dispatch(Jo(s))}}class Yf extends F{async refreshStore(e){const s=await this.enqueueRequest({description:"Get issue updates",method:l.GET,url:"/issue-updates/",queryParams:{project:e.toString()},blockers:[],blocks:[]});this.dispatch(sr(s))}}class Kf extends jd{constructor(e){super(e)}}const Jf=1800;function Xf(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 Zf extends Kf{constructor(){super(...arguments);A(this,"_getRenewedTokens",async s=>{const n=this.enqueueRequest({description:"Get renewed tokens",method:l.POST,url:this.refreshTokensUrl,payload:{refresh:s},isAuthNeeded:!1,blockers:[],blocks:[],checkAuth:!1,immediate:!0});let a;try{a=await n}catch(c){console.error("Could not renew tokens; clearing auth",c),this.clearAuth();return}if(!a.access)throw new Error("Missing access token");return{accessToken:a.access,refreshToken:a.refresh??this.getRefreshToken()}})}clearAuth(){console.debug(this.constructor.name,"clearing auth;"),this.dispatch(_a(!1)),this.clearTokens(),this.dispatch({type:xd.RESET_STATE}),this.dispatch({type:Ud})}async renewTokens(){const s=this.getRefreshToken();if(!s)throw new Error("No refresh token found");console.debug(this.constructor.name,"renewing tokens");try{const n=await this._getRenewedTokens(s);if(!n)return;console.log("Got renewed tokens"),this.setTokens(n)}catch(n){throw console.error("Could not renew tokens; clearing auth",n),this.clearAuth(),n}}tokenIsExpiringSoon(){const s=this.getAccessToken();if(!s)return!1;const n=Date.now()/1e3;let a;try{a=el(s).exp??n}catch{a=n}return a-n<Jf}getAuthHeader(){return`Bearer ${this.getAccessToken()}`}async prepareAuth(){if(this.tokenIsExpiringSoon()){console.debug(this.constructor.name,"preparing auth");try{await this.renewTokens()}catch(s){return s instanceof j&&this.clearAuth(),s instanceof Error?Promise.reject(s):Promise.reject(new Error((s??Te).toString()))}}}async handleUnauthorized(s,n){const a=this.client.store.getState();if(s.url.endsWith("/token/refresh/"))throw a.authReducer.isLoggedIn&&console.warn("No signed-in user to sign out."),this.clearAuth(),new j({message:"You have been signed out due to inactivity.",response:n,discard:!0});if(a.authReducer.isLoggedIn)await this.renewTokens();else throw console.debug("Forbidden; user is not logged in."),new j({message:"Incorrect username or password.",response:n,discard:!0})}async initAuth(s){const n=O.v4();return console.debug(this.constructor.name,"Initiating auth"),this.enqueueRequest({uuid:n,description:"Get token pair",method:l.POST,url:this.initTokensUrl,payload:s,isAuthNeeded:!1,checkAuth:!1,immediate:!0,blockers:[],blocks:[]}).then(a=>{this.setTokens(Xf(a))})}}class Qf extends F{async getLicense(e){const s=await this.enqueueRequest({description:"Get license",method:l.GET,url:`/billing/${e.offline_id}/`,isAuthNeeded:!0,blockers:[e.organization_owner?e.organization_owner.toString():""],blocks:[]});return this.dispatch(te(s)),s}async pauseLicense(e){const s=await this.enqueueRequest({description:"Pause license",method:l.DELETE,url:`/billing/${e.offline_id}/suspend/`,isAuthNeeded:!0,blockers:[e.organization_owner?e.organization_owner.toString():""],blocks:[]});return this.dispatch(te(s)),s}async resumeLicense(e){const s=await this.enqueueRequest({description:"Resume license",method:l.PATCH,url:`/billing/${e.offline_id}/suspend/`,isAuthNeeded:!0,blockers:[e.organization_owner?e.organization_owner.toString():""],blocks:[]});return this.dispatch(te(s)),s}async cancelLicense(e){const s=await this.enqueueRequest({description:"Cancel license",method:l.DELETE,url:`/billing/${e.offline_id}/`,isAuthNeeded:!0,blockers:[e.organization_owner?e.organization_owner.toString():""],blocks:[]});return this.dispatch(te(s)),s}async attachLicenseToProject(e,s){const n=await this.enqueueRequest({description:"Attach license",method:l.PATCH,url:`/billing/${e.offline_id}/project/`,isAuthNeeded:!0,payload:{project:s.id},blockers:[e.organization_owner?e.organization_owner.toString():"",s.id?s.id.toString():""],blocks:["add-issue","add-form-entry","change-access-level","add-workspace"]});return this.dispatch(te(n)),n}async detachLicenseFromProject(e){const s=await this.enqueueRequest({description:"Detach license",method:l.DELETE,url:`/billing/${e.offline_id}/project/`,isAuthNeeded:!0,blockers:[e.organization_owner?e.organization_owner.toString():""],blocks:["add-issue","add-form-entry","change-access-level","add-workspace"]});return this.dispatch(te(s)),s}async getLatestTransaction(e){return await this.enqueueRequest({description:"Get latest transaction",method:l.GET,url:`/billing/${e.offline_id}/transaction/`,isAuthNeeded:!0,blockers:[e.offline_id],blocks:[e.offline_id]})}async refreshStore(e,s){const n={},a=await this.enqueueRequest({description:"Get licenses",method:l.GET,url:`/organizations/${s}/licenses/`,isAuthNeeded:!0,blockers:[s.toString()],blocks:["add-issue","add-form-entry","change-access-level","add-workspace"]});for(const o of a)n[o.offline_id]=o;const c=await this.enqueueRequest({description:"Get licenses",method:l.GET,url:`/projects/${e}/licenses/`,isAuthNeeded:!0,blockers:[e.toString()],blocks:["add-issue","add-form-entry","change-access-level","add-workspace"]});for(const o of c)n[o.offline_id]=o;this.dispatch(ur(Object.values(n)))}}class xf extends F{async update(e){const s=this.enqueueRequest({description:"Edit organization access",method:l.PATCH,url:`/organizations/${e.organization}/access/${e.offline_id}/`,payload:e,blockers:[e.offline_id],blocks:[e.offline_id]});return s.then(()=>{this.dispatch(Tr(e))}),s}async remove(e){return this.dispatch(br(e.offline_id)),this.dispatch(yr(e.user)),this.enqueueRequest({description:"Remove organization access",method:l.DELETE,url:`/organizations/${e.organization}/access/${e.offline_id}/`,blockers:[e.offline_id],blocks:[]})}async refreshStore(e){const s=await this.enqueueRequest({description:"Get organization accesses",method:l.GET,url:`/organizations/${e}/access/`,blockers:[],blocks:[]});this.dispatch(Sr(s))}}class ep extends F{create(e){return this.enqueueRequest({description:"Create organization",method:l.POST,url:"/organizations/",payload:{name:e},blockers:[],blocks:[`add-org-${e}`,"create-org"]})}async update(e){return this.enqueueRequest({description:"Edit organization",method:l.PATCH,url:`/organizations/${e.id}/`,payload:e,blockers:[`add-org-${e.name}`,e.id.toString()],blocks:[e.id.toString()]})}async invite(e,s){return this.enqueueRequest({description:"Invite user to organization",method:l.POST,url:`/organizations/${e}/invite/${s}/`,blockers:[],blocks:[]})}async refreshStore(e,s){const n={},a=await this.enqueueRequest({description:"Get organizations",method:l.GET,url:`/projects/${e}/organizations/`,blockers:[],blocks:[]});for(const o of a)n[o.id]=o;const c=await this.enqueueRequest({description:"Get organization",method:l.GET,url:`/organizations/${s}/`,blockers:[],blocks:[]});n[c.id]=c,this.dispatch($r(Object.values(n)))}}class tp extends F{async update(e){return this.dispatch(Fr(e)),this.enqueueRequest({description:"Edit project access",method:l.PATCH,url:`/access/${e.offline_id}/`,payload:e,blockers:[e.offline_id,"change-access-level"],blocks:[e.offline_id]})}async remove(e){return this.dispatch(Or(e)),this.enqueueRequest({description:"Delete project access",method:l.DELETE,url:`/access/${e}/`,blockers:[e],blocks:[]})}async refreshStore(e){const s=await this.enqueueRequest({description:"Get project accesses",method:l.GET,url:`/projects/${e}/access/`,blockers:[],blocks:[]});this.dispatch(hi(s))}}class sp extends ke{constructor(){super(...arguments);A(this,"name","Project Attachment");A(this,"url","/project-attachments");A(this,"addAttachments",ed);A(this,"updateAttachments",id);A(this,"removeAttachments",Si);A(this,"removeAttachment",nd);A(this,"setAttachment",td);A(this,"selectAttachment",cd)}buildOfflineAttachment(s){return R({file:URL.createObjectURL(s.file),file_sha1:s.file_sha1,created_by:s.created_by,file_name:s.file.name,file_type:s.file.type,submitted_at:s.submitted_at,description:s.description,project:s.modelId})}buildAttachmentPayload(s){return{...s,project:s.modelId}}async bulkAdd(s){return this._bulkAdd(s.map(n=>({modelId:n.projectId,file:n.file})))}async delete(s){return this._delete(s)}async refreshStore(s){const n=await this.enqueueRequest({description:"Get project attachments",method:l.GET,url:`${this.url}/`,queryParams:{project:s.toString()},blockers:[],blocks:[]});this.dispatch(xr(n))}}class ip extends F{async saveExisting(e){if(!e.offline_id)throw new Error("You can only use this method to save existing project files. The one provided has no offline_id.");const s={...e};delete s.file;const n=this.enqueueRequest({method:l.PATCH,url:`/projects/files/${e.offline_id}/`,payload:s,blockers:[e.offline_id],blocks:[e.offline_id]});return n.then(a=>{this.dispatch(_i(a))}),n}saveActive(){const{store:e}=this.client,s=e.getState(),n=s.projectFileReducer.activeProjectFileId;if(!n)throw new Error("No active project file");const a=s.projectFileReducer.instances[n];if(!a)throw new Error("No active project file");if(!a.bounds&&!a.canvas_bounds)throw new Error("Project file must either have bounds or canvas_bounds set");let c;if(typeof a.file=="string"&&!a.file.startsWith("blob:")){const m={...a};delete m.file,c={method:l.PATCH,url:`/projects/files/${n}/`,payload:m,blockers:[n],blocks:[n]}}else c=new Promise((m,r)=>{this.client.files.uploadFileToS3(a.file_sha1).then(([h])=>{m({method:l.POST,url:`/projects/${a.project}/files/`,payload:{...a,...h},blockers:[n],blocks:[n]})}).catch(r)});const d=Promise.resolve(c).then(m=>this.enqueueRequest(m));return d.then(m=>{this.dispatch(_i(m))}),this.dispatch(yd),this.dispatch(pd(null)),this.dispatch(fd(!1)),[a,d]}delete(e){return this.dispatch(hd(e)),this.enqueueRequest({method:l.DELETE,url:`/projects/files/${e}`,blockers:[e],blocks:[]})}async refreshStore(e){const s=await this.enqueueRequest({description:"Get project files",method:l.GET,url:`/projects/${e}/files/`,blockers:[],blocks:[]});this.dispatch(ld(s))}}class np extends F{async add(e){if(!e.bounds&&!e.canvas_bounds)throw new Error("Project must either have bounds or canvas_bounds set");return await this.enqueueRequest({description:"Create project",method:l.POST,url:"/projects/",payload:{name:e.name,bounds:e.bounds,organization_owner:e.organization_owner},blockers:[],blocks:[]})}async update(e){if(!e.bounds&&!e.canvas_bounds)throw new Error("Project must either have bounds or canvas_bounds set");return this.dispatch(kr(e)),await this.enqueueRequest({description:"Update project",method:l.PATCH,url:`/projects/${e.id}/`,payload:{name:e.name,bounds:e.bounds},blockers:[e.id.toString()],blocks:[e.id.toString()]})}async delete(e){const{store:s}=this.client,n=s.getState(),a=pi(n),c=a[e];if(!c)throw new Error("Expected project to exist");const o=gd(n).filter(h=>h.project===e);this.dispatch(md(o.map(({offline_id:h})=>h)));const d=od(c.id)(n);this.dispatch(Si(d.map(({offline_id:h})=>h)));const m=wr(n);this.dispatch(vr(m.map(({offline_id:h})=>h))),this.dispatch({type:"rehydrated/setRehydrated",payload:!1}),this.dispatch(Dr(c));const r=hr(c.id)(n);r&&this.dispatch(te({...r,project:null}));try{await this.enqueueRequest({description:"Delete project",method:l.DELETE,url:`/projects/${e}/`,blockers:[e.toString()],blocks:[]}),this.dispatch({type:"rehydrated/setRehydrated",payload:!0})}catch(h){throw this.dispatch(qr(Object.values(a))),this.dispatch(hi(Object.values(m))),this.dispatch(ud(o)),this.dispatch(sd(d)),this.dispatch({type:"rehydrated/setRehydrated",payload:!0}),r&&this.dispatch(te({...r,project:c.id})),h}}invite(e,s){const n=O.v4();return this.enqueueRequest({description:"Invite user to project",method:l.POST,url:`/projects/${e}/invite/${s}/`,payload:{offline_id:n},blockers:[],blocks:[n]})}joinProject(e,s,n){return this.enqueueRequest({description:"Join project",method:l.GET,url:`/projects/${e}/join-project/${s}/${n}/`,isAuthNeeded:!1,blockers:[],blocks:[]})}async acceptInvite(e){return this.enqueueRequest({description:"Accept project invite",method:l.PATCH,url:`/projects/${e}/accept-invite/`,blockers:[e.toString()],blocks:[e.toString()]}).then(()=>{this.dispatch(Cr(e))})}}class ap extends F{add(e){const s=R({...e,submitted_at:new Date().toISOString()});this.dispatch(Id(s));const n=this.enqueueRequest({description:"Create team",method:l.POST,url:`/organizations/${e.organization}/teams/`,payload:s,blockers:[],blocks:[s.offline_id]});return n.then(a=>{this.dispatch(ge(a))}).catch(()=>{this.dispatch(Oi(s.offline_id))}),[s,n]}update(e){const{store:s}=this.client,n=Se(e.offline_id)(s.getState());if(!n)throw new Error(`Expected team with offline_id ${e.offline_id} to exist`);const a={...n,...e};this.dispatch(Fi(a));const c=this.enqueueRequest({description:"Update team",method:l.PATCH,url:`/organizations/teams/${e.offline_id}/`,payload:e,blockers:[e.offline_id],blocks:[e.offline_id]});return c.then(o=>{this.dispatch(ge(o))}).catch(()=>{this.dispatch(ge(n))}),[a,c]}async delete(e){const{store:s}=this.client,n=s.getState(),a=Se(e)(n);if(!a)throw new Error(`Expected team with id ${e} to exist`);this.dispatch(Oi(e));try{return await this.enqueueRequest({description:"Delete team",method:l.DELETE,url:`/organizations/teams/${e}/`,blockers:[e],blocks:[e]})}catch(c){throw this.dispatch(ge(a)),c}}async setMembers(e,s){const{store:n}=this.client,a=Se(e)(n.getState());if(!a)throw new Error(`Expected team with id ${e} to exist`);if(s.length!==new Set(s).size)throw new Error("Duplicate members found in the list");this.dispatch(Fi({...a,members:s}));const c=this.enqueueRequest({description:"Set team members",method:l.PUT,url:`/organizations/teams/${e}/set-members/`,payload:{users:s},blockers:[e],blocks:[e]});return c.catch(()=>{this.dispatch(ge(a))}),c}async addMembers(e,s){const{store:n}=this.client,a=Se(e)(n.getState());if(!a)throw new Error(`Expected team with id ${e} to exist`);const c=[...a.members,...s];return this.setMembers(e,c)}async removeMembers(e,s){const{store:n}=this.client,a=Se(e)(n.getState());if(!a)throw new Error(`Expected team with id ${e} to exist`);const c=a.members.filter(o=>!s.includes(o));return this.setMembers(e,c)}async refreshStore(e){const s=await this.enqueueRequest({description:"Fetch teams",method:l.GET,url:`/organizations/${e}/teams/`,blockers:[],blocks:[]});this.dispatch(_d(s))}}class cp extends F{async refreshStore(e,s){const n={},a=await this.enqueueRequest({description:"Fetch organization users",method:l.GET,url:`/organizations/${s}/users/`,blockers:[],blocks:[]});for(const o of a)n[o.id]=o;const c=await this.enqueueRequest({description:"Fetch project users",method:l.GET,url:`/projects/${e}/users/`,blockers:[],blocks:[]});for(const o of c)n[o.id]=o;this.dispatch(pr(Object.values(n)))}}var Nd=(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))(Nd||{});i.APIError=j,i.AgentService=hf,i.AssetAttachmentService=mf,i.AssetService=ff,i.AssetStageCompletionService=pf,i.AssetStageService=yf,i.AssetTypeAttachmentService=Af,i.AssetTypeFieldValuesAttachmentService=Tf,i.AssetTypeFieldValuesService=If,i.AssetTypeFieldsAttachmentService=gf,i.AssetTypeFieldsService=Sf,i.AssetTypeService=Rf,i.AttachmentModel=Bi,i.BaseApiService=F,i.BaseSDK=lf,i.CategoryService=Ff,i.DEFAULT_ISSUE_PRIORITY=sl,i.DEFAULT_ISSUE_STATUS=tl,i.DeferredPromise=Wi,i.DocumentAttachmentService=Of,i.DocumentService=vf,i.EMPTY_ARRAY=Vi,i.EMPTY_OBJECT=$i,i.EmailDomainsService=wf,i.EmailVerificationService=Ef,i.FileService=Pf,i.FormRevisionAttachmentService=qf,i.FormRevisionService=kf,i.FormService=Cf,i.FormSubmissionAttachmentService=Mf,i.FormSubmissionService=_f,i.GeoImageService=zf,i.HttpMethod=l,i.IssueAssociationService=Uf,i.IssueAttachmentService=Vf,i.IssueCommentService=$f,i.IssuePriority=dt,i.IssueService=Bf,i.IssueStatus=lt,i.IssueTypeFieldValuesAttachmentService=Nf,i.IssueTypeFieldValuesService=Hf,i.IssueTypeFieldsAttachmentService=Gf,i.IssueTypeFieldsService=Lf,i.IssueTypeService=Wf,i.IssueUpdateChange=v,i.IssueUpdateService=Yf,i.JWTService=Zf,i.LicenseLevel=Li,i.LicenseService=Qf,i.LicenseStatus=Ni,i.OUTBOX_RETRY_DELAY=Hi,i.OrganizationAccessLevel=rt,i.OrganizationAccessService=xf,i.OrganizationService=ep,i.OutboxCoordinator=be,i.PaddleCheckoutEvent=Gi,i.ProjectAccessLevel=ot,i.ProjectAccessService=tp,i.ProjectAttachmentService=sp,i.ProjectFileService=ip,i.ProjectService=np,i.TeamService=ap,i.UNKNOWN_ERROR_MESSAGE=Te,i.UserService=cp,i.VERSION_REDUCER_KEY=Ei,i.VerificationCodeType=Nd,i._selectLatestFormRevision=yc,i._setLatestRetryTime=Xr,i.acceptProjectInvite=Cr,i.addAsset=It,i.addAssetAttachment=Ol,i.addAssetAttachments=St,i.addAssetStage=zl,i.addAssetStageCompletion=jt,i.addAssetStageCompletions=Pt,i.addAssetStages=Ce,i.addAssetType=Qt,i.addAssetTypeAttachment=$l,i.addAssetTypeAttachments=Vt,i.addAssetTypeFieldValues=Yt,i.addAssetTypeFieldValuesAttachment=au,i.addAssetTypeFieldValuesAttachments=$e,i.addAssetTypeFieldValuesMany=ma,i.addAssetTypeFields=xn,i.addAssetTypeFieldsAttachment=Nl,i.addAssetTypeFieldsAttachments=Hn,i.addAssetTypeFieldsMany=Zl,i.addAssetTypes=Au,i.addAssets=Rt,i.addCategory=is,i.addConversation=sn,i.addDocumentAttachment=Eu,i.addDocumentAttachments=Pa,i.addDocuments=Ba,i.addEmailDomain=Ya,i.addForm=As,i.addFormRevision=fs,i.addFormRevisionAttachment=$u,i.addFormRevisionAttachments=ac,i.addFormRevisions=mc,i.addFormSubmission=_s,i.addFormSubmissionAttachment=eh,i.addFormSubmissionAttachments=He,i.addFormSubmissions=Ke,i.addForms=Xu,i.addGeoImage=$c,i.addGeoImages=Bc,i.addIssue=Ns,i.addIssueAssociation=Ps,i.addIssueAssociations=qs,i.addIssueAttachment=mh,i.addIssueAttachments=Ms,i.addIssueComment=Bs,i.addIssueComments=Ah,i.addIssueType=Xo,i.addIssueTypeFieldValues=Js,i.addIssueTypeFieldValuesAttachment=Lh,i.addIssueTypeFieldValuesAttachments=Qe,i.addIssueTypeFieldValuesMany=wh,i.addIssueTypeFields=Mo,i.addIssueTypeFieldsAttachment=bh,i.addIssueTypeFieldsAttachments=Ro,i.addIssueTypeFieldsMany=Dh,i.addIssueUpdate=ir,i.addIssueUpdates=nr,i.addIssues=go,i.addLicenses=xh,i.addProjectAttachment=Im,i.addProjectAttachments=ed,i.addProjectFile=wm,i.addProjectFiles=ud,i.addTeam=Id,i.addUsers=am,i.agentsReducer=cn,i.agentsSlice=pt,i.areArraysEqual=cl,i.assetAttachmentReducer=fn,i.assetAttachmentSlice=At,i.assetReducer=Sn,i.assetSlice=_t,i.assetStageCompletionReducer=On,i.assetStageCompletionSlice=Et,i.assetStageReducer=jn,i.assetStageSlice=Ct,i.assetTypeAttachmentReducer=Gn,i.assetTypeAttachmentSlice=Ut,i.assetTypeFieldValuesAttachmentReducer=la,i.assetTypeFieldValuesAttachmentSlice=Nt,i.assetTypeFieldValuesReducer=Aa,i.assetTypeFieldValuesSlice=Wt,i.assetTypeFieldsAttachmentReducer=Xn,i.assetTypeFieldsAttachmentSlice=Gt,i.assetTypeFieldsReducer=ia,i.assetTypeFieldsSlice=Lt,i.assetTypeReducer=Ta,i.assetTypeSlice=Zt,i.authReducer=Ia,i.authSlice=Ge,i.blobToBase64=pl,i.categoryReducer=wa,i.categorySlice=ss,i.clearTokens=Iu,i.constructUploadedFilePayloads=fl,i.coordinatesAreEqual=al,i.createModelAdapter=I,i.createMultiPointGeometry=nl,i.createOfflineAction=Wr,i.createPointGeometry=il,i.deleteAsset=Ft,i.deleteAssetAttachment=ln,i.deleteAssetAttachments=Tt,i.deleteAssetStage=Ul,i.deleteAssetStageCompletion=qt,i.deleteAssetStageCompletions=kt,i.deleteAssetStages=ze,i.deleteAssetType=xt,i.deleteAssetTypeAttachment=Un,i.deleteAssetTypeAttachments=$t,i.deleteAssetTypeFieldValues=Kt,i.deleteAssetTypeFieldValuesAttachment=du,i.deleteAssetTypeFieldValuesAttachments=Be,i.deleteAssetTypeFieldValuesMany=pa,i.deleteAssetTypeFields=ta,i.deleteAssetTypeFieldsAttachment=Kl,i.deleteAssetTypeFieldsAttachments=Yn,i.deleteAssetTypeFieldsMany=tu,i.deleteAssetTypes=Su,i.deleteAssets=An,i.deleteCategory=va,i.deleteDocumentAttachment=Da,i.deleteDocumentAttachments=Ca,i.deleteEmailDomain=Ka,i.deleteForm=gs,i.deleteFormRevision=ps,i.deleteFormRevisionAttachment=Nu,i.deleteFormRevisionAttachments=oc,i.deleteFormRevisions=fc,i.deleteFormSubmission=Is,i.deleteFormSubmissionAttachment=nh,i.deleteFormSubmissionAttachments=We,i.deleteFormSubmissions=Je,i.deleteGeoImage=ws,i.deleteGeoImages=Lc,i.deleteIssue=Hs,i.deleteIssueAssociation=ks,i.deleteIssueAssociations=Ds,i.deleteIssueAttachment=ao,i.deleteIssueAttachments=zs,i.deleteIssueComment=Gs,i.deleteIssueComments=gh,i.deleteIssueTypeFieldValues=Xs,i.deleteIssueTypeFieldValuesAttachment=Yh,i.deleteIssueTypeFieldValuesAttachments=xe,i.deleteIssueTypeFieldValuesMany=qh,i.deleteIssueTypeFields=Uo,i.deleteIssueTypeFieldsAttachment=Fh,i.deleteIssueTypeFieldsAttachments=Oo,i.deleteIssueTypeFieldsMany=Uh,i.deleteIssueUpdate=ar,i.deleteIssueUpdates=cr,i.deleteIssues=So,i.deleteOrganizationAccess=br,i.deleteProject=Dr,i.deleteProjectAccess=Or,i.deleteProjectAccesses=vr,i.deleteProjectAttachment=nd,i.deleteProjectAttachments=Si,i.deleteProjectFile=hd,i.deleteProjectFiles=md,i.deleteTeam=Oi,i.dequeue=$d,i.discard=qi,i.documentAttachmentReducer=Ua,i.documentAttachmentSlice=cs,i.documentSlice=rs,i.documentsReducer=Ha,i.downloadFile=yl,i.downloadInMemoryFile=ml,i.emailDomainsReducer=Za,i.emailDomainsSlice=ls,i.emailRegex=Il,i.enqueue=Vd,i.enqueueRequest=Kr,i.fallbackToEmptyArray=S,i.fallbackToEmptyObject=ae,i.fileReducer=sc,i.fileSlice=us,i.fileToBlob=Xi,i.formReducer=bc,i.formRevisionAttachmentReducer=dc,i.formRevisionAttachmentSlice=hs,i.formRevisionReducer=gc,i.formRevisionsSlice=ms,i.formSlice=ys,i.formSubmissionAttachmentReducer=Ec,i.formSubmissionAttachmentSlice=Ss,i.formSubmissionReducer=Mc,i.formSubmissionSlice=bs,i.geoImageReducer=Wc,i.geoImageSlice=vs,i.getFileIdentifier=hl,i.getFileS3Key=ft,i.getLocalDateString=Ki,i.getLocalRelativeDateString=ll,i.getOutboxCoordinator=ue,i.getRenamedFile=Ji,i.hashFile=fe,i.initSDK=uf,i.initializeAssetAttachments=gt,i.initializeAssetStageCompletions=bn,i.initializeAssetStages=wn,i.initializeAssetTypeAttachments=Cn,i.initializeAssetTypeFieldValues=ha,i.initializeAssetTypeFieldValuesAttachments=aa,i.initializeAssetTypeFields=Qn,i.initializeAssetTypeFieldsAttachments=Nn,i.initializeAssetTypes=Sa,i.initializeAssets=yn,i.initializeCategories=Fa,i.initializeConversations=tn,i.initializeDocumentAttachments=ja,i.initializeEmailDomains=Wa,i.initializeFormRevisionAttachments=nc,i.initializeFormRevisions=hc,i.initializeFormSubmissionAttachments=Fc,i.initializeFormSubmissions=Pc,i.initializeForms=Tc,i.initializeGeoImages=Uc,i.initializeIssueAssociations=Kc,i.initializeIssueAttachments=so,i.initializeIssueTypeFieldValues=Po,i.initializeIssueTypeFieldValuesAttachments=Go,i.initializeIssueTypeFields=Co,i.initializeIssueTypeFieldsAttachments=Io,i.initializeIssueTypes=Jo,i.initializeIssueUpdates=sr,i.initializeIssues=Ao,i.initializeLicences=ur,i.initializeOrganizationAccesses=Sr,i.initializeProjectAccesses=hi,i.initializeProjectAttachments=xr,i.initializeProjectFiles=ld,i.initializeTeams=_d,i.isToday=dl,i.issueAssociationReducer=eo,i.issueAssociationSlice=js,i.issueAttachmentReducer=lo,i.issueAttachmentSlice=Cs,i.issueCommentReducer=po,i.issueCommentSlice=Vs,i.issueReducer=bo,i.issueSlice=Ls,i.issueTypeFieldValuesAttachmentReducer=Yo,i.issueTypeFieldValuesAttachmentSlice=ei,i.issueTypeFieldValuesReducer=ko,i.issueTypeFieldValuesSlice=Ks,i.issueTypeFieldsAttachmentReducer=Eo,i.issueTypeFieldsAttachmentSlice=Ys,i.issueTypeFieldsReducer=$o,i.issueTypeFieldsSlice=xs,i.issueTypeReducer=er,i.issueTypeSlice=si,i.issueUpdateReducer=dr,i.issueUpdateSlice=ci,i.licenseReducer=mr,i.licenseSlice=oi,i.logOnlyOnce=Al,i.markAsDeleted=Jr,i.markForDeletion=_m,i.memoize=ht,i.moveDocument=Ga,i.offline=R,i.onlyUniqueHashes=_l,i.onlyUniqueOfflineIds=xi,i.organizationAccessReducer=Ir,i.organizationAccessSlice=di,i.organizationReducer=Hr,i.organizationSlice=yi,i.outboxReducer=Zr,i.outboxSlice=Ai,i.overmapEnhancer=Qm,i.overmapReducers=Md,i.overmapRootReducer=Ym,i.performRequest=Pi,i.projectAccessReducer=jr,i.projectAccessSlice=ui,i.projectAttachmentReducer=rd,i.projectAttachmentSlice=gi,i.projectFileReducer=Sd,i.projectFileSlice=bi,i.projectReducer=Mr,i.projectSlice=fi,i.rehydratedReducer=Td,i.rehydratedSlice=Ii,i.removeDocuments=ds,i.removeIssueType=ii,i.removeUser=yr,i.resetProjectFileObjectUrls=jm,i.resetStore=Ud,i.restructureCreateSelectorWithArgs=g,i.saveActiveProjectFileBounds=yd,i.selectAccessToken=Ru,i.selectActiveOrganizationAccess=dm,i.selectActiveProjectFileId=qm,i.selectActiveStatusLicenses=tm,i.selectAllDocumentAttachments=os,i.selectAllProjectAttachments=Ti,i.selectAncestorIdsOfDocument=Cu,i.selectAssetAttachmentById=hn,i.selectAssetAttachmentMapping=un,i.selectAssetAttachments=bt,i.selectAssetById=wt,i.selectAssetStageById=Pn,i.selectAssetStageCompletionById=Rn,i.selectAssetStageCompletionMapping=Dt,i.selectAssetStageCompletionsByIds=Fn,i.selectAssetStages=qn,i.selectAssetStagesByIds=zt,i.selectAssetTypeAttachmentById=$n,i.selectAssetTypeAttachmentMapping=Vn,i.selectAssetTypeAttachments=Bt,i.selectAssetTypeById=ts,i.selectAssetTypeFieldValues=Jt,i.selectAssetTypeFieldValuesAttachmentById=lu,i.selectAssetTypeFieldValuesAttachments=oa,i.selectAssetTypeFieldValuesAttachmentsByIds=ra,i.selectAssetTypeFieldValuesAttachmentsMapping=Ht,i.selectAssetTypeFieldValuesById=Xt,i.selectAssetTypeFieldValuesMapping=ya,i.selectAssetTypeFieldValuesOfAsset=mu,i.selectAssetTypeFields=Ve,i.selectAssetTypeFieldsAttachmentById=Xl,i.selectAssetTypeFieldsAttachments=Jn,i.selectAssetTypeFieldsAttachmentsMapping=Kn,i.selectAssetTypeFieldsById=nu,i.selectAssetTypeFieldsMapping=sa,i.selectAssetTypeFieldsOfAssetType=su,i.selectAssetTypeStagesMapping=Vl,i.selectAssetTypeValuesOfAssetType=fu,i.selectAssetTypes=Tu,i.selectAssetTypesByIds=bu,i.selectAssetTypesMapping=es,i.selectAssets=gn,i.selectAssetsByIds=kl,i.selectAssetsMapping=Ot,i.selectAssetsOfAssetType=vt,i.selectAttachmentsOfAsset=mn,i.selectAttachmentsOfAssetByType=El,i.selectAttachmentsOfAssetType=Bn,i.selectAttachmentsOfAssetTypeByType=Ll,i.selectAttachmentsOfAssetTypeFieldValues=da,i.selectAttachmentsOfAssetTypeFields=Jl,i.selectAttachmentsOfDocument=qu,i.selectAttachmentsOfDocumentByType=ku,i.selectAttachmentsOfFormRevision=Hu,i.selectAttachmentsOfFormSubmission=wc,i.selectAttachmentsOfIssue=oo,i.selectAttachmentsOfIssueByType=yh,i.selectAttachmentsOfIssueTypeFieldValues=Wo,i.selectAttachmentsOfIssueTypeFields=Oh,i.selectAttachmentsOfProject=od,i.selectAttachmentsOfProjectByType=Fm,i.selectCategories=Ou,i.selectCategoriesByIds=vu,i.selectCategoryById=as,i.selectCategoryMapping=ns,i.selectCommentsOfIssue=Sh,i.selectCompletedStagesByAsset=Cl,i.selectConversation=Fl,i.selectConversationMapping=yt,i.selectConversations=Rl,i.selectCurrentUser=st,i.selectDeletedRequests=Tm,i.selectDocumentAttachmentById=za,i.selectDocumentAttachmentMapping=Ma,i.selectDocumentById=Na,i.selectDocuments=La,i.selectDocumentsByIds=Du,i.selectDocumentsMapping=pe,i.selectEmailDomains=Xa,i.selectEmailDomainsAsMapping=Ja,i.selectEmailDomainsOfOrganization=Uu,i.selectFilteredForms=xu,i.selectFormById=Ic,i.selectFormMapping=_c,i.selectFormRevisionAttachmentsMapping=rc,i.selectFormRevisionById=Yu,i.selectFormRevisionMapping=Ne,i.selectFormRevisions=pc,i.selectFormRevisionsOfForm=Ac,i.selectFormSubmissionAttachemntsByIds=vc,i.selectFormSubmissionAttachmentsMapping=Ts,i.selectFormSubmissionById=Os,i.selectFormSubmissions=Fs,i.selectFormSubmissionsMapping=Rs,i.selectFormSubmissionsOfAsset=Cc,i.selectFormSubmissionsOfForm=kc,i.selectFormSubmissionsOfIssue=Dc,i.selectForms=Qu,i.selectGeoImageById=Es,i.selectGeoImageMapping=Nc,i.selectGeoImages=Hc,i.selectGeoImagesOfProject=rh,i.selectIsImportingProjectFile=km,i.selectIsLoggedIn=Fu,i.selectIssueAssociationById=Xc,i.selectIssueAssociationMapping=we,i.selectIssueAssociations=hh,i.selectIssueAssociationsOfAsset=xc,i.selectIssueAssociationsOfIssue=Qc,i.selectIssueAssociationsToIssue=Zc,i.selectIssueAttachmentById=ro,i.selectIssueAttachmentMapping=co,i.selectIssueAttachments=Us,i.selectIssueById=Ws,i.selectIssueCommentById=fo,i.selectIssueCommentMapping=mo,i.selectIssueCountOfCategory=wu,i.selectIssueMapping=To,i.selectIssueTypeById=ni,i.selectIssueTypeFieldValues=Zs,i.selectIssueTypeFieldValuesAttachmentById=Kh,i.selectIssueTypeFieldValuesAttachments=No,i.selectIssueTypeFieldValuesAttachmentsByIds=Ho,i.selectIssueTypeFieldValuesAttachmentsMapping=ti,i.selectIssueTypeFieldValuesById=Qs,i.selectIssueTypeFieldValuesMapping=qo,i.selectIssueTypeFieldValuesOfIssue=kh,i.selectIssueTypeFields=Ze,i.selectIssueTypeFieldsAttachmentById=vh,i.selectIssueTypeFieldsAttachments=wo,i.selectIssueTypeFieldsAttachmentsMapping=vo,i.selectIssueTypeFieldsById=Gh,i.selectIssueTypeFieldsMapping=Vo,i.selectIssueTypeFieldsOfIssueType=Vh,i.selectIssueTypeMapping=Qo,i.selectIssueTypeValuesOfIssueType=Bh,i.selectIssueTypes=xo,i.selectIssueTypesByIds=Jh,i.selectIssueTypesOfOrganization=Xh,i.selectIssueUpdateMapping=or,i.selectIssueUpdatesOfIssue=rr,i.selectIssuesByIds=Th,i.selectIssuesOfIssueType=ai,i.selectIssuesOfIssueTypeCount=Zh,i.selectLatestAssetTypeFieldsOfAssetType=iu,i.selectLatestFormRevisionOfForm=Ku,i.selectLatestIssueTypeFieldsOfIssueType=$h,i.selectLatestRetryTime=bm,i.selectLicense=em,i.selectLicenseForProject=hr,i.selectLicenses=tt,i.selectLicensesForProjectsMapping=sm,i.selectLicensesOfOrganization=gm,i.selectNumberOfAssetsOfAssetType=Dl,i.selectOrganizationAccessById=rm,i.selectOrganizationAccessForUser=lm,i.selectOrganizationAccessUserMapping=_r,i.selectOrganizationAccesses=li,i.selectOrganizationById=pm,i.selectOrganizationUsersAsMapping=Nr,i.selectOrganizationUsersIds=Lr,i.selectOrganizations=Gr,i.selectOrganizationsMapping=Br,i.selectOrganizationsWithAccess=ym,i.selectProjectAccessById=um,i.selectProjectAccessForUser=hm,i.selectProjectAccessMapping=mi,i.selectProjectAccessUserMapping=Er,i.selectProjectAccesses=wr,i.selectProjectAttachmentById=cd,i.selectProjectAttachmentMapping=ad,i.selectProjectById=mm,i.selectProjectFileById=Pm,i.selectProjectFileMapping=Ad,i.selectProjectFiles=gd,i.selectProjectMapping=pi,i.selectProjectUsersAsMapping=Ur,i.selectProjectUsersIds=zr,i.selectProjectsOfOrganization=Am,i.selectRehydrated=Mm,i.selectRootDocuments=Mu,i.selectSortedOrganizationUsers=Sm,i.selectSortedProjectUsers=fm,i.selectStageMapping=Ue,i.selectStagesOfAssetType=kn,i.selectTeamById=Se,i.selectTeams=wi,i.selectTeamsByIds=zm,i.selectTeamsMapping=vi,i.selectTeamsOfOrganization=Um,i.selectTeamsOfUser=Vm,i.selectUploadUrl=tc,i.selectUserById=cm,i.selectUsersByIds=om,i.selectUsersMapping=it,i.separateFilesFromValues=Di,i.separateImageFromFields=Df,i.setActiveProjectFileId=pd,i.setAsset=Pl,i.setAssetAttachment=rn,i.setAssetAttachments=vl,i.setAssetStage=En,i.setAssetStages=Ml,i.setAssetType=pu,i.setAssetTypeAttachment=Mn,i.setAssetTypeAttachments=Bl,i.setAssetTypeFieldValues=uu,i.setAssetTypeFieldValuesAttachment=cu,i.setAssetTypeFieldValuesAttachments=ou,i.setAssetTypeFieldValuesMany=hu,i.setAssetTypeFields=Ql,i.setAssetTypeFieldsAttachment=Hl,i.setAssetTypeFieldsAttachments=Wl,i.setAssetTypeFieldsMany=xl,i.setAssetTypes=yu,i.setAssets=ql,i.setConversation=nn,i.setCurrentUser=im,i.setDocumentAttachment=qa,i.setDocumentAttachments=ju,i.setDocuments=$a,i.setForm=Ju,i.setFormRevision=uc,i.setFormRevisionAttachment=Bu,i.setFormRevisionAttachments=Gu,i.setFormSubmission=Ye,i.setFormSubmissionAttachment=th,i.setFormSubmissionAttachments=sh,i.setFormSubmissions=ah,i.setGeoImage=ve,i.setGeoImages=Vc,i.setIsImportingProjectFile=fd,i.setIssueAssociation=lh,i.setIssueAssociations=dh,i.setIssueAttachment=io,i.setIssueAttachments=fh,i.setIssueComment=$s,i.setIssueComments=ho,i.setIssueType=je,i.setIssueTypeFieldValues=Eh,i.setIssueTypeFieldValuesAttachment=Nh,i.setIssueTypeFieldValuesAttachments=Hh,i.setIssueTypeFieldValuesMany=jh,i.setIssueTypeFields=Ch,i.setIssueTypeFieldsAttachment=_h,i.setIssueTypeFieldsAttachments=Ih,i.setIssueTypeFieldsMany=Mh,i.setIssueUpdate=Qh,i.setLoggedIn=_a,i.setOrganizations=$r,i.setProfilePicture=nm,i.setProjectAttachment=td,i.setProjectAttachments=sd,i.setProjectFile=Om,i.setProjectFiles=vm,i.setProjects=qr,i.setRehydrated=Cm,i.setTeam=ge,i.setTokens=_u,i.setUploadUrl=ec,i.setUsers=pr,i.shallowEqual=Yi,i.slugify=Tl,i.spacesToDashesLower=Sl,i.teamReducer=Rd,i.teamSlice=Ri,i.toFileNameSafeString=gl,i.toOfflineIdRecord=Qi,i.truncate=bl,i.updateAsset=Ie,i.updateAssetAttachment=wl,i.updateAssetAttachments=dn,i.updateAssetStage=Mt,i.updateAssetStageCompletion=_n,i.updateAssetStageCompletions=In,i.updateAssetStages=Me,i.updateAssetType=Fe,i.updateAssetTypeAttachment=Gl,i.updateAssetTypeAttachments=zn,i.updateAssetTypeFieldValues=Re,i.updateAssetTypeFieldValuesAttachment=ru,i.updateAssetTypeFieldValuesAttachments=ca,i.updateAssetTypeFieldValuesMany=fa,i.updateAssetTypeFields=ea,i.updateAssetTypeFieldsAttachment=Yl,i.updateAssetTypeFieldsAttachments=Wn,i.updateAssetTypeFieldsMany=eu,i.updateAssetTypes=gu,i.updateAssets=jl,i.updateCategory=Oa,i.updateConversation=an,i.updateDocumentAttachment=Pu,i.updateDocumentAttachments=ka,i.updateDocuments=ne,i.updateForm=Zu,i.updateFormRevisionAttachment=Lu,i.updateFormRevisionAttachments=cc,i.updateFormSubmission=qc,i.updateFormSubmissionAttachment=ih,i.updateFormSubmissionAttachments=Oc,i.updateFormSubmissions=ch,i.updateGeoImage=Gc,i.updateGeoImages=oh,i.updateIssue=Xe,i.updateIssueAssociation=Jc,i.updateIssueAssociations=uh,i.updateIssueAttachment=ph,i.updateIssueAttachments=no,i.updateIssueType=Zo,i.updateIssueTypeFieldValues=Ee,i.updateIssueTypeFieldValuesAttachment=Wh,i.updateIssueTypeFieldValuesAttachments=Lo,i.updateIssueTypeFieldValuesMany=Ph,i.updateIssueTypeFields=zo,i.updateIssueTypeFieldsAttachment=Rh,i.updateIssueTypeFieldsAttachments=Fo,i.updateIssueTypeFieldsMany=zh,i.updateLicense=te,i.updateOrganizationAccess=Tr,i.updateProject=kr,i.updateProjectAccess=Fr,i.updateProjectAttachment=Rm,i.updateProjectAttachments=id,i.updateProjectFile=_i,i.updateProjectFiles=Em,i.updateTeam=Fi,i.userReducer=Ar,i.userSlice=ri,i.versioningReducer=Od,i.versioningSlice=Fd,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -34,7 +34,7 @@ export interface Issue extends OfflineModel, SubmittedAtModel, CreatedByModel, M
|
|
|
34
34
|
assigned_to?: number | null;
|
|
35
35
|
due_date?: string | Date | null;
|
|
36
36
|
category?: string | null;
|
|
37
|
-
issue_type
|
|
37
|
+
issue_type: string;
|
|
38
38
|
project: number;
|
|
39
39
|
}
|
|
40
40
|
/**
|
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.
|
|
6
|
+
"version": "1.0.75-issues-requiring-type.0",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "dist/overmap-core.umd.cjs",
|
|
9
9
|
"module": "dist/overmap-core.js",
|