@overmap-ai/core 1.0.78 → 1.0.79-gcs.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.
Files changed (50) hide show
  1. package/dist/overmap-core.js +3369 -3464
  2. package/dist/overmap-core.umd.cjs +9 -9
  3. package/dist/sdk/services/BaseAttachmentService.d.ts +1 -1
  4. package/dist/sdk/services/index.d.ts +0 -1
  5. package/dist/store/reducers.d.ts +0 -3
  6. package/dist/store/slices/assetProcedureSlice.d.ts +0 -1
  7. package/dist/store/slices/assetProcedureStepFieldValuesAttachmentSlice.d.ts +0 -1
  8. package/dist/store/slices/assetProcedureStepFieldValuesSlice.d.ts +0 -1
  9. package/dist/store/slices/assetProcedureStepFieldsAttachmentSlice.d.ts +0 -1
  10. package/dist/store/slices/assetProcedureStepFieldsSlice.d.ts +0 -2
  11. package/dist/store/slices/assetProcedureStepSlice.d.ts +0 -1
  12. package/dist/store/slices/assetProcedureTypeFieldValuesAttachmentSlice.d.ts +0 -1
  13. package/dist/store/slices/assetProcedureTypeFieldValuesSlice.d.ts +0 -1
  14. package/dist/store/slices/assetProcedureTypeFieldsAttachmentSlice.d.ts +0 -1
  15. package/dist/store/slices/assetSlice.d.ts +0 -1
  16. package/dist/store/slices/assetStageCompletionSlice.d.ts +0 -1
  17. package/dist/store/slices/assetStageSlice.d.ts +0 -1
  18. package/dist/store/slices/assetTypeFieldValuesAttachmentSlice.d.ts +0 -1
  19. package/dist/store/slices/assetTypeFieldValuesSlice.d.ts +0 -1
  20. package/dist/store/slices/assetTypeFieldsAttachmentSlice.d.ts +0 -1
  21. package/dist/store/slices/assetTypeFieldsSlice.d.ts +0 -1
  22. package/dist/store/slices/categorySlice.d.ts +0 -1
  23. package/dist/store/slices/formRevisionSlice.d.ts +0 -1
  24. package/dist/store/slices/formSlice.d.ts +0 -1
  25. package/dist/store/slices/geoImageSlice.d.ts +0 -1
  26. package/dist/store/slices/index.d.ts +0 -1
  27. package/dist/store/slices/issueAssociationSlice.d.ts +0 -1
  28. package/dist/store/slices/issueTypeFieldValuesAttachmentSlice.d.ts +0 -1
  29. package/dist/store/slices/issueTypeFieldValuesSlice.d.ts +0 -1
  30. package/dist/store/slices/issueTypeFieldsAttachmentSlice.d.ts +0 -1
  31. package/dist/store/slices/issueTypeFieldsSlice.d.ts +0 -1
  32. package/dist/store/slices/organizationAccessSlice.d.ts +1 -1
  33. package/dist/store/slices/organizationSlice.d.ts +0 -1
  34. package/dist/store/slices/projectAccessSlice.d.ts +1 -1
  35. package/dist/store/slices/projectFileSlice.d.ts +0 -1
  36. package/dist/store/slices/projectSlice.d.ts +1 -2
  37. package/dist/store/slices/teamMembershipSlice.d.ts +1 -1
  38. package/dist/store/slices/userSlice.d.ts +19 -27
  39. package/dist/typings/models/base.d.ts +1 -1
  40. package/dist/typings/models/emailVerification.d.ts +1 -1
  41. package/dist/typings/models/index.d.ts +0 -1
  42. package/dist/typings/models/issues.d.ts +4 -4
  43. package/dist/typings/models/organizations.d.ts +1 -1
  44. package/dist/typings/models/projects.d.ts +1 -1
  45. package/dist/typings/models/teams.d.ts +1 -1
  46. package/dist/typings/models/users.d.ts +10 -6
  47. package/package.json +1 -1
  48. package/dist/sdk/services/EmailDomainsService.d.ts +0 -9
  49. package/dist/store/slices/emailDomainsSlice.d.ts +0 -135
  50. package/dist/typings/models/emailDomain.d.ts +0 -6
@@ -1,15 +1,15 @@
1
- (function(s,z){typeof exports=="object"&&typeof module<"u"?z(exports,require("@redux-offline/redux-offline/lib/types"),require("@reduxjs/toolkit"),require("superagent"),require("uuid"),require("file-saver"),require("fast-tree-builder"),require("ts-tree-lib"),require("react"),require("@redux-offline/redux-offline"),require("@redux-offline/redux-offline/lib/defaults"),require("buffer"),require("localforage"),require("redux-persist-migrate"),require("@overmap-ai/forms"),require("idb"),require("jwt-decode"),require("dependency-graph"),require("@tiptap/core")):typeof define=="function"&&define.amd?define(["exports","@redux-offline/redux-offline/lib/types","@reduxjs/toolkit","superagent","uuid","file-saver","fast-tree-builder","ts-tree-lib","react","@redux-offline/redux-offline","@redux-offline/redux-offline/lib/defaults","buffer","localforage","redux-persist-migrate","@overmap-ai/forms","idb","jwt-decode","dependency-graph","@tiptap/core"],z):(s=typeof globalThis<"u"?globalThis:s||self,z(s["overmap-core"]={},null,s.toolkit,s.request,s.uuid,s.fileSaver,s.buildTree,s.tsTreeLib,s.react,s.reduxOffline,s.offlineConfig,null,s.localforage,s.createMigration,null,s.idb,s.jwtDecode,s.dependencyGraph))})(this,function(s,z,d,Ze,Je,Gp,Lp,tc,Np,Hp,sc,MF,Wp,Kp,EF,Yp,Zp,Jp){"use strict";var vF=Object.defineProperty;var wF=(s,z,d)=>z in s?vF(s,z,{enumerable:!0,configurable:!0,writable:!0,value:d}):s[z]=d;var S=(s,z,d)=>wF(s,typeof z!="symbol"?z+"":z,d);var $p;const ic=Object.freeze([]),ac=Object.freeze({});var nc=(t=>(t[t.GUEST=0]="GUEST",t[t.BASIC=2]="BASIC",t[t.ADMIN=4]="ADMIN",t))(nc||{}),l=(t=>(t.GET="GET",t.POST="POST",t.PATCH="PATCH",t.PUT="PUT",t.DELETE="DELETE",t))(l||{}),cc=(t=>(t.Issue="issue",t.Asset="asset",t.AssetType="asset_type",t.Project="project",t.Document="document",t))(cc||{}),Qt=(t=>(t[t.LOWEST=0]="LOWEST",t[t.LOW=2]="LOW",t[t.MEDIUM=4]="MEDIUM",t[t.HIGH=6]="HIGH",t[t.HIGHEST=8]="HIGHEST",t))(Qt||{}),xt=(t=>(t[t.BACKLOG=0]="BACKLOG",t[t.SELECTED=2]="SELECTED",t[t.DONE=4]="DONE",t))(xt||{}),E=(t=>(t.STATUS="status",t.PRIORITY="priority",t.CATEGORY="category",t.DESCRIPTION="description",t.TITLE="title",t.ASSIGNED_TO="assigned_to",t.DUE_DATE="due_date",t))(E||{});const Xp=xt.BACKLOG,Qp=Qt.MEDIUM,rc=6e4;function P(t){return{addOne:(p,y)=>{const A=t(y.payload);p.instances[A]=y.payload},addMany:(p,y)=>{for(const A of y.payload){const g=t(A);p.instances[g]=A}},setOne:(p,y)=>{const A=t(y.payload);p.instances[A]=y.payload},setMany:(p,y)=>{for(const A of y.payload){const g=t(A);p.instances[g]=A}},updateOne:(p,y)=>{const A=t(y.payload);p.instances[A]=y.payload},updateMany:(p,y)=>{for(const A of y.payload){const g=t(A);p.instances[g]=A}},deleteOne:(p,y)=>{delete p.instances[y.payload]},deleteMany:(p,y)=>{for(const A of y.payload)delete p.instances[A]},initialize:(p,y)=>{p.instances={};const A=new Set;for(const g of y.payload){const b=t(g);A.add(b),p.instances[b]=g}A.size!==y.payload.length&&console.warn("duplicate ids detected when initializing model instances.")},getInitialState:p=>({...p,instances:{}})}}function xp(){return{initializeSelection:(m,o)=>{m.selection=Array.from(new Set(o.payload))},selectOne:(m,o)=>{new Set(m.selection).has(o.payload)||m.selection.push(o.payload)},selectMany:(m,o)=>{const h=new Set(m.selection);for(const p of o.payload)h.has(p)||h.add(p);m.selection=Array.from(h)},unselectOne:(m,o)=>{const h=new Set(m.selection);h.has(o.payload)&&(h.delete(o.payload),m.selection=Array.from(h))},unselectMany:(m,o)=>{const h=new Set(m.selection);for(const p of o.payload)h.has(p)&&h.delete(p);m.selection=Array.from(h)},toggleOne:(m,o)=>{const h=new Set(m.selection);h.has(o.payload)?h.delete(o.payload):h.add(o.payload),m.selection=Array.from(h)},toggleMany:(m,o)=>{const h=new Set(m.selection);for(const p of o.payload)h.has(p)?h.delete(p):h.add(p);m.selection=Array.from(h)},getInitialState:m=>({...m,selection:[]})}}const st="versioning",I=d.createAction("RESET"),M=d.createAction("RESET_PROJECT_STATE"),_=d.createAction("RESET_ORGANIZATION_STATE");$p=Symbol.toStringTag;class dc{constructor(){S(this,$p,"Promise");S(this,"_promise");S(this,"_resolve");S(this,"_reject");S(this,"_state","pending");this._resolve=null,this._reject=null,this._promise=new Promise((e,i)=>{this._resolve=e,this._reject=i})}get state(){return this._state}then(e,i){return this._promise.then(e,i)}catch(e){return this._promise.catch(e)}resolve(e){if(!this._resolve)throw new Error("No resolve callback");this._resolve(e),this._state="fulfilled"}reject(e){if(!this._reject)throw e;this._reject(e),this._state="rejected"}finally(e){throw new Error("`finally` not implemented")}}let es=!1;["true","1"].includes("".toLowerCase())&&(es=!0);function ey(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;const i=Object.keys(t),a=Object.keys(e),n=i.length;if(n!==a.length)return!1;for(let c=0;c<n;c++){const r=i[c];if(!Object.prototype.hasOwnProperty.call(e,r)||t[r]!==e[r])return!1}return!0}function ts(t){const e={};return function(){const i=Array.prototype.slice.call(arguments);return i in e?(es&&console.debug(`Memoization debug: Using memorized return value for ${t.toString()}(`,i,")"),e[i]):(es&&console.debug(`Memoization debug: Cache miss! Memoizing ${t.toString()}(`,i,")"),e[i]=t.apply(this,i))}}function ty(t,e){if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}const T=t=>t.length===0?ic:t,_t=t=>Object.keys(t).length===0?ac:t,uc=ts(t=>{if(!t)return"";const e=new Date(t),i=e.getFullYear()===ss.getFullYear(),a={day:"numeric",month:"short"};return i||(a.year="numeric"),e.toLocaleDateString([],a)}),sy=new Intl.RelativeTimeFormat([],{style:"long",numeric:"auto"}),iy=1e3*86400,ss=new Date,ay=t=>new Date(t).toDateString()===ss.toDateString(),ny=ts((t,e,i)=>{const a=Math.round((new Date(t).getTime()-ss.getTime())/iy);return a<e||a>i?uc(t):sy.format(a,"days")});function cy(t){return new Uint8Array(t).reduce((i,a)=>i+a.toString(16).padStart(2,"0"),"")}const is=async(t,e)=>{e||(e=await Xe(t));let i=t.type;if(i.includes("/")&&(i=i.split("/")[1]),!i)throw new Error(`Could not extract file type from ${t.type}`);return`${e}.${i}`};function Xe(t){return new Promise((e,i)=>{const a=new FileReader;a.onload=()=>{const n=a.result;if(!n){i(new Error("FileReader did not return a valid ArrayBuffer."));return}crypto.subtle.digest("SHA-1",n).then(c=>{const r=cy(c);e(r)})},a.readAsArrayBuffer(t)})}function ry(t){if(!t.name||!t.type||!t.size){const e="File has no name, type, and/or size";throw new Error(e)}return`${t.name}&${t.type}${t.size}`}function oc(t,e){return new File([t],e,{type:t.type})}function dy(t,e){const i=document.createElement("a");i.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(e)),i.setAttribute("download",t),i.style.display="none",document.body.appendChild(i),i.click(),document.body.removeChild(i)}const uy=async t=>{const e={};for(const i of t){const a=await Xe(i);e[a]={sha1:a,extension:i.name.split(".").pop()||"",file_type:i.type,size:i.size}}return Object.values(e)},lc=async t=>(await fetch(t)).blob(),oy=t=>new Promise((e,i)=>{const a=new FileReader;a.onloadend=()=>{var n;e(((n=a.result)==null?void 0:n.toString())||"")},a.readAsDataURL(t)});function ly(t){const e=new Blob([t]);Gp.saveAs(e,t.name)}const hc={};function hy(t,e,i,...a){const n=hc[t];let c=!1;n?n[e]||(n[e]=!0,c=!0):(hc[t]={[e]:!0},c=!0),c&&console[i](...a)}const mc=["created_at","updated_at","index","revision"];function F(t){return{...t,uuid:Je.v4()}}function pc(t){const e={};for(const i of t)e[i.uuid]=i;return e}function yc(t){return t.map(({uuid:e})=>e)}function my(t,e=void 0,i=255){let a=t.replace(/[^a-z0-9_\-.]/gi,"_").replace(/_{2,}/g,"_");if(!e){const c=t.split(".");c.length>1&&(e=c[c.length-1])}e&&!e.startsWith(".")&&(e="."+e);const n=e?e.length:0;return a.length+n>i&&(a=a.slice(0,i-n)+(e||"")),a}function py(t){return t.toLowerCase().replace(" ","-")}function yy(t,e=!1){return t.normalize("NFKD").toLowerCase().replace(/[^\w\s-]/g,"").trim().replace(/[-\s]+/g,e?"_":"-")}function Ay(t,e){if(t.length<=e)return t;const i=t.slice(0,e-1);return i.slice(0,i.lastIndexOf(" "))+"…"}const f=t=>e=>i=>t(i,e);function Ac(t,e,i){return i.findIndex(a=>a.uuid===t.uuid)===e}function fy(t,e,i){return i.findIndex(a=>a.file_sha1===t.file_sha1)===e}const Sy=/^.+@.+\..+$/;function v(t){const e={...t};for(const i of[...mc,"created_by"])i in e&&delete e[i];return e}const fc=t=>{const e=t.toSorted((i,a)=>i.order-a.order);return Lp(e,{id:i=>i.uuid,parentId:i=>i.parent,includeEmptyChildrenArray:!0,valueKey:!1})},Ty=t=>{const{roots:e}=fc(t);return e.map(i=>new tc.Tree(i))},Sc=(t,e)=>{const{nodes:i}=fc(e),a=i.get(t);if(!a)throw new Error(`Node with uuid ${t} does not exist in asset procedure step tree.`);return new tc.Tree(a)},C=P(t=>t.uuid),Tc=C.getInitialState({}),as=d.createSlice({name:"agents",initialState:Tc,extraReducers:t=>t.addMatcher(d.isAnyOf(I,M,_),e=>Object.assign(e,Tc)),reducers:{initializeConversations:C.initialize,addConversation:C.addOne,addConversations:C.addMany,setConversation:C.setOne,setConversations:C.setMany,updateConversation:C.updateOne,updateConversations:C.updateMany,deleteConversation:C.deleteOne,deleteConversations:C.deleteMany}}),{initializeConversations:gc,addConversation:Ic,addConversations:gy,setConversation:bc,setConversations:Iy,updateConversation:Fc,updateConversations:by,deleteConversation:Fy,deleteConversations:Py}=as.actions,ns=t=>t.agentsReducer.instances,_y=d.createSelector([ns],t=>Object.values(t)),Oy=f(d.createSelector([ns,(t,e)=>e],(t,e)=>t[e])),Pc=as.reducer,k=P(t=>t.uuid),_c=k.getInitialState({}),cs=d.createSlice({name:"assetAttachments",initialState:_c,extraReducers:t=>t.addMatcher(d.isAnyOf(I,M,_),e=>Object.assign(e,_c)),reducers:{initializeAssetAttachments:k.initialize,addAssetAttachment:k.addOne,addAssetAttachments:k.addMany,setAssetAttachment:k.setOne,setAssetAttachments:k.setMany,updateAssetAttachment:k.updateOne,updateAssetAttachments:k.updateMany,deleteAssetAttachment:k.deleteOne,deleteAssetAttachments:k.deleteMany}}),{initializeAssetAttachments:rs,addAssetAttachment:Ry,addAssetAttachments:ds,setAssetAttachment:Oc,setAssetAttachments:vy,updateAssetAttachment:wy,updateAssetAttachments:Rc,deleteAssetAttachment:vc,deleteAssetAttachments:us}=cs.actions,wc=t=>t.assetAttachmentReducer.instances,Mc=d.createSelector([wc],t=>Object.values(t)),Ec=t=>e=>e.assetAttachmentReducer.instances[t],Vc=f(d.createSelector([Mc,(t,e)=>e],(t,e)=>T(t.filter(({asset:i})=>e===i)))),jc=cs.reducer,B=P(({uuid:t})=>t),qc=B.getInitialState({}),os=d.createSlice({name:"assetProcedureTypeAttachments",initialState:qc,extraReducers:t=>t.addMatcher(d.isAnyOf(I,_),e=>Object.assign(e,qc)),reducers:{initializeAssetProcedureTypeAttachments:B.initialize,addAssetProcedureTypeAttachment:B.addOne,addAssetProcedureTypeAttachments:B.addMany,setAssetProcedureTypeAttachment:B.setOne,setAssetProcedureTypeAttachments:B.setMany,updateAssetProcedureTypeAttachment:B.updateOne,updateAssetProcedureTypeAttachments:B.updateMany,deleteAssetProcedureTypeAttachment:B.deleteOne,deleteAssetProcedureTypeAttachments:B.deleteMany}}),{initializeAssetProcedureTypeAttachments:ls,addAssetProcedureTypeAttachment:My,addAssetProcedureTypeAttachments:zc,setAssetProcedureTypeAttachment:Dc,setAssetProcedureTypeAttachments:Ey,updateAssetProcedureTypeAttachment:Vy,updateAssetProcedureTypeAttachments:Uc,deleteAssetProcedureTypeAttachment:Cc,deleteAssetProcedureTypeAttachments:kc}=os.actions,Bc=os.reducer,$c=t=>t.assetProcedureTypeAttachmentReducer.instances,Gc=d.createSelector([$c],t=>Object.values(t)),Lc=t=>e=>e.assetProcedureTypeAttachmentReducer.instances[t],jy=f(d.createSelector([Gc,(t,e)=>e],(t,e)=>T(t.filter(({asset_procedure_type:i})=>e===i)))),$=P(({uuid:t})=>t),Nc=$.getInitialState({}),hs=d.createSlice({name:"assetProcedureTypeFieldsAttachments",initialState:Nc,extraReducers:t=>t.addMatcher(d.isAnyOf(I,_),e=>Object.assign(e,Nc)),reducers:{initializeAssetProcedureTypeFieldsAttachments:$.initialize,addAssetProcedureTypeFieldsAttachment:$.addOne,addAssetProcedureTypeFieldsAttachments:$.addMany,setAssetProcedureTypeFieldsAttachment:$.setOne,setAssetProcedureTypeFieldsAttachments:$.setMany,updateAssetProcedureTypeFieldsAttachment:$.updateOne,updateAssetProcedureTypeFieldsAttachments:$.updateMany,deleteAssetProcedureTypeFieldsAttachment:$.deleteOne,deleteAssetProcedureTypeFieldsAttachments:$.deleteMany}}),{initializeAssetProcedureTypeFieldsAttachments:Hc,addAssetProcedureTypeFieldsAttachment:qy,addAssetProcedureTypeFieldsAttachments:Wc,setAssetProcedureTypeFieldsAttachment:zy,setAssetProcedureTypeFieldsAttachments:Dy,updateAssetProcedureTypeFieldsAttachment:Uy,updateAssetProcedureTypeFieldsAttachments:Kc,deleteAssetProcedureTypeFieldsAttachment:Cy,deleteAssetProcedureTypeFieldsAttachments:Yc}=hs.actions,Zc=hs.reducer,Jc=t=>t.assetProcedureTypeFieldsAttachmentReducer.instances,Xc=d.createSelector([Jc],t=>Object.values(t)),ky=f(d.createSelector([Xc,(t,e)=>e],(t,e)=>T(t.filter(i=>i.fields_revision===e)))),By=t=>e=>e.assetProcedureTypeFieldsAttachmentReducer.instances[t],G=P(({uuid:t})=>t),Qc=G.getInitialState({}),ms=d.createSlice({name:"assetProcedureTypeFields",initialState:Qc,extraReducers:t=>t.addMatcher(d.isAnyOf(I,_),e=>Object.assign(e,Qc)),reducers:{initializeAssetProcedureTypeFields:G.initialize,addAssetProcedureTypeFields:G.addOne,addAssetProcedureTypeFieldsMany:G.addMany,setAssetProcedureTypeFields:G.setOne,setAssetProcedureTypeFieldsMany:G.setMany,updateAssetProcedureTypeFields:G.updateOne,updateAssetProcedureTypeFieldsMany:G.updateMany,deleteAssetProcedureTypeFields:G.deleteOne,deleteAssetProcedureTypeFieldsMany:G.deleteMany}}),{initializeAssetProcedureTypeFields:xc,addAssetProcedureTypeFields:er,addAssetProcedureTypeFieldsMany:$y,setAssetProcedureTypeFields:Gy,setAssetProcedureTypeFieldsMany:Ly,updateAssetProcedureTypeFields:tr,updateAssetProcedureTypeFieldsMany:Ny,deleteAssetProcedureTypeFields:sr,deleteAssetProcedureTypeFieldsMany:Hy}=ms.actions,ir=ms.reducer,ar=t=>t.assetProcedureTypeFieldsReducer.instances,ps=d.createSelector([ar],t=>Object.values(t)),Wy=f(d.createSelector([ps,(t,e)=>e],(t,e)=>T(t.filter(i=>i.asset_procedure_type===e)))),Ky=f(d.createSelector([ps,(t,e)=>e],(t,e)=>t.filter(i=>i.asset_procedure_type===e).sort((i,a)=>i.submitted_at>a.submitted_at?-1:1)[0])),Yy=t=>e=>e.assetProcedureTypeFieldsReducer.instances[t],L=P(({uuid:t})=>t),nr=L.getInitialState({}),ys=d.createSlice({name:"assetProcedureTypeFieldValuesAttachments",initialState:nr,extraReducers:t=>t.addMatcher(d.isAnyOf(I,M,_),e=>Object.assign(e,nr)),reducers:{initializeAssetProcedureTypeFieldValuesAttachments:L.initialize,addAssetProcedureTypeFieldValuesAttachment:L.addOne,addAssetProcedureTypeFieldValuesAttachments:L.addMany,setAssetProcedureTypeFieldValuesAttachment:L.setOne,setAssetProcedureTypeFieldValuesAttachments:L.setMany,updateAssetProcedureTypeFieldValuesAttachment:L.updateOne,updateAssetProcedureTypeFieldValuesAttachments:L.updateMany,deleteAssetProcedureTypeFieldValuesAttachment:L.deleteOne,deleteAssetProcedureTypeFieldValuesAttachments:L.deleteMany}}),{initializeAssetProcedureTypeFieldValuesAttachments:cr,addAssetProcedureTypeFieldValuesAttachment:Zy,addAssetProcedureTypeFieldValuesAttachments:Ot,setAssetProcedureTypeFieldValuesAttachment:Jy,setAssetProcedureTypeFieldValuesAttachments:Xy,updateAssetProcedureTypeFieldValuesAttachment:Qy,updateAssetProcedureTypeFieldValuesAttachments:rr,deleteAssetProcedureTypeFieldValuesAttachment:xy,deleteAssetProcedureTypeFieldValuesAttachments:Rt}=ys.actions,dr=ys.reducer,As=t=>t.assetProcedureTypeFieldValuesAttachmentReducer.instances,ur=d.createSelector([As],t=>Object.values(t)),eA=t=>e=>e.assetProcedureTypeFieldValuesAttachmentReducer.instances[t],or=f(d.createSelector([As,(t,e)=>e],(t,e)=>{const i=new Set(e);return T(Object.values(t).filter(a=>i.has(a.uuid)))})),lr=f(d.createSelector([ur,(t,e)=>e],(t,e)=>T(t.filter(i=>i.field_values===e)))),N=P(({uuid:t})=>t),hr=N.getInitialState({}),fs=d.createSlice({name:"assetProcedureTypeFieldValues",initialState:hr,extraReducers:t=>t.addMatcher(d.isAnyOf(I,M,_),e=>Object.assign(e,hr)),reducers:{initializeAssetProcedureTypeFieldValues:N.initialize,addAssetProcedureTypeFieldValues:N.addOne,addAssetProcedureTypeFieldValuesMany:N.addMany,setAssetProcedureTypeFieldValues:N.setOne,setAssetProcedureTypeFieldValuesMany:N.setMany,updateAssetProcedureTypeFieldValues:N.updateOne,updateAssetProcedureTypeFieldValuesMany:N.updateMany,deleteAssetProcedureTypeFieldValues:N.deleteOne,deleteAssetProcedureTypeFieldValuesMany:N.deleteMany}}),{initializeAssetProcedureTypeFieldValues:mr,addAssetProcedureTypeFieldValues:Ss,addAssetProcedureTypeFieldValuesMany:pr,setAssetProcedureTypeFieldValues:tA,setAssetProcedureTypeFieldValuesMany:sA,updateAssetProcedureTypeFieldValues:it,updateAssetProcedureTypeFieldValuesMany:yr,deleteAssetProcedureTypeFieldValues:Ts,deleteAssetProcedureTypeFieldValuesMany:Ar}=fs.actions,fr=fs.reducer,Sr=t=>t.assetProcedureFieldValuesReducer.instances,gs=d.createSelector([Sr],t=>Object.values(t)),iA=f(d.createSelector([gs,(t,e)=>e],(t,e)=>T(t.filter(i=>i.asset===e)))),aA=f(d.createSelector([gs,(t,e)=>e],(t,e)=>T(t.filter(i=>i.asset_procedure===e)))),Is=t=>e=>e.assetProcedureFieldValuesReducer.instances[t],H=P(({uuid:t})=>t),Tr=H.getInitialState({}),bs=d.createSlice({name:"assetProcedures",initialState:Tr,extraReducers:t=>t.addMatcher(d.isAnyOf(I,M,_),e=>Object.assign(e,Tr)),reducers:{initializeAssetProcedures:H.initialize,addAssetProcedure:H.addOne,addAssetProcedures:H.addMany,setAssetProcedure:H.setOne,setAssetProcedures:H.setMany,updateAssetProcedure:H.updateOne,updateAssetProcedures:H.updateMany,deleteAssetProcedure:H.deleteOne,deleteAssetProcedures:H.deleteMany}}),{initializeAssetProcedures:gr,addAssetProcedure:Fs,addAssetProcedures:Ir,updateAssetProcedure:at,updateAssetProcedures:nA,deleteAssetProcedure:Ps,deleteAssetProcedures:br,setAssetProcedure:cA,setAssetProcedures:rA}=bs.actions,Fr=bs.reducer,_s=t=>t.assetProcedureReducer.instances,Os=d.createSelector([_s],t=>Object.values(t)),Pr=f(d.createSelector([Os,(t,e)=>e],(t,e)=>T(t.filter(i=>i.asset_procedure_type===e)))),dA=f(d.createSelector([Os,(t,e)=>e],(t,e)=>T(t.filter(i=>i.asset_type===e)))),Rs=t=>e=>e.assetProcedureReducer.instances[t],uA=f(d.createSelector([_s,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n&&i.push(n)}return T(i)})),W=P(t=>t.uuid),_r=W.getInitialState({}),vs=d.createSlice({name:"assetProcedureTypes",initialState:_r,extraReducers:t=>t.addMatcher(d.isAnyOf(I,_),e=>Object.assign(e,_r)),reducers:{initializeAssetProcedureTypes:W.initialize,addAssetProcedureType:W.addOne,addAssetProcedureTypes:W.addMany,setAssetProcedureType:W.setOne,setAssetProcedureTypes:W.setMany,updateAssetProcedureType:W.updateOne,updateAssetProcedureTypes:W.updateMany,deleteAssetProcedureType:W.deleteOne,deleteAssetProcedureTypes:W.deleteMany}}),{initializeAssetProcedureTypes:Or,addAssetProcedureType:ws,addAssetProcedureTypes:oA,updateAssetProcedureType:nt,updateAssetProcedureTypes:lA,deleteAssetProcedureType:Ms,deleteAssetProcedureTypes:hA,setAssetProcedureType:mA,setAssetProcedureTypes:pA}=vs.actions,Rr=vs.reducer,Es=t=>t.assetProcedureTypeReducer.instances,vr=d.createSelector([Es],t=>Object.values(t)),Vs=t=>e=>e.assetProcedureTypeReducer.instances[t],yA=f(d.createSelector([Es,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n&&i.push(n)}return T(i)})),AA=f(d.createSelector([vr,(t,e)=>e],(t,e)=>T(t.filter(i=>i.organization===e)))),K=P(t=>t.uuid),wr=K.getInitialState({}),js=d.createSlice({name:"assetProcedureStepFieldsAttachments",initialState:wr,extraReducers:t=>t.addMatcher(d.isAnyOf(I,_),e=>Object.assign(e,wr)),reducers:{initializeAssetProcedureStepFieldsAttachments:K.initialize,addAssetProcedureStepFieldsAttachment:K.addOne,addAssetProcedureStepFieldsAttachments:K.addMany,setAssetProcedureStepFieldsAttachment:K.setOne,setAssetProcedureStepFieldsAttachments:K.setMany,updateAssetProcedureStepFieldsAttachment:K.updateOne,updateAssetProcedureStepFieldsAttachments:K.updateMany,deleteAssetProcedureStepFieldsAttachment:K.deleteOne,deleteAssetProcedureStepFieldsAttachments:K.deleteMany}}),{initializeAssetProcedureStepFieldsAttachments:Mr,addAssetProcedureStepFieldsAttachment:fA,addAssetProcedureStepFieldsAttachments:Er,setAssetProcedureStepFieldsAttachment:SA,setAssetProcedureStepFieldsAttachments:TA,updateAssetProcedureStepFieldsAttachment:gA,updateAssetProcedureStepFieldsAttachments:Vr,deleteAssetProcedureStepFieldsAttachment:IA,deleteAssetProcedureStepFieldsAttachments:jr}=js.actions,qr=t=>t.assetProcedureStepFieldsAttachmentReducer.instances,zr=d.createSelector([qr],t=>Object.values(t)),bA=f(d.createSelector([zr,(t,e)=>e],(t,e)=>T(t.filter(i=>i.fields_revision===e)))),FA=t=>e=>e.assetProcedureStepFieldsAttachmentReducer.instances[t],Dr=js.reducer,Y=P(t=>t.uuid),Ur=Y.getInitialState({}),qs=d.createSlice({name:"assetProcedureStepFields",initialState:Ur,extraReducers:t=>t.addMatcher(d.isAnyOf(I,_),e=>Object.assign(e,Ur)),reducers:{initializeAssetProcedureStepFields:Y.initialize,addAssetProcedureStepFields:Y.addOne,addAssetProcedureStepFieldsMany:Y.addMany,setAssetProcedureStepFields:Y.setOne,setAssetProcedureStepFieldsMany:Y.setMany,updateAssetProcedureStepFields:Y.updateOne,updateAssetProcedureStepFieldsMany:Y.updateMany,deleteAssetProcedureStepFields:Y.deleteOne,deleteAssetProcedureStepFieldsMany:Y.deleteMany}}),{initializeAssetProcedureStepFields:Cr,addAssetProcedureStepFields:zs,addAssetProcedureStepFieldsMany:PA,setAssetProcedureStepFields:_A,setAssetProcedureStepFieldsMany:OA,updateAssetProcedureStepFields:ct,updateAssetProcedureStepFieldsMany:RA,deleteAssetProcedureStepFields:Ds,deleteAssetProcedureStepFieldsMany:vA}=qs.actions,Us=t=>t.assetProcedureStepFieldsReducer.instances,Cs=d.createSelector([Us],t=>Object.values(t)),wA=f(d.createSelector([Cs,(t,e)=>e],(t,e)=>T(t.filter(i=>i.asset_procedure_step===e)))),MA=f(d.createSelector([Cs,(t,e)=>e],(t,e)=>t.filter(i=>i.asset_procedure_step===e).sort((i,a)=>i.submitted_at>a.submitted_at?-1:1)[0])),EA=d.createSelector([Us],t=>{const e={};for(const i of Object.values(t)){const a=e[i.asset_procedure_step];(!a||a.submitted_at<i.submitted_at)&&(e[i.asset_procedure_step]=i)}return e}),VA=t=>e=>e.assetProcedureStepFieldsReducer.instances[t],kr=qs.reducer,Z=P(t=>t.uuid),Br=Z.getInitialState({}),ks=d.createSlice({name:"assetProcedureStepFieldValuesAttachments",initialState:Br,extraReducers:t=>t.addMatcher(d.isAnyOf(I,M,_),e=>Object.assign(e,Br)),reducers:{initializeAssetProcedureStepFieldValuesAttachments:Z.initialize,addAssetProcedureStepFieldValuesAttachment:Z.addOne,addAssetProcedureStepFieldValuesAttachments:Z.addMany,setAssetProcedureStepFieldValuesAttachment:Z.setOne,setAssetProcedureStepFieldValuesAttachments:Z.setMany,updateAssetProcedureStepFieldValuesAttachment:Z.updateOne,updateAssetProcedureStepFieldValuesAttachments:Z.updateMany,deleteAssetProcedureStepFieldValuesAttachment:Z.deleteOne,deleteAssetProcedureStepFieldValuesAttachments:Z.deleteMany}}),{initializeAssetProcedureStepFieldValuesAttachments:$r,addAssetProcedureStepFieldValuesAttachment:jA,addAssetProcedureStepFieldValuesAttachments:vt,setAssetProcedureStepFieldValuesAttachment:qA,setAssetProcedureStepFieldValuesAttachments:zA,updateAssetProcedureStepFieldValuesAttachment:DA,updateAssetProcedureStepFieldValuesAttachments:Gr,deleteAssetProcedureStepFieldValuesAttachment:UA,deleteAssetProcedureStepFieldValuesAttachments:wt}=ks.actions,Bs=t=>t.assetProcedureStepFieldValuesAttachmentReducer.instances,Lr=d.createSelector([Bs],t=>Object.values(t)),CA=t=>e=>e.assetProcedureStepFieldValuesAttachmentReducer.instances[t],Nr=f(d.createSelector([Bs,(t,e)=>e],(t,e)=>{const i=new Set(e);return T(Object.values(t).filter(a=>i.has(a.uuid)))})),Hr=f(d.createSelector([Lr,(t,e)=>e],(t,e)=>T(t.filter(i=>i.field_values===e)))),Wr=ks.reducer,J=P(t=>t.uuid),Kr=J.getInitialState({}),$s=d.createSlice({name:"assetProcedureStepFieldValues",initialState:Kr,extraReducers:t=>t.addMatcher(d.isAnyOf(I,M,_),e=>Object.assign(e,Kr)),reducers:{initializeAssetProcedureStepFieldValues:J.initialize,addAssetProcedureStepFieldValues:J.addOne,addAssetProcedureStepFieldValuesMany:J.addMany,setAssetProcedureStepFieldValues:J.setOne,setAssetProcedureStepFieldValuesMany:J.setMany,updateAssetProcedureStepFieldValues:J.updateOne,updateAssetProcedureStepFieldValuesMany:J.updateMany,deleteAssetProcedureStepFieldValues:J.deleteOne,deleteAssetProcedureStepFieldValuesMany:J.deleteMany}}),{initializeAssetProcedureStepFieldValues:Yr,addAssetProcedureStepFieldValues:Gs,addAssetProcedureStepFieldValuesMany:Zr,setAssetProcedureStepFieldValues:kA,setAssetProcedureStepFieldValuesMany:BA,updateAssetProcedureStepFieldValues:rt,updateAssetProcedureStepFieldValuesMany:Jr,deleteAssetProcedureStepFieldValues:Ls,deleteAssetProcedureStepFieldValuesMany:Xr}=$s.actions,Qr=t=>t.assetProcedureStepFieldValuesReducer.instances,Mt=d.createSelector([Qr],t=>Object.values(t)),$A=f(d.createSelector([Mt,(t,e)=>e],(t,e)=>T(t.filter(i=>i.asset===e)))),GA=f(d.createSelector([Mt,(t,e)=>e],(t,e)=>T(t.filter(i=>i.asset_procedure===e)))),LA=f(d.createSelector([Mt,(t,e)=>e],(t,e)=>T(t.filter(i=>i.asset_procedure_step===e)))),Ns=t=>e=>e.assetProcedureStepFieldValuesReducer.instances[t],xr=$s.reducer,X=P(t=>t.uuid),ed=X.getInitialState({}),Hs=d.createSlice({name:"assetProcedureSteps",initialState:ed,extraReducers:t=>t.addMatcher(d.isAnyOf(I,_),e=>Object.assign(e,ed)),reducers:{initializeAssetProcedureSteps:X.initialize,setAssetProcedureStep:X.setOne,setAssetProcedureSteps:X.setMany,addAssetProcedureStep:X.addOne,addAssetProcedureSteps:X.addMany,updateAssetProcedureStep:X.updateOne,updateAssetProcedureSteps:X.updateMany,deleteAssetProcedureStep:X.deleteOne,deleteAssetProcedureSteps:X.deleteMany}}),{initializeAssetProcedureSteps:td,setAssetProcedureStep:sd,setAssetProcedureSteps:NA,addAssetProcedureStep:id,addAssetProcedureSteps:ad,updateAssetProcedureStep:Et,updateAssetProcedureSteps:HA,deleteAssetProcedureStep:nd,deleteAssetProcedureSteps:cd}=Hs.actions,rd=Hs.reducer,dt=t=>t.assetProcedureStepReducer.instances,Ws=t=>e=>e.assetProcedureStepReducer.instances[t],dd=d.createSelector([dt],t=>Object.values(t)),WA=f(d.createSelector([dt,(t,e)=>e],(t,e)=>{const i={};for(const[a,n]of Object.entries(t))n.asset_procedure_type===e&&(i[a]=n);return _t(i)})),KA=f(d.createSelector([dd,(t,e)=>e],(t,e)=>T(t.filter(i=>i.asset_procedure_type===e)))),YA=f(d.createSelector([dt,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n?i.push(n):console.warn("selectAssetProcedureStepsByIds: No step exists with the id",a)}return T(i)})),ud=f(d.createSelector([dt,(t,e)=>e],(t,e)=>{if(!t[e])return T([]);const n=Sc(e,Object.values(t)).all().map(({model:c})=>c);return T(n)})),Q=P(t=>t.uuid),od=Q.getInitialState({}),Ks=d.createSlice({name:"assets",initialState:od,extraReducers:t=>t.addMatcher(d.isAnyOf(I,M,_),e=>Object.assign(e,od)),reducers:{initializeAssets:Q.initialize,addAsset:Q.addOne,addAssets:Q.addMany,setAsset:Q.setOne,setAssets:Q.setMany,updateAsset:Q.updateOne,updateAssets:Q.updateMany,deleteAsset:Q.deleteOne,deleteAssets:Q.deleteMany}}),{initializeAssets:ld,addAsset:Ys,addAssets:Vt,updateAsset:ut,updateAssets:ZA,deleteAsset:Zs,deleteAssets:Js,setAsset:JA,setAssets:XA}=Ks.actions,Xs=t=>t.assetReducer.instances,hd=d.createSelector([Xs],t=>T(Object.values(t))),Qs=f(d.createSelector([hd,(t,e)=>e],(t,e)=>T(t.filter(i=>i.asset_type===e)))),xs=t=>e=>e.assetReducer.instances[t],md=f(d.createSelector([Xs,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n&&i.push(n)}return T(i)})),QA=t=>e=>Qs(t)(e).length,pd=Ks.reducer,x=P(t=>t.uuid),yd=x.getInitialState({}),ei=d.createSlice({name:"assetStageCompletions",initialState:yd,extraReducers:t=>t.addMatcher(d.isAnyOf(I,M,_),e=>Object.assign(e,yd)),reducers:{initializeAssetStageCompletions:x.initialize,addAssetStageCompletion:x.addOne,addAssetStageCompletions:x.addMany,setAssetStageCompletion:x.setOne,setAssetStageCompletions:x.setMany,updateAssetStageCompletion:x.updateOne,updateAssetStageCompletions:x.updateMany,deleteAssetStageCompletion:x.deleteOne,deleteAssetStageCompletions:x.deleteMany}}),{initializeAssetStageCompletions:Ad,addAssetStageCompletion:ti,addAssetStageCompletions:si,setAssetStageCompletion:xA,setAssetStageCompletions:ef,updateAssetStageCompletion:fd,updateAssetStageCompletions:Sd,deleteAssetStageCompletion:ii,deleteAssetStageCompletions:ai}=ei.actions,Td=ei.reducer,ni=t=>t.assetStageCompletionReducer.instances,tf=d.createSelector([ni],t=>Object.values(t)),gd=t=>e=>e.assetStageCompletionReducer.instances[t],Id=f(d.createSelector([ni,(t,e)=>e],(t,e)=>{const i=new Set(e);return T(Object.values(t).filter(a=>i.has(a.uuid)))})),ee=P(t=>t.uuid),bd=ee.getInitialState({}),ci=d.createSlice({name:"assetStages",initialState:bd,extraReducers:t=>t.addMatcher(d.isAnyOf(I,_),e=>Object.assign(e,bd)),reducers:{initializeAssetStages:ee.initialize,setAssetStage:ee.setOne,setAssetStages:ee.setMany,addAssetStage:ee.addOne,addAssetStages:ee.addMany,updateAssetStage:ee.updateOne,updateAssetStages:ee.updateMany,deleteAssetStage:ee.deleteOne,deleteAssetStages:ee.deleteMany}}),{initializeAssetStages:Fd,setAssetStage:Pd,setAssetStages:sf,addAssetStage:ri,addAssetStages:af,updateAssetStage:jt,updateAssetStages:nf,deleteAssetStage:di,deleteAssetStages:cf}=ci.actions,_d=ci.reducer,qt=t=>t.assetStageReducer.instances,ui=t=>e=>e.assetStageReducer.instances[t],Od=d.createSelector([qt],t=>Object.values(t)),rf=f(d.createSelector([qt,(t,e)=>e],(t,e)=>{const i={};for(const[a,n]of Object.entries(t))n.asset_procedure_type===e&&(i[a]=n);return _t(i)})),df=f(d.createSelector([Od,(t,e)=>e],(t,e)=>T(t.filter(i=>i.asset_procedure_type===e)))),uf=f(d.createSelector([qt,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n?i.push(n):console.warn("selectStagesFromStageIds: No stage exists with the id",a)}return T(i)})),te=P(t=>t.uuid),Rd=te.getInitialState({}),oi=d.createSlice({name:"assetTypeAttachments",initialState:Rd,extraReducers:t=>t.addMatcher(d.isAnyOf(I,_),e=>Object.assign(e,Rd)),reducers:{initializeAssetTypeAttachments:te.initialize,addAssetTypeAttachment:te.addOne,addAssetTypeAttachments:te.addMany,setAssetTypeAttachment:te.setOne,setAssetTypeAttachments:te.setMany,updateAssetTypeAttachment:te.updateOne,updateAssetTypeAttachments:te.updateMany,deleteAssetTypeAttachment:te.deleteOne,deleteAssetTypeAttachments:te.deleteMany}}),{initializeAssetTypeAttachments:li,addAssetTypeAttachment:of,addAssetTypeAttachments:hi,setAssetTypeAttachment:vd,setAssetTypeAttachments:lf,updateAssetTypeAttachment:hf,updateAssetTypeAttachments:wd,deleteAssetTypeAttachment:Md,deleteAssetTypeAttachments:mi}=oi.actions,Ed=t=>t.assetTypeAttachmentReducer.instances,Vd=d.createSelector([Ed],t=>Object.values(t)),jd=t=>e=>e.assetTypeAttachmentReducer.instances[t],qd=f(d.createSelector([Vd,(t,e)=>e],(t,e)=>T(t.filter(({asset_type:i})=>e===i)))),zd=oi.reducer,se=P(t=>t.uuid),Dd=se.getInitialState({}),pi=d.createSlice({name:"assetTypeFieldsAttachments",initialState:Dd,extraReducers:t=>t.addMatcher(d.isAnyOf(I,_),e=>Object.assign(e,Dd)),reducers:{initializeAssetTypeFieldsAttachments:se.initialize,addAssetTypeFieldsAttachment:se.addOne,addAssetTypeFieldsAttachments:se.addMany,setAssetTypeFieldsAttachment:se.setOne,setAssetTypeFieldsAttachments:se.setMany,updateAssetTypeFieldsAttachment:se.updateOne,updateAssetTypeFieldsAttachments:se.updateMany,deleteAssetTypeFieldsAttachment:se.deleteOne,deleteAssetTypeFieldsAttachments:se.deleteMany}}),{initializeAssetTypeFieldsAttachments:Ud,addAssetTypeFieldsAttachment:mf,addAssetTypeFieldsAttachments:Cd,setAssetTypeFieldsAttachment:pf,setAssetTypeFieldsAttachments:yf,updateAssetTypeFieldsAttachment:Af,updateAssetTypeFieldsAttachments:kd,deleteAssetTypeFieldsAttachment:ff,deleteAssetTypeFieldsAttachments:Bd}=pi.actions,$d=t=>t.assetTypeFieldsAttachmentReducer.instances,Gd=d.createSelector([$d],t=>Object.values(t)),Sf=f(d.createSelector([Gd,(t,e)=>e],(t,e)=>T(t.filter(i=>i.fields_revision===e)))),Tf=t=>e=>e.assetTypeFieldsAttachmentReducer.instances[t],Ld=pi.reducer,ie=P(t=>t.uuid),Nd=ie.getInitialState({}),yi=d.createSlice({name:"assetTypeFields",initialState:Nd,extraReducers:t=>t.addMatcher(d.isAnyOf(I,_),e=>Object.assign(e,Nd)),reducers:{initializeAssetTypeFields:ie.initialize,addAssetTypeFields:ie.addOne,addAssetTypeFieldsMany:ie.addMany,setAssetTypeFields:ie.setOne,setAssetTypeFieldsMany:ie.setMany,updateAssetTypeFields:ie.updateOne,updateAssetTypeFieldsMany:ie.updateMany,deleteAssetTypeFields:ie.deleteOne,deleteAssetTypeFieldsMany:ie.deleteMany}}),{initializeAssetTypeFields:Hd,addAssetTypeFields:Wd,addAssetTypeFieldsMany:gf,setAssetTypeFields:If,setAssetTypeFieldsMany:bf,updateAssetTypeFields:Kd,updateAssetTypeFieldsMany:Ff,deleteAssetTypeFields:Yd,deleteAssetTypeFieldsMany:Pf}=yi.actions,Zd=t=>t.assetTypeFieldsReducer.instances,zt=d.createSelector([Zd],t=>Object.values(t)),_f=f(d.createSelector([zt,(t,e)=>e],(t,e)=>T(t.filter(i=>i.asset_type===e)))),Of=f(d.createSelector([zt,(t,e)=>e],(t,e)=>t.filter(i=>i.asset_type===e).sort((i,a)=>i.submitted_at>a.submitted_at?-1:1)[0])),Rf=t=>e=>e.assetTypeFieldsReducer.instances[t],Jd=yi.reducer,ae=P(t=>t.uuid),Xd=ae.getInitialState({}),Ai=d.createSlice({name:"assetTypeFieldValuesAttachments",initialState:Xd,extraReducers:t=>t.addMatcher(d.isAnyOf(I,M,_),e=>Object.assign(e,Xd)),reducers:{initializeAssetTypeFieldValuesAttachments:ae.initialize,addAssetTypeFieldValuesAttachment:ae.addOne,addAssetTypeFieldValuesAttachments:ae.addMany,setAssetTypeFieldValuesAttachment:ae.setOne,setAssetTypeFieldValuesAttachments:ae.setMany,updateAssetTypeFieldValuesAttachment:ae.updateOne,updateAssetTypeFieldValuesAttachments:ae.updateMany,deleteAssetTypeFieldValuesAttachment:ae.deleteOne,deleteAssetTypeFieldValuesAttachments:ae.deleteMany}}),{initializeAssetTypeFieldValuesAttachments:Qd,addAssetTypeFieldValuesAttachment:vf,addAssetTypeFieldValuesAttachments:Dt,setAssetTypeFieldValuesAttachment:wf,setAssetTypeFieldValuesAttachments:Mf,updateAssetTypeFieldValuesAttachment:Ef,updateAssetTypeFieldValuesAttachments:xd,deleteAssetTypeFieldValuesAttachment:Vf,deleteAssetTypeFieldValuesAttachments:Ut}=Ai.actions,fi=t=>t.assetTypeFieldValuesAttachmentReducer.instances,eu=d.createSelector([fi],t=>Object.values(t)),jf=t=>e=>e.assetTypeFieldValuesAttachmentReducer.instances[t],tu=f(d.createSelector([fi,(t,e)=>e],(t,e)=>{const i=new Set(e);return T(Object.values(t).filter(a=>i.has(a.uuid)))})),su=f(d.createSelector([eu,(t,e)=>e],(t,e)=>T(t.filter(i=>i.field_values===e)))),iu=Ai.reducer,ne=P(t=>t.uuid),au=ne.getInitialState({}),Si=d.createSlice({name:"assetTypeFieldValues",initialState:au,extraReducers:t=>t.addMatcher(d.isAnyOf(I,M,_),e=>Object.assign(e,au)),reducers:{initializeAssetTypeFieldValues:ne.initialize,addAssetTypeFieldValues:ne.addOne,addAssetTypeFieldValuesMany:ne.addMany,setAssetTypeFieldValues:ne.setOne,setAssetTypeFieldValuesMany:ne.setMany,updateAssetTypeFieldValues:ne.updateOne,updateAssetTypeFieldValuesMany:ne.updateMany,deleteAssetTypeFieldValues:ne.deleteOne,deleteAssetTypeFieldValuesMany:ne.deleteMany}}),{initializeAssetTypeFieldValues:nu,addAssetTypeFieldValues:Ti,addAssetTypeFieldValuesMany:cu,setAssetTypeFieldValues:qf,setAssetTypeFieldValuesMany:zf,updateAssetTypeFieldValues:ot,updateAssetTypeFieldValuesMany:ru,deleteAssetTypeFieldValues:gi,deleteAssetTypeFieldValuesMany:du}=Si.actions,uu=t=>t.assetTypeFieldValuesReducer.instances,Ii=d.createSelector([uu],t=>Object.values(t)),Df=f(d.createSelector([Ii,(t,e)=>e],(t,e)=>T(t.filter(i=>i.asset===e)))),Uf=f(d.createSelector([zt,Ii,(t,e)=>e],(t,e,i)=>{const a=new Set(t.filter(n=>n.asset_type===i).map(n=>n.uuid));return T(e.filter(n=>a.has(n.fields_revision)))})),bi=t=>e=>e.assetTypeFieldValuesReducer.instances[t],ou=Si.reducer,ce=P(t=>t.uuid),lu=ce.getInitialState({}),Fi=d.createSlice({name:"assetTypeIdentifiers",initialState:lu,extraReducers:t=>t.addMatcher(d.isAnyOf(I,_),e=>Object.assign(e,lu)),reducers:{initializeAssetTypeIdentifiers:ce.initialize,addAssetTypeIdentifier:ce.addOne,addAssetTypeIdentifiers:ce.addMany,setAssetTypeIdentifier:ce.setOne,setAssetTypeIdentifiers:ce.setMany,updateAssetTypeIdentifier:ce.updateOne,updateAssetTypeIdentifiers:ce.updateMany,deleteAssetTypeIdentifier:ce.deleteOne,deleteAssetTypeIdentifiers:ce.deleteMany}}),{initializeAssetTypeIdentifiers:hu,addAssetTypeIdentifier:Pi,addAssetTypeIdentifiers:Cf,setAssetTypeIdentifier:kf,setAssetTypeIdentifiers:Bf,updateAssetTypeIdentifier:lt,updateAssetTypeIdentifiers:$f,deleteAssetTypeIdentifier:_i,deleteAssetTypeIdentifiers:Gf}=Fi.actions,mu=t=>t.assetTypeIdentifierReducer.instances,pu=d.createSelector([mu],t=>Object.values(t)),Oi=t=>e=>e.assetTypeIdentifierReducer.instances[t],Lf=f(d.createSelector([pu,(t,e)=>e],(t,e)=>T(t.filter(i=>i.asset_type===e)))),yu=Fi.reducer,re=P(t=>t.uuid),Au=re.getInitialState({}),Ri=d.createSlice({name:"assetTypeIdentifierValues",initialState:Au,extraReducers:t=>t.addMatcher(d.isAnyOf(I,M,_),e=>Object.assign(e,Au)),reducers:{initializeAssetTypeIdentifierValues:re.initialize,addAssetTypeIdentifierValue:re.addOne,addAssetTypeIdentifierValues:re.addMany,setAssetTypeIdentifierValue:re.setOne,setAssetTypeIdentifierValues:re.setMany,updateAssetTypeIdentifierValue:re.updateOne,updateAssetTypeIdentifierValues:re.updateMany,deleteAssetTypeIdentifierValue:re.deleteOne,deleteAssetTypeIdentifierValues:re.deleteMany}}),{initializeAssetTypeIdentifierValues:fu,addAssetTypeIdentifierValue:vi,addAssetTypeIdentifierValues:Nf,setAssetTypeIdentifierValue:Hf,setAssetTypeIdentifierValues:Wf,updateAssetTypeIdentifierValue:ht,updateAssetTypeIdentifierValues:Kf,deleteAssetTypeIdentifierValue:wi,deleteAssetTypeIdentifierValues:Yf}=Ri.actions,Su=t=>t.assetTypeIdentifierValueReducer.instances,Mi=d.createSelector([Su],t=>Object.values(t)),Ei=t=>e=>e.assetTypeIdentifierValueReducer.instances[t],Zf=f(d.createSelector([Mi,(t,e)=>e],(t,e)=>T(t.filter(i=>i.asset===e)))),Jf=f(d.createSelector([Mi,(t,e)=>e],(t,e)=>T(t.filter(i=>i.asset_type_identifier===e)))),Tu=Ri.reducer,de=P(t=>t.uuid),gu=de.getInitialState({}),Vi=d.createSlice({name:"assetTypes",initialState:gu,extraReducers:t=>t.addMatcher(d.isAnyOf(I,_),e=>Object.assign(e,gu)),reducers:{initializeAssetTypes:de.initialize,setAssetType:de.setOne,setAssetTypes:de.setMany,addAssetType:de.addOne,addAssetTypes:de.addMany,updateAssetType:de.updateOne,updateAssetTypes:de.updateMany,deleteAssetType:de.deleteOne,deleteAssetTypes:de.deleteMany}}),{initializeAssetTypes:Iu,setAssetType:Xf,setAssetTypes:Qf,addAssetType:ji,addAssetTypes:xf,updateAssetType:mt,updateAssetTypes:eS,deleteAssetType:qi,deleteAssetTypes:tS}=Vi.actions,zi=t=>t.assetTypeReducer.instances,bu=d.createSelector([zi],t=>Object.values(t)),Di=t=>e=>e.assetTypeReducer.instances[t],sS=f(d.createSelector([zi,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n?i.push(n):console.warn("selectAssetTypesByIds: No assetType exists with the id",a)}return T(i)})),iS=f(d.createSelector([bu,(t,e)=>e],(t,e)=>T(t.filter(i=>i.organization===e)))),Fu=Vi.reducer,Pu={accessToken:"",refreshToken:"",isLoggedIn:!1},Ct=d.createSlice({name:"auth",initialState:Pu,extraReducers:t=>t.addCase(I,e=>Object.assign(e,Pu)),reducers:{setTokens:(t,e)=>{t.accessToken=e.payload.accessToken,t.refreshToken=e.payload.refreshToken},clearTokens:t=>{t.accessToken="",t.refreshToken=""},setLoggedIn:(t,e)=>{e.payload||Ct.caseReducers.clearTokens(t),t.isLoggedIn=e.payload}}}),{setTokens:aS,clearTokens:nS,setLoggedIn:_u}=Ct.actions,cS=t=>t.authReducer.accessToken,rS=t=>t.authReducer.isLoggedIn,Ou=Ct.reducer,ue=P(t=>t.uuid),Ru=ue.getInitialState({}),Ui=d.createSlice({name:"categories",initialState:Ru,extraReducers:t=>t.addMatcher(d.isAnyOf(I,_),e=>Object.assign(e,Ru)),reducers:{initializeCategories:ue.initialize,addCategory:ue.addOne,addCategories:ue.addMany,setCategory:ue.setOne,setCategories:ue.setMany,updateCategory:ue.updateOne,updateCategories:ue.updateMany,deleteCategory:ue.deleteOne,deleteCategories:ue.deleteMany}}),{initializeCategories:vu,addCategory:Ci,addCategories:dS,setCategory:uS,setCategories:oS,updateCategory:wu,updateCategories:lS,deleteCategory:Mu,deleteCategories:hS}=Ui.actions,ki=t=>t.categoryReducer.instances,Eu=d.createSelector([ki],t=>Object.values(t)),Bi=t=>e=>e.categoryReducer.instances[t],mS=f(d.createSelector([ki,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n?i.push(n):console.warn("selectCategoryByIds: No category exists with the id",a)}return T(i)})),pS=f(d.createSelector([Eu,(t,e)=>e],(t,e)=>T(t.filter(i=>i.project===e)))),Vu=Ui.reducer,oe=P(t=>t.uuid),ju=oe.getInitialState({}),$i=d.createSlice({name:"documentAttachments",initialState:ju,extraReducers:t=>t.addCase(I,e=>Object.assign(e,ju)),reducers:{initializeDocumentAttachments:oe.initialize,addDocumentAttachment:oe.addOne,addDocumentAttachments:oe.addMany,setDocumentAttachment:oe.setOne,setDocumentAttachments:oe.setMany,updateDocumentAttachment:oe.updateOne,updateDocumentAttachments:oe.updateMany,deleteDocumentAttachment:oe.deleteOne,deleteDocumentAttachments:oe.deleteMany}}),{initializeDocumentAttachments:Gi,addDocumentAttachment:yS,addDocumentAttachments:qu,setDocumentAttachment:zu,setDocumentAttachments:AS,updateDocumentAttachment:fS,updateDocumentAttachments:Du,deleteDocumentAttachment:Uu,deleteDocumentAttachments:Cu}=$i.actions,ku=t=>t.documentAttachmentReducer.instances,Bu=d.createSelector([ku],t=>Object.values(t)),$u=t=>e=>e.documentAttachmentReducer.instances[t],SS=f(d.createSelector([Bu,(t,e)=>e],(t,e)=>T(t.filter(({document:i})=>e===i)))),Gu=$i.reducer,Lu={documents:{}},Li=d.createSlice({name:"documents",initialState:Lu,extraReducers:t=>t.addCase(I,e=>{Object.assign(e,Lu)}),reducers:{setDocuments:(t,e)=>{if(e.payload.filter(Ac).length!==e.payload.length)throw new Error("Tried to use setIssues reducer with duplicate ID's");t.documents=pc(e.payload)},addDocuments:(t,e)=>{for(const i of e.payload)if(i.uuid in t.documents)throw new Error(`attempting to add a document with uuid ${i.uuid} which already exists in state.documents.`);for(const i of e.payload){if(i.parent_document&&t.documents[i.parent_document]){const a=t.documents[i.parent_document];t.documents[i.parent_document]={...a,children_documents:[...a.children_documents,i.uuid]}}t.documents[i.uuid]=i}},updateDocuments:(t,e)=>{for(const i of e.payload)if(!(i.uuid in t.documents))throw new Error(`attempting to update a document with uuid ${i.uuid} which doesn't exists in state.documents.`);for(const i of e.payload){const a=t.documents[i.uuid];if(i.organization!==void 0&&i.organization!==a.organization)throw new Error("organization cannot be updated");if(i.project!==void 0&&i.project!==a.project)throw new Error("project cannot be updated");t.documents[i.uuid]={...a,...i}}},removeDocuments:(t,e)=>{for(const i of e.payload)if(!(i in t.documents))throw new Error(`attempting to delete a document with uuid ${i} which doesn't exists in state.documents.`);for(const i of e.payload){const a=t.documents[i];if(a.parent_document&&t.documents[a.parent_document]){const n=t.documents[a.parent_document];t.documents[a.parent_document]={...n,children_documents:n.children_documents.filter(c=>c!==a.uuid)}}delete t.documents[i]}}}}),{setDocuments:Nu,addDocuments:Hu,updateDocuments:Qe,removeDocuments:Ni}=Li.actions,kt=t=>t.documentsReducer.documents,Hi=d.createSelector([kt],t=>Object.values(t)),Wu=t=>e=>e.documentsReducer.documents[t],TS=f(d.createSelector([kt,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n?i.push(n):console.warn("selectDocumentByIds: No document exists with the id",a)}return T(i)})),gS=f(d.createSelector([Hi,(t,e)=>e],(t,e)=>t.filter(i=>i.project===e))),IS=f(d.createSelector([Hi,(t,e)=>e],(t,e)=>t.filter(i=>i.organization===e))),Ku=Li.reducer,le=P(t=>t.uuid),Yu=le.getInitialState({}),Wi=d.createSlice({name:"emailDomains",initialState:Yu,extraReducers:t=>t.addMatcher(d.isAnyOf(I,_),e=>Object.assign(e,Yu)),reducers:{initializeEmailDomains:le.initialize,addEmailDomain:le.addOne,addEmailDomains:le.addMany,setEmailDomain:le.setOne,setEmailDomains:le.setMany,updateEmailDomain:le.updateOne,updateEmailDomains:le.updateMany,deleteEmailDomain:le.deleteOne,deleteEmailDomains:le.deleteMany}}),{initializeEmailDomains:Zu,addEmailDomain:Ju,addEmailDomains:bS,setEmailDomain:FS,setEmailDomains:PS,updateEmailDomain:_S,updateEmailDomains:OS,deleteEmailDomain:Xu,deleteEmailDomains:RS}=Wi.actions,Qu=t=>t.emailDomainsReducer.instances,xu=d.createSelector([Qu],t=>Object.values(t)),vS=f(d.createSelector([xu,(t,e)=>e],(t,e)=>T(t.filter(i=>i.organization===e)))),eo=Wi.reducer,to={s3Urls:{}},so=1e3*60*60,wS=so*24*7,Ki=d.createSlice({name:"file",initialState:to,extraReducers:t=>t.addCase(I,e=>Object.assign(e,to)),reducers:{setUploadUrl:(t,e)=>{const{url:i,fields:a,sha1:n}=e.payload,c=new Date,r=new Date(c.getTime()+wS);t.s3Urls[n]={url:i,fields:a,exp:r.getTime()}}}}),{setUploadUrl:io}=Ki.actions,ao=t=>e=>{const i=e.fileReducer.s3Urls[t];if(!i)return;const a=new Date().getTime();if(!((i.exp??a)-a<so))return i},no=Ki.reducer,he=P(t=>t.uuid),co=he.getInitialState({}),Yi=d.createSlice({name:"formIdentifiers",initialState:co,extraReducers:t=>t.addMatcher(d.isAnyOf(I,_),e=>Object.assign(e,co)),reducers:{initializeFormIdentifiers:he.initialize,addFormIdentifier:he.addOne,addFormIdentifiers:he.addMany,setFormIdentifier:he.setOne,setFormIdentifiers:he.setMany,updateFormIdentifier:he.updateOne,updateFormIdentifiers:he.updateMany,deleteFormIdentifier:he.deleteOne,deleteFormIdentifiers:he.deleteMany}}),{initializeFormIdentifiers:ro,addFormIdentifier:Zi,addFormIdentifiers:MS,setFormIdentifier:ES,setFormIdentifiers:VS,updateFormIdentifier:pt,updateFormIdentifiers:jS,deleteFormIdentifier:Ji,deleteFormIdentifiers:qS}=Yi.actions,uo=t=>t.formIdentifierReducer.instances,oo=d.createSelector([uo],t=>Object.values(t)),Xi=t=>e=>e.formIdentifierReducer.instances[t],zS=f(d.createSelector([oo,(t,e)=>e],(t,e)=>T(t.filter(i=>i.form===e)))),lo=Yi.reducer,me=P(t=>t.uuid),ho=me.getInitialState({}),Qi=d.createSlice({name:"formIdentifierValues",initialState:ho,extraReducers:t=>t.addMatcher(d.isAnyOf(I,_),e=>Object.assign(e,ho)),reducers:{initializeFormIdentifierValues:me.initialize,addFormIdentifierValue:me.addOne,addFormIdentifierValues:me.addMany,setFormIdentifierValue:me.setOne,setFormIdentifierValues:me.setMany,updateFormIdentifierValue:me.updateOne,updateFormIdentifierValues:me.updateMany,deleteFormIdentifierValue:me.deleteOne,deleteFormIdentifierValues:me.deleteMany}}),{initializeFormIdentifierValues:mo,addFormIdentifierValue:xi,addFormIdentifierValues:DS,setFormIdentifierValue:US,setFormIdentifierValues:CS,updateFormIdentifierValue:yt,updateFormIdentifierValues:kS,deleteFormIdentifierValue:ea,deleteFormIdentifierValues:BS}=Qi.actions,po=t=>t.formIdentifierValueReducer.instances,ta=d.createSelector([po],t=>Object.values(t)),sa=t=>e=>e.formIdentifierValueReducer.instances[t],$S=f(d.createSelector([ta,(t,e)=>e],(t,e)=>T(t.filter(i=>i.form_submission===e)))),GS=f(d.createSelector([ta,(t,e)=>e],(t,e)=>T(t.filter(i=>i.form_identifier===e)))),yo=Qi.reducer,pe=P(t=>t.uuid),Ao=pe.getInitialState({}),ia=d.createSlice({name:"formRevisionAttachments",initialState:Ao,extraReducers:t=>t.addMatcher(d.isAnyOf(I,_),e=>Object.assign(e,Ao)),reducers:{initializeFormRevisionAttachments:pe.initialize,addFormRevisionAttachment:pe.addOne,addFormRevisionAttachments:pe.addMany,setFormRevisionAttachment:pe.setOne,setFormRevisionAttachments:pe.setMany,updateFormRevisionAttachment:pe.updateOne,updateFormRevisionAttachments:pe.updateMany,deleteFormRevisionAttachment:pe.deleteOne,deleteFormRevisionAttachments:pe.deleteMany}}),{initializeFormRevisionAttachments:fo,addFormRevisionAttachment:LS,addFormRevisionAttachments:So,setFormRevisionAttachment:NS,setFormRevisionAttachments:HS,updateFormRevisionAttachment:WS,updateFormRevisionAttachments:To,deleteFormRevisionAttachment:KS,deleteFormRevisionAttachments:go}=ia.actions,Io=t=>t.formRevisionAttachmentReducer.instances,YS=f(d.createSelector([Io,(t,e)=>e],(t,e)=>T(Object.values(t).filter(i=>i.form_revision===e)))),bo=ia.reducer,ye=P(t=>t.uuid),Fo=ye.getInitialState({}),aa=d.createSlice({name:"formRevisions",initialState:Fo,extraReducers:t=>t.addMatcher(d.isAnyOf(I,_),e=>Object.assign(e,Fo)),reducers:{initializeFormRevisions:ye.initialize,addFormRevision:ye.addOne,addFormRevisions:ye.addMany,setFormRevision:ye.setOne,setFormRevisions:ye.setMany,updateFormRevision:ye.updateOne,updateFormRevisions:ye.updateMany,deleteFormRevision:ye.deleteOne,deleteFormRevisions:ye.deleteMany}}),{initializeFormRevisions:Po,addFormRevision:na,addFormRevisions:_o,setFormRevision:Oo,setFormRevisions:ZS,updateFormRevision:JS,updateFormRevisions:XS,deleteFormRevision:ca,deleteFormRevisions:Ro}=aa.actions,ra=t=>t.formRevisionReducer.instances,da=d.createSelector([ra],t=>Object.values(t)),QS=t=>e=>e.formRevisionReducer.instances[t],xS=f(d.createSelector([da,(t,e)=>e],(t,e)=>t.filter(i=>i.form===e).sort((i,a)=>i.submitted_at>a.submitted_at?-1:1)[0])),vo=f(d.createSelector([da,(t,e)=>e],(t,e)=>T(t.filter(i=>i.form===e)))),wo=aa.reducer,Ae=P(t=>t.uuid),Mo=Ae.getInitialState({}),ua=d.createSlice({name:"forms",initialState:Mo,extraReducers:t=>t.addMatcher(d.isAnyOf(I,_),e=>Object.assign(e,Mo)),reducers:{initializeForms:Ae.initialize,addForm:Ae.addOne,addForms:Ae.addMany,setForm:Ae.setOne,setForms:Ae.setMany,updateForm:Ae.updateOne,updateForms:Ae.updateMany,deleteForm:Ae.deleteOne,deleteForms:Ae.deleteMany}}),{initializeForms:Eo,addForm:oa,addForms:eT,setForm:tT,setForms:sT,updateForm:iT,updateForms:aT,deleteForm:la,deleteForms:nT}=ua.actions,Vo=ua.reducer,jo=t=>t.formReducer.instances,qo=d.createSelector([jo],t=>Object.values(t)),zo=t=>e=>e.formReducer.instances[t],cT=f(d.createSelector([qo,(t,e)=>e],(t,e)=>T(t.filter(i=>i.organization===e)))),fe=P(t=>t.uuid),Do=fe.getInitialState({}),ha=d.createSlice({name:"formSubmissionAttachments",initialState:Do,extraReducers:t=>t.addMatcher(d.isAnyOf(I,_),e=>Object.assign(e,Do)),reducers:{initializeFormSubmissionAttachments:fe.initialize,addFormSubmissionAttachment:fe.addOne,addFormSubmissionAttachments:fe.addMany,setFormSubmissionAttachment:fe.setOne,setFormSubmissionAttachments:fe.setMany,updateFormSubmissionAttachment:fe.updateOne,updateFormSubmissionAttachments:fe.updateMany,deleteFormSubmissionAttachment:fe.deleteOne,deleteFormSubmissionAttachments:fe.deleteMany}}),{initializeFormSubmissionAttachments:Uo,addFormSubmissionAttachment:rT,addFormSubmissionAttachments:Bt,setFormSubmissionAttachment:dT,setFormSubmissionAttachments:uT,updateFormSubmissionAttachment:oT,updateFormSubmissionAttachments:Co,deleteFormSubmissionAttachment:lT,deleteFormSubmissionAttachments:$t}=ha.actions,ko=t=>t.formSubmissionAttachmentReducer.instances,ma=d.createSelector([ko],t=>Object.values(t)),Bo=f(d.createSelector([ma,(t,e)=>e],(t,e)=>{const i=new Set(e);return T(t.filter(a=>i.has(a.uuid)))})),$o=f(d.createSelector([ma,(t,e)=>e],(t,e)=>T(t.filter(i=>i.form_submission===e)))),Go=ha.reducer,Se=P(t=>t.uuid),Lo=Se.getInitialState({}),pa=d.createSlice({name:"formSubmissions",initialState:Lo,extraReducers:t=>t.addMatcher(d.isAnyOf(I,_),e=>Object.assign(e,Lo)),reducers:{initializeFormSubmissions:Se.initialize,setFormSubmission:Se.setOne,setFormSubmissions:Se.setMany,addFormSubmission:Se.addOne,addFormSubmissions:Se.addMany,updateFormSubmission:Se.updateOne,updateFormSubmissions:Se.updateMany,deleteFormSubmission:Se.deleteOne,deleteFormSubmissions:Se.deleteMany}}),{initializeFormSubmissions:No,setFormSubmission:Gt,setFormSubmissions:hT,addFormSubmission:ya,addFormSubmissions:Ho,updateFormSubmission:Wo,updateFormSubmissions:mT,deleteFormSubmission:Aa,deleteFormSubmissions:Ko}=pa.actions,fa=t=>t.formSubmissionReducer.instances,pT=d.createSelector([fa],t=>Object.values(t)),Sa=t=>e=>e.formSubmissionReducer.instances[t],Yo=f(d.createSelector([fa,ra,(t,e)=>e],(t,e,i)=>{const a=new Set;for(const n of Object.values(e))n.form===i&&a.add(n.uuid);return Object.values(t).filter(n=>a.has(n.form_revision))})),Zo=pa.reducer,Te=P(t=>t.uuid),Jo=Te.getInitialState({}),Ta=d.createSlice({name:"geoImages",initialState:Jo,extraReducers:t=>t.addMatcher(d.isAnyOf(I,M,_),e=>Object.assign(e,Jo)),reducers:{initializeGeoImages:Te.initialize,setGeoImage:Te.setOne,setGeoImages:Te.setMany,addGeoImage:Te.addOne,addGeoImages:Te.addMany,updateGeoImage:Te.updateOne,updateGeoImages:Te.updateMany,deleteGeoImage:Te.deleteOne,deleteGeoImages:Te.deleteMany}}),{initializeGeoImages:Xo,setGeoImage:At,setGeoImages:Qo,addGeoImage:xo,addGeoImages:el,updateGeoImage:tl,updateGeoImages:yT,deleteGeoImage:ga,deleteGeoImages:sl}=Ta.actions,il=t=>t.geoImageReducer.instances,al=d.createSelector([il],t=>Object.values(t)),Ia=t=>e=>e.geoImageReducer.instances[t],AT=f(d.createSelector([al,(t,e)=>e],(t,e)=>T(t.filter(i=>i.project===e)))),nl=Ta.reducer,ge=P(t=>t.uuid),cl=ge.getInitialState({}),ba=d.createSlice({name:"issueAssociations",initialState:cl,extraReducers:t=>t.addMatcher(d.isAnyOf(I,M,_),e=>Object.assign(e,cl)),reducers:{initializeIssueAssociations:ge.initialize,addIssueAssociation:ge.addOne,addIssueAssociations:ge.addMany,setIssueAssociation:ge.setOne,setIssueAssociations:ge.setMany,updateIssueAssociation:ge.updateOne,updateIssueAssociations:ge.updateMany,deleteIssueAssociation:ge.deleteOne,deleteIssueAssociations:ge.deleteMany}}),{initializeIssueAssociations:rl,setIssueAssociations:fT,setIssueAssociation:ST,updateIssueAssociation:dl,updateIssueAssociations:TT,addIssueAssociation:Fa,addIssueAssociations:Pa,deleteIssueAssociation:_a,deleteIssueAssociations:Oa}=ba.actions,ft=t=>t.issueAssociationReducer.instances,gT=d.createSelector([ft],t=>Object.values(t)),ul=t=>e=>e.issueAssociationReducer.instances[t],ol=f(d.createSelector([ft,(t,e)=>e],(t,e)=>T(Object.values(t).filter(i=>i.associated_issue===e)))),ll=f(d.createSelector([ft,(t,e)=>e],(t,e)=>T(Object.values(t).filter(i=>i.issue===e)))),hl=f(d.createSelector([ft,(t,e)=>e],(t,e)=>T(Object.values(t).filter(i=>i.asset===e)))),ml=ba.reducer,Ie=P(t=>t.uuid),pl=Ie.getInitialState({}),Ra=d.createSlice({name:"issueAttachments",initialState:pl,extraReducers:t=>t.addMatcher(d.isAnyOf(I,M,_),e=>Object.assign(e,pl)),reducers:{initializeIssueAttachments:Ie.initialize,addIssueAttachment:Ie.addOne,addIssueAttachments:Ie.addMany,setIssueAttachment:Ie.setOne,setIssueAttachments:Ie.setMany,updateIssueAttachment:Ie.updateOne,updateIssueAttachments:Ie.updateMany,deleteIssueAttachment:Ie.deleteOne,deleteIssueAttachments:Ie.deleteMany}}),{initializeIssueAttachments:va,addIssueAttachment:IT,addIssueAttachments:wa,setIssueAttachment:yl,setIssueAttachments:bT,updateIssueAttachment:FT,updateIssueAttachments:Al,deleteIssueAttachment:fl,deleteIssueAttachments:Ma}=Ra.actions,Sl=t=>t.issueAttachmentReducer.instances,Tl=d.createSelector([Sl],t=>Object.values(t)),gl=f(d.createSelector([Tl,(t,e)=>e],(t,e)=>T(t.filter(({issue:i})=>e===i)))),Il=t=>e=>e.issueAttachmentReducer.instances[t],bl=Ra.reducer,be=P(t=>t.uuid),Fl=be.getInitialState({}),Ea=d.createSlice({name:"issueCommentAttachments",initialState:Fl,extraReducers:t=>t.addMatcher(d.isAnyOf(I,M,_),e=>Object.assign(e,Fl)),reducers:{initializeIssueCommentAttachments:be.initialize,addIssueCommentAttachment:be.addOne,addIssueCommentAttachments:be.addMany,setIssueCommentAttachment:be.setOne,setIssueCommentAttachments:be.setMany,updateIssueCommentAttachment:be.updateOne,updateIssueCommentAttachments:be.updateMany,deleteIssueCommentAttachment:be.deleteOne,deleteIssueCommentAttachments:be.deleteMany}}),{initializeIssueCommentAttachments:Va,addIssueCommentAttachment:PT,addIssueCommentAttachments:Pl,setIssueCommentAttachment:_l,setIssueCommentAttachments:_T,updateIssueCommentAttachment:OT,updateIssueCommentAttachments:Ol,deleteIssueCommentAttachment:Rl,deleteIssueCommentAttachments:vl}=Ea.actions,wl=t=>t.issueCommentAttachmentReducer.instances,Ml=d.createSelector([wl],t=>Object.values(t)),El=t=>e=>e.issueCommentAttachmentReducer.instances[t],RT=f(d.createSelector([Ml,(t,e)=>e],(t,e)=>T(t.filter(({issue_comment:i})=>e===i)))),Vl=Ea.reducer,Fe=P(t=>t.uuid),jl=Fe.getInitialState({}),ja=d.createSlice({name:"issueComments",initialState:jl,extraReducers:t=>t.addMatcher(d.isAnyOf(I,M,_),e=>Object.assign(e,jl)),reducers:{initializeIssueComments:Fe.initialize,addIssueComment:Fe.addOne,addIssueComments:Fe.addMany,setIssueComment:Fe.setOne,setIssueComments:Fe.setMany,updateIssueComment:Fe.updateOne,updateIssueComments:Fe.updateMany,deleteIssueComment:Fe.deleteOne,deleteIssueComments:Fe.deleteMany}}),{initializeIssueComments:vT,addIssueComment:qa,addIssueComments:wT,setIssueComment:za,setIssueComments:ql,updateIssueComment:MT,updateIssueComments:ET,deleteIssueComment:Da,deleteIssueComments:VT}=ja.actions,zl=t=>t.issueCommentReducer.instances,Ua=t=>e=>e.issueCommentReducer.instances[t],jT=f(d.createSelector([zl,(t,e)=>e],(t,e)=>T(Object.values(t).filter(i=>i.issue===e)))),Dl=ja.reducer,Pe=P(t=>t.uuid),Ul=Pe.getInitialState({}),Ca=d.createSlice({name:"issues",initialState:Ul,extraReducers:t=>t.addMatcher(d.isAnyOf(I,M,_),e=>Object.assign(e,Ul)),reducers:{initializeIssues:Pe.initialize,addIssue:Pe.addOne,addIssues:Pe.addMany,setIssue:Pe.setOne,setIssues:Pe.setMany,updateIssue:Pe.updateOne,updateIssues:Pe.updateMany,deleteIssue:Pe.deleteOne,deleteIssues:Pe.deleteMany}}),{initializeIssues:Cl,addIssue:ka,addIssues:kl,setIssue:qT,setIssues:zT,updateIssue:Lt,updateIssues:DT,deleteIssue:Ba,deleteIssues:Bl}=Ca.actions,$a=t=>t.issueReducer.instances,Ga=d.createSelector([$a],t=>Object.values(t)),La=t=>e=>e.issueReducer.instances[t],UT=f(d.createSelector([$a,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n?i.push(n):console.warn("selectIssuesByIds: No issue exists with the id",a)}return T(i)})),CT=f(d.createSelector([Ga,(t,e)=>e],(t,e)=>t.filter(i=>i.project===e))),$l=f(d.createSelector([Ga,(t,e)=>e],(t,e)=>t.filter(i=>i.issue_type===e))),Gl=Ca.reducer,_e=P(t=>t.uuid),Ll=_e.getInitialState({}),Na=d.createSlice({name:"issueTypeAttachments",initialState:Ll,extraReducers:t=>t.addMatcher(d.isAnyOf(I,_),e=>Object.assign(e,Ll)),reducers:{initializeIssueTypeAttachments:_e.initialize,addIssueTypeAttachment:_e.addOne,addIssueTypeAttachments:_e.addMany,setIssueTypeAttachment:_e.setOne,setIssueTypeAttachments:_e.setMany,updateIssueTypeAttachment:_e.updateOne,updateIssueTypeAttachments:_e.updateMany,deleteIssueTypeAttachment:_e.deleteOne,deleteIssueTypeAttachments:_e.deleteMany}}),{initializeIssueTypeAttachments:Ha,addIssueTypeAttachment:kT,addIssueTypeAttachments:Nl,setIssueTypeAttachment:Hl,setIssueTypeAttachments:BT,updateIssueTypeAttachment:$T,updateIssueTypeAttachments:Wl,deleteIssueTypeAttachment:Kl,deleteIssueTypeAttachments:Yl}=Na.actions,Zl=t=>t.issueTypeAttachmentReducer.instances,Jl=d.createSelector([Zl],t=>Object.values(t)),Xl=t=>e=>e.issueTypeAttachmentReducer.instances[t],GT=f(d.createSelector([Jl,(t,e)=>e],(t,e)=>T(t.filter(({issue_type:i})=>e===i)))),Ql=Na.reducer,Oe=P(t=>t.uuid),xl=Oe.getInitialState({}),Wa=d.createSlice({name:"issueTypeFieldsAttachments",initialState:xl,extraReducers:t=>t.addMatcher(d.isAnyOf(I,_),e=>Object.assign(e,xl)),reducers:{initializeIssueTypeFieldsAttachments:Oe.initialize,addIssueTypeFieldsAttachment:Oe.addOne,addIssueTypeFieldsAttachments:Oe.addMany,setIssueTypeFieldsAttachment:Oe.setOne,setIssueTypeFieldsAttachments:Oe.setMany,updateIssueTypeFieldsAttachment:Oe.updateOne,updateIssueTypeFieldsAttachments:Oe.updateMany,deleteIssueTypeFieldsAttachment:Oe.deleteOne,deleteIssueTypeFieldsAttachments:Oe.deleteMany}}),{initializeIssueTypeFieldsAttachments:eh,addIssueTypeFieldsAttachment:LT,addIssueTypeFieldsAttachments:th,setIssueTypeFieldsAttachment:NT,setIssueTypeFieldsAttachments:HT,updateIssueTypeFieldsAttachment:WT,updateIssueTypeFieldsAttachments:sh,deleteIssueTypeFieldsAttachment:KT,deleteIssueTypeFieldsAttachments:ih}=Wa.actions,ah=t=>t.issueTypeFieldsAttachmentReducer.instances,nh=d.createSelector([ah],t=>Object.values(t)),YT=f(d.createSelector([nh,(t,e)=>e],(t,e)=>T(t.filter(i=>i.fields_revision===e)))),ZT=t=>e=>e.issueTypeFieldsAttachmentReducer.instances[t],ch=Wa.reducer,Re=P(t=>t.uuid),rh=Re.getInitialState({}),Ka=d.createSlice({name:"issueTypeFieldValues",initialState:rh,extraReducers:t=>t.addMatcher(d.isAnyOf(I,M,_),e=>Object.assign(e,rh)),reducers:{initializeIssueTypeFieldValues:Re.initialize,addIssueTypeFieldValues:Re.addOne,addIssueTypeFieldValuesMany:Re.addMany,setIssueTypeFieldValues:Re.setOne,setIssueTypeFieldValuesMany:Re.setMany,updateIssueTypeFieldValues:Re.updateOne,updateIssueTypeFieldValuesMany:Re.updateMany,deleteIssueTypeFieldValues:Re.deleteOne,deleteIssueTypeFieldValuesMany:Re.deleteMany}}),{initializeIssueTypeFieldValues:dh,addIssueTypeFieldValues:Ya,addIssueTypeFieldValuesMany:JT,setIssueTypeFieldValues:XT,setIssueTypeFieldValuesMany:QT,updateIssueTypeFieldValues:St,updateIssueTypeFieldValuesMany:xT,deleteIssueTypeFieldValues:Za,deleteIssueTypeFieldValuesMany:eg}=Ka.actions,uh=t=>t.issueTypeFieldValuesReducer.instances,Ja=d.createSelector([uh],t=>Object.values(t)),tg=f(d.createSelector([Ja,(t,e)=>e],(t,e)=>T(t.filter(i=>i.issue===e)))),Xa=t=>e=>e.issueTypeFieldValuesReducer.instances[t],oh=Ka.reducer,ve=P(t=>t.uuid),lh=ve.getInitialState({}),Qa=d.createSlice({name:"issueTypeFields",initialState:lh,extraReducers:t=>t.addMatcher(d.isAnyOf(I,_),e=>Object.assign(e,lh)),reducers:{initializeIssueTypeFields:ve.initialize,addIssueTypeFields:ve.addOne,addIssueTypeFieldsMany:ve.addMany,setIssueTypeFields:ve.setOne,setIssueTypeFieldsMany:ve.setMany,updateIssueTypeFields:ve.updateOne,updateIssueTypeFieldsMany:ve.updateMany,deleteIssueTypeFields:ve.deleteOne,deleteIssueTypeFieldsMany:ve.deleteMany}}),{initializeIssueTypeFields:hh,addIssueTypeFields:mh,addIssueTypeFieldsMany:sg,setIssueTypeFields:ig,setIssueTypeFieldsMany:ag,updateIssueTypeFields:ph,updateIssueTypeFieldsMany:ng,deleteIssueTypeFields:yh,deleteIssueTypeFieldsMany:cg}=Qa.actions,Ah=t=>t.issueTypeFieldsReducer.instances,Nt=d.createSelector([Ah],t=>Object.values(t)),rg=f(d.createSelector([Nt,(t,e)=>e],(t,e)=>T(t.filter(i=>i.issue_type===e)))),dg=f(d.createSelector([Nt,(t,e)=>e],(t,e)=>t.filter(i=>i.issue_type===e).sort((i,a)=>i.submitted_at>a.submitted_at?-1:1)[0])),ug=f(d.createSelector([Nt,Ja,(t,e)=>e],(t,e,i)=>{const a=new Set(t.filter(n=>n.issue_type===i).map(n=>n.uuid));return T(e.filter(n=>a.has(n.fields_revision)))})),og=t=>e=>e.issueTypeFieldsReducer.instances[t],fh=Qa.reducer,we=P(t=>t.uuid),Sh=we.getInitialState({}),xa=d.createSlice({name:"issueTypeFieldValuesAttachments",initialState:Sh,extraReducers:t=>t.addMatcher(d.isAnyOf(I,M,_),e=>Object.assign(e,Sh)),reducers:{initializeIssueTypeFieldValuesAttachments:we.initialize,addIssueTypeFieldValuesAttachment:we.addOne,addIssueTypeFieldValuesAttachments:we.addMany,setIssueTypeFieldValuesAttachment:we.setOne,setIssueTypeFieldValuesAttachments:we.setMany,updateIssueTypeFieldValuesAttachment:we.updateOne,updateIssueTypeFieldValuesAttachments:we.updateMany,deleteIssueTypeFieldValuesAttachment:we.deleteOne,deleteIssueTypeFieldValuesAttachments:we.deleteMany}}),{initializeIssueTypeFieldValuesAttachments:Th,addIssueTypeFieldValuesAttachment:lg,addIssueTypeFieldValuesAttachments:Ht,setIssueTypeFieldValuesAttachment:hg,setIssueTypeFieldValuesAttachments:mg,updateIssueTypeFieldValuesAttachment:pg,updateIssueTypeFieldValuesAttachments:gh,deleteIssueTypeFieldValuesAttachment:yg,deleteIssueTypeFieldValuesAttachments:Wt}=xa.actions,Ih=t=>t.issueTypeFieldValuesAttachmentReducer.instances,en=d.createSelector([Ih],t=>Object.values(t)),Ag=t=>e=>e.issueTypeFieldValuesAttachmentReducer.instances[t],bh=f(d.createSelector([en,(t,e)=>e],(t,e)=>{const i=new Set(e);return T(t.filter(a=>i.has(a.uuid)))})),Fh=f(d.createSelector([en,(t,e)=>e],(t,e)=>T(t.filter(i=>i.field_values===e)))),Ph=xa.reducer,Me=P(t=>t.uuid),_h=Me.getInitialState({}),tn=d.createSlice({name:"issueTypeIdentifiers",initialState:_h,extraReducers:t=>t.addMatcher(d.isAnyOf(I,_),e=>Object.assign(e,_h)),reducers:{initializeIssueTypeIdentifiers:Me.initialize,addIssueTypeIdentifier:Me.addOne,addIssueTypeIdentifiers:Me.addMany,setIssueTypeIdentifier:Me.setOne,setIssueTypeIdentifiers:Me.setMany,updateIssueTypeIdentifier:Me.updateOne,updateIssueTypeIdentifiers:Me.updateMany,deleteIssueTypeIdentifier:Me.deleteOne,deleteIssueTypeIdentifiers:Me.deleteMany}}),{initializeIssueTypeIdentifiers:Oh,addIssueTypeIdentifier:sn,addIssueTypeIdentifiers:fg,setIssueTypeIdentifier:Sg,setIssueTypeIdentifiers:Tg,updateIssueTypeIdentifier:Tt,updateIssueTypeIdentifiers:gg,deleteIssueTypeIdentifier:an,deleteIssueTypeIdentifiers:Ig}=tn.actions,Rh=t=>t.issueTypeIdentifierReducer.instances,vh=d.createSelector([Rh],t=>Object.values(t)),nn=t=>e=>e.issueTypeIdentifierReducer.instances[t],bg=f(d.createSelector([vh,(t,e)=>e],(t,e)=>T(t.filter(i=>i.issue_type===e)))),wh=tn.reducer,Ee=P(t=>t.uuid),Mh=Ee.getInitialState({}),cn=d.createSlice({name:"issueTypeIdentifierValues",initialState:Mh,extraReducers:t=>t.addMatcher(d.isAnyOf(I,M,_),e=>Object.assign(e,Mh)),reducers:{initializeIssueTypeIdentifierValues:Ee.initialize,addIssueTypeIdentifierValue:Ee.addOne,addIssueTypeIdentifierValues:Ee.addMany,setIssueTypeIdentifierValue:Ee.setOne,setIssueTypeIdentifierValues:Ee.setMany,updateIssueTypeIdentifierValue:Ee.updateOne,updateIssueTypeIdentifierValues:Ee.updateMany,deleteIssueTypeIdentifierValue:Ee.deleteOne,deleteIssueTypeIdentifierValues:Ee.deleteMany}}),{initializeIssueTypeIdentifierValues:Eh,addIssueTypeIdentifierValue:rn,addIssueTypeIdentifierValues:Fg,setIssueTypeIdentifierValue:Pg,setIssueTypeIdentifierValues:_g,updateIssueTypeIdentifierValue:gt,updateIssueTypeIdentifierValues:Og,deleteIssueTypeIdentifierValue:dn,deleteIssueTypeIdentifierValues:Rg}=cn.actions,Vh=t=>t.issueTypeIdentifierValueReducer.instances,un=d.createSelector([Vh],t=>Object.values(t)),on=t=>e=>e.issueTypeIdentifierValueReducer.instances[t],vg=f(d.createSelector([un,(t,e)=>e],(t,e)=>T(t.filter(i=>i.issue===e)))),wg=f(d.createSelector([un,(t,e)=>e],(t,e)=>T(t.filter(i=>i.issue_type_identifier===e)))),jh=cn.reducer,U=P(t=>t.uuid),qh=U.getInitialState({}),ln=d.createSlice({name:"issueTypes",initialState:qh,extraReducers:t=>t.addMatcher(d.isAnyOf(I,_),e=>Object.assign(e,qh)),reducers:{initializeIssueTypes:U.initialize,addIssueType:U.addOne,addIssueTypes:U.addMany,setIssueType:U.setOne,setIssueTypes:U.setMany,updateIssueType:U.updateOne,updateIssueTypes:U.updateMany,deleteIssueType:U.deleteOne,deleteIssueTypes:U.deleteMany,removeIssueType:U.deleteOne}}),{initializeIssueTypes:zh,addIssueType:Dh,addIssueTypes:Mg,setIssueType:It,setIssueTypes:Eg,updateIssueType:Uh,updateIssueTypes:Vg,deleteIssueType:jg,deleteIssueTypes:qg,removeIssueType:hn}=ln.actions,mn=t=>t.issueTypeReducer.instances,Ch=d.createSelector(mn,t=>Object.values(t)),pn=t=>e=>e.issueTypeReducer.instances[t],zg=f(d.createSelector([mn,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n?i.push(n):console.warn("selectIssueTypesByIds: No issue type exists with the id",a)}return i})),Dg=f(d.createSelector([Ch,(t,e)=>e],(t,e)=>T(t.filter(i=>i.organization===e)))),kh=ln.reducer,Ve=P(t=>t.uuid),Bh=Ve.getInitialState({}),yn=d.createSlice({name:"issueUpdates",initialState:Bh,extraReducers:t=>t.addMatcher(d.isAnyOf(I,M,_),e=>Object.assign(e,Bh)),reducers:{initializeIssueUpdates:Ve.initialize,addIssueUpdate:Ve.addOne,addIssueUpdates:Ve.addMany,setIssueUpdate:Ve.setOne,setIssueUpdates:Ve.setMany,updateIssueUpdate:Ve.updateOne,updateIssueUpdates:Ve.updateMany,deleteIssueUpdate:Ve.deleteOne,deleteIssueUpdates:Ve.deleteMany}}),{initializeIssueUpdates:$h,addIssueUpdate:Gh,addIssueUpdates:Lh,setIssueUpdate:Ug,setIssueUpdates:Cg,updateIssueUpdate:kg,updateIssueUpdates:Bg,deleteIssueUpdate:Nh,deleteIssueUpdates:Hh}=yn.actions,Wh=t=>t.issueUpdateReducer.instances,Kh=d.createSelector([Wh],t=>Object.values(t)),Yh=f(d.createSelector([Kh,(t,e)=>e],(t,e)=>T(t.filter(i=>i.issue===e)))),Zh=yn.reducer,je=P(t=>t.id),Jh=je.getInitialState({currentUser:null}),An=d.createSlice({name:"users",initialState:Jh,extraReducers:t=>t.addMatcher(d.isAnyOf(I,_),e=>Object.assign(e,Jh)),reducers:{initializeUsers:je.initialize,setUsers:je.setMany,setUser:je.setOne,addUsers:je.addMany,addUser:je.addOne,updateUsers:je.updateMany,updateUser:je.updateOne,deleteUser:je.deleteOne,deleteUsers:je.deleteMany,setCurrentUser:(t,e)=>{t.currentUser=e.payload},setProfilePicture:(t,e)=>{if(!t.currentUser)return;t.currentUser.profile.file=e.payload.file??null,t.currentUser.profile.file_sha1=e.payload.file_sha1??null;const i=t.instances[t.currentUser.id];if(!i)throw new Error("Unable to find current user in users slice");i.profile.file=e.payload.file??null,i.profile.file_sha1=e.payload.file_sha1??null}}}),{initializeUsers:Xh,setUsers:$g,setUser:Gg,addUsers:Lg,addUser:Qh,updateUsers:Ng,updateUser:Hg,deleteUser:xh,deleteUsers:Wg,setCurrentUser:Kg,setProfilePicture:Yg}=An.actions,em=An.reducer,tm=t=>t.userReducer.currentUser,Kt=t=>t.userReducer.instances,fn=d.createSelector([Kt],t=>Object.values(t)),sm=t=>e=>e.userReducer.instances[t],Zg=f(d.createSelector([Kt,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n?i.push(n):console.warn("selectUsersByIds: No user exists with the id",a)}return T(i)})),qe=P(t=>t.uuid),im=qe.getInitialState({}),Sn=d.createSlice({name:"organizationAccess",initialState:im,extraReducers:t=>t.addMatcher(d.isAnyOf(I,_),e=>Object.assign(e,im)),reducers:{initializeOrganizationAccesses:qe.initialize,addOrganizationAccess:qe.addOne,addOrganizationAccesses:qe.addMany,setOrganizationAccess:qe.setOne,setOrganizationAccesses:qe.setMany,updateOrganizationAccess:qe.updateOne,updateOrganizationAccesses:qe.updateMany,deleteOrganizationAccess:qe.deleteOne,deleteOrganizationAccesses:qe.deleteMany}}),{initializeOrganizationAccesses:am,addOrganizationAccess:nm,addOrganizationAccesses:Jg,setOrganizationAccess:Xg,setOrganizationAccesses:Qg,updateOrganizationAccess:Yt,updateOrganizationAccesses:xg,deleteOrganizationAccess:cm,deleteOrganizationAccesses:eI}=Sn.actions,rm=Sn.reducer,Tn=t=>t.organizationAccessReducer.instances,gn=t=>e=>e.organizationAccessReducer.instances[t],tI=d.createSelector([tm,Tn],(t,e)=>Object.values(e).find(a=>a.user===(t==null?void 0:t.id))??null),dm=d.createSelector([Tn],t=>{const e={};for(const i of Object.values(t))e[i.user]=i;return _t(e)}),sI=f(d.createSelector([Kt,dm,(t,e)=>e],(t,e,i)=>T(Object.values(t).filter(a=>{const n=e[a.id];return!!n&&n.organization===i})))),ze=P(t=>t.uuid),um=ze.getInitialState({}),In=d.createSlice({name:"organizations",initialState:um,extraReducers:t=>t.addMatcher(d.isAnyOf(I,_),e=>Object.assign(e,um)),reducers:{initializeOrganizations:ze.initialize,setOrganizations:ze.setMany,setOrganization:ze.setOne,addOrganizations:ze.addMany,addOrganization:ze.addOne,updateOrganizations:ze.updateMany,updateOrganization:ze.updateOne,deleteOrganization:ze.deleteOne,deleteOrganizations:ze.deleteMany}}),{initializeOrganizations:om,setOrganizations:iI,setOrganization:aI,addOrganizations:nI,addOrganization:lm,updateOrganizations:cI,updateOrganization:hm,deleteOrganization:rI,deleteOrganizations:dI}=In.actions,mm=t=>t.organizationReducer.instances,uI=d.createSelector([mm],t=>Object.values(t)),oI=t=>e=>e.organizationReducer.instances[t],pm=In.reducer,ym=(t,e,i)=>{const a=t.uuid?t:{...t,uuid:Je.v4()};return{payload:a,type:"",meta:{offline:{effect:{timestamp:new Date().toISOString(),request:a,BASE_URL:e,serviceName:i}}}}},Am={deletedRequests:[],latestRetryTime:0},bn=d.createSlice({name:"outbox",initialState:Am,extraReducers:t=>t.addCase(I,e=>Object.assign(e,Am)),reducers:{enqueueRequest:{reducer:(t,e)=>t,prepare:t=>{console.debug("Preparing to enqueue request",t);const{BASE_URL:e,serviceName:i,...a}=t;return ym(a,e,i)}},markForDeletion(t,e){t.deletedRequests.push(e.payload)},markAsDeleted(t,e){const i=t.deletedRequests.indexOf(e.payload);i!==-1&&t.deletedRequests.splice(i,1)},_setLatestRetryTime:(t,e)=>{t.latestRetryTime=e.payload}}}),lI=t=>t.outboxReducer.deletedRequests,hI=t=>t.outboxReducer.latestRetryTime,{enqueueRequest:fm,markForDeletion:mI,markAsDeleted:Sm,_setLatestRetryTime:Tm}=bn.actions,gm=bn.reducer,De=P(t=>t.uuid),Im=De.getInitialState({}),Fn=d.createSlice({name:"projectAccess",initialState:Im,extraReducers:t=>t.addMatcher(d.isAnyOf(I,_),e=>Object.assign(e,Im)),reducers:{initializeProjectAccesses:De.initialize,addProjectAccess:De.addOne,addProjectAccesses:De.addMany,setProjectAccess:De.setOne,setProjectAccesses:De.setMany,updateProjectAccess:De.updateOne,updateProjectAccesses:De.updateMany,deleteProjectAccess:De.deleteOne,deleteProjectAccesses:De.deleteMany}}),{initializeProjectAccesses:bm,addProjectAccess:Pn,addProjectAccesses:_n,setProjectAccess:pI,setProjectAccesses:yI,updateProjectAccess:bt,updateProjectAccesses:Fm,deleteProjectAccess:On,deleteProjectAccesses:Rn}=Fn.actions,Pm=Fn.reducer,vn=t=>t.projectAccessReducer.instances,Zt=d.createSelector(vn,t=>Object.values(t)),wn=t=>e=>e.projectAccessReducer.instances[t],_m=f(d.createSelector([vn,(t,e)=>e],(t,e)=>T(Object.values(t).filter(i=>i.project===e)))),AI=f(d.createSelector([Zt,(t,e)=>e],(t,e)=>{const i={};for(const a of t.filter(n=>n.project===e))i[a.user]=a;return i})),fI=f(d.createSelector([fn,Zt,(t,e)=>e],(t,e,i)=>{const a=new Set(e.filter(n=>n.project===i).map(n=>n.user));return T(t.filter(n=>a.has(n.id)))})),Ue=P(t=>t.uuid),Om=Ue.getInitialState({}),Mn=d.createSlice({name:"projectAttachments",initialState:Om,extraReducers:t=>t.addMatcher(d.isAnyOf(I,_),e=>Object.assign(e,Om)),reducers:{initializeProjectAttachments:Ue.initialize,addProjectAttachment:Ue.addOne,addProjectAttachments:Ue.addMany,setProjectAttachment:Ue.setOne,setProjectAttachments:Ue.setMany,updateProjectAttachment:Ue.updateOne,updateProjectAttachments:Ue.updateMany,deleteProjectAttachment:Ue.deleteOne,deleteProjectAttachments:Ue.deleteMany}}),{initializeProjectAttachments:En,addProjectAttachment:SI,addProjectAttachments:Rm,setProjectAttachment:vm,setProjectAttachments:wm,updateProjectAttachment:TI,updateProjectAttachments:Mm,deleteProjectAttachment:Em,deleteProjectAttachments:Vn}=Mn.actions,Vm=t=>t.projectAttachmentReducer.instances,jm=d.createSelector([Vm],t=>Object.values(t)),qm=t=>e=>e.projectAttachmentReducer.instances[t],zm=f(d.createSelector([jm,(t,e)=>e],(t,e)=>T(t.filter(({project:i})=>e===i)))),Dm=Mn.reducer,Ce=P(t=>t.uuid),Um=Ce.getInitialState({activeProjectFileId:null,isImportingProjectFile:!1}),jn=d.createSlice({name:"projectFiles",initialState:Um,extraReducers:t=>t.addMatcher(d.isAnyOf(I,M,_),e=>Object.assign(e,Um)),reducers:{initializeProjectFiles:Ce.initialize,setProjectFile:Ce.setOne,setProjectFiles:Ce.setMany,addProjectFile:Ce.addOne,addProjectFiles:Ce.addMany,updateProjectFile:Ce.updateOne,updateProjectFiles:Ce.updateMany,deleteProjectFile:Ce.deleteOne,deleteProjectFiles:Ce.deleteMany,setIsImportingProjectFile:(t,e)=>{t.isImportingProjectFile=e.payload},saveActiveProjectFileBounds:(t,e)=>{const i=t.activeProjectFileId;if(!i)throw new Error("Tried to save bounds for active project file, but no active project file was set.");if(!t.instances[i])throw new Error(`Tried to save bounds for active project file, but project file with ID ${i}
2
- doesn't exist.`);t.instances[i].bounds=e.payload},setActiveProjectFileId:(t,e)=>{t.activeProjectFileId=e.payload}}}),{initializeProjectFiles:Cm,setProjectFile:gI,setProjectFiles:II,addProjectFile:bI,addProjectFiles:km,updateProjectFile:qn,updateProjectFiles:FI,deleteProjectFile:Bm,deleteProjectFiles:$m,setIsImportingProjectFile:Gm,setActiveProjectFileId:Lm,saveActiveProjectFileBounds:Nm}=jn.actions,Hm=t=>t.projectFileReducer.instances,Wm=d.createSelector([Hm],t=>T(Object.values(t).sort((e,i)=>e.z_index-i.z_index))),PI=t=>e=>e.projectFileReducer.instances[t],_I=t=>t.projectFileReducer.activeProjectFileId,OI=t=>t.projectFileReducer.isImportingProjectFile,Km=jn.reducer,ke=P(t=>t.uuid),Ym=ke.getInitialState({}),zn=d.createSlice({name:"projects",initialState:Ym,extraReducers:t=>t.addMatcher(d.isAnyOf(I,_),e=>Object.assign(e,Ym)),reducers:{initializeProjects:ke.initialize,setProjects:ke.setMany,setProject:ke.setOne,addProjects:ke.addMany,addProject:ke.addOne,updateProjects:ke.updateMany,updateProject:ke.updateOne,deleteProject:ke.deleteOne,deleteProjects:ke.deleteMany}}),{initializeProjects:Zm,setProjects:RI,setProject:vI,addProjects:wI,addProject:Dn,updateProjects:MI,updateProject:Jm,deleteProject:Un,deleteProjects:EI}=zn.actions,Xm=zn.reducer,Qm=t=>t.projectReducer.instances,Cn=d.createSelector([Qm],t=>T(Object.values(t))),xm=t=>e=>e.projectReducer.instances[t],VI=f(d.createSelector([Cn,Zt,(t,e)=>e],(t,e,i)=>{const a=new Set(e.filter(n=>n.user===i).map(n=>n.project));return T(t.filter(n=>a.has(n.uuid)))})),jI=f(d.createSelector([Cn,(t,e)=>e],(t,e)=>T(t.filter(i=>i.organization===e)))),qI={isRehydrated:!1},kn=d.createSlice({name:"rehydrated",initialState:qI,reducers:{setRehydrated:(t,e)=>{t.isRehydrated=e.payload}}}),{setRehydrated:zI}=kn.actions,DI=t=>t.rehydratedReducer.isRehydrated,ep=kn.reducer,Be=P(t=>t.uuid),tp=Be.getInitialState({}),Bn=d.createSlice({name:"teamMemberships",initialState:tp,extraReducers:t=>t.addMatcher(d.isAnyOf(I,_),e=>Object.assign(e,tp)),reducers:{initializeTeamMemberships:Be.initialize,addTeamMembership:Be.addOne,addTeamMemberships:Be.addMany,setTeamMembership:Be.setOne,setTeamMemberships:Be.setMany,updateTeamMembership:Be.updateOne,updateTeamMemberships:Be.updateMany,deleteTeamMembership:Be.deleteOne,deleteTeamMemberships:Be.deleteMany}}),{initializeTeamMemberships:sp,addTeamMembership:ip,addTeamMemberships:ap,setTeamMembership:$n,setTeamMemberships:np,updateTeamMembership:UI,updateTeamMemberships:CI,deleteTeamMembership:Gn,deleteTeamMemberships:cp}=Bn.actions,rp=Bn.reducer,dp=t=>t.teamMembershipReducer.instances,Ln=d.createSelector([dp],t=>Object.values(t)),up=t=>e=>e.teamMembershipReducer.instances[t],kI=f(d.createSelector([Ln,(t,e)=>e],(t,e)=>{const i={};for(const a of t.filter(n=>n.team===e))i[a.user]=a;return i})),BI=f(d.createSelector([fn,Ln,(t,e)=>e],(t,e,i)=>{const a=new Set(e.filter(n=>n.team===i).map(n=>n.user));return T(t.filter(n=>a.has(n.id)))})),$e=P(t=>t.uuid),op=$e.getInitialState({}),Nn=d.createSlice({name:"teams",initialState:op,extraReducers:t=>t.addMatcher(d.isAnyOf(I,_),e=>Object.assign(e,op)),reducers:{initializeTeams:$e.initialize,addTeam:$e.addOne,addTeams:$e.addMany,setTeam:$e.setOne,setTeams:$e.setMany,updateTeam:$e.updateOne,updateTeams:$e.updateMany,deleteTeam:$e.deleteOne,deleteTeams:$e.deleteMany}}),{initializeTeams:lp,addTeam:hp,addTeams:$I,setTeam:Ft,setTeams:GI,updateTeam:mp,updateTeams:LI,deleteTeam:Hn,deleteTeams:NI}=Nn.actions,Wn=t=>t.teamReducer.instances,pp=d.createSelector([Wn],t=>Object.values(t)),Kn=t=>e=>e.teamReducer.instances[t],HI=f(d.createSelector([Wn,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n?i.push(n):console.warn("selectTeamsByIds: No team exists with the id",a)}return T(i)})),WI=f(d.createSelector([pp,(t,e)=>e],(t,e)=>T(t.filter(i=>i.organization===e)))),yp=Nn.reducer,KI={version:0},Ap=d.createSlice({name:"versioning",initialState:KI,reducers:{}}),fp=Ap.reducer,Yn={outboxReducer:gm,fileReducer:no,authReducer:Ou},YI=d.combineReducers(Yn),Sp={...Yn,[st]:fp,categoryReducer:Vu,assetReducer:pd,assetAttachmentReducer:jc,assetStageCompletionReducer:Td,assetStageReducer:_d,assetTypeReducer:Fu,assetTypeAttachmentReducer:zd,issueReducer:Gl,issueAttachmentReducer:bl,issueTypeReducer:kh,issueTypeAttachmentReducer:Ql,organizationReducer:pm,projectReducer:Xm,projectAttachmentReducer:Dm,projectAccessReducer:Pm,organizationAccessReducer:rm,projectFileReducer:Km,rehydratedReducer:ep,formReducer:Vo,formRevisionReducer:wo,formRevisionAttachmentReducer:bo,formSubmissionAttachmentReducer:Go,formSubmissionReducer:Zo,formIdentifierReducer:lo,formIdentifierValueReducer:yo,userReducer:em,emailDomainsReducer:eo,documentsReducer:Ku,documentAttachmentReducer:Gu,teamReducer:yp,agentsReducer:Pc,issueCommentReducer:Dl,issueCommentAttachmentReducer:Vl,issueUpdateReducer:Zh,geoImageReducer:nl,issueAssociationReducer:ml,issueTypeFieldsReducer:fh,issueTypeFieldValuesReducer:oh,issueTypeFieldsAttachmentReducer:ch,issueTypeFieldValuesAttachmentReducer:Ph,issueTypeIdentifierReducer:wh,issueTypeIdentifierValueReducer:jh,assetTypeFieldsReducer:Jd,assetTypeFieldValuesReducer:ou,assetTypeFieldsAttachmentReducer:Ld,assetTypeFieldValuesAttachmentReducer:iu,assetTypeIdentifierReducer:yu,assetTypeIdentifierValueReducer:Tu,assetProcedureTypeReducer:Rr,assetProcedureReducer:Fr,assetProcedureTypeFieldsReducer:ir,assetProcedureFieldValuesReducer:fr,assetProcedureTypeFieldsAttachmentReducer:Zc,assetProcedureTypeFieldValuesAttachmentReducer:dr,assetProcedureTypeAttachmentReducer:Bc,assetProcedureStepFieldsAttachmentReducer:Dr,assetProcedureStepFieldsReducer:kr,assetProcedureStepFieldValuesAttachmentReducer:Wr,assetProcedureStepFieldValuesReducer:xr,assetProcedureStepReducer:rd,teamMembershipReducer:rp},ZI=d.combineReducers(Sp);function JI(t,e){return Np.useMemo(t,e)}class XI{constructor(e){S(this,"operations",[]);S(this,"getData");this.getData=e}performOperations(e){let i=e;for(const a of this.operations)i=a(i);return i}filter(e,i){return this.operations.push(a=>a.filter(n=>n[e]===i)),this}exclude(e,i){return this.operations.push(a=>a.filter(n=>n[e]!==i)),this}orderBy(e){return this.operations.push(i=>[...i].sort((a,n)=>a[e]<=n[e]?1:-1)),this}reverse(){return this.operations.push(e=>[...e].reverse()),this}all(){return this.operations.push(e=>e),this}get(e,i){return d.createSelector([this.getData],a=>this.performOperations(a).find(n=>n[e]===i))}count(){return d.createSelector([this.getData],e=>this.performOperations(e).length)}first(){return d.createSelector([this.getData],e=>this.performOperations(e)[0])}last(){return d.createSelector([this.getData],e=>{const i=this.performOperations(e);return i[i.length-1]})}exists(){return d.createSelector([this.getData],e=>this.performOperations(e).length>0)}toSelector(){return d.createSelector([this.getData],e=>T(this.performOperations(e)))}}const Tp=1e4,Ge=200,gp={};class Ip{constructor(e){S(this,"client");S(this,"pageSize",Tp);gp[this.constructor.name]=this,this.client=e}async enqueueRequest(e,i){return this.client.enqueueRequest(e,this.host,this.constructor.name,i)}async performPagination(e,i,a){const n=[];let c=await this.client.enqueueRequest(e,this.host,this.constructor.name,a);for(n.push(c.results);c.next;)c=await this.client.enqueueRequest(i(c.next),this.host,this.constructor.name,a),n.push(c.results);return n}dispatch(e){this.client.store.dispatch(e)}}const bp=()=>_p.length-1,Fp=t=>(t[st]={version:bp()},t),Pp=()=>Fp({}),QI=t=>(t.outboxReducer&&(t.outboxReducer.deletedRequests=[]),t),xI=t=>e=>{var i;return e===void 0&&(e={}),((i=e[st])==null?void 0:i.version)===bp()?e:t(e)},_p=[Fp,Pp,Pp,QI],eb=Object.fromEntries(_p.map((t,e)=>[e,xI(t)])),tb=t=>{if(t)throw t;const e=tt();e?e.dispatch({type:"rehydrated/setRehydrated",payload:!0}):console.error("Client store not set")},Op=(t,e,i)=>{const a=Ye();return a?(a.addRequest(e),a.getQueue()):(console.warn("Outbox coordinator not set; cannot enqueue request yet."),[])},Rp=(t,e,i)=>{const a=Ye();if(!a)return console.warn("Outbox coordinator not set; cannot dequeue request yet."),[];const c=e.meta.offlineAction.payload.uuid;return a.remove(c),a.getQueue()};async function sb(t,e){if(!e.payload)throw new Error("Received empty payload");return kp(e)}const ib={...sc,effect:sb,discard:wp,returnPromises:!0,persistCallback:tb,retry:db,persistOptions:{storage:Wp},queue:{...sc.queue,enqueue:Op,dequeue:Rp,peek:(...t)=>rb(...t)}},ab=Kp(eb,st),nb=d.compose(Hp.offline(ib),ab);function cb(t){function e(i){return typeof i=="object"&&i!==null&&["ok","redirect","clientError","serverError","error"].every(n=>n in i)}if(e(t))return t;if(typeof t=="object"&&t!==null){const i=t;if(e(i.response))return i.response;if(i.response&&e(i.response.response))return i.response.response}}async function Zn(t,e,i){if(e.store.getState().outboxReducer.deletedRequests.includes(t.payload.uuid))throw new Error("Request was marked for deletion");const n=gp[t.meta.offline.effect.serviceName];if(!n)throw new Error(`Service ${t.meta.offline.effect.serviceName} not found`);const c=n instanceof O;c&&t.payload.checkAuth!==!1&&await n.auth.prepareAuth();const r={queryParams:"",isAuthNeeded:!0},u=t.meta.offline.effect,{payload:m,headers:o,method:h,queryParams:p,attachmentHash:y,isExternalUrl:A,isAuthNeeded:g,isResponseBlob:b}={...r,...u.request},R=u.request;let w=R.url;const q=y?await e.files.fetchCache(y):void 0;if(y&&!q)throw new Error(`Cannot upload file ${y} because it's not cached.`);!A&&!w.startsWith("http")&&(!w.startsWith("/")&&!w.startsWith("blob:")&&(w="/"+w),w=t.meta.offline.effect.BASE_URL+w);const Le=j=>{if(y){const Ne=R.s3url;if(!Ne)throw new Error(`No S3 URL for file ${y}`);if("warning"in Ne)throw new Error(`S3 URL warning for file ${y}`);if(!q)throw new Error(`No file for file ${y}`);const Pt=Ne.fields["x-amz-checksum-sha1"];if(!Pt)throw new Error(`No checksum for file ${y}`);return j.set("x-amz-checksum-sha1",Pt).field({...m,...Ne.fields}).attach("file",q)}return j.send(m)},RF={[l.GET]:()=>b?Ze.get(w.toString()).responseType("blob"):Ze.get(w.toString()),[l.POST]:()=>{const j=Ze.post(w.toString());return Le(j)},[l.PATCH]:()=>{const j=Ze.patch(w.toString());return Le(j)},[l.PUT]:()=>{const j=Ze.put(w.toString());return Le(j)},[l.DELETE]:()=>{const j=Ze.delete(w.toString());return Le(j)}}[h];let We=RF();if(i==null||i.addEventListener("abort",()=>{console.debug("aborting request:",R),We.abort()}),g&&c){const j=n.auth.getAuthHeader();We=We.set("Authorization",j)}o&&(We=We.set(o));try{return await We.query(p)}catch(j){const Ne=cb(j),Pt=Ne==null?void 0:Ne.status;if(c&&Pt===401)return await n.auth.handleUnauthorized(We,Ne),We.query(p);throw new D({response:Ne,innerError:j,discard:vp.includes(Pt)})}}const vp=[400,409,403,404,405,500];function wp(t,e,i=0){var o;if(console.debug("Considering discarding request due to error:",t,`(${typeof t})`,`
1
+ (function(s,z){typeof exports=="object"&&typeof module<"u"?z(exports,require("@redux-offline/redux-offline/lib/types"),require("@reduxjs/toolkit"),require("superagent"),require("uuid"),require("file-saver"),require("fast-tree-builder"),require("ts-tree-lib"),require("react"),require("@redux-offline/redux-offline"),require("@redux-offline/redux-offline/lib/defaults"),require("buffer"),require("localforage"),require("redux-persist-migrate"),require("@overmap-ai/forms"),require("idb"),require("jwt-decode"),require("dependency-graph"),require("@tiptap/core")):typeof define=="function"&&define.amd?define(["exports","@redux-offline/redux-offline/lib/types","@reduxjs/toolkit","superagent","uuid","file-saver","fast-tree-builder","ts-tree-lib","react","@redux-offline/redux-offline","@redux-offline/redux-offline/lib/defaults","buffer","localforage","redux-persist-migrate","@overmap-ai/forms","idb","jwt-decode","dependency-graph","@tiptap/core"],z):(s=typeof globalThis<"u"?globalThis:s||self,z(s["overmap-core"]={},null,s.toolkit,s.request,s.uuid,s.fileSaver,s.buildTree,s.tsTreeLib,s.react,s.reduxOffline,s.offlineConfig,null,s.localforage,s.createMigration,null,s.idb,s.jwtDecode,s.dependencyGraph))})(this,function(s,z,d,Ye,Ze,jp,qp,Qc,zp,Up,xc,hF,Cp,Dp,mF,kp,Bp,$p){"use strict";var oF=Object.defineProperty;var lF=(s,z,d)=>z in s?oF(s,z,{enumerable:!0,configurable:!0,writable:!0,value:d}):s[z]=d;var S=(s,z,d)=>lF(s,typeof z!="symbol"?z+"":z,d);var Ep;const en=Object.freeze([]),tn=Object.freeze({});var sn=(t=>(t[t.GUEST=0]="GUEST",t[t.BASIC=2]="BASIC",t[t.ADMIN=4]="ADMIN",t))(sn||{}),l=(t=>(t.GET="GET",t.POST="POST",t.PATCH="PATCH",t.PUT="PUT",t.DELETE="DELETE",t))(l||{}),an=(t=>(t.Issue="issue",t.Asset="asset",t.AssetType="asset_type",t.Project="project",t.Document="document",t))(an||{}),Xt=(t=>(t[t.LOWEST=0]="LOWEST",t[t.LOW=2]="LOW",t[t.MEDIUM=4]="MEDIUM",t[t.HIGH=6]="HIGH",t[t.HIGHEST=8]="HIGHEST",t))(Xt||{}),Qt=(t=>(t[t.BACKLOG=0]="BACKLOG",t[t.SELECTED=2]="SELECTED",t[t.DONE=4]="DONE",t))(Qt||{}),V=(t=>(t.STATUS="status",t.PRIORITY="priority",t.CATEGORY="category",t.DESCRIPTION="description",t.TITLE="title",t.ASSIGNED_TO="assigned_to",t.DUE_DATE="due_date",t))(V||{});const Gp=Qt.BACKLOG,Lp=Xt.MEDIUM,cn=6e4;function P(t){return{addOne:(p,y)=>{const A=t(y.payload);p.instances[A]=y.payload},addMany:(p,y)=>{for(const A of y.payload){const I=t(A);p.instances[I]=A}},setOne:(p,y)=>{const A=t(y.payload);p.instances[A]=y.payload},setMany:(p,y)=>{for(const A of y.payload){const I=t(A);p.instances[I]=A}},updateOne:(p,y)=>{const A=t(y.payload);p.instances[A]=y.payload},updateMany:(p,y)=>{for(const A of y.payload){const I=t(A);p.instances[I]=A}},deleteOne:(p,y)=>{delete p.instances[y.payload]},deleteMany:(p,y)=>{for(const A of y.payload)delete p.instances[A]},initialize:(p,y)=>{p.instances={};const A=new Set;for(const I of y.payload){const g=t(I);A.add(g),p.instances[g]=I}A.size!==y.payload.length&&console.warn("duplicate ids detected when initializing model instances.")},getInitialState:p=>({...p,instances:{}})}}function Np(){return{initializeSelection:(m,o)=>{m.selection=Array.from(new Set(o.payload))},selectOne:(m,o)=>{new Set(m.selection).has(o.payload)||m.selection.push(o.payload)},selectMany:(m,o)=>{const h=new Set(m.selection);for(const p of o.payload)h.has(p)||h.add(p);m.selection=Array.from(h)},unselectOne:(m,o)=>{const h=new Set(m.selection);h.has(o.payload)&&(h.delete(o.payload),m.selection=Array.from(h))},unselectMany:(m,o)=>{const h=new Set(m.selection);for(const p of o.payload)h.has(p)&&h.delete(p);m.selection=Array.from(h)},toggleOne:(m,o)=>{const h=new Set(m.selection);h.has(o.payload)?h.delete(o.payload):h.add(o.payload),m.selection=Array.from(h)},toggleMany:(m,o)=>{const h=new Set(m.selection);for(const p of o.payload)h.has(p)?h.delete(p):h.add(p);m.selection=Array.from(h)},getInitialState:m=>({...m,selection:[]})}}const tt="versioning",b=d.createAction("RESET"),M=d.createAction("RESET_PROJECT_STATE"),_=d.createAction("RESET_ORGANIZATION_STATE");Ep=Symbol.toStringTag;class nn{constructor(){S(this,Ep,"Promise");S(this,"_promise");S(this,"_resolve");S(this,"_reject");S(this,"_state","pending");this._resolve=null,this._reject=null,this._promise=new Promise((e,i)=>{this._resolve=e,this._reject=i})}get state(){return this._state}then(e,i){return this._promise.then(e,i)}catch(e){return this._promise.catch(e)}resolve(e){if(!this._resolve)throw new Error("No resolve callback");this._resolve(e),this._state="fulfilled"}reject(e){if(!this._reject)throw e;this._reject(e),this._state="rejected"}finally(e){throw new Error("`finally` not implemented")}}let xt=!1;["true","1"].includes("".toLowerCase())&&(xt=!0);function Hp(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;const i=Object.keys(t),a=Object.keys(e),c=i.length;if(c!==a.length)return!1;for(let n=0;n<c;n++){const r=i[n];if(!Object.prototype.hasOwnProperty.call(e,r)||t[r]!==e[r])return!1}return!0}function es(t){const e={};return function(){const i=Array.prototype.slice.call(arguments);return i in e?(xt&&console.debug(`Memoization debug: Using memorized return value for ${t.toString()}(`,i,")"),e[i]):(xt&&console.debug(`Memoization debug: Cache miss! Memoizing ${t.toString()}(`,i,")"),e[i]=t.apply(this,i))}}function Wp(t,e){if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}const T=t=>t.length===0?en:t,Pt=t=>Object.keys(t).length===0?tn:t,rn=es(t=>{if(!t)return"";const e=new Date(t),i=e.getFullYear()===ts.getFullYear(),a={day:"numeric",month:"short"};return i||(a.year="numeric"),e.toLocaleDateString([],a)}),Kp=new Intl.RelativeTimeFormat([],{style:"long",numeric:"auto"}),Yp=1e3*86400,ts=new Date,Zp=t=>new Date(t).toDateString()===ts.toDateString(),Jp=es((t,e,i)=>{const a=Math.round((new Date(t).getTime()-ts.getTime())/Yp);return a<e||a>i?rn(t):Kp.format(a,"days")});function Xp(t){return new Uint8Array(t).reduce((i,a)=>i+a.toString(16).padStart(2,"0"),"")}const ss=async(t,e)=>{e||(e=await Je(t));let i=t.type;if(i.includes("/")&&(i=i.split("/")[1]),!i)throw new Error(`Could not extract file type from ${t.type}`);return`${e}.${i}`};function Je(t){return new Promise((e,i)=>{const a=new FileReader;a.onload=()=>{const c=a.result;if(!c){i(new Error("FileReader did not return a valid ArrayBuffer."));return}crypto.subtle.digest("SHA-1",c).then(n=>{const r=Xp(n);e(r)})},a.readAsArrayBuffer(t)})}function Qp(t){if(!t.name||!t.type||!t.size){const e="File has no name, type, and/or size";throw new Error(e)}return`${t.name}&${t.type}${t.size}`}function dn(t,e){return new File([t],e,{type:t.type})}function xp(t,e){const i=document.createElement("a");i.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(e)),i.setAttribute("download",t),i.style.display="none",document.body.appendChild(i),i.click(),document.body.removeChild(i)}const ey=async t=>{const e={};for(const i of t){const a=await Je(i);e[a]={sha1:a,extension:i.name.split(".").pop()||"",file_type:i.type,size:i.size}}return Object.values(e)},un=async t=>(await fetch(t)).blob(),ty=t=>new Promise((e,i)=>{const a=new FileReader;a.onloadend=()=>{var c;e(((c=a.result)==null?void 0:c.toString())||"")},a.readAsDataURL(t)});function sy(t){const e=new Blob([t]);jp.saveAs(e,t.name)}const on={};function iy(t,e,i,...a){const c=on[t];let n=!1;c?c[e]||(c[e]=!0,n=!0):(on[t]={[e]:!0},n=!0),n&&console[i](...a)}const ln=["created_at","updated_at","index","revision"];function F(t){return{...t,uuid:Ze.v4()}}function hn(t){const e={};for(const i of t)e[i.uuid]=i;return e}function mn(t){return t.map(({uuid:e})=>e)}function ay(t,e=void 0,i=255){let a=t.replace(/[^a-z0-9_\-.]/gi,"_").replace(/_{2,}/g,"_");if(!e){const n=t.split(".");n.length>1&&(e=n[n.length-1])}e&&!e.startsWith(".")&&(e="."+e);const c=e?e.length:0;return a.length+c>i&&(a=a.slice(0,i-c)+(e||"")),a}function cy(t){return t.toLowerCase().replace(" ","-")}function ny(t,e=!1){return t.normalize("NFKD").toLowerCase().replace(/[^\w\s-]/g,"").trim().replace(/[-\s]+/g,e?"_":"-")}function ry(t,e){if(t.length<=e)return t;const i=t.slice(0,e-1);return i.slice(0,i.lastIndexOf(" "))+"…"}const f=t=>e=>i=>t(i,e);function pn(t,e,i){return i.findIndex(a=>a.uuid===t.uuid)===e}function dy(t,e,i){return i.findIndex(a=>a.file_sha1===t.file_sha1)===e}const uy=/^.+@.+\..+$/;function v(t){const e={...t};for(const i of[...ln,"created_by"])i in e&&delete e[i];return e}const yn=t=>{const e=t.toSorted((i,a)=>i.order-a.order);return qp(e,{id:i=>i.uuid,parentId:i=>i.parent,includeEmptyChildrenArray:!0,valueKey:!1})},oy=t=>{const{roots:e}=yn(t);return e.map(i=>new Qc.Tree(i))},An=(t,e)=>{const{nodes:i}=yn(e),a=i.get(t);if(!a)throw new Error(`Node with uuid ${t} does not exist in asset procedure step tree.`);return new Qc.Tree(a)},D=P(t=>t.uuid),fn=D.getInitialState({}),is=d.createSlice({name:"agents",initialState:fn,extraReducers:t=>t.addMatcher(d.isAnyOf(b,M,_),e=>Object.assign(e,fn)),reducers:{initializeConversations:D.initialize,addConversation:D.addOne,addConversations:D.addMany,setConversation:D.setOne,setConversations:D.setMany,updateConversation:D.updateOne,updateConversations:D.updateMany,deleteConversation:D.deleteOne,deleteConversations:D.deleteMany}}),{initializeConversations:Sn,addConversation:Tn,addConversations:ly,setConversation:In,setConversations:hy,updateConversation:gn,updateConversations:my,deleteConversation:py,deleteConversations:yy}=is.actions,as=t=>t.agentsReducer.instances,Ay=d.createSelector([as],t=>Object.values(t)),fy=f(d.createSelector([as,(t,e)=>e],(t,e)=>t[e])),bn=is.reducer,k=P(t=>t.uuid),Fn=k.getInitialState({}),cs=d.createSlice({name:"assetAttachments",initialState:Fn,extraReducers:t=>t.addMatcher(d.isAnyOf(b,M,_),e=>Object.assign(e,Fn)),reducers:{initializeAssetAttachments:k.initialize,addAssetAttachment:k.addOne,addAssetAttachments:k.addMany,setAssetAttachment:k.setOne,setAssetAttachments:k.setMany,updateAssetAttachment:k.updateOne,updateAssetAttachments:k.updateMany,deleteAssetAttachment:k.deleteOne,deleteAssetAttachments:k.deleteMany}}),{initializeAssetAttachments:ns,addAssetAttachment:Sy,addAssetAttachments:rs,setAssetAttachment:Pn,setAssetAttachments:Ty,updateAssetAttachment:Iy,updateAssetAttachments:_n,deleteAssetAttachment:On,deleteAssetAttachments:ds}=cs.actions,Rn=t=>t.assetAttachmentReducer.instances,vn=d.createSelector([Rn],t=>Object.values(t)),wn=t=>e=>e.assetAttachmentReducer.instances[t],Mn=f(d.createSelector([vn,(t,e)=>e],(t,e)=>T(t.filter(({asset:i})=>e===i)))),Vn=cs.reducer,B=P(({uuid:t})=>t),En=B.getInitialState({}),us=d.createSlice({name:"assetProcedureTypeAttachments",initialState:En,extraReducers:t=>t.addMatcher(d.isAnyOf(b,_),e=>Object.assign(e,En)),reducers:{initializeAssetProcedureTypeAttachments:B.initialize,addAssetProcedureTypeAttachment:B.addOne,addAssetProcedureTypeAttachments:B.addMany,setAssetProcedureTypeAttachment:B.setOne,setAssetProcedureTypeAttachments:B.setMany,updateAssetProcedureTypeAttachment:B.updateOne,updateAssetProcedureTypeAttachments:B.updateMany,deleteAssetProcedureTypeAttachment:B.deleteOne,deleteAssetProcedureTypeAttachments:B.deleteMany}}),{initializeAssetProcedureTypeAttachments:os,addAssetProcedureTypeAttachment:gy,addAssetProcedureTypeAttachments:jn,setAssetProcedureTypeAttachment:qn,setAssetProcedureTypeAttachments:by,updateAssetProcedureTypeAttachment:Fy,updateAssetProcedureTypeAttachments:zn,deleteAssetProcedureTypeAttachment:Un,deleteAssetProcedureTypeAttachments:Cn}=us.actions,Dn=us.reducer,kn=t=>t.assetProcedureTypeAttachmentReducer.instances,Bn=d.createSelector([kn],t=>Object.values(t)),$n=t=>e=>e.assetProcedureTypeAttachmentReducer.instances[t],Py=f(d.createSelector([Bn,(t,e)=>e],(t,e)=>T(t.filter(({asset_procedure_type:i})=>e===i)))),$=P(({uuid:t})=>t),Gn=$.getInitialState({}),ls=d.createSlice({name:"assetProcedureTypeFieldsAttachments",initialState:Gn,extraReducers:t=>t.addMatcher(d.isAnyOf(b,_),e=>Object.assign(e,Gn)),reducers:{initializeAssetProcedureTypeFieldsAttachments:$.initialize,addAssetProcedureTypeFieldsAttachment:$.addOne,addAssetProcedureTypeFieldsAttachments:$.addMany,setAssetProcedureTypeFieldsAttachment:$.setOne,setAssetProcedureTypeFieldsAttachments:$.setMany,updateAssetProcedureTypeFieldsAttachment:$.updateOne,updateAssetProcedureTypeFieldsAttachments:$.updateMany,deleteAssetProcedureTypeFieldsAttachment:$.deleteOne,deleteAssetProcedureTypeFieldsAttachments:$.deleteMany}}),{initializeAssetProcedureTypeFieldsAttachments:Ln,addAssetProcedureTypeFieldsAttachment:_y,addAssetProcedureTypeFieldsAttachments:Nn,setAssetProcedureTypeFieldsAttachment:Oy,setAssetProcedureTypeFieldsAttachments:Ry,updateAssetProcedureTypeFieldsAttachment:vy,updateAssetProcedureTypeFieldsAttachments:Hn,deleteAssetProcedureTypeFieldsAttachment:wy,deleteAssetProcedureTypeFieldsAttachments:Wn}=ls.actions,Kn=ls.reducer,Yn=t=>t.assetProcedureTypeFieldsAttachmentReducer.instances,Zn=d.createSelector([Yn],t=>Object.values(t)),My=f(d.createSelector([Zn,(t,e)=>e],(t,e)=>T(t.filter(i=>i.fields_revision===e)))),Vy=t=>e=>e.assetProcedureTypeFieldsAttachmentReducer.instances[t],G=P(({uuid:t})=>t),Jn=G.getInitialState({}),hs=d.createSlice({name:"assetProcedureTypeFields",initialState:Jn,extraReducers:t=>t.addMatcher(d.isAnyOf(b,_),e=>Object.assign(e,Jn)),reducers:{initializeAssetProcedureTypeFields:G.initialize,addAssetProcedureTypeFields:G.addOne,addAssetProcedureTypeFieldsMany:G.addMany,setAssetProcedureTypeFields:G.setOne,setAssetProcedureTypeFieldsMany:G.setMany,updateAssetProcedureTypeFields:G.updateOne,updateAssetProcedureTypeFieldsMany:G.updateMany,deleteAssetProcedureTypeFields:G.deleteOne,deleteAssetProcedureTypeFieldsMany:G.deleteMany}}),{initializeAssetProcedureTypeFields:Xn,addAssetProcedureTypeFields:Qn,addAssetProcedureTypeFieldsMany:Ey,setAssetProcedureTypeFields:jy,setAssetProcedureTypeFieldsMany:qy,updateAssetProcedureTypeFields:xn,updateAssetProcedureTypeFieldsMany:zy,deleteAssetProcedureTypeFields:er,deleteAssetProcedureTypeFieldsMany:Uy}=hs.actions,tr=hs.reducer,sr=t=>t.assetProcedureTypeFieldsReducer.instances,ms=d.createSelector([sr],t=>Object.values(t)),Cy=f(d.createSelector([ms,(t,e)=>e],(t,e)=>T(t.filter(i=>i.asset_procedure_type===e)))),Dy=f(d.createSelector([ms,(t,e)=>e],(t,e)=>t.filter(i=>i.asset_procedure_type===e).sort((i,a)=>i.submitted_at>a.submitted_at?-1:1)[0])),ky=t=>e=>e.assetProcedureTypeFieldsReducer.instances[t],L=P(({uuid:t})=>t),ir=L.getInitialState({}),ps=d.createSlice({name:"assetProcedureTypeFieldValuesAttachments",initialState:ir,extraReducers:t=>t.addMatcher(d.isAnyOf(b,M,_),e=>Object.assign(e,ir)),reducers:{initializeAssetProcedureTypeFieldValuesAttachments:L.initialize,addAssetProcedureTypeFieldValuesAttachment:L.addOne,addAssetProcedureTypeFieldValuesAttachments:L.addMany,setAssetProcedureTypeFieldValuesAttachment:L.setOne,setAssetProcedureTypeFieldValuesAttachments:L.setMany,updateAssetProcedureTypeFieldValuesAttachment:L.updateOne,updateAssetProcedureTypeFieldValuesAttachments:L.updateMany,deleteAssetProcedureTypeFieldValuesAttachment:L.deleteOne,deleteAssetProcedureTypeFieldValuesAttachments:L.deleteMany}}),{initializeAssetProcedureTypeFieldValuesAttachments:ar,addAssetProcedureTypeFieldValuesAttachment:By,addAssetProcedureTypeFieldValuesAttachments:_t,setAssetProcedureTypeFieldValuesAttachment:$y,setAssetProcedureTypeFieldValuesAttachments:Gy,updateAssetProcedureTypeFieldValuesAttachment:Ly,updateAssetProcedureTypeFieldValuesAttachments:cr,deleteAssetProcedureTypeFieldValuesAttachment:Ny,deleteAssetProcedureTypeFieldValuesAttachments:Ot}=ps.actions,nr=ps.reducer,ys=t=>t.assetProcedureTypeFieldValuesAttachmentReducer.instances,rr=d.createSelector([ys],t=>Object.values(t)),Hy=t=>e=>e.assetProcedureTypeFieldValuesAttachmentReducer.instances[t],dr=f(d.createSelector([ys,(t,e)=>e],(t,e)=>{const i=new Set(e);return T(Object.values(t).filter(a=>i.has(a.uuid)))})),ur=f(d.createSelector([rr,(t,e)=>e],(t,e)=>T(t.filter(i=>i.field_values===e)))),N=P(({uuid:t})=>t),or=N.getInitialState({}),As=d.createSlice({name:"assetProcedureTypeFieldValues",initialState:or,extraReducers:t=>t.addMatcher(d.isAnyOf(b,M,_),e=>Object.assign(e,or)),reducers:{initializeAssetProcedureTypeFieldValues:N.initialize,addAssetProcedureTypeFieldValues:N.addOne,addAssetProcedureTypeFieldValuesMany:N.addMany,setAssetProcedureTypeFieldValues:N.setOne,setAssetProcedureTypeFieldValuesMany:N.setMany,updateAssetProcedureTypeFieldValues:N.updateOne,updateAssetProcedureTypeFieldValuesMany:N.updateMany,deleteAssetProcedureTypeFieldValues:N.deleteOne,deleteAssetProcedureTypeFieldValuesMany:N.deleteMany}}),{initializeAssetProcedureTypeFieldValues:lr,addAssetProcedureTypeFieldValues:fs,addAssetProcedureTypeFieldValuesMany:hr,setAssetProcedureTypeFieldValues:Wy,setAssetProcedureTypeFieldValuesMany:Ky,updateAssetProcedureTypeFieldValues:st,updateAssetProcedureTypeFieldValuesMany:mr,deleteAssetProcedureTypeFieldValues:Ss,deleteAssetProcedureTypeFieldValuesMany:pr}=As.actions,yr=As.reducer,Ar=t=>t.assetProcedureFieldValuesReducer.instances,Ts=d.createSelector([Ar],t=>Object.values(t)),Yy=f(d.createSelector([Ts,(t,e)=>e],(t,e)=>T(t.filter(i=>i.asset===e)))),Zy=f(d.createSelector([Ts,(t,e)=>e],(t,e)=>T(t.filter(i=>i.asset_procedure===e)))),Is=t=>e=>e.assetProcedureFieldValuesReducer.instances[t],H=P(({uuid:t})=>t),fr=H.getInitialState({}),gs=d.createSlice({name:"assetProcedures",initialState:fr,extraReducers:t=>t.addMatcher(d.isAnyOf(b,M,_),e=>Object.assign(e,fr)),reducers:{initializeAssetProcedures:H.initialize,addAssetProcedure:H.addOne,addAssetProcedures:H.addMany,setAssetProcedure:H.setOne,setAssetProcedures:H.setMany,updateAssetProcedure:H.updateOne,updateAssetProcedures:H.updateMany,deleteAssetProcedure:H.deleteOne,deleteAssetProcedures:H.deleteMany}}),{initializeAssetProcedures:Sr,addAssetProcedure:bs,addAssetProcedures:Tr,updateAssetProcedure:it,updateAssetProcedures:Jy,deleteAssetProcedure:Fs,deleteAssetProcedures:Ir,setAssetProcedure:Xy,setAssetProcedures:Qy}=gs.actions,gr=gs.reducer,Ps=t=>t.assetProcedureReducer.instances,_s=d.createSelector([Ps],t=>Object.values(t)),br=f(d.createSelector([_s,(t,e)=>e],(t,e)=>T(t.filter(i=>i.asset_procedure_type===e)))),xy=f(d.createSelector([_s,(t,e)=>e],(t,e)=>T(t.filter(i=>i.asset_type===e)))),Os=t=>e=>e.assetProcedureReducer.instances[t],eA=f(d.createSelector([Ps,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const c=t[a];c&&i.push(c)}return T(i)})),W=P(t=>t.uuid),Fr=W.getInitialState({}),Rs=d.createSlice({name:"assetProcedureTypes",initialState:Fr,extraReducers:t=>t.addMatcher(d.isAnyOf(b,_),e=>Object.assign(e,Fr)),reducers:{initializeAssetProcedureTypes:W.initialize,addAssetProcedureType:W.addOne,addAssetProcedureTypes:W.addMany,setAssetProcedureType:W.setOne,setAssetProcedureTypes:W.setMany,updateAssetProcedureType:W.updateOne,updateAssetProcedureTypes:W.updateMany,deleteAssetProcedureType:W.deleteOne,deleteAssetProcedureTypes:W.deleteMany}}),{initializeAssetProcedureTypes:Pr,addAssetProcedureType:vs,addAssetProcedureTypes:tA,updateAssetProcedureType:at,updateAssetProcedureTypes:sA,deleteAssetProcedureType:ws,deleteAssetProcedureTypes:iA,setAssetProcedureType:aA,setAssetProcedureTypes:cA}=Rs.actions,_r=Rs.reducer,Ms=t=>t.assetProcedureTypeReducer.instances,Or=d.createSelector([Ms],t=>Object.values(t)),Vs=t=>e=>e.assetProcedureTypeReducer.instances[t],nA=f(d.createSelector([Ms,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const c=t[a];c&&i.push(c)}return T(i)})),rA=f(d.createSelector([Or,(t,e)=>e],(t,e)=>T(t.filter(i=>i.organization===e)))),K=P(t=>t.uuid),Rr=K.getInitialState({}),Es=d.createSlice({name:"assetProcedureStepFieldsAttachments",initialState:Rr,extraReducers:t=>t.addMatcher(d.isAnyOf(b,_),e=>Object.assign(e,Rr)),reducers:{initializeAssetProcedureStepFieldsAttachments:K.initialize,addAssetProcedureStepFieldsAttachment:K.addOne,addAssetProcedureStepFieldsAttachments:K.addMany,setAssetProcedureStepFieldsAttachment:K.setOne,setAssetProcedureStepFieldsAttachments:K.setMany,updateAssetProcedureStepFieldsAttachment:K.updateOne,updateAssetProcedureStepFieldsAttachments:K.updateMany,deleteAssetProcedureStepFieldsAttachment:K.deleteOne,deleteAssetProcedureStepFieldsAttachments:K.deleteMany}}),{initializeAssetProcedureStepFieldsAttachments:vr,addAssetProcedureStepFieldsAttachment:dA,addAssetProcedureStepFieldsAttachments:wr,setAssetProcedureStepFieldsAttachment:uA,setAssetProcedureStepFieldsAttachments:oA,updateAssetProcedureStepFieldsAttachment:lA,updateAssetProcedureStepFieldsAttachments:Mr,deleteAssetProcedureStepFieldsAttachment:hA,deleteAssetProcedureStepFieldsAttachments:Vr}=Es.actions,Er=t=>t.assetProcedureStepFieldsAttachmentReducer.instances,jr=d.createSelector([Er],t=>Object.values(t)),mA=f(d.createSelector([jr,(t,e)=>e],(t,e)=>T(t.filter(i=>i.fields_revision===e)))),pA=t=>e=>e.assetProcedureStepFieldsAttachmentReducer.instances[t],qr=Es.reducer,Y=P(t=>t.uuid),zr=Y.getInitialState({}),js=d.createSlice({name:"assetProcedureStepFields",initialState:zr,extraReducers:t=>t.addMatcher(d.isAnyOf(b,_),e=>Object.assign(e,zr)),reducers:{initializeAssetProcedureStepFields:Y.initialize,addAssetProcedureStepFields:Y.addOne,addAssetProcedureStepFieldsMany:Y.addMany,setAssetProcedureStepFields:Y.setOne,setAssetProcedureStepFieldsMany:Y.setMany,updateAssetProcedureStepFields:Y.updateOne,updateAssetProcedureStepFieldsMany:Y.updateMany,deleteAssetProcedureStepFields:Y.deleteOne,deleteAssetProcedureStepFieldsMany:Y.deleteMany}}),{initializeAssetProcedureStepFields:Ur,addAssetProcedureStepFields:qs,addAssetProcedureStepFieldsMany:yA,setAssetProcedureStepFields:AA,setAssetProcedureStepFieldsMany:fA,updateAssetProcedureStepFields:ct,updateAssetProcedureStepFieldsMany:SA,deleteAssetProcedureStepFields:zs,deleteAssetProcedureStepFieldsMany:TA}=js.actions,Us=t=>t.assetProcedureStepFieldsReducer.instances,Cs=d.createSelector([Us],t=>Object.values(t)),IA=f(d.createSelector([Cs,(t,e)=>e],(t,e)=>T(t.filter(i=>i.asset_procedure_step===e)))),gA=f(d.createSelector([Cs,(t,e)=>e],(t,e)=>t.filter(i=>i.asset_procedure_step===e).sort((i,a)=>i.submitted_at>a.submitted_at?-1:1)[0])),bA=d.createSelector([Us],t=>{const e={};for(const i of Object.values(t)){const a=e[i.asset_procedure_step];(!a||a.submitted_at<i.submitted_at)&&(e[i.asset_procedure_step]=i)}return e}),FA=t=>e=>e.assetProcedureStepFieldsReducer.instances[t],Cr=js.reducer,Z=P(t=>t.uuid),Dr=Z.getInitialState({}),Ds=d.createSlice({name:"assetProcedureStepFieldValuesAttachments",initialState:Dr,extraReducers:t=>t.addMatcher(d.isAnyOf(b,M,_),e=>Object.assign(e,Dr)),reducers:{initializeAssetProcedureStepFieldValuesAttachments:Z.initialize,addAssetProcedureStepFieldValuesAttachment:Z.addOne,addAssetProcedureStepFieldValuesAttachments:Z.addMany,setAssetProcedureStepFieldValuesAttachment:Z.setOne,setAssetProcedureStepFieldValuesAttachments:Z.setMany,updateAssetProcedureStepFieldValuesAttachment:Z.updateOne,updateAssetProcedureStepFieldValuesAttachments:Z.updateMany,deleteAssetProcedureStepFieldValuesAttachment:Z.deleteOne,deleteAssetProcedureStepFieldValuesAttachments:Z.deleteMany}}),{initializeAssetProcedureStepFieldValuesAttachments:kr,addAssetProcedureStepFieldValuesAttachment:PA,addAssetProcedureStepFieldValuesAttachments:Rt,setAssetProcedureStepFieldValuesAttachment:_A,setAssetProcedureStepFieldValuesAttachments:OA,updateAssetProcedureStepFieldValuesAttachment:RA,updateAssetProcedureStepFieldValuesAttachments:Br,deleteAssetProcedureStepFieldValuesAttachment:vA,deleteAssetProcedureStepFieldValuesAttachments:vt}=Ds.actions,ks=t=>t.assetProcedureStepFieldValuesAttachmentReducer.instances,$r=d.createSelector([ks],t=>Object.values(t)),wA=t=>e=>e.assetProcedureStepFieldValuesAttachmentReducer.instances[t],Gr=f(d.createSelector([ks,(t,e)=>e],(t,e)=>{const i=new Set(e);return T(Object.values(t).filter(a=>i.has(a.uuid)))})),Lr=f(d.createSelector([$r,(t,e)=>e],(t,e)=>T(t.filter(i=>i.field_values===e)))),Nr=Ds.reducer,J=P(t=>t.uuid),Hr=J.getInitialState({}),Bs=d.createSlice({name:"assetProcedureStepFieldValues",initialState:Hr,extraReducers:t=>t.addMatcher(d.isAnyOf(b,M,_),e=>Object.assign(e,Hr)),reducers:{initializeAssetProcedureStepFieldValues:J.initialize,addAssetProcedureStepFieldValues:J.addOne,addAssetProcedureStepFieldValuesMany:J.addMany,setAssetProcedureStepFieldValues:J.setOne,setAssetProcedureStepFieldValuesMany:J.setMany,updateAssetProcedureStepFieldValues:J.updateOne,updateAssetProcedureStepFieldValuesMany:J.updateMany,deleteAssetProcedureStepFieldValues:J.deleteOne,deleteAssetProcedureStepFieldValuesMany:J.deleteMany}}),{initializeAssetProcedureStepFieldValues:Wr,addAssetProcedureStepFieldValues:$s,addAssetProcedureStepFieldValuesMany:Kr,setAssetProcedureStepFieldValues:MA,setAssetProcedureStepFieldValuesMany:VA,updateAssetProcedureStepFieldValues:nt,updateAssetProcedureStepFieldValuesMany:Yr,deleteAssetProcedureStepFieldValues:Gs,deleteAssetProcedureStepFieldValuesMany:Zr}=Bs.actions,Jr=t=>t.assetProcedureStepFieldValuesReducer.instances,wt=d.createSelector([Jr],t=>Object.values(t)),EA=f(d.createSelector([wt,(t,e)=>e],(t,e)=>T(t.filter(i=>i.asset===e)))),jA=f(d.createSelector([wt,(t,e)=>e],(t,e)=>T(t.filter(i=>i.asset_procedure===e)))),qA=f(d.createSelector([wt,(t,e)=>e],(t,e)=>T(t.filter(i=>i.asset_procedure_step===e)))),Ls=t=>e=>e.assetProcedureStepFieldValuesReducer.instances[t],Xr=Bs.reducer,X=P(t=>t.uuid),Qr=X.getInitialState({}),Ns=d.createSlice({name:"assetProcedureSteps",initialState:Qr,extraReducers:t=>t.addMatcher(d.isAnyOf(b,_),e=>Object.assign(e,Qr)),reducers:{initializeAssetProcedureSteps:X.initialize,setAssetProcedureStep:X.setOne,setAssetProcedureSteps:X.setMany,addAssetProcedureStep:X.addOne,addAssetProcedureSteps:X.addMany,updateAssetProcedureStep:X.updateOne,updateAssetProcedureSteps:X.updateMany,deleteAssetProcedureStep:X.deleteOne,deleteAssetProcedureSteps:X.deleteMany}}),{initializeAssetProcedureSteps:xr,setAssetProcedureStep:ed,setAssetProcedureSteps:zA,addAssetProcedureStep:td,addAssetProcedureSteps:sd,updateAssetProcedureStep:Mt,updateAssetProcedureSteps:UA,deleteAssetProcedureStep:id,deleteAssetProcedureSteps:ad}=Ns.actions,cd=Ns.reducer,rt=t=>t.assetProcedureStepReducer.instances,Hs=t=>e=>e.assetProcedureStepReducer.instances[t],nd=d.createSelector([rt],t=>Object.values(t)),CA=f(d.createSelector([rt,(t,e)=>e],(t,e)=>{const i={};for(const[a,c]of Object.entries(t))c.asset_procedure_type===e&&(i[a]=c);return Pt(i)})),DA=f(d.createSelector([nd,(t,e)=>e],(t,e)=>T(t.filter(i=>i.asset_procedure_type===e)))),kA=f(d.createSelector([rt,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const c=t[a];c?i.push(c):console.warn("selectAssetProcedureStepsByIds: No step exists with the id",a)}return T(i)})),rd=f(d.createSelector([rt,(t,e)=>e],(t,e)=>{if(!t[e])return T([]);const c=An(e,Object.values(t)).all().map(({model:n})=>n);return T(c)})),Q=P(t=>t.uuid),dd=Q.getInitialState({}),Ws=d.createSlice({name:"assets",initialState:dd,extraReducers:t=>t.addMatcher(d.isAnyOf(b,M,_),e=>Object.assign(e,dd)),reducers:{initializeAssets:Q.initialize,addAsset:Q.addOne,addAssets:Q.addMany,setAsset:Q.setOne,setAssets:Q.setMany,updateAsset:Q.updateOne,updateAssets:Q.updateMany,deleteAsset:Q.deleteOne,deleteAssets:Q.deleteMany}}),{initializeAssets:ud,addAsset:Ks,addAssets:Vt,updateAsset:dt,updateAssets:BA,deleteAsset:Ys,deleteAssets:Zs,setAsset:$A,setAssets:GA}=Ws.actions,Js=t=>t.assetReducer.instances,od=d.createSelector([Js],t=>T(Object.values(t))),Xs=f(d.createSelector([od,(t,e)=>e],(t,e)=>T(t.filter(i=>i.asset_type===e)))),Qs=t=>e=>e.assetReducer.instances[t],ld=f(d.createSelector([Js,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const c=t[a];c&&i.push(c)}return T(i)})),LA=t=>e=>Xs(t)(e).length,hd=Ws.reducer,x=P(t=>t.uuid),md=x.getInitialState({}),xs=d.createSlice({name:"assetStageCompletions",initialState:md,extraReducers:t=>t.addMatcher(d.isAnyOf(b,M,_),e=>Object.assign(e,md)),reducers:{initializeAssetStageCompletions:x.initialize,addAssetStageCompletion:x.addOne,addAssetStageCompletions:x.addMany,setAssetStageCompletion:x.setOne,setAssetStageCompletions:x.setMany,updateAssetStageCompletion:x.updateOne,updateAssetStageCompletions:x.updateMany,deleteAssetStageCompletion:x.deleteOne,deleteAssetStageCompletions:x.deleteMany}}),{initializeAssetStageCompletions:pd,addAssetStageCompletion:ei,addAssetStageCompletions:ti,setAssetStageCompletion:NA,setAssetStageCompletions:HA,updateAssetStageCompletion:yd,updateAssetStageCompletions:Ad,deleteAssetStageCompletion:si,deleteAssetStageCompletions:ii}=xs.actions,fd=xs.reducer,ai=t=>t.assetStageCompletionReducer.instances,WA=d.createSelector([ai],t=>Object.values(t)),Sd=t=>e=>e.assetStageCompletionReducer.instances[t],Td=f(d.createSelector([ai,(t,e)=>e],(t,e)=>{const i=new Set(e);return T(Object.values(t).filter(a=>i.has(a.uuid)))})),ee=P(t=>t.uuid),Id=ee.getInitialState({}),ci=d.createSlice({name:"assetStages",initialState:Id,extraReducers:t=>t.addMatcher(d.isAnyOf(b,_),e=>Object.assign(e,Id)),reducers:{initializeAssetStages:ee.initialize,setAssetStage:ee.setOne,setAssetStages:ee.setMany,addAssetStage:ee.addOne,addAssetStages:ee.addMany,updateAssetStage:ee.updateOne,updateAssetStages:ee.updateMany,deleteAssetStage:ee.deleteOne,deleteAssetStages:ee.deleteMany}}),{initializeAssetStages:gd,setAssetStage:bd,setAssetStages:KA,addAssetStage:ni,addAssetStages:YA,updateAssetStage:Et,updateAssetStages:ZA,deleteAssetStage:ri,deleteAssetStages:JA}=ci.actions,Fd=ci.reducer,jt=t=>t.assetStageReducer.instances,di=t=>e=>e.assetStageReducer.instances[t],Pd=d.createSelector([jt],t=>Object.values(t)),XA=f(d.createSelector([jt,(t,e)=>e],(t,e)=>{const i={};for(const[a,c]of Object.entries(t))c.asset_procedure_type===e&&(i[a]=c);return Pt(i)})),QA=f(d.createSelector([Pd,(t,e)=>e],(t,e)=>T(t.filter(i=>i.asset_procedure_type===e)))),xA=f(d.createSelector([jt,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const c=t[a];c?i.push(c):console.warn("selectStagesFromStageIds: No stage exists with the id",a)}return T(i)})),te=P(t=>t.uuid),_d=te.getInitialState({}),ui=d.createSlice({name:"assetTypeAttachments",initialState:_d,extraReducers:t=>t.addMatcher(d.isAnyOf(b,_),e=>Object.assign(e,_d)),reducers:{initializeAssetTypeAttachments:te.initialize,addAssetTypeAttachment:te.addOne,addAssetTypeAttachments:te.addMany,setAssetTypeAttachment:te.setOne,setAssetTypeAttachments:te.setMany,updateAssetTypeAttachment:te.updateOne,updateAssetTypeAttachments:te.updateMany,deleteAssetTypeAttachment:te.deleteOne,deleteAssetTypeAttachments:te.deleteMany}}),{initializeAssetTypeAttachments:oi,addAssetTypeAttachment:ef,addAssetTypeAttachments:li,setAssetTypeAttachment:Od,setAssetTypeAttachments:tf,updateAssetTypeAttachment:sf,updateAssetTypeAttachments:Rd,deleteAssetTypeAttachment:vd,deleteAssetTypeAttachments:hi}=ui.actions,wd=t=>t.assetTypeAttachmentReducer.instances,Md=d.createSelector([wd],t=>Object.values(t)),Vd=t=>e=>e.assetTypeAttachmentReducer.instances[t],Ed=f(d.createSelector([Md,(t,e)=>e],(t,e)=>T(t.filter(({asset_type:i})=>e===i)))),jd=ui.reducer,se=P(t=>t.uuid),qd=se.getInitialState({}),mi=d.createSlice({name:"assetTypeFieldsAttachments",initialState:qd,extraReducers:t=>t.addMatcher(d.isAnyOf(b,_),e=>Object.assign(e,qd)),reducers:{initializeAssetTypeFieldsAttachments:se.initialize,addAssetTypeFieldsAttachment:se.addOne,addAssetTypeFieldsAttachments:se.addMany,setAssetTypeFieldsAttachment:se.setOne,setAssetTypeFieldsAttachments:se.setMany,updateAssetTypeFieldsAttachment:se.updateOne,updateAssetTypeFieldsAttachments:se.updateMany,deleteAssetTypeFieldsAttachment:se.deleteOne,deleteAssetTypeFieldsAttachments:se.deleteMany}}),{initializeAssetTypeFieldsAttachments:zd,addAssetTypeFieldsAttachment:af,addAssetTypeFieldsAttachments:Ud,setAssetTypeFieldsAttachment:cf,setAssetTypeFieldsAttachments:nf,updateAssetTypeFieldsAttachment:rf,updateAssetTypeFieldsAttachments:Cd,deleteAssetTypeFieldsAttachment:df,deleteAssetTypeFieldsAttachments:Dd}=mi.actions,kd=t=>t.assetTypeFieldsAttachmentReducer.instances,Bd=d.createSelector([kd],t=>Object.values(t)),uf=f(d.createSelector([Bd,(t,e)=>e],(t,e)=>T(t.filter(i=>i.fields_revision===e)))),of=t=>e=>e.assetTypeFieldsAttachmentReducer.instances[t],$d=mi.reducer,ie=P(t=>t.uuid),Gd=ie.getInitialState({}),pi=d.createSlice({name:"assetTypeFields",initialState:Gd,extraReducers:t=>t.addMatcher(d.isAnyOf(b,_),e=>Object.assign(e,Gd)),reducers:{initializeAssetTypeFields:ie.initialize,addAssetTypeFields:ie.addOne,addAssetTypeFieldsMany:ie.addMany,setAssetTypeFields:ie.setOne,setAssetTypeFieldsMany:ie.setMany,updateAssetTypeFields:ie.updateOne,updateAssetTypeFieldsMany:ie.updateMany,deleteAssetTypeFields:ie.deleteOne,deleteAssetTypeFieldsMany:ie.deleteMany}}),{initializeAssetTypeFields:Ld,addAssetTypeFields:Nd,addAssetTypeFieldsMany:lf,setAssetTypeFields:hf,setAssetTypeFieldsMany:mf,updateAssetTypeFields:Hd,updateAssetTypeFieldsMany:pf,deleteAssetTypeFields:Wd,deleteAssetTypeFieldsMany:yf}=pi.actions,Kd=t=>t.assetTypeFieldsReducer.instances,qt=d.createSelector([Kd],t=>Object.values(t)),Af=f(d.createSelector([qt,(t,e)=>e],(t,e)=>T(t.filter(i=>i.asset_type===e)))),ff=f(d.createSelector([qt,(t,e)=>e],(t,e)=>t.filter(i=>i.asset_type===e).sort((i,a)=>i.submitted_at>a.submitted_at?-1:1)[0])),Sf=t=>e=>e.assetTypeFieldsReducer.instances[t],Yd=pi.reducer,ae=P(t=>t.uuid),Zd=ae.getInitialState({}),yi=d.createSlice({name:"assetTypeFieldValuesAttachments",initialState:Zd,extraReducers:t=>t.addMatcher(d.isAnyOf(b,M,_),e=>Object.assign(e,Zd)),reducers:{initializeAssetTypeFieldValuesAttachments:ae.initialize,addAssetTypeFieldValuesAttachment:ae.addOne,addAssetTypeFieldValuesAttachments:ae.addMany,setAssetTypeFieldValuesAttachment:ae.setOne,setAssetTypeFieldValuesAttachments:ae.setMany,updateAssetTypeFieldValuesAttachment:ae.updateOne,updateAssetTypeFieldValuesAttachments:ae.updateMany,deleteAssetTypeFieldValuesAttachment:ae.deleteOne,deleteAssetTypeFieldValuesAttachments:ae.deleteMany}}),{initializeAssetTypeFieldValuesAttachments:Jd,addAssetTypeFieldValuesAttachment:Tf,addAssetTypeFieldValuesAttachments:zt,setAssetTypeFieldValuesAttachment:If,setAssetTypeFieldValuesAttachments:gf,updateAssetTypeFieldValuesAttachment:bf,updateAssetTypeFieldValuesAttachments:Xd,deleteAssetTypeFieldValuesAttachment:Ff,deleteAssetTypeFieldValuesAttachments:Ut}=yi.actions,Ai=t=>t.assetTypeFieldValuesAttachmentReducer.instances,Qd=d.createSelector([Ai],t=>Object.values(t)),Pf=t=>e=>e.assetTypeFieldValuesAttachmentReducer.instances[t],xd=f(d.createSelector([Ai,(t,e)=>e],(t,e)=>{const i=new Set(e);return T(Object.values(t).filter(a=>i.has(a.uuid)))})),eu=f(d.createSelector([Qd,(t,e)=>e],(t,e)=>T(t.filter(i=>i.field_values===e)))),tu=yi.reducer,ce=P(t=>t.uuid),su=ce.getInitialState({}),fi=d.createSlice({name:"assetTypeFieldValues",initialState:su,extraReducers:t=>t.addMatcher(d.isAnyOf(b,M,_),e=>Object.assign(e,su)),reducers:{initializeAssetTypeFieldValues:ce.initialize,addAssetTypeFieldValues:ce.addOne,addAssetTypeFieldValuesMany:ce.addMany,setAssetTypeFieldValues:ce.setOne,setAssetTypeFieldValuesMany:ce.setMany,updateAssetTypeFieldValues:ce.updateOne,updateAssetTypeFieldValuesMany:ce.updateMany,deleteAssetTypeFieldValues:ce.deleteOne,deleteAssetTypeFieldValuesMany:ce.deleteMany}}),{initializeAssetTypeFieldValues:iu,addAssetTypeFieldValues:Si,addAssetTypeFieldValuesMany:au,setAssetTypeFieldValues:_f,setAssetTypeFieldValuesMany:Of,updateAssetTypeFieldValues:ut,updateAssetTypeFieldValuesMany:cu,deleteAssetTypeFieldValues:Ti,deleteAssetTypeFieldValuesMany:nu}=fi.actions,ru=t=>t.assetTypeFieldValuesReducer.instances,Ii=d.createSelector([ru],t=>Object.values(t)),Rf=f(d.createSelector([Ii,(t,e)=>e],(t,e)=>T(t.filter(i=>i.asset===e)))),vf=f(d.createSelector([qt,Ii,(t,e)=>e],(t,e,i)=>{const a=new Set(t.filter(c=>c.asset_type===i).map(c=>c.uuid));return T(e.filter(c=>a.has(c.fields_revision)))})),gi=t=>e=>e.assetTypeFieldValuesReducer.instances[t],du=fi.reducer,ne=P(t=>t.uuid),uu=ne.getInitialState({}),bi=d.createSlice({name:"assetTypeIdentifiers",initialState:uu,extraReducers:t=>t.addMatcher(d.isAnyOf(b,_),e=>Object.assign(e,uu)),reducers:{initializeAssetTypeIdentifiers:ne.initialize,addAssetTypeIdentifier:ne.addOne,addAssetTypeIdentifiers:ne.addMany,setAssetTypeIdentifier:ne.setOne,setAssetTypeIdentifiers:ne.setMany,updateAssetTypeIdentifier:ne.updateOne,updateAssetTypeIdentifiers:ne.updateMany,deleteAssetTypeIdentifier:ne.deleteOne,deleteAssetTypeIdentifiers:ne.deleteMany}}),{initializeAssetTypeIdentifiers:ou,addAssetTypeIdentifier:Fi,addAssetTypeIdentifiers:wf,setAssetTypeIdentifier:Mf,setAssetTypeIdentifiers:Vf,updateAssetTypeIdentifier:ot,updateAssetTypeIdentifiers:Ef,deleteAssetTypeIdentifier:Pi,deleteAssetTypeIdentifiers:jf}=bi.actions,lu=t=>t.assetTypeIdentifierReducer.instances,hu=d.createSelector([lu],t=>Object.values(t)),_i=t=>e=>e.assetTypeIdentifierReducer.instances[t],qf=f(d.createSelector([hu,(t,e)=>e],(t,e)=>T(t.filter(i=>i.asset_type===e)))),mu=bi.reducer,re=P(t=>t.uuid),pu=re.getInitialState({}),Oi=d.createSlice({name:"assetTypeIdentifierValues",initialState:pu,extraReducers:t=>t.addMatcher(d.isAnyOf(b,M,_),e=>Object.assign(e,pu)),reducers:{initializeAssetTypeIdentifierValues:re.initialize,addAssetTypeIdentifierValue:re.addOne,addAssetTypeIdentifierValues:re.addMany,setAssetTypeIdentifierValue:re.setOne,setAssetTypeIdentifierValues:re.setMany,updateAssetTypeIdentifierValue:re.updateOne,updateAssetTypeIdentifierValues:re.updateMany,deleteAssetTypeIdentifierValue:re.deleteOne,deleteAssetTypeIdentifierValues:re.deleteMany}}),{initializeAssetTypeIdentifierValues:yu,addAssetTypeIdentifierValue:Ri,addAssetTypeIdentifierValues:zf,setAssetTypeIdentifierValue:Uf,setAssetTypeIdentifierValues:Cf,updateAssetTypeIdentifierValue:lt,updateAssetTypeIdentifierValues:Df,deleteAssetTypeIdentifierValue:vi,deleteAssetTypeIdentifierValues:kf}=Oi.actions,Au=t=>t.assetTypeIdentifierValueReducer.instances,wi=d.createSelector([Au],t=>Object.values(t)),Mi=t=>e=>e.assetTypeIdentifierValueReducer.instances[t],Bf=f(d.createSelector([wi,(t,e)=>e],(t,e)=>T(t.filter(i=>i.asset===e)))),$f=f(d.createSelector([wi,(t,e)=>e],(t,e)=>T(t.filter(i=>i.asset_type_identifier===e)))),fu=Oi.reducer,de=P(t=>t.uuid),Su=de.getInitialState({}),Vi=d.createSlice({name:"assetTypes",initialState:Su,extraReducers:t=>t.addMatcher(d.isAnyOf(b,_),e=>Object.assign(e,Su)),reducers:{initializeAssetTypes:de.initialize,setAssetType:de.setOne,setAssetTypes:de.setMany,addAssetType:de.addOne,addAssetTypes:de.addMany,updateAssetType:de.updateOne,updateAssetTypes:de.updateMany,deleteAssetType:de.deleteOne,deleteAssetTypes:de.deleteMany}}),{initializeAssetTypes:Tu,setAssetType:Gf,setAssetTypes:Lf,addAssetType:Ei,addAssetTypes:Nf,updateAssetType:ht,updateAssetTypes:Hf,deleteAssetType:ji,deleteAssetTypes:Wf}=Vi.actions,qi=t=>t.assetTypeReducer.instances,Iu=d.createSelector([qi],t=>Object.values(t)),zi=t=>e=>e.assetTypeReducer.instances[t],Kf=f(d.createSelector([qi,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const c=t[a];c?i.push(c):console.warn("selectAssetTypesByIds: No assetType exists with the id",a)}return T(i)})),Yf=f(d.createSelector([Iu,(t,e)=>e],(t,e)=>T(t.filter(i=>i.organization===e)))),gu=Vi.reducer,bu={accessToken:"",refreshToken:"",isLoggedIn:!1},Ct=d.createSlice({name:"auth",initialState:bu,extraReducers:t=>t.addCase(b,e=>Object.assign(e,bu)),reducers:{setTokens:(t,e)=>{t.accessToken=e.payload.accessToken,t.refreshToken=e.payload.refreshToken},clearTokens:t=>{t.accessToken="",t.refreshToken=""},setLoggedIn:(t,e)=>{e.payload||Ct.caseReducers.clearTokens(t),t.isLoggedIn=e.payload}}}),{setTokens:Zf,clearTokens:Jf,setLoggedIn:Fu}=Ct.actions,Xf=t=>t.authReducer.accessToken,Qf=t=>t.authReducer.isLoggedIn,Pu=Ct.reducer,ue=P(t=>t.uuid),_u=ue.getInitialState({}),Ui=d.createSlice({name:"categories",initialState:_u,extraReducers:t=>t.addMatcher(d.isAnyOf(b,_),e=>Object.assign(e,_u)),reducers:{initializeCategories:ue.initialize,addCategory:ue.addOne,addCategories:ue.addMany,setCategory:ue.setOne,setCategories:ue.setMany,updateCategory:ue.updateOne,updateCategories:ue.updateMany,deleteCategory:ue.deleteOne,deleteCategories:ue.deleteMany}}),{initializeCategories:Ou,addCategory:Ci,addCategories:xf,setCategory:eS,setCategories:tS,updateCategory:Ru,updateCategories:sS,deleteCategory:vu,deleteCategories:iS}=Ui.actions,Di=t=>t.categoryReducer.instances,wu=d.createSelector([Di],t=>Object.values(t)),ki=t=>e=>e.categoryReducer.instances[t],aS=f(d.createSelector([Di,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const c=t[a];c?i.push(c):console.warn("selectCategoryByIds: No category exists with the id",a)}return T(i)})),cS=f(d.createSelector([wu,(t,e)=>e],(t,e)=>T(t.filter(i=>i.project===e)))),Mu=Ui.reducer,oe=P(t=>t.uuid),Vu=oe.getInitialState({}),Bi=d.createSlice({name:"documentAttachments",initialState:Vu,extraReducers:t=>t.addCase(b,e=>Object.assign(e,Vu)),reducers:{initializeDocumentAttachments:oe.initialize,addDocumentAttachment:oe.addOne,addDocumentAttachments:oe.addMany,setDocumentAttachment:oe.setOne,setDocumentAttachments:oe.setMany,updateDocumentAttachment:oe.updateOne,updateDocumentAttachments:oe.updateMany,deleteDocumentAttachment:oe.deleteOne,deleteDocumentAttachments:oe.deleteMany}}),{initializeDocumentAttachments:$i,addDocumentAttachment:nS,addDocumentAttachments:Eu,setDocumentAttachment:ju,setDocumentAttachments:rS,updateDocumentAttachment:dS,updateDocumentAttachments:qu,deleteDocumentAttachment:zu,deleteDocumentAttachments:Uu}=Bi.actions,Cu=t=>t.documentAttachmentReducer.instances,Du=d.createSelector([Cu],t=>Object.values(t)),ku=t=>e=>e.documentAttachmentReducer.instances[t],uS=f(d.createSelector([Du,(t,e)=>e],(t,e)=>T(t.filter(({document:i})=>e===i)))),Bu=Bi.reducer,$u={documents:{}},Gi=d.createSlice({name:"documents",initialState:$u,extraReducers:t=>t.addCase(b,e=>{Object.assign(e,$u)}),reducers:{setDocuments:(t,e)=>{if(e.payload.filter(pn).length!==e.payload.length)throw new Error("Tried to use setIssues reducer with duplicate ID's");t.documents=hn(e.payload)},addDocuments:(t,e)=>{for(const i of e.payload)if(i.uuid in t.documents)throw new Error(`attempting to add a document with uuid ${i.uuid} which already exists in state.documents.`);for(const i of e.payload){if(i.parent_document&&t.documents[i.parent_document]){const a=t.documents[i.parent_document];t.documents[i.parent_document]={...a,children_documents:[...a.children_documents,i.uuid]}}t.documents[i.uuid]=i}},updateDocuments:(t,e)=>{for(const i of e.payload)if(!(i.uuid in t.documents))throw new Error(`attempting to update a document with uuid ${i.uuid} which doesn't exists in state.documents.`);for(const i of e.payload){const a=t.documents[i.uuid];if(i.organization!==void 0&&i.organization!==a.organization)throw new Error("organization cannot be updated");if(i.project!==void 0&&i.project!==a.project)throw new Error("project cannot be updated");t.documents[i.uuid]={...a,...i}}},removeDocuments:(t,e)=>{for(const i of e.payload)if(!(i in t.documents))throw new Error(`attempting to delete a document with uuid ${i} which doesn't exists in state.documents.`);for(const i of e.payload){const a=t.documents[i];if(a.parent_document&&t.documents[a.parent_document]){const c=t.documents[a.parent_document];t.documents[a.parent_document]={...c,children_documents:c.children_documents.filter(n=>n!==a.uuid)}}delete t.documents[i]}}}}),{setDocuments:Gu,addDocuments:Lu,updateDocuments:Xe,removeDocuments:Li}=Gi.actions,Dt=t=>t.documentsReducer.documents,Ni=d.createSelector([Dt],t=>Object.values(t)),Nu=t=>e=>e.documentsReducer.documents[t],oS=f(d.createSelector([Dt,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const c=t[a];c?i.push(c):console.warn("selectDocumentByIds: No document exists with the id",a)}return T(i)})),lS=f(d.createSelector([Ni,(t,e)=>e],(t,e)=>t.filter(i=>i.project===e))),hS=f(d.createSelector([Ni,(t,e)=>e],(t,e)=>t.filter(i=>i.organization===e))),Hu=Gi.reducer,Wu={s3Urls:{}},Ku=1e3*60*60,mS=Ku*24*7,Hi=d.createSlice({name:"file",initialState:Wu,extraReducers:t=>t.addCase(b,e=>Object.assign(e,Wu)),reducers:{setUploadUrl:(t,e)=>{const{url:i,fields:a,sha1:c}=e.payload,n=new Date,r=new Date(n.getTime()+mS);t.s3Urls[c]={url:i,fields:a,exp:r.getTime()}}}}),{setUploadUrl:Yu}=Hi.actions,Zu=t=>e=>{const i=e.fileReducer.s3Urls[t];if(!i)return;const a=new Date().getTime();if(!((i.exp??a)-a<Ku))return i},Ju=Hi.reducer,le=P(t=>t.uuid),Xu=le.getInitialState({}),Wi=d.createSlice({name:"formIdentifiers",initialState:Xu,extraReducers:t=>t.addMatcher(d.isAnyOf(b,_),e=>Object.assign(e,Xu)),reducers:{initializeFormIdentifiers:le.initialize,addFormIdentifier:le.addOne,addFormIdentifiers:le.addMany,setFormIdentifier:le.setOne,setFormIdentifiers:le.setMany,updateFormIdentifier:le.updateOne,updateFormIdentifiers:le.updateMany,deleteFormIdentifier:le.deleteOne,deleteFormIdentifiers:le.deleteMany}}),{initializeFormIdentifiers:Qu,addFormIdentifier:Ki,addFormIdentifiers:pS,setFormIdentifier:yS,setFormIdentifiers:AS,updateFormIdentifier:mt,updateFormIdentifiers:fS,deleteFormIdentifier:Yi,deleteFormIdentifiers:SS}=Wi.actions,xu=t=>t.formIdentifierReducer.instances,eo=d.createSelector([xu],t=>Object.values(t)),Zi=t=>e=>e.formIdentifierReducer.instances[t],TS=f(d.createSelector([eo,(t,e)=>e],(t,e)=>T(t.filter(i=>i.form===e)))),to=Wi.reducer,he=P(t=>t.uuid),so=he.getInitialState({}),Ji=d.createSlice({name:"formIdentifierValues",initialState:so,extraReducers:t=>t.addMatcher(d.isAnyOf(b,_),e=>Object.assign(e,so)),reducers:{initializeFormIdentifierValues:he.initialize,addFormIdentifierValue:he.addOne,addFormIdentifierValues:he.addMany,setFormIdentifierValue:he.setOne,setFormIdentifierValues:he.setMany,updateFormIdentifierValue:he.updateOne,updateFormIdentifierValues:he.updateMany,deleteFormIdentifierValue:he.deleteOne,deleteFormIdentifierValues:he.deleteMany}}),{initializeFormIdentifierValues:io,addFormIdentifierValue:Xi,addFormIdentifierValues:IS,setFormIdentifierValue:gS,setFormIdentifierValues:bS,updateFormIdentifierValue:pt,updateFormIdentifierValues:FS,deleteFormIdentifierValue:Qi,deleteFormIdentifierValues:PS}=Ji.actions,ao=t=>t.formIdentifierValueReducer.instances,xi=d.createSelector([ao],t=>Object.values(t)),ea=t=>e=>e.formIdentifierValueReducer.instances[t],_S=f(d.createSelector([xi,(t,e)=>e],(t,e)=>T(t.filter(i=>i.form_submission===e)))),OS=f(d.createSelector([xi,(t,e)=>e],(t,e)=>T(t.filter(i=>i.form_identifier===e)))),co=Ji.reducer,me=P(t=>t.uuid),no=me.getInitialState({}),ta=d.createSlice({name:"formRevisionAttachments",initialState:no,extraReducers:t=>t.addMatcher(d.isAnyOf(b,_),e=>Object.assign(e,no)),reducers:{initializeFormRevisionAttachments:me.initialize,addFormRevisionAttachment:me.addOne,addFormRevisionAttachments:me.addMany,setFormRevisionAttachment:me.setOne,setFormRevisionAttachments:me.setMany,updateFormRevisionAttachment:me.updateOne,updateFormRevisionAttachments:me.updateMany,deleteFormRevisionAttachment:me.deleteOne,deleteFormRevisionAttachments:me.deleteMany}}),{initializeFormRevisionAttachments:ro,addFormRevisionAttachment:RS,addFormRevisionAttachments:uo,setFormRevisionAttachment:vS,setFormRevisionAttachments:wS,updateFormRevisionAttachment:MS,updateFormRevisionAttachments:oo,deleteFormRevisionAttachment:VS,deleteFormRevisionAttachments:lo}=ta.actions,ho=t=>t.formRevisionAttachmentReducer.instances,ES=f(d.createSelector([ho,(t,e)=>e],(t,e)=>T(Object.values(t).filter(i=>i.form_revision===e)))),mo=ta.reducer,pe=P(t=>t.uuid),po=pe.getInitialState({}),sa=d.createSlice({name:"formRevisions",initialState:po,extraReducers:t=>t.addMatcher(d.isAnyOf(b,_),e=>Object.assign(e,po)),reducers:{initializeFormRevisions:pe.initialize,addFormRevision:pe.addOne,addFormRevisions:pe.addMany,setFormRevision:pe.setOne,setFormRevisions:pe.setMany,updateFormRevision:pe.updateOne,updateFormRevisions:pe.updateMany,deleteFormRevision:pe.deleteOne,deleteFormRevisions:pe.deleteMany}}),{initializeFormRevisions:yo,addFormRevision:ia,addFormRevisions:Ao,setFormRevision:fo,setFormRevisions:jS,updateFormRevision:qS,updateFormRevisions:zS,deleteFormRevision:aa,deleteFormRevisions:So}=sa.actions,ca=t=>t.formRevisionReducer.instances,na=d.createSelector([ca],t=>Object.values(t)),US=t=>e=>e.formRevisionReducer.instances[t],CS=f(d.createSelector([na,(t,e)=>e],(t,e)=>t.filter(i=>i.form===e).sort((i,a)=>i.submitted_at>a.submitted_at?-1:1)[0])),To=f(d.createSelector([na,(t,e)=>e],(t,e)=>T(t.filter(i=>i.form===e)))),Io=sa.reducer,ye=P(t=>t.uuid),go=ye.getInitialState({}),ra=d.createSlice({name:"forms",initialState:go,extraReducers:t=>t.addMatcher(d.isAnyOf(b,_),e=>Object.assign(e,go)),reducers:{initializeForms:ye.initialize,addForm:ye.addOne,addForms:ye.addMany,setForm:ye.setOne,setForms:ye.setMany,updateForm:ye.updateOne,updateForms:ye.updateMany,deleteForm:ye.deleteOne,deleteForms:ye.deleteMany}}),{initializeForms:bo,addForm:da,addForms:DS,setForm:kS,setForms:BS,updateForm:$S,updateForms:GS,deleteForm:ua,deleteForms:LS}=ra.actions,Fo=ra.reducer,Po=t=>t.formReducer.instances,_o=d.createSelector([Po],t=>Object.values(t)),Oo=t=>e=>e.formReducer.instances[t],NS=f(d.createSelector([_o,(t,e)=>e],(t,e)=>T(t.filter(i=>i.organization===e)))),Ae=P(t=>t.uuid),Ro=Ae.getInitialState({}),oa=d.createSlice({name:"formSubmissionAttachments",initialState:Ro,extraReducers:t=>t.addMatcher(d.isAnyOf(b,_),e=>Object.assign(e,Ro)),reducers:{initializeFormSubmissionAttachments:Ae.initialize,addFormSubmissionAttachment:Ae.addOne,addFormSubmissionAttachments:Ae.addMany,setFormSubmissionAttachment:Ae.setOne,setFormSubmissionAttachments:Ae.setMany,updateFormSubmissionAttachment:Ae.updateOne,updateFormSubmissionAttachments:Ae.updateMany,deleteFormSubmissionAttachment:Ae.deleteOne,deleteFormSubmissionAttachments:Ae.deleteMany}}),{initializeFormSubmissionAttachments:vo,addFormSubmissionAttachment:HS,addFormSubmissionAttachments:kt,setFormSubmissionAttachment:WS,setFormSubmissionAttachments:KS,updateFormSubmissionAttachment:YS,updateFormSubmissionAttachments:wo,deleteFormSubmissionAttachment:ZS,deleteFormSubmissionAttachments:Bt}=oa.actions,Mo=t=>t.formSubmissionAttachmentReducer.instances,la=d.createSelector([Mo],t=>Object.values(t)),Vo=f(d.createSelector([la,(t,e)=>e],(t,e)=>{const i=new Set(e);return T(t.filter(a=>i.has(a.uuid)))})),Eo=f(d.createSelector([la,(t,e)=>e],(t,e)=>T(t.filter(i=>i.form_submission===e)))),jo=oa.reducer,fe=P(t=>t.uuid),qo=fe.getInitialState({}),ha=d.createSlice({name:"formSubmissions",initialState:qo,extraReducers:t=>t.addMatcher(d.isAnyOf(b,_),e=>Object.assign(e,qo)),reducers:{initializeFormSubmissions:fe.initialize,setFormSubmission:fe.setOne,setFormSubmissions:fe.setMany,addFormSubmission:fe.addOne,addFormSubmissions:fe.addMany,updateFormSubmission:fe.updateOne,updateFormSubmissions:fe.updateMany,deleteFormSubmission:fe.deleteOne,deleteFormSubmissions:fe.deleteMany}}),{initializeFormSubmissions:zo,setFormSubmission:$t,setFormSubmissions:JS,addFormSubmission:ma,addFormSubmissions:Uo,updateFormSubmission:Co,updateFormSubmissions:XS,deleteFormSubmission:pa,deleteFormSubmissions:Do}=ha.actions,ya=t=>t.formSubmissionReducer.instances,QS=d.createSelector([ya],t=>Object.values(t)),Aa=t=>e=>e.formSubmissionReducer.instances[t],ko=f(d.createSelector([ya,ca,(t,e)=>e],(t,e,i)=>{const a=new Set;for(const c of Object.values(e))c.form===i&&a.add(c.uuid);return Object.values(t).filter(c=>a.has(c.form_revision))})),Bo=ha.reducer,Se=P(t=>t.uuid),$o=Se.getInitialState({}),fa=d.createSlice({name:"geoImages",initialState:$o,extraReducers:t=>t.addMatcher(d.isAnyOf(b,M,_),e=>Object.assign(e,$o)),reducers:{initializeGeoImages:Se.initialize,setGeoImage:Se.setOne,setGeoImages:Se.setMany,addGeoImage:Se.addOne,addGeoImages:Se.addMany,updateGeoImage:Se.updateOne,updateGeoImages:Se.updateMany,deleteGeoImage:Se.deleteOne,deleteGeoImages:Se.deleteMany}}),{initializeGeoImages:Go,setGeoImage:yt,setGeoImages:Lo,addGeoImage:No,addGeoImages:Ho,updateGeoImage:Wo,updateGeoImages:xS,deleteGeoImage:Sa,deleteGeoImages:Ko}=fa.actions,Yo=t=>t.geoImageReducer.instances,Zo=d.createSelector([Yo],t=>Object.values(t)),Ta=t=>e=>e.geoImageReducer.instances[t],eT=f(d.createSelector([Zo,(t,e)=>e],(t,e)=>T(t.filter(i=>i.project===e)))),Jo=fa.reducer,Te=P(t=>t.uuid),Xo=Te.getInitialState({}),Ia=d.createSlice({name:"issueAssociations",initialState:Xo,extraReducers:t=>t.addMatcher(d.isAnyOf(b,M,_),e=>Object.assign(e,Xo)),reducers:{initializeIssueAssociations:Te.initialize,addIssueAssociation:Te.addOne,addIssueAssociations:Te.addMany,setIssueAssociation:Te.setOne,setIssueAssociations:Te.setMany,updateIssueAssociation:Te.updateOne,updateIssueAssociations:Te.updateMany,deleteIssueAssociation:Te.deleteOne,deleteIssueAssociations:Te.deleteMany}}),{initializeIssueAssociations:Qo,setIssueAssociations:tT,setIssueAssociation:sT,updateIssueAssociation:xo,updateIssueAssociations:iT,addIssueAssociation:ga,addIssueAssociations:ba,deleteIssueAssociation:Fa,deleteIssueAssociations:Pa}=Ia.actions,At=t=>t.issueAssociationReducer.instances,aT=d.createSelector([At],t=>Object.values(t)),el=t=>e=>e.issueAssociationReducer.instances[t],tl=f(d.createSelector([At,(t,e)=>e],(t,e)=>T(Object.values(t).filter(i=>i.associated_issue===e)))),sl=f(d.createSelector([At,(t,e)=>e],(t,e)=>T(Object.values(t).filter(i=>i.issue===e)))),il=f(d.createSelector([At,(t,e)=>e],(t,e)=>T(Object.values(t).filter(i=>i.asset===e)))),al=Ia.reducer,Ie=P(t=>t.uuid),cl=Ie.getInitialState({}),_a=d.createSlice({name:"issueAttachments",initialState:cl,extraReducers:t=>t.addMatcher(d.isAnyOf(b,M,_),e=>Object.assign(e,cl)),reducers:{initializeIssueAttachments:Ie.initialize,addIssueAttachment:Ie.addOne,addIssueAttachments:Ie.addMany,setIssueAttachment:Ie.setOne,setIssueAttachments:Ie.setMany,updateIssueAttachment:Ie.updateOne,updateIssueAttachments:Ie.updateMany,deleteIssueAttachment:Ie.deleteOne,deleteIssueAttachments:Ie.deleteMany}}),{initializeIssueAttachments:Oa,addIssueAttachment:cT,addIssueAttachments:Ra,setIssueAttachment:nl,setIssueAttachments:nT,updateIssueAttachment:rT,updateIssueAttachments:rl,deleteIssueAttachment:dl,deleteIssueAttachments:va}=_a.actions,ul=t=>t.issueAttachmentReducer.instances,ol=d.createSelector([ul],t=>Object.values(t)),ll=f(d.createSelector([ol,(t,e)=>e],(t,e)=>T(t.filter(({issue:i})=>e===i)))),hl=t=>e=>e.issueAttachmentReducer.instances[t],ml=_a.reducer,ge=P(t=>t.uuid),pl=ge.getInitialState({}),wa=d.createSlice({name:"issueCommentAttachments",initialState:pl,extraReducers:t=>t.addMatcher(d.isAnyOf(b,M,_),e=>Object.assign(e,pl)),reducers:{initializeIssueCommentAttachments:ge.initialize,addIssueCommentAttachment:ge.addOne,addIssueCommentAttachments:ge.addMany,setIssueCommentAttachment:ge.setOne,setIssueCommentAttachments:ge.setMany,updateIssueCommentAttachment:ge.updateOne,updateIssueCommentAttachments:ge.updateMany,deleteIssueCommentAttachment:ge.deleteOne,deleteIssueCommentAttachments:ge.deleteMany}}),{initializeIssueCommentAttachments:Ma,addIssueCommentAttachment:dT,addIssueCommentAttachments:yl,setIssueCommentAttachment:Al,setIssueCommentAttachments:uT,updateIssueCommentAttachment:oT,updateIssueCommentAttachments:fl,deleteIssueCommentAttachment:Sl,deleteIssueCommentAttachments:Tl}=wa.actions,Il=t=>t.issueCommentAttachmentReducer.instances,gl=d.createSelector([Il],t=>Object.values(t)),bl=t=>e=>e.issueCommentAttachmentReducer.instances[t],lT=f(d.createSelector([gl,(t,e)=>e],(t,e)=>T(t.filter(({issue_comment:i})=>e===i)))),Fl=wa.reducer,be=P(t=>t.uuid),Pl=be.getInitialState({}),Va=d.createSlice({name:"issueComments",initialState:Pl,extraReducers:t=>t.addMatcher(d.isAnyOf(b,M,_),e=>Object.assign(e,Pl)),reducers:{initializeIssueComments:be.initialize,addIssueComment:be.addOne,addIssueComments:be.addMany,setIssueComment:be.setOne,setIssueComments:be.setMany,updateIssueComment:be.updateOne,updateIssueComments:be.updateMany,deleteIssueComment:be.deleteOne,deleteIssueComments:be.deleteMany}}),{initializeIssueComments:hT,addIssueComment:Ea,addIssueComments:mT,setIssueComment:ja,setIssueComments:_l,updateIssueComment:pT,updateIssueComments:yT,deleteIssueComment:qa,deleteIssueComments:AT}=Va.actions,Ol=t=>t.issueCommentReducer.instances,za=t=>e=>e.issueCommentReducer.instances[t],fT=f(d.createSelector([Ol,(t,e)=>e],(t,e)=>T(Object.values(t).filter(i=>i.issue===e)))),Rl=Va.reducer,Fe=P(t=>t.uuid),vl=Fe.getInitialState({}),Ua=d.createSlice({name:"issues",initialState:vl,extraReducers:t=>t.addMatcher(d.isAnyOf(b,M,_),e=>Object.assign(e,vl)),reducers:{initializeIssues:Fe.initialize,addIssue:Fe.addOne,addIssues:Fe.addMany,setIssue:Fe.setOne,setIssues:Fe.setMany,updateIssue:Fe.updateOne,updateIssues:Fe.updateMany,deleteIssue:Fe.deleteOne,deleteIssues:Fe.deleteMany}}),{initializeIssues:wl,addIssue:Ca,addIssues:Ml,setIssue:ST,setIssues:TT,updateIssue:Gt,updateIssues:IT,deleteIssue:Da,deleteIssues:Vl}=Ua.actions,ka=t=>t.issueReducer.instances,Ba=d.createSelector([ka],t=>Object.values(t)),$a=t=>e=>e.issueReducer.instances[t],gT=f(d.createSelector([ka,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const c=t[a];c?i.push(c):console.warn("selectIssuesByIds: No issue exists with the id",a)}return T(i)})),bT=f(d.createSelector([Ba,(t,e)=>e],(t,e)=>t.filter(i=>i.project===e))),El=f(d.createSelector([Ba,(t,e)=>e],(t,e)=>t.filter(i=>i.issue_type===e))),jl=Ua.reducer,Pe=P(t=>t.uuid),ql=Pe.getInitialState({}),Ga=d.createSlice({name:"issueTypeAttachments",initialState:ql,extraReducers:t=>t.addMatcher(d.isAnyOf(b,_),e=>Object.assign(e,ql)),reducers:{initializeIssueTypeAttachments:Pe.initialize,addIssueTypeAttachment:Pe.addOne,addIssueTypeAttachments:Pe.addMany,setIssueTypeAttachment:Pe.setOne,setIssueTypeAttachments:Pe.setMany,updateIssueTypeAttachment:Pe.updateOne,updateIssueTypeAttachments:Pe.updateMany,deleteIssueTypeAttachment:Pe.deleteOne,deleteIssueTypeAttachments:Pe.deleteMany}}),{initializeIssueTypeAttachments:La,addIssueTypeAttachment:FT,addIssueTypeAttachments:zl,setIssueTypeAttachment:Ul,setIssueTypeAttachments:PT,updateIssueTypeAttachment:_T,updateIssueTypeAttachments:Cl,deleteIssueTypeAttachment:Dl,deleteIssueTypeAttachments:kl}=Ga.actions,Bl=t=>t.issueTypeAttachmentReducer.instances,$l=d.createSelector([Bl],t=>Object.values(t)),Gl=t=>e=>e.issueTypeAttachmentReducer.instances[t],OT=f(d.createSelector([$l,(t,e)=>e],(t,e)=>T(t.filter(({issue_type:i})=>e===i)))),Ll=Ga.reducer,_e=P(t=>t.uuid),Nl=_e.getInitialState({}),Na=d.createSlice({name:"issueTypeFieldsAttachments",initialState:Nl,extraReducers:t=>t.addMatcher(d.isAnyOf(b,_),e=>Object.assign(e,Nl)),reducers:{initializeIssueTypeFieldsAttachments:_e.initialize,addIssueTypeFieldsAttachment:_e.addOne,addIssueTypeFieldsAttachments:_e.addMany,setIssueTypeFieldsAttachment:_e.setOne,setIssueTypeFieldsAttachments:_e.setMany,updateIssueTypeFieldsAttachment:_e.updateOne,updateIssueTypeFieldsAttachments:_e.updateMany,deleteIssueTypeFieldsAttachment:_e.deleteOne,deleteIssueTypeFieldsAttachments:_e.deleteMany}}),{initializeIssueTypeFieldsAttachments:Hl,addIssueTypeFieldsAttachment:RT,addIssueTypeFieldsAttachments:Wl,setIssueTypeFieldsAttachment:vT,setIssueTypeFieldsAttachments:wT,updateIssueTypeFieldsAttachment:MT,updateIssueTypeFieldsAttachments:Kl,deleteIssueTypeFieldsAttachment:VT,deleteIssueTypeFieldsAttachments:Yl}=Na.actions,Zl=t=>t.issueTypeFieldsAttachmentReducer.instances,Jl=d.createSelector([Zl],t=>Object.values(t)),ET=f(d.createSelector([Jl,(t,e)=>e],(t,e)=>T(t.filter(i=>i.fields_revision===e)))),jT=t=>e=>e.issueTypeFieldsAttachmentReducer.instances[t],Xl=Na.reducer,Oe=P(t=>t.uuid),Ql=Oe.getInitialState({}),Ha=d.createSlice({name:"issueTypeFieldValues",initialState:Ql,extraReducers:t=>t.addMatcher(d.isAnyOf(b,M,_),e=>Object.assign(e,Ql)),reducers:{initializeIssueTypeFieldValues:Oe.initialize,addIssueTypeFieldValues:Oe.addOne,addIssueTypeFieldValuesMany:Oe.addMany,setIssueTypeFieldValues:Oe.setOne,setIssueTypeFieldValuesMany:Oe.setMany,updateIssueTypeFieldValues:Oe.updateOne,updateIssueTypeFieldValuesMany:Oe.updateMany,deleteIssueTypeFieldValues:Oe.deleteOne,deleteIssueTypeFieldValuesMany:Oe.deleteMany}}),{initializeIssueTypeFieldValues:xl,addIssueTypeFieldValues:Wa,addIssueTypeFieldValuesMany:qT,setIssueTypeFieldValues:zT,setIssueTypeFieldValuesMany:UT,updateIssueTypeFieldValues:ft,updateIssueTypeFieldValuesMany:CT,deleteIssueTypeFieldValues:Ka,deleteIssueTypeFieldValuesMany:DT}=Ha.actions,eh=t=>t.issueTypeFieldValuesReducer.instances,Ya=d.createSelector([eh],t=>Object.values(t)),kT=f(d.createSelector([Ya,(t,e)=>e],(t,e)=>T(t.filter(i=>i.issue===e)))),Za=t=>e=>e.issueTypeFieldValuesReducer.instances[t],th=Ha.reducer,Re=P(t=>t.uuid),sh=Re.getInitialState({}),Ja=d.createSlice({name:"issueTypeFields",initialState:sh,extraReducers:t=>t.addMatcher(d.isAnyOf(b,_),e=>Object.assign(e,sh)),reducers:{initializeIssueTypeFields:Re.initialize,addIssueTypeFields:Re.addOne,addIssueTypeFieldsMany:Re.addMany,setIssueTypeFields:Re.setOne,setIssueTypeFieldsMany:Re.setMany,updateIssueTypeFields:Re.updateOne,updateIssueTypeFieldsMany:Re.updateMany,deleteIssueTypeFields:Re.deleteOne,deleteIssueTypeFieldsMany:Re.deleteMany}}),{initializeIssueTypeFields:ih,addIssueTypeFields:ah,addIssueTypeFieldsMany:BT,setIssueTypeFields:$T,setIssueTypeFieldsMany:GT,updateIssueTypeFields:ch,updateIssueTypeFieldsMany:LT,deleteIssueTypeFields:nh,deleteIssueTypeFieldsMany:NT}=Ja.actions,rh=t=>t.issueTypeFieldsReducer.instances,Lt=d.createSelector([rh],t=>Object.values(t)),HT=f(d.createSelector([Lt,(t,e)=>e],(t,e)=>T(t.filter(i=>i.issue_type===e)))),WT=f(d.createSelector([Lt,(t,e)=>e],(t,e)=>t.filter(i=>i.issue_type===e).sort((i,a)=>i.submitted_at>a.submitted_at?-1:1)[0])),KT=f(d.createSelector([Lt,Ya,(t,e)=>e],(t,e,i)=>{const a=new Set(t.filter(c=>c.issue_type===i).map(c=>c.uuid));return T(e.filter(c=>a.has(c.fields_revision)))})),YT=t=>e=>e.issueTypeFieldsReducer.instances[t],dh=Ja.reducer,ve=P(t=>t.uuid),uh=ve.getInitialState({}),Xa=d.createSlice({name:"issueTypeFieldValuesAttachments",initialState:uh,extraReducers:t=>t.addMatcher(d.isAnyOf(b,M,_),e=>Object.assign(e,uh)),reducers:{initializeIssueTypeFieldValuesAttachments:ve.initialize,addIssueTypeFieldValuesAttachment:ve.addOne,addIssueTypeFieldValuesAttachments:ve.addMany,setIssueTypeFieldValuesAttachment:ve.setOne,setIssueTypeFieldValuesAttachments:ve.setMany,updateIssueTypeFieldValuesAttachment:ve.updateOne,updateIssueTypeFieldValuesAttachments:ve.updateMany,deleteIssueTypeFieldValuesAttachment:ve.deleteOne,deleteIssueTypeFieldValuesAttachments:ve.deleteMany}}),{initializeIssueTypeFieldValuesAttachments:oh,addIssueTypeFieldValuesAttachment:ZT,addIssueTypeFieldValuesAttachments:Nt,setIssueTypeFieldValuesAttachment:JT,setIssueTypeFieldValuesAttachments:XT,updateIssueTypeFieldValuesAttachment:QT,updateIssueTypeFieldValuesAttachments:lh,deleteIssueTypeFieldValuesAttachment:xT,deleteIssueTypeFieldValuesAttachments:Ht}=Xa.actions,hh=t=>t.issueTypeFieldValuesAttachmentReducer.instances,Qa=d.createSelector([hh],t=>Object.values(t)),eI=t=>e=>e.issueTypeFieldValuesAttachmentReducer.instances[t],mh=f(d.createSelector([Qa,(t,e)=>e],(t,e)=>{const i=new Set(e);return T(t.filter(a=>i.has(a.uuid)))})),ph=f(d.createSelector([Qa,(t,e)=>e],(t,e)=>T(t.filter(i=>i.field_values===e)))),yh=Xa.reducer,we=P(t=>t.uuid),Ah=we.getInitialState({}),xa=d.createSlice({name:"issueTypeIdentifiers",initialState:Ah,extraReducers:t=>t.addMatcher(d.isAnyOf(b,_),e=>Object.assign(e,Ah)),reducers:{initializeIssueTypeIdentifiers:we.initialize,addIssueTypeIdentifier:we.addOne,addIssueTypeIdentifiers:we.addMany,setIssueTypeIdentifier:we.setOne,setIssueTypeIdentifiers:we.setMany,updateIssueTypeIdentifier:we.updateOne,updateIssueTypeIdentifiers:we.updateMany,deleteIssueTypeIdentifier:we.deleteOne,deleteIssueTypeIdentifiers:we.deleteMany}}),{initializeIssueTypeIdentifiers:fh,addIssueTypeIdentifier:ec,addIssueTypeIdentifiers:tI,setIssueTypeIdentifier:sI,setIssueTypeIdentifiers:iI,updateIssueTypeIdentifier:St,updateIssueTypeIdentifiers:aI,deleteIssueTypeIdentifier:tc,deleteIssueTypeIdentifiers:cI}=xa.actions,Sh=t=>t.issueTypeIdentifierReducer.instances,Th=d.createSelector([Sh],t=>Object.values(t)),sc=t=>e=>e.issueTypeIdentifierReducer.instances[t],nI=f(d.createSelector([Th,(t,e)=>e],(t,e)=>T(t.filter(i=>i.issue_type===e)))),Ih=xa.reducer,Me=P(t=>t.uuid),gh=Me.getInitialState({}),ic=d.createSlice({name:"issueTypeIdentifierValues",initialState:gh,extraReducers:t=>t.addMatcher(d.isAnyOf(b,M,_),e=>Object.assign(e,gh)),reducers:{initializeIssueTypeIdentifierValues:Me.initialize,addIssueTypeIdentifierValue:Me.addOne,addIssueTypeIdentifierValues:Me.addMany,setIssueTypeIdentifierValue:Me.setOne,setIssueTypeIdentifierValues:Me.setMany,updateIssueTypeIdentifierValue:Me.updateOne,updateIssueTypeIdentifierValues:Me.updateMany,deleteIssueTypeIdentifierValue:Me.deleteOne,deleteIssueTypeIdentifierValues:Me.deleteMany}}),{initializeIssueTypeIdentifierValues:bh,addIssueTypeIdentifierValue:ac,addIssueTypeIdentifierValues:rI,setIssueTypeIdentifierValue:dI,setIssueTypeIdentifierValues:uI,updateIssueTypeIdentifierValue:Tt,updateIssueTypeIdentifierValues:oI,deleteIssueTypeIdentifierValue:cc,deleteIssueTypeIdentifierValues:lI}=ic.actions,Fh=t=>t.issueTypeIdentifierValueReducer.instances,nc=d.createSelector([Fh],t=>Object.values(t)),rc=t=>e=>e.issueTypeIdentifierValueReducer.instances[t],hI=f(d.createSelector([nc,(t,e)=>e],(t,e)=>T(t.filter(i=>i.issue===e)))),mI=f(d.createSelector([nc,(t,e)=>e],(t,e)=>T(t.filter(i=>i.issue_type_identifier===e)))),Ph=ic.reducer,C=P(t=>t.uuid),_h=C.getInitialState({}),dc=d.createSlice({name:"issueTypes",initialState:_h,extraReducers:t=>t.addMatcher(d.isAnyOf(b,_),e=>Object.assign(e,_h)),reducers:{initializeIssueTypes:C.initialize,addIssueType:C.addOne,addIssueTypes:C.addMany,setIssueType:C.setOne,setIssueTypes:C.setMany,updateIssueType:C.updateOne,updateIssueTypes:C.updateMany,deleteIssueType:C.deleteOne,deleteIssueTypes:C.deleteMany,removeIssueType:C.deleteOne}}),{initializeIssueTypes:Oh,addIssueType:Rh,addIssueTypes:pI,setIssueType:It,setIssueTypes:yI,updateIssueType:vh,updateIssueTypes:AI,deleteIssueType:fI,deleteIssueTypes:SI,removeIssueType:uc}=dc.actions,oc=t=>t.issueTypeReducer.instances,wh=d.createSelector(oc,t=>Object.values(t)),lc=t=>e=>e.issueTypeReducer.instances[t],TI=f(d.createSelector([oc,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const c=t[a];c?i.push(c):console.warn("selectIssueTypesByIds: No issue type exists with the id",a)}return i})),II=f(d.createSelector([wh,(t,e)=>e],(t,e)=>T(t.filter(i=>i.organization===e)))),Mh=dc.reducer,Ve=P(t=>t.uuid),Vh=Ve.getInitialState({}),hc=d.createSlice({name:"issueUpdates",initialState:Vh,extraReducers:t=>t.addMatcher(d.isAnyOf(b,M,_),e=>Object.assign(e,Vh)),reducers:{initializeIssueUpdates:Ve.initialize,addIssueUpdate:Ve.addOne,addIssueUpdates:Ve.addMany,setIssueUpdate:Ve.setOne,setIssueUpdates:Ve.setMany,updateIssueUpdate:Ve.updateOne,updateIssueUpdates:Ve.updateMany,deleteIssueUpdate:Ve.deleteOne,deleteIssueUpdates:Ve.deleteMany}}),{initializeIssueUpdates:Eh,addIssueUpdate:jh,addIssueUpdates:qh,setIssueUpdate:gI,setIssueUpdates:bI,updateIssueUpdate:FI,updateIssueUpdates:PI,deleteIssueUpdate:zh,deleteIssueUpdates:Uh}=hc.actions,Ch=t=>t.issueUpdateReducer.instances,Dh=d.createSelector([Ch],t=>Object.values(t)),kh=f(d.createSelector([Dh,(t,e)=>e],(t,e)=>T(t.filter(i=>i.issue===e)))),Bh=hc.reducer,Ee=P(({uuid:t})=>t),$h=Ee.getInitialState({currentUser:null}),mc=d.createSlice({name:"users",initialState:$h,extraReducers:t=>t.addMatcher(d.isAnyOf(b,_),e=>Object.assign(e,$h)),reducers:{initializeUsers:Ee.initialize,setUsers:Ee.setMany,setUser:Ee.setOne,addUsers:Ee.addMany,addUser:Ee.addOne,updateUsers:Ee.updateMany,updateUser:Ee.updateOne,deleteUser:Ee.deleteOne,deleteUsers:Ee.deleteMany,setCurrentUser:(t,e)=>{t.currentUser=e.payload}}}),{initializeUsers:Gh,setUsers:_I,setUser:OI,addUsers:RI,addUser:Lh,updateUsers:vI,updateUser:wI,deleteUser:Nh,deleteUsers:MI,setCurrentUser:VI}=mc.actions,Hh=mc.reducer,Wh=t=>t.userReducer.currentUser,Wt=t=>t.userReducer.instances,pc=d.createSelector([Wt],t=>Object.values(t)),Kh=t=>e=>e.userReducer.instances[t],EI=f(d.createSelector([Wt,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const c=t[a];c?i.push(c):console.warn("selectUsersByIds: No user exists with the id",a)}return T(i)})),je=P(t=>t.uuid),Yh=je.getInitialState({}),yc=d.createSlice({name:"organizationAccess",initialState:Yh,extraReducers:t=>t.addMatcher(d.isAnyOf(b,_),e=>Object.assign(e,Yh)),reducers:{initializeOrganizationAccesses:je.initialize,addOrganizationAccess:je.addOne,addOrganizationAccesses:je.addMany,setOrganizationAccess:je.setOne,setOrganizationAccesses:je.setMany,updateOrganizationAccess:je.updateOne,updateOrganizationAccesses:je.updateMany,deleteOrganizationAccess:je.deleteOne,deleteOrganizationAccesses:je.deleteMany}}),{initializeOrganizationAccesses:Zh,addOrganizationAccess:Jh,addOrganizationAccesses:jI,setOrganizationAccess:qI,setOrganizationAccesses:zI,updateOrganizationAccess:Kt,updateOrganizationAccesses:UI,deleteOrganizationAccess:Xh,deleteOrganizationAccesses:CI}=yc.actions,Qh=yc.reducer,Ac=t=>t.organizationAccessReducer.instances,fc=t=>e=>e.organizationAccessReducer.instances[t],DI=d.createSelector([Wh,Ac],(t,e)=>Object.values(e).find(a=>a.user===(t==null?void 0:t.uuid))??null),xh=d.createSelector([Ac],t=>{const e={};for(const i of Object.values(t))e[i.user]=i;return Pt(e)}),kI=f(d.createSelector([Wt,xh,(t,e)=>e],(t,e,i)=>T(Object.values(t).filter(a=>{const c=e[a.uuid];return!!c&&c.organization===i})))),qe=P(t=>t.uuid),em=qe.getInitialState({}),Sc=d.createSlice({name:"organizations",initialState:em,extraReducers:t=>t.addMatcher(d.isAnyOf(b,_),e=>Object.assign(e,em)),reducers:{initializeOrganizations:qe.initialize,setOrganizations:qe.setMany,setOrganization:qe.setOne,addOrganizations:qe.addMany,addOrganization:qe.addOne,updateOrganizations:qe.updateMany,updateOrganization:qe.updateOne,deleteOrganization:qe.deleteOne,deleteOrganizations:qe.deleteMany}}),{initializeOrganizations:tm,setOrganizations:BI,setOrganization:$I,addOrganizations:GI,addOrganization:sm,updateOrganizations:LI,updateOrganization:im,deleteOrganization:NI,deleteOrganizations:HI}=Sc.actions,am=t=>t.organizationReducer.instances,WI=d.createSelector([am],t=>Object.values(t)),KI=t=>e=>e.organizationReducer.instances[t],cm=Sc.reducer,nm=(t,e,i)=>{const a=t.uuid?t:{...t,uuid:Ze.v4()};return{payload:a,type:"",meta:{offline:{effect:{timestamp:new Date().toISOString(),request:a,BASE_URL:e,serviceName:i}}}}},rm={deletedRequests:[],latestRetryTime:0},Tc=d.createSlice({name:"outbox",initialState:rm,extraReducers:t=>t.addCase(b,e=>Object.assign(e,rm)),reducers:{enqueueRequest:{reducer:(t,e)=>t,prepare:t=>{console.debug("Preparing to enqueue request",t);const{BASE_URL:e,serviceName:i,...a}=t;return nm(a,e,i)}},markForDeletion(t,e){t.deletedRequests.push(e.payload)},markAsDeleted(t,e){const i=t.deletedRequests.indexOf(e.payload);i!==-1&&t.deletedRequests.splice(i,1)},_setLatestRetryTime:(t,e)=>{t.latestRetryTime=e.payload}}}),YI=t=>t.outboxReducer.deletedRequests,ZI=t=>t.outboxReducer.latestRetryTime,{enqueueRequest:dm,markForDeletion:JI,markAsDeleted:um,_setLatestRetryTime:om}=Tc.actions,lm=Tc.reducer,ze=P(t=>t.uuid),hm=ze.getInitialState({}),Ic=d.createSlice({name:"projectAccess",initialState:hm,extraReducers:t=>t.addMatcher(d.isAnyOf(b,_),e=>Object.assign(e,hm)),reducers:{initializeProjectAccesses:ze.initialize,addProjectAccess:ze.addOne,addProjectAccesses:ze.addMany,setProjectAccess:ze.setOne,setProjectAccesses:ze.setMany,updateProjectAccess:ze.updateOne,updateProjectAccesses:ze.updateMany,deleteProjectAccess:ze.deleteOne,deleteProjectAccesses:ze.deleteMany}}),{initializeProjectAccesses:mm,addProjectAccess:gc,addProjectAccesses:bc,setProjectAccess:XI,setProjectAccesses:QI,updateProjectAccess:gt,updateProjectAccesses:pm,deleteProjectAccess:Fc,deleteProjectAccesses:Pc}=Ic.actions,ym=Ic.reducer,_c=t=>t.projectAccessReducer.instances,Yt=d.createSelector(_c,t=>Object.values(t)),Oc=t=>e=>e.projectAccessReducer.instances[t],Am=f(d.createSelector([_c,(t,e)=>e],(t,e)=>T(Object.values(t).filter(i=>i.project===e)))),xI=f(d.createSelector([Yt,(t,e)=>e],(t,e)=>{const i={};for(const a of t.filter(c=>c.project===e))i[a.user]=a;return i})),eg=f(d.createSelector([pc,Yt,(t,e)=>e],(t,e,i)=>{const a=new Set(e.filter(c=>c.project===i).map(c=>c.user));return T(t.filter(c=>a.has(c.uuid)))})),Ue=P(t=>t.uuid),fm=Ue.getInitialState({}),Rc=d.createSlice({name:"projectAttachments",initialState:fm,extraReducers:t=>t.addMatcher(d.isAnyOf(b,_),e=>Object.assign(e,fm)),reducers:{initializeProjectAttachments:Ue.initialize,addProjectAttachment:Ue.addOne,addProjectAttachments:Ue.addMany,setProjectAttachment:Ue.setOne,setProjectAttachments:Ue.setMany,updateProjectAttachment:Ue.updateOne,updateProjectAttachments:Ue.updateMany,deleteProjectAttachment:Ue.deleteOne,deleteProjectAttachments:Ue.deleteMany}}),{initializeProjectAttachments:vc,addProjectAttachment:tg,addProjectAttachments:Sm,setProjectAttachment:Tm,setProjectAttachments:Im,updateProjectAttachment:sg,updateProjectAttachments:gm,deleteProjectAttachment:bm,deleteProjectAttachments:wc}=Rc.actions,Fm=t=>t.projectAttachmentReducer.instances,Pm=d.createSelector([Fm],t=>Object.values(t)),_m=t=>e=>e.projectAttachmentReducer.instances[t],Om=f(d.createSelector([Pm,(t,e)=>e],(t,e)=>T(t.filter(({project:i})=>e===i)))),Rm=Rc.reducer,Ce=P(t=>t.uuid),vm=Ce.getInitialState({activeProjectFileId:null,isImportingProjectFile:!1}),Mc=d.createSlice({name:"projectFiles",initialState:vm,extraReducers:t=>t.addMatcher(d.isAnyOf(b,M,_),e=>Object.assign(e,vm)),reducers:{initializeProjectFiles:Ce.initialize,setProjectFile:Ce.setOne,setProjectFiles:Ce.setMany,addProjectFile:Ce.addOne,addProjectFiles:Ce.addMany,updateProjectFile:Ce.updateOne,updateProjectFiles:Ce.updateMany,deleteProjectFile:Ce.deleteOne,deleteProjectFiles:Ce.deleteMany,setIsImportingProjectFile:(t,e)=>{t.isImportingProjectFile=e.payload},saveActiveProjectFileBounds:(t,e)=>{const i=t.activeProjectFileId;if(!i)throw new Error("Tried to save bounds for active project file, but no active project file was set.");if(!t.instances[i])throw new Error(`Tried to save bounds for active project file, but project file with ID ${i}
2
+ doesn't exist.`);t.instances[i].bounds=e.payload},setActiveProjectFileId:(t,e)=>{t.activeProjectFileId=e.payload}}}),{initializeProjectFiles:wm,setProjectFile:ig,setProjectFiles:ag,addProjectFile:cg,addProjectFiles:Mm,updateProjectFile:Vc,updateProjectFiles:ng,deleteProjectFile:Vm,deleteProjectFiles:Em,setIsImportingProjectFile:jm,setActiveProjectFileId:qm,saveActiveProjectFileBounds:zm}=Mc.actions,Um=t=>t.projectFileReducer.instances,Cm=d.createSelector([Um],t=>T(Object.values(t).sort((e,i)=>e.z_index-i.z_index))),rg=t=>e=>e.projectFileReducer.instances[t],dg=t=>t.projectFileReducer.activeProjectFileId,ug=t=>t.projectFileReducer.isImportingProjectFile,Dm=Mc.reducer,De=P(t=>t.uuid),km=De.getInitialState({}),Ec=d.createSlice({name:"projects",initialState:km,extraReducers:t=>t.addMatcher(d.isAnyOf(b,_),e=>Object.assign(e,km)),reducers:{initializeProjects:De.initialize,setProjects:De.setMany,setProject:De.setOne,addProjects:De.addMany,addProject:De.addOne,updateProjects:De.updateMany,updateProject:De.updateOne,deleteProject:De.deleteOne,deleteProjects:De.deleteMany}}),{initializeProjects:Bm,setProjects:og,setProject:lg,addProjects:hg,addProject:jc,updateProjects:mg,updateProject:$m,deleteProject:qc,deleteProjects:pg}=Ec.actions,Gm=Ec.reducer,Lm=t=>t.projectReducer.instances,zc=d.createSelector([Lm],t=>T(Object.values(t))),Nm=t=>e=>e.projectReducer.instances[t],yg=f(d.createSelector([zc,Yt,(t,e)=>e],(t,e,i)=>{const a=new Set(e.filter(c=>c.user===i).map(c=>c.project));return T(t.filter(c=>a.has(c.uuid)))})),Ag=f(d.createSelector([zc,(t,e)=>e],(t,e)=>T(t.filter(i=>i.organization===e)))),fg={isRehydrated:!1},Uc=d.createSlice({name:"rehydrated",initialState:fg,reducers:{setRehydrated:(t,e)=>{t.isRehydrated=e.payload}}}),{setRehydrated:Sg}=Uc.actions,Tg=t=>t.rehydratedReducer.isRehydrated,Hm=Uc.reducer,ke=P(t=>t.uuid),Wm=ke.getInitialState({}),Cc=d.createSlice({name:"teamMemberships",initialState:Wm,extraReducers:t=>t.addMatcher(d.isAnyOf(b,_),e=>Object.assign(e,Wm)),reducers:{initializeTeamMemberships:ke.initialize,addTeamMembership:ke.addOne,addTeamMemberships:ke.addMany,setTeamMembership:ke.setOne,setTeamMemberships:ke.setMany,updateTeamMembership:ke.updateOne,updateTeamMemberships:ke.updateMany,deleteTeamMembership:ke.deleteOne,deleteTeamMemberships:ke.deleteMany}}),{initializeTeamMemberships:Km,addTeamMembership:Ym,addTeamMemberships:Zm,setTeamMembership:Dc,setTeamMemberships:Jm,updateTeamMembership:Ig,updateTeamMemberships:gg,deleteTeamMembership:kc,deleteTeamMemberships:Xm}=Cc.actions,Qm=Cc.reducer,xm=t=>t.teamMembershipReducer.instances,Bc=d.createSelector([xm],t=>Object.values(t)),ep=t=>e=>e.teamMembershipReducer.instances[t],bg=f(d.createSelector([Bc,(t,e)=>e],(t,e)=>{const i={};for(const a of t.filter(c=>c.team===e))i[a.user]=a;return i})),Fg=f(d.createSelector([pc,Bc,(t,e)=>e],(t,e,i)=>{const a=new Set(e.filter(c=>c.team===i).map(c=>c.user));return T(t.filter(c=>a.has(c.uuid)))})),Be=P(t=>t.uuid),tp=Be.getInitialState({}),$c=d.createSlice({name:"teams",initialState:tp,extraReducers:t=>t.addMatcher(d.isAnyOf(b,_),e=>Object.assign(e,tp)),reducers:{initializeTeams:Be.initialize,addTeam:Be.addOne,addTeams:Be.addMany,setTeam:Be.setOne,setTeams:Be.setMany,updateTeam:Be.updateOne,updateTeams:Be.updateMany,deleteTeam:Be.deleteOne,deleteTeams:Be.deleteMany}}),{initializeTeams:sp,addTeam:ip,addTeams:Pg,setTeam:bt,setTeams:_g,updateTeam:ap,updateTeams:Og,deleteTeam:Gc,deleteTeams:Rg}=$c.actions,Lc=t=>t.teamReducer.instances,cp=d.createSelector([Lc],t=>Object.values(t)),Nc=t=>e=>e.teamReducer.instances[t],vg=f(d.createSelector([Lc,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const c=t[a];c?i.push(c):console.warn("selectTeamsByIds: No team exists with the id",a)}return T(i)})),wg=f(d.createSelector([cp,(t,e)=>e],(t,e)=>T(t.filter(i=>i.organization===e)))),np=$c.reducer,Mg={version:0},rp=d.createSlice({name:"versioning",initialState:Mg,reducers:{}}),dp=rp.reducer,Hc={outboxReducer:lm,fileReducer:Ju,authReducer:Pu},Vg=d.combineReducers(Hc),up={...Hc,[tt]:dp,categoryReducer:Mu,assetReducer:hd,assetAttachmentReducer:Vn,assetStageCompletionReducer:fd,assetStageReducer:Fd,assetTypeReducer:gu,assetTypeAttachmentReducer:jd,issueReducer:jl,issueAttachmentReducer:ml,issueTypeReducer:Mh,issueTypeAttachmentReducer:Ll,organizationReducer:cm,projectReducer:Gm,projectAttachmentReducer:Rm,projectAccessReducer:ym,organizationAccessReducer:Qh,projectFileReducer:Dm,rehydratedReducer:Hm,formReducer:Fo,formRevisionReducer:Io,formRevisionAttachmentReducer:mo,formSubmissionAttachmentReducer:jo,formSubmissionReducer:Bo,formIdentifierReducer:to,formIdentifierValueReducer:co,userReducer:Hh,documentsReducer:Hu,documentAttachmentReducer:Bu,teamReducer:np,agentsReducer:bn,issueCommentReducer:Rl,issueCommentAttachmentReducer:Fl,issueUpdateReducer:Bh,geoImageReducer:Jo,issueAssociationReducer:al,issueTypeFieldsReducer:dh,issueTypeFieldValuesReducer:th,issueTypeFieldsAttachmentReducer:Xl,issueTypeFieldValuesAttachmentReducer:yh,issueTypeIdentifierReducer:Ih,issueTypeIdentifierValueReducer:Ph,assetTypeFieldsReducer:Yd,assetTypeFieldValuesReducer:du,assetTypeFieldsAttachmentReducer:$d,assetTypeFieldValuesAttachmentReducer:tu,assetTypeIdentifierReducer:mu,assetTypeIdentifierValueReducer:fu,assetProcedureTypeReducer:_r,assetProcedureReducer:gr,assetProcedureTypeFieldsReducer:tr,assetProcedureFieldValuesReducer:yr,assetProcedureTypeFieldsAttachmentReducer:Kn,assetProcedureTypeFieldValuesAttachmentReducer:nr,assetProcedureTypeAttachmentReducer:Dn,assetProcedureStepFieldsAttachmentReducer:qr,assetProcedureStepFieldsReducer:Cr,assetProcedureStepFieldValuesAttachmentReducer:Nr,assetProcedureStepFieldValuesReducer:Xr,assetProcedureStepReducer:cd,teamMembershipReducer:Qm},Eg=d.combineReducers(up);function jg(t,e){return zp.useMemo(t,e)}class qg{constructor(e){S(this,"operations",[]);S(this,"getData");this.getData=e}performOperations(e){let i=e;for(const a of this.operations)i=a(i);return i}filter(e,i){return this.operations.push(a=>a.filter(c=>c[e]===i)),this}exclude(e,i){return this.operations.push(a=>a.filter(c=>c[e]!==i)),this}orderBy(e){return this.operations.push(i=>[...i].sort((a,c)=>a[e]<=c[e]?1:-1)),this}reverse(){return this.operations.push(e=>[...e].reverse()),this}all(){return this.operations.push(e=>e),this}get(e,i){return d.createSelector([this.getData],a=>this.performOperations(a).find(c=>c[e]===i))}count(){return d.createSelector([this.getData],e=>this.performOperations(e).length)}first(){return d.createSelector([this.getData],e=>this.performOperations(e)[0])}last(){return d.createSelector([this.getData],e=>{const i=this.performOperations(e);return i[i.length-1]})}exists(){return d.createSelector([this.getData],e=>this.performOperations(e).length>0)}toSelector(){return d.createSelector([this.getData],e=>T(this.performOperations(e)))}}const op=1e4,$e=200,lp={};class hp{constructor(e){S(this,"client");S(this,"pageSize",op);lp[this.constructor.name]=this,this.client=e}async enqueueRequest(e,i){return this.client.enqueueRequest(e,this.host,this.constructor.name,i)}async performPagination(e,i,a){const c=[];let n=await this.client.enqueueRequest(e,this.host,this.constructor.name,a);for(c.push(n.results);n.next;)n=await this.client.enqueueRequest(i(n.next),this.host,this.constructor.name,a),c.push(n.results);return c}dispatch(e){this.client.store.dispatch(e)}}const mp=()=>Ap.length-1,pp=t=>(t[tt]={version:mp()},t),yp=()=>pp({}),zg=t=>(t.outboxReducer&&(t.outboxReducer.deletedRequests=[]),t),Ug=t=>e=>{var i;return e===void 0&&(e={}),((i=e[tt])==null?void 0:i.version)===mp()?e:t(e)},Ap=[pp,yp,yp,zg],Cg=Object.fromEntries(Ap.map((t,e)=>[e,Ug(t)])),Dg=t=>{if(t)throw t;const e=et();e?e.dispatch({type:"rehydrated/setRehydrated",payload:!0}):console.error("Client store not set")},fp=(t,e,i)=>{const a=Ke();return a?(a.addRequest(e),a.getQueue()):(console.warn("Outbox coordinator not set; cannot enqueue request yet."),[])},Sp=(t,e,i)=>{const a=Ke();if(!a)return console.warn("Outbox coordinator not set; cannot dequeue request yet."),[];const n=e.meta.offlineAction.payload.uuid;return a.remove(n),a.getQueue()};async function kg(t,e){if(!e.payload)throw new Error("Received empty payload");return Mp(e)}const Bg={...xc,effect:kg,discard:Ip,returnPromises:!0,persistCallback:Dg,retry:Hg,persistOptions:{storage:Cp},queue:{...xc.queue,enqueue:fp,dequeue:Sp,peek:(...t)=>Ng(...t)}},$g=Dp(Cg,tt),Gg=d.compose(Up.offline(Bg),$g);function Lg(t){function e(i){return typeof i=="object"&&i!==null&&["ok","redirect","clientError","serverError","error"].every(c=>c in i)}if(e(t))return t;if(typeof t=="object"&&t!==null){const i=t;if(e(i.response))return i.response;if(i.response&&e(i.response.response))return i.response.response}}async function Wc(t,e,i){if(e.store.getState().outboxReducer.deletedRequests.includes(t.payload.uuid))throw new Error("Request was marked for deletion");const c=lp[t.meta.offline.effect.serviceName];if(!c)throw new Error(`Service ${t.meta.offline.effect.serviceName} not found`);const n=c instanceof O;n&&t.payload.checkAuth!==!1&&await c.auth.prepareAuth();const r={queryParams:"",isAuthNeeded:!0},u=t.meta.offline.effect,{payload:m,headers:o,method:h,queryParams:p,attachmentHash:y,isExternalUrl:A,isAuthNeeded:I,isResponseBlob:g}={...r,...u.request},R=u.request;let w=R.url;const q=y?await e.files.fetchCache(y):void 0;if(y&&!q)throw new Error(`Cannot upload file ${y} because it's not cached.`);!A&&!w.startsWith("http")&&(!w.startsWith("/")&&!w.startsWith("blob:")&&(w="/"+w),w=t.meta.offline.effect.BASE_URL+w);const Ge=j=>{if(y){const Le=R.s3url;if(!Le)throw new Error(`No S3 URL for file ${y}`);if("warning"in Le)throw new Error(`S3 URL warning for file ${y}`);if(!q)throw new Error(`No file for file ${y}`);const Ft=Le.fields["x-amz-checksum-sha1"];if(!Ft)throw new Error(`No checksum for file ${y}`);return j.set("x-amz-checksum-sha1",Ft).field({...m,...Le.fields}).attach("file",q)}return j.send(m)},uF={[l.GET]:()=>g?Ye.get(w.toString()).responseType("blob"):Ye.get(w.toString()),[l.POST]:()=>{const j=Ye.post(w.toString());return Ge(j)},[l.PATCH]:()=>{const j=Ye.patch(w.toString());return Ge(j)},[l.PUT]:()=>{const j=Ye.put(w.toString());return Ge(j)},[l.DELETE]:()=>{const j=Ye.delete(w.toString());return Ge(j)}}[h];let He=uF();if(i==null||i.addEventListener("abort",()=>{console.debug("aborting request:",R),He.abort()}),I&&n){const j=c.auth.getAuthHeader();He=He.set("Authorization",j)}o&&(He=He.set(o));try{return await He.query(p)}catch(j){const Le=Lg(j),Ft=Le==null?void 0:Le.status;if(n&&Ft===401)return await c.auth.handleUnauthorized(He,Le),He.query(p);throw new U({response:Le,innerError:j,discard:Tp.includes(Ft)})}}const Tp=[400,409,403,404,405,500];function Ip(t,e,i=0){var o;if(console.debug("Considering discarding request due to error:",t,`(${typeof t})`,`
3
3
  Action:`,e,`
4
- Retries:`,i),!(t instanceof Error))throw console.error("ENCOUNTERED NON-ERROR ERROR:",t,"(throwing immediately, which may lead to unexpected behavior)"),t;const a=tt(),c=a.getState().outboxReducer.deletedRequests,r=e.payload.uuid;function u(){a.dispatch(Sm(r));const h=Ye();if(!h)throw new Error("Outbox coordinator not set");h.remove(e.payload.uuid);const p=e.meta.offline.rollback;throw p&&(console.warn("Rolling back request due to SDK error:",e),a.dispatch(p)),t}if(t instanceof D&&t.options.discard&&(console.debug("Discarding request due to explicit discard:",e),u()),c.includes(r)&&(console.debug("Discarding request due to deletion:",e),u()),t instanceof D){const h=t.status||((o=t.response)==null?void 0:o.status);if(h||console.warn("Error has no status code:",t),h!==void 0&&vp.includes(h)){console.warn("Discarding request due to error:",t,`
5
- Action:`,e);const p=Ye();if(!p)throw new Error("Outbox coordinator not set");p.remove(e.payload.uuid),t.options.discard=!0,u()}}console.debug("Registering a retry for request:",e.payload.uuid);const m=Ye();if(!m)throw new Error("Outbox coordinator not set");return m.registerRetry(e.payload.uuid),!1}function rb(t,e,i){var a;return(a=Ye())==null?void 0:a.peek()}function db(t,e){return tt().dispatch(Tm(new Date().getTime())),rc}const xe="An unknown error occurred",ub=500,Mp=["non_field_errors","detail"];function ob(t,e){let i;if(t!=null&&t.body)if(typeof t.body=="object"){const a=t.body;if(typeof a.error=="string")i=a.error;else if(typeof a.message=="string")i=a.message;else try{i=Object.entries(a).map(([n,c])=>typeof c=="string"?Mp.includes(n)?c:`${n}: ${c}`:Array.isArray(c)?Mp.includes(n)?c.join(`
6
- `):c.map(r=>`${n}: ${r}`).join(`
7
- `):`${n}: ${JSON.stringify(c)}`).join(`
8
- `)}catch(n){console.error("Failed to extract error message from response body",n)}}else typeof t.body=="string"&&(i=t.body);else t!=null&&t.text?i=t.text:e instanceof Error&&(i=e.message);return!i||i.length>ub?xe:i}class D extends Error{constructor(i){super(xe);S(this,"status");S(this,"response");S(this,"message");S(this,"options");const{response:a,innerError:n}=i;this.message=i.message??ob(a,n)??xe,this.status=(a==null?void 0:a.status)??0,this.response=a,i.discard=i.discard??!1,this.options=i}}class lb extends Ip{constructor(e){super(e)}}class O extends Ip{constructor(i,a){super(i);S(this,"auth");this.auth=a}}class hb extends O{async startConversation(e,i){return this.enqueueRequest({description:"Start agent conversation",method:l.POST,url:"/agents/prompt/",payload:{prompt:e,active_project:i},blockers:["prompt"],blocks:["prompt"]}).then(a=>(this.dispatch(Ic(a)),a))}async continueConversation(e,i,a){return this.enqueueRequest({description:"Prompt agent",method:l.POST,url:"/agents/prompt/",payload:{prompt:e,active_project:a},blockers:["prompt"],blocks:["prompt"],queryParams:{conversation_id:i}}).then(n=>{this.dispatch(Fc(n))})}async fetchDetails(e){return this.enqueueRequest({description:"Get agent conversation",method:l.GET,url:`/agents/conversations/${e}/`,blockers:["conversation"],blocks:["conversation"]}).then(i=>{this.dispatch(bc(i))})}async rate(e,i){return this.enqueueRequest({description:"Rate agent response",method:l.PUT,url:`/agents/responses/${e}/rate/`,payload:{rating:i},blockers:["rate"],blocks:["rate"]})}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get agent conversation history",method:l.GET,url:"/agents/conversations/",queryParams:{project:e},blockers:["agent-conversations"],blocks:["agent-conversations"]},i);return this.dispatch(gc(a)),a}}class V extends O{getNumberOfAttachmentsWithSha1(e){const{issueAttachmentReducer:i,assetAttachmentReducer:a,assetTypeAttachmentReducer:n,documentAttachmentReducer:c,projectAttachmentReducer:r,formRevisionAttachmentReducer:u,formSubmissionAttachmentReducer:m,geoImageReducer:o,assetTypeFieldsAttachmentReducer:h,assetTypeFieldValuesAttachmentReducer:p,issueTypeFieldsAttachmentReducer:y,issueTypeFieldValuesAttachmentReducer:A}=this.client.store.getState();return[].concat(Object.values(i.instances),Object.values(a.instances),Object.values(n.instances),Object.values(c.instances),Object.values(r.instances),Object.values(u.instances),Object.values(m.instances),Object.values(o.instances),Object.values(h.instances),Object.values(p.instances),Object.values(y.instances),Object.values(A.instances)).filter(b=>b.file_sha1===e).length}processPresignedUrls(e){const i={};for(const[a,n]of Object.entries(e))i[a]=this.enqueueRequest({url:n.url,description:"Upload file to S3",method:l.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:a,blockers:[`s3-${n.fields.key}`],blocks:[a],s3url:n});return i}async getFilePayload(e){const i=await Xe(e),a={sha1:i,file_type:e.type,extension:e.name.split(".").pop(),size:e.size};return await this.client.files.addCache(e,i),a}}class He extends V{constructor(){super(...arguments);S(this,"pageSize",Ge)}async _bulkAdd(i){var h;const{store:a}=this.client,n=(h=a.getState().userReducer.currentUser)==null?void 0:h.id,c=new Date().toISOString(),r=[],u=[],m={};for(const p of i){const{modelUuid:y,file:A}=p,g=await this.getFilePayload(A);g.sha1 in m||(m[g.sha1]=g);const b=this.buildModel({file:A,file_sha1:g.sha1,submitted_at:c,created_by:n,modelUuid:y});r.push(b),u.push(this.buildPayload(b,g))}this.dispatch(this.addAttachments(r));const o=this.enqueueRequest({description:`Add ${this.name}`,method:l.POST,url:`${this.url}/bulk/`,payload:{submitted_at:c,attachments:u,files:Object.values(m)},blocks:r.map(p=>this.getId(p)),blockers:r.map(p=>p.file_sha1)});return o.then(({attachments:p,presigned_urls:y})=>{this.dispatch(this.updateAttachments(p)),this.processPresignedUrls(y)}).catch(()=>{this.dispatch(this.removeAttachments(r.map(p=>this.getId(p))))}),[r,o.then(({attachments:p})=>p)]}async _delete(i){const{store:a}=this.client,n=this.selectAttachment(i)(a.getState());if(!n)throw new Error(`Attempting to delete attachment with uuid ${i} that does not exist in the store`);this.dispatch(this.removeAttachment(this.getId(n)));const c=this.enqueueRequest({description:`Delete ${this.name}`,method:l.DELETE,url:`${this.url}/${i}/`,blockers:[i],blocks:[]});return c.then(()=>{this.getNumberOfAttachmentsWithSha1(n.file_sha1)===0&&this.client.files.removeCache(n.file_sha1)}).catch(()=>{this.dispatch(this.setAttachment(n))}),c}}class mb extends He{constructor(){super(...arguments);S(this,"name","Asset Attachment");S(this,"url","/asset-attachments");S(this,"initializeAttachments",rs);S(this,"addAttachments",ds);S(this,"updateAttachments",Rc);S(this,"removeAttachments",us);S(this,"removeAttachment",vc);S(this,"setAttachment",Oc);S(this,"selectAttachment",Ec)}getId(i){return i.uuid}buildModel(i){return F({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,asset:i.modelUuid})}buildPayload(i,a){return{uuid:i.uuid,file_name:i.file_name,file_sha1:i.file_sha1,file_extension:a.extension,asset:i.asset}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.assetUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const c=(await this.performPagination({immediate:!0,description:"Get asset attachments",method:l.GET,url:`${this.url}/`,queryParams:{limit:Ge,paginate:!0,asset__project:i},blocks:[],blockers:[]},r=>({immediate:!0,description:"Get asset attachments",method:l.GET,url:r,blockers:[],blocks:[]}),a)).flat();return this.dispatch(rs(c)),c}}class pb extends He{constructor(){super(...arguments);S(this,"name","Asset Procedure Attachment");S(this,"url","/asset-procedure-type-attachments");S(this,"initializeAttachments",ls);S(this,"addAttachments",zc);S(this,"updateAttachments",Uc);S(this,"removeAttachments",kc);S(this,"removeAttachment",Cc);S(this,"setAttachment",Dc);S(this,"selectAttachment",Lc)}getId(i){return i.uuid}buildModel(i){return F({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,asset_procedure_type:i.modelUuid})}buildPayload(i,a){return{uuid:i.uuid,file_name:i.file_name,file_sha1:i.file_sha1,file_extension:a.extension,asset_procedure_type:i.asset_procedure_type}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.assetProcedureTypeUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const n=await this.enqueueRequest({immediate:!0,description:"Get asset procedure attachments",method:l.GET,url:`${this.url}/`,queryParams:{asset_procedure_type__organization:i},blocks:[],blockers:[]},a);return this.dispatch(ls(n)),n}}class yb extends V{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const o of e){const{fieldsRevisionUuid:h,fieldIdentifier:p,file:y}=o,A=await this.getFilePayload(y);A.sha1 in n||(n[A.sha1]=A);const g=F({file:URL.createObjectURL(y),file_type:y.type,file_name:y.name,file_sha1:A.sha1,created_by:a,fields_revision:h,submitted_at:i,field_identifier:p});c.push(g);const b={uuid:g.uuid,file_name:y.name,field_identifier:p,file_extension:A.extension,file_sha1:A.sha1,fields_revision:h};r.push(b)}this.dispatch(Wc(c));const u=this.enqueueRequest({description:"Add asset procedure type fields attachments",method:l.POST,url:"/asset-procedure-type-fields-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(o=>o.fields_revision),blocks:c.map(o=>o.uuid)});return u.then(o=>{this.processPresignedUrls(o.presigned_urls),this.dispatch(Kc(o.attachments))}).catch(()=>{this.dispatch(Yc(c.map(o=>o.uuid)))}),[c,u.then(({attachments:o})=>o)]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset procedure type fields attachments",method:l.GET,url:"/asset-procedure-type-fields-attachments/",queryParams:{fields_revision__asset_procedure_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Hc(a)),a}}class Ab extends O{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(er(c));const r=this.enqueueRequest({description:"Add Asset Procedure Type Fields",method:l.POST,url:"/asset-procedure-type-fields/",payload:v(c),blockers:[c.asset_procedure_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(tr(m))}).catch(m=>{throw this.dispatch(sr(c.uuid)),m}),[c,r]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get Asset Procedure Type Fields",method:l.GET,url:"/asset-procedure-type-fields/",queryParams:{asset_procedure_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(xc(a)),a}}function Ke(t,e){const i=[];let a=0;const n=t.length;for(;a<n;)i.push(t.slice(a,a+=e));return i}class fb extends V{async bulkAdd(e,i){var o;const a=new Date().toISOString(),n=(o=this.client.store.getState().userReducer.currentUser)==null?void 0:o.id,c=Ke(e,i??e.length),r=[],u=[];for(const h of c){const p={},y=[];for(const A of h){const{fieldValuesUuid:g,fieldIdentifier:b,file:R}=A,w=await this.getFilePayload(R);w.sha1 in p||(p[w.sha1]=w);const q=F({file:URL.createObjectURL(R),file_type:R.type,file_name:R.name,file_sha1:w.sha1,created_by:n,field_values:g,submitted_at:a,field_identifier:b});r.push(q);const Le={uuid:q.uuid,file_name:R.name,file_sha1:w.sha1,file_extension:w.extension,field_identifier:b,field_values:g};y.push(Le)}u.push({submitted_at:a,attachments:y,files:Object.values(p)})}this.dispatch(Ot(r));const m=u.map(h=>this.enqueueRequest({description:"Add asset procedure type field values attachments",method:l.POST,url:"/asset-procedure-type-field-values-attachments/bulk/",payload:h,blockers:h.attachments.map(p=>p.field_values),blocks:h.attachments.map(p=>p.uuid)}));return Promise.all(m).then(h=>{for(const y of h)this.processPresignedUrls(y.presigned_urls);const p=h.flatMap(y=>y.attachments);this.dispatch(rr(p))}).catch(h=>{throw this.dispatch(Rt(r.map(p=>p.uuid))),h}),[r,m.map(h=>h.then(({attachments:p})=>p))]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),n=or(e)(a);this.dispatch(Rt(e));try{await this.enqueueRequest({description:"Delete asset procedure type field values attachments",method:l.DELETE,url:"/asset-procedure-type-field-values-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(Ot(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset procedure type field values attachments",method:l.GET,url:"/asset-procedure-type-field-values-attachments/",queryParams:{limit:Ge,paginate:!0,field_values__asset_procedure__project:e,latest:!0},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset procedure type field values attachments",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(cr(n)),n}}class Sb extends O{add(e){var r;const{store:i}=this.client,a=i.getState(),n=F({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),c=this.enqueueRequest({description:"Add asset procedure type field values",method:l.POST,url:"/asset-procedure-type-field-values/",payload:v(n),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[n.uuid]});return this.dispatch(Ss(n)),c.then(u=>(this.dispatch(it(u)),u)).catch(()=>{this.dispatch(Ts(n.uuid))}),[n,c]}bulkAdd(e,i){var m;const a=new Date().toISOString(),n=[],c=Ke(e.payloads,i??e.payloads.length),r=[];for(const o of c){const h=[];for(const p of o){const y=F({...p,values:p.values,created_by:(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,submitted_at:a});n.push(y),h.push({uuid:y.uuid,asset:p.asset,fields_revision:p.fields_revision,asset_procedure:p.asset_procedure,published_at:p.published_at,values:y.values})}r.push({submitted_at:a,values:e.values,field_values:h})}this.dispatch(pr(n));const u=[];for(const o of r){const h=o.field_values.map(b=>b.asset),p=o.field_values.map(b=>b.fields_revision),y=o.field_values.map(b=>b.asset_procedure),A=o.field_values.map(b=>b.uuid),g=this.enqueueRequest({description:"Bulk add asset procedure type field values",method:l.POST,url:"/asset-procedure-type-field-values/bulk/",payload:o,blockers:[...h,...p,...y],blocks:A});u.push(g)}return Promise.all(u).then(o=>{this.dispatch(yr(o.flat()))}).catch(()=>{this.dispatch(Ar(n.map(o=>o.uuid)))}),[n,u]}update(e){const{store:i}=this.client,a=i.getState(),n=Is(e.uuid)(a);if(!n)throw new Error(`Expected AssetProcedureTypeFieldValues with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(it(c));const r=this.enqueueRequest({description:"Update asset procedure type field values",method:l.PATCH,url:`/asset-procedure-type-field-values/${e.uuid}/`,payload:e,blockers:[c.fields_revision,c.asset,c.asset_procedure],blocks:[c.uuid]});return r.then(u=>{this.dispatch(it(u))}).catch(()=>{this.dispatch(it(n))}),[c,r]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Is(e)(a);if(!n)throw new Error(`Expected submission with uuid ${e} to exist`);const c=lr(e)(a);this.dispatch(Ts(e)),this.dispatch(Rt(c.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete asset procedure type field values",method:l.DELETE,url:`/asset-procedure-type-field-values/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(Ss(n)),this.dispatch(Ot(c)),r}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset procedure type field values",method:l.GET,url:"/asset-procedure-type-field-values/",queryParams:{limit:this.pageSize,paginate:!0,asset_procedure__project:e,latest:!0},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset procedure type field values",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(mr(n)),n}}class Tb extends O{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(Fs(c));const r=this.enqueueRequest({description:"Create asset procedure",method:l.POST,url:"/asset-procedures/",payload:v(c),blockers:[e.asset_procedure_type,e.asset_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(at(m))}).catch(()=>{this.dispatch(Ps(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=Rs(e.uuid)(i.getState());if(!a)throw new Error(`Expected asset procedure with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(at(n));const c=this.enqueueRequest({description:"Update asset procedure",method:l.PATCH,url:`/asset-procedures/${e.uuid}/`,payload:e,blockers:[a.uuid],blocks:[a.uuid]});return c.then(r=>{this.dispatch(at(r))}).catch(()=>{this.dispatch(at(a))}),[n,c]}async remove(e){const{store:i}=this.client,a=i.getState(),n=Rs(e)(a);if(!n)throw new Error(`Expected asset procedure with uuid ${e} to exist`);return this.dispatch(Ps(e)),this.enqueueRequest({description:"Delete asset procedure",method:l.DELETE,url:`/asset-procedures/${e}/`,blockers:[e],blocks:[]}).catch(c=>{throw this.dispatch(Fs(n)),c})}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset procedures",method:l.GET,url:"/asset-procedures/",queryParams:{limit:this.pageSize,paginate:!0,project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset procedures",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(gr(n)),n}}class gb extends O{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(ws(c));const r=this.enqueueRequest({description:"Create asset procedure type",method:l.POST,url:"/asset-procedure-types/",payload:v(c),blockers:[],blocks:[c.uuid]});return r.then(m=>{this.dispatch(nt(m))}).catch(()=>{this.dispatch(Ms(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=Vs(e.uuid)(i.getState());if(!a)throw new Error(`Expected asset procedure type with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(nt(n));const c=this.enqueueRequest({description:"Update asset procedure type",method:l.PATCH,url:`/asset-procedure-types/${e.uuid}/`,payload:e,blockers:[a.uuid],blocks:[a.uuid]});return c.then(r=>{this.dispatch(nt(r))}).catch(()=>{this.dispatch(nt(a))}),[n,c]}async remove(e){const{store:i}=this.client,a=i.getState(),n=Vs(e)(a);if(!n)throw new Error(`Expected asset procedure type with uuid ${e} to exist`);const c=Pr(e)(a);return this.dispatch(Ms(e)),this.dispatch(br(c.map(({uuid:r})=>r))),this.enqueueRequest({description:"Delete asset procedure type",method:l.DELETE,url:`/asset-procedure-types/${e}/`,blockers:[e],blocks:[]}).catch(r=>{throw this.dispatch(ws(n)),this.dispatch(Ir(c)),r})}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset procedure types",method:l.GET,url:"/asset-procedure-types/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(Or(a)),a}}class Ib extends V{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const o of e){const{fieldsRevisionUuid:h,fieldIdentifier:p,file:y}=o,A=await this.getFilePayload(y);A.sha1 in n||(n[A.sha1]=A);const g=F({file:URL.createObjectURL(y),file_type:y.type,file_name:y.name,file_sha1:A.sha1,created_by:a,fields_revision:h,submitted_at:i,field_identifier:p});c.push(g);const b={uuid:g.uuid,file_name:y.name,field_identifier:p,file_extension:A.extension,file_sha1:A.sha1,fields_revision:h};r.push(b)}this.dispatch(Er(c));const u=this.enqueueRequest({description:"Add asset procedure step fields attachments",method:l.POST,url:"/asset-procedure-step-fields-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(o=>o.fields_revision),blocks:c.map(o=>o.uuid)});return u.then(o=>{this.processPresignedUrls(o.presigned_urls),this.dispatch(Vr(o.attachments))}).catch(()=>{this.dispatch(jr(c.map(o=>o.uuid)))}),[c,u.then(({attachments:o})=>o)]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset procedure step fields attachments",method:l.GET,url:"/asset-procedure-step-fields-attachments/",queryParams:{fields_revision__asset_procedure_step__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Mr(a)),a}}class bb extends O{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(zs(c));const r=this.enqueueRequest({description:"Add Asset Procedure Step Fields",method:l.POST,url:"/asset-procedure-step-fields/",payload:v(c),blockers:[c.asset_procedure_step],blocks:[c.uuid]});return r.then(m=>{this.dispatch(ct(m))}).catch(m=>{throw this.dispatch(Ds(c.uuid)),m}),[c,r]}update(e){const{store:i}=this.client,a=i.getState().assetProcedureStepFieldsReducer.instances[e.uuid];if(!a)throw new Error(`AssetProcedureStepFields with uuid ${e.uuid} not found`);const n={...a,...e};this.dispatch(ct(n));const c=this.enqueueRequest({description:"Update Asset Procedure Step Fields",method:l.PATCH,url:`/asset-procedure-step-fields/${a.uuid}/`,payload:e,blockers:[a.uuid],blocks:[a.uuid]});return c.then(r=>{this.dispatch(ct(r))}).catch(r=>{throw this.dispatch(ct(a)),r}),[n,c]}delete(e){const{store:i}=this.client,a=i.getState().assetProcedureStepFieldsReducer.instances[e];if(!a)throw new Error(`AssetProcedureStepFields with uuid ${e} not found`);this.dispatch(Ds(e));const n=this.enqueueRequest({description:"Delete Asset Procedure Step Fields",method:l.DELETE,url:`/asset-procedure-step-fields/${e}/`,blockers:[e],blocks:[e]});return n.catch(c=>{throw this.dispatch(zs(a)),c}),n}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get Asset Procedure Step Fields",method:l.GET,url:"/asset-procedure-step-fields/",queryParams:{asset_procedure_step__asset_procedure_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Cr(a)),a}}class Fb extends V{async bulkAdd(e,i){var o;const a=new Date().toISOString(),n=(o=this.client.store.getState().userReducer.currentUser)==null?void 0:o.id,c=Ke(e,i??e.length),r=[],u=[];for(const h of c){const p={},y=[];for(const A of h){const{fieldValuesUuid:g,fieldIdentifier:b,file:R}=A,w=await this.getFilePayload(R);w.sha1 in p||(p[w.sha1]=w);const q=F({file:URL.createObjectURL(R),file_type:R.type,file_name:R.name,file_sha1:w.sha1,created_by:n,field_values:g,submitted_at:a,field_identifier:b});r.push(q);const Le={uuid:q.uuid,file_name:R.name,file_sha1:w.sha1,file_extension:w.extension,field_identifier:b,field_values:g};y.push(Le)}u.push({submitted_at:a,attachments:y,files:Object.values(p)})}this.dispatch(vt(r));const m=u.map(h=>this.enqueueRequest({description:"Add asset procedure step field values attachments",method:l.POST,url:"/asset-procedure-step-field-values-attachments/bulk/",payload:h,blockers:h.attachments.map(p=>p.field_values),blocks:h.attachments.map(p=>p.uuid)}));return Promise.all(m).then(h=>{for(const y of h)this.processPresignedUrls(y.presigned_urls);const p=h.flatMap(y=>y.attachments);this.dispatch(Gr(p))}).catch(h=>{throw this.dispatch(wt(r.map(p=>p.uuid))),h}),[r,m.map(h=>h.then(({attachments:p})=>p))]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),n=Nr(e)(a);this.dispatch(wt(e));try{await this.enqueueRequest({description:"Delete asset procedure step field values attachments",method:l.DELETE,url:"/asset-procedure-step-field-values-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(vt(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset procedure step field values attachments",method:l.GET,url:"/asset-procedure-step-field-values-attachments/",queryParams:{limit:Ge,paginate:!0,field_values__asset_procedure__project:e,latest:!0},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset procedure step field values attachments",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch($r(n)),n}}class Pb extends O{add(e){var r;const{store:i}=this.client,a=i.getState(),n=F({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),c=this.enqueueRequest({description:"Add asset procedure step field values",method:l.POST,url:"/asset-procedure-step-field-values/",payload:v(n),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[n.uuid]});return this.dispatch(Gs(n)),c.then(u=>(this.dispatch(rt(u)),u)).catch(()=>{this.dispatch(Ls(n.uuid))}),[n,c]}bulkAdd(e,i){var m;const a=new Date().toISOString(),n=[],c=Ke(e.payloads,i??e.payloads.length),r=[];for(const o of c){const h=[];for(const p of o){const y=F({...p,values:p.values,created_by:(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,submitted_at:a});n.push(y),h.push({uuid:y.uuid,asset:p.asset,fields_revision:p.fields_revision,asset_procedure:p.asset_procedure,asset_procedure_step:p.asset_procedure_step,published_at:p.published_at,values:y.values})}r.push({submitted_at:a,values:e.values,field_values:h})}this.dispatch(Zr(n));const u=[];for(const o of r){const h=o.field_values.map(b=>b.asset),p=o.field_values.map(b=>b.fields_revision),y=o.field_values.map(b=>b.asset_procedure),A=o.field_values.map(b=>b.uuid),g=this.enqueueRequest({description:"Bulk add asset procedure step field values",method:l.POST,url:"/asset-procedure-step-field-values/bulk/",payload:o,blockers:[...h,...p,...y],blocks:A});u.push(g)}return Promise.all(u).then(o=>{this.dispatch(Jr(o.flat()))}).catch(()=>{this.dispatch(Xr(n.map(o=>o.uuid)))}),[n,u]}update(e){const{store:i}=this.client,a=i.getState(),n=Ns(e.uuid)(a);if(!n)throw new Error(`Expected AssetProcedureStepFieldValues with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(rt(c));const r=this.enqueueRequest({description:"Update asset procedure step field values",method:l.PATCH,url:`/asset-procedure-step-field-values/${e.uuid}/`,payload:e,blockers:[c.fields_revision,c.asset,c.asset_procedure],blocks:[c.uuid]});return r.then(u=>{this.dispatch(rt(u))}).catch(()=>{this.dispatch(rt(n))}),[c,r]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Ns(e)(a);if(!n)throw new Error(`Expected submission with uuid ${e} to exist`);const c=Hr(e)(a);this.dispatch(Ls(e)),this.dispatch(wt(c.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete asset procedure step field values",method:l.DELETE,url:`/asset-procedure-step-field-values/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(Gs(n)),this.dispatch(vt(c)),r}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset procedure step field values",method:l.GET,url:"/asset-procedure-step-field-values/",queryParams:{limit:this.pageSize,paginate:!0,asset_procedure__project:e,latest:!0},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset procedure step field values",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Yr(n)),n}}class _b extends O{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(id(c));const r=this.enqueueRequest({description:"Create asset procedure step",method:l.POST,url:"/asset-procedure-steps/",payload:v(c),blockers:[c.asset_procedure_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(Et(m))}).catch(()=>{this.dispatch(nd(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=Ws(e.uuid)(i.getState());if(!a)throw new Error(`No asset procedure step with uuid ${e.uuid} found in the store`);const n={...a,...e};this.dispatch(Et(n));const c=this.enqueueRequest({description:"Update asset procedure step",method:l.PATCH,url:`/asset-procedure-steps/${a.uuid}/`,payload:{name:e.name,description:e.description,priority:e.order,color:e.color},blockers:[a.uuid],blocks:[a.uuid]});return c.then(r=>{this.dispatch(Et(r))}).catch(()=>{this.dispatch(sd(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Ws(e)(a);if(!n)throw new Error(`No asset procedure step with uuid ${e} found in the store`);const c=ud(e)(a);return this.dispatch(cd([e,...yc(c)])),this.enqueueRequest({description:"Delete asset stage",method:l.DELETE,url:`/asset-procedure-steps/${e}/`,blockers:[e],blocks:[]}).catch(r=>{throw this.dispatch(ad([n,...c])),r})}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset procedure steps",method:l.GET,url:"/asset-procedure-steps/",queryParams:{asset_procedure_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(td(a)),a}}class Ob extends O{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(Ys(c));const r=this.enqueueRequest({description:"Create asset",method:l.POST,url:"/assets/",payload:v(c),blockers:[c.asset_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(ut(m))}).catch(()=>{this.dispatch(Zs(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=xs(e.uuid)(i.getState());if(!a)throw new Error(`No asset with uuid ${e.uuid} found in the store`);const n={...a,...e};this.dispatch(ut(n));const c=this.enqueueRequest({description:"Edit asset",method:l.PATCH,url:`/assets/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(ut(r))}).catch(()=>{this.dispatch(ut(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=xs(e)(a);if(!n)throw new Error(`No asset with uuid ${e} found in the store`);const c=Vc(e)(a),r=hl(e)(a);if(this.dispatch(Zs(e)),c.length>0){const u=c.map(({uuid:m})=>m);this.dispatch(us(u))}if(r.length>0){const u=r.map(({uuid:m})=>m);this.dispatch(Oa(u))}return this.enqueueRequest({description:"Delete asset",method:l.DELETE,url:`/assets/${e}/`,blockers:[e],blocks:[]}).catch(u=>{throw this.dispatch(Ys(n)),this.dispatch(ds(c)),this.dispatch(Pa(r)),u})}bulkAdd(e,i,a,n){const c=new Date().toISOString(),r=Je.v4(),u=Ke(e,n).map(h=>{const p=h.map(y=>F(y));return{batchId:Je.v4(),payload:{transaction_id:r,submitted_at:c,asset_type:i,project:a,assets:p}}}),m=[];let o=null;for(const h of u){const{batchId:p,payload:y}=h,A=y.assets.map(w=>w.uuid),g=[i];o&&g.push(o);const b=A;b.push(p);const R=this.enqueueRequest({description:"Batch create assets",method:l.POST,url:"/assets/bulk/",payload:y,blockers:g,blocks:b});o=h.batchId,m.push(R)}return Promise.all(m).then(h=>{const p=h.flat();this.dispatch(Vt(p))}),m}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),n=md(e)(a);this.dispatch(Js(e));try{await this.enqueueRequest({description:"Bulk delete assets",method:l.DELETE,url:"/assets/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(Vt(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get assets",method:l.GET,url:"/assets/",queryParams:{limit:this.pageSize,paginate:!0,project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get assets",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(ld(n)),n}}class Rb extends O{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(ti(c));const r=this.enqueueRequest({description:"Add asset stage completion",method:l.POST,url:"/asset-stage-completions/",payload:v(c),blockers:[e.asset,e.asset_stage],blocks:[c.uuid]});return r.then(m=>{this.dispatch(fd(m))}).catch(()=>{this.dispatch(ii(c.uuid))}),[c,r]}delete(e){const{store:i}=this.client,a=gd(e)(i.getState());if(!a)throw new Error(`Expected asset stage completion with uuid ${e} to exist`);this.dispatch(ii(e));const n=this.enqueueRequest({description:"Delete asset stage completion",method:l.DELETE,url:`/asset-stage-completions/${e}/`,blockers:[e],blocks:[]});return n.catch(()=>{this.dispatch(ti(a))}),n}bulkAdd(e){var o;const{store:i}=this.client,a=new Date().toISOString(),n=(o=i.getState().userReducer.currentUser)==null?void 0:o.id,c=e.map(h=>F(h)),r=c.map(h=>({...h,created_by:n,submitted_at:a})),u=r.map(({uuid:h})=>h);this.dispatch(si(r));const m=this.enqueueRequest({description:"Bulk create asset stage completions",method:l.POST,url:"/asset-stage-completions/bulk/",payload:{submitted_at:a,completions:c},blockers:[...e.map(h=>h.asset_procedure),...e.map(h=>h.asset_stage),...e.map(h=>h.asset)],blocks:u});return m.then(h=>{this.dispatch(Sd(h))}).catch(()=>{this.dispatch(ai(u))}),[r,m]}bulkDelete(e){const{store:i}=this.client,a=Id(e)(i.getState());this.dispatch(ai(e));const n=this.enqueueRequest({description:"Deleting asset stage completions",method:l.DELETE,url:"/asset-stage-completions/bulk/",payload:{uuids:e},blockers:e,blocks:[]});return n.catch(()=>{this.dispatch(si(a))}),n}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset stage completions",method:l.GET,url:"/asset-stage-completions/",queryParams:{limit:this.pageSize,paginate:!0,asset_procedure__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset stage completions",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Ad(n)),n}}class vb extends O{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(ri(c));const r=this.enqueueRequest({description:"Create asset",method:l.POST,url:"/asset-stages/",payload:v(c),blockers:[c.asset_procedure_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(jt(m))}).catch(()=>{this.dispatch(di(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=ui(e.uuid)(i.getState());if(!a)throw new Error(`No asset stage with uuid ${e.uuid} found in the store`);const n={...a,...e};this.dispatch(jt(n));const c=this.enqueueRequest({description:"Update asset stage",method:l.PATCH,url:`/asset-stages/${a.uuid}/`,payload:e,blockers:[a.uuid],blocks:[a.uuid]});return c.then(r=>{this.dispatch(jt(r))}).catch(()=>{this.dispatch(Pd(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=ui(e)(a);if(!n)throw new Error(`No asset stage with uuid ${e} found in the store`);return this.dispatch(di(e)),this.enqueueRequest({description:"Delete asset stage",method:l.DELETE,url:`/asset-stages/${e}/`,blockers:[e],blocks:[]}).catch(c=>{throw this.dispatch(ri(n)),c})}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset stages",method:l.GET,url:"/asset-stages/",queryParams:{asset_procedure_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Fd(a)),a}}class wb extends He{constructor(){super(...arguments);S(this,"name","Asset Type Attachment");S(this,"url","/asset-type-attachments");S(this,"initializeAttachments",li);S(this,"addAttachments",hi);S(this,"updateAttachments",wd);S(this,"removeAttachments",mi);S(this,"removeAttachment",Md);S(this,"setAttachment",vd);S(this,"selectAttachment",jd)}getId(i){return i.uuid}buildModel(i){return F({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,asset_type:i.modelUuid})}buildPayload(i,a){return{uuid:i.uuid,file_name:i.file_name,file_sha1:i.file_sha1,file_extension:a.extension,asset_type:i.asset_type}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.assetTypeUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const n=await this.enqueueRequest({immediate:!0,description:"Get asset type attachments",method:l.GET,url:`${this.url}/`,queryParams:{asset_type__organization:i},blocks:[],blockers:[]},a);return this.dispatch(li(n)),n}}class Mb extends V{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const o of e){const{fieldsRevisionUuid:h,fieldIdentifier:p,file:y}=o,A=await this.getFilePayload(y);A.sha1 in n||(n[A.sha1]=A);const g=F({file:URL.createObjectURL(y),file_type:y.type,file_name:y.name,file_sha1:A.sha1,created_by:a,fields_revision:h,submitted_at:i,field_identifier:p});c.push(g);const b={uuid:g.uuid,file_name:y.name,field_identifier:p,file_extension:A.extension,file_sha1:A.sha1,fields_revision:h};r.push(b)}this.dispatch(Cd(c));const u=this.enqueueRequest({description:"Add asset type fields attachments",method:l.POST,url:"/asset-type-fields-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(o=>o.fields_revision),blocks:c.map(o=>o.uuid)});return u.then(o=>{this.processPresignedUrls(o.presigned_urls),this.dispatch(kd(o.attachments))}).catch(()=>{this.dispatch(Bd(c.map(o=>o.uuid)))}),[c,u.then(({attachments:o})=>o)]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset type fields attachments",method:l.GET,url:"/asset-type-fields-attachments/",queryParams:{fields_revision__asset_type__organization:e},blockers:[e],blocks:[]},i);return this.dispatch(Ud(a)),a}}class Eb extends O{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(Wd(c));const r=this.enqueueRequest({description:"Add Asset Type Fields",method:l.POST,url:"/asset-type-fields/",payload:v(c),blockers:[c.asset_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(Kd(m))}).catch(m=>{throw this.dispatch(Yd(c.uuid)),m}),[c,r]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get Asset Type Fields",method:l.GET,url:"/asset-type-fields/",queryParams:{asset_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Hd(a)),a}}class Vb extends V{async bulkAdd(e,i){var o;const a=new Date().toISOString(),n=(o=this.client.store.getState().userReducer.currentUser)==null?void 0:o.id,c=Ke(e,i??e.length),r=[],u=[];for(const h of c){const p={},y=[];for(const A of h){const{fieldValuesUuid:g,fieldIdentifier:b,file:R}=A,w=await this.getFilePayload(R);w.sha1 in p||(p[w.sha1]=w);const q=F({file:URL.createObjectURL(R),file_type:R.type,file_name:R.name,file_sha1:w.sha1,created_by:n,field_values:g,submitted_at:a,field_identifier:b});r.push(q);const Le={uuid:q.uuid,file_name:R.name,file_sha1:w.sha1,file_extension:w.extension,field_identifier:b,field_values:g};y.push(Le)}u.push({submitted_at:a,attachments:y,files:Object.values(p)})}this.dispatch(Dt(r));const m=u.map(h=>this.enqueueRequest({description:"Add asset type field values attachments",method:l.POST,url:"/asset-type-field-values-attachments/bulk/",payload:h,blockers:h.attachments.map(p=>p.field_values),blocks:h.attachments.map(p=>p.uuid)}));return Promise.all(m).then(h=>{for(const y of h)this.processPresignedUrls(y.presigned_urls);const p=h.flatMap(y=>y.attachments);this.dispatch(xd(p))}).catch(h=>{throw this.dispatch(Ut(r.map(p=>p.uuid))),h}),[r,m.map(h=>h.then(({attachments:p})=>p))]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),n=tu(e)(a);this.dispatch(Ut(e));try{await this.enqueueRequest({description:"Delete asset type field values attachments",method:l.DELETE,url:"/asset-type-field-values-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(Dt(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset type field values attachments",method:l.GET,url:"/asset-type-field-values-attachments/",queryParams:{limit:Ge,paginate:!0,field_values__asset__project:e,latest:!0},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset type field values attachments",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Qd(n)),n}}class jb extends O{add(e){var r;const{store:i}=this.client,a=i.getState(),n=F({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),c=this.enqueueRequest({description:"Add asset type field values",method:l.POST,url:"/asset-type-field-values/",payload:v(n),blockers:[e.asset,e.fields_revision],blocks:[n.uuid]});return this.dispatch(Ti(n)),c.then(u=>(this.dispatch(ot(u)),u)).catch(()=>{this.dispatch(gi(n.uuid))}),[n,c]}bulkAdd(e,i){var m;const a=new Date().toISOString(),n=[],c=Ke(e.payloads,i??e.payloads.length),r=[];for(const o of c){const h=[];for(const p of o){const y=F({...p,values:p.values,created_by:(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,submitted_at:a});n.push(y),h.push({uuid:y.uuid,asset:p.asset,fields_revision:p.fields_revision,published_at:p.published_at,values:y.values})}r.push({submitted_at:a,values:e.values,field_values:h})}this.dispatch(cu(n));const u=[];for(const o of r){const h=o.field_values.map(g=>g.asset),p=o.field_values.map(g=>g.fields_revision),y=o.field_values.map(g=>g.uuid),A=this.enqueueRequest({description:"Bulk add asset type field values",method:l.POST,url:"/asset-type-field-values/bulk/",payload:o,blockers:[...h,...p],blocks:y});u.push(A)}return Promise.all(u).then(o=>{this.dispatch(ru(o.flat()))}).catch(()=>{this.dispatch(du(n.map(o=>o.uuid)))}),[n,u]}update(e){const{store:i}=this.client,a=i.getState(),n=bi(e.uuid)(a);if(!n)throw new Error(`Expected AssetTypeFieldValues with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(ot(c));const r=this.enqueueRequest({description:"Delete asset type field values",method:l.PATCH,url:`/asset-type-field-values/${e.uuid}/`,payload:e,blockers:[c.uuid,c.fields_revision,c.asset],blocks:[c.uuid]});return r.then(u=>{this.dispatch(ot(u))}).catch(()=>{this.dispatch(ot(n))}),[c,r]}async delete(e){const{store:i}=this.client,a=i.getState(),n=bi(e)(a);if(!n)throw new Error(`Expected submission with uuid ${e} to exist`);const c=su(e)(a);this.dispatch(gi(e)),this.dispatch(Ut(c.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete asset type field values",method:l.DELETE,url:`/asset-type-field-values/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(Ti(n)),this.dispatch(Dt(c)),r}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset type field values",method:l.GET,url:"/asset-type-field-values/",queryParams:{limit:this.pageSize,paginate:!0,asset__project:e,latest:!0},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset type field values",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(nu(n)),n}}class qb extends O{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(Pi(c));const r=this.enqueueRequest({description:"Create asset type identifier",method:l.POST,url:"/asset-type-identifiers/",payload:v(c),blockers:[c.asset_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(lt(m))}).catch(()=>{this.dispatch(_i(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=Oi(e.uuid)(i.getState());if(!a)throw new Error(`Expected asset type identifier with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(lt(n));const c=this.enqueueRequest({description:"Update asset type identifier",method:l.PATCH,url:`/asset-type-identifiers/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(lt(r))}).catch(()=>{this.dispatch(lt(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Oi(e)(a);if(!n)throw new Error(`Expected asset type identifier with uuid ${e} to exist`);this.dispatch(_i(e));try{return await this.enqueueRequest({description:"Delete asset type identifier",method:l.DELETE,url:`/asset-type-identifiers/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(Pi(n)),c}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset type identifiers",method:l.GET,url:"/asset-type-identifiers/",queryParams:{asset_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(hu(a)),a}}class zb extends O{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(vi(c));const r=this.enqueueRequest({description:"Create asset type identifier value",method:l.POST,url:"/asset-type-identifier-values/",payload:v(c),blockers:[e.asset,e.asset_type_identifier],blocks:[c.uuid]});return r.then(m=>{this.dispatch(ht(m))}).catch(()=>{this.dispatch(wi(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=Ei(e.uuid)(i.getState());if(!a)throw new Error(`Expected asset type identifier value with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(ht(n));const c=this.enqueueRequest({description:"Update asset type identifier value",method:l.PATCH,url:`/asset-type-identifier-values/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(ht(r))}).catch(()=>{this.dispatch(ht(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Ei(e)(a);if(!n)throw new Error(`Expected asset type identifier value with uuid ${e} to exist`);this.dispatch(wi(e));try{return await this.enqueueRequest({description:"Delete asset type identifier value",method:l.DELETE,url:`/asset-type-identifier-values/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(vi(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset type identifier values",method:l.GET,url:"/asset-type-identifier-values/",queryParams:{limit:this.pageSize,paginate:!0,asset__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset type identifier values",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(fu(n)),n}}class Db extends O{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(ji(c));const r=this.enqueueRequest({description:"Create asset type",method:l.POST,url:"/asset-types/",payload:v(c),blockers:[],blocks:[c.uuid]});return r.then(m=>{this.dispatch(mt(m))}).catch(()=>{this.dispatch(qi(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=Di(e.uuid)(i.getState());if(!a)throw new Error(`Expected asset type with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(mt(n));const c=this.enqueueRequest({description:"Update asset type",method:l.PATCH,url:`/asset-types/${e.uuid}/`,payload:e,blockers:[a.uuid],blocks:[a.uuid]});return c.then(r=>{this.dispatch(mt(r))}).catch(()=>{this.dispatch(mt(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Di(e)(a);if(!n)throw new Error(`Expected asset type with uuid ${e} to exist`);const c=Qs(e)(a),r=qd(e)(a);return this.dispatch(qi(e)),this.dispatch(Js(c.map(u=>u.uuid))),this.dispatch(mi(r.map(({uuid:u})=>u))),this.enqueueRequest({description:"Delete asset type",method:l.DELETE,url:`/asset-types/${e}/`,blockers:[e],blocks:[]}).catch(u=>{throw this.dispatch(ji(n)),this.dispatch(Vt(c)),this.dispatch(hi(r)),u})}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset types",method:l.GET,url:"/asset-types/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(Iu(a)),a}}class Ub extends O{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(Ci(c));const r=this.enqueueRequest({description:"Create Category",method:l.POST,url:"/categories/",payload:v(c),blockers:[e.project],blocks:[c.uuid]});return[c,r]}update(e){const i=this.client.store.getState(),a=Bi(e.uuid)(i);if(!a)throw new Error(`Expected an existing category with uuid ${e.uuid}`);const n={...a,...e};this.dispatch(wu(n));const c=this.enqueueRequest({description:"Edit Category",method:l.PATCH,url:`/categories/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return[n,c]}remove(e){const{store:i}=this.client,a=Bi(e)(i.getState());if(!a)throw new Error(`No category with uuid ${e} found in the store`);this.dispatch(Mu(e));const n=this.enqueueRequest({description:"Delete Category",method:l.DELETE,url:`/categories/${a.uuid}/`,blockers:[a.uuid],blocks:[]});return n.catch(()=>{this.dispatch(Ci(a))}),n}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get categories",method:l.GET,url:"/categories/",queryParams:{project__organization:e},blocks:[],blockers:[]},i);return this.dispatch(vu(a)),a}}class Cb extends He{constructor(){super(...arguments);S(this,"name","Document Attachment");S(this,"url","/document-attachments");S(this,"initializeAttachments",Gi);S(this,"addAttachments",qu);S(this,"updateAttachments",Du);S(this,"removeAttachments",Cu);S(this,"removeAttachment",Uu);S(this,"setAttachment",zu);S(this,"selectAttachment",$u)}getId(i){return i.uuid}buildModel(i){return F({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,document:i.modelUuid})}buildPayload(i,a){return{uuid:i.uuid,file_name:i.file_name,file_sha1:i.file_sha1,file_extension:a.extension,document:i.document}}async bulkAdd(i){var p;const{store:a}=this.client,n=(p=a.getState().userReducer.currentUser)==null?void 0:p.id,c=new Date().toISOString(),r=[],u=[],m={},o={};for(const y of i){const{documentUuid:A,file:g}=y,b=await this.getFilePayload(g);b.sha1 in m||(m[b.sha1]=b,o[b.sha1]=[]);const R=this.buildModel({file:g,file_sha1:b.sha1,submitted_at:c,created_by:n,modelUuid:A});r.push(R),u.push(this.buildPayload(R,b)),o[b.sha1].push(R.uuid)}this.dispatch(this.addAttachments(r));const h=this.enqueueRequest({description:"Attach files to document",method:l.POST,url:"/document-attachments/bulk/",payload:{submitted_at:c,attachments:u,files:Object.values(m)},blocks:r.map(y=>y.uuid),blockers:r.map(y=>y.file_sha1)});return h.then(({attachments:y,presigned_urls:A})=>{this.dispatch(this.updateAttachments(y));const g=this.processPresignedUrls(A);for(const[b,R]of Object.entries(g))R.then(()=>{const w=o[b];for(const q of w)this.makeReadable(q)})}).catch(()=>{this.dispatch(this.removeAttachments(r.map(y=>y.uuid)))}),[r,h.then(({attachments:y})=>y)]}async delete(i){return this._delete(i)}makeReadable(i){this.enqueueRequest({description:"Add attachment to AI assistant",method:l.PATCH,url:`/document-attachments/${i}/`,payload:{readable_to_assistant:!0},blockers:["index-document-attachment",i],blocks:["index-document-attachment"]})}async refreshStore(i,a){const n=await this.enqueueRequest({immediate:!0,description:"Get document attachments",method:l.GET,url:"/document-attachments/",queryParams:{document__project__organization:i},blocks:[],blockers:[]},a),c=await this.enqueueRequest({immediate:!0,description:"Get document attachments",method:l.GET,url:"/document-attachments/",queryParams:{document__organization:i},blocks:[],blockers:[]},a),r=[...n,...c];return this.dispatch(Gi(r)),r}}class kb extends O{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(Hu([c]));const r=this.enqueueRequest({description:"Create Document",method:l.POST,url:"/documents/",payload:v(c),queryParams:{parent_document:c.parent_document??void 0},blockers:c.parent_document?[c.parent_document]:[],blocks:[c.uuid]});return r.catch(()=>{this.dispatch(Ni([c.uuid]))}),[c,r]}update(e){const{store:i}=this.client,a=i.getState().documentsReducer.documents[e.uuid];if(!a)throw new Error(`attempting to update a document with uuid ${e.uuid} that does not exist in store.documents`);const n={...a,...e};this.dispatch(Qe([n]));const c=this.enqueueRequest({description:"Update Document",method:l.PATCH,url:`/documents/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.catch(()=>{Qe([a])}),[n,c]}delete(e){const{store:i}=this.client,a=kt(i.getState()),n=Wu(e)(i.getState());if(!n)throw new Error(`attempting to delete a document with uuid ${e} that does not exist in store.documents`);const c=n.parent_document?a[n.parent_document]:void 0;this.dispatch(Ni([e]));const r=this.enqueueRequest({description:"Delete Document",method:l.DELETE,url:`/documents/${e}/`,blockers:[e],blocks:[]});return r.then(u=>{this.dispatch(Qe(u))}).catch(()=>{this.dispatch(Qe([n])),c&&this.dispatch(Qe([c]))}),r}async refreshStore(e,i){const a=this.enqueueRequest({immediate:!0,description:"Get project documents",method:l.GET,url:"/documents/",queryParams:{project__organization:e},blockers:[],blocks:[]},i),n=this.enqueueRequest({immediate:!0,description:"Get organization documents",method:l.GET,url:"/documents/",queryParams:{organization:e},blockers:[],blocks:[]},i),c=[...await a,...await n];return this.dispatch(Nu(c)),c}}class Bb extends O{async add(e,i){return this.enqueueRequest({description:"Add email domain to organization",method:l.POST,url:"/organization-email-domains/",payload:{email:i,organization:e},blockers:[e,"create-org"],blocks:[]})}async remove(e){return this.dispatch(Xu(e.uuid)),this.enqueueRequest({description:"Remove email domain from organization",method:l.DELETE,url:`/organization-email-domains/${e.uuid}/`,blockers:[e.domain],blocks:[]}).catch(i=>{throw this.dispatch(Ju(e)),i})}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch email domains for organization",method:l.GET,url:"/organization-email-domains/",queryParams:{organization:e},blockers:[e],blocks:[]},i);return this.dispatch(Zu(a)),a}}class $b extends O{async getVerificationCode(e){return this.enqueueRequest({description:"Get verification code",method:l.GET,url:`/verification/email-verification/${e}/`,isAuthNeeded:!1,blockers:[],blocks:[]})}validateVerificationCode(e,i=void 0){return this.enqueueRequest({description:"Validate verification code",method:l.POST,url:`/verification/email-verification/${e}/`,isAuthNeeded:!1,payload:i,blockers:[],blocks:[]})}}const Jt={},Jn=new Set;let Xt=0,Xn=0,Qn=0;const Gb=20;class Lb extends O{constructor(){super(...arguments);S(this,"host");S(this,"_dbPromise",Yp.openDB("fileCache",1,{upgrade(i){i.createObjectStore("files")}}))}async renewUploadUrl(i){const a=await this.fetchCache(i);if(!a)throw new Error(`File with sha1 ${i} not found in cache`);const n=await is(a,i),c=await this.enqueueRequest({description:"Get S3 URL",method:l.GET,url:"/authentication/files/presigned-upload-url/",queryParams:{sha1:await Xe(a),file_type:a.type,extension:a.name.split(".").pop(),size:a.size.toString()},blockers:[],blocks:[`s3-${n}`]});return"url"in c&&this.dispatch(io({sha1:i,...c})),c}async addCache(i,a){if(Jn.has(a))return;if(!i.type){const r=i.name.split("."),u=r[r.length-1];i=new File([i],i.name,{type:u})}if(!i.name||!i.size||!i.type)throw new Error("Cannot add files to cache that do not have a name, size and type.");const n=await this._dbPromise;!!await n.get("files",a)?(console.error("File already cached (this is unexpected at this point):",i.name,a),Xt++):(await n.put("files",i,a),Xn++),Jn.add(a),Qn++,Qn%Gb===0&&console.debug(`File cache summary: ${Xt} hits and ${Xn} misses, ${Xt/(Xt+Xn)*100}% hit rate over ${Qn} calls to addCache.`)}async removeCache(i){await(await this._dbPromise).delete("files",i),Jn.delete(i)}async fetchCache(i){return(await this._dbPromise).get("files",i)}async getOrRenewUploadUrl(i){const a=this.client.store.getState();return ao(i)(a)??await this.renewUploadUrl(i)}async uploadFileToS3(i){const a=await this.fetchCache(i);if(!a)throw new Error(`File with sha1 ${i} not found in cache`);const n=await is(a,i),c={file_name:a.name,file_sha1:i,file:n},r=await this.getOrRenewUploadUrl(i);if("warning"in r){if(r.warning==="already_uploaded")return[c,Promise.resolve(void 0)];throw new Error(r.warning)}const u=r.url,m=this.enqueueRequest({url:u,description:"Upload file",method:l.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:i,blockers:[`s3-${n}`],blocks:[i],s3url:r});return[c,m]}async fetchFileFromUrl(i,a,n){const c=i.split("?")[0]??i,r=await this.fetchCache(a);if(r){if(!r.name)throw new Error("Cached file unexpectedly has no name.");return r}if(i.startsWith("blob:")){const h=await lc(i),p=new File([h],n??a,{type:h.type});return await this.addCache(p,a),p}let u=Jt[c],m=!0;u?m=!1:(u=new Promise(h=>{this.enqueueRequest({description:"Download file",method:l.GET,url:i,isExternalUrl:!0,isResponseBlob:!0,isAuthNeeded:!1,blockers:[a],blocks:[a]}).then(p=>{const y=new File([p],n??a,{type:p.type});h(y)})}),Jt[c]=u);let o;try{o=await u}catch(h){throw m&&h instanceof D&&delete Jt[c],h}if(m){const h=await Xe(o);if(h!==a){const A=`The hash of the file returned from the server (${h}) does not match the
4
+ Retries:`,i),!(t instanceof Error))throw console.error("ENCOUNTERED NON-ERROR ERROR:",t,"(throwing immediately, which may lead to unexpected behavior)"),t;const a=et(),n=a.getState().outboxReducer.deletedRequests,r=e.payload.uuid;function u(){a.dispatch(um(r));const h=Ke();if(!h)throw new Error("Outbox coordinator not set");h.remove(e.payload.uuid);const p=e.meta.offline.rollback;throw p&&(console.warn("Rolling back request due to SDK error:",e),a.dispatch(p)),t}if(t instanceof U&&t.options.discard&&(console.debug("Discarding request due to explicit discard:",e),u()),n.includes(r)&&(console.debug("Discarding request due to deletion:",e),u()),t instanceof U){const h=t.status||((o=t.response)==null?void 0:o.status);if(h||console.warn("Error has no status code:",t),h!==void 0&&Tp.includes(h)){console.warn("Discarding request due to error:",t,`
5
+ Action:`,e);const p=Ke();if(!p)throw new Error("Outbox coordinator not set");p.remove(e.payload.uuid),t.options.discard=!0,u()}}console.debug("Registering a retry for request:",e.payload.uuid);const m=Ke();if(!m)throw new Error("Outbox coordinator not set");return m.registerRetry(e.payload.uuid),!1}function Ng(t,e,i){var a;return(a=Ke())==null?void 0:a.peek()}function Hg(t,e){return et().dispatch(om(new Date().getTime())),cn}const Qe="An unknown error occurred",Wg=500,gp=["non_field_errors","detail"];function Kg(t,e){let i;if(t!=null&&t.body)if(typeof t.body=="object"){const a=t.body;if(typeof a.error=="string")i=a.error;else if(typeof a.message=="string")i=a.message;else try{i=Object.entries(a).map(([c,n])=>typeof n=="string"?gp.includes(c)?n:`${c}: ${n}`:Array.isArray(n)?gp.includes(c)?n.join(`
6
+ `):n.map(r=>`${c}: ${r}`).join(`
7
+ `):`${c}: ${JSON.stringify(n)}`).join(`
8
+ `)}catch(c){console.error("Failed to extract error message from response body",c)}}else typeof t.body=="string"&&(i=t.body);else t!=null&&t.text?i=t.text:e instanceof Error&&(i=e.message);return!i||i.length>Wg?Qe:i}class U extends Error{constructor(i){super(Qe);S(this,"status");S(this,"response");S(this,"message");S(this,"options");const{response:a,innerError:c}=i;this.message=i.message??Kg(a,c)??Qe,this.status=(a==null?void 0:a.status)??0,this.response=a,i.discard=i.discard??!1,this.options=i}}class Yg extends hp{constructor(e){super(e)}}class O extends hp{constructor(i,a){super(i);S(this,"auth");this.auth=a}}class Zg extends O{async startConversation(e,i){return this.enqueueRequest({description:"Start agent conversation",method:l.POST,url:"/agents/prompt/",payload:{prompt:e,active_project:i},blockers:["prompt"],blocks:["prompt"]}).then(a=>(this.dispatch(Tn(a)),a))}async continueConversation(e,i,a){return this.enqueueRequest({description:"Prompt agent",method:l.POST,url:"/agents/prompt/",payload:{prompt:e,active_project:a},blockers:["prompt"],blocks:["prompt"],queryParams:{conversation_id:i}}).then(c=>{this.dispatch(gn(c))})}async fetchDetails(e){return this.enqueueRequest({description:"Get agent conversation",method:l.GET,url:`/agents/conversations/${e}/`,blockers:["conversation"],blocks:["conversation"]}).then(i=>{this.dispatch(In(i))})}async rate(e,i){return this.enqueueRequest({description:"Rate agent response",method:l.PUT,url:`/agents/responses/${e}/rate/`,payload:{rating:i},blockers:["rate"],blocks:["rate"]})}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get agent conversation history",method:l.GET,url:"/agents/conversations/",queryParams:{project:e},blockers:["agent-conversations"],blocks:["agent-conversations"]},i);return this.dispatch(Sn(a)),a}}class E extends O{getNumberOfAttachmentsWithSha1(e){const{issueAttachmentReducer:i,assetAttachmentReducer:a,assetTypeAttachmentReducer:c,documentAttachmentReducer:n,projectAttachmentReducer:r,formRevisionAttachmentReducer:u,formSubmissionAttachmentReducer:m,geoImageReducer:o,assetTypeFieldsAttachmentReducer:h,assetTypeFieldValuesAttachmentReducer:p,issueTypeFieldsAttachmentReducer:y,issueTypeFieldValuesAttachmentReducer:A}=this.client.store.getState();return[].concat(Object.values(i.instances),Object.values(a.instances),Object.values(c.instances),Object.values(n.instances),Object.values(r.instances),Object.values(u.instances),Object.values(m.instances),Object.values(o.instances),Object.values(h.instances),Object.values(p.instances),Object.values(y.instances),Object.values(A.instances)).filter(g=>g.file_sha1===e).length}processPresignedUrls(e){const i={};for(const[a,c]of Object.entries(e))i[a]=this.enqueueRequest({url:c.url,description:"Upload file to S3",method:l.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:a,blockers:[`s3-${c.fields.key}`],blocks:[a],s3url:c});return i}async getFilePayload(e){const i=await Je(e),a={sha1:i,file_type:e.type,extension:e.name.split(".").pop(),size:e.size};return await this.client.files.addCache(e,i),a}}class Ne extends E{constructor(){super(...arguments);S(this,"pageSize",$e)}async _bulkAdd(i){var h;const{store:a}=this.client,c=(h=a.getState().userReducer.currentUser)==null?void 0:h.uuid,n=new Date().toISOString(),r=[],u=[],m={};for(const p of i){const{modelUuid:y,file:A}=p,I=await this.getFilePayload(A);I.sha1 in m||(m[I.sha1]=I);const g=this.buildModel({file:A,file_sha1:I.sha1,submitted_at:n,created_by:c,modelUuid:y});r.push(g),u.push(this.buildPayload(g,I))}this.dispatch(this.addAttachments(r));const o=this.enqueueRequest({description:`Add ${this.name}`,method:l.POST,url:`${this.url}/bulk/`,payload:{submitted_at:n,attachments:u,files:Object.values(m)},blocks:r.map(p=>this.getId(p)),blockers:r.map(p=>p.file_sha1)});return o.then(({attachments:p,presigned_urls:y})=>{this.dispatch(this.updateAttachments(p)),this.processPresignedUrls(y)}).catch(()=>{this.dispatch(this.removeAttachments(r.map(p=>this.getId(p))))}),[r,o.then(({attachments:p})=>p)]}async _delete(i){const{store:a}=this.client,c=this.selectAttachment(i)(a.getState());if(!c)throw new Error(`Attempting to delete attachment with uuid ${i} that does not exist in the store`);this.dispatch(this.removeAttachment(this.getId(c)));const n=this.enqueueRequest({description:`Delete ${this.name}`,method:l.DELETE,url:`${this.url}/${i}/`,blockers:[i],blocks:[]});return n.then(()=>{this.getNumberOfAttachmentsWithSha1(c.file_sha1)===0&&this.client.files.removeCache(c.file_sha1)}).catch(()=>{this.dispatch(this.setAttachment(c))}),n}}class Jg extends Ne{constructor(){super(...arguments);S(this,"name","Asset Attachment");S(this,"url","/asset-attachments");S(this,"initializeAttachments",ns);S(this,"addAttachments",rs);S(this,"updateAttachments",_n);S(this,"removeAttachments",ds);S(this,"removeAttachment",On);S(this,"setAttachment",Pn);S(this,"selectAttachment",wn)}getId(i){return i.uuid}buildModel(i){return F({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,asset:i.modelUuid})}buildPayload(i,a){return{uuid:i.uuid,file_name:i.file_name,file_sha1:i.file_sha1,file_extension:a.extension,asset:i.asset}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.assetUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const n=(await this.performPagination({immediate:!0,description:"Get asset attachments",method:l.GET,url:`${this.url}/`,queryParams:{limit:$e,paginate:!0,asset__project:i},blocks:[],blockers:[]},r=>({immediate:!0,description:"Get asset attachments",method:l.GET,url:r,blockers:[],blocks:[]}),a)).flat();return this.dispatch(ns(n)),n}}class Xg extends Ne{constructor(){super(...arguments);S(this,"name","Asset Procedure Attachment");S(this,"url","/asset-procedure-type-attachments");S(this,"initializeAttachments",os);S(this,"addAttachments",jn);S(this,"updateAttachments",zn);S(this,"removeAttachments",Cn);S(this,"removeAttachment",Un);S(this,"setAttachment",qn);S(this,"selectAttachment",$n)}getId(i){return i.uuid}buildModel(i){return F({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,asset_procedure_type:i.modelUuid})}buildPayload(i,a){return{uuid:i.uuid,file_name:i.file_name,file_sha1:i.file_sha1,file_extension:a.extension,asset_procedure_type:i.asset_procedure_type}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.assetProcedureTypeUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const c=await this.enqueueRequest({immediate:!0,description:"Get asset procedure attachments",method:l.GET,url:`${this.url}/`,queryParams:{asset_procedure_type__organization:i},blocks:[],blockers:[]},a);return this.dispatch(os(c)),c}}class Qg extends E{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.uuid,c={},n=[],r=[];for(const o of e){const{fieldsRevisionUuid:h,fieldIdentifier:p,file:y}=o,A=await this.getFilePayload(y);A.sha1 in c||(c[A.sha1]=A);const I=F({file:URL.createObjectURL(y),file_type:y.type,file_name:y.name,file_sha1:A.sha1,created_by:a,fields_revision:h,submitted_at:i,field_identifier:p});n.push(I);const g={uuid:I.uuid,file_name:y.name,field_identifier:p,file_extension:A.extension,file_sha1:A.sha1,fields_revision:h};r.push(g)}this.dispatch(Nn(n));const u=this.enqueueRequest({description:"Add asset procedure type fields attachments",method:l.POST,url:"/asset-procedure-type-fields-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(c)},blockers:n.map(o=>o.fields_revision),blocks:n.map(o=>o.uuid)});return u.then(o=>{this.processPresignedUrls(o.presigned_urls),this.dispatch(Hn(o.attachments))}).catch(()=>{this.dispatch(Wn(n.map(o=>o.uuid)))}),[n,u.then(({attachments:o})=>o)]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset procedure type fields attachments",method:l.GET,url:"/asset-procedure-type-fields-attachments/",queryParams:{fields_revision__asset_procedure_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Ln(a)),a}}class xg extends O{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.uuid,c=new Date().toISOString(),n=F({...e,created_by:a,submitted_at:c});this.dispatch(Qn(n));const r=this.enqueueRequest({description:"Add Asset Procedure Type Fields",method:l.POST,url:"/asset-procedure-type-fields/",payload:v(n),blockers:[n.asset_procedure_type],blocks:[n.uuid]});return r.then(m=>{this.dispatch(xn(m))}).catch(m=>{throw this.dispatch(er(n.uuid)),m}),[n,r]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get Asset Procedure Type Fields",method:l.GET,url:"/asset-procedure-type-fields/",queryParams:{asset_procedure_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Xn(a)),a}}function We(t,e){const i=[];let a=0;const c=t.length;for(;a<c;)i.push(t.slice(a,a+=e));return i}class eb extends E{async bulkAdd(e,i){var o;const a=new Date().toISOString(),c=(o=this.client.store.getState().userReducer.currentUser)==null?void 0:o.uuid,n=We(e,i??e.length),r=[],u=[];for(const h of n){const p={},y=[];for(const A of h){const{fieldValuesUuid:I,fieldIdentifier:g,file:R}=A,w=await this.getFilePayload(R);w.sha1 in p||(p[w.sha1]=w);const q=F({file:URL.createObjectURL(R),file_type:R.type,file_name:R.name,file_sha1:w.sha1,created_by:c,field_values:I,submitted_at:a,field_identifier:g});r.push(q);const Ge={uuid:q.uuid,file_name:R.name,file_sha1:w.sha1,file_extension:w.extension,field_identifier:g,field_values:I};y.push(Ge)}u.push({submitted_at:a,attachments:y,files:Object.values(p)})}this.dispatch(_t(r));const m=u.map(h=>this.enqueueRequest({description:"Add asset procedure type field values attachments",method:l.POST,url:"/asset-procedure-type-field-values-attachments/bulk/",payload:h,blockers:h.attachments.map(p=>p.field_values),blocks:h.attachments.map(p=>p.uuid)}));return Promise.all(m).then(h=>{for(const y of h)this.processPresignedUrls(y.presigned_urls);const p=h.flatMap(y=>y.attachments);this.dispatch(cr(p))}).catch(h=>{throw this.dispatch(Ot(r.map(p=>p.uuid))),h}),[r,m.map(h=>h.then(({attachments:p})=>p))]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),c=dr(e)(a);this.dispatch(Ot(e));try{await this.enqueueRequest({description:"Delete asset procedure type field values attachments",method:l.DELETE,url:"/asset-procedure-type-field-values-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(n){throw this.dispatch(_t(c)),n}}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get asset procedure type field values attachments",method:l.GET,url:"/asset-procedure-type-field-values-attachments/",queryParams:{limit:$e,paginate:!0,field_values__asset_procedure__project:e,latest:!0},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get asset procedure type field values attachments",method:l.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(ar(c)),c}}class tb extends O{add(e){var r;const{store:i}=this.client,a=i.getState(),c=F({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.uuid,submitted_at:new Date().toISOString()}),n=this.enqueueRequest({description:"Add asset procedure type field values",method:l.POST,url:"/asset-procedure-type-field-values/",payload:v(c),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[c.uuid]});return this.dispatch(fs(c)),n.then(u=>(this.dispatch(st(u)),u)).catch(()=>{this.dispatch(Ss(c.uuid))}),[c,n]}bulkAdd(e,i){var m;const a=new Date().toISOString(),c=[],n=We(e.payloads,i??e.payloads.length),r=[];for(const o of n){const h=[];for(const p of o){const y=F({...p,values:p.values,created_by:(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.uuid,submitted_at:a});c.push(y),h.push({uuid:y.uuid,asset:p.asset,fields_revision:p.fields_revision,asset_procedure:p.asset_procedure,published_at:p.published_at,values:y.values})}r.push({submitted_at:a,values:e.values,field_values:h})}this.dispatch(hr(c));const u=[];for(const o of r){const h=o.field_values.map(g=>g.asset),p=o.field_values.map(g=>g.fields_revision),y=o.field_values.map(g=>g.asset_procedure),A=o.field_values.map(g=>g.uuid),I=this.enqueueRequest({description:"Bulk add asset procedure type field values",method:l.POST,url:"/asset-procedure-type-field-values/bulk/",payload:o,blockers:[...h,...p,...y],blocks:A});u.push(I)}return Promise.all(u).then(o=>{this.dispatch(mr(o.flat()))}).catch(()=>{this.dispatch(pr(c.map(o=>o.uuid)))}),[c,u]}update(e){const{store:i}=this.client,a=i.getState(),c=Is(e.uuid)(a);if(!c)throw new Error(`Expected AssetProcedureTypeFieldValues with uuid ${e.uuid} to exist`);const n={...c,...e};this.dispatch(st(n));const r=this.enqueueRequest({description:"Update asset procedure type field values",method:l.PATCH,url:`/asset-procedure-type-field-values/${e.uuid}/`,payload:e,blockers:[n.fields_revision,n.asset,n.asset_procedure],blocks:[n.uuid]});return r.then(u=>{this.dispatch(st(u))}).catch(()=>{this.dispatch(st(c))}),[n,r]}async delete(e){const{store:i}=this.client,a=i.getState(),c=Is(e)(a);if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const n=ur(e)(a);this.dispatch(Ss(e)),this.dispatch(Ot(n.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete asset procedure type field values",method:l.DELETE,url:`/asset-procedure-type-field-values/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(fs(c)),this.dispatch(_t(n)),r}}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get asset procedure type field values",method:l.GET,url:"/asset-procedure-type-field-values/",queryParams:{limit:this.pageSize,paginate:!0,asset_procedure__project:e,latest:!0},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get asset procedure type field values",method:l.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(lr(c)),c}}class sb extends O{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.uuid,c=new Date().toISOString(),n=F({...e,created_by:a,submitted_at:c});this.dispatch(bs(n));const r=this.enqueueRequest({description:"Create asset procedure",method:l.POST,url:"/asset-procedures/",payload:v(n),blockers:[e.asset_procedure_type,e.asset_type],blocks:[n.uuid]});return r.then(m=>{this.dispatch(it(m))}).catch(()=>{this.dispatch(Fs(n.uuid))}),[n,r]}update(e){const{store:i}=this.client,a=Os(e.uuid)(i.getState());if(!a)throw new Error(`Expected asset procedure with uuid ${e.uuid} to exist`);const c={...a,...e};this.dispatch(it(c));const n=this.enqueueRequest({description:"Update asset procedure",method:l.PATCH,url:`/asset-procedures/${e.uuid}/`,payload:e,blockers:[a.uuid],blocks:[a.uuid]});return n.then(r=>{this.dispatch(it(r))}).catch(()=>{this.dispatch(it(a))}),[c,n]}async remove(e){const{store:i}=this.client,a=i.getState(),c=Os(e)(a);if(!c)throw new Error(`Expected asset procedure with uuid ${e} to exist`);return this.dispatch(Fs(e)),this.enqueueRequest({description:"Delete asset procedure",method:l.DELETE,url:`/asset-procedures/${e}/`,blockers:[e],blocks:[]}).catch(n=>{throw this.dispatch(bs(c)),n})}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get asset procedures",method:l.GET,url:"/asset-procedures/",queryParams:{limit:this.pageSize,paginate:!0,project:e},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get asset procedures",method:l.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Sr(c)),c}}class ib extends O{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.uuid,c=new Date().toISOString(),n=F({...e,created_by:a,submitted_at:c});this.dispatch(vs(n));const r=this.enqueueRequest({description:"Create asset procedure type",method:l.POST,url:"/asset-procedure-types/",payload:v(n),blockers:[],blocks:[n.uuid]});return r.then(m=>{this.dispatch(at(m))}).catch(()=>{this.dispatch(ws(n.uuid))}),[n,r]}update(e){const{store:i}=this.client,a=Vs(e.uuid)(i.getState());if(!a)throw new Error(`Expected asset procedure type with uuid ${e.uuid} to exist`);const c={...a,...e};this.dispatch(at(c));const n=this.enqueueRequest({description:"Update asset procedure type",method:l.PATCH,url:`/asset-procedure-types/${e.uuid}/`,payload:e,blockers:[a.uuid],blocks:[a.uuid]});return n.then(r=>{this.dispatch(at(r))}).catch(()=>{this.dispatch(at(a))}),[c,n]}async remove(e){const{store:i}=this.client,a=i.getState(),c=Vs(e)(a);if(!c)throw new Error(`Expected asset procedure type with uuid ${e} to exist`);const n=br(e)(a);return this.dispatch(ws(e)),this.dispatch(Ir(n.map(({uuid:r})=>r))),this.enqueueRequest({description:"Delete asset procedure type",method:l.DELETE,url:`/asset-procedure-types/${e}/`,blockers:[e],blocks:[]}).catch(r=>{throw this.dispatch(vs(c)),this.dispatch(Tr(n)),r})}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset procedure types",method:l.GET,url:"/asset-procedure-types/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(Pr(a)),a}}class ab extends E{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.uuid,c={},n=[],r=[];for(const o of e){const{fieldsRevisionUuid:h,fieldIdentifier:p,file:y}=o,A=await this.getFilePayload(y);A.sha1 in c||(c[A.sha1]=A);const I=F({file:URL.createObjectURL(y),file_type:y.type,file_name:y.name,file_sha1:A.sha1,created_by:a,fields_revision:h,submitted_at:i,field_identifier:p});n.push(I);const g={uuid:I.uuid,file_name:y.name,field_identifier:p,file_extension:A.extension,file_sha1:A.sha1,fields_revision:h};r.push(g)}this.dispatch(wr(n));const u=this.enqueueRequest({description:"Add asset procedure step fields attachments",method:l.POST,url:"/asset-procedure-step-fields-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(c)},blockers:n.map(o=>o.fields_revision),blocks:n.map(o=>o.uuid)});return u.then(o=>{this.processPresignedUrls(o.presigned_urls),this.dispatch(Mr(o.attachments))}).catch(()=>{this.dispatch(Vr(n.map(o=>o.uuid)))}),[n,u.then(({attachments:o})=>o)]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset procedure step fields attachments",method:l.GET,url:"/asset-procedure-step-fields-attachments/",queryParams:{fields_revision__asset_procedure_step__organization:e},blockers:[],blocks:[]},i);return this.dispatch(vr(a)),a}}class cb extends O{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.uuid,c=new Date().toISOString(),n=F({...e,created_by:a,submitted_at:c});this.dispatch(qs(n));const r=this.enqueueRequest({description:"Add Asset Procedure Step Fields",method:l.POST,url:"/asset-procedure-step-fields/",payload:v(n),blockers:[n.asset_procedure_step],blocks:[n.uuid]});return r.then(m=>{this.dispatch(ct(m))}).catch(m=>{throw this.dispatch(zs(n.uuid)),m}),[n,r]}update(e){const{store:i}=this.client,a=i.getState().assetProcedureStepFieldsReducer.instances[e.uuid];if(!a)throw new Error(`AssetProcedureStepFields with uuid ${e.uuid} not found`);const c={...a,...e};this.dispatch(ct(c));const n=this.enqueueRequest({description:"Update Asset Procedure Step Fields",method:l.PATCH,url:`/asset-procedure-step-fields/${a.uuid}/`,payload:e,blockers:[a.uuid],blocks:[a.uuid]});return n.then(r=>{this.dispatch(ct(r))}).catch(r=>{throw this.dispatch(ct(a)),r}),[c,n]}delete(e){const{store:i}=this.client,a=i.getState().assetProcedureStepFieldsReducer.instances[e];if(!a)throw new Error(`AssetProcedureStepFields with uuid ${e} not found`);this.dispatch(zs(e));const c=this.enqueueRequest({description:"Delete Asset Procedure Step Fields",method:l.DELETE,url:`/asset-procedure-step-fields/${e}/`,blockers:[e],blocks:[e]});return c.catch(n=>{throw this.dispatch(qs(a)),n}),c}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get Asset Procedure Step Fields",method:l.GET,url:"/asset-procedure-step-fields/",queryParams:{asset_procedure_step__asset_procedure_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Ur(a)),a}}class nb extends E{async bulkAdd(e,i){var o;const a=new Date().toISOString(),c=(o=this.client.store.getState().userReducer.currentUser)==null?void 0:o.uuid,n=We(e,i??e.length),r=[],u=[];for(const h of n){const p={},y=[];for(const A of h){const{fieldValuesUuid:I,fieldIdentifier:g,file:R}=A,w=await this.getFilePayload(R);w.sha1 in p||(p[w.sha1]=w);const q=F({file:URL.createObjectURL(R),file_type:R.type,file_name:R.name,file_sha1:w.sha1,created_by:c,field_values:I,submitted_at:a,field_identifier:g});r.push(q);const Ge={uuid:q.uuid,file_name:R.name,file_sha1:w.sha1,file_extension:w.extension,field_identifier:g,field_values:I};y.push(Ge)}u.push({submitted_at:a,attachments:y,files:Object.values(p)})}this.dispatch(Rt(r));const m=u.map(h=>this.enqueueRequest({description:"Add asset procedure step field values attachments",method:l.POST,url:"/asset-procedure-step-field-values-attachments/bulk/",payload:h,blockers:h.attachments.map(p=>p.field_values),blocks:h.attachments.map(p=>p.uuid)}));return Promise.all(m).then(h=>{for(const y of h)this.processPresignedUrls(y.presigned_urls);const p=h.flatMap(y=>y.attachments);this.dispatch(Br(p))}).catch(h=>{throw this.dispatch(vt(r.map(p=>p.uuid))),h}),[r,m.map(h=>h.then(({attachments:p})=>p))]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),c=Gr(e)(a);this.dispatch(vt(e));try{await this.enqueueRequest({description:"Delete asset procedure step field values attachments",method:l.DELETE,url:"/asset-procedure-step-field-values-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(n){throw this.dispatch(Rt(c)),n}}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get asset procedure step field values attachments",method:l.GET,url:"/asset-procedure-step-field-values-attachments/",queryParams:{limit:$e,paginate:!0,field_values__asset_procedure__project:e,latest:!0},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get asset procedure step field values attachments",method:l.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(kr(c)),c}}class rb extends O{add(e){var r;const{store:i}=this.client,a=i.getState(),c=F({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.uuid,submitted_at:new Date().toISOString()}),n=this.enqueueRequest({description:"Add asset procedure step field values",method:l.POST,url:"/asset-procedure-step-field-values/",payload:v(c),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[c.uuid]});return this.dispatch($s(c)),n.then(u=>(this.dispatch(nt(u)),u)).catch(()=>{this.dispatch(Gs(c.uuid))}),[c,n]}bulkAdd(e,i){var m;const a=new Date().toISOString(),c=[],n=We(e.payloads,i??e.payloads.length),r=[];for(const o of n){const h=[];for(const p of o){const y=F({...p,values:p.values,created_by:(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.uuid,submitted_at:a});c.push(y),h.push({uuid:y.uuid,asset:p.asset,fields_revision:p.fields_revision,asset_procedure:p.asset_procedure,asset_procedure_step:p.asset_procedure_step,published_at:p.published_at,values:y.values})}r.push({submitted_at:a,values:e.values,field_values:h})}this.dispatch(Kr(c));const u=[];for(const o of r){const h=o.field_values.map(g=>g.asset),p=o.field_values.map(g=>g.fields_revision),y=o.field_values.map(g=>g.asset_procedure),A=o.field_values.map(g=>g.uuid),I=this.enqueueRequest({description:"Bulk add asset procedure step field values",method:l.POST,url:"/asset-procedure-step-field-values/bulk/",payload:o,blockers:[...h,...p,...y],blocks:A});u.push(I)}return Promise.all(u).then(o=>{this.dispatch(Yr(o.flat()))}).catch(()=>{this.dispatch(Zr(c.map(o=>o.uuid)))}),[c,u]}update(e){const{store:i}=this.client,a=i.getState(),c=Ls(e.uuid)(a);if(!c)throw new Error(`Expected AssetProcedureStepFieldValues with uuid ${e.uuid} to exist`);const n={...c,...e};this.dispatch(nt(n));const r=this.enqueueRequest({description:"Update asset procedure step field values",method:l.PATCH,url:`/asset-procedure-step-field-values/${e.uuid}/`,payload:e,blockers:[n.fields_revision,n.asset,n.asset_procedure],blocks:[n.uuid]});return r.then(u=>{this.dispatch(nt(u))}).catch(()=>{this.dispatch(nt(c))}),[n,r]}async delete(e){const{store:i}=this.client,a=i.getState(),c=Ls(e)(a);if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const n=Lr(e)(a);this.dispatch(Gs(e)),this.dispatch(vt(n.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete asset procedure step field values",method:l.DELETE,url:`/asset-procedure-step-field-values/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch($s(c)),this.dispatch(Rt(n)),r}}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get asset procedure step field values",method:l.GET,url:"/asset-procedure-step-field-values/",queryParams:{limit:this.pageSize,paginate:!0,asset_procedure__project:e,latest:!0},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get asset procedure step field values",method:l.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Wr(c)),c}}class db extends O{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.uuid,c=new Date().toISOString(),n=F({...e,created_by:a,submitted_at:c});this.dispatch(td(n));const r=this.enqueueRequest({description:"Create asset procedure step",method:l.POST,url:"/asset-procedure-steps/",payload:v(n),blockers:[n.asset_procedure_type],blocks:[n.uuid]});return r.then(m=>{this.dispatch(Mt(m))}).catch(()=>{this.dispatch(id(n.uuid))}),[n,r]}update(e){const{store:i}=this.client,a=Hs(e.uuid)(i.getState());if(!a)throw new Error(`No asset procedure step with uuid ${e.uuid} found in the store`);const c={...a,...e};this.dispatch(Mt(c));const n=this.enqueueRequest({description:"Update asset procedure step",method:l.PATCH,url:`/asset-procedure-steps/${a.uuid}/`,payload:{name:e.name,description:e.description,priority:e.order,color:e.color},blockers:[a.uuid],blocks:[a.uuid]});return n.then(r=>{this.dispatch(Mt(r))}).catch(()=>{this.dispatch(ed(a))}),[c,n]}async delete(e){const{store:i}=this.client,a=i.getState(),c=Hs(e)(a);if(!c)throw new Error(`No asset procedure step with uuid ${e} found in the store`);const n=rd(e)(a);return this.dispatch(ad([e,...mn(n)])),this.enqueueRequest({description:"Delete asset stage",method:l.DELETE,url:`/asset-procedure-steps/${e}/`,blockers:[e],blocks:[]}).catch(r=>{throw this.dispatch(sd([c,...n])),r})}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset procedure steps",method:l.GET,url:"/asset-procedure-steps/",queryParams:{asset_procedure_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(xr(a)),a}}class ub extends O{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.uuid,c=new Date().toISOString(),n=F({...e,created_by:a,submitted_at:c});this.dispatch(Ks(n));const r=this.enqueueRequest({description:"Create asset",method:l.POST,url:"/assets/",payload:v(n),blockers:[n.asset_type],blocks:[n.uuid]});return r.then(m=>{this.dispatch(dt(m))}).catch(()=>{this.dispatch(Ys(n.uuid))}),[n,r]}update(e){const{store:i}=this.client,a=Qs(e.uuid)(i.getState());if(!a)throw new Error(`No asset with uuid ${e.uuid} found in the store`);const c={...a,...e};this.dispatch(dt(c));const n=this.enqueueRequest({description:"Edit asset",method:l.PATCH,url:`/assets/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return n.then(r=>{this.dispatch(dt(r))}).catch(()=>{this.dispatch(dt(a))}),[c,n]}async delete(e){const{store:i}=this.client,a=i.getState(),c=Qs(e)(a);if(!c)throw new Error(`No asset with uuid ${e} found in the store`);const n=Mn(e)(a),r=il(e)(a);if(this.dispatch(Ys(e)),n.length>0){const u=n.map(({uuid:m})=>m);this.dispatch(ds(u))}if(r.length>0){const u=r.map(({uuid:m})=>m);this.dispatch(Pa(u))}return this.enqueueRequest({description:"Delete asset",method:l.DELETE,url:`/assets/${e}/`,blockers:[e],blocks:[]}).catch(u=>{throw this.dispatch(Ks(c)),this.dispatch(rs(n)),this.dispatch(ba(r)),u})}bulkAdd(e,i,a,c){const n=new Date().toISOString(),r=Ze.v4(),u=We(e,c).map(h=>{const p=h.map(y=>F(y));return{batchId:Ze.v4(),payload:{transaction_id:r,submitted_at:n,asset_type:i,project:a,assets:p}}}),m=[];let o=null;for(const h of u){const{batchId:p,payload:y}=h,A=y.assets.map(w=>w.uuid),I=[i];o&&I.push(o);const g=A;g.push(p);const R=this.enqueueRequest({description:"Batch create assets",method:l.POST,url:"/assets/bulk/",payload:y,blockers:I,blocks:g});o=h.batchId,m.push(R)}return Promise.all(m).then(h=>{const p=h.flat();this.dispatch(Vt(p))}),m}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),c=ld(e)(a);this.dispatch(Zs(e));try{await this.enqueueRequest({description:"Bulk delete assets",method:l.DELETE,url:"/assets/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(n){throw this.dispatch(Vt(c)),n}}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get assets",method:l.GET,url:"/assets/",queryParams:{limit:this.pageSize,paginate:!0,project:e},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get assets",method:l.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(ud(c)),c}}class ob extends O{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.uuid,c=new Date().toISOString(),n=F({...e,created_by:a,submitted_at:c});this.dispatch(ei(n));const r=this.enqueueRequest({description:"Add asset stage completion",method:l.POST,url:"/asset-stage-completions/",payload:v(n),blockers:[e.asset,e.asset_stage],blocks:[n.uuid]});return r.then(m=>{this.dispatch(yd(m))}).catch(()=>{this.dispatch(si(n.uuid))}),[n,r]}delete(e){const{store:i}=this.client,a=Sd(e)(i.getState());if(!a)throw new Error(`Expected asset stage completion with uuid ${e} to exist`);this.dispatch(si(e));const c=this.enqueueRequest({description:"Delete asset stage completion",method:l.DELETE,url:`/asset-stage-completions/${e}/`,blockers:[e],blocks:[]});return c.catch(()=>{this.dispatch(ei(a))}),c}bulkAdd(e){var o;const{store:i}=this.client,a=new Date().toISOString(),c=(o=i.getState().userReducer.currentUser)==null?void 0:o.uuid,n=e.map(h=>F(h)),r=n.map(h=>({...h,created_by:c,submitted_at:a})),u=r.map(({uuid:h})=>h);this.dispatch(ti(r));const m=this.enqueueRequest({description:"Bulk create asset stage completions",method:l.POST,url:"/asset-stage-completions/bulk/",payload:{submitted_at:a,completions:n},blockers:[...e.map(h=>h.asset_procedure),...e.map(h=>h.asset_stage),...e.map(h=>h.asset)],blocks:u});return m.then(h=>{this.dispatch(Ad(h))}).catch(()=>{this.dispatch(ii(u))}),[r,m]}bulkDelete(e){const{store:i}=this.client,a=Td(e)(i.getState());this.dispatch(ii(e));const c=this.enqueueRequest({description:"Deleting asset stage completions",method:l.DELETE,url:"/asset-stage-completions/bulk/",payload:{uuids:e},blockers:e,blocks:[]});return c.catch(()=>{this.dispatch(ti(a))}),c}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get asset stage completions",method:l.GET,url:"/asset-stage-completions/",queryParams:{limit:this.pageSize,paginate:!0,asset_procedure__project:e},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get asset stage completions",method:l.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(pd(c)),c}}class lb extends O{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.uuid,c=new Date().toISOString(),n=F({...e,created_by:a,submitted_at:c});this.dispatch(ni(n));const r=this.enqueueRequest({description:"Create asset",method:l.POST,url:"/asset-stages/",payload:v(n),blockers:[n.asset_procedure_type],blocks:[n.uuid]});return r.then(m=>{this.dispatch(Et(m))}).catch(()=>{this.dispatch(ri(n.uuid))}),[n,r]}update(e){const{store:i}=this.client,a=di(e.uuid)(i.getState());if(!a)throw new Error(`No asset stage with uuid ${e.uuid} found in the store`);const c={...a,...e};this.dispatch(Et(c));const n=this.enqueueRequest({description:"Update asset stage",method:l.PATCH,url:`/asset-stages/${a.uuid}/`,payload:e,blockers:[a.uuid],blocks:[a.uuid]});return n.then(r=>{this.dispatch(Et(r))}).catch(()=>{this.dispatch(bd(a))}),[c,n]}async delete(e){const{store:i}=this.client,a=i.getState(),c=di(e)(a);if(!c)throw new Error(`No asset stage with uuid ${e} found in the store`);return this.dispatch(ri(e)),this.enqueueRequest({description:"Delete asset stage",method:l.DELETE,url:`/asset-stages/${e}/`,blockers:[e],blocks:[]}).catch(n=>{throw this.dispatch(ni(c)),n})}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset stages",method:l.GET,url:"/asset-stages/",queryParams:{asset_procedure_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(gd(a)),a}}class hb extends Ne{constructor(){super(...arguments);S(this,"name","Asset Type Attachment");S(this,"url","/asset-type-attachments");S(this,"initializeAttachments",oi);S(this,"addAttachments",li);S(this,"updateAttachments",Rd);S(this,"removeAttachments",hi);S(this,"removeAttachment",vd);S(this,"setAttachment",Od);S(this,"selectAttachment",Vd)}getId(i){return i.uuid}buildModel(i){return F({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,asset_type:i.modelUuid})}buildPayload(i,a){return{uuid:i.uuid,file_name:i.file_name,file_sha1:i.file_sha1,file_extension:a.extension,asset_type:i.asset_type}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.assetTypeUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const c=await this.enqueueRequest({immediate:!0,description:"Get asset type attachments",method:l.GET,url:`${this.url}/`,queryParams:{asset_type__organization:i},blocks:[],blockers:[]},a);return this.dispatch(oi(c)),c}}class mb extends E{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.uuid,c={},n=[],r=[];for(const o of e){const{fieldsRevisionUuid:h,fieldIdentifier:p,file:y}=o,A=await this.getFilePayload(y);A.sha1 in c||(c[A.sha1]=A);const I=F({file:URL.createObjectURL(y),file_type:y.type,file_name:y.name,file_sha1:A.sha1,created_by:a,fields_revision:h,submitted_at:i,field_identifier:p});n.push(I);const g={uuid:I.uuid,file_name:y.name,field_identifier:p,file_extension:A.extension,file_sha1:A.sha1,fields_revision:h};r.push(g)}this.dispatch(Ud(n));const u=this.enqueueRequest({description:"Add asset type fields attachments",method:l.POST,url:"/asset-type-fields-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(c)},blockers:n.map(o=>o.fields_revision),blocks:n.map(o=>o.uuid)});return u.then(o=>{this.processPresignedUrls(o.presigned_urls),this.dispatch(Cd(o.attachments))}).catch(()=>{this.dispatch(Dd(n.map(o=>o.uuid)))}),[n,u.then(({attachments:o})=>o)]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset type fields attachments",method:l.GET,url:"/asset-type-fields-attachments/",queryParams:{fields_revision__asset_type__organization:e},blockers:[e],blocks:[]},i);return this.dispatch(zd(a)),a}}class pb extends O{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.uuid,c=new Date().toISOString(),n=F({...e,created_by:a,submitted_at:c});this.dispatch(Nd(n));const r=this.enqueueRequest({description:"Add Asset Type Fields",method:l.POST,url:"/asset-type-fields/",payload:v(n),blockers:[n.asset_type],blocks:[n.uuid]});return r.then(m=>{this.dispatch(Hd(m))}).catch(m=>{throw this.dispatch(Wd(n.uuid)),m}),[n,r]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get Asset Type Fields",method:l.GET,url:"/asset-type-fields/",queryParams:{asset_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Ld(a)),a}}class yb extends E{async bulkAdd(e,i){var o;const a=new Date().toISOString(),c=(o=this.client.store.getState().userReducer.currentUser)==null?void 0:o.uuid,n=We(e,i??e.length),r=[],u=[];for(const h of n){const p={},y=[];for(const A of h){const{fieldValuesUuid:I,fieldIdentifier:g,file:R}=A,w=await this.getFilePayload(R);w.sha1 in p||(p[w.sha1]=w);const q=F({file:URL.createObjectURL(R),file_type:R.type,file_name:R.name,file_sha1:w.sha1,created_by:c,field_values:I,submitted_at:a,field_identifier:g});r.push(q);const Ge={uuid:q.uuid,file_name:R.name,file_sha1:w.sha1,file_extension:w.extension,field_identifier:g,field_values:I};y.push(Ge)}u.push({submitted_at:a,attachments:y,files:Object.values(p)})}this.dispatch(zt(r));const m=u.map(h=>this.enqueueRequest({description:"Add asset type field values attachments",method:l.POST,url:"/asset-type-field-values-attachments/bulk/",payload:h,blockers:h.attachments.map(p=>p.field_values),blocks:h.attachments.map(p=>p.uuid)}));return Promise.all(m).then(h=>{for(const y of h)this.processPresignedUrls(y.presigned_urls);const p=h.flatMap(y=>y.attachments);this.dispatch(Xd(p))}).catch(h=>{throw this.dispatch(Ut(r.map(p=>p.uuid))),h}),[r,m.map(h=>h.then(({attachments:p})=>p))]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),c=xd(e)(a);this.dispatch(Ut(e));try{await this.enqueueRequest({description:"Delete asset type field values attachments",method:l.DELETE,url:"/asset-type-field-values-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(n){throw this.dispatch(zt(c)),n}}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get asset type field values attachments",method:l.GET,url:"/asset-type-field-values-attachments/",queryParams:{limit:$e,paginate:!0,field_values__asset__project:e,latest:!0},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get asset type field values attachments",method:l.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Jd(c)),c}}class Ab extends O{add(e){var r;const{store:i}=this.client,a=i.getState(),c=F({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.uuid,submitted_at:new Date().toISOString()}),n=this.enqueueRequest({description:"Add asset type field values",method:l.POST,url:"/asset-type-field-values/",payload:v(c),blockers:[e.asset,e.fields_revision],blocks:[c.uuid]});return this.dispatch(Si(c)),n.then(u=>(this.dispatch(ut(u)),u)).catch(()=>{this.dispatch(Ti(c.uuid))}),[c,n]}bulkAdd(e,i){var m;const a=new Date().toISOString(),c=[],n=We(e.payloads,i??e.payloads.length),r=[];for(const o of n){const h=[];for(const p of o){const y=F({...p,values:p.values,created_by:(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.uuid,submitted_at:a});c.push(y),h.push({uuid:y.uuid,asset:p.asset,fields_revision:p.fields_revision,published_at:p.published_at,values:y.values})}r.push({submitted_at:a,values:e.values,field_values:h})}this.dispatch(au(c));const u=[];for(const o of r){const h=o.field_values.map(I=>I.asset),p=o.field_values.map(I=>I.fields_revision),y=o.field_values.map(I=>I.uuid),A=this.enqueueRequest({description:"Bulk add asset type field values",method:l.POST,url:"/asset-type-field-values/bulk/",payload:o,blockers:[...h,...p],blocks:y});u.push(A)}return Promise.all(u).then(o=>{this.dispatch(cu(o.flat()))}).catch(()=>{this.dispatch(nu(c.map(o=>o.uuid)))}),[c,u]}update(e){const{store:i}=this.client,a=i.getState(),c=gi(e.uuid)(a);if(!c)throw new Error(`Expected AssetTypeFieldValues with uuid ${e.uuid} to exist`);const n={...c,...e};this.dispatch(ut(n));const r=this.enqueueRequest({description:"Delete asset type field values",method:l.PATCH,url:`/asset-type-field-values/${e.uuid}/`,payload:e,blockers:[n.uuid,n.fields_revision,n.asset],blocks:[n.uuid]});return r.then(u=>{this.dispatch(ut(u))}).catch(()=>{this.dispatch(ut(c))}),[n,r]}async delete(e){const{store:i}=this.client,a=i.getState(),c=gi(e)(a);if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const n=eu(e)(a);this.dispatch(Ti(e)),this.dispatch(Ut(n.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete asset type field values",method:l.DELETE,url:`/asset-type-field-values/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(Si(c)),this.dispatch(zt(n)),r}}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get asset type field values",method:l.GET,url:"/asset-type-field-values/",queryParams:{limit:this.pageSize,paginate:!0,asset__project:e,latest:!0},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get asset type field values",method:l.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(iu(c)),c}}class fb extends O{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.uuid,c=new Date().toISOString(),n=F({...e,created_by:a,submitted_at:c});this.dispatch(Fi(n));const r=this.enqueueRequest({description:"Create asset type identifier",method:l.POST,url:"/asset-type-identifiers/",payload:v(n),blockers:[n.asset_type],blocks:[n.uuid]});return r.then(m=>{this.dispatch(ot(m))}).catch(()=>{this.dispatch(Pi(n.uuid))}),[n,r]}update(e){const{store:i}=this.client,a=_i(e.uuid)(i.getState());if(!a)throw new Error(`Expected asset type identifier with uuid ${e.uuid} to exist`);const c={...a,...e};this.dispatch(ot(c));const n=this.enqueueRequest({description:"Update asset type identifier",method:l.PATCH,url:`/asset-type-identifiers/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return n.then(r=>{this.dispatch(ot(r))}).catch(()=>{this.dispatch(ot(a))}),[c,n]}async delete(e){const{store:i}=this.client,a=i.getState(),c=_i(e)(a);if(!c)throw new Error(`Expected asset type identifier with uuid ${e} to exist`);this.dispatch(Pi(e));try{return await this.enqueueRequest({description:"Delete asset type identifier",method:l.DELETE,url:`/asset-type-identifiers/${e}/`,blockers:[e],blocks:[]})}catch(n){throw this.dispatch(Fi(c)),n}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset type identifiers",method:l.GET,url:"/asset-type-identifiers/",queryParams:{asset_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(ou(a)),a}}class Sb extends O{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.uuid,c=new Date().toISOString(),n=F({...e,created_by:a,submitted_at:c});this.dispatch(Ri(n));const r=this.enqueueRequest({description:"Create asset type identifier value",method:l.POST,url:"/asset-type-identifier-values/",payload:v(n),blockers:[e.asset,e.asset_type_identifier],blocks:[n.uuid]});return r.then(m=>{this.dispatch(lt(m))}).catch(()=>{this.dispatch(vi(n.uuid))}),[n,r]}update(e){const{store:i}=this.client,a=Mi(e.uuid)(i.getState());if(!a)throw new Error(`Expected asset type identifier value with uuid ${e.uuid} to exist`);const c={...a,...e};this.dispatch(lt(c));const n=this.enqueueRequest({description:"Update asset type identifier value",method:l.PATCH,url:`/asset-type-identifier-values/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return n.then(r=>{this.dispatch(lt(r))}).catch(()=>{this.dispatch(lt(a))}),[c,n]}async delete(e){const{store:i}=this.client,a=i.getState(),c=Mi(e)(a);if(!c)throw new Error(`Expected asset type identifier value with uuid ${e} to exist`);this.dispatch(vi(e));try{return await this.enqueueRequest({description:"Delete asset type identifier value",method:l.DELETE,url:`/asset-type-identifier-values/${e}/`,blockers:[e],blocks:[]})}catch(n){throw this.dispatch(Ri(c)),n}}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get asset type identifier values",method:l.GET,url:"/asset-type-identifier-values/",queryParams:{limit:this.pageSize,paginate:!0,asset__project:e},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get asset type identifier values",method:l.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(yu(c)),c}}class Tb extends O{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.uuid,c=new Date().toISOString(),n=F({...e,created_by:a,submitted_at:c});this.dispatch(Ei(n));const r=this.enqueueRequest({description:"Create asset type",method:l.POST,url:"/asset-types/",payload:v(n),blockers:[],blocks:[n.uuid]});return r.then(m=>{this.dispatch(ht(m))}).catch(()=>{this.dispatch(ji(n.uuid))}),[n,r]}update(e){const{store:i}=this.client,a=zi(e.uuid)(i.getState());if(!a)throw new Error(`Expected asset type with uuid ${e.uuid} to exist`);const c={...a,...e};this.dispatch(ht(c));const n=this.enqueueRequest({description:"Update asset type",method:l.PATCH,url:`/asset-types/${e.uuid}/`,payload:e,blockers:[a.uuid],blocks:[a.uuid]});return n.then(r=>{this.dispatch(ht(r))}).catch(()=>{this.dispatch(ht(a))}),[c,n]}async delete(e){const{store:i}=this.client,a=i.getState(),c=zi(e)(a);if(!c)throw new Error(`Expected asset type with uuid ${e} to exist`);const n=Xs(e)(a),r=Ed(e)(a);return this.dispatch(ji(e)),this.dispatch(Zs(n.map(u=>u.uuid))),this.dispatch(hi(r.map(({uuid:u})=>u))),this.enqueueRequest({description:"Delete asset type",method:l.DELETE,url:`/asset-types/${e}/`,blockers:[e],blocks:[]}).catch(u=>{throw this.dispatch(Ei(c)),this.dispatch(Vt(n)),this.dispatch(li(r)),u})}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset types",method:l.GET,url:"/asset-types/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(Tu(a)),a}}class Ib extends O{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.uuid,c=new Date().toISOString(),n=F({...e,created_by:a,submitted_at:c});this.dispatch(Ci(n));const r=this.enqueueRequest({description:"Create Category",method:l.POST,url:"/categories/",payload:v(n),blockers:[e.project],blocks:[n.uuid]});return[n,r]}update(e){const i=this.client.store.getState(),a=ki(e.uuid)(i);if(!a)throw new Error(`Expected an existing category with uuid ${e.uuid}`);const c={...a,...e};this.dispatch(Ru(c));const n=this.enqueueRequest({description:"Edit Category",method:l.PATCH,url:`/categories/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return[c,n]}remove(e){const{store:i}=this.client,a=ki(e)(i.getState());if(!a)throw new Error(`No category with uuid ${e} found in the store`);this.dispatch(vu(e));const c=this.enqueueRequest({description:"Delete Category",method:l.DELETE,url:`/categories/${a.uuid}/`,blockers:[a.uuid],blocks:[]});return c.catch(()=>{this.dispatch(Ci(a))}),c}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get categories",method:l.GET,url:"/categories/",queryParams:{project__organization:e},blocks:[],blockers:[]},i);return this.dispatch(Ou(a)),a}}class gb extends Ne{constructor(){super(...arguments);S(this,"name","Document Attachment");S(this,"url","/document-attachments");S(this,"initializeAttachments",$i);S(this,"addAttachments",Eu);S(this,"updateAttachments",qu);S(this,"removeAttachments",Uu);S(this,"removeAttachment",zu);S(this,"setAttachment",ju);S(this,"selectAttachment",ku)}getId(i){return i.uuid}buildModel(i){return F({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,document:i.modelUuid})}buildPayload(i,a){return{uuid:i.uuid,file_name:i.file_name,file_sha1:i.file_sha1,file_extension:a.extension,document:i.document}}async bulkAdd(i){var p;const{store:a}=this.client,c=(p=a.getState().userReducer.currentUser)==null?void 0:p.uuid,n=new Date().toISOString(),r=[],u=[],m={},o={};for(const y of i){const{documentUuid:A,file:I}=y,g=await this.getFilePayload(I);g.sha1 in m||(m[g.sha1]=g,o[g.sha1]=[]);const R=this.buildModel({file:I,file_sha1:g.sha1,submitted_at:n,created_by:c,modelUuid:A});r.push(R),u.push(this.buildPayload(R,g)),o[g.sha1].push(R.uuid)}this.dispatch(this.addAttachments(r));const h=this.enqueueRequest({description:"Attach files to document",method:l.POST,url:"/document-attachments/bulk/",payload:{submitted_at:n,attachments:u,files:Object.values(m)},blocks:r.map(y=>y.uuid),blockers:r.map(y=>y.file_sha1)});return h.then(({attachments:y,presigned_urls:A})=>{this.dispatch(this.updateAttachments(y));const I=this.processPresignedUrls(A);for(const[g,R]of Object.entries(I))R.then(()=>{const w=o[g];for(const q of w)this.makeReadable(q)})}).catch(()=>{this.dispatch(this.removeAttachments(r.map(y=>y.uuid)))}),[r,h.then(({attachments:y})=>y)]}async delete(i){return this._delete(i)}makeReadable(i){this.enqueueRequest({description:"Add attachment to AI assistant",method:l.PATCH,url:`/document-attachments/${i}/`,payload:{readable_to_assistant:!0},blockers:["index-document-attachment",i],blocks:["index-document-attachment"]})}async refreshStore(i,a){const c=await this.enqueueRequest({immediate:!0,description:"Get document attachments",method:l.GET,url:"/document-attachments/",queryParams:{document__project__organization:i},blocks:[],blockers:[]},a),n=await this.enqueueRequest({immediate:!0,description:"Get document attachments",method:l.GET,url:"/document-attachments/",queryParams:{document__organization:i},blocks:[],blockers:[]},a),r=[...c,...n];return this.dispatch($i(r)),r}}class bb extends O{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.uuid,c=new Date().toISOString(),n=F({...e,created_by:a,submitted_at:c});this.dispatch(Lu([n]));const r=this.enqueueRequest({description:"Create Document",method:l.POST,url:"/documents/",payload:v(n),queryParams:{parent_document:n.parent_document??void 0},blockers:n.parent_document?[n.parent_document]:[],blocks:[n.uuid]});return r.catch(()=>{this.dispatch(Li([n.uuid]))}),[n,r]}update(e){const{store:i}=this.client,a=i.getState().documentsReducer.documents[e.uuid];if(!a)throw new Error(`attempting to update a document with uuid ${e.uuid} that does not exist in store.documents`);const c={...a,...e};this.dispatch(Xe([c]));const n=this.enqueueRequest({description:"Update Document",method:l.PATCH,url:`/documents/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return n.catch(()=>{Xe([a])}),[c,n]}delete(e){const{store:i}=this.client,a=Dt(i.getState()),c=Nu(e)(i.getState());if(!c)throw new Error(`attempting to delete a document with uuid ${e} that does not exist in store.documents`);const n=c.parent_document?a[c.parent_document]:void 0;this.dispatch(Li([e]));const r=this.enqueueRequest({description:"Delete Document",method:l.DELETE,url:`/documents/${e}/`,blockers:[e],blocks:[]});return r.then(u=>{this.dispatch(Xe(u))}).catch(()=>{this.dispatch(Xe([c])),n&&this.dispatch(Xe([n]))}),r}async refreshStore(e,i){const a=this.enqueueRequest({immediate:!0,description:"Get project documents",method:l.GET,url:"/documents/",queryParams:{project__organization:e},blockers:[],blocks:[]},i),c=this.enqueueRequest({immediate:!0,description:"Get organization documents",method:l.GET,url:"/documents/",queryParams:{organization:e},blockers:[],blocks:[]},i),n=[...await a,...await c];return this.dispatch(Gu(n)),n}}class Fb extends O{async getVerificationCode(e){return this.enqueueRequest({description:"Get verification code",method:l.GET,url:`/verification/email-verification/${e}/`,isAuthNeeded:!1,blockers:[],blocks:[]})}validateVerificationCode(e,i=void 0){return this.enqueueRequest({description:"Validate verification code",method:l.POST,url:`/verification/email-verification/${e}/`,isAuthNeeded:!1,payload:i,blockers:[],blocks:[]})}}const Zt={},Kc=new Set;let Jt=0,Yc=0,Zc=0;const Pb=20;class _b extends O{constructor(){super(...arguments);S(this,"host");S(this,"_dbPromise",kp.openDB("fileCache",1,{upgrade(i){i.createObjectStore("files")}}))}async renewUploadUrl(i){const a=await this.fetchCache(i);if(!a)throw new Error(`File with sha1 ${i} not found in cache`);const c=await ss(a,i),n=await this.enqueueRequest({description:"Get S3 URL",method:l.GET,url:"/authentication/files/presigned-upload-url/",queryParams:{sha1:await Je(a),file_type:a.type,extension:a.name.split(".").pop(),size:a.size.toString()},blockers:[],blocks:[`s3-${c}`]});return"url"in n&&this.dispatch(Yu({sha1:i,...n})),n}async addCache(i,a){if(Kc.has(a))return;if(!i.type){const r=i.name.split("."),u=r[r.length-1];i=new File([i],i.name,{type:u})}if(!i.name||!i.size||!i.type)throw new Error("Cannot add files to cache that do not have a name, size and type.");const c=await this._dbPromise;!!await c.get("files",a)?(console.error("File already cached (this is unexpected at this point):",i.name,a),Jt++):(await c.put("files",i,a),Yc++),Kc.add(a),Zc++,Zc%Pb===0&&console.debug(`File cache summary: ${Jt} hits and ${Yc} misses, ${Jt/(Jt+Yc)*100}% hit rate over ${Zc} calls to addCache.`)}async removeCache(i){await(await this._dbPromise).delete("files",i),Kc.delete(i)}async fetchCache(i){return(await this._dbPromise).get("files",i)}async getOrRenewUploadUrl(i){const a=this.client.store.getState();return Zu(i)(a)??await this.renewUploadUrl(i)}async uploadFileToS3(i){const a=await this.fetchCache(i);if(!a)throw new Error(`File with sha1 ${i} not found in cache`);const c=await ss(a,i),n={file_name:a.name,file_sha1:i,file:c},r=await this.getOrRenewUploadUrl(i);if("warning"in r){if(r.warning==="already_uploaded")return[n,Promise.resolve(void 0)];throw new Error(r.warning)}const u=r.url,m=this.enqueueRequest({url:u,description:"Upload file",method:l.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:i,blockers:[`s3-${c}`],blocks:[i],s3url:r});return[n,m]}async fetchFileFromUrl(i,a,c){const n=i.split("?")[0]??i,r=await this.fetchCache(a);if(r){if(!r.name)throw new Error("Cached file unexpectedly has no name.");return r}if(i.startsWith("blob:")){const h=await un(i),p=new File([h],c??a,{type:h.type});return await this.addCache(p,a),p}let u=Zt[n],m=!0;u?m=!1:(u=new Promise(h=>{this.enqueueRequest({description:"Download file",method:l.GET,url:i,isExternalUrl:!0,isResponseBlob:!0,isAuthNeeded:!1,blockers:[a],blocks:[a]}).then(p=>{const y=new File([p],c??a,{type:p.type});h(y)})}),Zt[n]=u);let o;try{o=await u}catch(h){throw m&&h instanceof U&&delete Zt[n],h}if(m){const h=await Je(o);if(h!==a){const A=`The hash of the file returned from the server (${h}) does not match the
9
9
  expected hash (${a}). This can happen if you're using a local development server and the
10
10
  isExternalUrl flag in the request details is set to true, because instead of requesting the local
11
11
  REST API, you will be requesting localhost:80 (where this app runs), resulting in a transformed blob
12
12
  (with an uuid attached) being returned. Alternatively, you may be running with
13
13
  import.meta.env.PROD, which will result in some file requests being treated as
14
- external URLs and therefore not prepended with VITE_API_URL.`;throw new Error(A)}const p=o.type.split("/")[1];if(!p)throw new Error("File has no extension");const y=n??h+"."+p;if(o=oc(o,y),!o.name)throw new Error("Failed to set file's name");await this.addCache(o,h),Jt[c]=new Promise(A=>{A(o)})}return o}}class Nb extends O{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(Zi(c));const r=this.enqueueRequest({description:"Create form identifier",method:l.POST,url:"/form-identifiers/",payload:v(c),blockers:[c.form],blocks:[c.uuid]});return r.then(m=>{this.dispatch(pt(m))}).catch(()=>{this.dispatch(Ji(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=Xi(e.uuid)(i.getState());if(!a)throw new Error(`Expected form identifier with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(pt(n));const c=this.enqueueRequest({description:"Update form identifier",method:l.PATCH,url:`/form-identifiers/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(pt(r))}).catch(()=>{this.dispatch(pt(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Xi(e)(a);if(!n)throw new Error(`Expected form identifier with uuid ${e} to exist`);this.dispatch(Ji(e));try{return await this.enqueueRequest({description:"Delete form identifier",method:l.DELETE,url:`/form-identifiers/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(Zi(n)),c}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get form identifiers",method:l.GET,url:"/form-identifiers/",queryParams:{form__organization:e},blockers:[],blocks:[]},i);return this.dispatch(ro(a)),a}}class Hb extends O{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(xi(c));const r=this.enqueueRequest({description:"Create form identifier value",method:l.POST,url:"/form-identifier-values/",payload:v(c),blockers:[e.form_submission,e.form_identifier],blocks:[c.uuid]});return r.then(m=>{this.dispatch(yt(m))}).catch(()=>{this.dispatch(ea(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=sa(e.uuid)(i.getState());if(!a)throw new Error(`Expected form identifier value with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(yt(n));const c=this.enqueueRequest({description:"Update form identifier value",method:l.PATCH,url:`/form-identifier-values/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(yt(r))}).catch(()=>{this.dispatch(yt(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=sa(e)(a);if(!n)throw new Error(`Expected form identifier value with uuid ${e} to exist`);this.dispatch(ea(e));try{return await this.enqueueRequest({description:"Delete form identifier value",method:l.DELETE,url:`/form-identifier-values/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(xi(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get form identifier values",method:l.GET,url:"/form-identifier-values/",queryParams:{limit:this.pageSize,paginate:!0,form_submission__form_revision__form__organization:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get form identifier values",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(mo(n)),n}}class Wb extends V{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const o of e){const{revisionUuid:h,fieldIdentifier:p,file:y}=o,A=await this.getFilePayload(y);A.sha1 in n||(n[A.sha1]=A);const g=F({file:URL.createObjectURL(y),file_type:y.type,file_name:y.name,file_sha1:A.sha1,created_by:a,form_revision:h,submitted_at:i,field_identifier:p});c.push(g);const b={uuid:g.uuid,file_name:y.name,field_identifier:p,file_extension:A.extension,file_sha1:A.sha1,form_revision:h};r.push(b)}this.dispatch(So(c));const u=this.enqueueRequest({description:"Attach files to form revision",method:l.POST,url:"/form-revision-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(o=>o.form_revision),blocks:c.map(o=>o.uuid)});return u.then(o=>{this.processPresignedUrls(o.presigned_urls),this.dispatch(To(o.attachments))}).catch(()=>{this.dispatch(go(c.map(o=>o.uuid)))}),[c,u.then(({attachments:o})=>o)]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch organization form revision attachments",method:l.GET,url:"/form-revision-attachments/",queryParams:{form_revision__form__organization:e},blockers:[e],blocks:[]},i);return this.dispatch(fo(a)),a}}class Kb extends V{add(e){var u;const{store:i}=this.client,n=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,c=F({...e,created_by:n,submitted_at:new Date().toISOString()});this.dispatch(na(c));const r=this.enqueueRequest({description:"Create form revision",method:l.POST,url:"/form-revisions/",payload:v(c),blockers:[e.form],blocks:[c.uuid]});return r.then(m=>{this.dispatch(Oo(m))}).catch(()=>{this.dispatch(ca(c.uuid))}),[c,r]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get organization form revisions",method:l.GET,url:"/form-revisions/",queryParams:{form__organization:e},blockers:[e],blocks:[]},i);return this.dispatch(Po(a)),a}}class Yb extends V{add(e,i){var o;const{store:a}=this.client,n=new Date().toISOString(),c=(o=a.getState().userReducer.currentUser)==null?void 0:o.id,r=F({...e,submitted_at:n,created_by:c}),u=F({...i,form:r.uuid,submitted_at:n,created_by:c});this.dispatch(oa(r)),this.dispatch(na(u));const m=this.enqueueRequest({description:"Create form",method:l.POST,url:"/forms/",payload:{...v(r),initial_revision:{uuid:u.uuid,submitted_at:u.submitted_at,title:u.title,description:u.description,fields:u.fields}},blockers:[],blocks:[r.uuid,u.uuid]});return m.catch(h=>{throw this.dispatch(la(r.uuid)),this.dispatch(ca(u.uuid)),h}),[r,u,m]}async delete(e){const{store:i}=this.client,a=i.getState(),n=zo(e)(a);if(!n)throw new Error("Expected form to exist");const c=Yo(e)(a);c.length>0&&this.dispatch(Ko(c.map(({uuid:u})=>u)));const r=vo(e)(a);r.length>0&&this.dispatch(Ro(r.map(({uuid:u})=>u))),this.dispatch(la(e));try{return await this.enqueueRequest({description:"Delete form",method:l.DELETE,url:`/forms/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(oa(n)),r.length>0&&this.dispatch(_o(r)),c.length>0&&this.dispatch(Ho(c)),u}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch organization forms",method:l.GET,url:"/forms/",queryParams:{organization:e},blockers:[e],blocks:[]},i);return this.dispatch(Eo(a)),a}}class Zb extends V{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const o of e){const{submissionUuid:h,fieldIdentifier:p,file:y}=o,A=await this.getFilePayload(y);A.sha1 in n||(n[A.sha1]=A);const g=F({file:URL.createObjectURL(y),file_type:y.type,file_name:y.name,file_sha1:A.sha1,created_by:a,form_submission:h,submitted_at:i,field_identifier:p});c.push(g);const b={uuid:g.uuid,file_name:y.name,file_sha1:A.sha1,file_extension:A.extension,field_identifier:p,form_submission:h};r.push(b)}this.dispatch(Bt(c));const u=this.enqueueRequest({description:"Attach files to form submission",method:l.POST,url:"/form-submission-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(o=>o.form_submission),blocks:c.map(o=>o.uuid)});return u.then(o=>{this.processPresignedUrls(o.presigned_urls),this.dispatch(Co(o.attachments))}).catch(o=>{throw this.dispatch($t(c.map(h=>h.uuid))),o}),[c,u.then(({attachments:o})=>o)]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),n=Bo(e)(a);this.dispatch($t(e));try{await this.enqueueRequest({description:"Delete form submission attachments",method:l.DELETE,url:"/form-submission-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(Bt(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get form submission attachments",method:l.GET,url:"/form-submission-attachments/",queryParams:{limit:Ge,paginate:!0,form_submission__form_revision__form__organization:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get form submission attachments",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Uo(n)),n}}class Jb extends V{add(e){var r;const{store:i}=this.client,a=i.getState(),n=F({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),c=this.enqueueRequest({description:"Add form submission",method:l.POST,url:"/form-submissions/",payload:v(n),blockers:[e.form_revision],blocks:[n.uuid]});return this.dispatch(ya(n)),c.then(u=>(this.dispatch(Gt(u)),u)).catch(()=>{this.dispatch(Aa(n.uuid))}),[n,c]}update(e){const{store:i}=this.client,a=i.getState(),n=Sa(e.uuid)(a);if(!n)throw new Error(`Expected submission with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(Wo(c));const r=this.enqueueRequest({description:"Delete user form submissions",method:l.PATCH,url:`/form-submissions/${c.uuid}/`,payload:e,blockers:[c.uuid],blocks:[c.uuid]});return r.then(u=>{this.dispatch(Gt(u))}).catch(()=>{this.dispatch(Gt(n))}),[c,r]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Sa(e)(a);if(!n)throw new Error(`Expected submission with uuid ${e} to exist`);const c=$o(e)(a);this.dispatch(Aa(e)),this.dispatch($t(c.map(r=>r.uuid)));try{return await this.enqueueRequest({description:"Delete user form submissions",method:l.DELETE,url:`/form-submissions/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(ya(n)),this.dispatch(Bt(c)),r}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Fetch form submissions",method:l.GET,url:"/form-submissions/",queryParams:{limit:this.pageSize,paginate:!0,form_revision__form_organization:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Fetch form submissions",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(No(n)),n}}class Xb extends V{async add(e){var p;const{store:i}=this.client,{file:a,...n}=e,c=new Date().toISOString(),r=(p=i.getState().userReducer.currentUser)==null?void 0:p.id,u=n.project,m=await this.getFilePayload(a),o=F({...n,file_name:a.name,file_sha1:m.sha1,file_type:a.type,file:URL.createObjectURL(a),submitted_at:c,created_by:r});this.dispatch(xo(o));const h=this.enqueueRequest({description:"Add geo image",method:l.POST,url:"/geo-images/",payload:{uuid:o.uuid,submitted_at:c,title:o.title,description:o.description,geo_marker:o.geo_marker,canvas_marker:o.canvas_marker,sha1:o.file_sha1,project:o.project,file_name:o.file_name,direction:o.direction,original_date:o.original_date,file:m},blocks:[u],blockers:[u]});return h.then(y=>{this.processPresignedUrls(y.presigned_urls),this.dispatch(At(y.geo_image))}).catch(()=>{this.dispatch(ga(o.uuid))}),[o,h.then(y=>y.geo_image)]}async bulkAdd(e,i){var p;const{store:a}=this.client,n=new Date().toISOString(),c=(p=a.getState().userReducer.currentUser)==null?void 0:p.id,r=[],u=[],m=[],o={};for(const y of e){const{file:A,...g}=y,b=await this.getFilePayload(A);b.sha1 in o||(o[b.sha1]=b);const R=F({...g,file_name:A.name,file_sha1:b.sha1,file_type:A.type,file:URL.createObjectURL(A),submitted_at:n,created_by:c,project:i});r.push(R),u.push(R.uuid),m.push({uuid:R.uuid,sha1:R.file_sha1,file_name:R.file_name,title:R.title,description:R.description,geo_marker:R.geo_marker,canvas_marker:R.canvas_marker,direction:R.direction,original_date:R.original_date})}this.dispatch(el(r));const h=this.enqueueRequest({description:"Bulk add geo images",method:l.POST,url:"/geo-images/bulk/",payload:{submitted_at:n,project:i,geo_images:m,files:Object.values(o)},blocks:[i],blockers:u});return h.then(y=>{this.processPresignedUrls(y.presigned_urls),this.dispatch(Qo(y.geo_images))}).catch(()=>{this.dispatch(sl(u))}),[r,h.then(y=>y.geo_images)]}update(e){const{store:i}=this.client,a=i.getState(),n=Ia(e.uuid)(a);if(!n)throw new Error(`Map image with uuid ${e.uuid} does not exist in the store`);const c={...n,...e};this.dispatch(tl(c));const r=this.enqueueRequest({description:"Update geo image",method:l.PATCH,url:`/geo-images/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return r.then(u=>{this.dispatch(At(u))}).catch(()=>{this.dispatch(At(n))}),[c,r]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Ia(e)(a);if(!n)throw new Error(`Map image with uuid ${e} does not exist in the store`);this.dispatch(ga(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(At(n))}),c}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get geo images",method:l.GET,url:"/geo-images/",queryParams:{project:e},blocks:[e],blockers:[]},i);return this.dispatch(Xo(a)),a}}class Qb extends O{add(e){var u;const{store:i}=this.client,a=new Date().toISOString(),n=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,c=F({...e,submitted_at:a,created_by:n});this.dispatch(Fa(c));const r=this.enqueueRequest({description:"Add issue association",method:l.POST,url:"/issue-associations/",payload:v(c),blockers:[e.associated_issue,...e.issue?[e.issue]:[],...e.asset?[e.asset]:[]],blocks:[c.uuid]});return r.then(m=>{this.dispatch(dl(m))}).catch(()=>{this.dispatch(_a(c.uuid))}),[c,r]}async delete(e){const{store:i}=this.client,a=ul(e)(i.getState());if(!a)throw new Error(`Issue association with uuid ${e} not found in store.`);this.dispatch(_a(e));const n=this.enqueueRequest({description:"Delete issue association",method:l.DELETE,url:`/issue-associations/${e}/`,blockers:[e],blocks:[]});return n.catch(()=>{this.dispatch(Fa(a))}),n}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Fetch issue associations",method:l.GET,url:"/issue-associations/",queryParams:{limit:this.pageSize,paginate:!0,associated_issue__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Fetch issue associations",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(rl(n)),n}}class xb extends He{constructor(){super(...arguments);S(this,"name","Issue Attachment");S(this,"url","/issue-attachments");S(this,"initializeAttachments",va);S(this,"addAttachments",wa);S(this,"updateAttachments",Al);S(this,"removeAttachments",Ma);S(this,"removeAttachment",fl);S(this,"setAttachment",yl);S(this,"selectAttachment",Il)}getId(i){return i.uuid}buildModel(i){return F({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,issue:i.modelUuid})}buildPayload(i,a){return{uuid:i.uuid,file_name:i.file_name,file_sha1:i.file_sha1,file_extension:a.extension,issue:i.issue}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.issueUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const c=(await this.performPagination({immediate:!0,description:"Get issue attachments",method:l.GET,url:`${this.url}/`,queryParams:{limit:Ge,paginate:!0,issue__project:i},blocks:[],blockers:[]},r=>({immediate:!0,description:"Get issue attachments",method:l.GET,url:r,blockers:[],blocks:[]}),a)).flat();return this.dispatch(va(c)),c}}class eF extends He{constructor(){super(...arguments);S(this,"name","Issue Comment Attachment");S(this,"url","/issue-comment-attachments");S(this,"initializeAttachments",Va);S(this,"addAttachments",Pl);S(this,"updateAttachments",Ol);S(this,"removeAttachments",vl);S(this,"removeAttachment",Rl);S(this,"setAttachment",_l);S(this,"selectAttachment",El)}getId(i){return i.uuid}buildModel(i){return F({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,issue_comment:i.modelUuid})}buildPayload(i,a){return{uuid:i.uuid,file_name:i.file_name,file_sha1:i.file_sha1,file_extension:a.extension,issue_comment:i.issue_comment}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.issueCommentUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const c=(await this.performPagination({immediate:!0,description:"Get issue comment attachments",method:l.GET,url:`${this.url}/`,queryParams:{limit:Ge,paginate:!0,issue_comment__issue__project:i},blocks:[],blockers:[]},r=>({immediate:!0,description:"Get issue comment attachments",method:l.GET,url:r,blockers:[],blocks:[]}),a)).flat();return this.dispatch(Va(c)),c}}class tF extends O{add(e){var c;const{store:i}=this.client,a=F({...e,author:(c=i.getState().userReducer.currentUser)==null?void 0:c.id,submitted_at:new Date().toISOString()});this.dispatch(qa(a));const n=this.enqueueRequest({description:"Add issue comment",method:l.POST,url:"/issue-comments/",payload:v(a),blockers:[e.issue],blocks:[a.uuid]});return n.catch(()=>{this.dispatch(Da(a.uuid))}),[a,n]}update(e){const{store:i}=this.client,a=Ua(e.uuid)(i.getState());if(!a)throw new Error(`Comment with uuid ${e.uuid} not found in store`);const n={...a,...e};this.dispatch(za(n));const c=this.enqueueRequest({description:"Edit issue comment",method:l.PATCH,url:`/issue-comments/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.catch(()=>{this.dispatch(za(a))}),[n,c]}remove(e){const{store:i}=this.client,a=Ua(e)(i.getState());if(!a)throw new Error(`Comment with uuid ${e} not found in store`);this.dispatch(Da(e));const n=this.enqueueRequest({description:"Delete comment",method:l.DELETE,url:`/issue-comments/${e}/`,blockers:[e],blocks:[]});return n.catch(()=>{this.dispatch(qa(a))}),n}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get comments",method:l.GET,url:"/issue-comments/",queryParams:{issue__project:e},blockers:[],blocks:[]},i);return this.dispatch(ql(a)),a}}class sF extends O{add(e){var m;const{store:i}=this.client,a=i.getState(),n=new Date().toISOString(),c=(m=a.userReducer.currentUser)==null?void 0:m.id,r=F({...e,submitted_at:n,created_by:c});this.dispatch(ka(r));const u=this.enqueueRequest({description:"Create issue",method:l.POST,url:"/issues/",payload:v(r),blockers:[r.project,r.issue_type,...r.category?[r.category]:[]],blocks:[r.uuid]});return u.then(o=>{this.dispatch(Lt(o))}).catch(o=>{throw this.dispatch(Ba(r.uuid)),o}),[r,u]}update(e){var m;const i=this.client.store.getState(),a=La(e.uuid)(i);if(!a)throw new Error(`Attempting to update an issue with uuid ${e.uuid} that doesn't exist in the store`);const n={...a,...e};this.dispatch(Lt(n));const c={};for(const o of[E.TITLE,E.DESCRIPTION,E.STATUS,E.CATEGORY,E.PRIORITY,E.ASSIGNED_TO,E.DUE_DATE])if(o in e&&e[o]!==a[o])switch(o){case E.PRIORITY:case E.STATUS:{const h=e[o];c[o]=h!==void 0?Number(h):null;break}case E.DUE_DATE:case E.DESCRIPTION:case E.TITLE:c[o]=e[o]??null;break;case E.CATEGORY:{let h=null;const p=e[o];if(p&&(h=i.categoryReducer.instances[p]??null,!h))throw new Error(`Trying to update issue category to ${p} which does not exist in store`);c[o]=h?{name:h.name,color:h.color,uuid:h.uuid}:null;break}case E.ASSIGNED_TO:{let h=null;const p=e[o];if(p&&(h=i.userReducer.instances[p]??null,!h))throw new Error(`Trying to update issue assigned_to to ${p} which does not exist in store`);c[o]=h?{full_name:h.username,id:h.id}:null;break}}const r=F({created_by:(m=i.userReducer.currentUser)==null?void 0:m.id,submitted_at:new Date().toISOString(),issue:a.uuid,changes:c});this.dispatch(Gh(r));const u=this.enqueueRequest({description:"Edit issue",method:l.PATCH,url:`/issues/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.catch(()=>{this.dispatch(Lt(a)),this.dispatch(Nh(r.uuid))}),[n,u]}async remove(e){const{store:i}=this.client,a=i.getState(),n=La(e)(a);if(!n)throw new Error(`No issue with uuid ${e} found in the store`);const c=gl(e)(a),r=Yh(e)(a),u={};for(const o of ol(e)(a))u[o.uuid]=o;for(const o of ll(e)(a))u[o.uuid]=o;const m=Object.values(u);this.dispatch(Ba(e)),c.length>0&&this.dispatch(Ma(c.map(({uuid:o})=>o))),r.length>0&&this.dispatch(Hh(r.map(({uuid:o})=>o))),m.length>0&&this.dispatch(Oa(m.map(({uuid:o})=>o)));try{return await this.enqueueRequest({description:"Delete issue",method:l.DELETE,url:`/issues/${e}/`,blockers:[e],blocks:[]})}catch(o){throw this.dispatch(ka(n)),this.dispatch(wa(c)),this.dispatch(Lh(r)),this.dispatch(Pa(m)),o}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get issues",method:l.GET,url:"/issues/",queryParams:{limit:this.pageSize,paginate:!0,project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get issues",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Cl(n)),n}}class iF extends He{constructor(){super(...arguments);S(this,"name","Issue Type Attachment");S(this,"url","/issue-type-attachments");S(this,"initializeAttachments",Ha);S(this,"addAttachments",Nl);S(this,"updateAttachments",Wl);S(this,"removeAttachments",Yl);S(this,"removeAttachment",Kl);S(this,"setAttachment",Hl);S(this,"selectAttachment",Xl)}getId(i){return i.uuid}buildModel(i){return F({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,issue_type:i.modelUuid})}buildPayload(i,a){return{uuid:i.uuid,file_name:i.file_name,file_sha1:i.file_sha1,file_extension:a.extension,issue_type:i.issue_type}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.issueTypeUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const n=await this.enqueueRequest({immediate:!0,description:"Get issue type attachments",method:l.GET,url:`${this.url}/`,queryParams:{issue_type__organization:i},blocks:[],blockers:[]},a);return this.dispatch(Ha(n)),n}}class aF extends V{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const o of e){const{fieldsRevisionUuid:h,fieldIdentifier:p,file:y}=o,A=await this.getFilePayload(y);A.sha1 in n||(n[A.sha1]=A);const g=F({file:URL.createObjectURL(y),file_type:y.type,file_name:y.name,file_sha1:A.sha1,created_by:a,fields_revision:h,submitted_at:i,field_identifier:p});c.push(g);const b={uuid:g.uuid,file_name:y.name,file_extension:A.extension,field_identifier:p,file_sha1:A.sha1,fields_revision:h};r.push(b)}this.dispatch(th(c));const u=this.enqueueRequest({description:"Add issue type fields attachments",method:l.POST,url:"/issue-type-fields-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(o=>o.fields_revision),blocks:c.map(o=>o.uuid)});return u.then(o=>{this.processPresignedUrls(o.presigned_urls),this.dispatch(sh(o.attachments))}).catch(()=>{this.dispatch(ih(c.map(o=>o.uuid)))}),[c,u.then(({attachments:o})=>o)]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"get issue type fields attachments",method:l.GET,url:"/issue-type-fields-attachments/",queryParams:{fields_revision__issue_type__organization:e},blockers:[e],blocks:[]},i);return this.dispatch(eh(a)),a}}class nF extends O{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(mh(c));const r=this.enqueueRequest({description:"Add Issue Type Fields",method:l.POST,url:"/issue-type-fields/",payload:v(c),blockers:[c.issue_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(ph(m))}).catch(m=>{throw this.dispatch(yh(c.uuid)),m}),[c,r]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get Issue Type Fields",method:l.GET,url:"/issue-type-fields/",queryParams:{issue_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(hh(a)),a}}class cF extends V{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const o of e){const{fieldValuesUuid:h,fieldIdentifier:p,file:y}=o,A=await this.getFilePayload(y);A.sha1 in n||(n[A.sha1]=A);const g=F({file:URL.createObjectURL(y),file_type:y.type,file_name:y.name,file_sha1:A.sha1,created_by:a,field_values:h,submitted_at:i,field_identifier:p});c.push(g);const b={uuid:g.uuid,file_name:y.name,file_sha1:A.sha1,file_extension:A.extension,field_identifier:p,field_values:h};r.push(b)}this.dispatch(Ht(c));const u=this.enqueueRequest({description:"Add issue type field values attachments",method:l.POST,url:"/issue-type-field-values-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(o=>o.field_values),blocks:c.map(o=>o.uuid)});return u.then(({presigned_urls:o,attachments:h})=>{this.processPresignedUrls(o),this.dispatch(gh(h))}).catch(o=>{throw this.dispatch(Wt(c.map(h=>h.uuid))),o}),[c,u.then(({attachments:o})=>o)]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),n=bh(e)(a);this.dispatch(Wt(e));try{await this.enqueueRequest({description:"Delete issue type field values attachments",method:l.DELETE,url:"/issue-type-field-values-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(Ht(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get issue type field values attachments",method:l.GET,url:"/issue-type-field-values-attachments/",queryParams:{limit:Ge,paginate:!0,field_values__issue__project:e,latest:!0},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get issue type field values attachments",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Th(n)),n}}class rF extends O{add(e){var r;const{store:i}=this.client,a=i.getState(),n=F({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),c=this.enqueueRequest({description:"Add issue type field values",method:l.POST,url:"/issue-type-field-values/",payload:v(n),blockers:[e.issue,e.fields_revision],blocks:[n.uuid]});return this.dispatch(Ya(n)),c.then(u=>(this.dispatch(St(u)),u)).catch(()=>{this.dispatch(Za(n.uuid))}),[n,c]}update(e){const{store:i}=this.client,a=i.getState(),n=Xa(e.uuid)(a);if(!n)throw new Error(`Expected IssueTypeFieldValues with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(St(c));const r=this.enqueueRequest({description:"Update issue type field values",method:l.PATCH,url:`/issue-type-field-values/${e.uuid}/`,payload:e,blockers:[c.uuid,c.fields_revision,c.issue],blocks:[c.uuid]});return r.then(u=>{this.dispatch(St(u))}).catch(()=>{this.dispatch(St(n))}),[c,r]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Xa(e)(a);if(!n)throw new Error(`Expected submission with uuid ${e} to exist`);const c=Fh(e)(a);this.dispatch(Za(e)),this.dispatch(Wt(c.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete issue type field values",method:l.DELETE,url:`/issue-type-field-values/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(Ya(n)),this.dispatch(Ht(c)),r}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get issue type field values",method:l.GET,url:"/issue-type-field-values/",queryParams:{limit:this.pageSize,paginate:!0,issue__project:e,latest:!0},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get issue type field values",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(dh(n)),n}}class dF extends O{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(sn(c));const r=this.enqueueRequest({description:"Create issue type identifier",method:l.POST,url:"/issue-type-identifiers/",payload:v(c),blockers:[c.issue_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(Tt(m))}).catch(()=>{this.dispatch(an(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=nn(e.uuid)(i.getState());if(!a)throw new Error(`Expected issue type identifier with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(Tt(n));const c=this.enqueueRequest({description:"Update issue type identifier",method:l.PATCH,url:`/issue-type-identifiers/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(Tt(r))}).catch(()=>{this.dispatch(Tt(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=nn(e)(a);if(!n)throw new Error(`Expected issue type identifier with uuid ${e} to exist`);this.dispatch(an(e));try{return await this.enqueueRequest({description:"Delete issue type identifier",method:l.DELETE,url:`/issue-type-identifiers/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(sn(n)),c}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get issue type identifiers",method:l.GET,url:"/issue-type-identifiers/",queryParams:{issue_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Oh(a)),a}}class uF extends O{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(rn(c));const r=this.enqueueRequest({description:"Create issue type identifier value",method:l.POST,url:"/issue-type-identifier-values/",payload:v(c),blockers:[e.issue,e.issue_type_identifier],blocks:[c.uuid]});return r.then(m=>{this.dispatch(gt(m))}).catch(()=>{this.dispatch(dn(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=on(e.uuid)(i.getState());if(!a)throw new Error(`Expected issue type identifier value with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(gt(n));const c=this.enqueueRequest({description:"Update issue type identifier value",method:l.PATCH,url:`/issue-type-identifier-values/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(gt(r))}).catch(()=>{this.dispatch(gt(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=on(e)(a);if(!n)throw new Error(`Expected issue type identifier value with uuid ${e} to exist`);this.dispatch(dn(e));try{return await this.enqueueRequest({description:"Delete issue type identifier value",method:l.DELETE,url:`/issue-type-identifier-values/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(rn(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get issue type identifier values",method:l.GET,url:"/issue-type-identifier-values/",queryParams:{limit:this.pageSize,paginate:!0,issue__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get issue type identifier values",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Eh(n)),n}}class oF extends O{add(e){var r;const{store:i}=this.client,a=i.getState(),n=F({...e,submitted_at:new Date().toISOString(),created_by:(r=a.userReducer.currentUser)==null?void 0:r.id});this.dispatch(Dh(n));const c=this.enqueueRequest({method:l.POST,url:"/issue-types/",payload:v(n),blockers:[],blocks:[n.uuid]});return c.then(u=>{this.dispatch(It(u))}).catch(()=>{this.dispatch(hn(n.uuid))}),[n,c]}update(e){const{store:i}=this.client,a=i.getState(),n=pn(e.uuid)(a);if(!n)throw new Error(`IssueType with uuid ${e.uuid} does not exist in the store.`);const c={...n,...e};this.dispatch(Uh(c));const r=this.enqueueRequest({method:l.PATCH,url:`/issue-types/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(It(u))}).catch(()=>{this.dispatch(It(n))}),[c,r]}delete(e){const{store:i}=this.client,a=i.getState(),n=pn(e)(a);if(!n)throw new Error(`IssueType with uuid ${e} does not exist in the store.`);const c=$l(e)(a);this.dispatch(hn(e)),this.dispatch(Bl(c.map(u=>u.uuid)));const r=this.enqueueRequest({method:l.DELETE,url:`/issue-types/${e}/`,blockers:[e],blocks:[]});return r.catch(()=>{this.dispatch(It(n)),this.dispatch(kl(c))}),r}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,method:l.GET,url:"/issue-types/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(zh(a)),a}}class lF extends O{async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get issue updates",method:l.GET,url:"/issue-updates/",queryParams:{limit:this.pageSize,paginate:!0,issue__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get issue updates",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch($h(n)),n}}const hF=1800;function mF(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 pF extends lb{constructor(){super(...arguments);S(this,"_getRenewedTokens",async i=>{const a=this.enqueueRequest({description:"Get renewed tokens",method:l.POST,url:this.refreshTokensUrl,payload:{refresh:i},isAuthNeeded:!1,blockers:[],blocks:[],checkAuth:!1,immediate:!0});let n;try{n=await a}catch(c){console.error("Could not renew tokens; clearing auth",c),this.clearAuth();return}if(!n.access)throw new Error("Missing access token");return{accessToken:n.access,refreshToken:n.refresh??this.getRefreshToken()}})}clearAuth(){console.debug(this.constructor.name,"clearing auth;"),this.dispatch(_u(!1)),this.clearTokens(),this.dispatch(I()),this.dispatch(I())}async renewTokens(){const i=this.getRefreshToken();if(!i)throw new Error("No refresh token found");console.debug(this.constructor.name,"renewing tokens");try{const a=await this._getRenewedTokens(i);if(!a)return;console.log("Got renewed tokens"),this.setTokens(a)}catch(a){throw console.error("Could not renew tokens; clearing auth",a),this.clearAuth(),a}}tokenIsExpiringSoon(){const i=this.getAccessToken();if(!i)return!1;const a=Date.now()/1e3;let n;try{n=Zp(i).exp??a}catch{n=a}return n-a<hF}getAuthHeader(){return`Bearer ${this.getAccessToken()}`}async prepareAuth(){if(this.tokenIsExpiringSoon()){console.debug(this.constructor.name,"preparing auth");try{await this.renewTokens()}catch(i){return i instanceof D&&this.clearAuth(),i instanceof Error?Promise.reject(i):Promise.reject(new Error((i??xe).toString()))}}}async handleUnauthorized(i,a){const n=this.client.store.getState();if(i.url.endsWith("/token/refresh/"))throw n.authReducer.isLoggedIn&&console.warn("No signed-in user to sign out."),this.clearAuth(),new D({message:"You have been signed out due to inactivity.",response:a,discard:!0});if(n.authReducer.isLoggedIn)await this.renewTokens();else throw console.debug("Forbidden; user is not logged in."),new D({message:"Incorrect username or password.",response:a,discard:!0})}async initAuth(i){const a=Je.v4();return console.debug(this.constructor.name,"Initiating auth"),this.enqueueRequest({uuid:a,description:"Get token pair",method:l.POST,url:this.initTokensUrl,payload:i,isAuthNeeded:!1,checkAuth:!1,immediate:!0,blockers:[],blocks:[]}).then(n=>{this.setTokens(mF(n))})}}class yF extends O{update(e){const{store:i}=this.client,a=gn(e.uuid)(i.getState()),n={...a,...e};this.dispatch(Yt(n));const c=this.enqueueRequest({description:"Edit organization access",method:l.PATCH,url:`/organization-accesses/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(Yt(r))}).catch(r=>{throw this.dispatch(Yt(a)),r}),[n,c]}async remove(e){const{store:i}=this.client,a=i.getState(),n=gn(e)(a),c=sm(n.user)(a);this.dispatch(cm(n.uuid)),this.dispatch(xh(n.user));try{await this.enqueueRequest({description:"Remove organization access",method:l.DELETE,url:`/organization-accesses/${n.uuid}/`,blockers:[n.uuid],blocks:[]})}catch(r){throw this.dispatch(nm(n)),this.dispatch(Qh(c)),r}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get organization accesses",method:l.GET,url:"/organization-accesses/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(am(a)),a}}class AF extends O{async add(e){const i=await this.enqueueRequest({description:"Create organization",method:l.POST,url:"/organizations/",payload:e,blockers:[],blocks:[]});return this.dispatch(lm(i)),i}async update(e){const i=await this.enqueueRequest({description:"Edit organization",method:l.PATCH,url:`/organizations/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return this.dispatch(hm(i)),i}async invite(e,i){return this.enqueueRequest({description:"Invite user to organization",method:l.POST,url:`/organizations/${e}/invite/${i}/`,blockers:[],blocks:[]})}async refreshStore(e){const i=await this.enqueueRequest({immediate:!0,description:"Fetch organizations",method:l.GET,url:"/organizations/",blockers:[],blocks:[]},e);return this.dispatch(om(i)),i}}class fF extends O{add(e){var c;const{store:i}=this.client,a=F({...e,created_by:(c=i.getState().userReducer.currentUser)==null?void 0:c.id});this.dispatch(Pn(a));const n=this.enqueueRequest({description:"Add project access",method:l.POST,url:"/project-accesses/",payload:v(a),blockers:[a.organization_access,a.project],blocks:[a.uuid]});return n.then(r=>{this.dispatch(bt(r))}).catch(r=>{throw this.dispatch(On(a.uuid)),r}),[a,n]}bulkAdd(e){var r;const{store:i}=this.client,a=(r=i.getState().userReducer.currentUser)==null?void 0:r.id,n=e.map(u=>F({...u,created_by:a}));this.dispatch(_n(n));const c=this.enqueueRequest({description:"Add project accesses",method:l.POST,url:"/project-accesses/bulk/",payload:{project_accesses:n.map(u=>v(u))},blockers:n.flatMap(u=>[u.project,u.organization_access]),blocks:n.map(u=>u.uuid)});return c.then(u=>{this.dispatch(Fm(u))}).catch(u=>{throw this.dispatch(Rn(n.map(m=>m.uuid))),u}),[n,c]}update(e){const{store:i}=this.client,a=wn(e.uuid)(i.getState()),n={...a,...e};this.dispatch(bt(n));const c=this.enqueueRequest({description:"Edit project access",method:l.PATCH,url:`/project-accesses/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[]});return c.then(r=>{this.dispatch(bt(r))}).catch(r=>{throw this.dispatch(bt(a)),r}),[n,c]}async remove(e){const{store:i}=this.client,a=wn(e)(i.getState());this.dispatch(On(e));try{await this.enqueueRequest({description:"Delete project access",method:l.DELETE,url:`/project-accesses/${e}/`,blockers:[e],blocks:[]})}catch(n){throw this.dispatch(Pn(a)),n}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get project accesses",method:l.GET,url:"/project-accesses/",queryParams:{project__organization:e},blockers:[],blocks:[]},i);return this.dispatch(bm(a)),a}}class SF extends He{constructor(){super(...arguments);S(this,"name","Project Attachment");S(this,"url","/project-attachments");S(this,"initializeAttachments",En);S(this,"addAttachments",Rm);S(this,"updateAttachments",Mm);S(this,"removeAttachments",Vn);S(this,"removeAttachment",Em);S(this,"setAttachment",vm);S(this,"selectAttachment",qm)}getId(i){return i.uuid}buildModel(i){return F({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,project:i.modelUuid})}buildPayload(i,a){return{uuid:i.uuid,file_name:i.file_name,file_sha1:i.file_sha1,file_extension:a.extension,project:i.project}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.projectUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const n=await this.enqueueRequest({immediate:!0,description:"Get project attachments",method:l.GET,url:`${this.url}/`,queryParams:{project__organization:i},blockers:[],blocks:[]},a);return this.dispatch(En(n)),n}}class TF extends O{async saveExisting(e){if(!e.uuid)throw new Error("You can only use this method to save existing project files. The one provided has no uuid.");const i={...e};delete i.file;const a=this.enqueueRequest({method:l.PATCH,url:`/project-files/${e.uuid}/`,payload:i,blockers:[e.uuid],blocks:[e.uuid]});return a.then(n=>{this.dispatch(qn(n))}),a}saveActive(){const{store:e}=this.client,i=e.getState(),a=i.projectFileReducer.activeProjectFileId;if(!a)throw new Error("No active project file");const n=i.projectFileReducer.instances[a];if(!n)throw new Error("No active project file");if(!n.bounds&&!n.canvas_bounds)throw new Error("Project file must either have bounds or canvas_bounds set");let c;if(typeof n.file=="string"&&!n.file.startsWith("blob:")){const m={...n};delete m.file,c={method:l.PATCH,url:`/project-files/${a}/`,payload:m,blockers:[a],blocks:[a]}}else c=new Promise((m,o)=>{this.client.files.uploadFileToS3(n.file_sha1).then(([h])=>{m({method:l.POST,url:"/project-files/",payload:{...n,...h},blockers:[a],blocks:[a]})}).catch(o)});const u=Promise.resolve(c).then(m=>this.enqueueRequest(m));return u.then(m=>{this.dispatch(qn(m))}),this.dispatch(Nm),this.dispatch(Lm(null)),this.dispatch(Gm(!1)),[n,u]}delete(e){return this.dispatch(Bm(e)),this.enqueueRequest({method:l.DELETE,url:`/project-files/${e}`,blockers:[e],blocks:[]})}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get project files",method:l.GET,url:"/project-files/",queryParams:{limit:this.pageSize,paginate:!0,project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get project files",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Cm(n)),n}}class gF extends O{async add(e){const i=await this.enqueueRequest({description:"Create project",method:l.POST,url:"/projects/",payload:v(e),blockers:[],blocks:[]});return this.dispatch(Dn(i)),i}async update(e){if(!e.bounds&&!e.canvas_bounds)throw new Error("Project must either have bounds or canvas_bounds set");return this.dispatch(Jm(e)),await this.enqueueRequest({description:"Update project",method:l.PATCH,url:`/projects/${e.uuid}/`,payload:{name:e.name,bounds:e.bounds},blockers:[e.uuid],blocks:[e.uuid]})}async delete(e){const{store:i}=this.client,a=i.getState(),n=xm(e)(a);if(!n)throw new Error("Expected project to exist");const c=Wm(a).filter(m=>m.project===e);this.dispatch($m(c.map(({uuid:m})=>m)));const r=zm(n.uuid)(a);this.dispatch(Vn(r.map(({uuid:m})=>m)));const u=_m(e)(a);this.dispatch(Rn(u.map(({uuid:m})=>m))),this.dispatch(Un(n.uuid));try{await this.enqueueRequest({description:"Delete project",method:l.DELETE,url:`/projects/${e}/`,blockers:[e],blocks:[]}),this.dispatch(Un(n.uuid))}catch(m){throw this.dispatch(Dn(n)),this.dispatch(_n(Object.values(u))),this.dispatch(km(c)),this.dispatch(wm(r)),m}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch projects",method:l.GET,url:"/projects/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(Zm(a)),a}}class IF extends O{add(e){var c;const{store:i}=this.client,a=F({...e,created_by:(c=i.getState().userReducer.currentUser)==null?void 0:c.id});this.dispatch(ip(a));const n=this.enqueueRequest({description:"Create team membership",method:l.POST,url:"/team-memberships/",payload:v(a),blockers:[e.team],blocks:[a.uuid]});return n.then(r=>{this.dispatch($n(r))}).catch(()=>{this.dispatch(Gn(a.uuid))}),[a,n]}bulkAdd(e){var r;const{store:i}=this.client,a=(r=i.getState().userReducer.currentUser)==null?void 0:r.id,n=e.map(u=>F({...u,created_by:a}));this.dispatch(ap(n));const c=this.enqueueRequest({description:"Create team memberships",method:l.POST,url:"/team-memberships/bulk/",payload:{team_memberships:n.map(u=>v(u))},blockers:n.map(u=>u.team),blocks:n.map(u=>u.uuid)});return c.then(u=>{this.dispatch(np(u))}).catch(()=>{this.dispatch(cp(n.map(u=>u.uuid)))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=up(e)(a);if(!n)throw new Error(`Expected team membership with uuid ${e} to exist`);this.dispatch(Gn(e));try{return await this.enqueueRequest({description:"Delete team membership",method:l.DELETE,url:`/team-memberships/${e}/`,blockers:[e],blocks:[e]})}catch(c){throw this.dispatch($n(n)),c}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch team memberships",method:l.GET,url:"/team-memberships/",queryParams:{team__organization:e},blockers:[],blocks:[]},i);return this.dispatch(sp(a)),a}}class bF extends O{add(e){var c;const{store:i}=this.client,a=F({...e,submitted_at:new Date().toISOString(),created_by:(c=i.getState().userReducer.currentUser)==null?void 0:c.id});this.dispatch(hp(a));const n=this.enqueueRequest({description:"Create team",method:l.POST,url:"/teams/",payload:v(a),blockers:[],blocks:[a.uuid]});return n.then(r=>{this.dispatch(Ft(r))}).catch(()=>{this.dispatch(Hn(a.uuid))}),[a,n]}update(e){const{store:i}=this.client,a=Kn(e.uuid)(i.getState());if(!a)throw new Error(`Expected team with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(mp(n));const c=this.enqueueRequest({description:"Update team",method:l.PATCH,url:`/teams/${e.uuid}/`,payload:v(e),blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(Ft(r))}).catch(()=>{this.dispatch(Ft(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Kn(e)(a);if(!n)throw new Error(`Expected team with uuid ${e} to exist`);this.dispatch(Hn(e));try{return await this.enqueueRequest({description:"Delete team",method:l.DELETE,url:`/teams/${e}/`,blockers:[e],blocks:[e]})}catch(c){throw this.dispatch(Ft(n)),c}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch teams",method:l.GET,url:"/teams/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(lp(a)),a}}class FF extends O{async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch organization users",method:l.GET,url:`/organizations/${e}/users/`,blockers:[],blocks:[]},i);return this.dispatch(Xh(a)),a}}class PF{constructor(e){S(this,"store");this.store=e}async enqueueRequest(e,i,a,n){return this._enqueueRequest(e,i,a,n).then(c=>{if(c instanceof D)throw c;return c})}_enqueueRequest(e,i,a,n){const c=new dc,r={...e,BASE_URL:i,serviceName:a};if(e.immediate){const u={...r,uuid:e.uuid??Je.v4()},m={payload:u,meta:{offline:{effect:{timestamp:new Date().toISOString(),request:u,BASE_URL:i,serviceName:a}}}};Zn(m,this,n).then(o=>{c.resolve(o.body)}).catch(o=>{o instanceof Error?c.reject(o):c.reject(new Error((o??xe).toString()))})}else{const u=this.store.dispatch(fm(r)),m=h=>{if(h)c.resolve(h.body);else{const p=new D({message:"Could not get a response from the server.",response:h,discard:!0});c.reject(p)}},o=h=>{h instanceof D?h.options.discard=!0:(console.error("Received an unexpected error while processing a request:",h,`
15
- Converting error to APIError and discarding.`),h=new D({message:"An error occurred while processing the request.",innerError:h,discard:!0})),c.reject(h)};u.then(m,o)}return c}}class et{constructor(){S(this,"graph");S(this,"requestAttemptCounter");this.graph=new Jp.DepGraph,this.requestAttemptCounter={}}static _fromOutbox(e){const i=new et;for(let a=0;a<e.length;a++){const n=e[a];if(!n){console.error("Outbox item was undefined");continue}i.sneakRequest(n);for(let c=0;c<a;c++){const r=e[c];if(!r){console.error("Previous outbox item was undefined");continue}r.payload.uuid!==n.payload.uuid&&r.payload.blocks.some(u=>n.payload.blockers.includes(u))&&et._addDependency(n.payload.uuid,r.payload.uuid,i.graph)}}return i}_addDependency(e,i){et._addDependency(e,i,this.graph)}static _addDependency(e,i,a){if(e===i)throw new Error(`Tried to add dependency from node to itself: ${e}`);if(!a.hasNode(e))throw new Error(`Tried to add dependency from non-existent node: ${e} (to node: ${i})`);if(!a.hasNode(i))throw new Error(`Tried to add dependency to non-existent node: ${i} (from node: ${e})`);a.addDependency(e,i)}addRequest(e){if(this.graph.addNode(e.payload.uuid,e),!(e.payload.blockers.length===0||this.graph.size()===1))for(const i of this.graph.overallOrder()){if(i===e.payload.uuid)continue;const a=this.graph.getNodeData(i);e.payload.blockers.some(n=>a.payload.blocks.includes(n))&&this._addDependency(e.payload.uuid,i)}}insertRequest(e){this.graph.addNode(e.payload.uuid,e);for(const i of this.graph.overallOrder()){if(i===e.payload.uuid)continue;this.graph.getNodeData(i).payload.blockers.some(n=>e.payload.blocks.includes(n))&&this._addDependency(i,e.payload.uuid)}}sneakRequest(e){this.graph.addNode(e.payload.uuid,e)}_getNextNode(){const e=this.graph.overallOrder(!0);let i=1/0,a;for(const n of e){const c=this.requestAttemptCounter[n]||0;c<i&&(i=c,a=n)}return a}peek(){const e=this._getNextNode();if(e)return this.graph.getNodeData(e)}remove(e){this.graph.removeNode(e),delete this.requestAttemptCounter[e]}pop(){const e=this.peek();return e&&this.graph.removeNode(e.payload.uuid),e}getQueue(){const e=this.graph.overallOrder().map(a=>this.graph.getNodeData(a)),i=this._getNextNode();if(i){const a=this.graph.getNodeData(i),n=e.findIndex(c=>c.payload.uuid===a.payload.uuid);n!==-1&&(e.splice(n,1),e.unshift(a))}return e}getReady(){let e=this.graph.overallOrder(!0).map(i=>this.graph.getNodeData(i));return e=e.sort((i,a)=>i.meta.offline.effect.timestamp.localeCompare(a.meta.offline.effect.timestamp)),e=e.sort((i,a)=>{const n=this.requestAttemptCounter[i.payload.uuid]||0,c=this.requestAttemptCounter[a.payload.uuid]||0;return n-c}),e}registerRetry(e){this.requestAttemptCounter[e]=(this.requestAttemptCounter[e]||0)+1}}let Ep;function Vp(t){Ep=t}function tt(){return Ep}let jp;function qp(t){jp=t}function zp(){return jp}let xn=null;function Ye(){const t=tt();if(!t)return console.warn("Client store not set; cannot get outbox coordinator yet."),null;if(xn)return xn;const e=t.getState().offline.outbox,i=et._fromOutbox(e);return xn=i,i}const _F=(t,e)=>{const i=new e(t);return qp(i),Vp(t),i};class OF{constructor(e){S(this,"_all");S(this,"_previous");this._all=[e],this._previous=e,this.then=this.then.bind(this),this.compile=this.compile.bind(this)}then(e){return this._previous&&(this._previous.next=e),this._all.push(e),this._previous=e,{then:this.then,compile:this.compile}}compile(){return this._all}}class ec{constructor(){S(this,"next");this.next=null}then(e){return new OF(this).then(e)}async run(e){if(this.next)return this.next.run(e);{if(console.debug("Middleware finished. Performing request:",e),!tt())throw new Error("Client store not set");const a=zp();if(!a)throw new Error("Client SDK not set");return Zn(e,a)}}}class Dp extends ec{async run(e){return super.run(e)}}class Up extends ec{async run(e){return super.run(e)}}const Cp=new Dp().then(new Up).compile();function kp(t){var e;return(e=Cp[0])==null?void 0:e.run(t)}var Bp=(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))(Bp||{});s.ALL_MIDDLEWARE=Cp,s.APIError=D,s.ATTACHMENT_MODEL_DEFAULT_PAGE_SIZE=Ge,s.AgentService=hb,s.AssetAttachmentService=mb,s.AssetProcedureService=Tb,s.AssetProcedureStepFieldValuesAttachmentService=Fb,s.AssetProcedureStepFieldValuesService=Pb,s.AssetProcedureStepFieldsAttachmentService=Ib,s.AssetProcedureStepFieldsService=bb,s.AssetProcedureStepService=_b,s.AssetProcedureTypeAttachmentService=pb,s.AssetProcedureTypeFieldValuesAttachmentService=fb,s.AssetProcedureTypeFieldValuesService=Sb,s.AssetProcedureTypeFieldsAttachmentService=yb,s.AssetProcedureTypeFieldsService=Ab,s.AssetProcedureTypeService=gb,s.AssetService=Ob,s.AssetStageCompletionService=Rb,s.AssetStageService=vb,s.AssetTypeAttachmentService=wb,s.AssetTypeFieldValuesAttachmentService=Vb,s.AssetTypeFieldValuesService=jb,s.AssetTypeFieldsAttachmentService=Mb,s.AssetTypeFieldsService=Eb,s.AssetTypeIdentifierService=qb,s.AssetTypeIdentifierValueService=zb,s.AssetTypeService=Db,s.AttachmentModel=cc,s.BaseApiService=O,s.BaseSDK=PF,s.COMMON_AUTO_FIELDS=mc,s.CategoryService=Ub,s.DEFAULT_ISSUE_PRIORITY=Qp,s.DEFAULT_ISSUE_STATUS=Xp,s.DEFAULT_PAGE_SIZE=Tp,s.DeferredPromise=dc,s.DocumentAttachmentService=Cb,s.DocumentService=kb,s.EMPTY_ARRAY=ic,s.EMPTY_OBJECT=ac,s.EmailDomainsService=Bb,s.EmailVerificationService=$b,s.FileService=Lb,s.FormIdentifierService=Nb,s.FormIdentifierValueService=Hb,s.FormRevisionAttachmentService=Wb,s.FormRevisionService=Kb,s.FormService=Yb,s.FormSubmissionAttachmentService=Zb,s.FormSubmissionService=Jb,s.GeoImageService=Xb,s.HttpMethod=l,s.IssueAssociationService=Qb,s.IssueAttachmentService=xb,s.IssueCommentAttachmentService=eF,s.IssueCommentService=tF,s.IssuePriority=Qt,s.IssueService=sF,s.IssueStatus=xt,s.IssueTypeAttachmentService=iF,s.IssueTypeFieldValuesAttachmentService=cF,s.IssueTypeFieldValuesService=rF,s.IssueTypeFieldsAttachmentService=aF,s.IssueTypeFieldsService=nF,s.IssueTypeIdentifierService=dF,s.IssueTypeIdentifierValueService=uF,s.IssueTypeService=oF,s.IssueUpdateChange=E,s.IssueUpdateService=lF,s.JWTService=pF,s.OUTBOX_RETRY_DELAY=rc,s.OfflineAnalyticsMiddleware=Dp,s.OfflineMiddleware=ec,s.OrganizationAccessLevel=nc,s.OrganizationAccessService=yF,s.OrganizationService=AF,s.OutboxCoordinator=et,s.ProjectAccessService=fF,s.ProjectAttachmentService=SF,s.ProjectFileService=TF,s.ProjectService=gF,s.RESET_ORGANIZATION_STATE=_,s.RESET_PROJECT_STATE=M,s.RESET_STATE=I,s.RateLimitingMiddleware=Up,s.SelectorBuilder=XI,s.TeamMembershipService=IF,s.TeamService=bF,s.UNKNOWN_ERROR_MESSAGE=xe,s.UserService=FF,s.VERSION_REDUCER_KEY=st,s.VerificationCodeType=Bp,s._setLatestRetryTime=Tm,s.addAsset=Ys,s.addAssetAttachment=Ry,s.addAssetAttachments=ds,s.addAssetProcedure=Fs,s.addAssetProcedureStep=id,s.addAssetProcedureStepFieldValues=Gs,s.addAssetProcedureStepFieldValuesAttachment=jA,s.addAssetProcedureStepFieldValuesAttachments=vt,s.addAssetProcedureStepFieldValuesMany=Zr,s.addAssetProcedureStepFields=zs,s.addAssetProcedureStepFieldsAttachment=fA,s.addAssetProcedureStepFieldsAttachments=Er,s.addAssetProcedureStepFieldsMany=PA,s.addAssetProcedureSteps=ad,s.addAssetProcedureType=ws,s.addAssetProcedureTypeAttachment=My,s.addAssetProcedureTypeAttachments=zc,s.addAssetProcedureTypeFieldValues=Ss,s.addAssetProcedureTypeFieldValuesAttachment=Zy,s.addAssetProcedureTypeFieldValuesAttachments=Ot,s.addAssetProcedureTypeFieldValuesMany=pr,s.addAssetProcedureTypeFields=er,s.addAssetProcedureTypeFieldsAttachment=qy,s.addAssetProcedureTypeFieldsAttachments=Wc,s.addAssetProcedureTypeFieldsMany=$y,s.addAssetProcedureTypes=oA,s.addAssetProcedures=Ir,s.addAssetStage=ri,s.addAssetStageCompletion=ti,s.addAssetStageCompletions=si,s.addAssetStages=af,s.addAssetType=ji,s.addAssetTypeAttachment=of,s.addAssetTypeAttachments=hi,s.addAssetTypeFieldValues=Ti,s.addAssetTypeFieldValuesAttachment=vf,s.addAssetTypeFieldValuesAttachments=Dt,s.addAssetTypeFieldValuesMany=cu,s.addAssetTypeFields=Wd,s.addAssetTypeFieldsAttachment=mf,s.addAssetTypeFieldsAttachments=Cd,s.addAssetTypeFieldsMany=gf,s.addAssetTypeIdentifier=Pi,s.addAssetTypeIdentifierValue=vi,s.addAssetTypeIdentifierValues=Nf,s.addAssetTypeIdentifiers=Cf,s.addAssetTypes=xf,s.addAssets=Vt,s.addCategories=dS,s.addCategory=Ci,s.addConversation=Ic,s.addConversations=gy,s.addDocumentAttachment=yS,s.addDocumentAttachments=qu,s.addDocuments=Hu,s.addEmailDomain=Ju,s.addEmailDomains=bS,s.addForm=oa,s.addFormIdentifier=Zi,s.addFormIdentifierValue=xi,s.addFormIdentifierValues=DS,s.addFormIdentifiers=MS,s.addFormRevision=na,s.addFormRevisionAttachment=LS,s.addFormRevisionAttachments=So,s.addFormRevisions=_o,s.addFormSubmission=ya,s.addFormSubmissionAttachment=rT,s.addFormSubmissionAttachments=Bt,s.addFormSubmissions=Ho,s.addForms=eT,s.addGeoImage=xo,s.addGeoImages=el,s.addIssue=ka,s.addIssueAssociation=Fa,s.addIssueAssociations=Pa,s.addIssueAttachment=IT,s.addIssueAttachments=wa,s.addIssueComment=qa,s.addIssueCommentAttachment=PT,s.addIssueCommentAttachments=Pl,s.addIssueComments=wT,s.addIssueType=Dh,s.addIssueTypeAttachment=kT,s.addIssueTypeAttachments=Nl,s.addIssueTypeFieldValues=Ya,s.addIssueTypeFieldValuesAttachment=lg,s.addIssueTypeFieldValuesAttachments=Ht,s.addIssueTypeFieldValuesMany=JT,s.addIssueTypeFields=mh,s.addIssueTypeFieldsAttachment=LT,s.addIssueTypeFieldsAttachments=th,s.addIssueTypeFieldsMany=sg,s.addIssueTypeIdentifier=sn,s.addIssueTypeIdentifierValue=rn,s.addIssueTypeIdentifierValues=Fg,s.addIssueTypeIdentifiers=fg,s.addIssueTypes=Mg,s.addIssueUpdate=Gh,s.addIssueUpdates=Lh,s.addIssues=kl,s.addOrganization=lm,s.addOrganizationAccess=nm,s.addOrganizationAccesses=Jg,s.addOrganizations=nI,s.addProject=Dn,s.addProjectAccess=Pn,s.addProjectAccesses=_n,s.addProjectAttachment=SI,s.addProjectAttachments=Rm,s.addProjectFile=bI,s.addProjectFiles=km,s.addProjects=wI,s.addTeam=hp,s.addTeamMembership=ip,s.addTeamMemberships=ap,s.addTeams=$I,s.addUser=Qh,s.addUsers=Lg,s.agentsReducer=Pc,s.agentsSlice=as,s.areArraysEqual=ty,s.assetAttachmentReducer=jc,s.assetAttachmentSlice=cs,s.assetProcedureReducer=Fr,s.assetProcedureSlice=bs,s.assetProcedureStepFieldValuesAttachmentReducer=Wr,s.assetProcedureStepFieldValuesAttachmentSlice=ks,s.assetProcedureStepFieldValuesReducer=xr,s.assetProcedureStepFieldValuesSlice=$s,s.assetProcedureStepFieldsAttachmentReducer=Dr,s.assetProcedureStepFieldsAttachmentSlice=js,s.assetProcedureStepFieldsReducer=kr,s.assetProcedureStepFieldsSlice=qs,s.assetProcedureStepReducer=rd,s.assetProcedureStepSlice=Hs,s.assetProcedureTypeAttachmentReducer=Bc,s.assetProcedureTypeAttachmentSlice=os,s.assetProcedureTypeFieldValuesAttachmentReducer=dr,s.assetProcedureTypeFieldValuesAttachmentSlice=ys,s.assetProcedureTypeFieldValuesReducer=fr,s.assetProcedureTypeFieldValuesSlice=fs,s.assetProcedureTypeFieldsAttachmentReducer=Zc,s.assetProcedureTypeFieldsAttachmentSlice=hs,s.assetProcedureTypeFieldsReducer=ir,s.assetProcedureTypeFieldsSlice=ms,s.assetProcedureTypeReducer=Rr,s.assetProcedureTypeSlice=vs,s.assetReducer=pd,s.assetSlice=Ks,s.assetStageCompletionReducer=Td,s.assetStageCompletionSlice=ei,s.assetStageReducer=_d,s.assetStageSlice=ci,s.assetTypeAttachmentReducer=zd,s.assetTypeAttachmentSlice=oi,s.assetTypeFieldValuesAttachmentReducer=iu,s.assetTypeFieldValuesAttachmentSlice=Ai,s.assetTypeFieldValuesReducer=ou,s.assetTypeFieldValuesSlice=Si,s.assetTypeFieldsAttachmentReducer=Ld,s.assetTypeFieldsAttachmentSlice=pi,s.assetTypeFieldsReducer=Jd,s.assetTypeFieldsSlice=yi,s.assetTypeIdentifierReducer=yu,s.assetTypeIdentifierSlice=Fi,s.assetTypeIdentifierValueReducer=Tu,s.assetTypeIdentifierValueSlice=Ri,s.assetTypeReducer=Fu,s.assetTypeSlice=Vi,s.authReducer=Ou,s.authSlice=Ct,s.baseReducer=YI,s.baseReducers=Yn,s.blobToBase64=oy,s.categoryReducer=Vu,s.categorySlice=Ui,s.clearTokens=nS,s.constructUploadedFilePayloads=uy,s.createModelAdapter=P,s.createOfflineAction=ym,s.createPayload=v,s.createSelectionAdapter=xp,s.deleteAsset=Zs,s.deleteAssetAttachment=vc,s.deleteAssetAttachments=us,s.deleteAssetProcedure=Ps,s.deleteAssetProcedureStep=nd,s.deleteAssetProcedureStepFieldValues=Ls,s.deleteAssetProcedureStepFieldValuesAttachment=UA,s.deleteAssetProcedureStepFieldValuesAttachments=wt,s.deleteAssetProcedureStepFieldValuesMany=Xr,s.deleteAssetProcedureStepFields=Ds,s.deleteAssetProcedureStepFieldsAttachment=IA,s.deleteAssetProcedureStepFieldsAttachments=jr,s.deleteAssetProcedureStepFieldsMany=vA,s.deleteAssetProcedureSteps=cd,s.deleteAssetProcedureType=Ms,s.deleteAssetProcedureTypeAttachment=Cc,s.deleteAssetProcedureTypeAttachments=kc,s.deleteAssetProcedureTypeFieldValues=Ts,s.deleteAssetProcedureTypeFieldValuesAttachment=xy,s.deleteAssetProcedureTypeFieldValuesAttachments=Rt,s.deleteAssetProcedureTypeFieldValuesMany=Ar,s.deleteAssetProcedureTypeFields=sr,s.deleteAssetProcedureTypeFieldsAttachment=Cy,s.deleteAssetProcedureTypeFieldsAttachments=Yc,s.deleteAssetProcedureTypeFieldsMany=Hy,s.deleteAssetProcedureTypes=hA,s.deleteAssetProcedures=br,s.deleteAssetStage=di,s.deleteAssetStageCompletion=ii,s.deleteAssetStageCompletions=ai,s.deleteAssetStages=cf,s.deleteAssetType=qi,s.deleteAssetTypeAttachment=Md,s.deleteAssetTypeAttachments=mi,s.deleteAssetTypeFieldValues=gi,s.deleteAssetTypeFieldValuesAttachment=Vf,s.deleteAssetTypeFieldValuesAttachments=Ut,s.deleteAssetTypeFieldValuesMany=du,s.deleteAssetTypeFields=Yd,s.deleteAssetTypeFieldsAttachment=ff,s.deleteAssetTypeFieldsAttachments=Bd,s.deleteAssetTypeFieldsMany=Pf,s.deleteAssetTypeIdentifier=_i,s.deleteAssetTypeIdentifierValue=wi,s.deleteAssetTypeIdentifierValues=Yf,s.deleteAssetTypeIdentifiers=Gf,s.deleteAssetTypes=tS,s.deleteAssets=Js,s.deleteCategories=hS,s.deleteCategory=Mu,s.deleteConversation=Fy,s.deleteConversations=Py,s.deleteDocumentAttachment=Uu,s.deleteDocumentAttachments=Cu,s.deleteEmailDomain=Xu,s.deleteEmailDomains=RS,s.deleteForm=la,s.deleteFormIdentifier=Ji,s.deleteFormIdentifierValue=ea,s.deleteFormIdentifierValues=BS,s.deleteFormIdentifiers=qS,s.deleteFormRevision=ca,s.deleteFormRevisionAttachment=KS,s.deleteFormRevisionAttachments=go,s.deleteFormRevisions=Ro,s.deleteFormSubmission=Aa,s.deleteFormSubmissionAttachment=lT,s.deleteFormSubmissionAttachments=$t,s.deleteFormSubmissions=Ko,s.deleteForms=nT,s.deleteGeoImage=ga,s.deleteGeoImages=sl,s.deleteIssue=Ba,s.deleteIssueAssociation=_a,s.deleteIssueAssociations=Oa,s.deleteIssueAttachment=fl,s.deleteIssueAttachments=Ma,s.deleteIssueComment=Da,s.deleteIssueCommentAttachment=Rl,s.deleteIssueCommentAttachments=vl,s.deleteIssueComments=VT,s.deleteIssueType=jg,s.deleteIssueTypeAttachment=Kl,s.deleteIssueTypeAttachments=Yl,s.deleteIssueTypeFieldValues=Za,s.deleteIssueTypeFieldValuesAttachment=yg,s.deleteIssueTypeFieldValuesAttachments=Wt,s.deleteIssueTypeFieldValuesMany=eg,s.deleteIssueTypeFields=yh,s.deleteIssueTypeFieldsAttachment=KT,s.deleteIssueTypeFieldsAttachments=ih,s.deleteIssueTypeFieldsMany=cg,s.deleteIssueTypeIdentifier=an,s.deleteIssueTypeIdentifierValue=dn,s.deleteIssueTypeIdentifierValues=Rg,s.deleteIssueTypeIdentifiers=Ig,s.deleteIssueTypes=qg,s.deleteIssueUpdate=Nh,s.deleteIssueUpdates=Hh,s.deleteIssues=Bl,s.deleteOrganization=rI,s.deleteOrganizationAccess=cm,s.deleteOrganizationAccesses=eI,s.deleteOrganizations=dI,s.deleteProject=Un,s.deleteProjectAccess=On,s.deleteProjectAccesses=Rn,s.deleteProjectAttachment=Em,s.deleteProjectAttachments=Vn,s.deleteProjectFile=Bm,s.deleteProjectFiles=$m,s.deleteProjects=EI,s.deleteTeam=Hn,s.deleteTeamMembership=Gn,s.deleteTeamMemberships=cp,s.deleteTeams=NI,s.deleteUser=xh,s.deleteUsers=Wg,s.dequeue=Rp,s.discard=wp,s.documentAttachmentReducer=Gu,s.documentAttachmentSlice=$i,s.documentSlice=Li,s.documentsReducer=Ku,s.downloadFile=ly,s.downloadInMemoryFile=dy,s.emailDomainsReducer=eo,s.emailDomainsSlice=Wi,s.emailRegex=Sy,s.enqueue=Op,s.enqueueRequest=fm,s.fallbackToEmptyArray=T,s.fallbackToEmptyObject=_t,s.fileReducer=no,s.fileSlice=Ki,s.fileToBlob=lc,s.formIdentifierReducer=lo,s.formIdentifierSlice=Yi,s.formIdentifierValueReducer=yo,s.formIdentifierValueSlice=Qi,s.formReducer=Vo,s.formRevisionAttachmentReducer=bo,s.formRevisionAttachmentSlice=ia,s.formRevisionReducer=wo,s.formRevisionsSlice=aa,s.formSlice=ua,s.formSubmissionAttachmentReducer=Go,s.formSubmissionAttachmentSlice=ha,s.formSubmissionReducer=Zo,s.formSubmissionSlice=pa,s.geoImageReducer=nl,s.geoImageSlice=Ta,s.getAssetProcedureStepSubTree=Sc,s.getAssetProcedureStepTrees=Ty,s.getClientSDK=zp,s.getClientStore=tt,s.getFileIdentifier=ry,s.getFileS3Key=is,s.getLocalDateString=uc,s.getLocalRelativeDateString=ny,s.getOutboxCoordinator=Ye,s.getRenamedFile=oc,s.hashFile=Xe,s.initSDK=_F,s.initializeAssetAttachments=rs,s.initializeAssetProcedureStepFieldValues=Yr,s.initializeAssetProcedureStepFieldValuesAttachments=$r,s.initializeAssetProcedureStepFields=Cr,s.initializeAssetProcedureStepFieldsAttachments=Mr,s.initializeAssetProcedureSteps=td,s.initializeAssetProcedureTypeAttachments=ls,s.initializeAssetProcedureTypeFieldValues=mr,s.initializeAssetProcedureTypeFieldValuesAttachments=cr,s.initializeAssetProcedureTypeFields=xc,s.initializeAssetProcedureTypeFieldsAttachments=Hc,s.initializeAssetProcedureTypes=Or,s.initializeAssetProcedures=gr,s.initializeAssetStageCompletions=Ad,s.initializeAssetStages=Fd,s.initializeAssetTypeAttachments=li,s.initializeAssetTypeFieldValues=nu,s.initializeAssetTypeFieldValuesAttachments=Qd,s.initializeAssetTypeFields=Hd,s.initializeAssetTypeFieldsAttachments=Ud,s.initializeAssetTypeIdentifierValues=fu,s.initializeAssetTypeIdentifiers=hu,s.initializeAssetTypes=Iu,s.initializeAssets=ld,s.initializeCategories=vu,s.initializeConversations=gc,s.initializeDocumentAttachments=Gi,s.initializeEmailDomains=Zu,s.initializeFormIdentifierValues=mo,s.initializeFormIdentifiers=ro,s.initializeFormRevisionAttachments=fo,s.initializeFormRevisions=Po,s.initializeFormSubmissionAttachments=Uo,s.initializeFormSubmissions=No,s.initializeForms=Eo,s.initializeGeoImages=Xo,s.initializeIssueAssociations=rl,s.initializeIssueAttachments=va,s.initializeIssueCommentAttachments=Va,s.initializeIssueComments=vT,s.initializeIssueTypeAttachments=Ha,s.initializeIssueTypeFieldValues=dh,s.initializeIssueTypeFieldValuesAttachments=Th,s.initializeIssueTypeFields=hh,s.initializeIssueTypeFieldsAttachments=eh,s.initializeIssueTypeIdentifierValues=Eh,s.initializeIssueTypeIdentifiers=Oh,s.initializeIssueTypes=zh,s.initializeIssueUpdates=$h,s.initializeIssues=Cl,s.initializeOrganizationAccesses=am,s.initializeOrganizations=om,s.initializeProjectAccesses=bm,s.initializeProjectAttachments=En,s.initializeProjectFiles=Cm,s.initializeProjects=Zm,s.initializeTeamMemberships=sp,s.initializeTeams=lp,s.initializeUsers=Xh,s.isToday=ay,s.issueAssociationReducer=ml,s.issueAssociationSlice=ba,s.issueAttachmentReducer=bl,s.issueAttachmentSlice=Ra,s.issueCommentAttachmentReducer=Vl,s.issueCommentAttachmentSlice=Ea,s.issueCommentReducer=Dl,s.issueCommentSlice=ja,s.issueReducer=Gl,s.issueSlice=Ca,s.issueTypeAttachmentReducer=Ql,s.issueTypeAttachmentSlice=Na,s.issueTypeFieldValuesAttachmentReducer=Ph,s.issueTypeFieldValuesAttachmentSlice=xa,s.issueTypeFieldValuesReducer=oh,s.issueTypeFieldValuesSlice=Ka,s.issueTypeFieldsAttachmentReducer=ch,s.issueTypeFieldsAttachmentSlice=Wa,s.issueTypeFieldsReducer=fh,s.issueTypeFieldsSlice=Qa,s.issueTypeIdentifierReducer=wh,s.issueTypeIdentifierSlice=tn,s.issueTypeIdentifierValueReducer=jh,s.issueTypeIdentifierValueSlice=cn,s.issueTypeReducer=kh,s.issueTypeSlice=ln,s.issueUpdateReducer=Zh,s.issueUpdateSlice=yn,s.logOnlyOnce=hy,s.markAsDeleted=Sm,s.markForDeletion=mI,s.memoize=ts,s.onlyUniqueHashes=fy,s.onlyUniqueOfflineIds=Ac,s.organizationAccessReducer=rm,s.organizationAccessSlice=Sn,s.organizationReducer=pm,s.organizationSlice=In,s.outboxReducer=gm,s.outboxSlice=bn,s.overmapEnhancer=nb,s.overmapReducer=ZI,s.overmapReducers=Sp,s.performRequest=Zn,s.projectAccessReducer=Pm,s.projectAccessSlice=Fn,s.projectAttachmentReducer=Dm,s.projectAttachmentSlice=Mn,s.projectFileReducer=Km,s.projectFileSlice=jn,s.projectReducer=Xm,s.projectSlice=zn,s.rehydratedReducer=ep,s.rehydratedSlice=kn,s.removeDocuments=Ni,s.removeIssueType=hn,s.restructureCreateSelectorWithArgs=f,s.runMiddleware=kp,s.saveActiveProjectFileBounds=Nm,s.selectAccessToken=cS,s.selectAccessesByUserOfProject=AI,s.selectAccessibleProjects=VI,s.selectActiveOrganizationAccess=tI,s.selectActiveProjectFileId=_I,s.selectAllDocumentAttachments=Bu,s.selectAllProjectAttachments=jm,s.selectAssetAttachmentById=Ec,s.selectAssetAttachmentMapping=wc,s.selectAssetAttachments=Mc,s.selectAssetById=xs,s.selectAssetProcedureById=Rs,s.selectAssetProcedureStepById=Ws,s.selectAssetProcedureStepFieldValues=Mt,s.selectAssetProcedureStepFieldValuesAttachmentById=CA,s.selectAssetProcedureStepFieldValuesAttachments=Lr,s.selectAssetProcedureStepFieldValuesAttachmentsByIds=Nr,s.selectAssetProcedureStepFieldValuesAttachmentsMapping=Bs,s.selectAssetProcedureStepFieldValuesById=Ns,s.selectAssetProcedureStepFieldValuesMapping=Qr,s.selectAssetProcedureStepFieldValuesOfAsset=$A,s.selectAssetProcedureStepFieldValuesOfAssetProcedure=GA,s.selectAssetProcedureStepFieldValuesOfAssetProcedureStep=LA,s.selectAssetProcedureStepFields=Cs,s.selectAssetProcedureStepFieldsAttachmentById=FA,s.selectAssetProcedureStepFieldsAttachments=zr,s.selectAssetProcedureStepFieldsAttachmentsMapping=qr,s.selectAssetProcedureStepFieldsById=VA,s.selectAssetProcedureStepFieldsMapping=Us,s.selectAssetProcedureStepFieldsOfAssetProcedureStep=wA,s.selectAssetProcedureStepMapping=dt,s.selectAssetProcedureSteps=dd,s.selectAssetProcedureStepsByIds=YA,s.selectAssetProcedureStepsMappingOfAssetProcedureType=WA,s.selectAssetProcedureStepsOfAssetProcedureType=KA,s.selectAssetProcedureTypeAttachmentById=Lc,s.selectAssetProcedureTypeAttachmentMapping=$c,s.selectAssetProcedureTypeAttachments=Gc,s.selectAssetProcedureTypeById=Vs,s.selectAssetProcedureTypeFieldValues=gs,s.selectAssetProcedureTypeFieldValuesAttachmentById=eA,s.selectAssetProcedureTypeFieldValuesAttachments=ur,s.selectAssetProcedureTypeFieldValuesAttachmentsByIds=or,s.selectAssetProcedureTypeFieldValuesAttachmentsMapping=As,s.selectAssetProcedureTypeFieldValuesById=Is,s.selectAssetProcedureTypeFieldValuesMapping=Sr,s.selectAssetProcedureTypeFieldValuesOfAsset=iA,s.selectAssetProcedureTypeFields=ps,s.selectAssetProcedureTypeFieldsAttachmentById=By,s.selectAssetProcedureTypeFieldsAttachments=Xc,s.selectAssetProcedureTypeFieldsAttachmentsMapping=Jc,s.selectAssetProcedureTypeFieldsById=Yy,s.selectAssetProcedureTypeFieldsMapping=ar,s.selectAssetProcedureTypeFieldsOfAssetProcedureType=Wy,s.selectAssetProcedureTypes=vr,s.selectAssetProcedureTypesByIds=yA,s.selectAssetProcedureTypesMapping=Es,s.selectAssetProcedureTypesOfOrganization=AA,s.selectAssetProcedures=Os,s.selectAssetProceduresByIds=uA,s.selectAssetProceduresMapping=_s,s.selectAssetProceduresOfAssetProcedureType=Pr,s.selectAssetProceduresOfAssetType=dA,s.selectAssetStageById=ui,s.selectAssetStageCompletionById=gd,s.selectAssetStageCompletionMapping=ni,s.selectAssetStageCompletions=tf,s.selectAssetStageCompletionsByIds=Id,s.selectAssetStages=Od,s.selectAssetStagesByIds=uf,s.selectAssetStagesMappingOfAssetProcedureType=rf,s.selectAssetStagesOfAssetProcedureType=df,s.selectAssetTypeAttachmentById=jd,s.selectAssetTypeAttachmentMapping=Ed,s.selectAssetTypeAttachments=Vd,s.selectAssetTypeById=Di,s.selectAssetTypeFieldValues=Ii,s.selectAssetTypeFieldValuesAttachmentById=jf,s.selectAssetTypeFieldValuesAttachments=eu,s.selectAssetTypeFieldValuesAttachmentsByIds=tu,s.selectAssetTypeFieldValuesAttachmentsMapping=fi,s.selectAssetTypeFieldValuesById=bi,s.selectAssetTypeFieldValuesMapping=uu,s.selectAssetTypeFieldValuesOfAsset=Df,s.selectAssetTypeFields=zt,s.selectAssetTypeFieldsAttachmentById=Tf,s.selectAssetTypeFieldsAttachments=Gd,s.selectAssetTypeFieldsAttachmentsMapping=$d,s.selectAssetTypeFieldsById=Rf,s.selectAssetTypeFieldsMapping=Zd,s.selectAssetTypeFieldsOfAssetType=_f,s.selectAssetTypeIdentifierById=Oi,s.selectAssetTypeIdentifierMapping=mu,s.selectAssetTypeIdentifierValueById=Ei,s.selectAssetTypeIdentifierValueMapping=Su,s.selectAssetTypeIdentifierValues=Mi,s.selectAssetTypeIdentifierValuesOfAsset=Zf,s.selectAssetTypeIdentifierValuesOfIdentifier=Jf,s.selectAssetTypeIdentifiers=pu,s.selectAssetTypeIdentifiersOfAssetType=Lf,s.selectAssetTypeValuesOfAssetType=Uf,s.selectAssetTypes=bu,s.selectAssetTypesByIds=sS,s.selectAssetTypesMapping=zi,s.selectAssetTypesOfOrganization=iS,s.selectAssets=hd,s.selectAssetsByIds=md,s.selectAssetsMapping=Xs,s.selectAssetsOfAssetType=Qs,s.selectAttachmentsOfAsset=Vc,s.selectAttachmentsOfAssetProcedureStepFieldValues=Hr,s.selectAttachmentsOfAssetProcedureStepFields=bA,s.selectAttachmentsOfAssetProcedureType=jy,s.selectAttachmentsOfAssetProcedureTypeFieldValues=lr,s.selectAttachmentsOfAssetProcedureTypeFields=ky,s.selectAttachmentsOfAssetType=qd,s.selectAttachmentsOfAssetTypeFieldValues=su,s.selectAttachmentsOfAssetTypeFields=Sf,s.selectAttachmentsOfDocument=SS,s.selectAttachmentsOfFormRevision=YS,s.selectAttachmentsOfFormSubmission=$o,s.selectAttachmentsOfIssue=gl,s.selectAttachmentsOfIssueComment=RT,s.selectAttachmentsOfIssueType=GT,s.selectAttachmentsOfIssueTypeFieldValues=Fh,s.selectAttachmentsOfIssueTypeFields=YT,s.selectAttachmentsOfProject=zm,s.selectCategories=Eu,s.selectCategoriesByIds=mS,s.selectCategoriesOfProject=pS,s.selectCategoryById=Bi,s.selectCategoryMapping=ki,s.selectCommentsOfIssue=jT,s.selectConversation=Oy,s.selectConversationMapping=ns,s.selectConversations=_y,s.selectCurrentUser=tm,s.selectDeletedRequests=lI,s.selectDescendantsOfAssetProcedureStep=ud,s.selectDocumentAttachmentById=$u,s.selectDocumentAttachmentMapping=ku,s.selectDocumentById=Wu,s.selectDocuments=Hi,s.selectDocumentsByIds=TS,s.selectDocumentsMapping=kt,s.selectEmailDomains=xu,s.selectEmailDomainsAsMapping=Qu,s.selectEmailDomainsOfOrganization=vS,s.selectFieldValuesOfAssetProcedure=aA,s.selectFormById=zo,s.selectFormIdentifierById=Xi,s.selectFormIdentifierMapping=uo,s.selectFormIdentifierValueById=sa,s.selectFormIdentifierValueMapping=po,s.selectFormIdentifierValues=ta,s.selectFormIdentifierValuesOfFormSubmission=$S,s.selectFormIdentifierValuesOfIdentifier=GS,s.selectFormIdentifiers=oo,s.selectFormIdentifiersOfForm=zS,s.selectFormMapping=jo,s.selectFormRevisionAttachmentsMapping=Io,s.selectFormRevisionById=QS,s.selectFormRevisionMapping=ra,s.selectFormRevisions=da,s.selectFormRevisionsOfForm=vo,s.selectFormSubmissionAttachemntsByIds=Bo,s.selectFormSubmissionAttachments=ma,s.selectFormSubmissionAttachmentsMapping=ko,s.selectFormSubmissionById=Sa,s.selectFormSubmissions=pT,s.selectFormSubmissionsMapping=fa,s.selectFormSubmissionsOfForm=Yo,s.selectForms=qo,s.selectFormsOfOrganization=cT,s.selectGeoImageById=Ia,s.selectGeoImageMapping=il,s.selectGeoImages=al,s.selectGeoImagesOfProject=AT,s.selectIsImportingProjectFile=OI,s.selectIsLoggedIn=rS,s.selectIssueAssociationById=ul,s.selectIssueAssociationMapping=ft,s.selectIssueAssociations=gT,s.selectIssueAssociationsOfAsset=hl,s.selectIssueAssociationsOfIssue=ll,s.selectIssueAssociationsToIssue=ol,s.selectIssueAttachmentById=Il,s.selectIssueAttachmentMapping=Sl,s.selectIssueAttachments=Tl,s.selectIssueById=La,s.selectIssueCommentAttachmentById=El,s.selectIssueCommentAttachmentMapping=wl,s.selectIssueCommentAttachments=Ml,s.selectIssueCommentById=Ua,s.selectIssueCommentMapping=zl,s.selectIssueMapping=$a,s.selectIssueTypeAttachmentById=Xl,s.selectIssueTypeAttachmentMapping=Zl,s.selectIssueTypeAttachments=Jl,s.selectIssueTypeById=pn,s.selectIssueTypeFieldValues=Ja,s.selectIssueTypeFieldValuesAttachmentById=Ag,s.selectIssueTypeFieldValuesAttachments=en,s.selectIssueTypeFieldValuesAttachmentsByIds=bh,s.selectIssueTypeFieldValuesAttachmentsMapping=Ih,s.selectIssueTypeFieldValuesById=Xa,s.selectIssueTypeFieldValuesMapping=uh,s.selectIssueTypeFieldValuesOfIssue=tg,s.selectIssueTypeFields=Nt,s.selectIssueTypeFieldsAttachmentById=ZT,s.selectIssueTypeFieldsAttachments=nh,s.selectIssueTypeFieldsAttachmentsMapping=ah,s.selectIssueTypeFieldsById=og,s.selectIssueTypeFieldsMapping=Ah,s.selectIssueTypeFieldsOfIssueType=rg,s.selectIssueTypeIdentifierById=nn,s.selectIssueTypeIdentifierMapping=Rh,s.selectIssueTypeIdentifierValueById=on,s.selectIssueTypeIdentifierValueMapping=Vh,s.selectIssueTypeIdentifierValues=un,s.selectIssueTypeIdentifierValuesOfIdentifier=wg,s.selectIssueTypeIdentifierValuesOfIssue=vg,s.selectIssueTypeIdentifiers=vh,s.selectIssueTypeIdentifiersOfIssueType=bg,s.selectIssueTypeMapping=mn,s.selectIssueTypeValuesOfIssueType=ug,s.selectIssueTypes=Ch,s.selectIssueTypesByIds=zg,s.selectIssueTypesOfOrganization=Dg,s.selectIssueUpdateMapping=Wh,s.selectIssueUpdates=Kh,s.selectIssueUpdatesOfIssue=Yh,s.selectIssues=Ga,s.selectIssuesByIds=UT,s.selectIssuesOfIssueType=$l,s.selectIssuesOfProject=CT,s.selectLatestAssetProcedureStepFieldsOfAssetProcedureStep=MA,s.selectLatestAssetProcedureTypeFieldsOfAssetProcedureType=Ky,s.selectLatestAssetTypeFieldsOfAssetType=Of,s.selectLatestFieldsByAssetProcedureStep=EA,s.selectLatestFormRevisionOfForm=xS,s.selectLatestIssueTypeFieldsOfIssueType=dg,s.selectLatestRetryTime=hI,s.selectMembershipsByUserOfTeam=kI,s.selectNumberOfAssetsOfAssetType=QA,s.selectOrganizationAccessById=gn,s.selectOrganizationAccessMapping=Tn,s.selectOrganizationAccessUserMapping=dm,s.selectOrganizationById=oI,s.selectOrganizationDocuments=IS,s.selectOrganizations=uI,s.selectOrganizationsMapping=mm,s.selectProjectAccessById=wn,s.selectProjectAccessMapping=vn,s.selectProjectAccesses=Zt,s.selectProjectAccessesOfProject=_m,s.selectProjectAttachmentById=qm,s.selectProjectAttachmentMapping=Vm,s.selectProjectById=xm,s.selectProjectDocuments=gS,s.selectProjectFileById=PI,s.selectProjectFileMapping=Hm,s.selectProjectFiles=Wm,s.selectProjectMapping=Qm,s.selectProjects=Cn,s.selectProjectsOfOrganization=jI,s.selectRehydrated=DI,s.selectStageMapping=qt,s.selectTeamById=Kn,s.selectTeamMembershipById=up,s.selectTeamMemberships=Ln,s.selectTeamMembershipsMapping=dp,s.selectTeams=pp,s.selectTeamsByIds=HI,s.selectTeamsMapping=Wn,s.selectTeamsOfOrganization=WI,s.selectUploadUrl=ao,s.selectUserById=sm,s.selectUsers=fn,s.selectUsersByIds=Zg,s.selectUsersMapping=Kt,s.selectUsersOfOrganization=sI,s.selectUsersOfProject=fI,s.selectUsersOfTeam=BI,s.setActiveProjectFileId=Lm,s.setAsset=JA,s.setAssetAttachment=Oc,s.setAssetAttachments=vy,s.setAssetProcedure=cA,s.setAssetProcedureStep=sd,s.setAssetProcedureStepFieldValues=kA,s.setAssetProcedureStepFieldValuesAttachment=qA,s.setAssetProcedureStepFieldValuesAttachments=zA,s.setAssetProcedureStepFieldValuesMany=BA,s.setAssetProcedureStepFields=_A,s.setAssetProcedureStepFieldsAttachment=SA,s.setAssetProcedureStepFieldsAttachments=TA,s.setAssetProcedureStepFieldsMany=OA,s.setAssetProcedureSteps=NA,s.setAssetProcedureType=mA,s.setAssetProcedureTypeAttachment=Dc,s.setAssetProcedureTypeAttachments=Ey,s.setAssetProcedureTypeFieldValues=tA,s.setAssetProcedureTypeFieldValuesAttachment=Jy,s.setAssetProcedureTypeFieldValuesAttachments=Xy,s.setAssetProcedureTypeFieldValuesMany=sA,s.setAssetProcedureTypeFields=Gy,s.setAssetProcedureTypeFieldsAttachment=zy,s.setAssetProcedureTypeFieldsAttachments=Dy,s.setAssetProcedureTypeFieldsMany=Ly,s.setAssetProcedureTypes=pA,s.setAssetProcedures=rA,s.setAssetStage=Pd,s.setAssetStageCompletion=xA,s.setAssetStageCompletions=ef,s.setAssetStages=sf,s.setAssetType=Xf,s.setAssetTypeAttachment=vd,s.setAssetTypeAttachments=lf,s.setAssetTypeFieldValues=qf,s.setAssetTypeFieldValuesAttachment=wf,s.setAssetTypeFieldValuesAttachments=Mf,s.setAssetTypeFieldValuesMany=zf,s.setAssetTypeFields=If,s.setAssetTypeFieldsAttachment=pf,s.setAssetTypeFieldsAttachments=yf,s.setAssetTypeFieldsMany=bf,s.setAssetTypeIdentifier=kf,s.setAssetTypeIdentifierValue=Hf,s.setAssetTypeIdentifierValues=Wf,s.setAssetTypeIdentifiers=Bf,s.setAssetTypes=Qf,s.setAssets=XA,s.setCategories=oS,s.setCategory=uS,s.setClientSDK=qp,s.setClientStore=Vp,s.setConversation=bc,s.setConversations=Iy,s.setCurrentUser=Kg,s.setDocumentAttachment=zu,s.setDocumentAttachments=AS,s.setDocuments=Nu,s.setEmailDomain=FS,s.setEmailDomains=PS,s.setForm=tT,s.setFormIdentifier=ES,s.setFormIdentifierValue=US,s.setFormIdentifierValues=CS,s.setFormIdentifiers=VS,s.setFormRevision=Oo,s.setFormRevisionAttachment=NS,s.setFormRevisionAttachments=HS,s.setFormRevisions=ZS,s.setFormSubmission=Gt,s.setFormSubmissionAttachment=dT,s.setFormSubmissionAttachments=uT,s.setFormSubmissions=hT,s.setForms=sT,s.setGeoImage=At,s.setGeoImages=Qo,s.setIsImportingProjectFile=Gm,s.setIssue=qT,s.setIssueAssociation=ST,s.setIssueAssociations=fT,s.setIssueAttachment=yl,s.setIssueAttachments=bT,s.setIssueComment=za,s.setIssueCommentAttachment=_l,s.setIssueCommentAttachments=_T,s.setIssueComments=ql,s.setIssueType=It,s.setIssueTypeAttachment=Hl,s.setIssueTypeAttachments=BT,s.setIssueTypeFieldValues=XT,s.setIssueTypeFieldValuesAttachment=hg,s.setIssueTypeFieldValuesAttachments=mg,s.setIssueTypeFieldValuesMany=QT,s.setIssueTypeFields=ig,s.setIssueTypeFieldsAttachment=NT,s.setIssueTypeFieldsAttachments=HT,s.setIssueTypeFieldsMany=ag,s.setIssueTypeIdentifier=Sg,s.setIssueTypeIdentifierValue=Pg,s.setIssueTypeIdentifierValues=_g,s.setIssueTypeIdentifiers=Tg,s.setIssueTypes=Eg,s.setIssueUpdate=Ug,s.setIssueUpdates=Cg,s.setIssues=zT,s.setLoggedIn=_u,s.setOrganization=aI,s.setOrganizationAccess=Xg,s.setOrganizationAccesses=Qg,s.setOrganizations=iI,s.setProfilePicture=Yg,s.setProject=vI,s.setProjectAccess=pI,s.setProjectAccesses=yI,s.setProjectAttachment=vm,s.setProjectAttachments=wm,s.setProjectFile=gI,s.setProjectFiles=II,s.setProjects=RI,s.setRehydrated=zI,s.setTeam=Ft,s.setTeamMembership=$n,s.setTeamMemberships=np,s.setTeams=GI,s.setTokens=aS,s.setUploadUrl=io,s.setUser=Gg,s.setUsers=$g,s.shallowEqual=ey,s.slugify=yy,s.spacesToDashesLower=py,s.teamMembershipReducer=rp,s.teamMembershipSlice=Bn,s.teamReducer=yp,s.teamSlice=Nn,s.toFileNameSafeString=my,s.toUuidArray=yc,s.toUuidIdRecord=pc,s.truncate=Ay,s.updateAsset=ut,s.updateAssetAttachment=wy,s.updateAssetAttachments=Rc,s.updateAssetProcedure=at,s.updateAssetProcedureStep=Et,s.updateAssetProcedureStepFieldValues=rt,s.updateAssetProcedureStepFieldValuesAttachment=DA,s.updateAssetProcedureStepFieldValuesAttachments=Gr,s.updateAssetProcedureStepFieldValuesMany=Jr,s.updateAssetProcedureStepFields=ct,s.updateAssetProcedureStepFieldsAttachment=gA,s.updateAssetProcedureStepFieldsAttachments=Vr,s.updateAssetProcedureStepFieldsMany=RA,s.updateAssetProcedureSteps=HA,s.updateAssetProcedureType=nt,s.updateAssetProcedureTypeAttachment=Vy,s.updateAssetProcedureTypeAttachments=Uc,s.updateAssetProcedureTypeFieldValues=it,s.updateAssetProcedureTypeFieldValuesAttachment=Qy,s.updateAssetProcedureTypeFieldValuesAttachments=rr,s.updateAssetProcedureTypeFieldValuesMany=yr,s.updateAssetProcedureTypeFields=tr,s.updateAssetProcedureTypeFieldsAttachment=Uy,s.updateAssetProcedureTypeFieldsAttachments=Kc,s.updateAssetProcedureTypeFieldsMany=Ny,s.updateAssetProcedureTypes=lA,s.updateAssetProcedures=nA,s.updateAssetStage=jt,s.updateAssetStageCompletion=fd,s.updateAssetStageCompletions=Sd,s.updateAssetStages=nf,s.updateAssetType=mt,s.updateAssetTypeAttachment=hf,s.updateAssetTypeAttachments=wd,s.updateAssetTypeFieldValues=ot,s.updateAssetTypeFieldValuesAttachment=Ef,s.updateAssetTypeFieldValuesAttachments=xd,s.updateAssetTypeFieldValuesMany=ru,s.updateAssetTypeFields=Kd,s.updateAssetTypeFieldsAttachment=Af,s.updateAssetTypeFieldsAttachments=kd,s.updateAssetTypeFieldsMany=Ff,s.updateAssetTypeIdentifier=lt,s.updateAssetTypeIdentifierValue=ht,s.updateAssetTypeIdentifierValues=Kf,s.updateAssetTypeIdentifiers=$f,s.updateAssetTypes=eS,s.updateAssets=ZA,s.updateCategories=lS,s.updateCategory=wu,s.updateConversation=Fc,s.updateConversations=by,s.updateDocumentAttachment=fS,s.updateDocumentAttachments=Du,s.updateDocuments=Qe,s.updateEmailDomain=_S,s.updateEmailDomains=OS,s.updateForm=iT,s.updateFormIdentifier=pt,s.updateFormIdentifierValue=yt,s.updateFormIdentifierValues=kS,s.updateFormIdentifiers=jS,s.updateFormRevision=JS,s.updateFormRevisionAttachment=WS,s.updateFormRevisionAttachments=To,s.updateFormRevisions=XS,s.updateFormSubmission=Wo,s.updateFormSubmissionAttachment=oT,s.updateFormSubmissionAttachments=Co,s.updateFormSubmissions=mT,s.updateForms=aT,s.updateGeoImage=tl,s.updateGeoImages=yT,s.updateIssue=Lt,s.updateIssueAssociation=dl,s.updateIssueAssociations=TT,s.updateIssueAttachment=FT,s.updateIssueAttachments=Al,s.updateIssueComment=MT,s.updateIssueCommentAttachment=OT,s.updateIssueCommentAttachments=Ol,s.updateIssueComments=ET,s.updateIssueType=Uh,s.updateIssueTypeAttachment=$T,s.updateIssueTypeAttachments=Wl,s.updateIssueTypeFieldValues=St,s.updateIssueTypeFieldValuesAttachment=pg,s.updateIssueTypeFieldValuesAttachments=gh,s.updateIssueTypeFieldValuesMany=xT,s.updateIssueTypeFields=ph,s.updateIssueTypeFieldsAttachment=WT,s.updateIssueTypeFieldsAttachments=sh,s.updateIssueTypeFieldsMany=ng,s.updateIssueTypeIdentifier=Tt,s.updateIssueTypeIdentifierValue=gt,s.updateIssueTypeIdentifierValues=Og,s.updateIssueTypeIdentifiers=gg,s.updateIssueTypes=Vg,s.updateIssueUpdate=kg,s.updateIssueUpdates=Bg,s.updateIssues=DT,s.updateOrganization=hm,s.updateOrganizationAccess=Yt,s.updateOrganizationAccesses=xg,s.updateOrganizations=cI,s.updateProject=Jm,s.updateProjectAccess=bt,s.updateProjectAccesses=Fm,s.updateProjectAttachment=TI,s.updateProjectAttachments=Mm,s.updateProjectFile=qn,s.updateProjectFiles=FI,s.updateProjects=MI,s.updateTeam=mp,s.updateTeamMembership=UI,s.updateTeamMemberships=CI,s.updateTeams=LI,s.updateUser=Hg,s.updateUsers=Ng,s.useSelectorBuilder=JI,s.userReducer=em,s.userSlice=An,s.uuidObj=F,s.versioningReducer=fp,s.versioningSlice=Ap,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
14
+ external URLs and therefore not prepended with VITE_API_URL.`;throw new Error(A)}const p=o.type.split("/")[1];if(!p)throw new Error("File has no extension");const y=c??h+"."+p;if(o=dn(o,y),!o.name)throw new Error("Failed to set file's name");await this.addCache(o,h),Zt[n]=new Promise(A=>{A(o)})}return o}}class Ob extends O{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.uuid,c=new Date().toISOString(),n=F({...e,created_by:a,submitted_at:c});this.dispatch(Ki(n));const r=this.enqueueRequest({description:"Create form identifier",method:l.POST,url:"/form-identifiers/",payload:v(n),blockers:[n.form],blocks:[n.uuid]});return r.then(m=>{this.dispatch(mt(m))}).catch(()=>{this.dispatch(Yi(n.uuid))}),[n,r]}update(e){const{store:i}=this.client,a=Zi(e.uuid)(i.getState());if(!a)throw new Error(`Expected form identifier with uuid ${e.uuid} to exist`);const c={...a,...e};this.dispatch(mt(c));const n=this.enqueueRequest({description:"Update form identifier",method:l.PATCH,url:`/form-identifiers/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return n.then(r=>{this.dispatch(mt(r))}).catch(()=>{this.dispatch(mt(a))}),[c,n]}async delete(e){const{store:i}=this.client,a=i.getState(),c=Zi(e)(a);if(!c)throw new Error(`Expected form identifier with uuid ${e} to exist`);this.dispatch(Yi(e));try{return await this.enqueueRequest({description:"Delete form identifier",method:l.DELETE,url:`/form-identifiers/${e}/`,blockers:[e],blocks:[]})}catch(n){throw this.dispatch(Ki(c)),n}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get form identifiers",method:l.GET,url:"/form-identifiers/",queryParams:{form__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Qu(a)),a}}class Rb extends O{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.uuid,c=new Date().toISOString(),n=F({...e,created_by:a,submitted_at:c});this.dispatch(Xi(n));const r=this.enqueueRequest({description:"Create form identifier value",method:l.POST,url:"/form-identifier-values/",payload:v(n),blockers:[e.form_submission,e.form_identifier],blocks:[n.uuid]});return r.then(m=>{this.dispatch(pt(m))}).catch(()=>{this.dispatch(Qi(n.uuid))}),[n,r]}update(e){const{store:i}=this.client,a=ea(e.uuid)(i.getState());if(!a)throw new Error(`Expected form identifier value with uuid ${e.uuid} to exist`);const c={...a,...e};this.dispatch(pt(c));const n=this.enqueueRequest({description:"Update form identifier value",method:l.PATCH,url:`/form-identifier-values/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return n.then(r=>{this.dispatch(pt(r))}).catch(()=>{this.dispatch(pt(a))}),[c,n]}async delete(e){const{store:i}=this.client,a=i.getState(),c=ea(e)(a);if(!c)throw new Error(`Expected form identifier value with uuid ${e} to exist`);this.dispatch(Qi(e));try{return await this.enqueueRequest({description:"Delete form identifier value",method:l.DELETE,url:`/form-identifier-values/${e}/`,blockers:[e],blocks:[]})}catch(n){throw this.dispatch(Xi(c)),n}}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get form identifier values",method:l.GET,url:"/form-identifier-values/",queryParams:{limit:this.pageSize,paginate:!0,form_submission__form_revision__form__organization:e},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get form identifier values",method:l.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(io(c)),c}}class vb extends E{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.uuid,c={},n=[],r=[];for(const o of e){const{revisionUuid:h,fieldIdentifier:p,file:y}=o,A=await this.getFilePayload(y);A.sha1 in c||(c[A.sha1]=A);const I=F({file:URL.createObjectURL(y),file_type:y.type,file_name:y.name,file_sha1:A.sha1,created_by:a,form_revision:h,submitted_at:i,field_identifier:p});n.push(I);const g={uuid:I.uuid,file_name:y.name,field_identifier:p,file_extension:A.extension,file_sha1:A.sha1,form_revision:h};r.push(g)}this.dispatch(uo(n));const u=this.enqueueRequest({description:"Attach files to form revision",method:l.POST,url:"/form-revision-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(c)},blockers:n.map(o=>o.form_revision),blocks:n.map(o=>o.uuid)});return u.then(o=>{this.processPresignedUrls(o.presigned_urls),this.dispatch(oo(o.attachments))}).catch(()=>{this.dispatch(lo(n.map(o=>o.uuid)))}),[n,u.then(({attachments:o})=>o)]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch organization form revision attachments",method:l.GET,url:"/form-revision-attachments/",queryParams:{form_revision__form__organization:e},blockers:[e],blocks:[]},i);return this.dispatch(ro(a)),a}}class wb extends E{add(e){var u;const{store:i}=this.client,c=(u=i.getState().userReducer.currentUser)==null?void 0:u.uuid,n=F({...e,created_by:c,submitted_at:new Date().toISOString()});this.dispatch(ia(n));const r=this.enqueueRequest({description:"Create form revision",method:l.POST,url:"/form-revisions/",payload:v(n),blockers:[e.form],blocks:[n.uuid]});return r.then(m=>{this.dispatch(fo(m))}).catch(()=>{this.dispatch(aa(n.uuid))}),[n,r]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get organization form revisions",method:l.GET,url:"/form-revisions/",queryParams:{form__organization:e},blockers:[e],blocks:[]},i);return this.dispatch(yo(a)),a}}class Mb extends E{add(e,i){var o;const{store:a}=this.client,c=new Date().toISOString(),n=(o=a.getState().userReducer.currentUser)==null?void 0:o.uuid,r=F({...e,submitted_at:c,created_by:n}),u=F({...i,form:r.uuid,submitted_at:c,created_by:n});this.dispatch(da(r)),this.dispatch(ia(u));const m=this.enqueueRequest({description:"Create form",method:l.POST,url:"/forms/",payload:{...v(r),initial_revision:{uuid:u.uuid,submitted_at:u.submitted_at,title:u.title,description:u.description,fields:u.fields}},blockers:[],blocks:[r.uuid,u.uuid]});return m.catch(h=>{throw this.dispatch(ua(r.uuid)),this.dispatch(aa(u.uuid)),h}),[r,u,m]}async delete(e){const{store:i}=this.client,a=i.getState(),c=Oo(e)(a);if(!c)throw new Error("Expected form to exist");const n=ko(e)(a);n.length>0&&this.dispatch(Do(n.map(({uuid:u})=>u)));const r=To(e)(a);r.length>0&&this.dispatch(So(r.map(({uuid:u})=>u))),this.dispatch(ua(e));try{return await this.enqueueRequest({description:"Delete form",method:l.DELETE,url:`/forms/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(da(c)),r.length>0&&this.dispatch(Ao(r)),n.length>0&&this.dispatch(Uo(n)),u}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch organization forms",method:l.GET,url:"/forms/",queryParams:{organization:e},blockers:[e],blocks:[]},i);return this.dispatch(bo(a)),a}}class Vb extends E{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.uuid,c={},n=[],r=[];for(const o of e){const{submissionUuid:h,fieldIdentifier:p,file:y}=o,A=await this.getFilePayload(y);A.sha1 in c||(c[A.sha1]=A);const I=F({file:URL.createObjectURL(y),file_type:y.type,file_name:y.name,file_sha1:A.sha1,created_by:a,form_submission:h,submitted_at:i,field_identifier:p});n.push(I);const g={uuid:I.uuid,file_name:y.name,file_sha1:A.sha1,file_extension:A.extension,field_identifier:p,form_submission:h};r.push(g)}this.dispatch(kt(n));const u=this.enqueueRequest({description:"Attach files to form submission",method:l.POST,url:"/form-submission-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(c)},blockers:n.map(o=>o.form_submission),blocks:n.map(o=>o.uuid)});return u.then(o=>{this.processPresignedUrls(o.presigned_urls),this.dispatch(wo(o.attachments))}).catch(o=>{throw this.dispatch(Bt(n.map(h=>h.uuid))),o}),[n,u.then(({attachments:o})=>o)]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),c=Vo(e)(a);this.dispatch(Bt(e));try{await this.enqueueRequest({description:"Delete form submission attachments",method:l.DELETE,url:"/form-submission-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(n){throw this.dispatch(kt(c)),n}}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get form submission attachments",method:l.GET,url:"/form-submission-attachments/",queryParams:{limit:$e,paginate:!0,form_submission__form_revision__form__organization:e},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get form submission attachments",method:l.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(vo(c)),c}}class Eb extends E{add(e){var r;const{store:i}=this.client,a=i.getState(),c=F({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.uuid,submitted_at:new Date().toISOString()}),n=this.enqueueRequest({description:"Add form submission",method:l.POST,url:"/form-submissions/",payload:v(c),blockers:[e.form_revision],blocks:[c.uuid]});return this.dispatch(ma(c)),n.then(u=>(this.dispatch($t(u)),u)).catch(()=>{this.dispatch(pa(c.uuid))}),[c,n]}update(e){const{store:i}=this.client,a=i.getState(),c=Aa(e.uuid)(a);if(!c)throw new Error(`Expected submission with uuid ${e.uuid} to exist`);const n={...c,...e};this.dispatch(Co(n));const r=this.enqueueRequest({description:"Delete user form submissions",method:l.PATCH,url:`/form-submissions/${n.uuid}/`,payload:e,blockers:[n.uuid],blocks:[n.uuid]});return r.then(u=>{this.dispatch($t(u))}).catch(()=>{this.dispatch($t(c))}),[n,r]}async delete(e){const{store:i}=this.client,a=i.getState(),c=Aa(e)(a);if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const n=Eo(e)(a);this.dispatch(pa(e)),this.dispatch(Bt(n.map(r=>r.uuid)));try{return await this.enqueueRequest({description:"Delete user form submissions",method:l.DELETE,url:`/form-submissions/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(ma(c)),this.dispatch(kt(n)),r}}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Fetch form submissions",method:l.GET,url:"/form-submissions/",queryParams:{limit:this.pageSize,paginate:!0,form_revision__form_organization:e},blockers:[],blocks:[]},n=>({immediate:!0,description:"Fetch form submissions",method:l.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(zo(c)),c}}class jb extends E{async add(e){var p;const{store:i}=this.client,{file:a,...c}=e,n=new Date().toISOString(),r=(p=i.getState().userReducer.currentUser)==null?void 0:p.uuid,u=c.project,m=await this.getFilePayload(a),o=F({...c,file_name:a.name,file_sha1:m.sha1,file_type:a.type,file:URL.createObjectURL(a),submitted_at:n,created_by:r});this.dispatch(No(o));const h=this.enqueueRequest({description:"Add geo image",method:l.POST,url:"/geo-images/",payload:{uuid:o.uuid,submitted_at:n,title:o.title,description:o.description,geo_marker:o.geo_marker,canvas_marker:o.canvas_marker,sha1:o.file_sha1,project:o.project,file_name:o.file_name,direction:o.direction,original_date:o.original_date,file:m},blocks:[u],blockers:[u]});return h.then(y=>{this.processPresignedUrls(y.presigned_urls),this.dispatch(yt(y.geo_image))}).catch(()=>{this.dispatch(Sa(o.uuid))}),[o,h.then(y=>y.geo_image)]}async bulkAdd(e,i){var p;const{store:a}=this.client,c=new Date().toISOString(),n=(p=a.getState().userReducer.currentUser)==null?void 0:p.uuid,r=[],u=[],m=[],o={};for(const y of e){const{file:A,...I}=y,g=await this.getFilePayload(A);g.sha1 in o||(o[g.sha1]=g);const R=F({...I,file_name:A.name,file_sha1:g.sha1,file_type:A.type,file:URL.createObjectURL(A),submitted_at:c,created_by:n,project:i});r.push(R),u.push(R.uuid),m.push({uuid:R.uuid,sha1:R.file_sha1,file_name:R.file_name,title:R.title,description:R.description,geo_marker:R.geo_marker,canvas_marker:R.canvas_marker,direction:R.direction,original_date:R.original_date})}this.dispatch(Ho(r));const h=this.enqueueRequest({description:"Bulk add geo images",method:l.POST,url:"/geo-images/bulk/",payload:{submitted_at:c,project:i,geo_images:m,files:Object.values(o)},blocks:[i],blockers:u});return h.then(y=>{this.processPresignedUrls(y.presigned_urls),this.dispatch(Lo(y.geo_images))}).catch(()=>{this.dispatch(Ko(u))}),[r,h.then(y=>y.geo_images)]}update(e){const{store:i}=this.client,a=i.getState(),c=Ta(e.uuid)(a);if(!c)throw new Error(`Map image with uuid ${e.uuid} does not exist in the store`);const n={...c,...e};this.dispatch(Wo(n));const r=this.enqueueRequest({description:"Update geo image",method:l.PATCH,url:`/geo-images/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return r.then(u=>{this.dispatch(yt(u))}).catch(()=>{this.dispatch(yt(c))}),[n,r]}async delete(e){const{store:i}=this.client,a=i.getState(),c=Ta(e)(a);if(!c)throw new Error(`Map image with uuid ${e} does not exist in the store`);this.dispatch(Sa(e));const n=this.enqueueRequest({description:"Delete geo image",method:l.DELETE,url:`/geo-images/${e}/`,blocks:[e],blockers:[e]});return n.catch(()=>{this.dispatch(yt(c))}),n}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get geo images",method:l.GET,url:"/geo-images/",queryParams:{project:e},blocks:[e],blockers:[]},i);return this.dispatch(Go(a)),a}}class qb extends O{add(e){var u;const{store:i}=this.client,a=new Date().toISOString(),c=(u=i.getState().userReducer.currentUser)==null?void 0:u.uuid,n=F({...e,submitted_at:a,created_by:c});this.dispatch(ga(n));const r=this.enqueueRequest({description:"Add issue association",method:l.POST,url:"/issue-associations/",payload:v(n),blockers:[e.associated_issue,...e.issue?[e.issue]:[],...e.asset?[e.asset]:[]],blocks:[n.uuid]});return r.then(m=>{this.dispatch(xo(m))}).catch(()=>{this.dispatch(Fa(n.uuid))}),[n,r]}async delete(e){const{store:i}=this.client,a=el(e)(i.getState());if(!a)throw new Error(`Issue association with uuid ${e} not found in store.`);this.dispatch(Fa(e));const c=this.enqueueRequest({description:"Delete issue association",method:l.DELETE,url:`/issue-associations/${e}/`,blockers:[e],blocks:[]});return c.catch(()=>{this.dispatch(ga(a))}),c}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Fetch issue associations",method:l.GET,url:"/issue-associations/",queryParams:{limit:this.pageSize,paginate:!0,associated_issue__project:e},blockers:[],blocks:[]},n=>({immediate:!0,description:"Fetch issue associations",method:l.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Qo(c)),c}}class zb extends Ne{constructor(){super(...arguments);S(this,"name","Issue Attachment");S(this,"url","/issue-attachments");S(this,"initializeAttachments",Oa);S(this,"addAttachments",Ra);S(this,"updateAttachments",rl);S(this,"removeAttachments",va);S(this,"removeAttachment",dl);S(this,"setAttachment",nl);S(this,"selectAttachment",hl)}getId(i){return i.uuid}buildModel(i){return F({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,issue:i.modelUuid})}buildPayload(i,a){return{uuid:i.uuid,file_name:i.file_name,file_sha1:i.file_sha1,file_extension:a.extension,issue:i.issue}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.issueUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const n=(await this.performPagination({immediate:!0,description:"Get issue attachments",method:l.GET,url:`${this.url}/`,queryParams:{limit:$e,paginate:!0,issue__project:i},blocks:[],blockers:[]},r=>({immediate:!0,description:"Get issue attachments",method:l.GET,url:r,blockers:[],blocks:[]}),a)).flat();return this.dispatch(Oa(n)),n}}class Ub extends Ne{constructor(){super(...arguments);S(this,"name","Issue Comment Attachment");S(this,"url","/issue-comment-attachments");S(this,"initializeAttachments",Ma);S(this,"addAttachments",yl);S(this,"updateAttachments",fl);S(this,"removeAttachments",Tl);S(this,"removeAttachment",Sl);S(this,"setAttachment",Al);S(this,"selectAttachment",bl)}getId(i){return i.uuid}buildModel(i){return F({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,issue_comment:i.modelUuid})}buildPayload(i,a){return{uuid:i.uuid,file_name:i.file_name,file_sha1:i.file_sha1,file_extension:a.extension,issue_comment:i.issue_comment}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.issueCommentUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const n=(await this.performPagination({immediate:!0,description:"Get issue comment attachments",method:l.GET,url:`${this.url}/`,queryParams:{limit:$e,paginate:!0,issue_comment__issue__project:i},blocks:[],blockers:[]},r=>({immediate:!0,description:"Get issue comment attachments",method:l.GET,url:r,blockers:[],blocks:[]}),a)).flat();return this.dispatch(Ma(n)),n}}class Cb extends O{add(e){var n;const{store:i}=this.client,a=F({...e,author:(n=i.getState().userReducer.currentUser)==null?void 0:n.uuid,submitted_at:new Date().toISOString()});this.dispatch(Ea(a));const c=this.enqueueRequest({description:"Add issue comment",method:l.POST,url:"/issue-comments/",payload:v(a),blockers:[e.issue],blocks:[a.uuid]});return c.catch(()=>{this.dispatch(qa(a.uuid))}),[a,c]}update(e){const{store:i}=this.client,a=za(e.uuid)(i.getState());if(!a)throw new Error(`Comment with uuid ${e.uuid} not found in store`);const c={...a,...e};this.dispatch(ja(c));const n=this.enqueueRequest({description:"Edit issue comment",method:l.PATCH,url:`/issue-comments/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return n.catch(()=>{this.dispatch(ja(a))}),[c,n]}remove(e){const{store:i}=this.client,a=za(e)(i.getState());if(!a)throw new Error(`Comment with uuid ${e} not found in store`);this.dispatch(qa(e));const c=this.enqueueRequest({description:"Delete comment",method:l.DELETE,url:`/issue-comments/${e}/`,blockers:[e],blocks:[]});return c.catch(()=>{this.dispatch(Ea(a))}),c}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get comments",method:l.GET,url:"/issue-comments/",queryParams:{issue__project:e},blockers:[],blocks:[]},i);return this.dispatch(_l(a)),a}}class Db extends O{add(e){var m;const{store:i}=this.client,a=i.getState(),c=new Date().toISOString(),n=(m=a.userReducer.currentUser)==null?void 0:m.uuid,r=F({...e,submitted_at:c,created_by:n});this.dispatch(Ca(r));const u=this.enqueueRequest({description:"Create issue",method:l.POST,url:"/issues/",payload:v(r),blockers:[r.project,r.issue_type,...r.category?[r.category]:[]],blocks:[r.uuid]});return u.then(o=>{this.dispatch(Gt(o))}).catch(o=>{throw this.dispatch(Da(r.uuid)),o}),[r,u]}update(e){var m;const i=this.client.store.getState(),a=$a(e.uuid)(i);if(!a)throw new Error(`Attempting to update an issue with uuid ${e.uuid} that doesn't exist in the store`);const c={...a,...e};this.dispatch(Gt(c));const n={};for(const o of[V.TITLE,V.DESCRIPTION,V.STATUS,V.CATEGORY,V.PRIORITY,V.ASSIGNED_TO,V.DUE_DATE])if(o in e&&e[o]!==a[o])switch(o){case V.PRIORITY:case V.STATUS:{const h=e[o];n[o]=h!==void 0?Number(h):null;break}case V.DUE_DATE:case V.DESCRIPTION:case V.TITLE:n[o]=e[o]??null;break;case V.CATEGORY:{let h=null;const p=e[o];if(p&&(h=i.categoryReducer.instances[p]??null,!h))throw new Error(`Trying to update issue category to ${p} which does not exist in store`);n[o]=h?{name:h.name,color:h.color,uuid:h.uuid}:null;break}case V.ASSIGNED_TO:{let h=null;const p=e[o];if(p&&(h=i.userReducer.instances[p]??null,!h))throw new Error(`Trying to update issue assigned_to to ${p} which does not exist in store`);n[o]=h?{email:h.email,id:h.uuid}:null;break}}const r=F({created_by:(m=i.userReducer.currentUser)==null?void 0:m.uuid,submitted_at:new Date().toISOString(),issue:a.uuid,changes:n});this.dispatch(jh(r));const u=this.enqueueRequest({description:"Edit issue",method:l.PATCH,url:`/issues/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.catch(()=>{this.dispatch(Gt(a)),this.dispatch(zh(r.uuid))}),[c,u]}async remove(e){const{store:i}=this.client,a=i.getState(),c=$a(e)(a);if(!c)throw new Error(`No issue with uuid ${e} found in the store`);const n=ll(e)(a),r=kh(e)(a),u={};for(const o of tl(e)(a))u[o.uuid]=o;for(const o of sl(e)(a))u[o.uuid]=o;const m=Object.values(u);this.dispatch(Da(e)),n.length>0&&this.dispatch(va(n.map(({uuid:o})=>o))),r.length>0&&this.dispatch(Uh(r.map(({uuid:o})=>o))),m.length>0&&this.dispatch(Pa(m.map(({uuid:o})=>o)));try{return await this.enqueueRequest({description:"Delete issue",method:l.DELETE,url:`/issues/${e}/`,blockers:[e],blocks:[]})}catch(o){throw this.dispatch(Ca(c)),this.dispatch(Ra(n)),this.dispatch(qh(r)),this.dispatch(ba(m)),o}}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get issues",method:l.GET,url:"/issues/",queryParams:{limit:this.pageSize,paginate:!0,project:e},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get issues",method:l.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(wl(c)),c}}class kb extends Ne{constructor(){super(...arguments);S(this,"name","Issue Type Attachment");S(this,"url","/issue-type-attachments");S(this,"initializeAttachments",La);S(this,"addAttachments",zl);S(this,"updateAttachments",Cl);S(this,"removeAttachments",kl);S(this,"removeAttachment",Dl);S(this,"setAttachment",Ul);S(this,"selectAttachment",Gl)}getId(i){return i.uuid}buildModel(i){return F({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,issue_type:i.modelUuid})}buildPayload(i,a){return{uuid:i.uuid,file_name:i.file_name,file_sha1:i.file_sha1,file_extension:a.extension,issue_type:i.issue_type}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.issueTypeUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const c=await this.enqueueRequest({immediate:!0,description:"Get issue type attachments",method:l.GET,url:`${this.url}/`,queryParams:{issue_type__organization:i},blocks:[],blockers:[]},a);return this.dispatch(La(c)),c}}class Bb extends E{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.uuid,c={},n=[],r=[];for(const o of e){const{fieldsRevisionUuid:h,fieldIdentifier:p,file:y}=o,A=await this.getFilePayload(y);A.sha1 in c||(c[A.sha1]=A);const I=F({file:URL.createObjectURL(y),file_type:y.type,file_name:y.name,file_sha1:A.sha1,created_by:a,fields_revision:h,submitted_at:i,field_identifier:p});n.push(I);const g={uuid:I.uuid,file_name:y.name,file_extension:A.extension,field_identifier:p,file_sha1:A.sha1,fields_revision:h};r.push(g)}this.dispatch(Wl(n));const u=this.enqueueRequest({description:"Add issue type fields attachments",method:l.POST,url:"/issue-type-fields-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(c)},blockers:n.map(o=>o.fields_revision),blocks:n.map(o=>o.uuid)});return u.then(o=>{this.processPresignedUrls(o.presigned_urls),this.dispatch(Kl(o.attachments))}).catch(()=>{this.dispatch(Yl(n.map(o=>o.uuid)))}),[n,u.then(({attachments:o})=>o)]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"get issue type fields attachments",method:l.GET,url:"/issue-type-fields-attachments/",queryParams:{fields_revision__issue_type__organization:e},blockers:[e],blocks:[]},i);return this.dispatch(Hl(a)),a}}class $b extends O{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.uuid,c=new Date().toISOString(),n=F({...e,created_by:a,submitted_at:c});this.dispatch(ah(n));const r=this.enqueueRequest({description:"Add Issue Type Fields",method:l.POST,url:"/issue-type-fields/",payload:v(n),blockers:[n.issue_type],blocks:[n.uuid]});return r.then(m=>{this.dispatch(ch(m))}).catch(m=>{throw this.dispatch(nh(n.uuid)),m}),[n,r]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get Issue Type Fields",method:l.GET,url:"/issue-type-fields/",queryParams:{issue_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(ih(a)),a}}class Gb extends E{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.uuid,c={},n=[],r=[];for(const o of e){const{fieldValuesUuid:h,fieldIdentifier:p,file:y}=o,A=await this.getFilePayload(y);A.sha1 in c||(c[A.sha1]=A);const I=F({file:URL.createObjectURL(y),file_type:y.type,file_name:y.name,file_sha1:A.sha1,created_by:a,field_values:h,submitted_at:i,field_identifier:p});n.push(I);const g={uuid:I.uuid,file_name:y.name,file_sha1:A.sha1,file_extension:A.extension,field_identifier:p,field_values:h};r.push(g)}this.dispatch(Nt(n));const u=this.enqueueRequest({description:"Add issue type field values attachments",method:l.POST,url:"/issue-type-field-values-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(c)},blockers:n.map(o=>o.field_values),blocks:n.map(o=>o.uuid)});return u.then(({presigned_urls:o,attachments:h})=>{this.processPresignedUrls(o),this.dispatch(lh(h))}).catch(o=>{throw this.dispatch(Ht(n.map(h=>h.uuid))),o}),[n,u.then(({attachments:o})=>o)]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),c=mh(e)(a);this.dispatch(Ht(e));try{await this.enqueueRequest({description:"Delete issue type field values attachments",method:l.DELETE,url:"/issue-type-field-values-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(n){throw this.dispatch(Nt(c)),n}}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get issue type field values attachments",method:l.GET,url:"/issue-type-field-values-attachments/",queryParams:{limit:$e,paginate:!0,field_values__issue__project:e,latest:!0},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get issue type field values attachments",method:l.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(oh(c)),c}}class Lb extends O{add(e){var r;const{store:i}=this.client,a=i.getState(),c=F({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.uuid,submitted_at:new Date().toISOString()}),n=this.enqueueRequest({description:"Add issue type field values",method:l.POST,url:"/issue-type-field-values/",payload:v(c),blockers:[e.issue,e.fields_revision],blocks:[c.uuid]});return this.dispatch(Wa(c)),n.then(u=>(this.dispatch(ft(u)),u)).catch(()=>{this.dispatch(Ka(c.uuid))}),[c,n]}update(e){const{store:i}=this.client,a=i.getState(),c=Za(e.uuid)(a);if(!c)throw new Error(`Expected IssueTypeFieldValues with uuid ${e.uuid} to exist`);const n={...c,...e};this.dispatch(ft(n));const r=this.enqueueRequest({description:"Update issue type field values",method:l.PATCH,url:`/issue-type-field-values/${e.uuid}/`,payload:e,blockers:[n.uuid,n.fields_revision,n.issue],blocks:[n.uuid]});return r.then(u=>{this.dispatch(ft(u))}).catch(()=>{this.dispatch(ft(c))}),[n,r]}async delete(e){const{store:i}=this.client,a=i.getState(),c=Za(e)(a);if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const n=ph(e)(a);this.dispatch(Ka(e)),this.dispatch(Ht(n.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete issue type field values",method:l.DELETE,url:`/issue-type-field-values/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(Wa(c)),this.dispatch(Nt(n)),r}}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get issue type field values",method:l.GET,url:"/issue-type-field-values/",queryParams:{limit:this.pageSize,paginate:!0,issue__project:e,latest:!0},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get issue type field values",method:l.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(xl(c)),c}}class Nb extends O{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.uuid,c=new Date().toISOString(),n=F({...e,created_by:a,submitted_at:c});this.dispatch(ec(n));const r=this.enqueueRequest({description:"Create issue type identifier",method:l.POST,url:"/issue-type-identifiers/",payload:v(n),blockers:[n.issue_type],blocks:[n.uuid]});return r.then(m=>{this.dispatch(St(m))}).catch(()=>{this.dispatch(tc(n.uuid))}),[n,r]}update(e){const{store:i}=this.client,a=sc(e.uuid)(i.getState());if(!a)throw new Error(`Expected issue type identifier with uuid ${e.uuid} to exist`);const c={...a,...e};this.dispatch(St(c));const n=this.enqueueRequest({description:"Update issue type identifier",method:l.PATCH,url:`/issue-type-identifiers/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return n.then(r=>{this.dispatch(St(r))}).catch(()=>{this.dispatch(St(a))}),[c,n]}async delete(e){const{store:i}=this.client,a=i.getState(),c=sc(e)(a);if(!c)throw new Error(`Expected issue type identifier with uuid ${e} to exist`);this.dispatch(tc(e));try{return await this.enqueueRequest({description:"Delete issue type identifier",method:l.DELETE,url:`/issue-type-identifiers/${e}/`,blockers:[e],blocks:[]})}catch(n){throw this.dispatch(ec(c)),n}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get issue type identifiers",method:l.GET,url:"/issue-type-identifiers/",queryParams:{issue_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(fh(a)),a}}class Hb extends O{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.uuid,c=new Date().toISOString(),n=F({...e,created_by:a,submitted_at:c});this.dispatch(ac(n));const r=this.enqueueRequest({description:"Create issue type identifier value",method:l.POST,url:"/issue-type-identifier-values/",payload:v(n),blockers:[e.issue,e.issue_type_identifier],blocks:[n.uuid]});return r.then(m=>{this.dispatch(Tt(m))}).catch(()=>{this.dispatch(cc(n.uuid))}),[n,r]}update(e){const{store:i}=this.client,a=rc(e.uuid)(i.getState());if(!a)throw new Error(`Expected issue type identifier value with uuid ${e.uuid} to exist`);const c={...a,...e};this.dispatch(Tt(c));const n=this.enqueueRequest({description:"Update issue type identifier value",method:l.PATCH,url:`/issue-type-identifier-values/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return n.then(r=>{this.dispatch(Tt(r))}).catch(()=>{this.dispatch(Tt(a))}),[c,n]}async delete(e){const{store:i}=this.client,a=i.getState(),c=rc(e)(a);if(!c)throw new Error(`Expected issue type identifier value with uuid ${e} to exist`);this.dispatch(cc(e));try{return await this.enqueueRequest({description:"Delete issue type identifier value",method:l.DELETE,url:`/issue-type-identifier-values/${e}/`,blockers:[e],blocks:[]})}catch(n){throw this.dispatch(ac(c)),n}}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get issue type identifier values",method:l.GET,url:"/issue-type-identifier-values/",queryParams:{limit:this.pageSize,paginate:!0,issue__project:e},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get issue type identifier values",method:l.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(bh(c)),c}}class Wb extends O{add(e){var r;const{store:i}=this.client,a=i.getState(),c=F({...e,submitted_at:new Date().toISOString(),created_by:(r=a.userReducer.currentUser)==null?void 0:r.uuid});this.dispatch(Rh(c));const n=this.enqueueRequest({method:l.POST,url:"/issue-types/",payload:v(c),blockers:[],blocks:[c.uuid]});return n.then(u=>{this.dispatch(It(u))}).catch(()=>{this.dispatch(uc(c.uuid))}),[c,n]}update(e){const{store:i}=this.client,a=i.getState(),c=lc(e.uuid)(a);if(!c)throw new Error(`IssueType with uuid ${e.uuid} does not exist in the store.`);const n={...c,...e};this.dispatch(vh(n));const r=this.enqueueRequest({method:l.PATCH,url:`/issue-types/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(It(u))}).catch(()=>{this.dispatch(It(c))}),[n,r]}delete(e){const{store:i}=this.client,a=i.getState(),c=lc(e)(a);if(!c)throw new Error(`IssueType with uuid ${e} does not exist in the store.`);const n=El(e)(a);this.dispatch(uc(e)),this.dispatch(Vl(n.map(u=>u.uuid)));const r=this.enqueueRequest({method:l.DELETE,url:`/issue-types/${e}/`,blockers:[e],blocks:[]});return r.catch(()=>{this.dispatch(It(c)),this.dispatch(Ml(n))}),r}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,method:l.GET,url:"/issue-types/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(Oh(a)),a}}class Kb extends O{async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get issue updates",method:l.GET,url:"/issue-updates/",queryParams:{limit:this.pageSize,paginate:!0,issue__project:e},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get issue updates",method:l.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Eh(c)),c}}const Yb=1800;function Zb(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 Jb extends Yg{constructor(){super(...arguments);S(this,"_getRenewedTokens",async i=>{const a=this.enqueueRequest({description:"Get renewed tokens",method:l.POST,url:this.refreshTokensUrl,payload:{refresh:i},isAuthNeeded:!1,blockers:[],blocks:[],checkAuth:!1,immediate:!0});let c;try{c=await a}catch(n){console.error("Could not renew tokens; clearing auth",n),this.clearAuth();return}if(!c.access)throw new Error("Missing access token");return{accessToken:c.access,refreshToken:c.refresh??this.getRefreshToken()}})}clearAuth(){console.debug(this.constructor.name,"clearing auth;"),this.dispatch(Fu(!1)),this.clearTokens(),this.dispatch(b()),this.dispatch(b())}async renewTokens(){const i=this.getRefreshToken();if(!i)throw new Error("No refresh token found");console.debug(this.constructor.name,"renewing tokens");try{const a=await this._getRenewedTokens(i);if(!a)return;console.log("Got renewed tokens"),this.setTokens(a)}catch(a){throw console.error("Could not renew tokens; clearing auth",a),this.clearAuth(),a}}tokenIsExpiringSoon(){const i=this.getAccessToken();if(!i)return!1;const a=Date.now()/1e3;let c;try{c=Bp(i).exp??a}catch{c=a}return c-a<Yb}getAuthHeader(){return`Bearer ${this.getAccessToken()}`}async prepareAuth(){if(this.tokenIsExpiringSoon()){console.debug(this.constructor.name,"preparing auth");try{await this.renewTokens()}catch(i){return i instanceof U&&this.clearAuth(),i instanceof Error?Promise.reject(i):Promise.reject(new Error((i??Qe).toString()))}}}async handleUnauthorized(i,a){const c=this.client.store.getState();if(i.url.endsWith("/token/refresh/"))throw c.authReducer.isLoggedIn&&console.warn("No signed-in user to sign out."),this.clearAuth(),new U({message:"You have been signed out due to inactivity.",response:a,discard:!0});if(c.authReducer.isLoggedIn)await this.renewTokens();else throw console.debug("Forbidden; user is not logged in."),new U({message:"Incorrect username or password.",response:a,discard:!0})}async initAuth(i){const a=Ze.v4();return console.debug(this.constructor.name,"Initiating auth"),this.enqueueRequest({uuid:a,description:"Get token pair",method:l.POST,url:this.initTokensUrl,payload:i,isAuthNeeded:!1,checkAuth:!1,immediate:!0,blockers:[],blocks:[]}).then(c=>{this.setTokens(Zb(c))})}}class Xb extends O{update(e){const{store:i}=this.client,a=fc(e.uuid)(i.getState()),c={...a,...e};this.dispatch(Kt(c));const n=this.enqueueRequest({description:"Edit organization access",method:l.PATCH,url:`/organization-accesses/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return n.then(r=>{this.dispatch(Kt(r))}).catch(r=>{throw this.dispatch(Kt(a)),r}),[c,n]}async remove(e){const{store:i}=this.client,a=i.getState(),c=fc(e)(a),n=Kh(c.user)(a);this.dispatch(Xh(c.uuid)),this.dispatch(Nh(c.user));try{await this.enqueueRequest({description:"Remove organization access",method:l.DELETE,url:`/organization-accesses/${c.uuid}/`,blockers:[c.uuid],blocks:[]})}catch(r){throw this.dispatch(Jh(c)),this.dispatch(Lh(n)),r}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get organization accesses",method:l.GET,url:"/organization-accesses/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(Zh(a)),a}}class Qb extends O{async add(e){const i=await this.enqueueRequest({description:"Create organization",method:l.POST,url:"/organizations/",payload:e,blockers:[],blocks:[]});return this.dispatch(sm(i)),i}async update(e){const i=await this.enqueueRequest({description:"Edit organization",method:l.PATCH,url:`/organizations/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return this.dispatch(im(i)),i}async invite(e,i){return this.enqueueRequest({description:"Invite user to organization",method:l.POST,url:`/organizations/${e}/invite/${i}/`,blockers:[],blocks:[]})}async refreshStore(e){const i=await this.enqueueRequest({immediate:!0,description:"Fetch organizations",method:l.GET,url:"/organizations/",blockers:[],blocks:[]},e);return this.dispatch(tm(i)),i}}class xb extends O{add(e){var n;const{store:i}=this.client,a=F({...e,created_by:(n=i.getState().userReducer.currentUser)==null?void 0:n.uuid});this.dispatch(gc(a));const c=this.enqueueRequest({description:"Add project access",method:l.POST,url:"/project-accesses/",payload:v(a),blockers:[a.organization_access,a.project],blocks:[a.uuid]});return c.then(r=>{this.dispatch(gt(r))}).catch(r=>{throw this.dispatch(Fc(a.uuid)),r}),[a,c]}bulkAdd(e){var r;const{store:i}=this.client,a=(r=i.getState().userReducer.currentUser)==null?void 0:r.uuid,c=e.map(u=>F({...u,created_by:a}));this.dispatch(bc(c));const n=this.enqueueRequest({description:"Add project accesses",method:l.POST,url:"/project-accesses/bulk/",payload:{project_accesses:c.map(u=>v(u))},blockers:c.flatMap(u=>[u.project,u.organization_access]),blocks:c.map(u=>u.uuid)});return n.then(u=>{this.dispatch(pm(u))}).catch(u=>{throw this.dispatch(Pc(c.map(m=>m.uuid))),u}),[c,n]}update(e){const{store:i}=this.client,a=Oc(e.uuid)(i.getState()),c={...a,...e};this.dispatch(gt(c));const n=this.enqueueRequest({description:"Edit project access",method:l.PATCH,url:`/project-accesses/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[]});return n.then(r=>{this.dispatch(gt(r))}).catch(r=>{throw this.dispatch(gt(a)),r}),[c,n]}async remove(e){const{store:i}=this.client,a=Oc(e)(i.getState());this.dispatch(Fc(e));try{await this.enqueueRequest({description:"Delete project access",method:l.DELETE,url:`/project-accesses/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(gc(a)),c}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get project accesses",method:l.GET,url:"/project-accesses/",queryParams:{project__organization:e},blockers:[],blocks:[]},i);return this.dispatch(mm(a)),a}}class eF extends Ne{constructor(){super(...arguments);S(this,"name","Project Attachment");S(this,"url","/project-attachments");S(this,"initializeAttachments",vc);S(this,"addAttachments",Sm);S(this,"updateAttachments",gm);S(this,"removeAttachments",wc);S(this,"removeAttachment",bm);S(this,"setAttachment",Tm);S(this,"selectAttachment",_m)}getId(i){return i.uuid}buildModel(i){return F({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,project:i.modelUuid})}buildPayload(i,a){return{uuid:i.uuid,file_name:i.file_name,file_sha1:i.file_sha1,file_extension:a.extension,project:i.project}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.projectUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const c=await this.enqueueRequest({immediate:!0,description:"Get project attachments",method:l.GET,url:`${this.url}/`,queryParams:{project__organization:i},blockers:[],blocks:[]},a);return this.dispatch(vc(c)),c}}class tF extends O{async saveExisting(e){if(!e.uuid)throw new Error("You can only use this method to save existing project files. The one provided has no uuid.");const i={...e};delete i.file;const a=this.enqueueRequest({method:l.PATCH,url:`/project-files/${e.uuid}/`,payload:i,blockers:[e.uuid],blocks:[e.uuid]});return a.then(c=>{this.dispatch(Vc(c))}),a}saveActive(){const{store:e}=this.client,i=e.getState(),a=i.projectFileReducer.activeProjectFileId;if(!a)throw new Error("No active project file");const c=i.projectFileReducer.instances[a];if(!c)throw new Error("No active project file");if(!c.bounds&&!c.canvas_bounds)throw new Error("Project file must either have bounds or canvas_bounds set");let n;if(typeof c.file=="string"&&!c.file.startsWith("blob:")){const m={...c};delete m.file,n={method:l.PATCH,url:`/project-files/${a}/`,payload:m,blockers:[a],blocks:[a]}}else n=new Promise((m,o)=>{this.client.files.uploadFileToS3(c.file_sha1).then(([h])=>{m({method:l.POST,url:"/project-files/",payload:{...c,...h},blockers:[a],blocks:[a]})}).catch(o)});const u=Promise.resolve(n).then(m=>this.enqueueRequest(m));return u.then(m=>{this.dispatch(Vc(m))}),this.dispatch(zm),this.dispatch(qm(null)),this.dispatch(jm(!1)),[c,u]}delete(e){return this.dispatch(Vm(e)),this.enqueueRequest({method:l.DELETE,url:`/project-files/${e}`,blockers:[e],blocks:[]})}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get project files",method:l.GET,url:"/project-files/",queryParams:{limit:this.pageSize,paginate:!0,project:e},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get project files",method:l.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(wm(c)),c}}class sF extends O{async add(e){const i=await this.enqueueRequest({description:"Create project",method:l.POST,url:"/projects/",payload:v(e),blockers:[],blocks:[]});return this.dispatch(jc(i)),i}async update(e){if(!e.bounds&&!e.canvas_bounds)throw new Error("Project must either have bounds or canvas_bounds set");return this.dispatch($m(e)),await this.enqueueRequest({description:"Update project",method:l.PATCH,url:`/projects/${e.uuid}/`,payload:{name:e.name,bounds:e.bounds},blockers:[e.uuid],blocks:[e.uuid]})}async delete(e){const{store:i}=this.client,a=i.getState(),c=Nm(e)(a);if(!c)throw new Error("Expected project to exist");const n=Cm(a).filter(m=>m.project===e);this.dispatch(Em(n.map(({uuid:m})=>m)));const r=Om(c.uuid)(a);this.dispatch(wc(r.map(({uuid:m})=>m)));const u=Am(e)(a);this.dispatch(Pc(u.map(({uuid:m})=>m))),this.dispatch(qc(c.uuid));try{await this.enqueueRequest({description:"Delete project",method:l.DELETE,url:`/projects/${e}/`,blockers:[e],blocks:[]}),this.dispatch(qc(c.uuid))}catch(m){throw this.dispatch(jc(c)),this.dispatch(bc(Object.values(u))),this.dispatch(Mm(n)),this.dispatch(Im(r)),m}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch projects",method:l.GET,url:"/projects/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(Bm(a)),a}}class iF extends O{add(e){var n;const{store:i}=this.client,a=F({...e,created_by:(n=i.getState().userReducer.currentUser)==null?void 0:n.uuid});this.dispatch(Ym(a));const c=this.enqueueRequest({description:"Create team membership",method:l.POST,url:"/team-memberships/",payload:v(a),blockers:[e.team],blocks:[a.uuid]});return c.then(r=>{this.dispatch(Dc(r))}).catch(()=>{this.dispatch(kc(a.uuid))}),[a,c]}bulkAdd(e){var r;const{store:i}=this.client,a=(r=i.getState().userReducer.currentUser)==null?void 0:r.uuid,c=e.map(u=>F({...u,created_by:a}));this.dispatch(Zm(c));const n=this.enqueueRequest({description:"Create team memberships",method:l.POST,url:"/team-memberships/bulk/",payload:{team_memberships:c.map(u=>v(u))},blockers:c.map(u=>u.team),blocks:c.map(u=>u.uuid)});return n.then(u=>{this.dispatch(Jm(u))}).catch(()=>{this.dispatch(Xm(c.map(u=>u.uuid)))}),[c,n]}async delete(e){const{store:i}=this.client,a=i.getState(),c=ep(e)(a);if(!c)throw new Error(`Expected team membership with uuid ${e} to exist`);this.dispatch(kc(e));try{return await this.enqueueRequest({description:"Delete team membership",method:l.DELETE,url:`/team-memberships/${e}/`,blockers:[e],blocks:[e]})}catch(n){throw this.dispatch(Dc(c)),n}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch team memberships",method:l.GET,url:"/team-memberships/",queryParams:{team__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Km(a)),a}}class aF extends O{add(e){var n;const{store:i}=this.client,a=F({...e,submitted_at:new Date().toISOString(),created_by:(n=i.getState().userReducer.currentUser)==null?void 0:n.uuid});this.dispatch(ip(a));const c=this.enqueueRequest({description:"Create team",method:l.POST,url:"/teams/",payload:v(a),blockers:[],blocks:[a.uuid]});return c.then(r=>{this.dispatch(bt(r))}).catch(()=>{this.dispatch(Gc(a.uuid))}),[a,c]}update(e){const{store:i}=this.client,a=Nc(e.uuid)(i.getState());if(!a)throw new Error(`Expected team with uuid ${e.uuid} to exist`);const c={...a,...e};this.dispatch(ap(c));const n=this.enqueueRequest({description:"Update team",method:l.PATCH,url:`/teams/${e.uuid}/`,payload:v(e),blockers:[e.uuid],blocks:[e.uuid]});return n.then(r=>{this.dispatch(bt(r))}).catch(()=>{this.dispatch(bt(a))}),[c,n]}async delete(e){const{store:i}=this.client,a=i.getState(),c=Nc(e)(a);if(!c)throw new Error(`Expected team with uuid ${e} to exist`);this.dispatch(Gc(e));try{return await this.enqueueRequest({description:"Delete team",method:l.DELETE,url:`/teams/${e}/`,blockers:[e],blocks:[e]})}catch(n){throw this.dispatch(bt(c)),n}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch teams",method:l.GET,url:"/teams/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(sp(a)),a}}class cF extends O{async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch organization users",method:l.GET,url:`/organizations/${e}/users/`,blockers:[],blocks:[]},i);return this.dispatch(Gh(a)),a}}class nF{constructor(e){S(this,"store");this.store=e}async enqueueRequest(e,i,a,c){return this._enqueueRequest(e,i,a,c).then(n=>{if(n instanceof U)throw n;return n})}_enqueueRequest(e,i,a,c){const n=new nn,r={...e,BASE_URL:i,serviceName:a};if(e.immediate){const u={...r,uuid:e.uuid??Ze.v4()},m={payload:u,meta:{offline:{effect:{timestamp:new Date().toISOString(),request:u,BASE_URL:i,serviceName:a}}}};Wc(m,this,c).then(o=>{n.resolve(o.body)}).catch(o=>{o instanceof Error?n.reject(o):n.reject(new Error((o??Qe).toString()))})}else{const u=this.store.dispatch(dm(r)),m=h=>{if(h)n.resolve(h.body);else{const p=new U({message:"Could not get a response from the server.",response:h,discard:!0});n.reject(p)}},o=h=>{h instanceof U?h.options.discard=!0:(console.error("Received an unexpected error while processing a request:",h,`
15
+ Converting error to APIError and discarding.`),h=new U({message:"An error occurred while processing the request.",innerError:h,discard:!0})),n.reject(h)};u.then(m,o)}return n}}class xe{constructor(){S(this,"graph");S(this,"requestAttemptCounter");this.graph=new $p.DepGraph,this.requestAttemptCounter={}}static _fromOutbox(e){const i=new xe;for(let a=0;a<e.length;a++){const c=e[a];if(!c){console.error("Outbox item was undefined");continue}i.sneakRequest(c);for(let n=0;n<a;n++){const r=e[n];if(!r){console.error("Previous outbox item was undefined");continue}r.payload.uuid!==c.payload.uuid&&r.payload.blocks.some(u=>c.payload.blockers.includes(u))&&xe._addDependency(c.payload.uuid,r.payload.uuid,i.graph)}}return i}_addDependency(e,i){xe._addDependency(e,i,this.graph)}static _addDependency(e,i,a){if(e===i)throw new Error(`Tried to add dependency from node to itself: ${e}`);if(!a.hasNode(e))throw new Error(`Tried to add dependency from non-existent node: ${e} (to node: ${i})`);if(!a.hasNode(i))throw new Error(`Tried to add dependency to non-existent node: ${i} (from node: ${e})`);a.addDependency(e,i)}addRequest(e){if(this.graph.addNode(e.payload.uuid,e),!(e.payload.blockers.length===0||this.graph.size()===1))for(const i of this.graph.overallOrder()){if(i===e.payload.uuid)continue;const a=this.graph.getNodeData(i);e.payload.blockers.some(c=>a.payload.blocks.includes(c))&&this._addDependency(e.payload.uuid,i)}}insertRequest(e){this.graph.addNode(e.payload.uuid,e);for(const i of this.graph.overallOrder()){if(i===e.payload.uuid)continue;this.graph.getNodeData(i).payload.blockers.some(c=>e.payload.blocks.includes(c))&&this._addDependency(i,e.payload.uuid)}}sneakRequest(e){this.graph.addNode(e.payload.uuid,e)}_getNextNode(){const e=this.graph.overallOrder(!0);let i=1/0,a;for(const c of e){const n=this.requestAttemptCounter[c]||0;n<i&&(i=n,a=c)}return a}peek(){const e=this._getNextNode();if(e)return this.graph.getNodeData(e)}remove(e){this.graph.removeNode(e),delete this.requestAttemptCounter[e]}pop(){const e=this.peek();return e&&this.graph.removeNode(e.payload.uuid),e}getQueue(){const e=this.graph.overallOrder().map(a=>this.graph.getNodeData(a)),i=this._getNextNode();if(i){const a=this.graph.getNodeData(i),c=e.findIndex(n=>n.payload.uuid===a.payload.uuid);c!==-1&&(e.splice(c,1),e.unshift(a))}return e}getReady(){let e=this.graph.overallOrder(!0).map(i=>this.graph.getNodeData(i));return e=e.sort((i,a)=>i.meta.offline.effect.timestamp.localeCompare(a.meta.offline.effect.timestamp)),e=e.sort((i,a)=>{const c=this.requestAttemptCounter[i.payload.uuid]||0,n=this.requestAttemptCounter[a.payload.uuid]||0;return c-n}),e}registerRetry(e){this.requestAttemptCounter[e]=(this.requestAttemptCounter[e]||0)+1}}let bp;function Fp(t){bp=t}function et(){return bp}let Pp;function _p(t){Pp=t}function Op(){return Pp}let Jc=null;function Ke(){const t=et();if(!t)return console.warn("Client store not set; cannot get outbox coordinator yet."),null;if(Jc)return Jc;const e=t.getState().offline.outbox,i=xe._fromOutbox(e);return Jc=i,i}const rF=(t,e)=>{const i=new e(t);return _p(i),Fp(t),i};class dF{constructor(e){S(this,"_all");S(this,"_previous");this._all=[e],this._previous=e,this.then=this.then.bind(this),this.compile=this.compile.bind(this)}then(e){return this._previous&&(this._previous.next=e),this._all.push(e),this._previous=e,{then:this.then,compile:this.compile}}compile(){return this._all}}class Xc{constructor(){S(this,"next");this.next=null}then(e){return new dF(this).then(e)}async run(e){if(this.next)return this.next.run(e);{if(console.debug("Middleware finished. Performing request:",e),!et())throw new Error("Client store not set");const a=Op();if(!a)throw new Error("Client SDK not set");return Wc(e,a)}}}class Rp extends Xc{async run(e){return super.run(e)}}class vp extends Xc{async run(e){return super.run(e)}}const wp=new Rp().then(new vp).compile();function Mp(t){var e;return(e=wp[0])==null?void 0:e.run(t)}var Vp=(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))(Vp||{});s.ALL_MIDDLEWARE=wp,s.APIError=U,s.ATTACHMENT_MODEL_DEFAULT_PAGE_SIZE=$e,s.AgentService=Zg,s.AssetAttachmentService=Jg,s.AssetProcedureService=sb,s.AssetProcedureStepFieldValuesAttachmentService=nb,s.AssetProcedureStepFieldValuesService=rb,s.AssetProcedureStepFieldsAttachmentService=ab,s.AssetProcedureStepFieldsService=cb,s.AssetProcedureStepService=db,s.AssetProcedureTypeAttachmentService=Xg,s.AssetProcedureTypeFieldValuesAttachmentService=eb,s.AssetProcedureTypeFieldValuesService=tb,s.AssetProcedureTypeFieldsAttachmentService=Qg,s.AssetProcedureTypeFieldsService=xg,s.AssetProcedureTypeService=ib,s.AssetService=ub,s.AssetStageCompletionService=ob,s.AssetStageService=lb,s.AssetTypeAttachmentService=hb,s.AssetTypeFieldValuesAttachmentService=yb,s.AssetTypeFieldValuesService=Ab,s.AssetTypeFieldsAttachmentService=mb,s.AssetTypeFieldsService=pb,s.AssetTypeIdentifierService=fb,s.AssetTypeIdentifierValueService=Sb,s.AssetTypeService=Tb,s.AttachmentModel=an,s.BaseApiService=O,s.BaseSDK=nF,s.COMMON_AUTO_FIELDS=ln,s.CategoryService=Ib,s.DEFAULT_ISSUE_PRIORITY=Lp,s.DEFAULT_ISSUE_STATUS=Gp,s.DEFAULT_PAGE_SIZE=op,s.DeferredPromise=nn,s.DocumentAttachmentService=gb,s.DocumentService=bb,s.EMPTY_ARRAY=en,s.EMPTY_OBJECT=tn,s.EmailVerificationService=Fb,s.FileService=_b,s.FormIdentifierService=Ob,s.FormIdentifierValueService=Rb,s.FormRevisionAttachmentService=vb,s.FormRevisionService=wb,s.FormService=Mb,s.FormSubmissionAttachmentService=Vb,s.FormSubmissionService=Eb,s.GeoImageService=jb,s.HttpMethod=l,s.IssueAssociationService=qb,s.IssueAttachmentService=zb,s.IssueCommentAttachmentService=Ub,s.IssueCommentService=Cb,s.IssuePriority=Xt,s.IssueService=Db,s.IssueStatus=Qt,s.IssueTypeAttachmentService=kb,s.IssueTypeFieldValuesAttachmentService=Gb,s.IssueTypeFieldValuesService=Lb,s.IssueTypeFieldsAttachmentService=Bb,s.IssueTypeFieldsService=$b,s.IssueTypeIdentifierService=Nb,s.IssueTypeIdentifierValueService=Hb,s.IssueTypeService=Wb,s.IssueUpdateChange=V,s.IssueUpdateService=Kb,s.JWTService=Jb,s.OUTBOX_RETRY_DELAY=cn,s.OfflineAnalyticsMiddleware=Rp,s.OfflineMiddleware=Xc,s.OrganizationAccessLevel=sn,s.OrganizationAccessService=Xb,s.OrganizationService=Qb,s.OutboxCoordinator=xe,s.ProjectAccessService=xb,s.ProjectAttachmentService=eF,s.ProjectFileService=tF,s.ProjectService=sF,s.RESET_ORGANIZATION_STATE=_,s.RESET_PROJECT_STATE=M,s.RESET_STATE=b,s.RateLimitingMiddleware=vp,s.SelectorBuilder=qg,s.TeamMembershipService=iF,s.TeamService=aF,s.UNKNOWN_ERROR_MESSAGE=Qe,s.UserService=cF,s.VERSION_REDUCER_KEY=tt,s.VerificationCodeType=Vp,s._setLatestRetryTime=om,s.addAsset=Ks,s.addAssetAttachment=Sy,s.addAssetAttachments=rs,s.addAssetProcedure=bs,s.addAssetProcedureStep=td,s.addAssetProcedureStepFieldValues=$s,s.addAssetProcedureStepFieldValuesAttachment=PA,s.addAssetProcedureStepFieldValuesAttachments=Rt,s.addAssetProcedureStepFieldValuesMany=Kr,s.addAssetProcedureStepFields=qs,s.addAssetProcedureStepFieldsAttachment=dA,s.addAssetProcedureStepFieldsAttachments=wr,s.addAssetProcedureStepFieldsMany=yA,s.addAssetProcedureSteps=sd,s.addAssetProcedureType=vs,s.addAssetProcedureTypeAttachment=gy,s.addAssetProcedureTypeAttachments=jn,s.addAssetProcedureTypeFieldValues=fs,s.addAssetProcedureTypeFieldValuesAttachment=By,s.addAssetProcedureTypeFieldValuesAttachments=_t,s.addAssetProcedureTypeFieldValuesMany=hr,s.addAssetProcedureTypeFields=Qn,s.addAssetProcedureTypeFieldsAttachment=_y,s.addAssetProcedureTypeFieldsAttachments=Nn,s.addAssetProcedureTypeFieldsMany=Ey,s.addAssetProcedureTypes=tA,s.addAssetProcedures=Tr,s.addAssetStage=ni,s.addAssetStageCompletion=ei,s.addAssetStageCompletions=ti,s.addAssetStages=YA,s.addAssetType=Ei,s.addAssetTypeAttachment=ef,s.addAssetTypeAttachments=li,s.addAssetTypeFieldValues=Si,s.addAssetTypeFieldValuesAttachment=Tf,s.addAssetTypeFieldValuesAttachments=zt,s.addAssetTypeFieldValuesMany=au,s.addAssetTypeFields=Nd,s.addAssetTypeFieldsAttachment=af,s.addAssetTypeFieldsAttachments=Ud,s.addAssetTypeFieldsMany=lf,s.addAssetTypeIdentifier=Fi,s.addAssetTypeIdentifierValue=Ri,s.addAssetTypeIdentifierValues=zf,s.addAssetTypeIdentifiers=wf,s.addAssetTypes=Nf,s.addAssets=Vt,s.addCategories=xf,s.addCategory=Ci,s.addConversation=Tn,s.addConversations=ly,s.addDocumentAttachment=nS,s.addDocumentAttachments=Eu,s.addDocuments=Lu,s.addForm=da,s.addFormIdentifier=Ki,s.addFormIdentifierValue=Xi,s.addFormIdentifierValues=IS,s.addFormIdentifiers=pS,s.addFormRevision=ia,s.addFormRevisionAttachment=RS,s.addFormRevisionAttachments=uo,s.addFormRevisions=Ao,s.addFormSubmission=ma,s.addFormSubmissionAttachment=HS,s.addFormSubmissionAttachments=kt,s.addFormSubmissions=Uo,s.addForms=DS,s.addGeoImage=No,s.addGeoImages=Ho,s.addIssue=Ca,s.addIssueAssociation=ga,s.addIssueAssociations=ba,s.addIssueAttachment=cT,s.addIssueAttachments=Ra,s.addIssueComment=Ea,s.addIssueCommentAttachment=dT,s.addIssueCommentAttachments=yl,s.addIssueComments=mT,s.addIssueType=Rh,s.addIssueTypeAttachment=FT,s.addIssueTypeAttachments=zl,s.addIssueTypeFieldValues=Wa,s.addIssueTypeFieldValuesAttachment=ZT,s.addIssueTypeFieldValuesAttachments=Nt,s.addIssueTypeFieldValuesMany=qT,s.addIssueTypeFields=ah,s.addIssueTypeFieldsAttachment=RT,s.addIssueTypeFieldsAttachments=Wl,s.addIssueTypeFieldsMany=BT,s.addIssueTypeIdentifier=ec,s.addIssueTypeIdentifierValue=ac,s.addIssueTypeIdentifierValues=rI,s.addIssueTypeIdentifiers=tI,s.addIssueTypes=pI,s.addIssueUpdate=jh,s.addIssueUpdates=qh,s.addIssues=Ml,s.addOrganization=sm,s.addOrganizationAccess=Jh,s.addOrganizationAccesses=jI,s.addOrganizations=GI,s.addProject=jc,s.addProjectAccess=gc,s.addProjectAccesses=bc,s.addProjectAttachment=tg,s.addProjectAttachments=Sm,s.addProjectFile=cg,s.addProjectFiles=Mm,s.addProjects=hg,s.addTeam=ip,s.addTeamMembership=Ym,s.addTeamMemberships=Zm,s.addTeams=Pg,s.addUser=Lh,s.addUsers=RI,s.agentsReducer=bn,s.agentsSlice=is,s.areArraysEqual=Wp,s.assetAttachmentReducer=Vn,s.assetAttachmentSlice=cs,s.assetProcedureReducer=gr,s.assetProcedureSlice=gs,s.assetProcedureStepFieldValuesAttachmentReducer=Nr,s.assetProcedureStepFieldValuesAttachmentSlice=Ds,s.assetProcedureStepFieldValuesReducer=Xr,s.assetProcedureStepFieldValuesSlice=Bs,s.assetProcedureStepFieldsAttachmentReducer=qr,s.assetProcedureStepFieldsAttachmentSlice=Es,s.assetProcedureStepFieldsReducer=Cr,s.assetProcedureStepFieldsSlice=js,s.assetProcedureStepReducer=cd,s.assetProcedureStepSlice=Ns,s.assetProcedureTypeAttachmentReducer=Dn,s.assetProcedureTypeAttachmentSlice=us,s.assetProcedureTypeFieldValuesAttachmentReducer=nr,s.assetProcedureTypeFieldValuesAttachmentSlice=ps,s.assetProcedureTypeFieldValuesReducer=yr,s.assetProcedureTypeFieldValuesSlice=As,s.assetProcedureTypeFieldsAttachmentReducer=Kn,s.assetProcedureTypeFieldsAttachmentSlice=ls,s.assetProcedureTypeFieldsReducer=tr,s.assetProcedureTypeFieldsSlice=hs,s.assetProcedureTypeReducer=_r,s.assetProcedureTypeSlice=Rs,s.assetReducer=hd,s.assetSlice=Ws,s.assetStageCompletionReducer=fd,s.assetStageCompletionSlice=xs,s.assetStageReducer=Fd,s.assetStageSlice=ci,s.assetTypeAttachmentReducer=jd,s.assetTypeAttachmentSlice=ui,s.assetTypeFieldValuesAttachmentReducer=tu,s.assetTypeFieldValuesAttachmentSlice=yi,s.assetTypeFieldValuesReducer=du,s.assetTypeFieldValuesSlice=fi,s.assetTypeFieldsAttachmentReducer=$d,s.assetTypeFieldsAttachmentSlice=mi,s.assetTypeFieldsReducer=Yd,s.assetTypeFieldsSlice=pi,s.assetTypeIdentifierReducer=mu,s.assetTypeIdentifierSlice=bi,s.assetTypeIdentifierValueReducer=fu,s.assetTypeIdentifierValueSlice=Oi,s.assetTypeReducer=gu,s.assetTypeSlice=Vi,s.authReducer=Pu,s.authSlice=Ct,s.baseReducer=Vg,s.baseReducers=Hc,s.blobToBase64=ty,s.categoryReducer=Mu,s.categorySlice=Ui,s.clearTokens=Jf,s.constructUploadedFilePayloads=ey,s.createModelAdapter=P,s.createOfflineAction=nm,s.createPayload=v,s.createSelectionAdapter=Np,s.deleteAsset=Ys,s.deleteAssetAttachment=On,s.deleteAssetAttachments=ds,s.deleteAssetProcedure=Fs,s.deleteAssetProcedureStep=id,s.deleteAssetProcedureStepFieldValues=Gs,s.deleteAssetProcedureStepFieldValuesAttachment=vA,s.deleteAssetProcedureStepFieldValuesAttachments=vt,s.deleteAssetProcedureStepFieldValuesMany=Zr,s.deleteAssetProcedureStepFields=zs,s.deleteAssetProcedureStepFieldsAttachment=hA,s.deleteAssetProcedureStepFieldsAttachments=Vr,s.deleteAssetProcedureStepFieldsMany=TA,s.deleteAssetProcedureSteps=ad,s.deleteAssetProcedureType=ws,s.deleteAssetProcedureTypeAttachment=Un,s.deleteAssetProcedureTypeAttachments=Cn,s.deleteAssetProcedureTypeFieldValues=Ss,s.deleteAssetProcedureTypeFieldValuesAttachment=Ny,s.deleteAssetProcedureTypeFieldValuesAttachments=Ot,s.deleteAssetProcedureTypeFieldValuesMany=pr,s.deleteAssetProcedureTypeFields=er,s.deleteAssetProcedureTypeFieldsAttachment=wy,s.deleteAssetProcedureTypeFieldsAttachments=Wn,s.deleteAssetProcedureTypeFieldsMany=Uy,s.deleteAssetProcedureTypes=iA,s.deleteAssetProcedures=Ir,s.deleteAssetStage=ri,s.deleteAssetStageCompletion=si,s.deleteAssetStageCompletions=ii,s.deleteAssetStages=JA,s.deleteAssetType=ji,s.deleteAssetTypeAttachment=vd,s.deleteAssetTypeAttachments=hi,s.deleteAssetTypeFieldValues=Ti,s.deleteAssetTypeFieldValuesAttachment=Ff,s.deleteAssetTypeFieldValuesAttachments=Ut,s.deleteAssetTypeFieldValuesMany=nu,s.deleteAssetTypeFields=Wd,s.deleteAssetTypeFieldsAttachment=df,s.deleteAssetTypeFieldsAttachments=Dd,s.deleteAssetTypeFieldsMany=yf,s.deleteAssetTypeIdentifier=Pi,s.deleteAssetTypeIdentifierValue=vi,s.deleteAssetTypeIdentifierValues=kf,s.deleteAssetTypeIdentifiers=jf,s.deleteAssetTypes=Wf,s.deleteAssets=Zs,s.deleteCategories=iS,s.deleteCategory=vu,s.deleteConversation=py,s.deleteConversations=yy,s.deleteDocumentAttachment=zu,s.deleteDocumentAttachments=Uu,s.deleteForm=ua,s.deleteFormIdentifier=Yi,s.deleteFormIdentifierValue=Qi,s.deleteFormIdentifierValues=PS,s.deleteFormIdentifiers=SS,s.deleteFormRevision=aa,s.deleteFormRevisionAttachment=VS,s.deleteFormRevisionAttachments=lo,s.deleteFormRevisions=So,s.deleteFormSubmission=pa,s.deleteFormSubmissionAttachment=ZS,s.deleteFormSubmissionAttachments=Bt,s.deleteFormSubmissions=Do,s.deleteForms=LS,s.deleteGeoImage=Sa,s.deleteGeoImages=Ko,s.deleteIssue=Da,s.deleteIssueAssociation=Fa,s.deleteIssueAssociations=Pa,s.deleteIssueAttachment=dl,s.deleteIssueAttachments=va,s.deleteIssueComment=qa,s.deleteIssueCommentAttachment=Sl,s.deleteIssueCommentAttachments=Tl,s.deleteIssueComments=AT,s.deleteIssueType=fI,s.deleteIssueTypeAttachment=Dl,s.deleteIssueTypeAttachments=kl,s.deleteIssueTypeFieldValues=Ka,s.deleteIssueTypeFieldValuesAttachment=xT,s.deleteIssueTypeFieldValuesAttachments=Ht,s.deleteIssueTypeFieldValuesMany=DT,s.deleteIssueTypeFields=nh,s.deleteIssueTypeFieldsAttachment=VT,s.deleteIssueTypeFieldsAttachments=Yl,s.deleteIssueTypeFieldsMany=NT,s.deleteIssueTypeIdentifier=tc,s.deleteIssueTypeIdentifierValue=cc,s.deleteIssueTypeIdentifierValues=lI,s.deleteIssueTypeIdentifiers=cI,s.deleteIssueTypes=SI,s.deleteIssueUpdate=zh,s.deleteIssueUpdates=Uh,s.deleteIssues=Vl,s.deleteOrganization=NI,s.deleteOrganizationAccess=Xh,s.deleteOrganizationAccesses=CI,s.deleteOrganizations=HI,s.deleteProject=qc,s.deleteProjectAccess=Fc,s.deleteProjectAccesses=Pc,s.deleteProjectAttachment=bm,s.deleteProjectAttachments=wc,s.deleteProjectFile=Vm,s.deleteProjectFiles=Em,s.deleteProjects=pg,s.deleteTeam=Gc,s.deleteTeamMembership=kc,s.deleteTeamMemberships=Xm,s.deleteTeams=Rg,s.deleteUser=Nh,s.deleteUsers=MI,s.dequeue=Sp,s.discard=Ip,s.documentAttachmentReducer=Bu,s.documentAttachmentSlice=Bi,s.documentSlice=Gi,s.documentsReducer=Hu,s.downloadFile=sy,s.downloadInMemoryFile=xp,s.emailRegex=uy,s.enqueue=fp,s.enqueueRequest=dm,s.fallbackToEmptyArray=T,s.fallbackToEmptyObject=Pt,s.fileReducer=Ju,s.fileSlice=Hi,s.fileToBlob=un,s.formIdentifierReducer=to,s.formIdentifierSlice=Wi,s.formIdentifierValueReducer=co,s.formIdentifierValueSlice=Ji,s.formReducer=Fo,s.formRevisionAttachmentReducer=mo,s.formRevisionAttachmentSlice=ta,s.formRevisionReducer=Io,s.formRevisionsSlice=sa,s.formSlice=ra,s.formSubmissionAttachmentReducer=jo,s.formSubmissionAttachmentSlice=oa,s.formSubmissionReducer=Bo,s.formSubmissionSlice=ha,s.geoImageReducer=Jo,s.geoImageSlice=fa,s.getAssetProcedureStepSubTree=An,s.getAssetProcedureStepTrees=oy,s.getClientSDK=Op,s.getClientStore=et,s.getFileIdentifier=Qp,s.getFileS3Key=ss,s.getLocalDateString=rn,s.getLocalRelativeDateString=Jp,s.getOutboxCoordinator=Ke,s.getRenamedFile=dn,s.hashFile=Je,s.initSDK=rF,s.initializeAssetAttachments=ns,s.initializeAssetProcedureStepFieldValues=Wr,s.initializeAssetProcedureStepFieldValuesAttachments=kr,s.initializeAssetProcedureStepFields=Ur,s.initializeAssetProcedureStepFieldsAttachments=vr,s.initializeAssetProcedureSteps=xr,s.initializeAssetProcedureTypeAttachments=os,s.initializeAssetProcedureTypeFieldValues=lr,s.initializeAssetProcedureTypeFieldValuesAttachments=ar,s.initializeAssetProcedureTypeFields=Xn,s.initializeAssetProcedureTypeFieldsAttachments=Ln,s.initializeAssetProcedureTypes=Pr,s.initializeAssetProcedures=Sr,s.initializeAssetStageCompletions=pd,s.initializeAssetStages=gd,s.initializeAssetTypeAttachments=oi,s.initializeAssetTypeFieldValues=iu,s.initializeAssetTypeFieldValuesAttachments=Jd,s.initializeAssetTypeFields=Ld,s.initializeAssetTypeFieldsAttachments=zd,s.initializeAssetTypeIdentifierValues=yu,s.initializeAssetTypeIdentifiers=ou,s.initializeAssetTypes=Tu,s.initializeAssets=ud,s.initializeCategories=Ou,s.initializeConversations=Sn,s.initializeDocumentAttachments=$i,s.initializeFormIdentifierValues=io,s.initializeFormIdentifiers=Qu,s.initializeFormRevisionAttachments=ro,s.initializeFormRevisions=yo,s.initializeFormSubmissionAttachments=vo,s.initializeFormSubmissions=zo,s.initializeForms=bo,s.initializeGeoImages=Go,s.initializeIssueAssociations=Qo,s.initializeIssueAttachments=Oa,s.initializeIssueCommentAttachments=Ma,s.initializeIssueComments=hT,s.initializeIssueTypeAttachments=La,s.initializeIssueTypeFieldValues=xl,s.initializeIssueTypeFieldValuesAttachments=oh,s.initializeIssueTypeFields=ih,s.initializeIssueTypeFieldsAttachments=Hl,s.initializeIssueTypeIdentifierValues=bh,s.initializeIssueTypeIdentifiers=fh,s.initializeIssueTypes=Oh,s.initializeIssueUpdates=Eh,s.initializeIssues=wl,s.initializeOrganizationAccesses=Zh,s.initializeOrganizations=tm,s.initializeProjectAccesses=mm,s.initializeProjectAttachments=vc,s.initializeProjectFiles=wm,s.initializeProjects=Bm,s.initializeTeamMemberships=Km,s.initializeTeams=sp,s.initializeUsers=Gh,s.isToday=Zp,s.issueAssociationReducer=al,s.issueAssociationSlice=Ia,s.issueAttachmentReducer=ml,s.issueAttachmentSlice=_a,s.issueCommentAttachmentReducer=Fl,s.issueCommentAttachmentSlice=wa,s.issueCommentReducer=Rl,s.issueCommentSlice=Va,s.issueReducer=jl,s.issueSlice=Ua,s.issueTypeAttachmentReducer=Ll,s.issueTypeAttachmentSlice=Ga,s.issueTypeFieldValuesAttachmentReducer=yh,s.issueTypeFieldValuesAttachmentSlice=Xa,s.issueTypeFieldValuesReducer=th,s.issueTypeFieldValuesSlice=Ha,s.issueTypeFieldsAttachmentReducer=Xl,s.issueTypeFieldsAttachmentSlice=Na,s.issueTypeFieldsReducer=dh,s.issueTypeFieldsSlice=Ja,s.issueTypeIdentifierReducer=Ih,s.issueTypeIdentifierSlice=xa,s.issueTypeIdentifierValueReducer=Ph,s.issueTypeIdentifierValueSlice=ic,s.issueTypeReducer=Mh,s.issueTypeSlice=dc,s.issueUpdateReducer=Bh,s.issueUpdateSlice=hc,s.logOnlyOnce=iy,s.markAsDeleted=um,s.markForDeletion=JI,s.memoize=es,s.onlyUniqueHashes=dy,s.onlyUniqueOfflineIds=pn,s.organizationAccessReducer=Qh,s.organizationAccessSlice=yc,s.organizationReducer=cm,s.organizationSlice=Sc,s.outboxReducer=lm,s.outboxSlice=Tc,s.overmapEnhancer=Gg,s.overmapReducer=Eg,s.overmapReducers=up,s.performRequest=Wc,s.projectAccessReducer=ym,s.projectAccessSlice=Ic,s.projectAttachmentReducer=Rm,s.projectAttachmentSlice=Rc,s.projectFileReducer=Dm,s.projectFileSlice=Mc,s.projectReducer=Gm,s.projectSlice=Ec,s.rehydratedReducer=Hm,s.rehydratedSlice=Uc,s.removeDocuments=Li,s.removeIssueType=uc,s.restructureCreateSelectorWithArgs=f,s.runMiddleware=Mp,s.saveActiveProjectFileBounds=zm,s.selectAccessToken=Xf,s.selectAccessesByUserOfProject=xI,s.selectAccessibleProjects=yg,s.selectActiveOrganizationAccess=DI,s.selectActiveProjectFileId=dg,s.selectAllDocumentAttachments=Du,s.selectAllProjectAttachments=Pm,s.selectAssetAttachmentById=wn,s.selectAssetAttachmentMapping=Rn,s.selectAssetAttachments=vn,s.selectAssetById=Qs,s.selectAssetProcedureById=Os,s.selectAssetProcedureStepById=Hs,s.selectAssetProcedureStepFieldValues=wt,s.selectAssetProcedureStepFieldValuesAttachmentById=wA,s.selectAssetProcedureStepFieldValuesAttachments=$r,s.selectAssetProcedureStepFieldValuesAttachmentsByIds=Gr,s.selectAssetProcedureStepFieldValuesAttachmentsMapping=ks,s.selectAssetProcedureStepFieldValuesById=Ls,s.selectAssetProcedureStepFieldValuesMapping=Jr,s.selectAssetProcedureStepFieldValuesOfAsset=EA,s.selectAssetProcedureStepFieldValuesOfAssetProcedure=jA,s.selectAssetProcedureStepFieldValuesOfAssetProcedureStep=qA,s.selectAssetProcedureStepFields=Cs,s.selectAssetProcedureStepFieldsAttachmentById=pA,s.selectAssetProcedureStepFieldsAttachments=jr,s.selectAssetProcedureStepFieldsAttachmentsMapping=Er,s.selectAssetProcedureStepFieldsById=FA,s.selectAssetProcedureStepFieldsMapping=Us,s.selectAssetProcedureStepFieldsOfAssetProcedureStep=IA,s.selectAssetProcedureStepMapping=rt,s.selectAssetProcedureSteps=nd,s.selectAssetProcedureStepsByIds=kA,s.selectAssetProcedureStepsMappingOfAssetProcedureType=CA,s.selectAssetProcedureStepsOfAssetProcedureType=DA,s.selectAssetProcedureTypeAttachmentById=$n,s.selectAssetProcedureTypeAttachmentMapping=kn,s.selectAssetProcedureTypeAttachments=Bn,s.selectAssetProcedureTypeById=Vs,s.selectAssetProcedureTypeFieldValues=Ts,s.selectAssetProcedureTypeFieldValuesAttachmentById=Hy,s.selectAssetProcedureTypeFieldValuesAttachments=rr,s.selectAssetProcedureTypeFieldValuesAttachmentsByIds=dr,s.selectAssetProcedureTypeFieldValuesAttachmentsMapping=ys,s.selectAssetProcedureTypeFieldValuesById=Is,s.selectAssetProcedureTypeFieldValuesMapping=Ar,s.selectAssetProcedureTypeFieldValuesOfAsset=Yy,s.selectAssetProcedureTypeFields=ms,s.selectAssetProcedureTypeFieldsAttachmentById=Vy,s.selectAssetProcedureTypeFieldsAttachments=Zn,s.selectAssetProcedureTypeFieldsAttachmentsMapping=Yn,s.selectAssetProcedureTypeFieldsById=ky,s.selectAssetProcedureTypeFieldsMapping=sr,s.selectAssetProcedureTypeFieldsOfAssetProcedureType=Cy,s.selectAssetProcedureTypes=Or,s.selectAssetProcedureTypesByIds=nA,s.selectAssetProcedureTypesMapping=Ms,s.selectAssetProcedureTypesOfOrganization=rA,s.selectAssetProcedures=_s,s.selectAssetProceduresByIds=eA,s.selectAssetProceduresMapping=Ps,s.selectAssetProceduresOfAssetProcedureType=br,s.selectAssetProceduresOfAssetType=xy,s.selectAssetStageById=di,s.selectAssetStageCompletionById=Sd,s.selectAssetStageCompletionMapping=ai,s.selectAssetStageCompletions=WA,s.selectAssetStageCompletionsByIds=Td,s.selectAssetStages=Pd,s.selectAssetStagesByIds=xA,s.selectAssetStagesMappingOfAssetProcedureType=XA,s.selectAssetStagesOfAssetProcedureType=QA,s.selectAssetTypeAttachmentById=Vd,s.selectAssetTypeAttachmentMapping=wd,s.selectAssetTypeAttachments=Md,s.selectAssetTypeById=zi,s.selectAssetTypeFieldValues=Ii,s.selectAssetTypeFieldValuesAttachmentById=Pf,s.selectAssetTypeFieldValuesAttachments=Qd,s.selectAssetTypeFieldValuesAttachmentsByIds=xd,s.selectAssetTypeFieldValuesAttachmentsMapping=Ai,s.selectAssetTypeFieldValuesById=gi,s.selectAssetTypeFieldValuesMapping=ru,s.selectAssetTypeFieldValuesOfAsset=Rf,s.selectAssetTypeFields=qt,s.selectAssetTypeFieldsAttachmentById=of,s.selectAssetTypeFieldsAttachments=Bd,s.selectAssetTypeFieldsAttachmentsMapping=kd,s.selectAssetTypeFieldsById=Sf,s.selectAssetTypeFieldsMapping=Kd,s.selectAssetTypeFieldsOfAssetType=Af,s.selectAssetTypeIdentifierById=_i,s.selectAssetTypeIdentifierMapping=lu,s.selectAssetTypeIdentifierValueById=Mi,s.selectAssetTypeIdentifierValueMapping=Au,s.selectAssetTypeIdentifierValues=wi,s.selectAssetTypeIdentifierValuesOfAsset=Bf,s.selectAssetTypeIdentifierValuesOfIdentifier=$f,s.selectAssetTypeIdentifiers=hu,s.selectAssetTypeIdentifiersOfAssetType=qf,s.selectAssetTypeValuesOfAssetType=vf,s.selectAssetTypes=Iu,s.selectAssetTypesByIds=Kf,s.selectAssetTypesMapping=qi,s.selectAssetTypesOfOrganization=Yf,s.selectAssets=od,s.selectAssetsByIds=ld,s.selectAssetsMapping=Js,s.selectAssetsOfAssetType=Xs,s.selectAttachmentsOfAsset=Mn,s.selectAttachmentsOfAssetProcedureStepFieldValues=Lr,s.selectAttachmentsOfAssetProcedureStepFields=mA,s.selectAttachmentsOfAssetProcedureType=Py,s.selectAttachmentsOfAssetProcedureTypeFieldValues=ur,s.selectAttachmentsOfAssetProcedureTypeFields=My,s.selectAttachmentsOfAssetType=Ed,s.selectAttachmentsOfAssetTypeFieldValues=eu,s.selectAttachmentsOfAssetTypeFields=uf,s.selectAttachmentsOfDocument=uS,s.selectAttachmentsOfFormRevision=ES,s.selectAttachmentsOfFormSubmission=Eo,s.selectAttachmentsOfIssue=ll,s.selectAttachmentsOfIssueComment=lT,s.selectAttachmentsOfIssueType=OT,s.selectAttachmentsOfIssueTypeFieldValues=ph,s.selectAttachmentsOfIssueTypeFields=ET,s.selectAttachmentsOfProject=Om,s.selectCategories=wu,s.selectCategoriesByIds=aS,s.selectCategoriesOfProject=cS,s.selectCategoryById=ki,s.selectCategoryMapping=Di,s.selectCommentsOfIssue=fT,s.selectConversation=fy,s.selectConversationMapping=as,s.selectConversations=Ay,s.selectCurrentUser=Wh,s.selectDeletedRequests=YI,s.selectDescendantsOfAssetProcedureStep=rd,s.selectDocumentAttachmentById=ku,s.selectDocumentAttachmentMapping=Cu,s.selectDocumentById=Nu,s.selectDocuments=Ni,s.selectDocumentsByIds=oS,s.selectDocumentsMapping=Dt,s.selectFieldValuesOfAssetProcedure=Zy,s.selectFormById=Oo,s.selectFormIdentifierById=Zi,s.selectFormIdentifierMapping=xu,s.selectFormIdentifierValueById=ea,s.selectFormIdentifierValueMapping=ao,s.selectFormIdentifierValues=xi,s.selectFormIdentifierValuesOfFormSubmission=_S,s.selectFormIdentifierValuesOfIdentifier=OS,s.selectFormIdentifiers=eo,s.selectFormIdentifiersOfForm=TS,s.selectFormMapping=Po,s.selectFormRevisionAttachmentsMapping=ho,s.selectFormRevisionById=US,s.selectFormRevisionMapping=ca,s.selectFormRevisions=na,s.selectFormRevisionsOfForm=To,s.selectFormSubmissionAttachemntsByIds=Vo,s.selectFormSubmissionAttachments=la,s.selectFormSubmissionAttachmentsMapping=Mo,s.selectFormSubmissionById=Aa,s.selectFormSubmissions=QS,s.selectFormSubmissionsMapping=ya,s.selectFormSubmissionsOfForm=ko,s.selectForms=_o,s.selectFormsOfOrganization=NS,s.selectGeoImageById=Ta,s.selectGeoImageMapping=Yo,s.selectGeoImages=Zo,s.selectGeoImagesOfProject=eT,s.selectIsImportingProjectFile=ug,s.selectIsLoggedIn=Qf,s.selectIssueAssociationById=el,s.selectIssueAssociationMapping=At,s.selectIssueAssociations=aT,s.selectIssueAssociationsOfAsset=il,s.selectIssueAssociationsOfIssue=sl,s.selectIssueAssociationsToIssue=tl,s.selectIssueAttachmentById=hl,s.selectIssueAttachmentMapping=ul,s.selectIssueAttachments=ol,s.selectIssueById=$a,s.selectIssueCommentAttachmentById=bl,s.selectIssueCommentAttachmentMapping=Il,s.selectIssueCommentAttachments=gl,s.selectIssueCommentById=za,s.selectIssueCommentMapping=Ol,s.selectIssueMapping=ka,s.selectIssueTypeAttachmentById=Gl,s.selectIssueTypeAttachmentMapping=Bl,s.selectIssueTypeAttachments=$l,s.selectIssueTypeById=lc,s.selectIssueTypeFieldValues=Ya,s.selectIssueTypeFieldValuesAttachmentById=eI,s.selectIssueTypeFieldValuesAttachments=Qa,s.selectIssueTypeFieldValuesAttachmentsByIds=mh,s.selectIssueTypeFieldValuesAttachmentsMapping=hh,s.selectIssueTypeFieldValuesById=Za,s.selectIssueTypeFieldValuesMapping=eh,s.selectIssueTypeFieldValuesOfIssue=kT,s.selectIssueTypeFields=Lt,s.selectIssueTypeFieldsAttachmentById=jT,s.selectIssueTypeFieldsAttachments=Jl,s.selectIssueTypeFieldsAttachmentsMapping=Zl,s.selectIssueTypeFieldsById=YT,s.selectIssueTypeFieldsMapping=rh,s.selectIssueTypeFieldsOfIssueType=HT,s.selectIssueTypeIdentifierById=sc,s.selectIssueTypeIdentifierMapping=Sh,s.selectIssueTypeIdentifierValueById=rc,s.selectIssueTypeIdentifierValueMapping=Fh,s.selectIssueTypeIdentifierValues=nc,s.selectIssueTypeIdentifierValuesOfIdentifier=mI,s.selectIssueTypeIdentifierValuesOfIssue=hI,s.selectIssueTypeIdentifiers=Th,s.selectIssueTypeIdentifiersOfIssueType=nI,s.selectIssueTypeMapping=oc,s.selectIssueTypeValuesOfIssueType=KT,s.selectIssueTypes=wh,s.selectIssueTypesByIds=TI,s.selectIssueTypesOfOrganization=II,s.selectIssueUpdateMapping=Ch,s.selectIssueUpdates=Dh,s.selectIssueUpdatesOfIssue=kh,s.selectIssues=Ba,s.selectIssuesByIds=gT,s.selectIssuesOfIssueType=El,s.selectIssuesOfProject=bT,s.selectLatestAssetProcedureStepFieldsOfAssetProcedureStep=gA,s.selectLatestAssetProcedureTypeFieldsOfAssetProcedureType=Dy,s.selectLatestAssetTypeFieldsOfAssetType=ff,s.selectLatestFieldsByAssetProcedureStep=bA,s.selectLatestFormRevisionOfForm=CS,s.selectLatestIssueTypeFieldsOfIssueType=WT,s.selectLatestRetryTime=ZI,s.selectMembershipsByUserOfTeam=bg,s.selectNumberOfAssetsOfAssetType=LA,s.selectOrganizationAccessById=fc,s.selectOrganizationAccessMapping=Ac,s.selectOrganizationAccessUserMapping=xh,s.selectOrganizationById=KI,s.selectOrganizationDocuments=hS,s.selectOrganizations=WI,s.selectOrganizationsMapping=am,s.selectProjectAccessById=Oc,s.selectProjectAccessMapping=_c,s.selectProjectAccesses=Yt,s.selectProjectAccessesOfProject=Am,s.selectProjectAttachmentById=_m,s.selectProjectAttachmentMapping=Fm,s.selectProjectById=Nm,s.selectProjectDocuments=lS,s.selectProjectFileById=rg,s.selectProjectFileMapping=Um,s.selectProjectFiles=Cm,s.selectProjectMapping=Lm,s.selectProjects=zc,s.selectProjectsOfOrganization=Ag,s.selectRehydrated=Tg,s.selectStageMapping=jt,s.selectTeamById=Nc,s.selectTeamMembershipById=ep,s.selectTeamMemberships=Bc,s.selectTeamMembershipsMapping=xm,s.selectTeams=cp,s.selectTeamsByIds=vg,s.selectTeamsMapping=Lc,s.selectTeamsOfOrganization=wg,s.selectUploadUrl=Zu,s.selectUserById=Kh,s.selectUsers=pc,s.selectUsersByIds=EI,s.selectUsersMapping=Wt,s.selectUsersOfOrganization=kI,s.selectUsersOfProject=eg,s.selectUsersOfTeam=Fg,s.setActiveProjectFileId=qm,s.setAsset=$A,s.setAssetAttachment=Pn,s.setAssetAttachments=Ty,s.setAssetProcedure=Xy,s.setAssetProcedureStep=ed,s.setAssetProcedureStepFieldValues=MA,s.setAssetProcedureStepFieldValuesAttachment=_A,s.setAssetProcedureStepFieldValuesAttachments=OA,s.setAssetProcedureStepFieldValuesMany=VA,s.setAssetProcedureStepFields=AA,s.setAssetProcedureStepFieldsAttachment=uA,s.setAssetProcedureStepFieldsAttachments=oA,s.setAssetProcedureStepFieldsMany=fA,s.setAssetProcedureSteps=zA,s.setAssetProcedureType=aA,s.setAssetProcedureTypeAttachment=qn,s.setAssetProcedureTypeAttachments=by,s.setAssetProcedureTypeFieldValues=Wy,s.setAssetProcedureTypeFieldValuesAttachment=$y,s.setAssetProcedureTypeFieldValuesAttachments=Gy,s.setAssetProcedureTypeFieldValuesMany=Ky,s.setAssetProcedureTypeFields=jy,s.setAssetProcedureTypeFieldsAttachment=Oy,s.setAssetProcedureTypeFieldsAttachments=Ry,s.setAssetProcedureTypeFieldsMany=qy,s.setAssetProcedureTypes=cA,s.setAssetProcedures=Qy,s.setAssetStage=bd,s.setAssetStageCompletion=NA,s.setAssetStageCompletions=HA,s.setAssetStages=KA,s.setAssetType=Gf,s.setAssetTypeAttachment=Od,s.setAssetTypeAttachments=tf,s.setAssetTypeFieldValues=_f,s.setAssetTypeFieldValuesAttachment=If,s.setAssetTypeFieldValuesAttachments=gf,s.setAssetTypeFieldValuesMany=Of,s.setAssetTypeFields=hf,s.setAssetTypeFieldsAttachment=cf,s.setAssetTypeFieldsAttachments=nf,s.setAssetTypeFieldsMany=mf,s.setAssetTypeIdentifier=Mf,s.setAssetTypeIdentifierValue=Uf,s.setAssetTypeIdentifierValues=Cf,s.setAssetTypeIdentifiers=Vf,s.setAssetTypes=Lf,s.setAssets=GA,s.setCategories=tS,s.setCategory=eS,s.setClientSDK=_p,s.setClientStore=Fp,s.setConversation=In,s.setConversations=hy,s.setCurrentUser=VI,s.setDocumentAttachment=ju,s.setDocumentAttachments=rS,s.setDocuments=Gu,s.setForm=kS,s.setFormIdentifier=yS,s.setFormIdentifierValue=gS,s.setFormIdentifierValues=bS,s.setFormIdentifiers=AS,s.setFormRevision=fo,s.setFormRevisionAttachment=vS,s.setFormRevisionAttachments=wS,s.setFormRevisions=jS,s.setFormSubmission=$t,s.setFormSubmissionAttachment=WS,s.setFormSubmissionAttachments=KS,s.setFormSubmissions=JS,s.setForms=BS,s.setGeoImage=yt,s.setGeoImages=Lo,s.setIsImportingProjectFile=jm,s.setIssue=ST,s.setIssueAssociation=sT,s.setIssueAssociations=tT,s.setIssueAttachment=nl,s.setIssueAttachments=nT,s.setIssueComment=ja,s.setIssueCommentAttachment=Al,s.setIssueCommentAttachments=uT,s.setIssueComments=_l,s.setIssueType=It,s.setIssueTypeAttachment=Ul,s.setIssueTypeAttachments=PT,s.setIssueTypeFieldValues=zT,s.setIssueTypeFieldValuesAttachment=JT,s.setIssueTypeFieldValuesAttachments=XT,s.setIssueTypeFieldValuesMany=UT,s.setIssueTypeFields=$T,s.setIssueTypeFieldsAttachment=vT,s.setIssueTypeFieldsAttachments=wT,s.setIssueTypeFieldsMany=GT,s.setIssueTypeIdentifier=sI,s.setIssueTypeIdentifierValue=dI,s.setIssueTypeIdentifierValues=uI,s.setIssueTypeIdentifiers=iI,s.setIssueTypes=yI,s.setIssueUpdate=gI,s.setIssueUpdates=bI,s.setIssues=TT,s.setLoggedIn=Fu,s.setOrganization=$I,s.setOrganizationAccess=qI,s.setOrganizationAccesses=zI,s.setOrganizations=BI,s.setProject=lg,s.setProjectAccess=XI,s.setProjectAccesses=QI,s.setProjectAttachment=Tm,s.setProjectAttachments=Im,s.setProjectFile=ig,s.setProjectFiles=ag,s.setProjects=og,s.setRehydrated=Sg,s.setTeam=bt,s.setTeamMembership=Dc,s.setTeamMemberships=Jm,s.setTeams=_g,s.setTokens=Zf,s.setUploadUrl=Yu,s.setUser=OI,s.setUsers=_I,s.shallowEqual=Hp,s.slugify=ny,s.spacesToDashesLower=cy,s.teamMembershipReducer=Qm,s.teamMembershipSlice=Cc,s.teamReducer=np,s.teamSlice=$c,s.toFileNameSafeString=ay,s.toUuidArray=mn,s.toUuidIdRecord=hn,s.truncate=ry,s.updateAsset=dt,s.updateAssetAttachment=Iy,s.updateAssetAttachments=_n,s.updateAssetProcedure=it,s.updateAssetProcedureStep=Mt,s.updateAssetProcedureStepFieldValues=nt,s.updateAssetProcedureStepFieldValuesAttachment=RA,s.updateAssetProcedureStepFieldValuesAttachments=Br,s.updateAssetProcedureStepFieldValuesMany=Yr,s.updateAssetProcedureStepFields=ct,s.updateAssetProcedureStepFieldsAttachment=lA,s.updateAssetProcedureStepFieldsAttachments=Mr,s.updateAssetProcedureStepFieldsMany=SA,s.updateAssetProcedureSteps=UA,s.updateAssetProcedureType=at,s.updateAssetProcedureTypeAttachment=Fy,s.updateAssetProcedureTypeAttachments=zn,s.updateAssetProcedureTypeFieldValues=st,s.updateAssetProcedureTypeFieldValuesAttachment=Ly,s.updateAssetProcedureTypeFieldValuesAttachments=cr,s.updateAssetProcedureTypeFieldValuesMany=mr,s.updateAssetProcedureTypeFields=xn,s.updateAssetProcedureTypeFieldsAttachment=vy,s.updateAssetProcedureTypeFieldsAttachments=Hn,s.updateAssetProcedureTypeFieldsMany=zy,s.updateAssetProcedureTypes=sA,s.updateAssetProcedures=Jy,s.updateAssetStage=Et,s.updateAssetStageCompletion=yd,s.updateAssetStageCompletions=Ad,s.updateAssetStages=ZA,s.updateAssetType=ht,s.updateAssetTypeAttachment=sf,s.updateAssetTypeAttachments=Rd,s.updateAssetTypeFieldValues=ut,s.updateAssetTypeFieldValuesAttachment=bf,s.updateAssetTypeFieldValuesAttachments=Xd,s.updateAssetTypeFieldValuesMany=cu,s.updateAssetTypeFields=Hd,s.updateAssetTypeFieldsAttachment=rf,s.updateAssetTypeFieldsAttachments=Cd,s.updateAssetTypeFieldsMany=pf,s.updateAssetTypeIdentifier=ot,s.updateAssetTypeIdentifierValue=lt,s.updateAssetTypeIdentifierValues=Df,s.updateAssetTypeIdentifiers=Ef,s.updateAssetTypes=Hf,s.updateAssets=BA,s.updateCategories=sS,s.updateCategory=Ru,s.updateConversation=gn,s.updateConversations=my,s.updateDocumentAttachment=dS,s.updateDocumentAttachments=qu,s.updateDocuments=Xe,s.updateForm=$S,s.updateFormIdentifier=mt,s.updateFormIdentifierValue=pt,s.updateFormIdentifierValues=FS,s.updateFormIdentifiers=fS,s.updateFormRevision=qS,s.updateFormRevisionAttachment=MS,s.updateFormRevisionAttachments=oo,s.updateFormRevisions=zS,s.updateFormSubmission=Co,s.updateFormSubmissionAttachment=YS,s.updateFormSubmissionAttachments=wo,s.updateFormSubmissions=XS,s.updateForms=GS,s.updateGeoImage=Wo,s.updateGeoImages=xS,s.updateIssue=Gt,s.updateIssueAssociation=xo,s.updateIssueAssociations=iT,s.updateIssueAttachment=rT,s.updateIssueAttachments=rl,s.updateIssueComment=pT,s.updateIssueCommentAttachment=oT,s.updateIssueCommentAttachments=fl,s.updateIssueComments=yT,s.updateIssueType=vh,s.updateIssueTypeAttachment=_T,s.updateIssueTypeAttachments=Cl,s.updateIssueTypeFieldValues=ft,s.updateIssueTypeFieldValuesAttachment=QT,s.updateIssueTypeFieldValuesAttachments=lh,s.updateIssueTypeFieldValuesMany=CT,s.updateIssueTypeFields=ch,s.updateIssueTypeFieldsAttachment=MT,s.updateIssueTypeFieldsAttachments=Kl,s.updateIssueTypeFieldsMany=LT,s.updateIssueTypeIdentifier=St,s.updateIssueTypeIdentifierValue=Tt,s.updateIssueTypeIdentifierValues=oI,s.updateIssueTypeIdentifiers=aI,s.updateIssueTypes=AI,s.updateIssueUpdate=FI,s.updateIssueUpdates=PI,s.updateIssues=IT,s.updateOrganization=im,s.updateOrganizationAccess=Kt,s.updateOrganizationAccesses=UI,s.updateOrganizations=LI,s.updateProject=$m,s.updateProjectAccess=gt,s.updateProjectAccesses=pm,s.updateProjectAttachment=sg,s.updateProjectAttachments=gm,s.updateProjectFile=Vc,s.updateProjectFiles=ng,s.updateProjects=mg,s.updateTeam=ap,s.updateTeamMembership=Ig,s.updateTeamMemberships=gg,s.updateTeams=Og,s.updateUser=wI,s.updateUsers=vI,s.useSelectorBuilder=jg,s.userReducer=Hh,s.userSlice=mc,s.uuidObj=F,s.versioningReducer=dp,s.versioningSlice=rp,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});