@overmap-ai/core 1.0.78-workflows.3 → 1.0.78-workflows.5

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 (62) hide show
  1. package/dist/enums/issue.d.ts +0 -1
  2. package/dist/overmap-core.js +5366 -5531
  3. package/dist/overmap-core.umd.cjs +9 -9
  4. package/dist/sdk/services/IssueUpdateService.d.ts +0 -2
  5. package/dist/sdk/services/WorkflowStepEventService.d.ts +0 -1
  6. package/dist/sdk/services/index.d.ts +0 -1
  7. package/dist/store/reducers.d.ts +0 -3
  8. package/dist/store/slices/assetProcedureSlice.d.ts +0 -1
  9. package/dist/store/slices/assetProcedureStepFieldValuesAttachmentSlice.d.ts +0 -1
  10. package/dist/store/slices/assetProcedureStepFieldValuesSlice.d.ts +0 -1
  11. package/dist/store/slices/assetProcedureStepFieldsAttachmentSlice.d.ts +0 -1
  12. package/dist/store/slices/assetProcedureStepFieldsSlice.d.ts +0 -2
  13. package/dist/store/slices/assetProcedureStepSlice.d.ts +0 -1
  14. package/dist/store/slices/assetProcedureTypeAttachmentSlice.d.ts +0 -1
  15. package/dist/store/slices/assetProcedureTypeFieldValuesAttachmentSlice.d.ts +0 -1
  16. package/dist/store/slices/assetProcedureTypeFieldValuesSlice.d.ts +0 -1
  17. package/dist/store/slices/assetProcedureTypeFieldsAttachmentSlice.d.ts +0 -1
  18. package/dist/store/slices/assetSlice.d.ts +0 -1
  19. package/dist/store/slices/assetStageCompletionSlice.d.ts +0 -1
  20. package/dist/store/slices/assetStageSlice.d.ts +0 -1
  21. package/dist/store/slices/assetTypeFieldValuesAttachmentSlice.d.ts +0 -1
  22. package/dist/store/slices/assetTypeFieldValuesSlice.d.ts +0 -1
  23. package/dist/store/slices/assetTypeFieldsAttachmentSlice.d.ts +0 -1
  24. package/dist/store/slices/assetTypeFieldsSlice.d.ts +0 -1
  25. package/dist/store/slices/assetTypeStatusSlice.d.ts +0 -1
  26. package/dist/store/slices/emailDomainsSlice.d.ts +0 -1
  27. package/dist/store/slices/formRevisionAttachmentSlice.d.ts +0 -1
  28. package/dist/store/slices/formRevisionSlice.d.ts +0 -1
  29. package/dist/store/slices/formSlice.d.ts +0 -1
  30. package/dist/store/slices/geoImageSlice.d.ts +0 -1
  31. package/dist/store/slices/index.d.ts +0 -1
  32. package/dist/store/slices/issueAssociationSlice.d.ts +0 -1
  33. package/dist/store/slices/issueTypeFieldValuesAttachmentSlice.d.ts +0 -1
  34. package/dist/store/slices/issueTypeFieldValuesSlice.d.ts +0 -1
  35. package/dist/store/slices/issueTypeFieldsAttachmentSlice.d.ts +0 -1
  36. package/dist/store/slices/issueTypeFieldsSlice.d.ts +0 -1
  37. package/dist/store/slices/issueTypeStatusSlice.d.ts +0 -1
  38. package/dist/store/slices/issueUpdateSlice.d.ts +0 -3
  39. package/dist/store/slices/organizationSlice.d.ts +0 -1
  40. package/dist/store/slices/projectFileSlice.d.ts +0 -1
  41. package/dist/store/slices/projectSlice.d.ts +0 -1
  42. package/dist/store/slices/userSlice.d.ts +0 -1
  43. package/dist/store/slices/workflowStepAssigneeSlice.d.ts +0 -1
  44. package/dist/store/slices/workflowStepCommentSlice.d.ts +0 -1
  45. package/dist/store/slices/workflowStepCompletionSlice.d.ts +0 -1
  46. package/dist/store/slices/workflowStepEventSlice.d.ts +0 -1
  47. package/dist/store/slices/workflowStepFieldValuesAttachmentSlice.d.ts +0 -1
  48. package/dist/store/slices/workflowStepFieldValuesSlice.d.ts +0 -1
  49. package/dist/store/slices/workflowStepFieldsAttachmentSlice.d.ts +0 -1
  50. package/dist/store/slices/workflowStepFieldsSlice.d.ts +0 -2
  51. package/dist/store/slices/workflowStepReviewRequestSlice.d.ts +0 -1
  52. package/dist/store/slices/workflowStepReviewSlice.d.ts +0 -1
  53. package/dist/store/slices/workflowStepReviewerSlice.d.ts +0 -1
  54. package/dist/store/slices/workflowStepSlice.d.ts +0 -1
  55. package/dist/typings/models/base.d.ts +4 -1
  56. package/dist/typings/models/index.d.ts +0 -1
  57. package/dist/typings/models/issues.d.ts +3 -10
  58. package/dist/typings/models/projects.d.ts +4 -4
  59. package/package.json +1 -1
  60. package/dist/sdk/services/CategoryService.d.ts +0 -28
  61. package/dist/store/slices/categorySlice.d.ts +0 -127
  62. package/dist/typings/models/categories.d.ts +0 -7
@@ -1,15 +1,15 @@
1
- (function(i,$){typeof exports=="object"&&typeof module<"u"?$(exports,require("@redux-offline/redux-offline/lib/types"),require("@reduxjs/toolkit"),require("superagent"),require("uuid"),require("react"),require("file-saver"),require("fast-tree-builder"),require("ts-tree-lib"),require("@redux-offline/redux-offline"),require("@redux-offline/redux-offline/lib/defaults"),require("localforage"),require("redux-persist-migrate"),require("buffer"),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","react","file-saver","fast-tree-builder","ts-tree-lib","@redux-offline/redux-offline","@redux-offline/redux-offline/lib/defaults","localforage","redux-persist-migrate","buffer","@overmap-ai/forms","idb","jwt-decode","dependency-graph","@tiptap/core"],$):(i=typeof globalThis<"u"?globalThis:i||self,$(i["overmap-core"]={},null,i.toolkit,i.request,i.uuid,i.react,i.fileSaver,i.buildTree,i.tsTreeLib,i.reduxOffline,i.offlineConfig,i.localforage,i.createMigration,null,null,i.idb,i.jwtDecode,i.dependencyGraph))})(this,function(i,$,u,St,mt,_b,Rb,dc,Et,Mb,lc,kb,vb,xk,ev,Eb,Vb,Wb){"use strict";var Qk=Object.defineProperty;var Xk=(i,$,u)=>$ in i?Qk(i,$,{enumerable:!0,configurable:!0,writable:!0,value:u}):i[$]=u;var m=(i,$,u)=>Xk(i,typeof $!="symbol"?$+"":$,u);var gb;const oc=Object.freeze([]),uc=Object.freeze({});var hc=(t=>(t[t.GUEST=0]="GUEST",t[t.BASIC=2]="BASIC",t[t.ADMIN=4]="ADMIN",t))(hc||{}),p=(t=>(t.GET="GET",t.POST="POST",t.PATCH="PATCH",t.PUT="PUT",t.DELETE="DELETE",t))(p||{}),pc=(t=>(t[t.PLANNED=0]="PLANNED",t[t.ACTIVE=1]="ACTIVE",t[t.MAINTENANCE=2]="MAINTENANCE",t[t.INACTIVE=3]="INACTIVE",t[t.RETIRED=4]="RETIRED",t[t.DISPOSED=5]="DISPOSED",t))(pc||{}),mc=(t=>(t.Issue="issue",t.Asset="asset",t.AssetType="asset_type",t.Project="project",t.Document="document",t))(mc||{}),ys=(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))(ys||{}),j=(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))(j||{}),yc=(t=>(t[t.BACKLOG=0]="BACKLOG",t[t.PLANNED=1]="PLANNED",t[t.IN_PROGRESS=2]="IN_PROGRESS",t[t.COMPLETED=3]="COMPLETED",t[t.CANCELLED=4]="CANCELLED",t))(yc||{}),fc=(t=>(t[t.COMMENT=0]="COMMENT",t[t.APPROVE=2]="APPROVE",t[t.DENY=4]="DENY",t))(fc||{}),Sc=(t=>(t[t.ADD_ASSIGNEE=0]="ADD_ASSIGNEE",t[t.REMOVE_ASSIGNEE=1]="REMOVE_ASSIGNEE",t[t.ADD_REVIEWER=2]="ADD_REVIEWER",t[t.REMOVE_REVIEWER=3]="REMOVE_REVIEWER",t[t.ADD_REVIEW_REQUEST=4]="ADD_REVIEW_REQUEST",t[t.REMOVE_REVIEW_REQUEST=5]="REMOVE_REVIEW_REQUEST",t))(Sc||{});const Bb=ys.MEDIUM,Ac=6e4;function R(t){return{addOne:(h,y)=>{const f=t(y.payload);h.instances[f]=y.payload},addMany:(h,y)=>{for(const f of y.payload){const S=t(f);h.instances[S]=f}},setOne:(h,y)=>{const f=t(y.payload);h.instances[f]=y.payload},setMany:(h,y)=>{for(const f of y.payload){const S=t(f);h.instances[S]=f}},updateOne:(h,y)=>{const f=t(y.payload);h.instances[f]=y.payload},updateMany:(h,y)=>{for(const f of y.payload){const S=t(f);h.instances[S]=f}},deleteOne:(h,y)=>{delete h.instances[y.payload]},deleteMany:(h,y)=>{for(const f of y.payload)delete h.instances[f]},initialize:(h,y)=>{h.instances={};const f=new Set;for(const S of y.payload){const O=t(S);f.add(O),h.instances[O]=S}f.size!==y.payload.length&&console.warn("duplicate ids detected when initializing model instances.")}}}function zb(){return{initializeSelection:(l,r)=>{l.selection=Array.from(new Set(r.payload))},selectOne:(l,r)=>{new Set(l.selection).has(r.payload)||l.selection.push(r.payload)},selectMany:(l,r)=>{const h=new Set(l.selection);for(const y of r.payload)h.has(y)||h.add(y);l.selection=Array.from(h)},unselectOne:(l,r)=>{const h=new Set(l.selection);h.has(r.payload)&&(h.delete(r.payload),l.selection=Array.from(h))},unselectMany:(l,r)=>{const h=new Set(l.selection);for(const y of r.payload)h.has(y)&&h.delete(y);l.selection=Array.from(h)},toggleOne:(l,r)=>{const h=new Set(l.selection);h.has(r.payload)?h.delete(r.payload):h.add(r.payload),l.selection=Array.from(h)},toggleMany:(l,r)=>{const h=new Set(l.selection);for(const y of r.payload)h.has(y)?h.delete(y):h.add(y);l.selection=Array.from(h)},getInitialState:l=>({...l,selection:[]})}}const Ft="versioning",b=u.createAction("RESET"),z=u.createAction("RESET_PROJECT_STATE"),M=u.createAction("RESET_ORGANIZATION_STATE");function qb(t,s){return _b.useMemo(t,s)}gb=Symbol.toStringTag;class fs{constructor(){m(this,gb,"Promise");m(this,"_promise");m(this,"_resolve");m(this,"_reject");m(this,"_state","pending");this._resolve=null,this._reject=null,this._promise=new Promise((s,e)=>{this._resolve=s,this._reject=e})}get state(){return this._state}then(s,e){return this._promise.then(s,e)}catch(s){return this._promise.catch(s)}resolve(s){if(!this._resolve)throw new Error("No resolve callback");this._resolve(s),this._state="fulfilled"}reject(s){if(!this._reject)throw s;this._reject(s),this._state="rejected"}finally(s){throw new Error("`finally` not implemented")}}let Ss=!1;["true","1"].includes("".toLowerCase())&&(Ss=!0);function Cb(t,s){if(t===s)return!0;if(typeof t!=typeof s)return!1;const e=Object.keys(t),n=Object.keys(s),a=e.length;if(a!==n.length)return!1;for(let c=0;c<a;c++){const d=e[c];if(!Object.prototype.hasOwnProperty.call(s,d)||t[d]!==s[d])return!1}return!0}function As(t){const s={};return function(){const e=Array.prototype.slice.call(arguments);return e in s?(Ss&&console.debug(`Memoization debug: Using memorized return value for ${t.toString()}(`,e,")"),s[e]):(Ss&&console.debug(`Memoization debug: Cache miss! Memoizing ${t.toString()}(`,e,")"),s[e]=t.apply(this,e))}}function jb(t,s){if(t.length!==s.length)return!1;for(let e=0;e<t.length;e++)if(t[e]!==s[e])return!1;return!0}const w=t=>t.length===0?oc:t,Vt=t=>Object.keys(t).length===0?uc:t,wc=As(t=>{if(!t)return"";const s=new Date(t),e=s.getFullYear()===ws.getFullYear(),n={day:"numeric",month:"short"};return e||(n.year="numeric"),s.toLocaleDateString([],n)}),Db=new Intl.RelativeTimeFormat([],{style:"long",numeric:"auto"}),$b=1e3*86400,ws=new Date,Ub=t=>new Date(t).toDateString()===ws.toDateString(),Lb=As((t,s,e)=>{const n=Math.round((new Date(t).getTime()-ws.getTime())/$b);return n<s||n>e?wc(t):Db.format(n,"days")});function Nb(t){return new Uint8Array(t).reduce((e,n)=>e+n.toString(16).padStart(2,"0"),"")}const Ts=async(t,s)=>{s||(s=await At(t));let e=t.type;if(e.includes("/")&&(e=e.split("/")[1]),!e)throw new Error(`Could not extract file type from ${t.type}`);return`${s}.${e}`};function At(t){return new Promise((s,e)=>{const n=new FileReader;n.onload=()=>{const a=n.result;if(!a){e(new Error("FileReader did not return a valid ArrayBuffer."));return}crypto.subtle.digest("SHA-1",a).then(c=>{const d=Nb(c);s(d)})},n.readAsArrayBuffer(t)})}function Hb(t){if(!t.name||!t.type||!t.size){const s="File has no name, type, and/or size";throw new Error(s)}return`${t.name}&${t.type}${t.size}`}function Tc(t,s){return new File([t],s,{type:t.type})}function Gb(t,s){const e=document.createElement("a");e.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(s)),e.setAttribute("download",t),e.style.display="none",document.body.appendChild(e),e.click(),document.body.removeChild(e)}const Kb=async t=>{const s={};for(const e of t){const n=await At(e);s[n]={sha1:n,extension:e.name.split(".").pop()||"",file_type:e.type,size:e.size}}return Object.values(s)},Oc=async t=>(await fetch(t)).blob(),Yb=t=>new Promise((s,e)=>{const n=new FileReader;n.onloadend=()=>{var a;s(((a=n.result)==null?void 0:a.toString())||"")},n.readAsDataURL(t)});function Zb(t){const s=new Blob([t]);Rb.saveAs(s,t.name)}const Ic={};function Jb(t,s,e,...n){const a=Ic[t];let c=!1;a?a[s]||(a[s]=!0,c=!0):(Ic[t]={[s]:!0},c=!0),c&&console[e](...n)}const Fc=["created_at","updated_at","index","revision"];function _(t){return{...t,uuid:mt.v4()}}function Qb(t){const s={};for(const e of t)s[e.uuid]=e;return s}function B(t){return t.map(({uuid:s})=>s)}function Wt(t,s){return t.localeCompare(s)}function Os(t,s){return Wt(t.uuid,s.uuid)}function Xb(t,s=void 0,e=255){let n=t.replace(/[^a-z0-9_\-.]/gi,"_").replace(/_{2,}/g,"_");if(!s){const c=t.split(".");c.length>1&&(s=c[c.length-1])}s&&!s.startsWith(".")&&(s="."+s);const a=s?s.length:0;return n.length+a>e&&(n=n.slice(0,e-a)+(s||"")),n}function xb(t){return t.toLowerCase().replace(" ","-")}function e_(t,s=!1){return t.normalize("NFKD").toLowerCase().replace(/[^\w\s-]/g,"").trim().replace(/[-\s]+/g,s?"_":"-")}function t_(t,s){if(t.length<=s)return t;const e=t.slice(0,s-1);return e.slice(0,e.lastIndexOf(" "))+"…"}const s_=/^.+@.+\..+$/;function E(t){const s={...t};for(const e of[...Fc,"created_by"])e in s&&delete s[e];return s}const Pc=t=>{const s=t.toSorted((e,n)=>e.order-n.order);return dc(s,{id:e=>e.uuid,parentId:e=>e.parent,includeEmptyChildrenArray:!0,valueKey:!1})},i_=t=>{const{roots:s}=Pc(t);return s.map(e=>new Et.Tree(e))},gc=(t,s)=>{const{nodes:e}=Pc(s),n=e.get(t);if(!n)throw new Error(`Node with uuid ${t} does not exist in asset procedure step tree.`);return new Et.Tree(n)},bc=(t,s)=>t.type!==s.type?t.type-s.type:t.order-s.order,_c=(t,s)=>t.type!==s.type?t.type-s.type:t.order-s.order,Rc=t=>dc(t,{id:s=>s.uuid,parentId:s=>s.parent_document,includeEmptyChildrenArray:!0,valueKey:!1}),n_=t=>{const{roots:s}=Rc(t);return s.map(e=>new Et.Tree(e))},Mc=(t,s)=>{const{nodes:e}=Rc(s),n=e.get(t);if(!n)throw new Error(`Node with uuid ${t} does not exist in document tree.`);return new Et.Tree(n)};class a_{constructor(s){m(this,"operations",[]);m(this,"getData");this.getData=s}performOperations(s){let e=s;for(const n of this.operations)e=n(e);return e}filter(s,e){return this.operations.push(n=>n.filter(a=>a[s]===e)),this}exclude(s,e){return this.operations.push(n=>n.filter(a=>a[s]!==e)),this}orderBy(s){return this.operations.push(e=>[...e].sort((n,a)=>n[s]<=a[s]?1:-1)),this}reverse(){return this.operations.push(s=>[...s].reverse()),this}all(){return this.operations.push(s=>s),this}get(s,e){return u.createSelector([this.getData],n=>this.performOperations(n).find(a=>a[s]===e))}count(){return u.createSelector([this.getData],s=>this.performOperations(s).length)}first(){return u.createSelector([this.getData],s=>this.performOperations(s)[0])}last(){return u.createSelector([this.getData],s=>{const e=this.performOperations(s);return e[e.length-1]})}exists(){return u.createSelector([this.getData],s=>this.performOperations(s).length>0)}toSelector(){return u.createSelector([this.getData],s=>w(this.performOperations(s)))}}const A=t=>(...s)=>e=>t(e,...s),N=R(t=>t.uuid),kc={instances:{}},Is=u.createSlice({name:"agents",initialState:kc,extraReducers:t=>t.addMatcher(u.isAnyOf(b,z,M),s=>Object.assign(s,kc)),reducers:{initializeConversations:N.initialize,addConversation:N.addOne,addConversations:N.addMany,setConversation:N.setOne,setConversations:N.setMany,updateConversation:N.updateOne,updateConversations:N.updateMany,deleteConversation:N.deleteOne,deleteConversations:N.deleteMany}}),{initializeConversations:vc,addConversation:Ec,addConversations:c_,setConversation:Vc,setConversations:r_,updateConversation:Wc,updateConversations:d_,deleteConversation:l_,deleteConversations:o_}=Is.actions,Fs=t=>t.agentsReducer.instances,u_=u.createSelector([Fs],t=>Object.values(t)),h_=A(u.createSelector([Fs,(t,s)=>s],(t,s)=>t[s])),Bc=Is.reducer,H=R(t=>t.uuid),zc={instances:{}},Ps=u.createSlice({name:"assetAttachments",initialState:zc,extraReducers:t=>t.addMatcher(u.isAnyOf(b,z,M),s=>Object.assign(s,zc)),reducers:{initializeAssetAttachments:H.initialize,addAssetAttachment:H.addOne,addAssetAttachments:H.addMany,setAssetAttachment:H.setOne,setAssetAttachments:H.setMany,updateAssetAttachment:H.updateOne,updateAssetAttachments:H.updateMany,deleteAssetAttachment:H.deleteOne,deleteAssetAttachments:H.deleteMany}}),{initializeAssetAttachments:qc,addAssetAttachment:Cc,addAssetAttachments:gs,setAssetAttachment:jc,setAssetAttachments:Dc,updateAssetAttachment:$c,updateAssetAttachments:Uc,deleteAssetAttachment:Lc,deleteAssetAttachments:bs}=Ps.actions,Nc=t=>t.assetAttachmentReducer.instances,_s=u.createSelector([Nc],t=>Object.values(t)),Hc=t=>s=>s.assetAttachmentReducer.instances[t],Gc=A(u.createSelector([_s,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),Kc=A(u.createSelector([_s,(t,s)=>s],(t,s)=>w(t.filter(({asset:e})=>s===e)))),Yc=Ps.reducer,G=R(({uuid:t})=>t),Zc={instances:{}},Rs=u.createSlice({name:"assetProcedureTypeAttachments",initialState:Zc,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,Zc)),reducers:{initializeAssetProcedureTypeAttachments:G.initialize,addAssetProcedureTypeAttachment:G.addOne,addAssetProcedureTypeAttachments:G.addMany,setAssetProcedureTypeAttachment:G.setOne,setAssetProcedureTypeAttachments:G.setMany,updateAssetProcedureTypeAttachment:G.updateOne,updateAssetProcedureTypeAttachments:G.updateMany,deleteAssetProcedureTypeAttachment:G.deleteOne,deleteAssetProcedureTypeAttachments:G.deleteMany}}),{initializeAssetProcedureTypeAttachments:Jc,addAssetProcedureTypeAttachment:Qc,addAssetProcedureTypeAttachments:Xc,setAssetProcedureTypeAttachment:xc,setAssetProcedureTypeAttachments:er,updateAssetProcedureTypeAttachment:tr,updateAssetProcedureTypeAttachments:sr,deleteAssetProcedureTypeAttachment:ir,deleteAssetProcedureTypeAttachments:nr}=Rs.actions,ar=Rs.reducer,cr=t=>t.assetProcedureTypeAttachmentReducer.instances,Ms=u.createSelector([cr],t=>Object.values(t)),rr=t=>s=>s.assetProcedureTypeAttachmentReducer.instances[t],dr=A(u.createSelector([Ms,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),p_=A(u.createSelector([Ms,(t,s)=>s],(t,s)=>w(t.filter(({asset_procedure_type:e})=>s===e)))),K=R(({uuid:t})=>t),lr={instances:{}},ks=u.createSlice({name:"assetProcedureTypeFieldsAttachments",initialState:lr,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,lr)),reducers:{initializeAssetProcedureTypeFieldsAttachments:K.initialize,addAssetProcedureTypeFieldsAttachment:K.addOne,addAssetProcedureTypeFieldsAttachments:K.addMany,setAssetProcedureTypeFieldsAttachment:K.setOne,setAssetProcedureTypeFieldsAttachments:K.setMany,updateAssetProcedureTypeFieldsAttachment:K.updateOne,updateAssetProcedureTypeFieldsAttachments:K.updateMany,deleteAssetProcedureTypeFieldsAttachment:K.deleteOne,deleteAssetProcedureTypeFieldsAttachments:K.deleteMany}}),{initializeAssetProcedureTypeFieldsAttachments:or,addAssetProcedureTypeFieldsAttachment:ur,addAssetProcedureTypeFieldsAttachments:hr,setAssetProcedureTypeFieldsAttachment:pr,setAssetProcedureTypeFieldsAttachments:mr,updateAssetProcedureTypeFieldsAttachment:yr,updateAssetProcedureTypeFieldsAttachments:fr,deleteAssetProcedureTypeFieldsAttachment:Sr,deleteAssetProcedureTypeFieldsAttachments:Ar}=ks.actions,wr=ks.reducer,Tr=t=>t.assetProcedureTypeFieldsAttachmentReducer.instances,vs=u.createSelector([Tr],t=>Object.values(t)),m_=A(u.createSelector([vs,(t,s)=>s],(t,s)=>w(t.filter(e=>e.fields_revision===s)))),Or=t=>s=>s.assetProcedureTypeFieldsAttachmentReducer.instances[t],Ir=A(u.createSelector([vs,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),Y=R(({uuid:t})=>t),Fr={instances:{}},Es=u.createSlice({name:"assetProcedureTypeFields",initialState:Fr,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,Fr)),reducers:{initializeAssetProcedureTypeFields:Y.initialize,addAssetProcedureTypeFields:Y.addOne,addAssetProcedureTypeFieldsMany:Y.addMany,setAssetProcedureTypeFields:Y.setOne,setAssetProcedureTypeFieldsMany:Y.setMany,updateAssetProcedureTypeFields:Y.updateOne,updateAssetProcedureTypeFieldsMany:Y.updateMany,deleteAssetProcedureTypeFields:Y.deleteOne,deleteAssetProcedureTypeFieldsMany:Y.deleteMany}}),{initializeAssetProcedureTypeFields:Pr,addAssetProcedureTypeFields:gr,addAssetProcedureTypeFieldsMany:br,setAssetProcedureTypeFields:_r,setAssetProcedureTypeFieldsMany:Rr,updateAssetProcedureTypeFields:Mr,updateAssetProcedureTypeFieldsMany:kr,deleteAssetProcedureTypeFields:vr,deleteAssetProcedureTypeFieldsMany:Er}=Es.actions,Vr=Es.reducer,Wr=t=>t.assetProcedureTypeFieldsReducer.instances,Bt=u.createSelector([Wr],t=>Object.values(t)),y_=A(u.createSelector([Bt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.asset_procedure_type===s)))),f_=A(u.createSelector([Bt,(t,s)=>s],(t,s)=>t.filter(e=>e.asset_procedure_type===s).sort((e,n)=>e.submitted_at>n.submitted_at?-1:1)[0])),Br=t=>s=>s.assetProcedureTypeFieldsReducer.instances[t],zr=A(u.createSelector([Bt,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),Z=R(({uuid:t})=>t),qr={instances:{}},Vs=u.createSlice({name:"assetProcedureTypeFieldValuesAttachments",initialState:qr,extraReducers:t=>t.addMatcher(u.isAnyOf(b,z,M),s=>Object.assign(s,qr)),reducers:{initializeAssetProcedureTypeFieldValuesAttachments:Z.initialize,addAssetProcedureTypeFieldValuesAttachment:Z.addOne,addAssetProcedureTypeFieldValuesAttachments:Z.addMany,setAssetProcedureTypeFieldValuesAttachment:Z.setOne,setAssetProcedureTypeFieldValuesAttachments:Z.setMany,updateAssetProcedureTypeFieldValuesAttachment:Z.updateOne,updateAssetProcedureTypeFieldValuesAttachments:Z.updateMany,deleteAssetProcedureTypeFieldValuesAttachment:Z.deleteOne,deleteAssetProcedureTypeFieldValuesAttachments:Z.deleteMany}}),{initializeAssetProcedureTypeFieldValuesAttachments:Cr,addAssetProcedureTypeFieldValuesAttachment:jr,addAssetProcedureTypeFieldValuesAttachments:Ws,setAssetProcedureTypeFieldValuesAttachment:Dr,setAssetProcedureTypeFieldValuesAttachments:$r,updateAssetProcedureTypeFieldValuesAttachment:Ur,updateAssetProcedureTypeFieldValuesAttachments:Lr,deleteAssetProcedureTypeFieldValuesAttachment:Nr,deleteAssetProcedureTypeFieldValuesAttachments:Bs}=Vs.actions,Hr=Vs.reducer,Gr=t=>t.assetProcedureTypeFieldValuesAttachmentReducer.instances,zs=u.createSelector([Gr],t=>Object.values(t)),Kr=t=>s=>s.assetProcedureTypeFieldValuesAttachmentReducer.instances[t],Yr=A(u.createSelector([zs,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),Zr=A(u.createSelector([zs,(t,s)=>s],(t,s)=>w(t.filter(e=>e.field_values===s)))),J=R(({uuid:t})=>t),Jr={instances:{}},qs=u.createSlice({name:"assetProcedureTypeFieldValues",initialState:Jr,extraReducers:t=>t.addMatcher(u.isAnyOf(b,z,M),s=>Object.assign(s,Jr)),reducers:{initializeAssetProcedureTypeFieldValues:J.initialize,addAssetProcedureTypeFieldValues:J.addOne,addAssetProcedureTypeFieldValuesMany:J.addMany,setAssetProcedureTypeFieldValues:J.setOne,setAssetProcedureTypeFieldValuesMany:J.setMany,updateAssetProcedureTypeFieldValues:J.updateOne,updateAssetProcedureTypeFieldValuesMany:J.updateMany,deleteAssetProcedureTypeFieldValues:J.deleteOne,deleteAssetProcedureTypeFieldValuesMany:J.deleteMany}}),{initializeAssetProcedureTypeFieldValues:Qr,addAssetProcedureTypeFieldValues:Xr,addAssetProcedureTypeFieldValuesMany:xr,setAssetProcedureTypeFieldValues:ed,setAssetProcedureTypeFieldValuesMany:td,updateAssetProcedureTypeFieldValues:sd,updateAssetProcedureTypeFieldValuesMany:id,deleteAssetProcedureTypeFieldValues:nd,deleteAssetProcedureTypeFieldValuesMany:ad}=qs.actions,cd=qs.reducer,rd=t=>t.assetProcedureTypeFieldValuesReducer.instances,zt=u.createSelector([rd],t=>Object.values(t)),S_=A(u.createSelector([zt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.asset===s)))),A_=A(u.createSelector([zt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.asset_procedure===s)))),dd=t=>s=>s.assetProcedureTypeFieldValuesReducer.instances[t],ld=A(u.createSelector([zt,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),Q=R(({uuid:t})=>t),od={instances:{}},Cs=u.createSlice({name:"assetProcedures",initialState:od,extraReducers:t=>t.addMatcher(u.isAnyOf(b,z,M),s=>Object.assign(s,od)),reducers:{initializeAssetProcedures:Q.initialize,addAssetProcedure:Q.addOne,addAssetProcedures:Q.addMany,setAssetProcedure:Q.setOne,setAssetProcedures:Q.setMany,updateAssetProcedure:Q.updateOne,updateAssetProcedures:Q.updateMany,deleteAssetProcedure:Q.deleteOne,deleteAssetProcedures:Q.deleteMany}}),{initializeAssetProcedures:ud,addAssetProcedure:hd,addAssetProcedures:js,updateAssetProcedure:pd,updateAssetProcedures:md,deleteAssetProcedure:yd,deleteAssetProcedures:Ds,setAssetProcedure:fd,setAssetProcedures:Sd}=Cs.actions,Ad=Cs.reducer,wd=t=>t.assetProcedureReducer.instances,qt=u.createSelector([wd],t=>Object.values(t)),Td=A(u.createSelector([qt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.asset_procedure_type===s)))),w_=A(u.createSelector([qt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.asset_type===s)))),Od=t=>s=>s.assetProcedureReducer.instances[t],Id=A(u.createSelector([qt,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),X=R(t=>t.uuid),Fd={instances:{}},$s=u.createSlice({name:"assetProcedureTypes",initialState:Fd,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,Fd)),reducers:{initializeAssetProcedureTypes:X.initialize,addAssetProcedureType:X.addOne,addAssetProcedureTypes:X.addMany,setAssetProcedureType:X.setOne,setAssetProcedureTypes:X.setMany,updateAssetProcedureType:X.updateOne,updateAssetProcedureTypes:X.updateMany,deleteAssetProcedureType:X.deleteOne,deleteAssetProcedureTypes:X.deleteMany}}),{initializeAssetProcedureTypes:Pd,addAssetProcedureType:gd,addAssetProcedureTypes:bd,updateAssetProcedureType:_d,updateAssetProcedureTypes:Rd,deleteAssetProcedureType:Md,deleteAssetProcedureTypes:kd,setAssetProcedureType:vd,setAssetProcedureTypes:Ed}=$s.actions,Vd=$s.reducer,Wd=t=>t.assetProcedureTypeReducer.instances,Us=u.createSelector([Wd],t=>Object.values(t)),Bd=t=>s=>s.assetProcedureTypeReducer.instances[t],zd=A(u.createSelector([Us,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),T_=A(u.createSelector([Us,(t,s)=>s],(t,s)=>w(t.filter(e=>e.organization===s)))),x=R(t=>t.uuid),qd={instances:{}},Ls=u.createSlice({name:"assetProcedureStepFieldsAttachments",initialState:qd,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,qd)),reducers:{initializeAssetProcedureStepFieldsAttachments:x.initialize,addAssetProcedureStepFieldsAttachment:x.addOne,addAssetProcedureStepFieldsAttachments:x.addMany,setAssetProcedureStepFieldsAttachment:x.setOne,setAssetProcedureStepFieldsAttachments:x.setMany,updateAssetProcedureStepFieldsAttachment:x.updateOne,updateAssetProcedureStepFieldsAttachments:x.updateMany,deleteAssetProcedureStepFieldsAttachment:x.deleteOne,deleteAssetProcedureStepFieldsAttachments:x.deleteMany}}),{initializeAssetProcedureStepFieldsAttachments:Cd,addAssetProcedureStepFieldsAttachment:jd,addAssetProcedureStepFieldsAttachments:Dd,setAssetProcedureStepFieldsAttachment:$d,setAssetProcedureStepFieldsAttachments:Ud,updateAssetProcedureStepFieldsAttachment:Ld,updateAssetProcedureStepFieldsAttachments:Nd,deleteAssetProcedureStepFieldsAttachment:Hd,deleteAssetProcedureStepFieldsAttachments:Gd}=Ls.actions,Kd=t=>t.assetProcedureStepFieldsAttachmentReducer.instances,Ns=u.createSelector([Kd],t=>Object.values(t)),O_=A(u.createSelector([Ns,(t,s)=>s],(t,s)=>w(t.filter(e=>e.fields_revision===s)))),Yd=t=>s=>s.assetProcedureStepFieldsAttachmentReducer.instances[t],Zd=A(u.createSelector([Ns,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),Jd=Ls.reducer,ee=R(t=>t.uuid),Qd={instances:{}},Hs=u.createSlice({name:"assetProcedureStepFields",initialState:Qd,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,Qd)),reducers:{initializeAssetProcedureStepFields:ee.initialize,addAssetProcedureStepFields:ee.addOne,addAssetProcedureStepFieldsMany:ee.addMany,setAssetProcedureStepFields:ee.setOne,setAssetProcedureStepFieldsMany:ee.setMany,updateAssetProcedureStepFields:ee.updateOne,updateAssetProcedureStepFieldsMany:ee.updateMany,deleteAssetProcedureStepFields:ee.deleteOne,deleteAssetProcedureStepFieldsMany:ee.deleteMany}}),{initializeAssetProcedureStepFields:Xd,addAssetProcedureStepFields:xd,addAssetProcedureStepFieldsMany:el,setAssetProcedureStepFields:tl,setAssetProcedureStepFieldsMany:sl,updateAssetProcedureStepFields:il,updateAssetProcedureStepFieldsMany:nl,deleteAssetProcedureStepFields:al,deleteAssetProcedureStepFieldsMany:cl}=Hs.actions,Gs=t=>t.assetProcedureStepFieldsReducer.instances,Ct=u.createSelector([Gs],t=>Object.values(t)),I_=A(u.createSelector([Ct,(t,s)=>s],(t,s)=>w(t.filter(e=>e.asset_procedure_step===s)))),F_=A(u.createSelector([Ct,(t,s)=>s],(t,s)=>t.filter(e=>e.asset_procedure_step===s).sort((e,n)=>e.submitted_at>n.submitted_at?-1:1)[0])),P_=u.createSelector([Gs],t=>{const s={};for(const e of Object.values(t)){const n=s[e.asset_procedure_step];(!n||n.submitted_at<e.submitted_at)&&(s[e.asset_procedure_step]=e)}return s}),rl=t=>s=>s.assetProcedureStepFieldsReducer.instances[t],dl=A(u.createSelector([Ct,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),ll=Hs.reducer,te=R(t=>t.uuid),ol={instances:{}},Ks=u.createSlice({name:"assetProcedureStepFieldValuesAttachments",initialState:ol,extraReducers:t=>t.addMatcher(u.isAnyOf(b,z,M),s=>Object.assign(s,ol)),reducers:{initializeAssetProcedureStepFieldValuesAttachments:te.initialize,addAssetProcedureStepFieldValuesAttachment:te.addOne,addAssetProcedureStepFieldValuesAttachments:te.addMany,setAssetProcedureStepFieldValuesAttachment:te.setOne,setAssetProcedureStepFieldValuesAttachments:te.setMany,updateAssetProcedureStepFieldValuesAttachment:te.updateOne,updateAssetProcedureStepFieldValuesAttachments:te.updateMany,deleteAssetProcedureStepFieldValuesAttachment:te.deleteOne,deleteAssetProcedureStepFieldValuesAttachments:te.deleteMany}}),{initializeAssetProcedureStepFieldValuesAttachments:ul,addAssetProcedureStepFieldValuesAttachment:hl,addAssetProcedureStepFieldValuesAttachments:Ys,setAssetProcedureStepFieldValuesAttachment:pl,setAssetProcedureStepFieldValuesAttachments:ml,updateAssetProcedureStepFieldValuesAttachment:yl,updateAssetProcedureStepFieldValuesAttachments:fl,deleteAssetProcedureStepFieldValuesAttachment:Sl,deleteAssetProcedureStepFieldValuesAttachments:Zs}=Ks.actions,Al=t=>t.assetProcedureStepFieldValuesAttachmentReducer.instances,Js=u.createSelector([Al],t=>Object.values(t)),wl=t=>s=>s.assetProcedureStepFieldValuesAttachmentReducer.instances[t],Tl=A(u.createSelector([Js,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),Ol=A(u.createSelector([Js,(t,s)=>s],(t,s)=>w(t.filter(e=>e.field_values===s)))),Il=Ks.reducer,se=R(t=>t.uuid),Fl={instances:{}},Qs=u.createSlice({name:"assetProcedureStepFieldValues",initialState:Fl,extraReducers:t=>t.addMatcher(u.isAnyOf(b,z,M),s=>Object.assign(s,Fl)),reducers:{initializeAssetProcedureStepFieldValues:se.initialize,addAssetProcedureStepFieldValues:se.addOne,addAssetProcedureStepFieldValuesMany:se.addMany,setAssetProcedureStepFieldValues:se.setOne,setAssetProcedureStepFieldValuesMany:se.setMany,updateAssetProcedureStepFieldValues:se.updateOne,updateAssetProcedureStepFieldValuesMany:se.updateMany,deleteAssetProcedureStepFieldValues:se.deleteOne,deleteAssetProcedureStepFieldValuesMany:se.deleteMany}}),{initializeAssetProcedureStepFieldValues:Pl,addAssetProcedureStepFieldValues:gl,addAssetProcedureStepFieldValuesMany:bl,setAssetProcedureStepFieldValues:_l,setAssetProcedureStepFieldValuesMany:Rl,updateAssetProcedureStepFieldValues:Ml,updateAssetProcedureStepFieldValuesMany:kl,deleteAssetProcedureStepFieldValues:vl,deleteAssetProcedureStepFieldValuesMany:El}=Qs.actions,Vl=t=>t.assetProcedureStepFieldValuesReducer.instances,Pt=u.createSelector([Vl],t=>Object.values(t)),g_=A(u.createSelector([Pt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.asset===s)))),b_=A(u.createSelector([Pt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.asset_procedure===s)))),__=A(u.createSelector([Pt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.asset_procedure_step===s)))),Wl=t=>s=>s.assetProcedureStepFieldValuesReducer.instances[t],Bl=A(u.createSelector([Pt,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),zl=Qs.reducer,ie=R(t=>t.uuid),ql={instances:{}},Xs=u.createSlice({name:"assetProcedureSteps",initialState:ql,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,ql)),reducers:{initializeAssetProcedureSteps:ie.initialize,setAssetProcedureStep:ie.setOne,setAssetProcedureSteps:ie.setMany,addAssetProcedureStep:ie.addOne,addAssetProcedureSteps:ie.addMany,updateAssetProcedureStep:ie.updateOne,updateAssetProcedureSteps:ie.updateMany,deleteAssetProcedureStep:ie.deleteOne,deleteAssetProcedureSteps:ie.deleteMany}}),{initializeAssetProcedureSteps:Cl,setAssetProcedureStep:jl,setAssetProcedureSteps:Dl,addAssetProcedureStep:$l,addAssetProcedureSteps:Ul,updateAssetProcedureStep:Ll,updateAssetProcedureSteps:Nl,deleteAssetProcedureStep:Hl,deleteAssetProcedureSteps:Gl}=Xs.actions,Kl=Xs.reducer,jt=t=>t.assetProcedureStepReducer.instances,Yl=t=>s=>s.assetProcedureStepReducer.instances[t],xs=u.createSelector([jt],t=>Object.values(t)),R_=A(u.createSelector([jt,(t,s)=>s],(t,s)=>{const e={};for(const[n,a]of Object.entries(t))a.asset_procedure_type===s&&(e[n]=a);return Vt(e)})),M_=A(u.createSelector([xs,(t,s)=>s],(t,s)=>w(t.filter(e=>e.asset_procedure_type===s)))),Zl=A(u.createSelector([xs,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),Jl=A(u.createSelector([jt,(t,s)=>s],(t,s)=>{if(!t[s])return w([]);const a=gc(s,Object.values(t)).all().map(({model:c})=>c);return w(a)})),ne=R(t=>t.uuid),Ql={instances:{}},ei=u.createSlice({name:"assets",initialState:Ql,extraReducers:t=>t.addMatcher(u.isAnyOf(b,z,M),s=>Object.assign(s,Ql)),reducers:{initializeAssets:ne.initialize,addAsset:ne.addOne,addAssets:ne.addMany,setAsset:ne.setOne,setAssets:ne.setMany,updateAsset:ne.updateOne,updateAssets:ne.updateMany,deleteAsset:ne.deleteOne,deleteAssets:ne.deleteMany}}),{initializeAssets:Xl,addAsset:xl,addAssets:ti,updateAsset:eo,updateAssets:to,deleteAsset:so,deleteAssets:si,setAsset:io,setAssets:no}=ei.actions,ao=t=>t.assetReducer.instances,Dt=u.createSelector([ao],t=>w(Object.values(t))),k_=A(u.createSelector([Dt,(t,s)=>s],(t,s)=>w(t.filter(({project:e})=>e===s)))),co=A(u.createSelector([Dt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.asset_type===s)))),ro=t=>s=>s.assetReducer.instances[t],lo=A(u.createSelector([Dt,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),oo=ei.reducer,ae=R(t=>t.uuid),uo={instances:{}},ii=u.createSlice({name:"assetStageCompletions",initialState:uo,extraReducers:t=>t.addMatcher(u.isAnyOf(b,z,M),s=>Object.assign(s,uo)),reducers:{initializeAssetStageCompletions:ae.initialize,addAssetStageCompletion:ae.addOne,addAssetStageCompletions:ae.addMany,setAssetStageCompletion:ae.setOne,setAssetStageCompletions:ae.setMany,updateAssetStageCompletion:ae.updateOne,updateAssetStageCompletions:ae.updateMany,deleteAssetStageCompletion:ae.deleteOne,deleteAssetStageCompletions:ae.deleteMany}}),{initializeAssetStageCompletions:ho,addAssetStageCompletion:po,addAssetStageCompletions:mo,setAssetStageCompletion:yo,setAssetStageCompletions:fo,updateAssetStageCompletion:So,updateAssetStageCompletions:Ao,deleteAssetStageCompletion:wo,deleteAssetStageCompletions:To}=ii.actions,Oo=ii.reducer,Io=t=>t.assetStageCompletionReducer.instances,Fo=u.createSelector([Io],t=>Object.values(t)),Po=t=>s=>s.assetStageCompletionReducer.instances[t],go=A(u.createSelector([Fo,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),ce=R(t=>t.uuid),bo={instances:{}},ni=u.createSlice({name:"assetStages",initialState:bo,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,bo)),reducers:{initializeAssetStages:ce.initialize,setAssetStage:ce.setOne,setAssetStages:ce.setMany,addAssetStage:ce.addOne,addAssetStages:ce.addMany,updateAssetStage:ce.updateOne,updateAssetStages:ce.updateMany,deleteAssetStage:ce.deleteOne,deleteAssetStages:ce.deleteMany}}),{initializeAssetStages:_o,setAssetStage:Ro,setAssetStages:Mo,addAssetStage:ko,addAssetStages:vo,updateAssetStage:Eo,updateAssetStages:Vo,deleteAssetStage:Wo,deleteAssetStages:Bo}=ni.actions,zo=ni.reducer,ai=t=>t.assetStageReducer.instances,qo=t=>s=>s.assetStageReducer.instances[t],ci=u.createSelector([ai],t=>Object.values(t)),v_=A(u.createSelector([ai,(t,s)=>s],(t,s)=>{const e={};for(const[n,a]of Object.entries(t))a.asset_procedure_type===s&&(e[n]=a);return Vt(e)})),E_=A(u.createSelector([ci,(t,s)=>s],(t,s)=>w(t.filter(e=>e.asset_procedure_type===s)))),Co=A(u.createSelector([ci,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),re=R(t=>t.uuid),jo={instances:{}},ri=u.createSlice({name:"assetTypeAttachments",initialState:jo,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,jo)),reducers:{initializeAssetTypeAttachments:re.initialize,addAssetTypeAttachment:re.addOne,addAssetTypeAttachments:re.addMany,setAssetTypeAttachment:re.setOne,setAssetTypeAttachments:re.setMany,updateAssetTypeAttachment:re.updateOne,updateAssetTypeAttachments:re.updateMany,deleteAssetTypeAttachment:re.deleteOne,deleteAssetTypeAttachments:re.deleteMany}}),{initializeAssetTypeAttachments:Do,addAssetTypeAttachment:$o,addAssetTypeAttachments:di,setAssetTypeAttachment:Uo,setAssetTypeAttachments:Lo,updateAssetTypeAttachment:No,updateAssetTypeAttachments:Ho,deleteAssetTypeAttachment:Go,deleteAssetTypeAttachments:li}=ri.actions,Ko=t=>t.assetTypeAttachmentReducer.instances,oi=u.createSelector([Ko],t=>Object.values(t)),Yo=t=>s=>s.assetTypeAttachmentReducer.instances[t],Zo=A(u.createSelector([oi,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),Jo=A(u.createSelector([oi,(t,s)=>s],(t,s)=>w(t.filter(({asset_type:e})=>s===e)))),Qo=ri.reducer,de=R(t=>t.uuid),Xo={instances:{}},ui=u.createSlice({name:"assetTypeFieldsAttachments",initialState:Xo,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,Xo)),reducers:{initializeAssetTypeFieldsAttachments:de.initialize,addAssetTypeFieldsAttachment:de.addOne,addAssetTypeFieldsAttachments:de.addMany,setAssetTypeFieldsAttachment:de.setOne,setAssetTypeFieldsAttachments:de.setMany,updateAssetTypeFieldsAttachment:de.updateOne,updateAssetTypeFieldsAttachments:de.updateMany,deleteAssetTypeFieldsAttachment:de.deleteOne,deleteAssetTypeFieldsAttachments:de.deleteMany}}),{initializeAssetTypeFieldsAttachments:xo,addAssetTypeFieldsAttachment:eu,addAssetTypeFieldsAttachments:tu,setAssetTypeFieldsAttachment:su,setAssetTypeFieldsAttachments:iu,updateAssetTypeFieldsAttachment:nu,updateAssetTypeFieldsAttachments:au,deleteAssetTypeFieldsAttachment:cu,deleteAssetTypeFieldsAttachments:ru}=ui.actions,du=t=>t.assetTypeFieldsAttachmentReducer.instances,hi=u.createSelector([du],t=>Object.values(t)),V_=A(u.createSelector([hi,(t,s)=>s],(t,s)=>w(t.filter(e=>e.fields_revision===s)))),lu=t=>s=>s.assetTypeFieldsAttachmentReducer.instances[t],ou=A(u.createSelector([hi,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),uu=ui.reducer,le=R(t=>t.uuid),hu={instances:{}},pi=u.createSlice({name:"assetTypeFields",initialState:hu,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,hu)),reducers:{initializeAssetTypeFields:le.initialize,addAssetTypeFields:le.addOne,addAssetTypeFieldsMany:le.addMany,setAssetTypeFields:le.setOne,setAssetTypeFieldsMany:le.setMany,updateAssetTypeFields:le.updateOne,updateAssetTypeFieldsMany:le.updateMany,deleteAssetTypeFields:le.deleteOne,deleteAssetTypeFieldsMany:le.deleteMany}}),{initializeAssetTypeFields:pu,addAssetTypeFields:mu,addAssetTypeFieldsMany:yu,setAssetTypeFields:fu,setAssetTypeFieldsMany:Su,updateAssetTypeFields:Au,updateAssetTypeFieldsMany:wu,deleteAssetTypeFields:Tu,deleteAssetTypeFieldsMany:Ou}=pi.actions,Iu=t=>t.assetTypeFieldsReducer.instances,gt=u.createSelector([Iu],t=>Object.values(t)),W_=A(u.createSelector([gt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.asset_type===s)))),B_=A(u.createSelector([gt,(t,s)=>s],(t,s)=>t.filter(e=>e.asset_type===s).sort((e,n)=>e.submitted_at>n.submitted_at?-1:1)[0])),Fu=t=>s=>s.assetTypeFieldsReducer.instances[t],Pu=A(u.createSelector([gt,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),gu=pi.reducer,oe=R(t=>t.uuid),bu={instances:{}},mi=u.createSlice({name:"assetTypeFieldValuesAttachments",initialState:bu,extraReducers:t=>t.addMatcher(u.isAnyOf(b,z,M),s=>Object.assign(s,bu)),reducers:{initializeAssetTypeFieldValuesAttachments:oe.initialize,addAssetTypeFieldValuesAttachment:oe.addOne,addAssetTypeFieldValuesAttachments:oe.addMany,setAssetTypeFieldValuesAttachment:oe.setOne,setAssetTypeFieldValuesAttachments:oe.setMany,updateAssetTypeFieldValuesAttachment:oe.updateOne,updateAssetTypeFieldValuesAttachments:oe.updateMany,deleteAssetTypeFieldValuesAttachment:oe.deleteOne,deleteAssetTypeFieldValuesAttachments:oe.deleteMany}}),{initializeAssetTypeFieldValuesAttachments:_u,addAssetTypeFieldValuesAttachment:Ru,addAssetTypeFieldValuesAttachments:yi,setAssetTypeFieldValuesAttachment:Mu,setAssetTypeFieldValuesAttachments:ku,updateAssetTypeFieldValuesAttachment:vu,updateAssetTypeFieldValuesAttachments:Eu,deleteAssetTypeFieldValuesAttachment:Vu,deleteAssetTypeFieldValuesAttachments:fi}=mi.actions,Wu=t=>t.assetTypeFieldValuesAttachmentReducer.instances,Si=u.createSelector([Wu],t=>Object.values(t)),Bu=t=>s=>s.assetTypeFieldValuesAttachmentReducer.instances[t],zu=A(u.createSelector([Si,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),qu=A(u.createSelector([Si,(t,s)=>s],(t,s)=>w(t.filter(e=>e.field_values===s)))),Cu=mi.reducer,ue=R(t=>t.uuid),ju={instances:{}},Ai=u.createSlice({name:"assetTypeFieldValues",initialState:ju,extraReducers:t=>t.addMatcher(u.isAnyOf(b,z,M),s=>Object.assign(s,ju)),reducers:{initializeAssetTypeFieldValues:ue.initialize,addAssetTypeFieldValues:ue.addOne,addAssetTypeFieldValuesMany:ue.addMany,setAssetTypeFieldValues:ue.setOne,setAssetTypeFieldValuesMany:ue.setMany,updateAssetTypeFieldValues:ue.updateOne,updateAssetTypeFieldValuesMany:ue.updateMany,deleteAssetTypeFieldValues:ue.deleteOne,deleteAssetTypeFieldValuesMany:ue.deleteMany}}),{initializeAssetTypeFieldValues:Du,addAssetTypeFieldValues:$u,addAssetTypeFieldValuesMany:Uu,setAssetTypeFieldValues:Lu,setAssetTypeFieldValuesMany:Nu,updateAssetTypeFieldValues:Hu,updateAssetTypeFieldValuesMany:Gu,deleteAssetTypeFieldValues:Ku,deleteAssetTypeFieldValuesMany:Yu}=Ai.actions,Zu=t=>t.assetTypeFieldValuesReducer.instances,$t=u.createSelector([Zu],t=>Object.values(t)),z_=A(u.createSelector([$t,(t,s)=>s],(t,s)=>w(t.filter(e=>e.asset===s)))),q_=A(u.createSelector([gt,$t,(t,s)=>s],(t,s,e)=>{const n=new Set(t.filter(a=>a.asset_type===e).map(a=>a.uuid));return w(s.filter(a=>n.has(a.fields_revision)))})),Ju=t=>s=>s.assetTypeFieldValuesReducer.instances[t],Qu=A(u.createSelector([$t,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),Xu=Ai.reducer,he=R(t=>t.uuid),xu={instances:{}},wi=u.createSlice({name:"assetTypeIdentifiers",initialState:xu,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,xu)),reducers:{initializeAssetTypeIdentifiers:he.initialize,addAssetTypeIdentifier:he.addOne,addAssetTypeIdentifiers:he.addMany,setAssetTypeIdentifier:he.setOne,setAssetTypeIdentifiers:he.setMany,updateAssetTypeIdentifier:he.updateOne,updateAssetTypeIdentifiers:he.updateMany,deleteAssetTypeIdentifier:he.deleteOne,deleteAssetTypeIdentifiers:he.deleteMany}}),{initializeAssetTypeIdentifiers:eh,addAssetTypeIdentifier:th,addAssetTypeIdentifiers:sh,setAssetTypeIdentifier:ih,setAssetTypeIdentifiers:nh,updateAssetTypeIdentifier:ah,updateAssetTypeIdentifiers:ch,deleteAssetTypeIdentifier:rh,deleteAssetTypeIdentifiers:dh}=wi.actions,lh=t=>t.assetTypeIdentifierReducer.instances,Ti=u.createSelector([lh],t=>Object.values(t)),oh=t=>s=>s.assetTypeIdentifierReducer.instances[t],uh=A(u.createSelector([Ti,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),C_=A(u.createSelector([Ti,(t,s)=>s],(t,s)=>w(t.filter(e=>e.asset_type===s)))),hh=wi.reducer,pe=R(t=>t.uuid),ph={instances:{}},Oi=u.createSlice({name:"assetTypeIdentifierValues",initialState:ph,extraReducers:t=>t.addMatcher(u.isAnyOf(b,z,M),s=>Object.assign(s,ph)),reducers:{initializeAssetTypeIdentifierValues:pe.initialize,addAssetTypeIdentifierValue:pe.addOne,addAssetTypeIdentifierValues:pe.addMany,setAssetTypeIdentifierValue:pe.setOne,setAssetTypeIdentifierValues:pe.setMany,updateAssetTypeIdentifierValue:pe.updateOne,updateAssetTypeIdentifierValues:pe.updateMany,deleteAssetTypeIdentifierValue:pe.deleteOne,deleteAssetTypeIdentifierValues:pe.deleteMany}}),{initializeAssetTypeIdentifierValues:mh,addAssetTypeIdentifierValue:yh,addAssetTypeIdentifierValues:fh,setAssetTypeIdentifierValue:Sh,setAssetTypeIdentifierValues:Ah,updateAssetTypeIdentifierValue:wh,updateAssetTypeIdentifierValues:Th,deleteAssetTypeIdentifierValue:Oh,deleteAssetTypeIdentifierValues:Ih}=Oi.actions,Fh=t=>t.assetTypeIdentifierValueReducer.instances,Ut=u.createSelector([Fh],t=>Object.values(t)),Ph=t=>s=>s.assetTypeIdentifierValueReducer.instances[t],gh=A(u.createSelector([Ut,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),j_=A(u.createSelector([Ut,(t,s)=>s],(t,s)=>w(t.filter(e=>e.asset===s)))),D_=A(u.createSelector([Ut,(t,s)=>s],(t,s)=>w(t.filter(e=>e.asset_type_identifier===s)))),bh=Oi.reducer,me=R(t=>t.uuid),_h={instances:{}},Ii=u.createSlice({name:"assetTypes",initialState:_h,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,_h)),reducers:{initializeAssetTypes:me.initialize,setAssetType:me.setOne,setAssetTypes:me.setMany,addAssetType:me.addOne,addAssetTypes:me.addMany,updateAssetType:me.updateOne,updateAssetTypes:me.updateMany,deleteAssetType:me.deleteOne,deleteAssetTypes:me.deleteMany}}),{initializeAssetTypes:Rh,setAssetType:Mh,setAssetTypes:kh,addAssetType:vh,addAssetTypes:Eh,updateAssetType:Vh,updateAssetTypes:Wh,deleteAssetType:Bh,deleteAssetTypes:zh}=Ii.actions,qh=t=>t.assetTypeReducer.instances,Fi=u.createSelector([qh],t=>Object.values(t)),Ch=t=>s=>s.assetTypeReducer.instances[t],jh=A(u.createSelector([Fi,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),$_=A(u.createSelector([Fi,(t,s)=>s],(t,s)=>w(t.filter(e=>e.organization===s)))),Dh=Ii.reducer,ye=R(t=>t.uuid),$h={instances:{}},Pi=u.createSlice({name:"assetTypeStatuses",initialState:$h,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,$h)),reducers:{initializeAssetTypeStatuses:ye.initialize,addAssetTypeStatus:ye.addOne,addAssetTypeStatuses:ye.addMany,setAssetTypeStatus:ye.setOne,setAssetTypeStatuses:ye.setMany,updateAssetTypeStatus:ye.updateOne,updateAssetTypeStatuses:ye.updateMany,deleteAssetTypeStatus:ye.deleteOne,deleteAssetTypeStatuses:ye.deleteMany}}),{initializeAssetTypeStatuses:Uh,addAssetTypeStatus:Lh,addAssetTypeStatuses:Nh,setAssetTypeStatus:Hh,setAssetTypeStatuses:Gh,updateAssetTypeStatus:Kh,updateAssetTypeStatuses:Yh,deleteAssetTypeStatus:Zh,deleteAssetTypeStatuses:Jh}=Pi.actions,Qh=t=>t.assetTypeStatusReducer.instances,gi=u.createSelector([Qh],t=>w(Object.values(t).toSorted(bc))),Xh=t=>s=>s.assetTypeStatusReducer.instances[t],xh=A(u.createSelector([gi,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),U_=A(u.createSelector([gi,(t,s)=>s],(t,s)=>w(t.filter(e=>e.asset_type===s)))),ep=Pi.reducer,tp={accessToken:"",refreshToken:"",isLoggedIn:!1},Lt=u.createSlice({name:"auth",initialState:tp,extraReducers:t=>t.addCase(b,s=>Object.assign(s,tp)),reducers:{setTokens:(t,s)=>{t.accessToken=s.payload.accessToken,t.refreshToken=s.payload.refreshToken},clearTokens:t=>{t.accessToken="",t.refreshToken=""},setLoggedIn:(t,s)=>{s.payload||Lt.caseReducers.clearTokens(t),t.isLoggedIn=s.payload}}}),{setTokens:L_,clearTokens:N_,setLoggedIn:sp}=Lt.actions,H_=t=>t.authReducer.accessToken,G_=t=>t.authReducer.isLoggedIn,ip=Lt.reducer,fe=R(t=>t.uuid),np={instances:{}},bi=u.createSlice({name:"categories",initialState:np,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,np)),reducers:{initializeCategories:fe.initialize,addCategory:fe.addOne,addCategories:fe.addMany,setCategory:fe.setOne,setCategories:fe.setMany,updateCategory:fe.updateOne,updateCategories:fe.updateMany,deleteCategory:fe.deleteOne,deleteCategories:fe.deleteMany}}),{initializeCategories:ap,addCategory:cp,addCategories:rp,setCategory:dp,setCategories:lp,updateCategory:op,updateCategories:up,deleteCategory:hp,deleteCategories:pp}=bi.actions,mp=t=>t.categoryReducer.instances,_i=u.createSelector([mp],t=>Object.values(t)),Ri=t=>s=>s.categoryReducer.instances[t],yp=A(u.createSelector([_i,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),K_=A(u.createSelector([_i,(t,s)=>s],(t,s)=>w(t.filter(e=>e.project===s)))),fp=bi.reducer,Se=R(t=>t.uuid),Sp={instances:{}},Mi=u.createSlice({name:"documentAttachments",initialState:Sp,extraReducers:t=>t.addCase(b,s=>Object.assign(s,Sp)),reducers:{initializeDocumentAttachments:Se.initialize,addDocumentAttachment:Se.addOne,addDocumentAttachments:Se.addMany,setDocumentAttachment:Se.setOne,setDocumentAttachments:Se.setMany,updateDocumentAttachment:Se.updateOne,updateDocumentAttachments:Se.updateMany,deleteDocumentAttachment:Se.deleteOne,deleteDocumentAttachments:Se.deleteMany}}),{initializeDocumentAttachments:Ap,addDocumentAttachment:wp,addDocumentAttachments:Tp,setDocumentAttachment:Op,setDocumentAttachments:Ip,updateDocumentAttachment:Fp,updateDocumentAttachments:Pp,deleteDocumentAttachment:gp,deleteDocumentAttachments:bp}=Mi.actions,_p=t=>t.documentAttachmentReducer.instances,ki=u.createSelector([_p],t=>Object.values(t)),Rp=t=>s=>s.documentAttachmentReducer.instances[t],Mp=A(u.createSelector([ki,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),Y_=A(u.createSelector([ki,(t,s)=>s],(t,s)=>w(t.filter(({document:e})=>s===e)))),kp=Mi.reducer,Ae=R(({uuid:t})=>t),vp={instances:{}},vi=u.createSlice({name:"documents",initialState:vp,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>{Object.assign(s,vp)}),reducers:{initializeDocuments:Ae.initialize,addDocument:Ae.addOne,addDocuments:Ae.addMany,setDocument:Ae.setOne,setDocuments:Ae.setMany,updateDocument:Ae.updateOne,updateDocuments:Ae.updateMany,deleteDocument:Ae.deleteOne,deleteDocuments:Ae.deleteMany}}),{initializeDocuments:Ep,addDocument:Vp,addDocuments:Wp,setDocument:Bp,setDocuments:zp,updateDocument:qp,updateDocuments:Cp,deleteDocument:jp,deleteDocuments:Dp}=vi.actions,$p=vi.reducer,Ei=t=>t.documentsReducer.instances,Nt=u.createSelector([Ei],t=>Object.values(t)),Up=t=>s=>s.documentsReducer.instances[t],Lp=A(u.createSelector([Nt,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),Z_=A(u.createSelector([Nt,(t,s)=>s],(t,s)=>t.filter(e=>e.project===s))),J_=A(u.createSelector([Nt,(t,s)=>s],(t,s)=>t.filter(e=>e.organization===s))),Np=A(u.createSelector([Ei,(t,s)=>s],(t,s)=>{if(!t[s])return w([]);const a=Mc(s,Object.values(t)).all().map(({model:c})=>c);return w(a)})),we=R(t=>t.uuid),Hp={instances:{}},Vi=u.createSlice({name:"emailDomains",initialState:Hp,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,Hp)),reducers:{initializeEmailDomains:we.initialize,addEmailDomain:we.addOne,addEmailDomains:we.addMany,setEmailDomain:we.setOne,setEmailDomains:we.setMany,updateEmailDomain:we.updateOne,updateEmailDomains:we.updateMany,deleteEmailDomain:we.deleteOne,deleteEmailDomains:we.deleteMany}}),{initializeEmailDomains:Gp,addEmailDomain:Kp,addEmailDomains:Yp,setEmailDomain:Zp,setEmailDomains:Jp,updateEmailDomain:Qp,updateEmailDomains:Xp,deleteEmailDomain:xp,deleteEmailDomains:em}=Vi.actions,tm=t=>t.emailDomainsReducer.instances,Wi=u.createSelector([tm],t=>Object.values(t)),sm=t=>s=>s.emailDomainsReducer.instances[t],im=A(u.createSelector([Wi,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),Q_=A(u.createSelector([Wi,(t,s)=>s],(t,s)=>w(t.filter(e=>e.organization===s)))),nm=Vi.reducer,am={s3Urls:{}},cm=1e3*60*60,X_=cm*24*7,Bi=u.createSlice({name:"file",initialState:am,extraReducers:t=>t.addCase(b,s=>Object.assign(s,am)),reducers:{setUploadUrl:(t,s)=>{const{url:e,fields:n,sha1:a}=s.payload,c=new Date,d=new Date(c.getTime()+X_);t.s3Urls[a]={url:e,fields:n,exp:d.getTime()}}}}),{setUploadUrl:rm}=Bi.actions,dm=t=>s=>{const e=s.fileReducer.s3Urls[t];if(!e)return;const n=new Date().getTime();if(!((e.exp??n)-n<cm))return e},lm=Bi.reducer,Te=R(t=>t.uuid),om={instances:{}},zi=u.createSlice({name:"formIdentifiers",initialState:om,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,om)),reducers:{initializeFormIdentifiers:Te.initialize,addFormIdentifier:Te.addOne,addFormIdentifiers:Te.addMany,setFormIdentifier:Te.setOne,setFormIdentifiers:Te.setMany,updateFormIdentifier:Te.updateOne,updateFormIdentifiers:Te.updateMany,deleteFormIdentifier:Te.deleteOne,deleteFormIdentifiers:Te.deleteMany}}),{initializeFormIdentifiers:um,addFormIdentifier:hm,addFormIdentifiers:pm,setFormIdentifier:mm,setFormIdentifiers:ym,updateFormIdentifier:fm,updateFormIdentifiers:Sm,deleteFormIdentifier:Am,deleteFormIdentifiers:wm}=zi.actions,Tm=t=>t.formIdentifierReducer.instances,qi=u.createSelector([Tm],t=>Object.values(t)),Om=t=>s=>s.formIdentifierReducer.instances[t],Im=A(u.createSelector([qi,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),x_=A(u.createSelector([qi,(t,s)=>s],(t,s)=>w(t.filter(e=>e.form===s)))),Fm=zi.reducer,Oe=R(t=>t.uuid),Pm={instances:{}},Ci=u.createSlice({name:"formIdentifierValues",initialState:Pm,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,Pm)),reducers:{initializeFormIdentifierValues:Oe.initialize,addFormIdentifierValue:Oe.addOne,addFormIdentifierValues:Oe.addMany,setFormIdentifierValue:Oe.setOne,setFormIdentifierValues:Oe.setMany,updateFormIdentifierValue:Oe.updateOne,updateFormIdentifierValues:Oe.updateMany,deleteFormIdentifierValue:Oe.deleteOne,deleteFormIdentifierValues:Oe.deleteMany}}),{initializeFormIdentifierValues:gm,addFormIdentifierValue:bm,addFormIdentifierValues:_m,setFormIdentifierValue:Rm,setFormIdentifierValues:Mm,updateFormIdentifierValue:km,updateFormIdentifierValues:vm,deleteFormIdentifierValue:Em,deleteFormIdentifierValues:Vm}=Ci.actions,Wm=t=>t.formIdentifierValueReducer.instances,Ht=u.createSelector([Wm],t=>Object.values(t)),Bm=t=>s=>s.formIdentifierValueReducer.instances[t],zm=A(u.createSelector([Ht,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),eR=A(u.createSelector([Ht,(t,s)=>s],(t,s)=>w(t.filter(e=>e.form_submission===s)))),tR=A(u.createSelector([Ht,(t,s)=>s],(t,s)=>w(t.filter(e=>e.form_identifier===s)))),qm=Ci.reducer,Ie=R(t=>t.uuid),Cm={instances:{}},ji=u.createSlice({name:"formRevisionAttachments",initialState:Cm,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,Cm)),reducers:{initializeFormRevisionAttachments:Ie.initialize,addFormRevisionAttachment:Ie.addOne,addFormRevisionAttachments:Ie.addMany,setFormRevisionAttachment:Ie.setOne,setFormRevisionAttachments:Ie.setMany,updateFormRevisionAttachment:Ie.updateOne,updateFormRevisionAttachments:Ie.updateMany,deleteFormRevisionAttachment:Ie.deleteOne,deleteFormRevisionAttachments:Ie.deleteMany}}),{initializeFormRevisionAttachments:jm,addFormRevisionAttachment:Dm,addFormRevisionAttachments:$m,setFormRevisionAttachment:Um,setFormRevisionAttachments:Lm,updateFormRevisionAttachment:Nm,updateFormRevisionAttachments:Hm,deleteFormRevisionAttachment:Gm,deleteFormRevisionAttachments:Km}=ji.actions,Gt=t=>t.formRevisionAttachmentReducer.instances,Ym=u.createSelector([Gt],t=>Object.values(t)),Zm=A(u.createSelector([Gt,(t,s)=>s],(t,s)=>t[s])),Jm=A(u.createSelector([Ym,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),sR=A(u.createSelector([Gt,(t,s)=>s],(t,s)=>w(Object.values(t).filter(e=>e.form_revision===s)))),Qm=ji.reducer,Fe=R(t=>t.uuid),Xm={instances:{}},Di=u.createSlice({name:"formRevisions",initialState:Xm,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,Xm)),reducers:{initializeFormRevisions:Fe.initialize,addFormRevision:Fe.addOne,addFormRevisions:Fe.addMany,setFormRevision:Fe.setOne,setFormRevisions:Fe.setMany,updateFormRevision:Fe.updateOne,updateFormRevisions:Fe.updateMany,deleteFormRevision:Fe.deleteOne,deleteFormRevisions:Fe.deleteMany}}),{initializeFormRevisions:xm,addFormRevision:$i,addFormRevisions:Ui,setFormRevision:ey,setFormRevisions:ty,updateFormRevision:sy,updateFormRevisions:iy,deleteFormRevision:Li,deleteFormRevisions:Ni}=Di.actions,Hi=t=>t.formRevisionReducer.instances,Kt=u.createSelector([Hi],t=>Object.values(t)),ny=t=>s=>s.formRevisionReducer.instances[t],ay=A(u.createSelector([Kt,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),iR=A(u.createSelector([Kt,(t,s)=>s],(t,s)=>t.filter(e=>e.form===s).sort((e,n)=>e.submitted_at>n.submitted_at?-1:1)[0])),cy=A(u.createSelector([Kt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.form===s)))),ry=Di.reducer,Pe=R(t=>t.uuid),dy={instances:{}},Gi=u.createSlice({name:"forms",initialState:dy,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,dy)),reducers:{initializeForms:Pe.initialize,addForm:Pe.addOne,addForms:Pe.addMany,setForm:Pe.setOne,setForms:Pe.setMany,updateForm:Pe.updateOne,updateForms:Pe.updateMany,deleteForm:Pe.deleteOne,deleteForms:Pe.deleteMany}}),{initializeForms:ly,addForm:oy,addForms:uy,setForm:hy,setForms:py,updateForm:my,updateForms:yy,deleteForm:fy,deleteForms:Sy}=Gi.actions,Ay=Gi.reducer,wy=t=>t.formReducer.instances,Ki=u.createSelector([wy],t=>Object.values(t)),Ty=t=>s=>s.formReducer.instances[t],Oy=A(u.createSelector([Ki,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),nR=A(u.createSelector([Ki,(t,s)=>s],(t,s)=>w(t.filter(e=>e.organization===s)))),ge=R(t=>t.uuid),Iy={instances:{}},Yi=u.createSlice({name:"formSubmissionAttachments",initialState:Iy,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,Iy)),reducers:{initializeFormSubmissionAttachments:ge.initialize,addFormSubmissionAttachment:ge.addOne,addFormSubmissionAttachments:ge.addMany,setFormSubmissionAttachment:ge.setOne,setFormSubmissionAttachments:ge.setMany,updateFormSubmissionAttachment:ge.updateOne,updateFormSubmissionAttachments:ge.updateMany,deleteFormSubmissionAttachment:ge.deleteOne,deleteFormSubmissionAttachments:ge.deleteMany}}),{initializeFormSubmissionAttachments:Fy,addFormSubmissionAttachment:Py,addFormSubmissionAttachments:Zi,setFormSubmissionAttachment:gy,setFormSubmissionAttachments:by,updateFormSubmissionAttachment:_y,updateFormSubmissionAttachments:Ry,deleteFormSubmissionAttachment:My,deleteFormSubmissionAttachments:Ji}=Yi.actions,Qi=t=>t.formSubmissionAttachmentReducer.instances,Xi=u.createSelector([Qi],t=>Object.values(t)),ky=A(u.createSelector([Qi,(t,s)=>s],(t,s)=>t[s])),xi=A(u.createSelector([Xi,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(n=>e.has(n.uuid)))})),vy=xi,Ey=A(u.createSelector([Xi,(t,s)=>s],(t,s)=>w(t.filter(e=>e.form_submission===s)))),Vy=Yi.reducer,be=R(t=>t.uuid),Wy={instances:{}},en=u.createSlice({name:"formSubmissions",initialState:Wy,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,Wy)),reducers:{initializeFormSubmissions:be.initialize,setFormSubmission:be.setOne,setFormSubmissions:be.setMany,addFormSubmission:be.addOne,addFormSubmissions:be.addMany,updateFormSubmission:be.updateOne,updateFormSubmissions:be.updateMany,deleteFormSubmission:be.deleteOne,deleteFormSubmissions:be.deleteMany}}),{initializeFormSubmissions:By,setFormSubmission:zy,setFormSubmissions:qy,addFormSubmission:Cy,addFormSubmissions:tn,updateFormSubmission:jy,updateFormSubmissions:Dy,deleteFormSubmission:$y,deleteFormSubmissions:sn}=en.actions,nn=t=>t.formSubmissionReducer.instances,Uy=u.createSelector([nn],t=>Object.values(t)),Ly=t=>s=>s.formSubmissionReducer.instances[t],Ny=A(u.createSelector([Uy,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),Hy=A(u.createSelector([nn,Hi,(t,s)=>s],(t,s,e)=>{const n=new Set;for(const a of Object.values(s))a.form===e&&n.add(a.uuid);return Object.values(t).filter(a=>n.has(a.form_revision))})),Gy=en.reducer,_e=R(t=>t.uuid),Ky={instances:{}},an=u.createSlice({name:"geoImages",initialState:Ky,extraReducers:t=>t.addMatcher(u.isAnyOf(b,z,M),s=>Object.assign(s,Ky)),reducers:{initializeGeoImages:_e.initialize,setGeoImage:_e.setOne,setGeoImages:_e.setMany,addGeoImage:_e.addOne,addGeoImages:_e.addMany,updateGeoImage:_e.updateOne,updateGeoImages:_e.updateMany,deleteGeoImage:_e.deleteOne,deleteGeoImages:_e.deleteMany}}),{initializeGeoImages:Yy,setGeoImage:Zy,setGeoImages:Jy,addGeoImage:Qy,addGeoImages:Xy,updateGeoImage:xy,updateGeoImages:ef,deleteGeoImage:tf,deleteGeoImages:sf}=an.actions,nf=t=>t.geoImageReducer.instances,cn=u.createSelector([nf],t=>Object.values(t)),af=t=>s=>s.geoImageReducer.instances[t],cf=A(u.createSelector([cn,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),aR=A(u.createSelector([cn,(t,s)=>s],(t,s)=>w(t.filter(e=>e.project===s)))),rf=an.reducer,Re=R(t=>t.uuid),df={instances:{}},rn=u.createSlice({name:"issueAssociations",initialState:df,extraReducers:t=>t.addMatcher(u.isAnyOf(b,z,M),s=>Object.assign(s,df)),reducers:{initializeIssueAssociations:Re.initialize,addIssueAssociation:Re.addOne,addIssueAssociations:Re.addMany,setIssueAssociation:Re.setOne,setIssueAssociations:Re.setMany,updateIssueAssociation:Re.updateOne,updateIssueAssociations:Re.updateMany,deleteIssueAssociation:Re.deleteOne,deleteIssueAssociations:Re.deleteMany}}),{initializeIssueAssociations:lf,setIssueAssociations:of,setIssueAssociation:uf,updateIssueAssociation:hf,updateIssueAssociations:pf,addIssueAssociation:mf,addIssueAssociations:Yt,deleteIssueAssociation:yf,deleteIssueAssociations:Zt}=rn.actions,bt=t=>t.issueAssociationReducer.instances,ff=u.createSelector([bt],t=>Object.values(t)),Sf=t=>s=>s.issueAssociationReducer.instances[t],Af=A(u.createSelector([ff,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),wf=A(u.createSelector([bt,(t,s)=>s],(t,s)=>w(Object.values(t).filter(e=>e.associated_issue===s)))),Tf=A(u.createSelector([bt,(t,s)=>s],(t,s)=>w(Object.values(t).filter(e=>e.issue===s)))),Of=A(u.createSelector([bt,(t,s)=>s],(t,s)=>w(Object.values(t).filter(e=>e.asset===s)))),If=rn.reducer,Me=R(t=>t.uuid),Ff={instances:{}},dn=u.createSlice({name:"issueAttachments",initialState:Ff,extraReducers:t=>t.addMatcher(u.isAnyOf(b,z,M),s=>Object.assign(s,Ff)),reducers:{initializeIssueAttachments:Me.initialize,addIssueAttachment:Me.addOne,addIssueAttachments:Me.addMany,setIssueAttachment:Me.setOne,setIssueAttachments:Me.setMany,updateIssueAttachment:Me.updateOne,updateIssueAttachments:Me.updateMany,deleteIssueAttachment:Me.deleteOne,deleteIssueAttachments:Me.deleteMany}}),{initializeIssueAttachments:Pf,addIssueAttachment:gf,addIssueAttachments:ln,setIssueAttachment:bf,setIssueAttachments:_f,updateIssueAttachment:Rf,updateIssueAttachments:Mf,deleteIssueAttachment:kf,deleteIssueAttachments:on}=dn.actions,vf=t=>t.issueAttachmentReducer.instances,un=u.createSelector([vf],t=>Object.values(t)),Ef=A(u.createSelector([un,(t,s)=>s],(t,s)=>w(t.filter(({issue:e})=>s===e)))),Vf=t=>s=>s.issueAttachmentReducer.instances[t],Wf=A(u.createSelector([un,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),Bf=dn.reducer,ke=R(t=>t.uuid),zf={instances:{}},hn=u.createSlice({name:"issueCommentAttachments",initialState:zf,extraReducers:t=>t.addMatcher(u.isAnyOf(b,z,M),s=>Object.assign(s,zf)),reducers:{initializeIssueCommentAttachments:ke.initialize,addIssueCommentAttachment:ke.addOne,addIssueCommentAttachments:ke.addMany,setIssueCommentAttachment:ke.setOne,setIssueCommentAttachments:ke.setMany,updateIssueCommentAttachment:ke.updateOne,updateIssueCommentAttachments:ke.updateMany,deleteIssueCommentAttachment:ke.deleteOne,deleteIssueCommentAttachments:ke.deleteMany}}),{initializeIssueCommentAttachments:qf,addIssueCommentAttachment:Cf,addIssueCommentAttachments:jf,setIssueCommentAttachment:Df,setIssueCommentAttachments:$f,updateIssueCommentAttachment:Uf,updateIssueCommentAttachments:Lf,deleteIssueCommentAttachment:Nf,deleteIssueCommentAttachments:Hf}=hn.actions,Gf=t=>t.issueCommentAttachmentReducer.instances,pn=u.createSelector([Gf],t=>Object.values(t)),Kf=t=>s=>s.issueCommentAttachmentReducer.instances[t],Yf=A(u.createSelector([pn,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),cR=A(u.createSelector([pn,(t,s)=>s],(t,s)=>w(t.filter(({issue_comment:e})=>s===e)))),Zf=hn.reducer,ve=R(t=>t.uuid),Jf={instances:{}},mn=u.createSlice({name:"issueComments",initialState:Jf,extraReducers:t=>t.addMatcher(u.isAnyOf(b,z,M),s=>Object.assign(s,Jf)),reducers:{initializeIssueComments:ve.initialize,addIssueComment:ve.addOne,addIssueComments:ve.addMany,setIssueComment:ve.setOne,setIssueComments:ve.setMany,updateIssueComment:ve.updateOne,updateIssueComments:ve.updateMany,deleteIssueComment:ve.deleteOne,deleteIssueComments:ve.deleteMany}}),{initializeIssueComments:Qf,addIssueComment:Xf,addIssueComments:xf,setIssueComment:eS,setIssueComments:tS,updateIssueComment:sS,updateIssueComments:iS,deleteIssueComment:nS,deleteIssueComments:aS}=mn.actions,yn=t=>t.issueCommentReducer.instances,cS=t=>s=>s.issueCommentReducer.instances[t],rS=A(u.createSelector([yn,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(Object.values(t).filter(({uuid:n})=>e.has(n)))})),rR=A(u.createSelector([yn,(t,s)=>s],(t,s)=>w(Object.values(t).filter(e=>e.issue===s)))),dS=mn.reducer,Ee=R(t=>t.uuid),lS={instances:{}},fn=u.createSlice({name:"issues",initialState:lS,extraReducers:t=>t.addMatcher(u.isAnyOf(b,z,M),s=>Object.assign(s,lS)),reducers:{initializeIssues:Ee.initialize,addIssue:Ee.addOne,addIssues:Ee.addMany,setIssue:Ee.setOne,setIssues:Ee.setMany,updateIssue:Ee.updateOne,updateIssues:Ee.updateMany,deleteIssue:Ee.deleteOne,deleteIssues:Ee.deleteMany}}),{initializeIssues:oS,addIssue:uS,addIssues:Sn,setIssue:hS,setIssues:pS,updateIssue:mS,updateIssues:yS,deleteIssue:fS,deleteIssues:An}=fn.actions,SS=t=>t.issueReducer.instances,Jt=u.createSelector([SS],t=>Object.values(t)),AS=t=>s=>s.issueReducer.instances[t],wS=A(u.createSelector([Jt,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),dR=A(u.createSelector([Jt,(t,s)=>s],(t,s)=>t.filter(e=>e.project===s))),TS=A(u.createSelector([Jt,(t,s)=>s],(t,s)=>t.filter(e=>e.issue_type===s))),OS=fn.reducer,Ve=R(t=>t.uuid),IS={instances:{}},wn=u.createSlice({name:"issueTypeAttachments",initialState:IS,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,IS)),reducers:{initializeIssueTypeAttachments:Ve.initialize,addIssueTypeAttachment:Ve.addOne,addIssueTypeAttachments:Ve.addMany,setIssueTypeAttachment:Ve.setOne,setIssueTypeAttachments:Ve.setMany,updateIssueTypeAttachment:Ve.updateOne,updateIssueTypeAttachments:Ve.updateMany,deleteIssueTypeAttachment:Ve.deleteOne,deleteIssueTypeAttachments:Ve.deleteMany}}),{initializeIssueTypeAttachments:FS,addIssueTypeAttachment:PS,addIssueTypeAttachments:gS,setIssueTypeAttachment:bS,setIssueTypeAttachments:_S,updateIssueTypeAttachment:RS,updateIssueTypeAttachments:MS,deleteIssueTypeAttachment:kS,deleteIssueTypeAttachments:vS}=wn.actions,ES=t=>t.issueTypeAttachmentReducer.instances,Tn=u.createSelector([ES],t=>Object.values(t)),VS=t=>s=>s.issueTypeAttachmentReducer.instances[t],WS=A(u.createSelector([Tn,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),lR=A(u.createSelector([Tn,(t,s)=>s],(t,s)=>w(t.filter(({issue_type:e})=>s===e)))),BS=wn.reducer,We=R(t=>t.uuid),zS={instances:{}},On=u.createSlice({name:"issueTypeFieldsAttachments",initialState:zS,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,zS)),reducers:{initializeIssueTypeFieldsAttachments:We.initialize,addIssueTypeFieldsAttachment:We.addOne,addIssueTypeFieldsAttachments:We.addMany,setIssueTypeFieldsAttachment:We.setOne,setIssueTypeFieldsAttachments:We.setMany,updateIssueTypeFieldsAttachment:We.updateOne,updateIssueTypeFieldsAttachments:We.updateMany,deleteIssueTypeFieldsAttachment:We.deleteOne,deleteIssueTypeFieldsAttachments:We.deleteMany}}),{initializeIssueTypeFieldsAttachments:qS,addIssueTypeFieldsAttachment:CS,addIssueTypeFieldsAttachments:jS,setIssueTypeFieldsAttachment:DS,setIssueTypeFieldsAttachments:$S,updateIssueTypeFieldsAttachment:US,updateIssueTypeFieldsAttachments:LS,deleteIssueTypeFieldsAttachment:NS,deleteIssueTypeFieldsAttachments:HS}=On.actions,GS=t=>t.issueTypeFieldsAttachmentReducer.instances,In=u.createSelector([GS],t=>Object.values(t)),oR=A(u.createSelector([In,(t,s)=>s],(t,s)=>w(t.filter(e=>e.fields_revision===s)))),KS=t=>s=>s.issueTypeFieldsAttachmentReducer.instances[t],YS=A(u.createSelector([In,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),ZS=On.reducer,Be=R(t=>t.uuid),JS={instances:{}},Fn=u.createSlice({name:"issueTypeFieldValues",initialState:JS,extraReducers:t=>t.addMatcher(u.isAnyOf(b,z,M),s=>Object.assign(s,JS)),reducers:{initializeIssueTypeFieldValues:Be.initialize,addIssueTypeFieldValues:Be.addOne,addIssueTypeFieldValuesMany:Be.addMany,setIssueTypeFieldValues:Be.setOne,setIssueTypeFieldValuesMany:Be.setMany,updateIssueTypeFieldValues:Be.updateOne,updateIssueTypeFieldValuesMany:Be.updateMany,deleteIssueTypeFieldValues:Be.deleteOne,deleteIssueTypeFieldValuesMany:Be.deleteMany}}),{initializeIssueTypeFieldValues:QS,addIssueTypeFieldValues:XS,addIssueTypeFieldValuesMany:xS,setIssueTypeFieldValues:eA,setIssueTypeFieldValuesMany:tA,updateIssueTypeFieldValues:sA,updateIssueTypeFieldValuesMany:iA,deleteIssueTypeFieldValues:nA,deleteIssueTypeFieldValuesMany:aA}=Fn.actions,cA=t=>t.issueTypeFieldValuesReducer.instances,Qt=u.createSelector([cA],t=>Object.values(t)),uR=A(u.createSelector([Qt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.issue===s)))),rA=t=>s=>s.issueTypeFieldValuesReducer.instances[t],dA=A(u.createSelector([Qt,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),lA=Fn.reducer,ze=R(t=>t.uuid),oA={instances:{}},Pn=u.createSlice({name:"issueTypeFields",initialState:oA,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,oA)),reducers:{initializeIssueTypeFields:ze.initialize,addIssueTypeFields:ze.addOne,addIssueTypeFieldsMany:ze.addMany,setIssueTypeFields:ze.setOne,setIssueTypeFieldsMany:ze.setMany,updateIssueTypeFields:ze.updateOne,updateIssueTypeFieldsMany:ze.updateMany,deleteIssueTypeFields:ze.deleteOne,deleteIssueTypeFieldsMany:ze.deleteMany}}),{initializeIssueTypeFields:uA,addIssueTypeFields:hA,addIssueTypeFieldsMany:pA,setIssueTypeFields:mA,setIssueTypeFieldsMany:yA,updateIssueTypeFields:fA,updateIssueTypeFieldsMany:SA,deleteIssueTypeFields:AA,deleteIssueTypeFieldsMany:wA}=Pn.actions,TA=t=>t.issueTypeFieldsReducer.instances,_t=u.createSelector([TA],t=>Object.values(t)),hR=A(u.createSelector([_t,(t,s)=>s],(t,s)=>w(t.filter(e=>e.issue_type===s)))),pR=A(u.createSelector([_t,(t,s)=>s],(t,s)=>t.filter(e=>e.issue_type===s).sort((e,n)=>e.submitted_at>n.submitted_at?-1:1)[0])),mR=A(u.createSelector([_t,Qt,(t,s)=>s],(t,s,e)=>{const n=new Set(t.filter(a=>a.issue_type===e).map(a=>a.uuid));return w(s.filter(a=>n.has(a.fields_revision)))})),OA=t=>s=>s.issueTypeFieldsReducer.instances[t],IA=A(u.createSelector([_t,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),FA=Pn.reducer,qe=R(t=>t.uuid),PA={instances:{}},gn=u.createSlice({name:"issueTypeFieldValuesAttachments",initialState:PA,extraReducers:t=>t.addMatcher(u.isAnyOf(b,z,M),s=>Object.assign(s,PA)),reducers:{initializeIssueTypeFieldValuesAttachments:qe.initialize,addIssueTypeFieldValuesAttachment:qe.addOne,addIssueTypeFieldValuesAttachments:qe.addMany,setIssueTypeFieldValuesAttachment:qe.setOne,setIssueTypeFieldValuesAttachments:qe.setMany,updateIssueTypeFieldValuesAttachment:qe.updateOne,updateIssueTypeFieldValuesAttachments:qe.updateMany,deleteIssueTypeFieldValuesAttachment:qe.deleteOne,deleteIssueTypeFieldValuesAttachments:qe.deleteMany}}),{initializeIssueTypeFieldValuesAttachments:gA,addIssueTypeFieldValuesAttachment:bA,addIssueTypeFieldValuesAttachments:bn,setIssueTypeFieldValuesAttachment:_A,setIssueTypeFieldValuesAttachments:RA,updateIssueTypeFieldValuesAttachment:MA,updateIssueTypeFieldValuesAttachments:kA,deleteIssueTypeFieldValuesAttachment:vA,deleteIssueTypeFieldValuesAttachments:_n}=gn.actions,EA=t=>t.issueTypeFieldValuesAttachmentReducer.instances,Rn=u.createSelector([EA],t=>Object.values(t)),VA=t=>s=>s.issueTypeFieldValuesAttachmentReducer.instances[t],WA=A(u.createSelector([Rn,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),BA=A(u.createSelector([Rn,(t,s)=>s],(t,s)=>w(t.filter(e=>e.field_values===s)))),zA=gn.reducer,Ce=R(t=>t.uuid),qA={instances:{}},Mn=u.createSlice({name:"issueTypeIdentifiers",initialState:qA,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,qA)),reducers:{initializeIssueTypeIdentifiers:Ce.initialize,addIssueTypeIdentifier:Ce.addOne,addIssueTypeIdentifiers:Ce.addMany,setIssueTypeIdentifier:Ce.setOne,setIssueTypeIdentifiers:Ce.setMany,updateIssueTypeIdentifier:Ce.updateOne,updateIssueTypeIdentifiers:Ce.updateMany,deleteIssueTypeIdentifier:Ce.deleteOne,deleteIssueTypeIdentifiers:Ce.deleteMany}}),{initializeIssueTypeIdentifiers:CA,addIssueTypeIdentifier:jA,addIssueTypeIdentifiers:DA,setIssueTypeIdentifier:$A,setIssueTypeIdentifiers:UA,updateIssueTypeIdentifier:LA,updateIssueTypeIdentifiers:NA,deleteIssueTypeIdentifier:HA,deleteIssueTypeIdentifiers:GA}=Mn.actions,KA=t=>t.issueTypeIdentifierReducer.instances,kn=u.createSelector([KA],t=>Object.values(t)),YA=t=>s=>s.issueTypeIdentifierReducer.instances[t],ZA=A(u.createSelector([kn,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),yR=A(u.createSelector([kn,(t,s)=>s],(t,s)=>w(t.filter(e=>e.issue_type===s)))),JA=Mn.reducer,je=R(t=>t.uuid),QA={instances:{}},vn=u.createSlice({name:"issueTypeIdentifierValues",initialState:QA,extraReducers:t=>t.addMatcher(u.isAnyOf(b,z,M),s=>Object.assign(s,QA)),reducers:{initializeIssueTypeIdentifierValues:je.initialize,addIssueTypeIdentifierValue:je.addOne,addIssueTypeIdentifierValues:je.addMany,setIssueTypeIdentifierValue:je.setOne,setIssueTypeIdentifierValues:je.setMany,updateIssueTypeIdentifierValue:je.updateOne,updateIssueTypeIdentifierValues:je.updateMany,deleteIssueTypeIdentifierValue:je.deleteOne,deleteIssueTypeIdentifierValues:je.deleteMany}}),{initializeIssueTypeIdentifierValues:XA,addIssueTypeIdentifierValue:xA,addIssueTypeIdentifierValues:ew,setIssueTypeIdentifierValue:tw,setIssueTypeIdentifierValues:sw,updateIssueTypeIdentifierValue:iw,updateIssueTypeIdentifierValues:nw,deleteIssueTypeIdentifierValue:aw,deleteIssueTypeIdentifierValues:cw}=vn.actions,rw=t=>t.issueTypeIdentifierValueReducer.instances,Xt=u.createSelector([rw],t=>Object.values(t)),dw=t=>s=>s.issueTypeIdentifierValueReducer.instances[t],lw=A(u.createSelector([Xt,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),fR=A(u.createSelector([Xt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.issue===s)))),SR=A(u.createSelector([Xt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.issue_type_identifier===s)))),ow=vn.reducer,De=R(t=>t.uuid),uw={instances:{}},En=u.createSlice({name:"issueTypes",initialState:uw,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,uw)),reducers:{initializeIssueTypes:De.initialize,addIssueType:De.addOne,addIssueTypes:De.addMany,setIssueType:De.setOne,setIssueTypes:De.setMany,updateIssueType:De.updateOne,updateIssueTypes:De.updateMany,deleteIssueType:De.deleteOne,deleteIssueTypes:De.deleteMany}}),{initializeIssueTypes:hw,addIssueType:pw,addIssueTypes:mw,setIssueType:yw,setIssueTypes:fw,updateIssueType:Sw,updateIssueTypes:Aw,deleteIssueType:ww,deleteIssueTypes:Tw}=En.actions,Ow=t=>t.issueTypeReducer.instances,Vn=u.createSelector(Ow,t=>Object.values(t)),Iw=t=>s=>s.issueTypeReducer.instances[t],Fw=A(u.createSelector([Vn,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),AR=A(u.createSelector([Vn,(t,s)=>s],(t,s)=>w(t.filter(e=>e.organization===s)))),Pw=En.reducer,$e=R(t=>t.uuid),gw={instances:{}},Wn=u.createSlice({name:"issueTypeStatuses",initialState:gw,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,gw)),reducers:{initializeIssueTypeStatuses:$e.initialize,addIssueTypeStatus:$e.addOne,addIssueTypeStatuses:$e.addMany,setIssueTypeStatus:$e.setOne,setIssueTypeStatuses:$e.setMany,updateIssueTypeStatus:$e.updateOne,updateIssueTypeStatuses:$e.updateMany,deleteIssueTypeStatus:$e.deleteOne,deleteIssueTypeStatuses:$e.deleteMany}}),{initializeIssueTypeStatuses:bw,addIssueTypeStatus:_w,addIssueTypeStatuses:Rw,setIssueTypeStatus:Mw,setIssueTypeStatuses:kw,updateIssueTypeStatus:vw,updateIssueTypeStatuses:Ew,deleteIssueTypeStatus:Vw,deleteIssueTypeStatuses:Ww}=Wn.actions,Bw=t=>t.issueTypeStatusReducer.instances,Bn=u.createSelector([Bw],t=>w(Object.values(t).toSorted(_c))),zn=t=>s=>s.issueTypeStatusReducer.instances[t],zw=A(u.createSelector([Bn,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),wR=A(u.createSelector([Bn,(t,s)=>s],(t,s)=>w(t.filter(e=>e.issue_type===s)))),qw=Wn.reducer,Ue=R(t=>t.uuid),Cw={instances:{}},qn=u.createSlice({name:"issueUpdates",initialState:Cw,extraReducers:t=>t.addMatcher(u.isAnyOf(b,z,M),s=>Object.assign(s,Cw)),reducers:{initializeIssueUpdates:Ue.initialize,addIssueUpdate:Ue.addOne,addIssueUpdates:Ue.addMany,setIssueUpdate:Ue.setOne,setIssueUpdates:Ue.setMany,updateIssueUpdate:Ue.updateOne,updateIssueUpdates:Ue.updateMany,deleteIssueUpdate:Ue.deleteOne,deleteIssueUpdates:Ue.deleteMany}}),{initializeIssueUpdates:jw,addIssueUpdate:Cn,addIssueUpdates:jn,setIssueUpdate:Dw,setIssueUpdates:$w,updateIssueUpdate:Uw,updateIssueUpdates:Lw,deleteIssueUpdate:Dn,deleteIssueUpdates:$n}=qn.actions,Un=t=>t.issueUpdateReducer.instances,Ln=u.createSelector([Un],t=>Object.values(t)),Nw=A(u.createSelector([Un,(t,s)=>s],(t,s)=>t[s])),Hw=A(u.createSelector([Ln,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),Gw=A(u.createSelector([Ln,(t,s)=>s],(t,s)=>w(t.filter(e=>e.issue===s)))),Kw=qn.reducer,Le=R(t=>t.id),Yw={instances:{},currentUser:null},Nn=u.createSlice({name:"users",initialState:Yw,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,Yw)),reducers:{initializeUsers:Le.initialize,setUsers:Le.setMany,setUser:Le.setOne,addUsers:Le.addMany,addUser:Le.addOne,updateUsers:Le.updateMany,updateUser:Le.updateOne,deleteUser:Le.deleteOne,deleteUsers:Le.deleteMany,setCurrentUser:(t,s)=>{t.currentUser=s.payload},setProfilePicture:(t,s)=>{if(!t.currentUser)return;t.currentUser.profile.file=s.payload.file??null,t.currentUser.profile.file_sha1=s.payload.file_sha1??null;const e=t.instances[t.currentUser.id];if(!e)throw new Error("Unable to find current user in users slice");e.profile.file=s.payload.file??null,e.profile.file_sha1=s.payload.file_sha1??null}}}),{initializeUsers:Zw,setUsers:Jw,setUser:Qw,addUsers:Xw,addUser:Hn,updateUsers:xw,updateUser:eT,deleteUser:Gn,deleteUsers:tT,setCurrentUser:TR,setProfilePicture:OR}=Nn.actions,sT=Nn.reducer,iT=t=>t.userReducer.currentUser,Kn=t=>t.userReducer.instances,xt=u.createSelector([Kn],t=>Object.values(t)),es=t=>s=>s.userReducer.instances[t],nT=A(u.createSelector([xt,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({id:n})=>e.has(n)))})),Ne=R(t=>t.uuid),aT={instances:{}},Yn=u.createSlice({name:"organizationAccess",initialState:aT,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,aT)),reducers:{initializeOrganizationAccesses:Ne.initialize,addOrganizationAccess:Ne.addOne,addOrganizationAccesses:Ne.addMany,setOrganizationAccess:Ne.setOne,setOrganizationAccesses:Ne.setMany,updateOrganizationAccess:Ne.updateOne,updateOrganizationAccesses:Ne.updateMany,deleteOrganizationAccess:Ne.deleteOne,deleteOrganizationAccesses:Ne.deleteMany}}),{initializeOrganizationAccesses:cT,addOrganizationAccess:rT,addOrganizationAccesses:dT,setOrganizationAccess:lT,setOrganizationAccesses:oT,updateOrganizationAccess:uT,updateOrganizationAccesses:hT,deleteOrganizationAccess:pT,deleteOrganizationAccesses:mT}=Yn.actions,yT=Yn.reducer,ts=t=>t.organizationAccessReducer.instances,fT=t=>s=>s.organizationAccessReducer.instances[t],ST=A(u.createSelector([ts,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(Object.values(t).filter(({uuid:n})=>e.has(n)))})),IR=u.createSelector([iT,ts],(t,s)=>Object.values(s).find(n=>n.user===(t==null?void 0:t.id))??null),AT=u.createSelector([ts],t=>{const s={};for(const e of Object.values(t))s[e.user]=e;return Vt(s)}),FR=A(u.createSelector([Kn,AT,(t,s)=>s],(t,s,e)=>w(Object.values(t).filter(n=>{const a=s[n.id];return!!a&&a.organization===e})))),He=R(t=>t.uuid),wT={instances:{}},Zn=u.createSlice({name:"organizations",initialState:wT,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,wT)),reducers:{initializeOrganizations:He.initialize,setOrganizations:He.setMany,setOrganization:He.setOne,addOrganizations:He.addMany,addOrganization:He.addOne,updateOrganizations:He.updateMany,updateOrganization:He.updateOne,deleteOrganization:He.deleteOne,deleteOrganizations:He.deleteMany}}),{initializeOrganizations:TT,setOrganizations:OT,setOrganization:IT,addOrganizations:FT,addOrganization:PT,updateOrganizations:gT,updateOrganization:bT,deleteOrganization:_T,deleteOrganizations:RT}=Zn.actions,MT=t=>t.organizationReducer.instances,kT=u.createSelector([MT],t=>Object.values(t)),vT=t=>s=>s.organizationReducer.instances[t],ET=A(u.createSelector([kT,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),VT=Zn.reducer,WT=(t,s,e)=>{const n=t.uuid?t:{...t,uuid:mt.v4()};return{payload:n,type:"",meta:{offline:{effect:{timestamp:new Date().toISOString(),request:n,BASE_URL:s,serviceName:e}}}}},BT={deletedRequests:[],latestRetryTime:0},Jn=u.createSlice({name:"outbox",initialState:BT,extraReducers:t=>t.addCase(b,s=>Object.assign(s,BT)),reducers:{enqueueRequest:{reducer:(t,s)=>t,prepare:t=>{console.debug("Preparing to enqueue request",t.url);const{BASE_URL:s,serviceName:e,...n}=t;return WT(n,s,e)}},markForDeletion(t,s){t.deletedRequests.push(s.payload)},markAsDeleted(t,s){const e=t.deletedRequests.indexOf(s.payload);e!==-1&&t.deletedRequests.splice(e,1)},_setLatestRetryTime:(t,s)=>{t.latestRetryTime=s.payload}}}),PR=t=>t.outboxReducer.deletedRequests,gR=t=>t.outboxReducer.latestRetryTime,{enqueueRequest:zT,markForDeletion:bR,markAsDeleted:qT,_setLatestRetryTime:CT}=Jn.actions,jT=Jn.reducer,Ge=R(t=>t.uuid),DT={instances:{}},Qn=u.createSlice({name:"projectAccess",initialState:DT,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,DT)),reducers:{initializeProjectAccesses:Ge.initialize,addProjectAccess:Ge.addOne,addProjectAccesses:Ge.addMany,setProjectAccess:Ge.setOne,setProjectAccesses:Ge.setMany,updateProjectAccess:Ge.updateOne,updateProjectAccesses:Ge.updateMany,deleteProjectAccess:Ge.deleteOne,deleteProjectAccesses:Ge.deleteMany}}),{initializeProjectAccesses:$T,addProjectAccess:UT,addProjectAccesses:LT,setProjectAccess:NT,setProjectAccesses:HT,updateProjectAccess:GT,updateProjectAccesses:KT,deleteProjectAccess:YT,deleteProjectAccesses:ZT}=Qn.actions,JT=Qn.reducer,Xn=t=>t.projectAccessReducer.instances,Rt=u.createSelector(Xn,t=>Object.values(t)),QT=t=>s=>s.projectAccessReducer.instances[t],XT=A(u.createSelector([Rt,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),_R=A(u.createSelector([Xn,(t,s)=>s],(t,s)=>w(Object.values(t).filter(e=>e.project===s)))),RR=A(u.createSelector([Rt,(t,s)=>s],(t,s)=>{const e={};for(const n of t.filter(a=>a.project===s))e[n.user]=n;return e})),MR=A(u.createSelector([xt,Rt,(t,s)=>s],(t,s,e)=>{const n=new Set(s.filter(a=>a.project===e).map(a=>a.user));return w(t.filter(a=>n.has(a.id)))})),Ke=R(t=>t.uuid),xT={instances:{}},xn=u.createSlice({name:"projectAttachments",initialState:xT,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,xT)),reducers:{initializeProjectAttachments:Ke.initialize,addProjectAttachment:Ke.addOne,addProjectAttachments:Ke.addMany,setProjectAttachment:Ke.setOne,setProjectAttachments:Ke.setMany,updateProjectAttachment:Ke.updateOne,updateProjectAttachments:Ke.updateMany,deleteProjectAttachment:Ke.deleteOne,deleteProjectAttachments:Ke.deleteMany}}),{initializeProjectAttachments:eO,addProjectAttachment:tO,addProjectAttachments:sO,setProjectAttachment:iO,setProjectAttachments:nO,updateProjectAttachment:aO,updateProjectAttachments:cO,deleteProjectAttachment:rO,deleteProjectAttachments:dO}=xn.actions,lO=t=>t.projectAttachmentReducer.instances,ea=u.createSelector([lO],t=>Object.values(t)),oO=t=>s=>s.projectAttachmentReducer.instances[t],uO=A(u.createSelector([ea,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),kR=A(u.createSelector([ea,(t,s)=>s],(t,s)=>w(t.filter(({project:e})=>s===e)))),hO=xn.reducer,Ye=R(t=>t.uuid),pO={instances:{},activeProjectFileId:null,isImportingProjectFile:!1},ta=u.createSlice({name:"projectFiles",initialState:pO,extraReducers:t=>t.addMatcher(u.isAnyOf(b,z,M),s=>Object.assign(s,pO)),reducers:{initializeProjectFiles:Ye.initialize,setProjectFile:Ye.setOne,setProjectFiles:Ye.setMany,addProjectFile:Ye.addOne,addProjectFiles:Ye.addMany,updateProjectFile:Ye.updateOne,updateProjectFiles:Ye.updateMany,deleteProjectFile:Ye.deleteOne,deleteProjectFiles:Ye.deleteMany,setIsImportingProjectFile:(t,s)=>{t.isImportingProjectFile=s.payload},saveActiveProjectFileBounds:(t,s)=>{const e=t.activeProjectFileId;if(!e)throw new Error("Tried to save bounds for active project file, but no active project file was set.");if(!t.instances[e])throw new Error(`Tried to save bounds for active project file, but project file with ID ${e}
2
- doesn't exist.`);t.instances[e].bounds=s.payload},setActiveProjectFileId:(t,s)=>{t.activeProjectFileId=s.payload}}}),{initializeProjectFiles:mO,setProjectFile:yO,setProjectFiles:fO,addProjectFile:SO,addProjectFiles:AO,updateProjectFile:wO,updateProjectFiles:TO,deleteProjectFile:OO,deleteProjectFiles:IO,setIsImportingProjectFile:FO,setActiveProjectFileId:PO,saveActiveProjectFileBounds:gO}=ta.actions,bO=t=>t.projectFileReducer.instances,_O=u.createSelector([bO],t=>w(Object.values(t).sort((s,e)=>s.z_index-e.z_index))),RO=t=>s=>s.projectFileReducer.instances[t],MO=A(u.createSelector([_O,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),vR=t=>t.projectFileReducer.activeProjectFileId,ER=t=>t.projectFileReducer.isImportingProjectFile,kO=ta.reducer,Ze=R(t=>t.uuid),vO={instances:{}},sa=u.createSlice({name:"projects",initialState:vO,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,vO)),reducers:{initializeProjects:Ze.initialize,setProjects:Ze.setMany,setProject:Ze.setOne,addProjects:Ze.addMany,addProject:Ze.addOne,updateProjects:Ze.updateMany,updateProject:Ze.updateOne,deleteProject:Ze.deleteOne,deleteProjects:Ze.deleteMany}}),{initializeProjects:EO,setProjects:VO,setProject:WO,addProjects:BO,addProject:zO,updateProjects:qO,updateProject:CO,deleteProject:jO,deleteProjects:DO}=sa.actions,$O=sa.reducer,UO=t=>t.projectReducer.instances,ss=u.createSelector([UO],t=>Object.values(t)),LO=t=>s=>s.projectReducer.instances[t],NO=A(u.createSelector([ss,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),VR=A(u.createSelector([ss,Rt,(t,s)=>s],(t,s,e)=>{const n=new Set(s.filter(a=>a.user===e).map(a=>a.project));return w(t.filter(a=>n.has(a.uuid)))})),WR=A(u.createSelector([ss,(t,s)=>s],(t,s)=>w(t.filter(e=>e.organization===s)))),BR={isRehydrated:!1},ia=u.createSlice({name:"rehydrated",initialState:BR,reducers:{setRehydrated:(t,s)=>{t.isRehydrated=s.payload}}}),{setRehydrated:zR}=ia.actions,qR=t=>t.rehydratedReducer.isRehydrated,HO=ia.reducer,Je=R(t=>t.uuid),GO={instances:{}},na=u.createSlice({name:"teamMemberships",initialState:GO,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,GO)),reducers:{initializeTeamMemberships:Je.initialize,addTeamMembership:Je.addOne,addTeamMemberships:Je.addMany,setTeamMembership:Je.setOne,setTeamMemberships:Je.setMany,updateTeamMembership:Je.updateOne,updateTeamMemberships:Je.updateMany,deleteTeamMembership:Je.deleteOne,deleteTeamMemberships:Je.deleteMany}}),{initializeTeamMemberships:KO,addTeamMembership:YO,addTeamMemberships:ZO,setTeamMembership:JO,setTeamMemberships:QO,updateTeamMembership:XO,updateTeamMemberships:xO,deleteTeamMembership:eI,deleteTeamMemberships:tI}=na.actions,sI=na.reducer,iI=t=>t.teamMembershipReducer.instances,is=u.createSelector([iI],t=>Object.values(t)),nI=t=>s=>s.teamMembershipReducer.instances[t],aI=A(u.createSelector([is,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),CR=A(u.createSelector([is,(t,s)=>s],(t,s)=>{const e={};for(const n of t.filter(a=>a.team===s))e[n.user]=n;return e})),jR=A(u.createSelector([xt,is,(t,s)=>s],(t,s,e)=>{const n=new Set(s.filter(a=>a.team===e).map(a=>a.user));return w(t.filter(a=>n.has(a.id)))})),Qe=R(t=>t.uuid),cI={instances:{}},aa=u.createSlice({name:"teams",initialState:cI,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,cI)),reducers:{initializeTeams:Qe.initialize,addTeam:Qe.addOne,addTeams:Qe.addMany,setTeam:Qe.setOne,setTeams:Qe.setMany,updateTeam:Qe.updateOne,updateTeams:Qe.updateMany,deleteTeam:Qe.deleteOne,deleteTeams:Qe.deleteMany}}),{initializeTeams:rI,addTeam:dI,addTeams:lI,setTeam:oI,setTeams:uI,updateTeam:hI,updateTeams:pI,deleteTeam:mI,deleteTeams:yI}=aa.actions,fI=t=>t.teamReducer.instances,ca=u.createSelector([fI],t=>Object.values(t)),SI=t=>s=>s.teamReducer.instances[t],AI=A(u.createSelector([ca,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),DR=A(u.createSelector([ca,(t,s)=>s],(t,s)=>w(t.filter(e=>e.organization===s)))),wI=aa.reducer,Xe=R(t=>t.uuid),TI={instances:{}},ra=u.createSlice({name:"workflows",initialState:TI,extraReducers:t=>t.addMatcher(u.isAnyOf(b,z,M),s=>Object.assign(s,TI)),reducers:{initializeWorkflows:Xe.initialize,addWorkflow:Xe.addOne,addWorkflows:Xe.addMany,setWorkflow:Xe.setOne,setWorkflows:Xe.setMany,updateWorkflow:Xe.updateOne,updateWorkflows:Xe.updateMany,deleteWorkflow:Xe.deleteOne,deleteWorkflows:Xe.deleteMany}}),{initializeWorkflows:OI,addWorkflow:II,addWorkflows:da,setWorkflow:FI,setWorkflows:PI,updateWorkflow:gI,updateWorkflows:bI,deleteWorkflow:_I,deleteWorkflows:la}=ra.actions,RI=t=>t.workflowReducer.instances,ns=u.createSelector([RI],t=>Object.values(t)),MI=t=>s=>s.workflowReducer.instances[t],kI=A(u.createSelector([ns,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),$R=A(u.createSelector([ns,(t,s)=>s],(t,s)=>w(t.filter(e=>e.project===s)))),vI=A(u.createSelector([ns,(t,s)=>s],(t,s)=>w(t.filter(e=>e.workflow_type===s)))),EI=ra.reducer,xe=R(t=>t.uuid),VI={instances:{}},oa=u.createSlice({name:"workflowStepAssignees",initialState:VI,extraReducers:t=>t.addMatcher(u.isAnyOf(b,z,M),s=>Object.assign(s,VI)),reducers:{initializeWorkflowStepAssignees:xe.initialize,addWorkflowStepAssignee:xe.addOne,addWorkflowStepAssignees:xe.addMany,setWorkflowStepAssignee:xe.setOne,setWorkflowStepAssignees:xe.setMany,updateWorkflowStepAssignee:xe.updateOne,updateWorkflowStepAssignees:xe.updateMany,deleteWorkflowStepAssignee:xe.deleteOne,deleteWorkflowStepAssignees:xe.deleteMany}}),{initializeWorkflowStepAssignees:WI,addWorkflowStepAssignee:BI,addWorkflowStepAssignees:ua,setWorkflowStepAssignee:zI,setWorkflowStepAssignees:qI,updateWorkflowStepAssignee:CI,updateWorkflowStepAssignees:jI,deleteWorkflowStepAssignee:DI,deleteWorkflowStepAssignees:ha}=oa.actions,$I=t=>t.workflowStepAssigneeReducer.instances,Mt=u.createSelector([$I],t=>Object.values(t)),UI=t=>s=>s.workflowStepAssigneeReducer.instances[t],LI=A(u.createSelector([Mt,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),NI=A(u.createSelector([Mt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.workflow===s)))),UR=A(u.createSelector([Mt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.workflow_step===s)))),LR=A(u.createSelector([Mt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.user===s)))),HI=oa.reducer,et=R(t=>t.uuid),GI={instances:{}},pa=u.createSlice({name:"workflowStepCommentAttachments",initialState:GI,extraReducers:t=>t.addMatcher(u.isAnyOf(b,z,M),s=>Object.assign(s,GI)),reducers:{initializeWorkflowStepCommentAttachments:et.initialize,addWorkflowStepCommentAttachment:et.addOne,addWorkflowStepCommentAttachments:et.addMany,setWorkflowStepCommentAttachment:et.setOne,setWorkflowStepCommentAttachments:et.setMany,updateWorkflowStepCommentAttachment:et.updateOne,updateWorkflowStepCommentAttachments:et.updateMany,deleteWorkflowStepCommentAttachment:et.deleteOne,deleteWorkflowStepCommentAttachments:et.deleteMany}}),{initializeWorkflowStepCommentAttachments:KI,addWorkflowStepCommentAttachment:YI,addWorkflowStepCommentAttachments:as,setWorkflowStepCommentAttachment:ZI,setWorkflowStepCommentAttachments:JI,updateWorkflowStepCommentAttachment:QI,updateWorkflowStepCommentAttachments:XI,deleteWorkflowStepCommentAttachment:xI,deleteWorkflowStepCommentAttachments:cs}=pa.actions,eF=t=>t.workflowStepCommentAttachmentReducer.instances,ma=u.createSelector([eF],t=>Object.values(t)),tF=t=>s=>s.workflowStepCommentAttachmentReducer.instances[t],sF=A(u.createSelector([ma,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),ya=A(u.createSelector([ma,(t,s)=>s],(t,s)=>w(t.filter(e=>e.workflow_step_comment===s)))),iF=pa.reducer,tt=R(t=>t.uuid),nF={instances:{}},fa=u.createSlice({name:"workflowStepComments",initialState:nF,extraReducers:t=>t.addMatcher(u.isAnyOf(b,z,M),s=>Object.assign(s,nF)),reducers:{initializeWorkflowStepComments:tt.initialize,addWorkflowStepComment:tt.addOne,addWorkflowStepComments:tt.addMany,setWorkflowStepComment:tt.setOne,setWorkflowStepComments:tt.setMany,updateWorkflowStepComment:tt.updateOne,updateWorkflowStepComments:tt.updateMany,deleteWorkflowStepComment:tt.deleteOne,deleteWorkflowStepComments:tt.deleteMany}}),{initializeWorkflowStepComments:aF,addWorkflowStepComment:cF,addWorkflowStepComments:Sa,setWorkflowStepComment:rF,setWorkflowStepComments:dF,updateWorkflowStepComment:lF,updateWorkflowStepComments:oF,deleteWorkflowStepComment:uF,deleteWorkflowStepComments:Aa}=fa.actions,hF=t=>t.workflowStepCommentReducer.instances,rs=u.createSelector([hF],t=>Object.values(t)),pF=t=>s=>s.workflowStepCommentReducer.instances[t],mF=A(u.createSelector([rs,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),yF=A(u.createSelector([rs,(t,s)=>s],(t,s)=>w(t.filter(e=>e.workflow===s)))),NR=A(u.createSelector([rs,(t,s)=>s],(t,s)=>w(t.filter(e=>e.workflow_step===s)))),fF=fa.reducer,st=R(t=>t.uuid),SF={instances:{}},wa=u.createSlice({name:"workflowStepCompletions",initialState:SF,extraReducers:t=>t.addMatcher(u.isAnyOf(b,z,M),s=>Object.assign(s,SF)),reducers:{initializeWorkflowStepCompletions:st.initialize,addWorkflowStepCompletion:st.addOne,addWorkflowStepCompletions:st.addMany,setWorkflowStepCompletion:st.setOne,setWorkflowStepCompletions:st.setMany,updateWorkflowStepCompletion:st.updateOne,updateWorkflowStepCompletions:st.updateMany,deleteWorkflowStepCompletion:st.deleteOne,deleteWorkflowStepCompletions:st.deleteMany}}),{initializeWorkflowStepCompletions:AF,addWorkflowStepCompletion:wF,addWorkflowStepCompletions:Ta,setWorkflowStepCompletion:TF,setWorkflowStepCompletions:OF,updateWorkflowStepCompletion:IF,updateWorkflowStepCompletions:FF,deleteWorkflowStepCompletion:PF,deleteWorkflowStepCompletions:Oa}=wa.actions,gF=t=>t.workflowStepCompletionReducer.instances,ds=u.createSelector([gF],t=>Object.values(t)),bF=t=>s=>s.workflowStepCompletionReducer.instances[t],_F=A(u.createSelector([ds,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),RF=A(u.createSelector([ds,(t,s)=>s],(t,s)=>w(t.filter(e=>e.workflow===s)))),HR=A(u.createSelector([ds,(t,s)=>s],(t,s)=>w(t.filter(e=>e.workflow_step===s)))),MF=wa.reducer,it=R(t=>t.uuid),kF={instances:{}},Ia=u.createSlice({name:"workflowStepEvents",initialState:kF,extraReducers:t=>t.addMatcher(u.isAnyOf(b,z,M),s=>Object.assign(s,kF)),reducers:{initializeWorkflowStepEvents:it.initialize,addWorkflowStepEvent:it.addOne,addWorkflowStepEvents:it.addMany,setWorkflowStepEvent:it.setOne,setWorkflowStepEvents:it.setMany,updateWorkflowStepEvent:it.updateOne,updateWorkflowStepEvents:it.updateMany,deleteWorkflowStepEvent:it.deleteOne,deleteWorkflowStepEvents:it.deleteMany}}),{initializeWorkflowStepEvents:vF,addWorkflowStepEvent:EF,addWorkflowStepEvents:Fa,setWorkflowStepEvent:VF,setWorkflowStepEvents:WF,updateWorkflowStepEvent:BF,updateWorkflowStepEvents:zF,deleteWorkflowStepEvent:qF,deleteWorkflowStepEvents:Pa}=Ia.actions,ga=t=>t.workflowStepEventReducer.instances,ls=u.createSelector([ga],t=>Object.values(t)),CF=A(u.createSelector([ga,(t,s)=>s],(t,s)=>t[s])),jF=A(u.createSelector([ls,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),DF=A(u.createSelector([ls,(t,s)=>s],(t,s)=>w(t.filter(e=>e.workflow===s)))),GR=A(u.createSelector([ls,(t,s)=>s],(t,s)=>w(t.filter(e=>e.workflow_step===s)))),$F=Ia.reducer,nt=R(t=>t.uuid),UF={instances:{}},ba=u.createSlice({name:"workflowStepFieldValuesAttachments",initialState:UF,extraReducers:t=>t.addMatcher(u.isAnyOf(b,z,M),s=>Object.assign(s,UF)),reducers:{initializeWorkflowStepFieldValuesAttachments:nt.initialize,addWorkflowStepFieldValuesAttachment:nt.addOne,addWorkflowStepFieldValuesAttachments:nt.addMany,setWorkflowStepFieldValuesAttachment:nt.setOne,setWorkflowStepFieldValuesAttachments:nt.setMany,updateWorkflowStepFieldValuesAttachment:nt.updateOne,updateWorkflowStepFieldValuesAttachments:nt.updateMany,deleteWorkflowStepFieldValuesAttachment:nt.deleteOne,deleteWorkflowStepFieldValuesAttachments:nt.deleteMany}}),{initializeWorkflowStepFieldValuesAttachments:LF,addWorkflowStepFieldValuesAttachment:NF,addWorkflowStepFieldValuesAttachments:_a,setWorkflowStepFieldValuesAttachment:HF,setWorkflowStepFieldValuesAttachments:GF,updateWorkflowStepFieldValuesAttachment:KF,updateWorkflowStepFieldValuesAttachments:YF,deleteWorkflowStepFieldValuesAttachment:ZF,deleteWorkflowStepFieldValuesAttachments:Ra}=ba.actions,JF=t=>t.workflowStepFieldValuesAttachmentReducer.instances,Ma=u.createSelector([JF],t=>Object.values(t)),QF=t=>s=>s.workflowStepFieldValuesAttachmentReducer.instances[t],XF=A(u.createSelector([Ma,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),xF=A(u.createSelector([Ma,(t,s)=>s],(t,s)=>w(t.filter(e=>e.field_values===s)))),eP=ba.reducer,at=R(t=>t.uuid),tP={instances:{}},ka=u.createSlice({name:"workflowStepFieldValues",initialState:tP,extraReducers:t=>t.addMatcher(u.isAnyOf(b,z,M),s=>Object.assign(s,tP)),reducers:{initializeWorkflowStepFieldValues:at.initialize,addWorkflowStepFieldValues:at.addOne,addWorkflowStepFieldValuesMany:at.addMany,setWorkflowStepFieldValues:at.setOne,setWorkflowStepFieldValuesMany:at.setMany,updateWorkflowStepFieldValues:at.updateOne,updateWorkflowStepFieldValuesMany:at.updateMany,deleteWorkflowStepFieldValues:at.deleteOne,deleteWorkflowStepFieldValuesMany:at.deleteMany}}),{initializeWorkflowStepFieldValues:sP,addWorkflowStepFieldValues:iP,addWorkflowStepFieldValuesMany:va,setWorkflowStepFieldValues:nP,setWorkflowStepFieldValuesMany:aP,updateWorkflowStepFieldValues:cP,updateWorkflowStepFieldValuesMany:rP,deleteWorkflowStepFieldValues:dP,deleteWorkflowStepFieldValuesMany:Ea}=ka.actions,lP=t=>t.workflowStepFieldValuesReducer.instances,kt=u.createSelector([lP],t=>Object.values(t)),oP=A(u.createSelector([kt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.workflow===s)))),KR=A(u.createSelector([kt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.workflow_step===s)))),YR=A(u.createSelector([kt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.fields_revision===s)))),uP=t=>s=>s.workflowStepFieldValuesReducer.instances[t],hP=A(u.createSelector([kt,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),pP=ka.reducer,ct=R(t=>t.uuid),mP={instances:{}},Va=u.createSlice({name:"workflowStepFieldsAttachments",initialState:mP,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,mP)),reducers:{initializeWorkflowStepFieldsAttachments:ct.initialize,addWorkflowStepFieldsAttachment:ct.addOne,addWorkflowStepFieldsAttachments:ct.addMany,setWorkflowStepFieldsAttachment:ct.setOne,setWorkflowStepFieldsAttachments:ct.setMany,updateWorkflowStepFieldsAttachment:ct.updateOne,updateWorkflowStepFieldsAttachments:ct.updateMany,deleteWorkflowStepFieldsAttachment:ct.deleteOne,deleteWorkflowStepFieldsAttachments:ct.deleteMany}}),{initializeWorkflowStepFieldsAttachments:yP,addWorkflowStepFieldsAttachment:fP,addWorkflowStepFieldsAttachments:Wa,setWorkflowStepFieldsAttachment:SP,setWorkflowStepFieldsAttachments:AP,updateWorkflowStepFieldsAttachment:wP,updateWorkflowStepFieldsAttachments:TP,deleteWorkflowStepFieldsAttachment:OP,deleteWorkflowStepFieldsAttachments:Ba}=Va.actions,IP=t=>t.workflowStepFieldsAttachmentReducer.instances,za=u.createSelector([IP],t=>Object.values(t)),FP=A(u.createSelector([za,(t,s)=>s],(t,s)=>w(t.filter(e=>e.fields_revision===s)))),PP=t=>s=>s.workflowStepFieldsAttachmentReducer.instances[t],gP=A(u.createSelector([za,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),bP=Va.reducer,rt=R(t=>t.uuid),_P={instances:{}},qa=u.createSlice({name:"workflowStepFields",initialState:_P,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,_P)),reducers:{initializeWorkflowStepFields:rt.initialize,addWorkflowStepFields:rt.addOne,addWorkflowStepFieldsMany:rt.addMany,setWorkflowStepFields:rt.setOne,setWorkflowStepFieldsMany:rt.setMany,updateWorkflowStepFields:rt.updateOne,updateWorkflowStepFieldsMany:rt.updateMany,deleteWorkflowStepFields:rt.deleteOne,deleteWorkflowStepFieldsMany:rt.deleteMany}}),{initializeWorkflowStepFields:RP,addWorkflowStepFields:MP,addWorkflowStepFieldsMany:kP,setWorkflowStepFields:vP,setWorkflowStepFieldsMany:EP,updateWorkflowStepFields:VP,updateWorkflowStepFieldsMany:WP,deleteWorkflowStepFields:BP,deleteWorkflowStepFieldsMany:zP}=qa.actions,Ca=t=>t.workflowStepFieldsReducer.instances,os=u.createSelector([Ca],t=>Object.values(t)),ZR=A(u.createSelector([os,(t,s)=>s],(t,s)=>w(t.filter(e=>e.workflow_step===s)))),JR=A(u.createSelector([os,(t,s)=>s],(t,s)=>t.filter(e=>e.workflow_step===s).sort((e,n)=>e.submitted_at>n.submitted_at?-1:1)[0])),QR=u.createSelector([Ca],t=>{const s={};for(const e of Object.values(t)){const n=s[e.workflow_step];(!n||n.submitted_at<e.submitted_at)&&(s[e.workflow_step]=e)}return s}),qP=t=>s=>s.workflowStepFieldsReducer.instances[t],CP=A(u.createSelector([os,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),jP=qa.reducer,dt=R(t=>t.uuid),DP={instances:{}},ja=u.createSlice({name:"workflowStepReviewers",initialState:DP,extraReducers:t=>t.addMatcher(u.isAnyOf(b,z,M),s=>Object.assign(s,DP)),reducers:{initializeWorkflowStepReviewers:dt.initialize,addWorkflowStepReviewer:dt.addOne,addWorkflowStepReviewers:dt.addMany,setWorkflowStepReviewer:dt.setOne,setWorkflowStepReviewers:dt.setMany,updateWorkflowStepReviewer:dt.updateOne,updateWorkflowStepReviewers:dt.updateMany,deleteWorkflowStepReviewer:dt.deleteOne,deleteWorkflowStepReviewers:dt.deleteMany}}),{initializeWorkflowStepReviewers:$P,addWorkflowStepReviewer:UP,addWorkflowStepReviewers:Da,setWorkflowStepReviewer:LP,setWorkflowStepReviewers:NP,updateWorkflowStepReviewer:HP,updateWorkflowStepReviewers:GP,deleteWorkflowStepReviewer:KP,deleteWorkflowStepReviewers:$a}=ja.actions,YP=t=>t.workflowStepReviewerReducer.instances,vt=u.createSelector([YP],t=>Object.values(t)),ZP=t=>s=>s.workflowStepReviewerReducer.instances[t],JP=A(u.createSelector([vt,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),QP=A(u.createSelector([vt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.workflow===s)))),XR=A(u.createSelector([vt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.workflow_step===s)))),xR=A(u.createSelector([vt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.user===s)))),XP=ja.reducer,lt=R(t=>t.uuid),xP={instances:{}},Ua=u.createSlice({name:"workflowStepReviewRequests",initialState:xP,extraReducers:t=>t.addMatcher(u.isAnyOf(b,z,M),s=>Object.assign(s,xP)),reducers:{initializeWorkflowStepReviewRequests:lt.initialize,addWorkflowStepReviewRequest:lt.addOne,addWorkflowStepReviewRequests:lt.addMany,setWorkflowStepReviewRequest:lt.setOne,setWorkflowStepReviewRequests:lt.setMany,updateWorkflowStepReviewRequest:lt.updateOne,updateWorkflowStepReviewRequests:lt.updateMany,deleteWorkflowStepReviewRequest:lt.deleteOne,deleteWorkflowStepReviewRequests:lt.deleteMany}}),{initializeWorkflowStepReviewRequests:eg,addWorkflowStepReviewRequest:tg,addWorkflowStepReviewRequests:La,setWorkflowStepReviewRequest:sg,setWorkflowStepReviewRequests:ig,updateWorkflowStepReviewRequest:ng,updateWorkflowStepReviewRequests:ag,deleteWorkflowStepReviewRequest:cg,deleteWorkflowStepReviewRequests:Na}=Ua.actions,rg=t=>t.workflowStepReviewRequestReducer.instances,us=u.createSelector([rg],t=>Object.values(t)),dg=t=>s=>s.workflowStepReviewRequestReducer.instances[t],lg=A(u.createSelector([us,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),og=A(u.createSelector([us,(t,s)=>s],(t,s)=>w(t.filter(e=>e.workflow===s)))),eM=A(u.createSelector([us,(t,s)=>s],(t,s)=>w(t.filter(e=>e.workflow_step===s)))),ug=Ua.reducer,ot=R(t=>t.uuid),hg={instances:{}},Ha=u.createSlice({name:"workflowStepReviews",initialState:hg,extraReducers:t=>t.addMatcher(u.isAnyOf(b,z,M),s=>Object.assign(s,hg)),reducers:{initializeWorkflowStepReviews:ot.initialize,addWorkflowStepReview:ot.addOne,addWorkflowStepReviews:ot.addMany,setWorkflowStepReview:ot.setOne,setWorkflowStepReviews:ot.setMany,updateWorkflowStepReview:ot.updateOne,updateWorkflowStepReviews:ot.updateMany,deleteWorkflowStepReview:ot.deleteOne,deleteWorkflowStepReviews:ot.deleteMany}}),{initializeWorkflowStepReviews:pg,addWorkflowStepReview:mg,addWorkflowStepReviews:Ga,setWorkflowStepReview:yg,setWorkflowStepReviews:fg,updateWorkflowStepReview:Sg,updateWorkflowStepReviews:Ag,deleteWorkflowStepReview:wg,deleteWorkflowStepReviews:Ka}=Ha.actions,Tg=t=>t.workflowStepReviewReducer.instances,hs=u.createSelector([Tg],t=>Object.values(t)),Og=t=>s=>s.workflowStepReviewReducer.instances[t],Ig=A(u.createSelector([hs,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),Fg=A(u.createSelector([hs,(t,s)=>s],(t,s)=>w(t.filter(e=>e.workflow===s)))),tM=A(u.createSelector([hs,(t,s)=>s],(t,s)=>w(t.filter(e=>e.workflow_step===s)))),Pg=Ha.reducer,ut=R(t=>t.uuid),gg={instances:{}},Ya=u.createSlice({name:"workflowSteps",initialState:gg,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,gg)),reducers:{initializeWorkflowSteps:ut.initialize,addWorkflowStep:ut.addOne,addWorkflowSteps:ut.addMany,setWorkflowStep:ut.setOne,setWorkflowSteps:ut.setMany,updateWorkflowStep:ut.updateOne,updateWorkflowSteps:ut.updateMany,deleteWorkflowStep:ut.deleteOne,deleteWorkflowSteps:ut.deleteMany}}),{initializeWorkflowSteps:bg,addWorkflowStep:_g,addWorkflowSteps:Za,setWorkflowStep:Rg,setWorkflowSteps:Mg,updateWorkflowStep:kg,updateWorkflowSteps:vg,deleteWorkflowStep:Eg,deleteWorkflowSteps:Ja}=Ya.actions,Vg=Ya.reducer,Wg=t=>t.workflowStepReducer.instances,Qa=u.createSelector([Wg],t=>Object.values(t)),Bg=t=>s=>s.workflowStepReducer.instances[t],zg=A(u.createSelector([Qa,(t,s)=>s],(t,s)=>w(t.filter(e=>e.workflow_type===s)))),qg=A(u.createSelector([Qa,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),ht=R(t=>t.uuid),Cg={instances:{}},Xa=u.createSlice({name:"workflowTypes",initialState:Cg,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,Cg)),reducers:{initializeWorkflowTypes:ht.initialize,addWorkflowType:ht.addOne,addWorkflowTypes:ht.addMany,setWorkflowType:ht.setOne,setWorkflowTypes:ht.setMany,updateWorkflowType:ht.updateOne,updateWorkflowTypes:ht.updateMany,deleteWorkflowType:ht.deleteOne,deleteWorkflowTypes:ht.deleteMany}}),{initializeWorkflowTypes:jg,addWorkflowType:Dg,addWorkflowTypes:$g,setWorkflowType:Ug,setWorkflowTypes:Lg,updateWorkflowType:Ng,updateWorkflowTypes:Hg,deleteWorkflowType:Gg,deleteWorkflowTypes:Kg}=Xa.actions,Yg=t=>t.workflowTypeReducer.instances,xa=u.createSelector([Yg],t=>Object.values(t)),Zg=t=>s=>s.workflowTypeReducer.instances[t],Jg=A(u.createSelector([xa,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),sM=A(u.createSelector([xa,(t,s)=>s],(t,s)=>w(t.filter(e=>e.organization===s)))),Qg=Xa.reducer,iM={version:0},Xg=u.createSlice({name:"versioning",initialState:iM,reducers:{}}),xg=Xg.reducer,ec={outboxReducer:jT,fileReducer:lm,authReducer:ip},nM=u.combineReducers(ec),eb={...ec,[Ft]:xg,categoryReducer:fp,assetReducer:oo,assetAttachmentReducer:Yc,assetStageCompletionReducer:Oo,assetStageReducer:zo,assetTypeReducer:Dh,assetTypeAttachmentReducer:Qo,issueReducer:OS,issueAttachmentReducer:Bf,issueTypeReducer:Pw,issueTypeAttachmentReducer:BS,organizationReducer:VT,projectReducer:$O,projectAttachmentReducer:hO,projectAccessReducer:JT,organizationAccessReducer:yT,projectFileReducer:kO,rehydratedReducer:HO,formReducer:Ay,formRevisionReducer:ry,formRevisionAttachmentReducer:Qm,formSubmissionAttachmentReducer:Vy,formSubmissionReducer:Gy,formIdentifierReducer:Fm,formIdentifierValueReducer:qm,userReducer:sT,emailDomainsReducer:nm,documentsReducer:$p,documentAttachmentReducer:kp,teamReducer:wI,agentsReducer:Bc,issueCommentReducer:dS,issueCommentAttachmentReducer:Zf,issueUpdateReducer:Kw,geoImageReducer:rf,issueAssociationReducer:If,issueTypeFieldsReducer:FA,issueTypeFieldValuesReducer:lA,issueTypeFieldsAttachmentReducer:ZS,issueTypeFieldValuesAttachmentReducer:zA,issueTypeIdentifierReducer:JA,issueTypeIdentifierValueReducer:ow,issueTypeStatusReducer:qw,assetTypeFieldsReducer:gu,assetTypeFieldValuesReducer:Xu,assetTypeFieldsAttachmentReducer:uu,assetTypeFieldValuesAttachmentReducer:Cu,assetTypeIdentifierReducer:hh,assetTypeIdentifierValueReducer:bh,assetTypeStatusReducer:ep,assetProcedureTypeReducer:Vd,assetProcedureReducer:Ad,assetProcedureTypeFieldsReducer:Vr,assetProcedureTypeFieldValuesReducer:cd,assetProcedureTypeFieldsAttachmentReducer:wr,assetProcedureTypeFieldValuesAttachmentReducer:Hr,assetProcedureTypeAttachmentReducer:ar,assetProcedureStepFieldsAttachmentReducer:Jd,assetProcedureStepFieldsReducer:ll,assetProcedureStepFieldValuesAttachmentReducer:Il,assetProcedureStepFieldValuesReducer:zl,assetProcedureStepReducer:Kl,teamMembershipReducer:sI,workflowTypeReducer:Qg,workflowStepReducer:Vg,workflowReducer:EI,workflowStepFieldsReducer:jP,workflowStepFieldsAttachmentReducer:bP,workflowStepFieldValuesReducer:pP,workflowStepFieldValuesAttachmentReducer:eP,workflowStepAssigneeReducer:HI,workflowStepReviewRequestReducer:ug,workflowStepReviewReducer:Pg,workflowStepCompletionReducer:MF,workflowStepCommentReducer:fF,workflowStepCommentAttachmentReducer:iF,workflowStepReviewerReducer:XP,workflowStepEventReducer:$F},aM=u.combineReducers(eb),tb=1e4,sb=200,tc=[400,409,403,404,405,500],U=1e4,ib={};class nb{constructor(s){m(this,"client");m(this,"pageSize",tb);ib[this.constructor.name]=this,this.client=s}async performRequest(s,e){return this.client.performRequest(this.host,s,this,e)}async enqueueRequest(s){return this.client.enqueueRequest(s,this.host,this.constructor.name)}async performPagination(s,e){return this.client.performPagination(this.host,s,this.pageSize,this,e)}dispatch(s){this.client.store.dispatch(s)}}const ab=()=>db.length-1,cb=t=>(t[Ft]={version:ab()},t),rb=()=>cb({}),cM=t=>(t.outboxReducer&&(t.outboxReducer.deletedRequests=[]),t),rM=t=>s=>{var e;return s===void 0&&(s={}),((e=s[Ft])==null?void 0:e.version)===ab()?s:t(s)},db=[cb,rb,rb,cM],dM=Object.fromEntries(db.map((t,s)=>[s,rM(t)])),lM=t=>{if(t)throw t;const s=It();s?s.dispatch({type:"rehydrated/setRehydrated",payload:!0}):console.error("Client store not set")},lb=(t,s,e)=>{const n=ft();return n?(n.addRequest(s),n.getQueue()):(console.warn("Outbox coordinator not set; cannot enqueue request yet."),[])},ob=(t,s,e)=>{const n=ft();if(!n)return console.warn("Outbox coordinator not set; cannot dequeue request yet."),[];const c=s.meta.offlineAction.payload.uuid;return n.remove(c),n.getQueue()};async function oM(t,s){if(!s.payload)throw new Error("Received empty payload");return Fb(s)}const uM={...lc,effect:oM,discard:hb,returnPromises:!0,persistCallback:lM,retry:yM,persistOptions:{storage:kb},queue:{...lc.queue,enqueue:lb,dequeue:ob,peek:(...t)=>mM(...t)}},hM=vb(dM,Ft),pM=u.compose(Mb.offline(uM),hM);async function ub(t,s,e){if(s.store.getState().outboxReducer.deletedRequests.includes(t.payload.uuid))throw new Error("Request was marked for deletion");const a=ib[t.meta.offline.effect.serviceName];if(!a)throw new Error(`Service ${t.meta.offline.effect.serviceName} not found`);return ac(t.meta.offline.effect.BASE_URL,t.meta.offline.effect.request,s,a,e)}function hb(t,s,e=0){var r;if(console.debug("Considering discarding request due to error:",t,`(${typeof t})`,`
1
+ (function(i,$){typeof exports=="object"&&typeof module<"u"?$(exports,require("@redux-offline/redux-offline/lib/types"),require("@reduxjs/toolkit"),require("superagent"),require("uuid"),require("react"),require("file-saver"),require("fast-tree-builder"),require("ts-tree-lib"),require("@redux-offline/redux-offline"),require("@redux-offline/redux-offline/lib/defaults"),require("localforage"),require("redux-persist-migrate"),require("buffer"),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","react","file-saver","fast-tree-builder","ts-tree-lib","@redux-offline/redux-offline","@redux-offline/redux-offline/lib/defaults","localforage","redux-persist-migrate","buffer","@overmap-ai/forms","idb","jwt-decode","dependency-graph","@tiptap/core"],$):(i=typeof globalThis<"u"?globalThis:i||self,$(i["overmap-core"]={},null,i.toolkit,i.request,i.uuid,i.react,i.fileSaver,i.buildTree,i.tsTreeLib,i.reduxOffline,i.offlineConfig,i.localforage,i.createMigration,null,null,i.idb,i.jwtDecode,i.dependencyGraph))})(this,function(i,$,u,St,pt,ub,hb,ac,Et,pb,cc,mb,fb,Bk,zk,yb,Sb,Ab){"use strict";var Vk=Object.defineProperty;var Wk=(i,$,u)=>$ in i?Vk(i,$,{enumerable:!0,configurable:!0,writable:!0,value:u}):i[$]=u;var m=(i,$,u)=>Wk(i,typeof $!="symbol"?$+"":$,u);var lb;const rc=Object.freeze([]),dc=Object.freeze({});var lc=(t=>(t[t.GUEST=0]="GUEST",t[t.BASIC=2]="BASIC",t[t.ADMIN=4]="ADMIN",t))(lc||{}),p=(t=>(t.GET="GET",t.POST="POST",t.PATCH="PATCH",t.PUT="PUT",t.DELETE="DELETE",t))(p||{}),oc=(t=>(t[t.PLANNED=0]="PLANNED",t[t.ACTIVE=1]="ACTIVE",t[t.MAINTENANCE=2]="MAINTENANCE",t[t.INACTIVE=3]="INACTIVE",t[t.RETIRED=4]="RETIRED",t[t.DISPOSED=5]="DISPOSED",t))(oc||{}),uc=(t=>(t.Issue="issue",t.Asset="asset",t.AssetType="asset_type",t.Project="project",t.Document="document",t))(uc||{}),fs=(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))(fs||{}),C=(t=>(t.STATUS="status",t.PRIORITY="priority",t.DESCRIPTION="description",t.TITLE="title",t.ASSIGNED_TO="assigned_to",t.DUE_DATE="due_date",t))(C||{}),hc=(t=>(t[t.BACKLOG=0]="BACKLOG",t[t.PLANNED=1]="PLANNED",t[t.IN_PROGRESS=2]="IN_PROGRESS",t[t.COMPLETED=3]="COMPLETED",t[t.CANCELLED=4]="CANCELLED",t))(hc||{}),pc=(t=>(t[t.COMMENT=0]="COMMENT",t[t.APPROVE=2]="APPROVE",t[t.DENY=4]="DENY",t))(pc||{}),mc=(t=>(t[t.ADD_ASSIGNEE=0]="ADD_ASSIGNEE",t[t.REMOVE_ASSIGNEE=1]="REMOVE_ASSIGNEE",t[t.ADD_REVIEWER=2]="ADD_REVIEWER",t[t.REMOVE_REVIEWER=3]="REMOVE_REVIEWER",t[t.ADD_REVIEW_REQUEST=4]="ADD_REVIEW_REQUEST",t[t.REMOVE_REVIEW_REQUEST=5]="REMOVE_REVIEW_REQUEST",t))(mc||{});const wb=fs.MEDIUM,fc=6e4;function R(t){return{addOne:(h,f)=>{const y=t(f.payload);h.instances[y]=f.payload},addMany:(h,f)=>{for(const y of f.payload){const S=t(y);h.instances[S]=y}},setOne:(h,f)=>{const y=t(f.payload);h.instances[y]=f.payload},setMany:(h,f)=>{for(const y of f.payload){const S=t(y);h.instances[S]=y}},updateOne:(h,f)=>{const y=t(f.payload);h.instances[y]=f.payload},updateMany:(h,f)=>{for(const y of f.payload){const S=t(y);h.instances[S]=y}},deleteOne:(h,f)=>{delete h.instances[f.payload]},deleteMany:(h,f)=>{for(const y of f.payload)delete h.instances[y]},initialize:(h,f)=>{h.instances={};const y=new Set;for(const S of f.payload){const O=t(S);y.add(O),h.instances[O]=S}y.size!==f.payload.length&&console.warn("duplicate ids detected when initializing model instances.")}}}function Tb(){return{initializeSelection:(l,c)=>{l.selection=Array.from(new Set(c.payload))},selectOne:(l,c)=>{new Set(l.selection).has(c.payload)||l.selection.push(c.payload)},selectMany:(l,c)=>{const h=new Set(l.selection);for(const f of c.payload)h.has(f)||h.add(f);l.selection=Array.from(h)},unselectOne:(l,c)=>{const h=new Set(l.selection);h.has(c.payload)&&(h.delete(c.payload),l.selection=Array.from(h))},unselectMany:(l,c)=>{const h=new Set(l.selection);for(const f of c.payload)h.has(f)&&h.delete(f);l.selection=Array.from(h)},toggleOne:(l,c)=>{const h=new Set(l.selection);h.has(c.payload)?h.delete(c.payload):h.add(c.payload),l.selection=Array.from(h)},toggleMany:(l,c)=>{const h=new Set(l.selection);for(const f of c.payload)h.has(f)?h.delete(f):h.add(f);l.selection=Array.from(h)},getInitialState:l=>({...l,selection:[]})}}const Ft="versioning",b=u.createAction("RESET"),q=u.createAction("RESET_PROJECT_STATE"),M=u.createAction("RESET_ORGANIZATION_STATE");function Ob(t,s){return ub.useMemo(t,s)}lb=Symbol.toStringTag;class ys{constructor(){m(this,lb,"Promise");m(this,"_promise");m(this,"_resolve");m(this,"_reject");m(this,"_state","pending");this._resolve=null,this._reject=null,this._promise=new Promise((s,e)=>{this._resolve=s,this._reject=e})}get state(){return this._state}then(s,e){return this._promise.then(s,e)}catch(s){return this._promise.catch(s)}resolve(s){if(!this._resolve)throw new Error("No resolve callback");this._resolve(s),this._state="fulfilled"}reject(s){if(!this._reject)throw s;this._reject(s),this._state="rejected"}finally(s){throw new Error("`finally` not implemented")}}let Ss=!1;["true","1"].includes("".toLowerCase())&&(Ss=!0);function Ib(t,s){if(t===s)return!0;if(typeof t!=typeof s)return!1;const e=Object.keys(t),n=Object.keys(s),a=e.length;if(a!==n.length)return!1;for(let r=0;r<a;r++){const d=e[r];if(!Object.prototype.hasOwnProperty.call(s,d)||t[d]!==s[d])return!1}return!0}function As(t){const s={};return function(){const e=Array.prototype.slice.call(arguments);return e in s?(Ss&&console.debug(`Memoization debug: Using memorized return value for ${t.toString()}(`,e,")"),s[e]):(Ss&&console.debug(`Memoization debug: Cache miss! Memoizing ${t.toString()}(`,e,")"),s[e]=t.apply(this,e))}}function Fb(t,s){if(t.length!==s.length)return!1;for(let e=0;e<t.length;e++)if(t[e]!==s[e])return!1;return!0}const w=t=>t.length===0?rc:t,Vt=t=>Object.keys(t).length===0?dc:t,yc=As(t=>{if(!t)return"";const s=new Date(t),e=s.getFullYear()===ws.getFullYear(),n={day:"numeric",month:"short"};return e||(n.year="numeric"),s.toLocaleDateString([],n)}),Pb=new Intl.RelativeTimeFormat([],{style:"long",numeric:"auto"}),gb=1e3*86400,ws=new Date,bb=t=>new Date(t).toDateString()===ws.toDateString(),_b=As((t,s,e)=>{const n=Math.round((new Date(t).getTime()-ws.getTime())/gb);return n<s||n>e?yc(t):Pb.format(n,"days")});function Rb(t){return new Uint8Array(t).reduce((e,n)=>e+n.toString(16).padStart(2,"0"),"")}const Ts=async(t,s)=>{s||(s=await At(t));let e=t.type;if(e.includes("/")&&(e=e.split("/")[1]),!e)throw new Error(`Could not extract file type from ${t.type}`);return`${s}.${e}`};function At(t){return new Promise((s,e)=>{const n=new FileReader;n.onload=()=>{const a=n.result;if(!a){e(new Error("FileReader did not return a valid ArrayBuffer."));return}crypto.subtle.digest("SHA-1",a).then(r=>{const d=Rb(r);s(d)})},n.readAsArrayBuffer(t)})}function Mb(t){if(!t.name||!t.type||!t.size){const s="File has no name, type, and/or size";throw new Error(s)}return`${t.name}&${t.type}${t.size}`}function Sc(t,s){return new File([t],s,{type:t.type})}function kb(t,s){const e=document.createElement("a");e.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(s)),e.setAttribute("download",t),e.style.display="none",document.body.appendChild(e),e.click(),document.body.removeChild(e)}const vb=async t=>{const s={};for(const e of t){const n=await At(e);s[n]={sha1:n,extension:e.name.split(".").pop()||"",file_type:e.type,size:e.size}}return Object.values(s)},Ac=async t=>(await fetch(t)).blob(),Eb=t=>new Promise((s,e)=>{const n=new FileReader;n.onloadend=()=>{var a;s(((a=n.result)==null?void 0:a.toString())||"")},n.readAsDataURL(t)});function Vb(t){const s=new Blob([t]);hb.saveAs(s,t.name)}const wc={};function Wb(t,s,e,...n){const a=wc[t];let r=!1;a?a[s]||(a[s]=!0,r=!0):(wc[t]={[s]:!0},r=!0),r&&console[e](...n)}const Tc=["created_at","updated_at","index","revision"];function _(t){return{...t,uuid:pt.v4()}}function Bb(t){const s={};for(const e of t)s[e.uuid]=e;return s}function B(t){return t.map(({uuid:s})=>s)}function Wt(t,s){return t.localeCompare(s)}function Os(t,s){return Wt(t.uuid,s.uuid)}function zb(t,s=void 0,e=255){let n=t.replace(/[^a-z0-9_\-.]/gi,"_").replace(/_{2,}/g,"_");if(!s){const r=t.split(".");r.length>1&&(s=r[r.length-1])}s&&!s.startsWith(".")&&(s="."+s);const a=s?s.length:0;return n.length+a>e&&(n=n.slice(0,e-a)+(s||"")),n}function qb(t){return t.toLowerCase().replace(" ","-")}function jb(t,s=!1){return t.normalize("NFKD").toLowerCase().replace(/[^\w\s-]/g,"").trim().replace(/[-\s]+/g,s?"_":"-")}function Cb(t,s){if(t.length<=s)return t;const e=t.slice(0,s-1);return e.slice(0,e.lastIndexOf(" "))+"…"}const Db=/^.+@.+\..+$/;function E(t){const s={...t};for(const e of[...Tc,"created_by"])e in s&&delete s[e];return s}const Oc=t=>{const s=t.toSorted((e,n)=>e.order-n.order);return ac(s,{id:e=>e.uuid,parentId:e=>e.parent,includeEmptyChildrenArray:!0,valueKey:!1})},$b=t=>{const{roots:s}=Oc(t);return s.map(e=>new Et.Tree(e))},Ic=(t,s)=>{const{nodes:e}=Oc(s),n=e.get(t);if(!n)throw new Error(`Node with uuid ${t} does not exist in asset procedure step tree.`);return new Et.Tree(n)},Fc=(t,s)=>t.type!==s.type?t.type-s.type:t.order-s.order,Pc=(t,s)=>t.type!==s.type?t.type-s.type:t.order-s.order,gc=t=>ac(t,{id:s=>s.uuid,parentId:s=>s.parent_document,includeEmptyChildrenArray:!0,valueKey:!1}),Ub=t=>{const{roots:s}=gc(t);return s.map(e=>new Et.Tree(e))},bc=(t,s)=>{const{nodes:e}=gc(s),n=e.get(t);if(!n)throw new Error(`Node with uuid ${t} does not exist in document tree.`);return new Et.Tree(n)};class Lb{constructor(s){m(this,"operations",[]);m(this,"getData");this.getData=s}performOperations(s){let e=s;for(const n of this.operations)e=n(e);return e}filter(s,e){return this.operations.push(n=>n.filter(a=>a[s]===e)),this}exclude(s,e){return this.operations.push(n=>n.filter(a=>a[s]!==e)),this}orderBy(s){return this.operations.push(e=>[...e].sort((n,a)=>n[s]<=a[s]?1:-1)),this}reverse(){return this.operations.push(s=>[...s].reverse()),this}all(){return this.operations.push(s=>s),this}get(s,e){return u.createSelector([this.getData],n=>this.performOperations(n).find(a=>a[s]===e))}count(){return u.createSelector([this.getData],s=>this.performOperations(s).length)}first(){return u.createSelector([this.getData],s=>this.performOperations(s)[0])}last(){return u.createSelector([this.getData],s=>{const e=this.performOperations(s);return e[e.length-1]})}exists(){return u.createSelector([this.getData],s=>this.performOperations(s).length>0)}toSelector(){return u.createSelector([this.getData],s=>w(this.performOperations(s)))}}const A=t=>(...s)=>e=>t(e,...s),N=R(t=>t.uuid),_c={instances:{}},Is=u.createSlice({name:"agents",initialState:_c,extraReducers:t=>t.addMatcher(u.isAnyOf(b,q,M),s=>Object.assign(s,_c)),reducers:{initializeConversations:N.initialize,addConversation:N.addOne,addConversations:N.addMany,setConversation:N.setOne,setConversations:N.setMany,updateConversation:N.updateOne,updateConversations:N.updateMany,deleteConversation:N.deleteOne,deleteConversations:N.deleteMany}}),{initializeConversations:Rc,addConversation:Mc,addConversations:Nb,setConversation:kc,setConversations:Hb,updateConversation:vc,updateConversations:Gb,deleteConversation:Kb,deleteConversations:Yb}=Is.actions,Fs=t=>t.agentsReducer.instances,Zb=u.createSelector([Fs],t=>Object.values(t)),Jb=A(u.createSelector([Fs,(t,s)=>s],(t,s)=>t[s])),Ec=Is.reducer,H=R(t=>t.uuid),Vc={instances:{}},Ps=u.createSlice({name:"assetAttachments",initialState:Vc,extraReducers:t=>t.addMatcher(u.isAnyOf(b,q,M),s=>Object.assign(s,Vc)),reducers:{initializeAssetAttachments:H.initialize,addAssetAttachment:H.addOne,addAssetAttachments:H.addMany,setAssetAttachment:H.setOne,setAssetAttachments:H.setMany,updateAssetAttachment:H.updateOne,updateAssetAttachments:H.updateMany,deleteAssetAttachment:H.deleteOne,deleteAssetAttachments:H.deleteMany}}),{initializeAssetAttachments:Wc,addAssetAttachment:Bc,addAssetAttachments:gs,setAssetAttachment:zc,setAssetAttachments:qc,updateAssetAttachment:jc,updateAssetAttachments:Cc,deleteAssetAttachment:Dc,deleteAssetAttachments:bs}=Ps.actions,$c=t=>t.assetAttachmentReducer.instances,_s=u.createSelector([$c],t=>Object.values(t)),Uc=t=>s=>s.assetAttachmentReducer.instances[t],Lc=A(u.createSelector([_s,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),Nc=A(u.createSelector([_s,(t,s)=>s],(t,s)=>w(t.filter(({asset:e})=>s===e)))),Hc=Ps.reducer,G=R(({uuid:t})=>t),Gc={instances:{}},Rs=u.createSlice({name:"assetProcedureTypeAttachments",initialState:Gc,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,Gc)),reducers:{initializeAssetProcedureTypeAttachments:G.initialize,addAssetProcedureTypeAttachment:G.addOne,addAssetProcedureTypeAttachments:G.addMany,setAssetProcedureTypeAttachment:G.setOne,setAssetProcedureTypeAttachments:G.setMany,updateAssetProcedureTypeAttachment:G.updateOne,updateAssetProcedureTypeAttachments:G.updateMany,deleteAssetProcedureTypeAttachment:G.deleteOne,deleteAssetProcedureTypeAttachments:G.deleteMany}}),{initializeAssetProcedureTypeAttachments:Kc,addAssetProcedureTypeAttachment:Yc,addAssetProcedureTypeAttachments:Zc,setAssetProcedureTypeAttachment:Jc,setAssetProcedureTypeAttachments:Qc,updateAssetProcedureTypeAttachment:Xc,updateAssetProcedureTypeAttachments:xc,deleteAssetProcedureTypeAttachment:er,deleteAssetProcedureTypeAttachments:tr}=Rs.actions,sr=Rs.reducer,ir=t=>t.assetProcedureTypeAttachmentReducer.instances,Ms=u.createSelector([ir],t=>Object.values(t)),nr=t=>s=>s.assetProcedureTypeAttachmentReducer.instances[t],ar=A(u.createSelector([Ms,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),Qb=A(u.createSelector([Ms,(t,s)=>s],(t,s)=>w(t.filter(({asset_procedure_type:e})=>s===e)))),K=R(({uuid:t})=>t),cr={instances:{}},ks=u.createSlice({name:"assetProcedureTypeFieldsAttachments",initialState:cr,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,cr)),reducers:{initializeAssetProcedureTypeFieldsAttachments:K.initialize,addAssetProcedureTypeFieldsAttachment:K.addOne,addAssetProcedureTypeFieldsAttachments:K.addMany,setAssetProcedureTypeFieldsAttachment:K.setOne,setAssetProcedureTypeFieldsAttachments:K.setMany,updateAssetProcedureTypeFieldsAttachment:K.updateOne,updateAssetProcedureTypeFieldsAttachments:K.updateMany,deleteAssetProcedureTypeFieldsAttachment:K.deleteOne,deleteAssetProcedureTypeFieldsAttachments:K.deleteMany}}),{initializeAssetProcedureTypeFieldsAttachments:rr,addAssetProcedureTypeFieldsAttachment:dr,addAssetProcedureTypeFieldsAttachments:lr,setAssetProcedureTypeFieldsAttachment:or,setAssetProcedureTypeFieldsAttachments:ur,updateAssetProcedureTypeFieldsAttachment:hr,updateAssetProcedureTypeFieldsAttachments:pr,deleteAssetProcedureTypeFieldsAttachment:mr,deleteAssetProcedureTypeFieldsAttachments:fr}=ks.actions,yr=ks.reducer,Sr=t=>t.assetProcedureTypeFieldsAttachmentReducer.instances,vs=u.createSelector([Sr],t=>Object.values(t)),Xb=A(u.createSelector([vs,(t,s)=>s],(t,s)=>w(t.filter(e=>e.fields_revision===s)))),Ar=t=>s=>s.assetProcedureTypeFieldsAttachmentReducer.instances[t],wr=A(u.createSelector([vs,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),Y=R(({uuid:t})=>t),Tr={instances:{}},Es=u.createSlice({name:"assetProcedureTypeFields",initialState:Tr,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,Tr)),reducers:{initializeAssetProcedureTypeFields:Y.initialize,addAssetProcedureTypeFields:Y.addOne,addAssetProcedureTypeFieldsMany:Y.addMany,setAssetProcedureTypeFields:Y.setOne,setAssetProcedureTypeFieldsMany:Y.setMany,updateAssetProcedureTypeFields:Y.updateOne,updateAssetProcedureTypeFieldsMany:Y.updateMany,deleteAssetProcedureTypeFields:Y.deleteOne,deleteAssetProcedureTypeFieldsMany:Y.deleteMany}}),{initializeAssetProcedureTypeFields:Or,addAssetProcedureTypeFields:Ir,addAssetProcedureTypeFieldsMany:Fr,setAssetProcedureTypeFields:Pr,setAssetProcedureTypeFieldsMany:gr,updateAssetProcedureTypeFields:br,updateAssetProcedureTypeFieldsMany:_r,deleteAssetProcedureTypeFields:Rr,deleteAssetProcedureTypeFieldsMany:Mr}=Es.actions,kr=Es.reducer,vr=t=>t.assetProcedureTypeFieldsReducer.instances,Bt=u.createSelector([vr],t=>Object.values(t)),xb=A(u.createSelector([Bt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.asset_procedure_type===s)))),e_=A(u.createSelector([Bt,(t,s)=>s],(t,s)=>t.filter(e=>e.asset_procedure_type===s).sort((e,n)=>e.submitted_at>n.submitted_at?-1:1)[0])),Er=t=>s=>s.assetProcedureTypeFieldsReducer.instances[t],Vr=A(u.createSelector([Bt,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),Z=R(({uuid:t})=>t),Wr={instances:{}},Vs=u.createSlice({name:"assetProcedureTypeFieldValuesAttachments",initialState:Wr,extraReducers:t=>t.addMatcher(u.isAnyOf(b,q,M),s=>Object.assign(s,Wr)),reducers:{initializeAssetProcedureTypeFieldValuesAttachments:Z.initialize,addAssetProcedureTypeFieldValuesAttachment:Z.addOne,addAssetProcedureTypeFieldValuesAttachments:Z.addMany,setAssetProcedureTypeFieldValuesAttachment:Z.setOne,setAssetProcedureTypeFieldValuesAttachments:Z.setMany,updateAssetProcedureTypeFieldValuesAttachment:Z.updateOne,updateAssetProcedureTypeFieldValuesAttachments:Z.updateMany,deleteAssetProcedureTypeFieldValuesAttachment:Z.deleteOne,deleteAssetProcedureTypeFieldValuesAttachments:Z.deleteMany}}),{initializeAssetProcedureTypeFieldValuesAttachments:Br,addAssetProcedureTypeFieldValuesAttachment:zr,addAssetProcedureTypeFieldValuesAttachments:Ws,setAssetProcedureTypeFieldValuesAttachment:qr,setAssetProcedureTypeFieldValuesAttachments:jr,updateAssetProcedureTypeFieldValuesAttachment:Cr,updateAssetProcedureTypeFieldValuesAttachments:Dr,deleteAssetProcedureTypeFieldValuesAttachment:$r,deleteAssetProcedureTypeFieldValuesAttachments:Bs}=Vs.actions,Ur=Vs.reducer,Lr=t=>t.assetProcedureTypeFieldValuesAttachmentReducer.instances,zs=u.createSelector([Lr],t=>Object.values(t)),Nr=t=>s=>s.assetProcedureTypeFieldValuesAttachmentReducer.instances[t],Hr=A(u.createSelector([zs,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),Gr=A(u.createSelector([zs,(t,s)=>s],(t,s)=>w(t.filter(e=>e.field_values===s)))),J=R(({uuid:t})=>t),Kr={instances:{}},qs=u.createSlice({name:"assetProcedureTypeFieldValues",initialState:Kr,extraReducers:t=>t.addMatcher(u.isAnyOf(b,q,M),s=>Object.assign(s,Kr)),reducers:{initializeAssetProcedureTypeFieldValues:J.initialize,addAssetProcedureTypeFieldValues:J.addOne,addAssetProcedureTypeFieldValuesMany:J.addMany,setAssetProcedureTypeFieldValues:J.setOne,setAssetProcedureTypeFieldValuesMany:J.setMany,updateAssetProcedureTypeFieldValues:J.updateOne,updateAssetProcedureTypeFieldValuesMany:J.updateMany,deleteAssetProcedureTypeFieldValues:J.deleteOne,deleteAssetProcedureTypeFieldValuesMany:J.deleteMany}}),{initializeAssetProcedureTypeFieldValues:Yr,addAssetProcedureTypeFieldValues:Zr,addAssetProcedureTypeFieldValuesMany:Jr,setAssetProcedureTypeFieldValues:Qr,setAssetProcedureTypeFieldValuesMany:Xr,updateAssetProcedureTypeFieldValues:xr,updateAssetProcedureTypeFieldValuesMany:ed,deleteAssetProcedureTypeFieldValues:td,deleteAssetProcedureTypeFieldValuesMany:sd}=qs.actions,id=qs.reducer,nd=t=>t.assetProcedureTypeFieldValuesReducer.instances,zt=u.createSelector([nd],t=>Object.values(t)),t_=A(u.createSelector([zt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.asset===s)))),s_=A(u.createSelector([zt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.asset_procedure===s)))),ad=t=>s=>s.assetProcedureTypeFieldValuesReducer.instances[t],cd=A(u.createSelector([zt,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),Q=R(({uuid:t})=>t),rd={instances:{}},js=u.createSlice({name:"assetProcedures",initialState:rd,extraReducers:t=>t.addMatcher(u.isAnyOf(b,q,M),s=>Object.assign(s,rd)),reducers:{initializeAssetProcedures:Q.initialize,addAssetProcedure:Q.addOne,addAssetProcedures:Q.addMany,setAssetProcedure:Q.setOne,setAssetProcedures:Q.setMany,updateAssetProcedure:Q.updateOne,updateAssetProcedures:Q.updateMany,deleteAssetProcedure:Q.deleteOne,deleteAssetProcedures:Q.deleteMany}}),{initializeAssetProcedures:dd,addAssetProcedure:ld,addAssetProcedures:Cs,updateAssetProcedure:od,updateAssetProcedures:ud,deleteAssetProcedure:hd,deleteAssetProcedures:Ds,setAssetProcedure:pd,setAssetProcedures:md}=js.actions,fd=js.reducer,yd=t=>t.assetProcedureReducer.instances,qt=u.createSelector([yd],t=>Object.values(t)),Sd=A(u.createSelector([qt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.asset_procedure_type===s)))),i_=A(u.createSelector([qt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.asset_type===s)))),Ad=t=>s=>s.assetProcedureReducer.instances[t],wd=A(u.createSelector([qt,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),X=R(t=>t.uuid),Td={instances:{}},$s=u.createSlice({name:"assetProcedureTypes",initialState:Td,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,Td)),reducers:{initializeAssetProcedureTypes:X.initialize,addAssetProcedureType:X.addOne,addAssetProcedureTypes:X.addMany,setAssetProcedureType:X.setOne,setAssetProcedureTypes:X.setMany,updateAssetProcedureType:X.updateOne,updateAssetProcedureTypes:X.updateMany,deleteAssetProcedureType:X.deleteOne,deleteAssetProcedureTypes:X.deleteMany}}),{initializeAssetProcedureTypes:Od,addAssetProcedureType:Id,addAssetProcedureTypes:Fd,updateAssetProcedureType:Pd,updateAssetProcedureTypes:gd,deleteAssetProcedureType:bd,deleteAssetProcedureTypes:_d,setAssetProcedureType:Rd,setAssetProcedureTypes:Md}=$s.actions,kd=$s.reducer,vd=t=>t.assetProcedureTypeReducer.instances,Us=u.createSelector([vd],t=>Object.values(t)),Ed=t=>s=>s.assetProcedureTypeReducer.instances[t],Vd=A(u.createSelector([Us,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),n_=A(u.createSelector([Us,(t,s)=>s],(t,s)=>w(t.filter(e=>e.organization===s)))),x=R(t=>t.uuid),Wd={instances:{}},Ls=u.createSlice({name:"assetProcedureStepFieldsAttachments",initialState:Wd,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,Wd)),reducers:{initializeAssetProcedureStepFieldsAttachments:x.initialize,addAssetProcedureStepFieldsAttachment:x.addOne,addAssetProcedureStepFieldsAttachments:x.addMany,setAssetProcedureStepFieldsAttachment:x.setOne,setAssetProcedureStepFieldsAttachments:x.setMany,updateAssetProcedureStepFieldsAttachment:x.updateOne,updateAssetProcedureStepFieldsAttachments:x.updateMany,deleteAssetProcedureStepFieldsAttachment:x.deleteOne,deleteAssetProcedureStepFieldsAttachments:x.deleteMany}}),{initializeAssetProcedureStepFieldsAttachments:Bd,addAssetProcedureStepFieldsAttachment:zd,addAssetProcedureStepFieldsAttachments:qd,setAssetProcedureStepFieldsAttachment:jd,setAssetProcedureStepFieldsAttachments:Cd,updateAssetProcedureStepFieldsAttachment:Dd,updateAssetProcedureStepFieldsAttachments:$d,deleteAssetProcedureStepFieldsAttachment:Ud,deleteAssetProcedureStepFieldsAttachments:Ld}=Ls.actions,Nd=t=>t.assetProcedureStepFieldsAttachmentReducer.instances,Ns=u.createSelector([Nd],t=>Object.values(t)),a_=A(u.createSelector([Ns,(t,s)=>s],(t,s)=>w(t.filter(e=>e.fields_revision===s)))),Hd=t=>s=>s.assetProcedureStepFieldsAttachmentReducer.instances[t],Gd=A(u.createSelector([Ns,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),Kd=Ls.reducer,ee=R(t=>t.uuid),Yd={instances:{}},Hs=u.createSlice({name:"assetProcedureStepFields",initialState:Yd,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,Yd)),reducers:{initializeAssetProcedureStepFields:ee.initialize,addAssetProcedureStepFields:ee.addOne,addAssetProcedureStepFieldsMany:ee.addMany,setAssetProcedureStepFields:ee.setOne,setAssetProcedureStepFieldsMany:ee.setMany,updateAssetProcedureStepFields:ee.updateOne,updateAssetProcedureStepFieldsMany:ee.updateMany,deleteAssetProcedureStepFields:ee.deleteOne,deleteAssetProcedureStepFieldsMany:ee.deleteMany}}),{initializeAssetProcedureStepFields:Zd,addAssetProcedureStepFields:Jd,addAssetProcedureStepFieldsMany:Qd,setAssetProcedureStepFields:Xd,setAssetProcedureStepFieldsMany:xd,updateAssetProcedureStepFields:el,updateAssetProcedureStepFieldsMany:tl,deleteAssetProcedureStepFields:sl,deleteAssetProcedureStepFieldsMany:il}=Hs.actions,Gs=t=>t.assetProcedureStepFieldsReducer.instances,jt=u.createSelector([Gs],t=>Object.values(t)),c_=A(u.createSelector([jt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.asset_procedure_step===s)))),r_=A(u.createSelector([jt,(t,s)=>s],(t,s)=>t.filter(e=>e.asset_procedure_step===s).sort((e,n)=>e.submitted_at>n.submitted_at?-1:1)[0])),d_=u.createSelector([Gs],t=>{const s={};for(const e of Object.values(t)){const n=s[e.asset_procedure_step];(!n||n.submitted_at<e.submitted_at)&&(s[e.asset_procedure_step]=e)}return s}),nl=t=>s=>s.assetProcedureStepFieldsReducer.instances[t],al=A(u.createSelector([jt,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),cl=Hs.reducer,te=R(t=>t.uuid),rl={instances:{}},Ks=u.createSlice({name:"assetProcedureStepFieldValuesAttachments",initialState:rl,extraReducers:t=>t.addMatcher(u.isAnyOf(b,q,M),s=>Object.assign(s,rl)),reducers:{initializeAssetProcedureStepFieldValuesAttachments:te.initialize,addAssetProcedureStepFieldValuesAttachment:te.addOne,addAssetProcedureStepFieldValuesAttachments:te.addMany,setAssetProcedureStepFieldValuesAttachment:te.setOne,setAssetProcedureStepFieldValuesAttachments:te.setMany,updateAssetProcedureStepFieldValuesAttachment:te.updateOne,updateAssetProcedureStepFieldValuesAttachments:te.updateMany,deleteAssetProcedureStepFieldValuesAttachment:te.deleteOne,deleteAssetProcedureStepFieldValuesAttachments:te.deleteMany}}),{initializeAssetProcedureStepFieldValuesAttachments:dl,addAssetProcedureStepFieldValuesAttachment:ll,addAssetProcedureStepFieldValuesAttachments:Ys,setAssetProcedureStepFieldValuesAttachment:ol,setAssetProcedureStepFieldValuesAttachments:ul,updateAssetProcedureStepFieldValuesAttachment:hl,updateAssetProcedureStepFieldValuesAttachments:pl,deleteAssetProcedureStepFieldValuesAttachment:ml,deleteAssetProcedureStepFieldValuesAttachments:Zs}=Ks.actions,fl=t=>t.assetProcedureStepFieldValuesAttachmentReducer.instances,Js=u.createSelector([fl],t=>Object.values(t)),yl=t=>s=>s.assetProcedureStepFieldValuesAttachmentReducer.instances[t],Sl=A(u.createSelector([Js,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),Al=A(u.createSelector([Js,(t,s)=>s],(t,s)=>w(t.filter(e=>e.field_values===s)))),wl=Ks.reducer,se=R(t=>t.uuid),Tl={instances:{}},Qs=u.createSlice({name:"assetProcedureStepFieldValues",initialState:Tl,extraReducers:t=>t.addMatcher(u.isAnyOf(b,q,M),s=>Object.assign(s,Tl)),reducers:{initializeAssetProcedureStepFieldValues:se.initialize,addAssetProcedureStepFieldValues:se.addOne,addAssetProcedureStepFieldValuesMany:se.addMany,setAssetProcedureStepFieldValues:se.setOne,setAssetProcedureStepFieldValuesMany:se.setMany,updateAssetProcedureStepFieldValues:se.updateOne,updateAssetProcedureStepFieldValuesMany:se.updateMany,deleteAssetProcedureStepFieldValues:se.deleteOne,deleteAssetProcedureStepFieldValuesMany:se.deleteMany}}),{initializeAssetProcedureStepFieldValues:Ol,addAssetProcedureStepFieldValues:Il,addAssetProcedureStepFieldValuesMany:Fl,setAssetProcedureStepFieldValues:Pl,setAssetProcedureStepFieldValuesMany:gl,updateAssetProcedureStepFieldValues:bl,updateAssetProcedureStepFieldValuesMany:_l,deleteAssetProcedureStepFieldValues:Rl,deleteAssetProcedureStepFieldValuesMany:Ml}=Qs.actions,kl=t=>t.assetProcedureStepFieldValuesReducer.instances,Pt=u.createSelector([kl],t=>Object.values(t)),l_=A(u.createSelector([Pt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.asset===s)))),o_=A(u.createSelector([Pt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.asset_procedure===s)))),u_=A(u.createSelector([Pt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.asset_procedure_step===s)))),vl=t=>s=>s.assetProcedureStepFieldValuesReducer.instances[t],El=A(u.createSelector([Pt,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),Vl=Qs.reducer,ie=R(t=>t.uuid),Wl={instances:{}},Xs=u.createSlice({name:"assetProcedureSteps",initialState:Wl,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,Wl)),reducers:{initializeAssetProcedureSteps:ie.initialize,setAssetProcedureStep:ie.setOne,setAssetProcedureSteps:ie.setMany,addAssetProcedureStep:ie.addOne,addAssetProcedureSteps:ie.addMany,updateAssetProcedureStep:ie.updateOne,updateAssetProcedureSteps:ie.updateMany,deleteAssetProcedureStep:ie.deleteOne,deleteAssetProcedureSteps:ie.deleteMany}}),{initializeAssetProcedureSteps:Bl,setAssetProcedureStep:zl,setAssetProcedureSteps:ql,addAssetProcedureStep:jl,addAssetProcedureSteps:Cl,updateAssetProcedureStep:Dl,updateAssetProcedureSteps:$l,deleteAssetProcedureStep:Ul,deleteAssetProcedureSteps:Ll}=Xs.actions,Nl=Xs.reducer,Ct=t=>t.assetProcedureStepReducer.instances,Hl=t=>s=>s.assetProcedureStepReducer.instances[t],xs=u.createSelector([Ct],t=>Object.values(t)),h_=A(u.createSelector([Ct,(t,s)=>s],(t,s)=>{const e={};for(const[n,a]of Object.entries(t))a.asset_procedure_type===s&&(e[n]=a);return Vt(e)})),p_=A(u.createSelector([xs,(t,s)=>s],(t,s)=>w(t.filter(e=>e.asset_procedure_type===s)))),Gl=A(u.createSelector([xs,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),Kl=A(u.createSelector([Ct,(t,s)=>s],(t,s)=>{if(!t[s])return w([]);const a=Ic(s,Object.values(t)).all().map(({model:r})=>r);return w(a)})),ne=R(t=>t.uuid),Yl={instances:{}},ei=u.createSlice({name:"assets",initialState:Yl,extraReducers:t=>t.addMatcher(u.isAnyOf(b,q,M),s=>Object.assign(s,Yl)),reducers:{initializeAssets:ne.initialize,addAsset:ne.addOne,addAssets:ne.addMany,setAsset:ne.setOne,setAssets:ne.setMany,updateAsset:ne.updateOne,updateAssets:ne.updateMany,deleteAsset:ne.deleteOne,deleteAssets:ne.deleteMany}}),{initializeAssets:Zl,addAsset:Jl,addAssets:ti,updateAsset:Ql,updateAssets:Xl,deleteAsset:xl,deleteAssets:si,setAsset:eo,setAssets:to}=ei.actions,so=t=>t.assetReducer.instances,Dt=u.createSelector([so],t=>w(Object.values(t))),m_=A(u.createSelector([Dt,(t,s)=>s],(t,s)=>w(t.filter(({project:e})=>e===s)))),io=A(u.createSelector([Dt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.asset_type===s)))),no=t=>s=>s.assetReducer.instances[t],ao=A(u.createSelector([Dt,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),co=ei.reducer,ae=R(t=>t.uuid),ro={instances:{}},ii=u.createSlice({name:"assetStageCompletions",initialState:ro,extraReducers:t=>t.addMatcher(u.isAnyOf(b,q,M),s=>Object.assign(s,ro)),reducers:{initializeAssetStageCompletions:ae.initialize,addAssetStageCompletion:ae.addOne,addAssetStageCompletions:ae.addMany,setAssetStageCompletion:ae.setOne,setAssetStageCompletions:ae.setMany,updateAssetStageCompletion:ae.updateOne,updateAssetStageCompletions:ae.updateMany,deleteAssetStageCompletion:ae.deleteOne,deleteAssetStageCompletions:ae.deleteMany}}),{initializeAssetStageCompletions:lo,addAssetStageCompletion:oo,addAssetStageCompletions:uo,setAssetStageCompletion:ho,setAssetStageCompletions:po,updateAssetStageCompletion:mo,updateAssetStageCompletions:fo,deleteAssetStageCompletion:yo,deleteAssetStageCompletions:So}=ii.actions,Ao=ii.reducer,wo=t=>t.assetStageCompletionReducer.instances,To=u.createSelector([wo],t=>Object.values(t)),Oo=t=>s=>s.assetStageCompletionReducer.instances[t],Io=A(u.createSelector([To,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),ce=R(t=>t.uuid),Fo={instances:{}},ni=u.createSlice({name:"assetStages",initialState:Fo,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,Fo)),reducers:{initializeAssetStages:ce.initialize,setAssetStage:ce.setOne,setAssetStages:ce.setMany,addAssetStage:ce.addOne,addAssetStages:ce.addMany,updateAssetStage:ce.updateOne,updateAssetStages:ce.updateMany,deleteAssetStage:ce.deleteOne,deleteAssetStages:ce.deleteMany}}),{initializeAssetStages:Po,setAssetStage:go,setAssetStages:bo,addAssetStage:_o,addAssetStages:Ro,updateAssetStage:Mo,updateAssetStages:ko,deleteAssetStage:vo,deleteAssetStages:Eo}=ni.actions,Vo=ni.reducer,ai=t=>t.assetStageReducer.instances,Wo=t=>s=>s.assetStageReducer.instances[t],ci=u.createSelector([ai],t=>Object.values(t)),f_=A(u.createSelector([ai,(t,s)=>s],(t,s)=>{const e={};for(const[n,a]of Object.entries(t))a.asset_procedure_type===s&&(e[n]=a);return Vt(e)})),y_=A(u.createSelector([ci,(t,s)=>s],(t,s)=>w(t.filter(e=>e.asset_procedure_type===s)))),Bo=A(u.createSelector([ci,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),re=R(t=>t.uuid),zo={instances:{}},ri=u.createSlice({name:"assetTypeAttachments",initialState:zo,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,zo)),reducers:{initializeAssetTypeAttachments:re.initialize,addAssetTypeAttachment:re.addOne,addAssetTypeAttachments:re.addMany,setAssetTypeAttachment:re.setOne,setAssetTypeAttachments:re.setMany,updateAssetTypeAttachment:re.updateOne,updateAssetTypeAttachments:re.updateMany,deleteAssetTypeAttachment:re.deleteOne,deleteAssetTypeAttachments:re.deleteMany}}),{initializeAssetTypeAttachments:qo,addAssetTypeAttachment:jo,addAssetTypeAttachments:di,setAssetTypeAttachment:Co,setAssetTypeAttachments:Do,updateAssetTypeAttachment:$o,updateAssetTypeAttachments:Uo,deleteAssetTypeAttachment:Lo,deleteAssetTypeAttachments:li}=ri.actions,No=t=>t.assetTypeAttachmentReducer.instances,oi=u.createSelector([No],t=>Object.values(t)),Ho=t=>s=>s.assetTypeAttachmentReducer.instances[t],Go=A(u.createSelector([oi,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),Ko=A(u.createSelector([oi,(t,s)=>s],(t,s)=>w(t.filter(({asset_type:e})=>s===e)))),Yo=ri.reducer,de=R(t=>t.uuid),Zo={instances:{}},ui=u.createSlice({name:"assetTypeFieldsAttachments",initialState:Zo,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,Zo)),reducers:{initializeAssetTypeFieldsAttachments:de.initialize,addAssetTypeFieldsAttachment:de.addOne,addAssetTypeFieldsAttachments:de.addMany,setAssetTypeFieldsAttachment:de.setOne,setAssetTypeFieldsAttachments:de.setMany,updateAssetTypeFieldsAttachment:de.updateOne,updateAssetTypeFieldsAttachments:de.updateMany,deleteAssetTypeFieldsAttachment:de.deleteOne,deleteAssetTypeFieldsAttachments:de.deleteMany}}),{initializeAssetTypeFieldsAttachments:Jo,addAssetTypeFieldsAttachment:Qo,addAssetTypeFieldsAttachments:Xo,setAssetTypeFieldsAttachment:xo,setAssetTypeFieldsAttachments:eu,updateAssetTypeFieldsAttachment:tu,updateAssetTypeFieldsAttachments:su,deleteAssetTypeFieldsAttachment:iu,deleteAssetTypeFieldsAttachments:nu}=ui.actions,au=t=>t.assetTypeFieldsAttachmentReducer.instances,hi=u.createSelector([au],t=>Object.values(t)),S_=A(u.createSelector([hi,(t,s)=>s],(t,s)=>w(t.filter(e=>e.fields_revision===s)))),cu=t=>s=>s.assetTypeFieldsAttachmentReducer.instances[t],ru=A(u.createSelector([hi,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),du=ui.reducer,le=R(t=>t.uuid),lu={instances:{}},pi=u.createSlice({name:"assetTypeFields",initialState:lu,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,lu)),reducers:{initializeAssetTypeFields:le.initialize,addAssetTypeFields:le.addOne,addAssetTypeFieldsMany:le.addMany,setAssetTypeFields:le.setOne,setAssetTypeFieldsMany:le.setMany,updateAssetTypeFields:le.updateOne,updateAssetTypeFieldsMany:le.updateMany,deleteAssetTypeFields:le.deleteOne,deleteAssetTypeFieldsMany:le.deleteMany}}),{initializeAssetTypeFields:ou,addAssetTypeFields:uu,addAssetTypeFieldsMany:hu,setAssetTypeFields:pu,setAssetTypeFieldsMany:mu,updateAssetTypeFields:fu,updateAssetTypeFieldsMany:yu,deleteAssetTypeFields:Su,deleteAssetTypeFieldsMany:Au}=pi.actions,wu=t=>t.assetTypeFieldsReducer.instances,gt=u.createSelector([wu],t=>Object.values(t)),A_=A(u.createSelector([gt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.asset_type===s)))),w_=A(u.createSelector([gt,(t,s)=>s],(t,s)=>t.filter(e=>e.asset_type===s).sort((e,n)=>e.submitted_at>n.submitted_at?-1:1)[0])),Tu=t=>s=>s.assetTypeFieldsReducer.instances[t],Ou=A(u.createSelector([gt,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),Iu=pi.reducer,oe=R(t=>t.uuid),Fu={instances:{}},mi=u.createSlice({name:"assetTypeFieldValuesAttachments",initialState:Fu,extraReducers:t=>t.addMatcher(u.isAnyOf(b,q,M),s=>Object.assign(s,Fu)),reducers:{initializeAssetTypeFieldValuesAttachments:oe.initialize,addAssetTypeFieldValuesAttachment:oe.addOne,addAssetTypeFieldValuesAttachments:oe.addMany,setAssetTypeFieldValuesAttachment:oe.setOne,setAssetTypeFieldValuesAttachments:oe.setMany,updateAssetTypeFieldValuesAttachment:oe.updateOne,updateAssetTypeFieldValuesAttachments:oe.updateMany,deleteAssetTypeFieldValuesAttachment:oe.deleteOne,deleteAssetTypeFieldValuesAttachments:oe.deleteMany}}),{initializeAssetTypeFieldValuesAttachments:Pu,addAssetTypeFieldValuesAttachment:gu,addAssetTypeFieldValuesAttachments:fi,setAssetTypeFieldValuesAttachment:bu,setAssetTypeFieldValuesAttachments:_u,updateAssetTypeFieldValuesAttachment:Ru,updateAssetTypeFieldValuesAttachments:Mu,deleteAssetTypeFieldValuesAttachment:ku,deleteAssetTypeFieldValuesAttachments:yi}=mi.actions,vu=t=>t.assetTypeFieldValuesAttachmentReducer.instances,Si=u.createSelector([vu],t=>Object.values(t)),Eu=t=>s=>s.assetTypeFieldValuesAttachmentReducer.instances[t],Vu=A(u.createSelector([Si,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),Wu=A(u.createSelector([Si,(t,s)=>s],(t,s)=>w(t.filter(e=>e.field_values===s)))),Bu=mi.reducer,ue=R(t=>t.uuid),zu={instances:{}},Ai=u.createSlice({name:"assetTypeFieldValues",initialState:zu,extraReducers:t=>t.addMatcher(u.isAnyOf(b,q,M),s=>Object.assign(s,zu)),reducers:{initializeAssetTypeFieldValues:ue.initialize,addAssetTypeFieldValues:ue.addOne,addAssetTypeFieldValuesMany:ue.addMany,setAssetTypeFieldValues:ue.setOne,setAssetTypeFieldValuesMany:ue.setMany,updateAssetTypeFieldValues:ue.updateOne,updateAssetTypeFieldValuesMany:ue.updateMany,deleteAssetTypeFieldValues:ue.deleteOne,deleteAssetTypeFieldValuesMany:ue.deleteMany}}),{initializeAssetTypeFieldValues:qu,addAssetTypeFieldValues:ju,addAssetTypeFieldValuesMany:Cu,setAssetTypeFieldValues:Du,setAssetTypeFieldValuesMany:$u,updateAssetTypeFieldValues:Uu,updateAssetTypeFieldValuesMany:Lu,deleteAssetTypeFieldValues:Nu,deleteAssetTypeFieldValuesMany:Hu}=Ai.actions,Gu=t=>t.assetTypeFieldValuesReducer.instances,$t=u.createSelector([Gu],t=>Object.values(t)),T_=A(u.createSelector([$t,(t,s)=>s],(t,s)=>w(t.filter(e=>e.asset===s)))),O_=A(u.createSelector([gt,$t,(t,s)=>s],(t,s,e)=>{const n=new Set(t.filter(a=>a.asset_type===e).map(a=>a.uuid));return w(s.filter(a=>n.has(a.fields_revision)))})),Ku=t=>s=>s.assetTypeFieldValuesReducer.instances[t],Yu=A(u.createSelector([$t,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),Zu=Ai.reducer,he=R(t=>t.uuid),Ju={instances:{}},wi=u.createSlice({name:"assetTypeIdentifiers",initialState:Ju,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,Ju)),reducers:{initializeAssetTypeIdentifiers:he.initialize,addAssetTypeIdentifier:he.addOne,addAssetTypeIdentifiers:he.addMany,setAssetTypeIdentifier:he.setOne,setAssetTypeIdentifiers:he.setMany,updateAssetTypeIdentifier:he.updateOne,updateAssetTypeIdentifiers:he.updateMany,deleteAssetTypeIdentifier:he.deleteOne,deleteAssetTypeIdentifiers:he.deleteMany}}),{initializeAssetTypeIdentifiers:Qu,addAssetTypeIdentifier:Xu,addAssetTypeIdentifiers:xu,setAssetTypeIdentifier:eh,setAssetTypeIdentifiers:th,updateAssetTypeIdentifier:sh,updateAssetTypeIdentifiers:ih,deleteAssetTypeIdentifier:nh,deleteAssetTypeIdentifiers:ah}=wi.actions,ch=t=>t.assetTypeIdentifierReducer.instances,Ti=u.createSelector([ch],t=>Object.values(t)),rh=t=>s=>s.assetTypeIdentifierReducer.instances[t],dh=A(u.createSelector([Ti,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),I_=A(u.createSelector([Ti,(t,s)=>s],(t,s)=>w(t.filter(e=>e.asset_type===s)))),lh=wi.reducer,pe=R(t=>t.uuid),oh={instances:{}},Oi=u.createSlice({name:"assetTypeIdentifierValues",initialState:oh,extraReducers:t=>t.addMatcher(u.isAnyOf(b,q,M),s=>Object.assign(s,oh)),reducers:{initializeAssetTypeIdentifierValues:pe.initialize,addAssetTypeIdentifierValue:pe.addOne,addAssetTypeIdentifierValues:pe.addMany,setAssetTypeIdentifierValue:pe.setOne,setAssetTypeIdentifierValues:pe.setMany,updateAssetTypeIdentifierValue:pe.updateOne,updateAssetTypeIdentifierValues:pe.updateMany,deleteAssetTypeIdentifierValue:pe.deleteOne,deleteAssetTypeIdentifierValues:pe.deleteMany}}),{initializeAssetTypeIdentifierValues:uh,addAssetTypeIdentifierValue:hh,addAssetTypeIdentifierValues:ph,setAssetTypeIdentifierValue:mh,setAssetTypeIdentifierValues:fh,updateAssetTypeIdentifierValue:yh,updateAssetTypeIdentifierValues:Sh,deleteAssetTypeIdentifierValue:Ah,deleteAssetTypeIdentifierValues:wh}=Oi.actions,Th=t=>t.assetTypeIdentifierValueReducer.instances,Ut=u.createSelector([Th],t=>Object.values(t)),Oh=t=>s=>s.assetTypeIdentifierValueReducer.instances[t],Ih=A(u.createSelector([Ut,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),F_=A(u.createSelector([Ut,(t,s)=>s],(t,s)=>w(t.filter(e=>e.asset===s)))),P_=A(u.createSelector([Ut,(t,s)=>s],(t,s)=>w(t.filter(e=>e.asset_type_identifier===s)))),Fh=Oi.reducer,me=R(t=>t.uuid),Ph={instances:{}},Ii=u.createSlice({name:"assetTypes",initialState:Ph,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,Ph)),reducers:{initializeAssetTypes:me.initialize,setAssetType:me.setOne,setAssetTypes:me.setMany,addAssetType:me.addOne,addAssetTypes:me.addMany,updateAssetType:me.updateOne,updateAssetTypes:me.updateMany,deleteAssetType:me.deleteOne,deleteAssetTypes:me.deleteMany}}),{initializeAssetTypes:gh,setAssetType:bh,setAssetTypes:_h,addAssetType:Rh,addAssetTypes:Mh,updateAssetType:kh,updateAssetTypes:vh,deleteAssetType:Eh,deleteAssetTypes:Vh}=Ii.actions,Wh=t=>t.assetTypeReducer.instances,Fi=u.createSelector([Wh],t=>Object.values(t)),Bh=t=>s=>s.assetTypeReducer.instances[t],zh=A(u.createSelector([Fi,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),g_=A(u.createSelector([Fi,(t,s)=>s],(t,s)=>w(t.filter(e=>e.organization===s)))),qh=Ii.reducer,fe=R(t=>t.uuid),jh={instances:{}},Pi=u.createSlice({name:"assetTypeStatuses",initialState:jh,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,jh)),reducers:{initializeAssetTypeStatuses:fe.initialize,addAssetTypeStatus:fe.addOne,addAssetTypeStatuses:fe.addMany,setAssetTypeStatus:fe.setOne,setAssetTypeStatuses:fe.setMany,updateAssetTypeStatus:fe.updateOne,updateAssetTypeStatuses:fe.updateMany,deleteAssetTypeStatus:fe.deleteOne,deleteAssetTypeStatuses:fe.deleteMany}}),{initializeAssetTypeStatuses:Ch,addAssetTypeStatus:Dh,addAssetTypeStatuses:$h,setAssetTypeStatus:Uh,setAssetTypeStatuses:Lh,updateAssetTypeStatus:Nh,updateAssetTypeStatuses:Hh,deleteAssetTypeStatus:Gh,deleteAssetTypeStatuses:Kh}=Pi.actions,Yh=t=>t.assetTypeStatusReducer.instances,gi=u.createSelector([Yh],t=>w(Object.values(t).toSorted(Fc))),Zh=t=>s=>s.assetTypeStatusReducer.instances[t],Jh=A(u.createSelector([gi,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),b_=A(u.createSelector([gi,(t,s)=>s],(t,s)=>w(t.filter(e=>e.asset_type===s)))),Qh=Pi.reducer,Xh={accessToken:"",refreshToken:"",isLoggedIn:!1},Lt=u.createSlice({name:"auth",initialState:Xh,extraReducers:t=>t.addCase(b,s=>Object.assign(s,Xh)),reducers:{setTokens:(t,s)=>{t.accessToken=s.payload.accessToken,t.refreshToken=s.payload.refreshToken},clearTokens:t=>{t.accessToken="",t.refreshToken=""},setLoggedIn:(t,s)=>{s.payload||Lt.caseReducers.clearTokens(t),t.isLoggedIn=s.payload}}}),{setTokens:__,clearTokens:R_,setLoggedIn:xh}=Lt.actions,M_=t=>t.authReducer.accessToken,k_=t=>t.authReducer.isLoggedIn,ep=Lt.reducer,ye=R(t=>t.uuid),tp={instances:{}},bi=u.createSlice({name:"documentAttachments",initialState:tp,extraReducers:t=>t.addCase(b,s=>Object.assign(s,tp)),reducers:{initializeDocumentAttachments:ye.initialize,addDocumentAttachment:ye.addOne,addDocumentAttachments:ye.addMany,setDocumentAttachment:ye.setOne,setDocumentAttachments:ye.setMany,updateDocumentAttachment:ye.updateOne,updateDocumentAttachments:ye.updateMany,deleteDocumentAttachment:ye.deleteOne,deleteDocumentAttachments:ye.deleteMany}}),{initializeDocumentAttachments:sp,addDocumentAttachment:ip,addDocumentAttachments:np,setDocumentAttachment:ap,setDocumentAttachments:cp,updateDocumentAttachment:rp,updateDocumentAttachments:dp,deleteDocumentAttachment:lp,deleteDocumentAttachments:op}=bi.actions,up=t=>t.documentAttachmentReducer.instances,_i=u.createSelector([up],t=>Object.values(t)),hp=t=>s=>s.documentAttachmentReducer.instances[t],pp=A(u.createSelector([_i,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),v_=A(u.createSelector([_i,(t,s)=>s],(t,s)=>w(t.filter(({document:e})=>s===e)))),mp=bi.reducer,Se=R(({uuid:t})=>t),fp={instances:{}},Ri=u.createSlice({name:"documents",initialState:fp,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>{Object.assign(s,fp)}),reducers:{initializeDocuments:Se.initialize,addDocument:Se.addOne,addDocuments:Se.addMany,setDocument:Se.setOne,setDocuments:Se.setMany,updateDocument:Se.updateOne,updateDocuments:Se.updateMany,deleteDocument:Se.deleteOne,deleteDocuments:Se.deleteMany}}),{initializeDocuments:yp,addDocument:Sp,addDocuments:Ap,setDocument:wp,setDocuments:Tp,updateDocument:Op,updateDocuments:Ip,deleteDocument:Fp,deleteDocuments:Pp}=Ri.actions,gp=Ri.reducer,Mi=t=>t.documentsReducer.instances,Nt=u.createSelector([Mi],t=>Object.values(t)),bp=t=>s=>s.documentsReducer.instances[t],_p=A(u.createSelector([Nt,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),E_=A(u.createSelector([Nt,(t,s)=>s],(t,s)=>t.filter(e=>e.project===s))),V_=A(u.createSelector([Nt,(t,s)=>s],(t,s)=>t.filter(e=>e.organization===s))),Rp=A(u.createSelector([Mi,(t,s)=>s],(t,s)=>{if(!t[s])return w([]);const a=bc(s,Object.values(t)).all().map(({model:r})=>r);return w(a)})),Ae=R(t=>t.uuid),Mp={instances:{}},ki=u.createSlice({name:"emailDomains",initialState:Mp,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,Mp)),reducers:{initializeEmailDomains:Ae.initialize,addEmailDomain:Ae.addOne,addEmailDomains:Ae.addMany,setEmailDomain:Ae.setOne,setEmailDomains:Ae.setMany,updateEmailDomain:Ae.updateOne,updateEmailDomains:Ae.updateMany,deleteEmailDomain:Ae.deleteOne,deleteEmailDomains:Ae.deleteMany}}),{initializeEmailDomains:kp,addEmailDomain:vp,addEmailDomains:Ep,setEmailDomain:Vp,setEmailDomains:Wp,updateEmailDomain:Bp,updateEmailDomains:zp,deleteEmailDomain:qp,deleteEmailDomains:jp}=ki.actions,Cp=t=>t.emailDomainsReducer.instances,vi=u.createSelector([Cp],t=>Object.values(t)),Dp=t=>s=>s.emailDomainsReducer.instances[t],$p=A(u.createSelector([vi,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),W_=A(u.createSelector([vi,(t,s)=>s],(t,s)=>w(t.filter(e=>e.organization===s)))),Up=ki.reducer,Lp={s3Urls:{}},Np=1e3*60*60,B_=Np*24*7,Ei=u.createSlice({name:"file",initialState:Lp,extraReducers:t=>t.addCase(b,s=>Object.assign(s,Lp)),reducers:{setUploadUrl:(t,s)=>{const{url:e,fields:n,sha1:a}=s.payload,r=new Date,d=new Date(r.getTime()+B_);t.s3Urls[a]={url:e,fields:n,exp:d.getTime()}}}}),{setUploadUrl:Hp}=Ei.actions,Gp=t=>s=>{const e=s.fileReducer.s3Urls[t];if(!e)return;const n=new Date().getTime();if(!((e.exp??n)-n<Np))return e},Kp=Ei.reducer,we=R(t=>t.uuid),Yp={instances:{}},Vi=u.createSlice({name:"formIdentifiers",initialState:Yp,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,Yp)),reducers:{initializeFormIdentifiers:we.initialize,addFormIdentifier:we.addOne,addFormIdentifiers:we.addMany,setFormIdentifier:we.setOne,setFormIdentifiers:we.setMany,updateFormIdentifier:we.updateOne,updateFormIdentifiers:we.updateMany,deleteFormIdentifier:we.deleteOne,deleteFormIdentifiers:we.deleteMany}}),{initializeFormIdentifiers:Zp,addFormIdentifier:Jp,addFormIdentifiers:Qp,setFormIdentifier:Xp,setFormIdentifiers:xp,updateFormIdentifier:em,updateFormIdentifiers:tm,deleteFormIdentifier:sm,deleteFormIdentifiers:im}=Vi.actions,nm=t=>t.formIdentifierReducer.instances,Wi=u.createSelector([nm],t=>Object.values(t)),am=t=>s=>s.formIdentifierReducer.instances[t],cm=A(u.createSelector([Wi,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),z_=A(u.createSelector([Wi,(t,s)=>s],(t,s)=>w(t.filter(e=>e.form===s)))),rm=Vi.reducer,Te=R(t=>t.uuid),dm={instances:{}},Bi=u.createSlice({name:"formIdentifierValues",initialState:dm,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,dm)),reducers:{initializeFormIdentifierValues:Te.initialize,addFormIdentifierValue:Te.addOne,addFormIdentifierValues:Te.addMany,setFormIdentifierValue:Te.setOne,setFormIdentifierValues:Te.setMany,updateFormIdentifierValue:Te.updateOne,updateFormIdentifierValues:Te.updateMany,deleteFormIdentifierValue:Te.deleteOne,deleteFormIdentifierValues:Te.deleteMany}}),{initializeFormIdentifierValues:lm,addFormIdentifierValue:om,addFormIdentifierValues:um,setFormIdentifierValue:hm,setFormIdentifierValues:pm,updateFormIdentifierValue:mm,updateFormIdentifierValues:fm,deleteFormIdentifierValue:ym,deleteFormIdentifierValues:Sm}=Bi.actions,Am=t=>t.formIdentifierValueReducer.instances,Ht=u.createSelector([Am],t=>Object.values(t)),wm=t=>s=>s.formIdentifierValueReducer.instances[t],Tm=A(u.createSelector([Ht,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),q_=A(u.createSelector([Ht,(t,s)=>s],(t,s)=>w(t.filter(e=>e.form_submission===s)))),j_=A(u.createSelector([Ht,(t,s)=>s],(t,s)=>w(t.filter(e=>e.form_identifier===s)))),Om=Bi.reducer,Oe=R(t=>t.uuid),Im={instances:{}},zi=u.createSlice({name:"formRevisionAttachments",initialState:Im,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,Im)),reducers:{initializeFormRevisionAttachments:Oe.initialize,addFormRevisionAttachment:Oe.addOne,addFormRevisionAttachments:Oe.addMany,setFormRevisionAttachment:Oe.setOne,setFormRevisionAttachments:Oe.setMany,updateFormRevisionAttachment:Oe.updateOne,updateFormRevisionAttachments:Oe.updateMany,deleteFormRevisionAttachment:Oe.deleteOne,deleteFormRevisionAttachments:Oe.deleteMany}}),{initializeFormRevisionAttachments:Fm,addFormRevisionAttachment:Pm,addFormRevisionAttachments:gm,setFormRevisionAttachment:bm,setFormRevisionAttachments:_m,updateFormRevisionAttachment:Rm,updateFormRevisionAttachments:Mm,deleteFormRevisionAttachment:km,deleteFormRevisionAttachments:vm}=zi.actions,Gt=t=>t.formRevisionAttachmentReducer.instances,Em=u.createSelector([Gt],t=>Object.values(t)),Vm=A(u.createSelector([Gt,(t,s)=>s],(t,s)=>t[s])),Wm=A(u.createSelector([Em,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),C_=A(u.createSelector([Gt,(t,s)=>s],(t,s)=>w(Object.values(t).filter(e=>e.form_revision===s)))),Bm=zi.reducer,Ie=R(t=>t.uuid),zm={instances:{}},qi=u.createSlice({name:"formRevisions",initialState:zm,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,zm)),reducers:{initializeFormRevisions:Ie.initialize,addFormRevision:Ie.addOne,addFormRevisions:Ie.addMany,setFormRevision:Ie.setOne,setFormRevisions:Ie.setMany,updateFormRevision:Ie.updateOne,updateFormRevisions:Ie.updateMany,deleteFormRevision:Ie.deleteOne,deleteFormRevisions:Ie.deleteMany}}),{initializeFormRevisions:qm,addFormRevision:ji,addFormRevisions:Ci,setFormRevision:jm,setFormRevisions:Cm,updateFormRevision:Dm,updateFormRevisions:$m,deleteFormRevision:Di,deleteFormRevisions:$i}=qi.actions,Ui=t=>t.formRevisionReducer.instances,Kt=u.createSelector([Ui],t=>Object.values(t)),Um=t=>s=>s.formRevisionReducer.instances[t],Lm=A(u.createSelector([Kt,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),D_=A(u.createSelector([Kt,(t,s)=>s],(t,s)=>t.filter(e=>e.form===s).sort((e,n)=>e.submitted_at>n.submitted_at?-1:1)[0])),Nm=A(u.createSelector([Kt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.form===s)))),Hm=qi.reducer,Fe=R(t=>t.uuid),Gm={instances:{}},Li=u.createSlice({name:"forms",initialState:Gm,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,Gm)),reducers:{initializeForms:Fe.initialize,addForm:Fe.addOne,addForms:Fe.addMany,setForm:Fe.setOne,setForms:Fe.setMany,updateForm:Fe.updateOne,updateForms:Fe.updateMany,deleteForm:Fe.deleteOne,deleteForms:Fe.deleteMany}}),{initializeForms:Km,addForm:Ym,addForms:Zm,setForm:Jm,setForms:Qm,updateForm:Xm,updateForms:xm,deleteForm:ef,deleteForms:tf}=Li.actions,sf=Li.reducer,nf=t=>t.formReducer.instances,Ni=u.createSelector([nf],t=>Object.values(t)),af=t=>s=>s.formReducer.instances[t],cf=A(u.createSelector([Ni,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),$_=A(u.createSelector([Ni,(t,s)=>s],(t,s)=>w(t.filter(e=>e.organization===s)))),Pe=R(t=>t.uuid),rf={instances:{}},Hi=u.createSlice({name:"formSubmissionAttachments",initialState:rf,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,rf)),reducers:{initializeFormSubmissionAttachments:Pe.initialize,addFormSubmissionAttachment:Pe.addOne,addFormSubmissionAttachments:Pe.addMany,setFormSubmissionAttachment:Pe.setOne,setFormSubmissionAttachments:Pe.setMany,updateFormSubmissionAttachment:Pe.updateOne,updateFormSubmissionAttachments:Pe.updateMany,deleteFormSubmissionAttachment:Pe.deleteOne,deleteFormSubmissionAttachments:Pe.deleteMany}}),{initializeFormSubmissionAttachments:df,addFormSubmissionAttachment:lf,addFormSubmissionAttachments:Gi,setFormSubmissionAttachment:of,setFormSubmissionAttachments:uf,updateFormSubmissionAttachment:hf,updateFormSubmissionAttachments:pf,deleteFormSubmissionAttachment:mf,deleteFormSubmissionAttachments:Ki}=Hi.actions,Yi=t=>t.formSubmissionAttachmentReducer.instances,Zi=u.createSelector([Yi],t=>Object.values(t)),ff=A(u.createSelector([Yi,(t,s)=>s],(t,s)=>t[s])),Ji=A(u.createSelector([Zi,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(n=>e.has(n.uuid)))})),yf=Ji,Sf=A(u.createSelector([Zi,(t,s)=>s],(t,s)=>w(t.filter(e=>e.form_submission===s)))),Af=Hi.reducer,ge=R(t=>t.uuid),wf={instances:{}},Qi=u.createSlice({name:"formSubmissions",initialState:wf,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,wf)),reducers:{initializeFormSubmissions:ge.initialize,setFormSubmission:ge.setOne,setFormSubmissions:ge.setMany,addFormSubmission:ge.addOne,addFormSubmissions:ge.addMany,updateFormSubmission:ge.updateOne,updateFormSubmissions:ge.updateMany,deleteFormSubmission:ge.deleteOne,deleteFormSubmissions:ge.deleteMany}}),{initializeFormSubmissions:Tf,setFormSubmission:Of,setFormSubmissions:If,addFormSubmission:Ff,addFormSubmissions:Xi,updateFormSubmission:Pf,updateFormSubmissions:gf,deleteFormSubmission:bf,deleteFormSubmissions:xi}=Qi.actions,en=t=>t.formSubmissionReducer.instances,_f=u.createSelector([en],t=>Object.values(t)),Rf=t=>s=>s.formSubmissionReducer.instances[t],Mf=A(u.createSelector([_f,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),kf=A(u.createSelector([en,Ui,(t,s)=>s],(t,s,e)=>{const n=new Set;for(const a of Object.values(s))a.form===e&&n.add(a.uuid);return Object.values(t).filter(a=>n.has(a.form_revision))})),vf=Qi.reducer,be=R(t=>t.uuid),Ef={instances:{}},tn=u.createSlice({name:"geoImages",initialState:Ef,extraReducers:t=>t.addMatcher(u.isAnyOf(b,q,M),s=>Object.assign(s,Ef)),reducers:{initializeGeoImages:be.initialize,setGeoImage:be.setOne,setGeoImages:be.setMany,addGeoImage:be.addOne,addGeoImages:be.addMany,updateGeoImage:be.updateOne,updateGeoImages:be.updateMany,deleteGeoImage:be.deleteOne,deleteGeoImages:be.deleteMany}}),{initializeGeoImages:Vf,setGeoImage:Wf,setGeoImages:Bf,addGeoImage:zf,addGeoImages:qf,updateGeoImage:jf,updateGeoImages:Cf,deleteGeoImage:Df,deleteGeoImages:$f}=tn.actions,Uf=t=>t.geoImageReducer.instances,sn=u.createSelector([Uf],t=>Object.values(t)),Lf=t=>s=>s.geoImageReducer.instances[t],Nf=A(u.createSelector([sn,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),U_=A(u.createSelector([sn,(t,s)=>s],(t,s)=>w(t.filter(e=>e.project===s)))),Hf=tn.reducer,_e=R(t=>t.uuid),Gf={instances:{}},nn=u.createSlice({name:"issueAssociations",initialState:Gf,extraReducers:t=>t.addMatcher(u.isAnyOf(b,q,M),s=>Object.assign(s,Gf)),reducers:{initializeIssueAssociations:_e.initialize,addIssueAssociation:_e.addOne,addIssueAssociations:_e.addMany,setIssueAssociation:_e.setOne,setIssueAssociations:_e.setMany,updateIssueAssociation:_e.updateOne,updateIssueAssociations:_e.updateMany,deleteIssueAssociation:_e.deleteOne,deleteIssueAssociations:_e.deleteMany}}),{initializeIssueAssociations:Kf,setIssueAssociations:Yf,setIssueAssociation:Zf,updateIssueAssociation:Jf,updateIssueAssociations:Qf,addIssueAssociation:Xf,addIssueAssociations:Yt,deleteIssueAssociation:xf,deleteIssueAssociations:Zt}=nn.actions,bt=t=>t.issueAssociationReducer.instances,ey=u.createSelector([bt],t=>Object.values(t)),ty=t=>s=>s.issueAssociationReducer.instances[t],sy=A(u.createSelector([ey,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),iy=A(u.createSelector([bt,(t,s)=>s],(t,s)=>w(Object.values(t).filter(e=>e.associated_issue===s)))),ny=A(u.createSelector([bt,(t,s)=>s],(t,s)=>w(Object.values(t).filter(e=>e.issue===s)))),ay=A(u.createSelector([bt,(t,s)=>s],(t,s)=>w(Object.values(t).filter(e=>e.asset===s)))),cy=nn.reducer,Re=R(t=>t.uuid),ry={instances:{}},an=u.createSlice({name:"issueAttachments",initialState:ry,extraReducers:t=>t.addMatcher(u.isAnyOf(b,q,M),s=>Object.assign(s,ry)),reducers:{initializeIssueAttachments:Re.initialize,addIssueAttachment:Re.addOne,addIssueAttachments:Re.addMany,setIssueAttachment:Re.setOne,setIssueAttachments:Re.setMany,updateIssueAttachment:Re.updateOne,updateIssueAttachments:Re.updateMany,deleteIssueAttachment:Re.deleteOne,deleteIssueAttachments:Re.deleteMany}}),{initializeIssueAttachments:dy,addIssueAttachment:ly,addIssueAttachments:cn,setIssueAttachment:oy,setIssueAttachments:uy,updateIssueAttachment:hy,updateIssueAttachments:py,deleteIssueAttachment:my,deleteIssueAttachments:rn}=an.actions,fy=t=>t.issueAttachmentReducer.instances,dn=u.createSelector([fy],t=>Object.values(t)),yy=A(u.createSelector([dn,(t,s)=>s],(t,s)=>w(t.filter(({issue:e})=>s===e)))),Sy=t=>s=>s.issueAttachmentReducer.instances[t],Ay=A(u.createSelector([dn,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),wy=an.reducer,Me=R(t=>t.uuid),Ty={instances:{}},ln=u.createSlice({name:"issueCommentAttachments",initialState:Ty,extraReducers:t=>t.addMatcher(u.isAnyOf(b,q,M),s=>Object.assign(s,Ty)),reducers:{initializeIssueCommentAttachments:Me.initialize,addIssueCommentAttachment:Me.addOne,addIssueCommentAttachments:Me.addMany,setIssueCommentAttachment:Me.setOne,setIssueCommentAttachments:Me.setMany,updateIssueCommentAttachment:Me.updateOne,updateIssueCommentAttachments:Me.updateMany,deleteIssueCommentAttachment:Me.deleteOne,deleteIssueCommentAttachments:Me.deleteMany}}),{initializeIssueCommentAttachments:Oy,addIssueCommentAttachment:Iy,addIssueCommentAttachments:Fy,setIssueCommentAttachment:Py,setIssueCommentAttachments:gy,updateIssueCommentAttachment:by,updateIssueCommentAttachments:_y,deleteIssueCommentAttachment:Ry,deleteIssueCommentAttachments:My}=ln.actions,ky=t=>t.issueCommentAttachmentReducer.instances,on=u.createSelector([ky],t=>Object.values(t)),vy=t=>s=>s.issueCommentAttachmentReducer.instances[t],Ey=A(u.createSelector([on,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),L_=A(u.createSelector([on,(t,s)=>s],(t,s)=>w(t.filter(({issue_comment:e})=>s===e)))),Vy=ln.reducer,ke=R(t=>t.uuid),Wy={instances:{}},un=u.createSlice({name:"issueComments",initialState:Wy,extraReducers:t=>t.addMatcher(u.isAnyOf(b,q,M),s=>Object.assign(s,Wy)),reducers:{initializeIssueComments:ke.initialize,addIssueComment:ke.addOne,addIssueComments:ke.addMany,setIssueComment:ke.setOne,setIssueComments:ke.setMany,updateIssueComment:ke.updateOne,updateIssueComments:ke.updateMany,deleteIssueComment:ke.deleteOne,deleteIssueComments:ke.deleteMany}}),{initializeIssueComments:By,addIssueComment:zy,addIssueComments:qy,setIssueComment:jy,setIssueComments:Cy,updateIssueComment:Dy,updateIssueComments:$y,deleteIssueComment:Uy,deleteIssueComments:Ly}=un.actions,hn=t=>t.issueCommentReducer.instances,Ny=t=>s=>s.issueCommentReducer.instances[t],Hy=A(u.createSelector([hn,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(Object.values(t).filter(({uuid:n})=>e.has(n)))})),N_=A(u.createSelector([hn,(t,s)=>s],(t,s)=>w(Object.values(t).filter(e=>e.issue===s)))),Gy=un.reducer,ve=R(t=>t.uuid),Ky={instances:{}},pn=u.createSlice({name:"issues",initialState:Ky,extraReducers:t=>t.addMatcher(u.isAnyOf(b,q,M),s=>Object.assign(s,Ky)),reducers:{initializeIssues:ve.initialize,addIssue:ve.addOne,addIssues:ve.addMany,setIssue:ve.setOne,setIssues:ve.setMany,updateIssue:ve.updateOne,updateIssues:ve.updateMany,deleteIssue:ve.deleteOne,deleteIssues:ve.deleteMany}}),{initializeIssues:Yy,addIssue:Zy,addIssues:mn,setIssue:Jy,setIssues:Qy,updateIssue:Xy,updateIssues:xy,deleteIssue:eS,deleteIssues:fn}=pn.actions,tS=t=>t.issueReducer.instances,Jt=u.createSelector([tS],t=>Object.values(t)),sS=t=>s=>s.issueReducer.instances[t],iS=A(u.createSelector([Jt,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),H_=A(u.createSelector([Jt,(t,s)=>s],(t,s)=>t.filter(e=>e.project===s))),nS=A(u.createSelector([Jt,(t,s)=>s],(t,s)=>t.filter(e=>e.issue_type===s))),aS=pn.reducer,Ee=R(t=>t.uuid),cS={instances:{}},yn=u.createSlice({name:"issueTypeAttachments",initialState:cS,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,cS)),reducers:{initializeIssueTypeAttachments:Ee.initialize,addIssueTypeAttachment:Ee.addOne,addIssueTypeAttachments:Ee.addMany,setIssueTypeAttachment:Ee.setOne,setIssueTypeAttachments:Ee.setMany,updateIssueTypeAttachment:Ee.updateOne,updateIssueTypeAttachments:Ee.updateMany,deleteIssueTypeAttachment:Ee.deleteOne,deleteIssueTypeAttachments:Ee.deleteMany}}),{initializeIssueTypeAttachments:rS,addIssueTypeAttachment:dS,addIssueTypeAttachments:lS,setIssueTypeAttachment:oS,setIssueTypeAttachments:uS,updateIssueTypeAttachment:hS,updateIssueTypeAttachments:pS,deleteIssueTypeAttachment:mS,deleteIssueTypeAttachments:fS}=yn.actions,yS=t=>t.issueTypeAttachmentReducer.instances,Sn=u.createSelector([yS],t=>Object.values(t)),SS=t=>s=>s.issueTypeAttachmentReducer.instances[t],AS=A(u.createSelector([Sn,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),G_=A(u.createSelector([Sn,(t,s)=>s],(t,s)=>w(t.filter(({issue_type:e})=>s===e)))),wS=yn.reducer,Ve=R(t=>t.uuid),TS={instances:{}},An=u.createSlice({name:"issueTypeFieldsAttachments",initialState:TS,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,TS)),reducers:{initializeIssueTypeFieldsAttachments:Ve.initialize,addIssueTypeFieldsAttachment:Ve.addOne,addIssueTypeFieldsAttachments:Ve.addMany,setIssueTypeFieldsAttachment:Ve.setOne,setIssueTypeFieldsAttachments:Ve.setMany,updateIssueTypeFieldsAttachment:Ve.updateOne,updateIssueTypeFieldsAttachments:Ve.updateMany,deleteIssueTypeFieldsAttachment:Ve.deleteOne,deleteIssueTypeFieldsAttachments:Ve.deleteMany}}),{initializeIssueTypeFieldsAttachments:OS,addIssueTypeFieldsAttachment:IS,addIssueTypeFieldsAttachments:FS,setIssueTypeFieldsAttachment:PS,setIssueTypeFieldsAttachments:gS,updateIssueTypeFieldsAttachment:bS,updateIssueTypeFieldsAttachments:_S,deleteIssueTypeFieldsAttachment:RS,deleteIssueTypeFieldsAttachments:MS}=An.actions,kS=t=>t.issueTypeFieldsAttachmentReducer.instances,wn=u.createSelector([kS],t=>Object.values(t)),K_=A(u.createSelector([wn,(t,s)=>s],(t,s)=>w(t.filter(e=>e.fields_revision===s)))),vS=t=>s=>s.issueTypeFieldsAttachmentReducer.instances[t],ES=A(u.createSelector([wn,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),VS=An.reducer,We=R(t=>t.uuid),WS={instances:{}},Tn=u.createSlice({name:"issueTypeFieldValues",initialState:WS,extraReducers:t=>t.addMatcher(u.isAnyOf(b,q,M),s=>Object.assign(s,WS)),reducers:{initializeIssueTypeFieldValues:We.initialize,addIssueTypeFieldValues:We.addOne,addIssueTypeFieldValuesMany:We.addMany,setIssueTypeFieldValues:We.setOne,setIssueTypeFieldValuesMany:We.setMany,updateIssueTypeFieldValues:We.updateOne,updateIssueTypeFieldValuesMany:We.updateMany,deleteIssueTypeFieldValues:We.deleteOne,deleteIssueTypeFieldValuesMany:We.deleteMany}}),{initializeIssueTypeFieldValues:BS,addIssueTypeFieldValues:zS,addIssueTypeFieldValuesMany:qS,setIssueTypeFieldValues:jS,setIssueTypeFieldValuesMany:CS,updateIssueTypeFieldValues:DS,updateIssueTypeFieldValuesMany:$S,deleteIssueTypeFieldValues:US,deleteIssueTypeFieldValuesMany:LS}=Tn.actions,NS=t=>t.issueTypeFieldValuesReducer.instances,Qt=u.createSelector([NS],t=>Object.values(t)),Y_=A(u.createSelector([Qt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.issue===s)))),HS=t=>s=>s.issueTypeFieldValuesReducer.instances[t],GS=A(u.createSelector([Qt,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),KS=Tn.reducer,Be=R(t=>t.uuid),YS={instances:{}},On=u.createSlice({name:"issueTypeFields",initialState:YS,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,YS)),reducers:{initializeIssueTypeFields:Be.initialize,addIssueTypeFields:Be.addOne,addIssueTypeFieldsMany:Be.addMany,setIssueTypeFields:Be.setOne,setIssueTypeFieldsMany:Be.setMany,updateIssueTypeFields:Be.updateOne,updateIssueTypeFieldsMany:Be.updateMany,deleteIssueTypeFields:Be.deleteOne,deleteIssueTypeFieldsMany:Be.deleteMany}}),{initializeIssueTypeFields:ZS,addIssueTypeFields:JS,addIssueTypeFieldsMany:QS,setIssueTypeFields:XS,setIssueTypeFieldsMany:xS,updateIssueTypeFields:eA,updateIssueTypeFieldsMany:tA,deleteIssueTypeFields:sA,deleteIssueTypeFieldsMany:iA}=On.actions,nA=t=>t.issueTypeFieldsReducer.instances,_t=u.createSelector([nA],t=>Object.values(t)),Z_=A(u.createSelector([_t,(t,s)=>s],(t,s)=>w(t.filter(e=>e.issue_type===s)))),J_=A(u.createSelector([_t,(t,s)=>s],(t,s)=>t.filter(e=>e.issue_type===s).sort((e,n)=>e.submitted_at>n.submitted_at?-1:1)[0])),Q_=A(u.createSelector([_t,Qt,(t,s)=>s],(t,s,e)=>{const n=new Set(t.filter(a=>a.issue_type===e).map(a=>a.uuid));return w(s.filter(a=>n.has(a.fields_revision)))})),aA=t=>s=>s.issueTypeFieldsReducer.instances[t],cA=A(u.createSelector([_t,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),rA=On.reducer,ze=R(t=>t.uuid),dA={instances:{}},In=u.createSlice({name:"issueTypeFieldValuesAttachments",initialState:dA,extraReducers:t=>t.addMatcher(u.isAnyOf(b,q,M),s=>Object.assign(s,dA)),reducers:{initializeIssueTypeFieldValuesAttachments:ze.initialize,addIssueTypeFieldValuesAttachment:ze.addOne,addIssueTypeFieldValuesAttachments:ze.addMany,setIssueTypeFieldValuesAttachment:ze.setOne,setIssueTypeFieldValuesAttachments:ze.setMany,updateIssueTypeFieldValuesAttachment:ze.updateOne,updateIssueTypeFieldValuesAttachments:ze.updateMany,deleteIssueTypeFieldValuesAttachment:ze.deleteOne,deleteIssueTypeFieldValuesAttachments:ze.deleteMany}}),{initializeIssueTypeFieldValuesAttachments:lA,addIssueTypeFieldValuesAttachment:oA,addIssueTypeFieldValuesAttachments:Fn,setIssueTypeFieldValuesAttachment:uA,setIssueTypeFieldValuesAttachments:hA,updateIssueTypeFieldValuesAttachment:pA,updateIssueTypeFieldValuesAttachments:mA,deleteIssueTypeFieldValuesAttachment:fA,deleteIssueTypeFieldValuesAttachments:Pn}=In.actions,yA=t=>t.issueTypeFieldValuesAttachmentReducer.instances,gn=u.createSelector([yA],t=>Object.values(t)),SA=t=>s=>s.issueTypeFieldValuesAttachmentReducer.instances[t],AA=A(u.createSelector([gn,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),wA=A(u.createSelector([gn,(t,s)=>s],(t,s)=>w(t.filter(e=>e.field_values===s)))),TA=In.reducer,qe=R(t=>t.uuid),OA={instances:{}},bn=u.createSlice({name:"issueTypeIdentifiers",initialState:OA,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,OA)),reducers:{initializeIssueTypeIdentifiers:qe.initialize,addIssueTypeIdentifier:qe.addOne,addIssueTypeIdentifiers:qe.addMany,setIssueTypeIdentifier:qe.setOne,setIssueTypeIdentifiers:qe.setMany,updateIssueTypeIdentifier:qe.updateOne,updateIssueTypeIdentifiers:qe.updateMany,deleteIssueTypeIdentifier:qe.deleteOne,deleteIssueTypeIdentifiers:qe.deleteMany}}),{initializeIssueTypeIdentifiers:IA,addIssueTypeIdentifier:FA,addIssueTypeIdentifiers:PA,setIssueTypeIdentifier:gA,setIssueTypeIdentifiers:bA,updateIssueTypeIdentifier:_A,updateIssueTypeIdentifiers:RA,deleteIssueTypeIdentifier:MA,deleteIssueTypeIdentifiers:kA}=bn.actions,vA=t=>t.issueTypeIdentifierReducer.instances,_n=u.createSelector([vA],t=>Object.values(t)),EA=t=>s=>s.issueTypeIdentifierReducer.instances[t],VA=A(u.createSelector([_n,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),X_=A(u.createSelector([_n,(t,s)=>s],(t,s)=>w(t.filter(e=>e.issue_type===s)))),WA=bn.reducer,je=R(t=>t.uuid),BA={instances:{}},Rn=u.createSlice({name:"issueTypeIdentifierValues",initialState:BA,extraReducers:t=>t.addMatcher(u.isAnyOf(b,q,M),s=>Object.assign(s,BA)),reducers:{initializeIssueTypeIdentifierValues:je.initialize,addIssueTypeIdentifierValue:je.addOne,addIssueTypeIdentifierValues:je.addMany,setIssueTypeIdentifierValue:je.setOne,setIssueTypeIdentifierValues:je.setMany,updateIssueTypeIdentifierValue:je.updateOne,updateIssueTypeIdentifierValues:je.updateMany,deleteIssueTypeIdentifierValue:je.deleteOne,deleteIssueTypeIdentifierValues:je.deleteMany}}),{initializeIssueTypeIdentifierValues:zA,addIssueTypeIdentifierValue:qA,addIssueTypeIdentifierValues:jA,setIssueTypeIdentifierValue:CA,setIssueTypeIdentifierValues:DA,updateIssueTypeIdentifierValue:$A,updateIssueTypeIdentifierValues:UA,deleteIssueTypeIdentifierValue:LA,deleteIssueTypeIdentifierValues:NA}=Rn.actions,HA=t=>t.issueTypeIdentifierValueReducer.instances,Xt=u.createSelector([HA],t=>Object.values(t)),GA=t=>s=>s.issueTypeIdentifierValueReducer.instances[t],KA=A(u.createSelector([Xt,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),x_=A(u.createSelector([Xt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.issue===s)))),eR=A(u.createSelector([Xt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.issue_type_identifier===s)))),YA=Rn.reducer,Ce=R(t=>t.uuid),ZA={instances:{}},Mn=u.createSlice({name:"issueTypes",initialState:ZA,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,ZA)),reducers:{initializeIssueTypes:Ce.initialize,addIssueType:Ce.addOne,addIssueTypes:Ce.addMany,setIssueType:Ce.setOne,setIssueTypes:Ce.setMany,updateIssueType:Ce.updateOne,updateIssueTypes:Ce.updateMany,deleteIssueType:Ce.deleteOne,deleteIssueTypes:Ce.deleteMany}}),{initializeIssueTypes:JA,addIssueType:QA,addIssueTypes:XA,setIssueType:xA,setIssueTypes:ew,updateIssueType:tw,updateIssueTypes:sw,deleteIssueType:iw,deleteIssueTypes:nw}=Mn.actions,aw=t=>t.issueTypeReducer.instances,kn=u.createSelector(aw,t=>Object.values(t)),cw=t=>s=>s.issueTypeReducer.instances[t],rw=A(u.createSelector([kn,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),tR=A(u.createSelector([kn,(t,s)=>s],(t,s)=>w(t.filter(e=>e.organization===s)))),dw=Mn.reducer,De=R(t=>t.uuid),lw={instances:{}},vn=u.createSlice({name:"issueTypeStatuses",initialState:lw,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,lw)),reducers:{initializeIssueTypeStatuses:De.initialize,addIssueTypeStatus:De.addOne,addIssueTypeStatuses:De.addMany,setIssueTypeStatus:De.setOne,setIssueTypeStatuses:De.setMany,updateIssueTypeStatus:De.updateOne,updateIssueTypeStatuses:De.updateMany,deleteIssueTypeStatus:De.deleteOne,deleteIssueTypeStatuses:De.deleteMany}}),{initializeIssueTypeStatuses:ow,addIssueTypeStatus:uw,addIssueTypeStatuses:hw,setIssueTypeStatus:pw,setIssueTypeStatuses:mw,updateIssueTypeStatus:fw,updateIssueTypeStatuses:yw,deleteIssueTypeStatus:Sw,deleteIssueTypeStatuses:Aw}=vn.actions,ww=t=>t.issueTypeStatusReducer.instances,En=u.createSelector([ww],t=>w(Object.values(t).toSorted(Pc))),Vn=t=>s=>s.issueTypeStatusReducer.instances[t],Tw=A(u.createSelector([En,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),sR=A(u.createSelector([En,(t,s)=>s],(t,s)=>w(t.filter(e=>e.issue_type===s)))),Ow=vn.reducer,$e=R(t=>t.uuid),Iw={instances:{}},Wn=u.createSlice({name:"issueUpdates",initialState:Iw,extraReducers:t=>t.addMatcher(u.isAnyOf(b,q,M),s=>Object.assign(s,Iw)),reducers:{initializeIssueUpdates:$e.initialize,addIssueUpdate:$e.addOne,addIssueUpdates:$e.addMany,setIssueUpdate:$e.setOne,setIssueUpdates:$e.setMany,updateIssueUpdate:$e.updateOne,updateIssueUpdates:$e.updateMany,deleteIssueUpdate:$e.deleteOne,deleteIssueUpdates:$e.deleteMany}}),{initializeIssueUpdates:Fw,addIssueUpdate:Bn,addIssueUpdates:zn,setIssueUpdate:Pw,setIssueUpdates:gw,updateIssueUpdate:bw,updateIssueUpdates:_w,deleteIssueUpdate:qn,deleteIssueUpdates:jn}=Wn.actions,Cn=t=>t.issueUpdateReducer.instances,Dn=u.createSelector([Cn],t=>Object.values(t)),Rw=A(u.createSelector([Cn,(t,s)=>s],(t,s)=>t[s])),Mw=A(u.createSelector([Dn,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),kw=A(u.createSelector([Dn,(t,s)=>s],(t,s)=>w(t.filter(e=>e.issue===s)))),vw=Wn.reducer,Ue=R(t=>t.id),Ew={instances:{},currentUser:null},$n=u.createSlice({name:"users",initialState:Ew,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,Ew)),reducers:{initializeUsers:Ue.initialize,setUsers:Ue.setMany,setUser:Ue.setOne,addUsers:Ue.addMany,addUser:Ue.addOne,updateUsers:Ue.updateMany,updateUser:Ue.updateOne,deleteUser:Ue.deleteOne,deleteUsers:Ue.deleteMany,setCurrentUser:(t,s)=>{t.currentUser=s.payload},setProfilePicture:(t,s)=>{if(!t.currentUser)return;t.currentUser.profile.file=s.payload.file??null,t.currentUser.profile.file_sha1=s.payload.file_sha1??null;const e=t.instances[t.currentUser.id];if(!e)throw new Error("Unable to find current user in users slice");e.profile.file=s.payload.file??null,e.profile.file_sha1=s.payload.file_sha1??null}}}),{initializeUsers:Vw,setUsers:Ww,setUser:Bw,addUsers:zw,addUser:Un,updateUsers:qw,updateUser:jw,deleteUser:Ln,deleteUsers:Cw,setCurrentUser:iR,setProfilePicture:nR}=$n.actions,Dw=$n.reducer,$w=t=>t.userReducer.currentUser,Nn=t=>t.userReducer.instances,xt=u.createSelector([Nn],t=>Object.values(t)),es=t=>s=>s.userReducer.instances[t],Uw=A(u.createSelector([xt,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({id:n})=>e.has(n)))})),Le=R(t=>t.uuid),Lw={instances:{}},Hn=u.createSlice({name:"organizationAccess",initialState:Lw,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,Lw)),reducers:{initializeOrganizationAccesses:Le.initialize,addOrganizationAccess:Le.addOne,addOrganizationAccesses:Le.addMany,setOrganizationAccess:Le.setOne,setOrganizationAccesses:Le.setMany,updateOrganizationAccess:Le.updateOne,updateOrganizationAccesses:Le.updateMany,deleteOrganizationAccess:Le.deleteOne,deleteOrganizationAccesses:Le.deleteMany}}),{initializeOrganizationAccesses:Nw,addOrganizationAccess:Hw,addOrganizationAccesses:Gw,setOrganizationAccess:Kw,setOrganizationAccesses:Yw,updateOrganizationAccess:Zw,updateOrganizationAccesses:Jw,deleteOrganizationAccess:Qw,deleteOrganizationAccesses:Xw}=Hn.actions,xw=Hn.reducer,ts=t=>t.organizationAccessReducer.instances,eT=t=>s=>s.organizationAccessReducer.instances[t],tT=A(u.createSelector([ts,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(Object.values(t).filter(({uuid:n})=>e.has(n)))})),aR=u.createSelector([$w,ts],(t,s)=>Object.values(s).find(n=>n.user===(t==null?void 0:t.id))??null),sT=u.createSelector([ts],t=>{const s={};for(const e of Object.values(t))s[e.user]=e;return Vt(s)}),cR=A(u.createSelector([Nn,sT,(t,s)=>s],(t,s,e)=>w(Object.values(t).filter(n=>{const a=s[n.id];return!!a&&a.organization===e})))),Ne=R(t=>t.uuid),iT={instances:{}},Gn=u.createSlice({name:"organizations",initialState:iT,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,iT)),reducers:{initializeOrganizations:Ne.initialize,setOrganizations:Ne.setMany,setOrganization:Ne.setOne,addOrganizations:Ne.addMany,addOrganization:Ne.addOne,updateOrganizations:Ne.updateMany,updateOrganization:Ne.updateOne,deleteOrganization:Ne.deleteOne,deleteOrganizations:Ne.deleteMany}}),{initializeOrganizations:nT,setOrganizations:aT,setOrganization:cT,addOrganizations:rT,addOrganization:dT,updateOrganizations:lT,updateOrganization:oT,deleteOrganization:uT,deleteOrganizations:hT}=Gn.actions,pT=t=>t.organizationReducer.instances,mT=u.createSelector([pT],t=>Object.values(t)),fT=t=>s=>s.organizationReducer.instances[t],yT=A(u.createSelector([mT,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),ST=Gn.reducer,AT=(t,s,e)=>{const n=t.uuid?t:{...t,uuid:pt.v4()};return{payload:n,type:"",meta:{offline:{effect:{timestamp:new Date().toISOString(),request:n,BASE_URL:s,serviceName:e}}}}},wT={deletedRequests:[],latestRetryTime:0},Kn=u.createSlice({name:"outbox",initialState:wT,extraReducers:t=>t.addCase(b,s=>Object.assign(s,wT)),reducers:{enqueueRequest:{reducer:(t,s)=>t,prepare:t=>{console.debug("Preparing to enqueue request",t.url);const{BASE_URL:s,serviceName:e,...n}=t;return AT(n,s,e)}},markForDeletion(t,s){t.deletedRequests.push(s.payload)},markAsDeleted(t,s){const e=t.deletedRequests.indexOf(s.payload);e!==-1&&t.deletedRequests.splice(e,1)},_setLatestRetryTime:(t,s)=>{t.latestRetryTime=s.payload}}}),rR=t=>t.outboxReducer.deletedRequests,dR=t=>t.outboxReducer.latestRetryTime,{enqueueRequest:TT,markForDeletion:lR,markAsDeleted:OT,_setLatestRetryTime:IT}=Kn.actions,FT=Kn.reducer,He=R(t=>t.uuid),PT={instances:{}},Yn=u.createSlice({name:"projectAccess",initialState:PT,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,PT)),reducers:{initializeProjectAccesses:He.initialize,addProjectAccess:He.addOne,addProjectAccesses:He.addMany,setProjectAccess:He.setOne,setProjectAccesses:He.setMany,updateProjectAccess:He.updateOne,updateProjectAccesses:He.updateMany,deleteProjectAccess:He.deleteOne,deleteProjectAccesses:He.deleteMany}}),{initializeProjectAccesses:gT,addProjectAccess:bT,addProjectAccesses:_T,setProjectAccess:RT,setProjectAccesses:MT,updateProjectAccess:kT,updateProjectAccesses:vT,deleteProjectAccess:ET,deleteProjectAccesses:VT}=Yn.actions,WT=Yn.reducer,Zn=t=>t.projectAccessReducer.instances,Rt=u.createSelector(Zn,t=>Object.values(t)),BT=t=>s=>s.projectAccessReducer.instances[t],zT=A(u.createSelector([Rt,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),oR=A(u.createSelector([Zn,(t,s)=>s],(t,s)=>w(Object.values(t).filter(e=>e.project===s)))),uR=A(u.createSelector([Rt,(t,s)=>s],(t,s)=>{const e={};for(const n of t.filter(a=>a.project===s))e[n.user]=n;return e})),hR=A(u.createSelector([xt,Rt,(t,s)=>s],(t,s,e)=>{const n=new Set(s.filter(a=>a.project===e).map(a=>a.user));return w(t.filter(a=>n.has(a.id)))})),Ge=R(t=>t.uuid),qT={instances:{}},Jn=u.createSlice({name:"projectAttachments",initialState:qT,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,qT)),reducers:{initializeProjectAttachments:Ge.initialize,addProjectAttachment:Ge.addOne,addProjectAttachments:Ge.addMany,setProjectAttachment:Ge.setOne,setProjectAttachments:Ge.setMany,updateProjectAttachment:Ge.updateOne,updateProjectAttachments:Ge.updateMany,deleteProjectAttachment:Ge.deleteOne,deleteProjectAttachments:Ge.deleteMany}}),{initializeProjectAttachments:jT,addProjectAttachment:CT,addProjectAttachments:DT,setProjectAttachment:$T,setProjectAttachments:UT,updateProjectAttachment:LT,updateProjectAttachments:NT,deleteProjectAttachment:HT,deleteProjectAttachments:GT}=Jn.actions,KT=t=>t.projectAttachmentReducer.instances,Qn=u.createSelector([KT],t=>Object.values(t)),YT=t=>s=>s.projectAttachmentReducer.instances[t],ZT=A(u.createSelector([Qn,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),pR=A(u.createSelector([Qn,(t,s)=>s],(t,s)=>w(t.filter(({project:e})=>s===e)))),JT=Jn.reducer,Ke=R(t=>t.uuid),QT={instances:{},activeProjectFileId:null,isImportingProjectFile:!1},Xn=u.createSlice({name:"projectFiles",initialState:QT,extraReducers:t=>t.addMatcher(u.isAnyOf(b,q,M),s=>Object.assign(s,QT)),reducers:{initializeProjectFiles:Ke.initialize,setProjectFile:Ke.setOne,setProjectFiles:Ke.setMany,addProjectFile:Ke.addOne,addProjectFiles:Ke.addMany,updateProjectFile:Ke.updateOne,updateProjectFiles:Ke.updateMany,deleteProjectFile:Ke.deleteOne,deleteProjectFiles:Ke.deleteMany,setIsImportingProjectFile:(t,s)=>{t.isImportingProjectFile=s.payload},saveActiveProjectFileBounds:(t,s)=>{const e=t.activeProjectFileId;if(!e)throw new Error("Tried to save bounds for active project file, but no active project file was set.");if(!t.instances[e])throw new Error(`Tried to save bounds for active project file, but project file with ID ${e}
2
+ doesn't exist.`);t.instances[e].bounds=s.payload},setActiveProjectFileId:(t,s)=>{t.activeProjectFileId=s.payload}}}),{initializeProjectFiles:XT,setProjectFile:xT,setProjectFiles:eO,addProjectFile:tO,addProjectFiles:sO,updateProjectFile:iO,updateProjectFiles:nO,deleteProjectFile:aO,deleteProjectFiles:cO,setIsImportingProjectFile:rO,setActiveProjectFileId:dO,saveActiveProjectFileBounds:lO}=Xn.actions,oO=t=>t.projectFileReducer.instances,uO=u.createSelector([oO],t=>w(Object.values(t).sort((s,e)=>s.z_index-e.z_index))),hO=t=>s=>s.projectFileReducer.instances[t],pO=A(u.createSelector([uO,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),mR=t=>t.projectFileReducer.activeProjectFileId,fR=t=>t.projectFileReducer.isImportingProjectFile,mO=Xn.reducer,Ye=R(t=>t.uuid),fO={instances:{}},xn=u.createSlice({name:"projects",initialState:fO,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,fO)),reducers:{initializeProjects:Ye.initialize,setProjects:Ye.setMany,setProject:Ye.setOne,addProjects:Ye.addMany,addProject:Ye.addOne,updateProjects:Ye.updateMany,updateProject:Ye.updateOne,deleteProject:Ye.deleteOne,deleteProjects:Ye.deleteMany}}),{initializeProjects:yO,setProjects:SO,setProject:AO,addProjects:wO,addProject:TO,updateProjects:OO,updateProject:IO,deleteProject:FO,deleteProjects:PO}=xn.actions,gO=xn.reducer,bO=t=>t.projectReducer.instances,ss=u.createSelector([bO],t=>Object.values(t)),_O=t=>s=>s.projectReducer.instances[t],RO=A(u.createSelector([ss,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),yR=A(u.createSelector([ss,Rt,(t,s)=>s],(t,s,e)=>{const n=new Set(s.filter(a=>a.user===e).map(a=>a.project));return w(t.filter(a=>n.has(a.uuid)))})),SR=A(u.createSelector([ss,(t,s)=>s],(t,s)=>w(t.filter(e=>e.organization===s)))),AR={isRehydrated:!1},ea=u.createSlice({name:"rehydrated",initialState:AR,reducers:{setRehydrated:(t,s)=>{t.isRehydrated=s.payload}}}),{setRehydrated:wR}=ea.actions,TR=t=>t.rehydratedReducer.isRehydrated,MO=ea.reducer,Ze=R(t=>t.uuid),kO={instances:{}},ta=u.createSlice({name:"teamMemberships",initialState:kO,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,kO)),reducers:{initializeTeamMemberships:Ze.initialize,addTeamMembership:Ze.addOne,addTeamMemberships:Ze.addMany,setTeamMembership:Ze.setOne,setTeamMemberships:Ze.setMany,updateTeamMembership:Ze.updateOne,updateTeamMemberships:Ze.updateMany,deleteTeamMembership:Ze.deleteOne,deleteTeamMemberships:Ze.deleteMany}}),{initializeTeamMemberships:vO,addTeamMembership:EO,addTeamMemberships:VO,setTeamMembership:WO,setTeamMemberships:BO,updateTeamMembership:zO,updateTeamMemberships:qO,deleteTeamMembership:jO,deleteTeamMemberships:CO}=ta.actions,DO=ta.reducer,$O=t=>t.teamMembershipReducer.instances,is=u.createSelector([$O],t=>Object.values(t)),UO=t=>s=>s.teamMembershipReducer.instances[t],LO=A(u.createSelector([is,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),OR=A(u.createSelector([is,(t,s)=>s],(t,s)=>{const e={};for(const n of t.filter(a=>a.team===s))e[n.user]=n;return e})),IR=A(u.createSelector([xt,is,(t,s)=>s],(t,s,e)=>{const n=new Set(s.filter(a=>a.team===e).map(a=>a.user));return w(t.filter(a=>n.has(a.id)))})),Je=R(t=>t.uuid),NO={instances:{}},sa=u.createSlice({name:"teams",initialState:NO,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,NO)),reducers:{initializeTeams:Je.initialize,addTeam:Je.addOne,addTeams:Je.addMany,setTeam:Je.setOne,setTeams:Je.setMany,updateTeam:Je.updateOne,updateTeams:Je.updateMany,deleteTeam:Je.deleteOne,deleteTeams:Je.deleteMany}}),{initializeTeams:HO,addTeam:GO,addTeams:KO,setTeam:YO,setTeams:ZO,updateTeam:JO,updateTeams:QO,deleteTeam:XO,deleteTeams:xO}=sa.actions,eI=t=>t.teamReducer.instances,ia=u.createSelector([eI],t=>Object.values(t)),tI=t=>s=>s.teamReducer.instances[t],sI=A(u.createSelector([ia,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),FR=A(u.createSelector([ia,(t,s)=>s],(t,s)=>w(t.filter(e=>e.organization===s)))),iI=sa.reducer,Qe=R(t=>t.uuid),nI={instances:{}},na=u.createSlice({name:"workflows",initialState:nI,extraReducers:t=>t.addMatcher(u.isAnyOf(b,q,M),s=>Object.assign(s,nI)),reducers:{initializeWorkflows:Qe.initialize,addWorkflow:Qe.addOne,addWorkflows:Qe.addMany,setWorkflow:Qe.setOne,setWorkflows:Qe.setMany,updateWorkflow:Qe.updateOne,updateWorkflows:Qe.updateMany,deleteWorkflow:Qe.deleteOne,deleteWorkflows:Qe.deleteMany}}),{initializeWorkflows:aI,addWorkflow:cI,addWorkflows:aa,setWorkflow:rI,setWorkflows:dI,updateWorkflow:lI,updateWorkflows:oI,deleteWorkflow:uI,deleteWorkflows:ca}=na.actions,hI=t=>t.workflowReducer.instances,ns=u.createSelector([hI],t=>Object.values(t)),pI=t=>s=>s.workflowReducer.instances[t],mI=A(u.createSelector([ns,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),PR=A(u.createSelector([ns,(t,s)=>s],(t,s)=>w(t.filter(e=>e.project===s)))),fI=A(u.createSelector([ns,(t,s)=>s],(t,s)=>w(t.filter(e=>e.workflow_type===s)))),yI=na.reducer,Xe=R(t=>t.uuid),SI={instances:{}},ra=u.createSlice({name:"workflowStepAssignees",initialState:SI,extraReducers:t=>t.addMatcher(u.isAnyOf(b,q,M),s=>Object.assign(s,SI)),reducers:{initializeWorkflowStepAssignees:Xe.initialize,addWorkflowStepAssignee:Xe.addOne,addWorkflowStepAssignees:Xe.addMany,setWorkflowStepAssignee:Xe.setOne,setWorkflowStepAssignees:Xe.setMany,updateWorkflowStepAssignee:Xe.updateOne,updateWorkflowStepAssignees:Xe.updateMany,deleteWorkflowStepAssignee:Xe.deleteOne,deleteWorkflowStepAssignees:Xe.deleteMany}}),{initializeWorkflowStepAssignees:AI,addWorkflowStepAssignee:wI,addWorkflowStepAssignees:da,setWorkflowStepAssignee:TI,setWorkflowStepAssignees:OI,updateWorkflowStepAssignee:II,updateWorkflowStepAssignees:FI,deleteWorkflowStepAssignee:PI,deleteWorkflowStepAssignees:la}=ra.actions,gI=t=>t.workflowStepAssigneeReducer.instances,Mt=u.createSelector([gI],t=>Object.values(t)),bI=t=>s=>s.workflowStepAssigneeReducer.instances[t],_I=A(u.createSelector([Mt,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),RI=A(u.createSelector([Mt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.workflow===s)))),gR=A(u.createSelector([Mt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.workflow_step===s)))),bR=A(u.createSelector([Mt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.user===s)))),MI=ra.reducer,xe=R(t=>t.uuid),kI={instances:{}},oa=u.createSlice({name:"workflowStepCommentAttachments",initialState:kI,extraReducers:t=>t.addMatcher(u.isAnyOf(b,q,M),s=>Object.assign(s,kI)),reducers:{initializeWorkflowStepCommentAttachments:xe.initialize,addWorkflowStepCommentAttachment:xe.addOne,addWorkflowStepCommentAttachments:xe.addMany,setWorkflowStepCommentAttachment:xe.setOne,setWorkflowStepCommentAttachments:xe.setMany,updateWorkflowStepCommentAttachment:xe.updateOne,updateWorkflowStepCommentAttachments:xe.updateMany,deleteWorkflowStepCommentAttachment:xe.deleteOne,deleteWorkflowStepCommentAttachments:xe.deleteMany}}),{initializeWorkflowStepCommentAttachments:vI,addWorkflowStepCommentAttachment:EI,addWorkflowStepCommentAttachments:as,setWorkflowStepCommentAttachment:VI,setWorkflowStepCommentAttachments:WI,updateWorkflowStepCommentAttachment:BI,updateWorkflowStepCommentAttachments:zI,deleteWorkflowStepCommentAttachment:qI,deleteWorkflowStepCommentAttachments:cs}=oa.actions,jI=t=>t.workflowStepCommentAttachmentReducer.instances,ua=u.createSelector([jI],t=>Object.values(t)),CI=t=>s=>s.workflowStepCommentAttachmentReducer.instances[t],DI=A(u.createSelector([ua,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),ha=A(u.createSelector([ua,(t,s)=>s],(t,s)=>w(t.filter(e=>e.workflow_step_comment===s)))),$I=oa.reducer,et=R(t=>t.uuid),UI={instances:{}},pa=u.createSlice({name:"workflowStepComments",initialState:UI,extraReducers:t=>t.addMatcher(u.isAnyOf(b,q,M),s=>Object.assign(s,UI)),reducers:{initializeWorkflowStepComments:et.initialize,addWorkflowStepComment:et.addOne,addWorkflowStepComments:et.addMany,setWorkflowStepComment:et.setOne,setWorkflowStepComments:et.setMany,updateWorkflowStepComment:et.updateOne,updateWorkflowStepComments:et.updateMany,deleteWorkflowStepComment:et.deleteOne,deleteWorkflowStepComments:et.deleteMany}}),{initializeWorkflowStepComments:LI,addWorkflowStepComment:NI,addWorkflowStepComments:ma,setWorkflowStepComment:HI,setWorkflowStepComments:GI,updateWorkflowStepComment:KI,updateWorkflowStepComments:YI,deleteWorkflowStepComment:ZI,deleteWorkflowStepComments:fa}=pa.actions,JI=t=>t.workflowStepCommentReducer.instances,rs=u.createSelector([JI],t=>Object.values(t)),QI=t=>s=>s.workflowStepCommentReducer.instances[t],XI=A(u.createSelector([rs,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),xI=A(u.createSelector([rs,(t,s)=>s],(t,s)=>w(t.filter(e=>e.workflow===s)))),_R=A(u.createSelector([rs,(t,s)=>s],(t,s)=>w(t.filter(e=>e.workflow_step===s)))),eF=pa.reducer,tt=R(t=>t.uuid),tF={instances:{}},ya=u.createSlice({name:"workflowStepCompletions",initialState:tF,extraReducers:t=>t.addMatcher(u.isAnyOf(b,q,M),s=>Object.assign(s,tF)),reducers:{initializeWorkflowStepCompletions:tt.initialize,addWorkflowStepCompletion:tt.addOne,addWorkflowStepCompletions:tt.addMany,setWorkflowStepCompletion:tt.setOne,setWorkflowStepCompletions:tt.setMany,updateWorkflowStepCompletion:tt.updateOne,updateWorkflowStepCompletions:tt.updateMany,deleteWorkflowStepCompletion:tt.deleteOne,deleteWorkflowStepCompletions:tt.deleteMany}}),{initializeWorkflowStepCompletions:sF,addWorkflowStepCompletion:iF,addWorkflowStepCompletions:Sa,setWorkflowStepCompletion:nF,setWorkflowStepCompletions:aF,updateWorkflowStepCompletion:cF,updateWorkflowStepCompletions:rF,deleteWorkflowStepCompletion:dF,deleteWorkflowStepCompletions:Aa}=ya.actions,lF=t=>t.workflowStepCompletionReducer.instances,ds=u.createSelector([lF],t=>Object.values(t)),oF=t=>s=>s.workflowStepCompletionReducer.instances[t],uF=A(u.createSelector([ds,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),hF=A(u.createSelector([ds,(t,s)=>s],(t,s)=>w(t.filter(e=>e.workflow===s)))),RR=A(u.createSelector([ds,(t,s)=>s],(t,s)=>w(t.filter(e=>e.workflow_step===s)))),pF=ya.reducer,st=R(t=>t.uuid),mF={instances:{}},wa=u.createSlice({name:"workflowStepEvents",initialState:mF,extraReducers:t=>t.addMatcher(u.isAnyOf(b,q,M),s=>Object.assign(s,mF)),reducers:{initializeWorkflowStepEvents:st.initialize,addWorkflowStepEvent:st.addOne,addWorkflowStepEvents:st.addMany,setWorkflowStepEvent:st.setOne,setWorkflowStepEvents:st.setMany,updateWorkflowStepEvent:st.updateOne,updateWorkflowStepEvents:st.updateMany,deleteWorkflowStepEvent:st.deleteOne,deleteWorkflowStepEvents:st.deleteMany}}),{initializeWorkflowStepEvents:fF,addWorkflowStepEvent:yF,addWorkflowStepEvents:Ta,setWorkflowStepEvent:SF,setWorkflowStepEvents:AF,updateWorkflowStepEvent:wF,updateWorkflowStepEvents:TF,deleteWorkflowStepEvent:OF,deleteWorkflowStepEvents:Oa}=wa.actions,Ia=t=>t.workflowStepEventReducer.instances,ls=u.createSelector([Ia],t=>Object.values(t)),IF=A(u.createSelector([Ia,(t,s)=>s],(t,s)=>t[s])),FF=A(u.createSelector([ls,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),PF=A(u.createSelector([ls,(t,s)=>s],(t,s)=>w(t.filter(e=>e.workflow===s)))),MR=A(u.createSelector([ls,(t,s)=>s],(t,s)=>w(t.filter(e=>e.workflow_step===s)))),gF=wa.reducer,it=R(t=>t.uuid),bF={instances:{}},Fa=u.createSlice({name:"workflowStepFieldValuesAttachments",initialState:bF,extraReducers:t=>t.addMatcher(u.isAnyOf(b,q,M),s=>Object.assign(s,bF)),reducers:{initializeWorkflowStepFieldValuesAttachments:it.initialize,addWorkflowStepFieldValuesAttachment:it.addOne,addWorkflowStepFieldValuesAttachments:it.addMany,setWorkflowStepFieldValuesAttachment:it.setOne,setWorkflowStepFieldValuesAttachments:it.setMany,updateWorkflowStepFieldValuesAttachment:it.updateOne,updateWorkflowStepFieldValuesAttachments:it.updateMany,deleteWorkflowStepFieldValuesAttachment:it.deleteOne,deleteWorkflowStepFieldValuesAttachments:it.deleteMany}}),{initializeWorkflowStepFieldValuesAttachments:_F,addWorkflowStepFieldValuesAttachment:RF,addWorkflowStepFieldValuesAttachments:Pa,setWorkflowStepFieldValuesAttachment:MF,setWorkflowStepFieldValuesAttachments:kF,updateWorkflowStepFieldValuesAttachment:vF,updateWorkflowStepFieldValuesAttachments:EF,deleteWorkflowStepFieldValuesAttachment:VF,deleteWorkflowStepFieldValuesAttachments:ga}=Fa.actions,WF=t=>t.workflowStepFieldValuesAttachmentReducer.instances,ba=u.createSelector([WF],t=>Object.values(t)),BF=t=>s=>s.workflowStepFieldValuesAttachmentReducer.instances[t],zF=A(u.createSelector([ba,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),qF=A(u.createSelector([ba,(t,s)=>s],(t,s)=>w(t.filter(e=>e.field_values===s)))),jF=Fa.reducer,nt=R(t=>t.uuid),CF={instances:{}},_a=u.createSlice({name:"workflowStepFieldValues",initialState:CF,extraReducers:t=>t.addMatcher(u.isAnyOf(b,q,M),s=>Object.assign(s,CF)),reducers:{initializeWorkflowStepFieldValues:nt.initialize,addWorkflowStepFieldValues:nt.addOne,addWorkflowStepFieldValuesMany:nt.addMany,setWorkflowStepFieldValues:nt.setOne,setWorkflowStepFieldValuesMany:nt.setMany,updateWorkflowStepFieldValues:nt.updateOne,updateWorkflowStepFieldValuesMany:nt.updateMany,deleteWorkflowStepFieldValues:nt.deleteOne,deleteWorkflowStepFieldValuesMany:nt.deleteMany}}),{initializeWorkflowStepFieldValues:DF,addWorkflowStepFieldValues:$F,addWorkflowStepFieldValuesMany:Ra,setWorkflowStepFieldValues:UF,setWorkflowStepFieldValuesMany:LF,updateWorkflowStepFieldValues:NF,updateWorkflowStepFieldValuesMany:HF,deleteWorkflowStepFieldValues:GF,deleteWorkflowStepFieldValuesMany:Ma}=_a.actions,KF=t=>t.workflowStepFieldValuesReducer.instances,kt=u.createSelector([KF],t=>Object.values(t)),YF=A(u.createSelector([kt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.workflow===s)))),kR=A(u.createSelector([kt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.workflow_step===s)))),vR=A(u.createSelector([kt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.fields_revision===s)))),ZF=t=>s=>s.workflowStepFieldValuesReducer.instances[t],JF=A(u.createSelector([kt,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),QF=_a.reducer,at=R(t=>t.uuid),XF={instances:{}},ka=u.createSlice({name:"workflowStepFieldsAttachments",initialState:XF,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,XF)),reducers:{initializeWorkflowStepFieldsAttachments:at.initialize,addWorkflowStepFieldsAttachment:at.addOne,addWorkflowStepFieldsAttachments:at.addMany,setWorkflowStepFieldsAttachment:at.setOne,setWorkflowStepFieldsAttachments:at.setMany,updateWorkflowStepFieldsAttachment:at.updateOne,updateWorkflowStepFieldsAttachments:at.updateMany,deleteWorkflowStepFieldsAttachment:at.deleteOne,deleteWorkflowStepFieldsAttachments:at.deleteMany}}),{initializeWorkflowStepFieldsAttachments:xF,addWorkflowStepFieldsAttachment:eP,addWorkflowStepFieldsAttachments:va,setWorkflowStepFieldsAttachment:tP,setWorkflowStepFieldsAttachments:sP,updateWorkflowStepFieldsAttachment:iP,updateWorkflowStepFieldsAttachments:nP,deleteWorkflowStepFieldsAttachment:aP,deleteWorkflowStepFieldsAttachments:Ea}=ka.actions,cP=t=>t.workflowStepFieldsAttachmentReducer.instances,Va=u.createSelector([cP],t=>Object.values(t)),rP=A(u.createSelector([Va,(t,s)=>s],(t,s)=>w(t.filter(e=>e.fields_revision===s)))),dP=t=>s=>s.workflowStepFieldsAttachmentReducer.instances[t],lP=A(u.createSelector([Va,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),oP=ka.reducer,ct=R(t=>t.uuid),uP={instances:{}},Wa=u.createSlice({name:"workflowStepFields",initialState:uP,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,uP)),reducers:{initializeWorkflowStepFields:ct.initialize,addWorkflowStepFields:ct.addOne,addWorkflowStepFieldsMany:ct.addMany,setWorkflowStepFields:ct.setOne,setWorkflowStepFieldsMany:ct.setMany,updateWorkflowStepFields:ct.updateOne,updateWorkflowStepFieldsMany:ct.updateMany,deleteWorkflowStepFields:ct.deleteOne,deleteWorkflowStepFieldsMany:ct.deleteMany}}),{initializeWorkflowStepFields:hP,addWorkflowStepFields:pP,addWorkflowStepFieldsMany:mP,setWorkflowStepFields:fP,setWorkflowStepFieldsMany:yP,updateWorkflowStepFields:SP,updateWorkflowStepFieldsMany:AP,deleteWorkflowStepFields:wP,deleteWorkflowStepFieldsMany:TP}=Wa.actions,Ba=t=>t.workflowStepFieldsReducer.instances,os=u.createSelector([Ba],t=>Object.values(t)),ER=A(u.createSelector([os,(t,s)=>s],(t,s)=>w(t.filter(e=>e.workflow_step===s)))),VR=A(u.createSelector([os,(t,s)=>s],(t,s)=>t.filter(e=>e.workflow_step===s).sort((e,n)=>e.submitted_at>n.submitted_at?-1:1)[0])),WR=u.createSelector([Ba],t=>{const s={};for(const e of Object.values(t)){const n=s[e.workflow_step];(!n||n.submitted_at<e.submitted_at)&&(s[e.workflow_step]=e)}return s}),OP=t=>s=>s.workflowStepFieldsReducer.instances[t],IP=A(u.createSelector([os,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),FP=Wa.reducer,rt=R(t=>t.uuid),PP={instances:{}},za=u.createSlice({name:"workflowStepReviewers",initialState:PP,extraReducers:t=>t.addMatcher(u.isAnyOf(b,q,M),s=>Object.assign(s,PP)),reducers:{initializeWorkflowStepReviewers:rt.initialize,addWorkflowStepReviewer:rt.addOne,addWorkflowStepReviewers:rt.addMany,setWorkflowStepReviewer:rt.setOne,setWorkflowStepReviewers:rt.setMany,updateWorkflowStepReviewer:rt.updateOne,updateWorkflowStepReviewers:rt.updateMany,deleteWorkflowStepReviewer:rt.deleteOne,deleteWorkflowStepReviewers:rt.deleteMany}}),{initializeWorkflowStepReviewers:gP,addWorkflowStepReviewer:bP,addWorkflowStepReviewers:qa,setWorkflowStepReviewer:_P,setWorkflowStepReviewers:RP,updateWorkflowStepReviewer:MP,updateWorkflowStepReviewers:kP,deleteWorkflowStepReviewer:vP,deleteWorkflowStepReviewers:ja}=za.actions,EP=t=>t.workflowStepReviewerReducer.instances,vt=u.createSelector([EP],t=>Object.values(t)),VP=t=>s=>s.workflowStepReviewerReducer.instances[t],WP=A(u.createSelector([vt,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),BP=A(u.createSelector([vt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.workflow===s)))),BR=A(u.createSelector([vt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.workflow_step===s)))),zR=A(u.createSelector([vt,(t,s)=>s],(t,s)=>w(t.filter(e=>e.user===s)))),zP=za.reducer,dt=R(t=>t.uuid),qP={instances:{}},Ca=u.createSlice({name:"workflowStepReviewRequests",initialState:qP,extraReducers:t=>t.addMatcher(u.isAnyOf(b,q,M),s=>Object.assign(s,qP)),reducers:{initializeWorkflowStepReviewRequests:dt.initialize,addWorkflowStepReviewRequest:dt.addOne,addWorkflowStepReviewRequests:dt.addMany,setWorkflowStepReviewRequest:dt.setOne,setWorkflowStepReviewRequests:dt.setMany,updateWorkflowStepReviewRequest:dt.updateOne,updateWorkflowStepReviewRequests:dt.updateMany,deleteWorkflowStepReviewRequest:dt.deleteOne,deleteWorkflowStepReviewRequests:dt.deleteMany}}),{initializeWorkflowStepReviewRequests:jP,addWorkflowStepReviewRequest:CP,addWorkflowStepReviewRequests:Da,setWorkflowStepReviewRequest:DP,setWorkflowStepReviewRequests:$P,updateWorkflowStepReviewRequest:UP,updateWorkflowStepReviewRequests:LP,deleteWorkflowStepReviewRequest:NP,deleteWorkflowStepReviewRequests:$a}=Ca.actions,HP=t=>t.workflowStepReviewRequestReducer.instances,us=u.createSelector([HP],t=>Object.values(t)),GP=t=>s=>s.workflowStepReviewRequestReducer.instances[t],KP=A(u.createSelector([us,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),YP=A(u.createSelector([us,(t,s)=>s],(t,s)=>w(t.filter(e=>e.workflow===s)))),qR=A(u.createSelector([us,(t,s)=>s],(t,s)=>w(t.filter(e=>e.workflow_step===s)))),ZP=Ca.reducer,lt=R(t=>t.uuid),JP={instances:{}},Ua=u.createSlice({name:"workflowStepReviews",initialState:JP,extraReducers:t=>t.addMatcher(u.isAnyOf(b,q,M),s=>Object.assign(s,JP)),reducers:{initializeWorkflowStepReviews:lt.initialize,addWorkflowStepReview:lt.addOne,addWorkflowStepReviews:lt.addMany,setWorkflowStepReview:lt.setOne,setWorkflowStepReviews:lt.setMany,updateWorkflowStepReview:lt.updateOne,updateWorkflowStepReviews:lt.updateMany,deleteWorkflowStepReview:lt.deleteOne,deleteWorkflowStepReviews:lt.deleteMany}}),{initializeWorkflowStepReviews:QP,addWorkflowStepReview:XP,addWorkflowStepReviews:La,setWorkflowStepReview:xP,setWorkflowStepReviews:eg,updateWorkflowStepReview:tg,updateWorkflowStepReviews:sg,deleteWorkflowStepReview:ig,deleteWorkflowStepReviews:Na}=Ua.actions,ng=t=>t.workflowStepReviewReducer.instances,hs=u.createSelector([ng],t=>Object.values(t)),ag=t=>s=>s.workflowStepReviewReducer.instances[t],cg=A(u.createSelector([hs,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),rg=A(u.createSelector([hs,(t,s)=>s],(t,s)=>w(t.filter(e=>e.workflow===s)))),jR=A(u.createSelector([hs,(t,s)=>s],(t,s)=>w(t.filter(e=>e.workflow_step===s)))),dg=Ua.reducer,ot=R(t=>t.uuid),lg={instances:{}},Ha=u.createSlice({name:"workflowSteps",initialState:lg,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,lg)),reducers:{initializeWorkflowSteps:ot.initialize,addWorkflowStep:ot.addOne,addWorkflowSteps:ot.addMany,setWorkflowStep:ot.setOne,setWorkflowSteps:ot.setMany,updateWorkflowStep:ot.updateOne,updateWorkflowSteps:ot.updateMany,deleteWorkflowStep:ot.deleteOne,deleteWorkflowSteps:ot.deleteMany}}),{initializeWorkflowSteps:og,addWorkflowStep:ug,addWorkflowSteps:Ga,setWorkflowStep:hg,setWorkflowSteps:pg,updateWorkflowStep:mg,updateWorkflowSteps:fg,deleteWorkflowStep:yg,deleteWorkflowSteps:Ka}=Ha.actions,Sg=Ha.reducer,Ag=t=>t.workflowStepReducer.instances,Ya=u.createSelector([Ag],t=>Object.values(t)),wg=t=>s=>s.workflowStepReducer.instances[t],Tg=A(u.createSelector([Ya,(t,s)=>s],(t,s)=>w(t.filter(e=>e.workflow_type===s)))),Og=A(u.createSelector([Ya,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),ut=R(t=>t.uuid),Ig={instances:{}},Za=u.createSlice({name:"workflowTypes",initialState:Ig,extraReducers:t=>t.addMatcher(u.isAnyOf(b,M),s=>Object.assign(s,Ig)),reducers:{initializeWorkflowTypes:ut.initialize,addWorkflowType:ut.addOne,addWorkflowTypes:ut.addMany,setWorkflowType:ut.setOne,setWorkflowTypes:ut.setMany,updateWorkflowType:ut.updateOne,updateWorkflowTypes:ut.updateMany,deleteWorkflowType:ut.deleteOne,deleteWorkflowTypes:ut.deleteMany}}),{initializeWorkflowTypes:Fg,addWorkflowType:Pg,addWorkflowTypes:gg,setWorkflowType:bg,setWorkflowTypes:_g,updateWorkflowType:Rg,updateWorkflowTypes:Mg,deleteWorkflowType:kg,deleteWorkflowTypes:vg}=Za.actions,Eg=t=>t.workflowTypeReducer.instances,Ja=u.createSelector([Eg],t=>Object.values(t)),Vg=t=>s=>s.workflowTypeReducer.instances[t],Wg=A(u.createSelector([Ja,(t,s)=>s],(t,s)=>{const e=new Set(s);return w(t.filter(({uuid:n})=>e.has(n)))})),CR=A(u.createSelector([Ja,(t,s)=>s],(t,s)=>w(t.filter(e=>e.organization===s)))),Bg=Za.reducer,DR={version:0},zg=u.createSlice({name:"versioning",initialState:DR,reducers:{}}),qg=zg.reducer,Qa={outboxReducer:FT,fileReducer:Kp,authReducer:ep},$R=u.combineReducers(Qa),jg={...Qa,[Ft]:qg,assetReducer:co,assetAttachmentReducer:Hc,assetStageCompletionReducer:Ao,assetStageReducer:Vo,assetTypeReducer:qh,assetTypeAttachmentReducer:Yo,issueReducer:aS,issueAttachmentReducer:wy,issueTypeReducer:dw,issueTypeAttachmentReducer:wS,organizationReducer:ST,projectReducer:gO,projectAttachmentReducer:JT,projectAccessReducer:WT,organizationAccessReducer:xw,projectFileReducer:mO,rehydratedReducer:MO,formReducer:sf,formRevisionReducer:Hm,formRevisionAttachmentReducer:Bm,formSubmissionAttachmentReducer:Af,formSubmissionReducer:vf,formIdentifierReducer:rm,formIdentifierValueReducer:Om,userReducer:Dw,emailDomainsReducer:Up,documentsReducer:gp,documentAttachmentReducer:mp,teamReducer:iI,agentsReducer:Ec,issueCommentReducer:Gy,issueCommentAttachmentReducer:Vy,issueUpdateReducer:vw,geoImageReducer:Hf,issueAssociationReducer:cy,issueTypeFieldsReducer:rA,issueTypeFieldValuesReducer:KS,issueTypeFieldsAttachmentReducer:VS,issueTypeFieldValuesAttachmentReducer:TA,issueTypeIdentifierReducer:WA,issueTypeIdentifierValueReducer:YA,issueTypeStatusReducer:Ow,assetTypeFieldsReducer:Iu,assetTypeFieldValuesReducer:Zu,assetTypeFieldsAttachmentReducer:du,assetTypeFieldValuesAttachmentReducer:Bu,assetTypeIdentifierReducer:lh,assetTypeIdentifierValueReducer:Fh,assetTypeStatusReducer:Qh,assetProcedureTypeReducer:kd,assetProcedureReducer:fd,assetProcedureTypeFieldsReducer:kr,assetProcedureTypeFieldValuesReducer:id,assetProcedureTypeFieldsAttachmentReducer:yr,assetProcedureTypeFieldValuesAttachmentReducer:Ur,assetProcedureTypeAttachmentReducer:sr,assetProcedureStepFieldsAttachmentReducer:Kd,assetProcedureStepFieldsReducer:cl,assetProcedureStepFieldValuesAttachmentReducer:wl,assetProcedureStepFieldValuesReducer:Vl,assetProcedureStepReducer:Nl,teamMembershipReducer:DO,workflowTypeReducer:Bg,workflowStepReducer:Sg,workflowReducer:yI,workflowStepFieldsReducer:FP,workflowStepFieldsAttachmentReducer:oP,workflowStepFieldValuesReducer:QF,workflowStepFieldValuesAttachmentReducer:jF,workflowStepAssigneeReducer:MI,workflowStepReviewRequestReducer:ZP,workflowStepReviewReducer:dg,workflowStepCompletionReducer:pF,workflowStepCommentReducer:eF,workflowStepCommentAttachmentReducer:$I,workflowStepReviewerReducer:zP,workflowStepEventReducer:gF},UR=u.combineReducers(jg),Cg=1e4,Dg=200,Xa=[400,409,403,404,405,500],U=1e4,$g={};class Ug{constructor(s){m(this,"client");m(this,"pageSize",Cg);$g[this.constructor.name]=this,this.client=s}async performRequest(s,e){return this.client.performRequest(this.host,s,this,e)}async enqueueRequest(s){return this.client.enqueueRequest(s,this.host,this.constructor.name)}async performPagination(s,e){return this.client.performPagination(this.host,s,this.pageSize,this,e)}dispatch(s){this.client.store.dispatch(s)}}const Lg=()=>Gg.length-1,Ng=t=>(t[Ft]={version:Lg()},t),Hg=()=>Ng({}),LR=t=>(t.outboxReducer&&(t.outboxReducer.deletedRequests=[]),t),NR=t=>s=>{var e;return s===void 0&&(s={}),((e=s[Ft])==null?void 0:e.version)===Lg()?s:t(s)},Gg=[Ng,Hg,Hg,LR],HR=Object.fromEntries(Gg.map((t,s)=>[s,NR(t)])),GR=t=>{if(t)throw t;const s=It();s?s.dispatch({type:"rehydrated/setRehydrated",payload:!0}):console.error("Client store not set")},Kg=(t,s,e)=>{const n=yt();return n?(n.addRequest(s),n.getQueue()):(console.warn("Outbox coordinator not set; cannot enqueue request yet."),[])},Yg=(t,s,e)=>{const n=yt();if(!n)return console.warn("Outbox coordinator not set; cannot dequeue request yet."),[];const r=s.meta.offlineAction.payload.uuid;return n.remove(r),n.getQueue()};async function KR(t,s){if(!s.payload)throw new Error("Received empty payload");return rb(s)}const YR={...cc,effect:KR,discard:Jg,returnPromises:!0,persistCallback:GR,retry:XR,persistOptions:{storage:mb},queue:{...cc.queue,enqueue:Kg,dequeue:Yg,peek:(...t)=>QR(...t)}},ZR=fb(HR,Ft),JR=u.compose(pb.offline(YR),ZR);async function Zg(t,s,e){if(s.store.getState().outboxReducer.deletedRequests.includes(t.payload.uuid))throw new Error("Request was marked for deletion");const a=$g[t.meta.offline.effect.serviceName];if(!a)throw new Error(`Service ${t.meta.offline.effect.serviceName} not found`);return sc(t.meta.offline.effect.BASE_URL,t.meta.offline.effect.request,s,a,e)}function Jg(t,s,e=0){var c;if(console.debug("Considering discarding request due to error:",t,`(${typeof t})`,`
3
3
  Url:`,s.payload.url,`
4
- Retries:`,e),!(t instanceof Error))throw console.error("ENCOUNTERED NON-ERROR ERROR:",t,"(throwing immediately, which may lead to unexpected behavior)"),t;const n=It(),c=n.getState().outboxReducer.deletedRequests,d=s.payload.uuid;function o(){n.dispatch(qT(d));const h=ft();if(!h)throw new Error("Outbox coordinator not set");h.remove(s.payload.uuid);const y=s.meta.offline.rollback;throw y&&(console.warn("Rolling back request due to SDK error:",s),n.dispatch(y)),t}if(t instanceof D&&t.options.discard&&(console.debug("Discarding request due to explicit discard:",s.payload.url),o()),c.includes(d)&&(console.debug("Discarding request due to deletion:",s.payload.url),o()),t instanceof D){const h=t.status||((r=t.response)==null?void 0:r.status);if(h||console.warn("Error has no status code:",t),h!==void 0&&tc.includes(h)){console.warn("Discarding request due to error:",t,`
5
- Action:`,s);const y=ft();if(!y)throw new Error("Outbox coordinator not set");y.remove(s.payload.uuid),t.options.discard=!0,o()}}console.debug("Registering a retry for request:",s.payload.uuid);const l=ft();if(!l)throw new Error("Outbox coordinator not set");return l.registerRetry(s.payload.uuid),!1}function mM(t,s,e){var n;return(n=ft())==null?void 0:n.peek()}function yM(t,s){return It().dispatch(CT(new Date().getTime())),Ac}const wt="An unknown error occurred",fM=500,pb=["non_field_errors","detail"];function SM(t,s){let e;if(t!=null&&t.body)if(typeof t.body=="object"){const n=t.body;if(typeof n.error=="string")e=n.error;else if(typeof n.message=="string")e=n.message;else try{e=Object.entries(n).map(([a,c])=>typeof c=="string"?pb.includes(a)?c:`${a}: ${c}`:Array.isArray(c)?pb.includes(a)?c.join(`
6
- `):c.map(d=>`${a}: ${d}`).join(`
7
- `):`${a}: ${JSON.stringify(c)}`).join(`
8
- `)}catch(a){console.error("Failed to extract error message from response body",a)}}else typeof t.body=="string"&&(e=t.body);else t!=null&&t.text?e=t.text:s instanceof Error&&(e=s.message);return!e||e.length>fM?wt:e}class D extends Error{constructor(e){super(wt);m(this,"status");m(this,"response");m(this,"message");m(this,"options");const{response:n,innerError:a}=e;this.message=e.message??SM(n,a)??wt,this.status=(n==null?void 0:n.status)??0,this.response=n,e.discard=e.discard??!1,this.options=e}}function mb(t){function s(e){return typeof e=="object"&&e!==null&&["ok","redirect","clientError","serverError","error"].every(a=>a in e)}if(s(t))return t;if(typeof t=="object"&&t!==null){const e=t;if(s(e.response))return e.response;if(e.response&&s(e.response.response))return e.response.response}}class AM extends nb{constructor(s){super(s)}}class yt extends nb{constructor(e,n){super(e);m(this,"auth");this.auth=n}}class wM extends yt{async startConversation(s,e){return this.enqueueRequest({description:"Start agent conversation",method:p.POST,url:"/agents/prompt/",payload:{prompt:s,active_project:e},blockers:["prompt"],blocks:["prompt"]}).then(n=>(this.dispatch(Ec(n)),n))}async continueConversation(s,e,n){return this.enqueueRequest({description:"Prompt agent",method:p.POST,url:"/agents/prompt/",payload:{prompt:s,active_project:n},blockers:["prompt"],blocks:["prompt"],queryParams:{conversation_id:e}}).then(a=>{this.dispatch(Wc(a))})}async fetchDetails(s){return this.enqueueRequest({description:"Get agent conversation",method:p.GET,url:`/agents/conversations/${s}/`,blockers:["conversation"],blocks:["conversation"]}).then(e=>{this.dispatch(Vc(e))})}async rate(s,e){return this.enqueueRequest({description:"Rate agent response",method:p.PUT,url:`/agents/responses/${s}/rate/`,payload:{rating:e},blockers:["rate"],blocks:["rate"]})}async list(s,e){return this.performRequest({method:p.GET,url:"/agents/conversations/",...s},e)}async refreshStore(s,e){const n=await this.list({queryParams:{project:s}},e);return this.dispatch(vc(n)),n}}function T(t,s,e){const n=`${s}${e?"s":""}`;switch(t){case p.GET:return`Get ${n}`;case p.POST:return`Create ${n}`;case p.PATCH:return`Update ${n}`;case p.PUT:return`Update ${n}`;case p.DELETE:return`Delete ${n}`}}class k extends yt{async get(s,e){return this.performRequest({url:`${this.url}/${s}/`,method:p.GET},e)}async list(s,e){return this.performRequest({url:`${this.url}/`,method:p.GET,...s},e)}async listPaginated(s,e){return this.performPagination({url:`${this.url}/`,method:p.GET,...s},e)}}class L extends k{constructor(){super(...arguments);m(this,"pageSize",sb)}async _bulkAdd(e){var S;const{store:n}=this.client,{addMany:a,updateMany:c,deleteMany:d}=this.actions,o=((S=n.getState().userReducer.currentUser)==null?void 0:S.id)??null,l=new Date().toISOString(),r=[],h=[],y={};for(const O of e){const{modelUuid:P,file:I}=O,F=await this.client.files.getFilePayload(I);F.sha1 in y||(y[F.sha1]=F);const g=this.buildModel({file:I,file_sha1:F.sha1,submitted_at:l,created_by:o,modelUuid:P});r.push(g),h.push(this.buildPayload(g,F))}this.dispatch(a(r));const f=this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:{submitted_at:l,attachments:h,files:Object.values(y)},blocks:r.map(O=>this.getId(O)),blockers:r.map(O=>O.file_sha1)});return f.then(({attachments:O,presigned_urls:P})=>{this.dispatch(c(O)),this.client.files.processPresignedUrls(P)}).catch(()=>{this.dispatch(d(r.map(O=>this.getId(O))))}),[r,f.then(({attachments:O})=>O)]}async _delete(e){const{store:n}=this.client,{addOne:a,deleteOne:c}=this.actions,{selectById:d}=this.selectors,o=d(e)(n.getState());if(!o)throw new Error(`Attempting to delete attachment with uuid ${e} that does not exist in the store`);this.dispatch(c(this.getId(o)));const l=this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return l.then(()=>{this.client.files.removeCache(o.file_sha1)}).catch(()=>{this.dispatch(a(o))}),l}}class TM extends L{constructor(){super(...arguments);m(this,"name","Asset attachment");m(this,"url","/asset-attachments");m(this,"actions",{addOne:Cc,addMany:gs,setOne:jc,setMany:Dc,updateOne:$c,updateMany:Uc,deleteOne:Lc,deleteMany:bs,initialize:qc});m(this,"selectors",{selectById:Hc,selectByIds:Gc})}getId(e){return e.uuid}buildModel(e){return _({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,asset:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,asset:e.asset}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.assetUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{asset__project:e}},n)).flat();return this.dispatch(a(d)),d}}class OM extends L{constructor(){super(...arguments);m(this,"name","Asset Procedure Attachment");m(this,"url","/asset-procedure-type-attachments");m(this,"actions",{addOne:Qc,addMany:Xc,setOne:xc,setMany:er,updateOne:tr,updateMany:sr,deleteOne:ir,deleteMany:nr,initialize:Jc});m(this,"selectors",{selectById:rr,selectByIds:dr})}getId(e){return e.uuid}buildModel(e){return _({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,asset_procedure_type:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,asset_procedure_type:e.asset_procedure_type}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.assetProcedureTypeUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class IM extends k{constructor(){super(...arguments);m(this,"name","Asset Procedure Type Fields Attachment");m(this,"url","/asset-procedure-type-fields-attachments");m(this,"actions",{addOne:ur,addMany:hr,setOne:pr,setMany:mr,updateOne:yr,updateMany:fr,deleteOne:Sr,deleteMany:Ar,initialize:or});m(this,"selectors",{selectById:Or,selectByIds:Ir})}async bulkAdd(e){var f;const{addMany:n,setMany:a,deleteMany:c}=this.actions,d=new Date().toISOString(),o=((f=this.client.store.getState().userReducer.currentUser)==null?void 0:f.id)??null,l={},r=[],h=[];for(const S of e){const{fieldsRevisionUuid:O,fieldIdentifier:P,file:I}=S,F=await this.client.files.getFilePayload(I);F.sha1 in l||(l[F.sha1]=F);const g=_({file:URL.createObjectURL(I),file_type:I.type,file_name:I.name,file_sha1:F.sha1,created_by:o,fields_revision:O,submitted_at:d,field_identifier:P});r.push(g);const v={uuid:g.uuid,file_name:I.name,field_identifier:P,file_extension:F.extension,file_sha1:F.sha1,fields_revision:O};h.push(v)}this.dispatch(n(r));const y=this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:{submitted_at:d,attachments:h,files:Object.values(l)},blockers:r.map(S=>S.fields_revision),blocks:r.map(S=>S.uuid)});return y.then(S=>{this.client.files.processPresignedUrls(S.presigned_urls),this.dispatch(a(S.attachments))}).catch(()=>{this.dispatch(c(r.map(S=>S.uuid)))}),[r,y.then(({attachments:S})=>S)]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{fields_revision__asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class FM extends k{constructor(){super(...arguments);m(this,"name","Asset Procedure Type Fields");m(this,"url","/asset-procedure-type-fields");m(this,"actions",{addOne:gr,addMany:br,setOne:_r,setMany:Rr,updateOne:Mr,updateMany:kr,deleteOne:vr,deleteMany:Er,initialize:Pr});m(this,"selectors",{selectById:Br,selectByIds:zr})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,o=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,l=new Date().toISOString(),r=_({...e,created_by:o,submitted_at:l});this.dispatch(a(r));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(r),blockers:[r.asset_procedure_type],blocks:[r.uuid]});return h.then(f=>{this.dispatch(c(f))}).catch(f=>{throw this.dispatch(d(r.uuid)),f}),[r,h]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}function pt(t,s){const e=[];let n=0;const a=t.length;for(;n<a;)e.push(t.slice(n,n+=s));return e}class PM extends k{constructor(){super(...arguments);m(this,"name","Asset Procedure Type Field Values Attachment");m(this,"url","/asset-procedure-type-field-values-attachments");m(this,"actions",{addOne:jr,addMany:Ws,setOne:Dr,setMany:$r,updateOne:Ur,updateMany:Lr,deleteOne:Nr,deleteMany:Bs,initialize:Cr});m(this,"selectors",{selectById:Kr,selectByIds:Yr})}async bulkAdd(e,n){var S;const{addMany:a,setMany:c,deleteMany:d}=this.actions,o=new Date().toISOString(),l=((S=this.client.store.getState().userReducer.currentUser)==null?void 0:S.id)??null,r=pt(e,Math.min(n??e.length,U)),h=[],y=[];for(const O of r){const P={},I=[];for(const F of O){const{fieldValuesUuid:g,fieldIdentifier:v,file:V}=F,W=await this.client.files.getFilePayload(V);W.sha1 in P||(P[W.sha1]=W);const C=_({file:URL.createObjectURL(V),file_type:V.type,file_name:V.name,file_sha1:W.sha1,created_by:l,field_values:g,submitted_at:o,field_identifier:v});h.push(C);const q={uuid:C.uuid,file_name:V.name,file_sha1:W.sha1,file_extension:W.extension,field_identifier:v,field_values:g};I.push(q)}y.push({submitted_at:o,attachments:I,files:Object.values(P)})}this.dispatch(a(h));const f=y.map(O=>this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:O,blockers:O.attachments.map(P=>P.field_values),blocks:O.attachments.map(P=>P.uuid)}));return Promise.all(f).then(O=>{for(const I of O)this.client.files.processPresignedUrls(I.presigned_urls);const P=O.flatMap(I=>I.attachments);this.dispatch(c(P))}).catch(O=>{throw this.dispatch(d(h.map(P=>P.uuid))),O}),[h,f.map(O=>O.then(({attachments:P})=>P))]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:d}=this.selectors,o=n.getState(),l=d(e)(o);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!0),method:p.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{field_values__asset_procedure__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class gM extends k{constructor(){super(...arguments);m(this,"name","Asset Procedure Type Field Values");m(this,"url","/asset-procedure-type-field-values");m(this,"actions",{addOne:Xr,addMany:xr,setOne:ed,setMany:td,updateOne:sd,updateMany:id,deleteOne:nd,deleteMany:ad,initialize:Qr});m(this,"selectors",{selectById:dd,selectByIds:ld})}add(e){var f;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,r=new Date().toISOString(),h=_({...e,created_by:l,submitted_at:r}),y=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(h),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[h.uuid]});return this.dispatch(a(h)),y.then(S=>{this.dispatch(c(S))}).catch(()=>{this.dispatch(d(h.uuid))}),[h,y]}bulkAdd(e,n){var P;const{values:a,payloads:c}=e,{addMany:d,setMany:o,deleteMany:l}=this.actions,r=new Date().toISOString(),h=((P=this.client.store.getState().userReducer.currentUser)==null?void 0:P.id)??null,y=[],f=pt(c,Math.min(n??c.length,U)),S=[];for(const I of f){const F=[];for(const g of I){const v=_({...g,values:g.values,created_by:h,submitted_at:r});y.push(v),F.push({uuid:v.uuid,asset:g.asset,fields_revision:g.fields_revision,asset_procedure:g.asset_procedure,published_at:g.published_at,values:v.values})}S.push({submitted_at:r,values:a,field_values:F})}this.dispatch(d(y));const O=[];for(const I of S){const{field_values:F}=I,g=F.map(({asset:q})=>q),v=F.map(({fields_revision:q})=>q),V=F.map(({asset_procedure:q})=>q),W=F.map(({uuid:q})=>q),C=this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:I,blockers:g.concat(v).concat(V),blocks:W});O.push(C)}return Promise.all(O).then(I=>{this.dispatch(o(I.flat()))}).catch(()=>{this.dispatch(l(B(y)))}),[y,O]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=n.getState(),o=c(e.uuid)(d);if(!o)throw new Error(`Expected AssetProcedureTypeFieldValues with uuid ${e.uuid} to exist`);const l={...o,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[l.fields_revision,l.asset,l.asset_procedure],blocks:[l.uuid]});return r.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(o))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected submission with uuid ${e} to exist`);const r=Zr(e)(o);this.dispatch(a(e)),this.dispatch(Bs(B(r)));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(l)),this.dispatch(Ws(r)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{asset_procedure__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class bM extends k{constructor(){super(...arguments);m(this,"name","Asset Procedure");m(this,"url","/asset-procedures");m(this,"actions",{addOne:hd,addMany:js,setOne:fd,setMany:Sd,updateOne:pd,updateMany:md,deleteOne:yd,deleteMany:Ds,initialize:ud});m(this,"selectors",{selectById:Od,selectByIds:Id})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,o=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,l=new Date().toISOString(),r=_({...e,created_by:o,submitted_at:l});this.dispatch(a(r));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(r),blockers:[e.asset_procedure_type,e.asset_type],blocks:[r.uuid]});return h.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(d(r.uuid))}),[r,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Expected asset procedure with uuid ${e.uuid} to exist`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[d.uuid],blocks:[d.uuid]});return l.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected asset procedure with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(d)),d}}class _M extends k{constructor(){super(...arguments);m(this,"name","Asset Procedure Type");m(this,"url","/asset-procedure-types");m(this,"actions",{addOne:gd,addMany:bd,setOne:vd,setMany:Ed,updateOne:_d,updateMany:Rd,deleteOne:Md,deleteMany:kd,initialize:Pd});m(this,"selectors",{selectById:Bd,selectByIds:zd})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,o=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,l=new Date().toISOString(),r=_({...e,created_by:o,submitted_at:l});this.dispatch(a(r));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(r),blockers:[],blocks:[r.uuid]});return h.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(d(r.uuid))}),[r,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Expected asset procedure type with uuid ${e.uuid} to exist`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[d.uuid],blocks:[d.uuid]});return l.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected asset procedure type with uuid ${e} to exist`);const r=Td(e)(o);this.dispatch(a(e)),this.dispatch(Ds(B(r)));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(l)),this.dispatch(js(r)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class RM extends k{constructor(){super(...arguments);m(this,"name","Asset Procedure Step Fields Attachment");m(this,"url","/asset-procedure-step-fields-attachments");m(this,"actions",{addOne:jd,addMany:Dd,setOne:$d,setMany:Ud,updateOne:Ld,updateMany:Nd,deleteOne:Hd,deleteMany:Gd,initialize:Cd});m(this,"selectors",{selectById:Yd,selectByIds:Zd})}async bulkAdd(e){var f;const{addMany:n,setMany:a,deleteMany:c}=this.actions,d=new Date().toISOString(),o=((f=this.client.store.getState().userReducer.currentUser)==null?void 0:f.id)??null,l={},r=[],h=[];for(const S of e){const{fieldsRevisionUuid:O,fieldIdentifier:P,file:I}=S,F=await this.client.files.getFilePayload(I);F.sha1 in l||(l[F.sha1]=F);const g=_({file:URL.createObjectURL(I),file_type:I.type,file_name:I.name,file_sha1:F.sha1,created_by:o,fields_revision:O,submitted_at:d,field_identifier:P});r.push(g);const v={uuid:g.uuid,file_name:I.name,field_identifier:P,file_extension:F.extension,file_sha1:F.sha1,fields_revision:O};h.push(v)}this.dispatch(n(r));const y=this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:{submitted_at:d,attachments:h,files:Object.values(l)},blockers:r.map(S=>S.fields_revision),blocks:r.map(S=>S.uuid)});return y.then(S=>{this.client.files.processPresignedUrls(S.presigned_urls),this.dispatch(a(S.attachments))}).catch(()=>{this.dispatch(c(r.map(S=>S.uuid)))}),[r,y.then(({attachments:S})=>S)]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{fields_revision__asset_procedure_step__organization:e}},n);return this.dispatch(a(c)),c}}class MM extends k{constructor(){super(...arguments);m(this,"name","Asset Procedure Step Fields");m(this,"url","/asset-procedure-step-fields");m(this,"actions",{addOne:xd,addMany:el,setOne:tl,setMany:sl,updateOne:il,updateMany:nl,deleteOne:al,deleteMany:cl,initialize:Xd});m(this,"selectors",{selectById:rl,selectByIds:dl})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,o=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,l=new Date().toISOString(),r=_({...e,created_by:o,submitted_at:l});this.dispatch(a(r));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(r),blockers:[r.asset_procedure_step],blocks:[r.uuid]});return h.then(f=>{this.dispatch(c(f))}).catch(f=>{throw this.dispatch(d(r.uuid)),f}),[r,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,c=n.getState().assetProcedureStepFieldsReducer.instances[e.uuid];if(!c)throw new Error(`AssetProcedureStepFields with uuid ${e.uuid} not found`);const d={...c,...e};this.dispatch(a(d));const o=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${c.uuid}/`,payload:e,blockers:[c.uuid],blocks:[c.uuid]});return o.then(l=>{this.dispatch(a(l))}).catch(l=>{throw this.dispatch(a(c)),l}),[d,o]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,d=n.getState().assetProcedureStepFieldsReducer.instances[e];if(!d)throw new Error(`AssetProcedureStepFields with uuid ${e} not found`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(o){throw this.dispatch(c(d)),o}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_step__asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class kM extends k{constructor(){super(...arguments);m(this,"name","Asset Procedure Step Field Values Attachment");m(this,"url","/asset-procedure-step-field-values-attachments");m(this,"actions",{addOne:hl,addMany:Ys,setOne:pl,setMany:ml,updateOne:yl,updateMany:fl,deleteOne:Sl,deleteMany:Zs,initialize:ul});m(this,"selectors",{selectById:wl,selectByIds:Tl})}async bulkAdd(e,n){var S;const{addMany:a,setMany:c,deleteMany:d}=this.actions,o=new Date().toISOString(),l=((S=this.client.store.getState().userReducer.currentUser)==null?void 0:S.id)??null,r=pt(e,Math.min(n??e.length,U)),h=[],y=[];for(const O of r){const P={},I=[];for(const F of O){const{fieldValuesUuid:g,fieldIdentifier:v,file:V}=F,W=await this.client.files.getFilePayload(V);W.sha1 in P||(P[W.sha1]=W);const C=_({file:URL.createObjectURL(V),file_type:V.type,file_name:V.name,file_sha1:W.sha1,created_by:l,field_values:g,submitted_at:o,field_identifier:v});h.push(C);const q={uuid:C.uuid,file_name:V.name,file_sha1:W.sha1,file_extension:W.extension,field_identifier:v,field_values:g};I.push(q)}y.push({submitted_at:o,attachments:I,files:Object.values(P)})}this.dispatch(a(h));const f=y.map(O=>this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:O,blockers:O.attachments.map(P=>P.field_values),blocks:O.attachments.map(P=>P.uuid)}));return Promise.all(f).then(O=>{for(const I of O)this.client.files.processPresignedUrls(I.presigned_urls);const P=O.flatMap(I=>I.attachments);this.dispatch(c(P))}).catch(O=>{throw this.dispatch(d(h.map(P=>P.uuid))),O}),[h,f.map(O=>O.then(({attachments:P})=>P))]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:d}=this.selectors,o=n.getState(),l=d(e)(o);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!0),method:p.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{field_values__asset_procedure__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class vM extends k{constructor(){super(...arguments);m(this,"name","Asset Procedure Step Field Values");m(this,"url","/asset-procedure-step-field-values");m(this,"actions",{addOne:gl,addMany:bl,setOne:_l,setMany:Rl,updateOne:Ml,updateMany:kl,deleteOne:vl,deleteMany:El,initialize:Pl});m(this,"selectors",{selectById:Wl,selectByIds:Bl})}add(e){var f;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,r=new Date().toISOString(),h=_({...e,created_by:l,submitted_at:r}),y=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(h),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[h.uuid]});return this.dispatch(a(h)),y.then(S=>{this.dispatch(c(S))}).catch(()=>{this.dispatch(d(h.uuid))}),[h,y]}bulkAdd(e,n){var P;const{payloads:a,values:c}=e,{addMany:d,setMany:o,deleteMany:l}=this.actions,r=new Date().toISOString(),h=((P=this.client.store.getState().userReducer.currentUser)==null?void 0:P.id)??null,y=[],f=pt(a,Math.min(n??a.length,U)),S=[];for(const I of f){const F=[];for(const g of I){const v=_({...g,values:g.values,created_by:h,submitted_at:r});y.push(v),F.push({uuid:v.uuid,asset:g.asset,fields_revision:g.fields_revision,asset_procedure:g.asset_procedure,asset_procedure_step:g.asset_procedure_step,published_at:g.published_at,values:v.values})}S.push({submitted_at:r,values:c,field_values:F})}this.dispatch(d(y));const O=[];for(const I of S){const{field_values:F}=I,g=F.map(({asset:q})=>q),v=F.map(({fields_revision:q})=>q),V=F.map(({asset_procedure:q})=>q),W=F.map(({uuid:q})=>q),C=this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:I,blockers:g.concat(v).concat(V),blocks:W});O.push(C)}return Promise.all(O).then(I=>{this.dispatch(o(I.flat()))}).catch(()=>{this.dispatch(l(B(y)))}),[y,O]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=n.getState(),o=c(e.uuid)(d);if(!o)throw new Error(`Expected AssetProcedureStepFieldValues with uuid ${e.uuid} to exist`);const l={...o,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[l.fields_revision,l.asset,l.asset_procedure],blocks:[l.uuid]});return r.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(o))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected submission with uuid ${e} to exist`);const r=Ol(e)(o);this.dispatch(a(e)),this.dispatch(Zs(B(r)));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(l)),this.dispatch(Ys(r)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{asset_procedure__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class EM extends k{constructor(){super(...arguments);m(this,"name","Asset Procedure Step");m(this,"url","/asset-procedure-steps");m(this,"actions",{addOne:$l,addMany:Ul,setOne:jl,setMany:Dl,updateOne:Ll,updateMany:Nl,deleteOne:Hl,deleteMany:Gl,initialize:Cl});m(this,"selectors",{selectById:Yl,selectByIds:Zl})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,o=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,l=new Date().toISOString(),r=_({...e,created_by:o,submitted_at:l});this.dispatch(a(r));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(r),blockers:[r.asset_procedure_type],blocks:[r.uuid]});return h.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(d(r.uuid))}),[r,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`No asset procedure step with uuid ${e.uuid} found in the store`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${d.uuid}/`,payload:{name:e.name,description:e.description,priority:e.order,color:e.color},blockers:[d.uuid],blocks:[d.uuid]});return l.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteMany:a,addMany:c,addOne:d,deleteOne:o}=this.actions,{selectById:l}=this.selectors,r=n.getState(),h=l(e)(r);if(!h)throw new Error(`No asset procedure step with uuid ${e} found in the store`);const y=Jl(e)(r);this.dispatch(o(e)),this.dispatch(a(B(y)));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(f){throw this.dispatch(d(h)),this.dispatch(c(y)),f}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class VM extends k{constructor(){super(...arguments);m(this,"url","/assets");m(this,"name","Asset");m(this,"actions",{addOne:xl,addMany:ti,setOne:io,setMany:no,updateOne:eo,updateMany:to,deleteOne:so,deleteMany:si,initialize:Xl});m(this,"selectors",{selectById:ro,selectByIds:lo})}add(e){var y;const{store:n}=this.client,{addOne:a,updateOne:c,deleteOne:d}=this.actions,o=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,l=new Date().toISOString(),r=_({...e,created_by:o,submitted_at:l});this.dispatch(a(r));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(r),blockers:[r.asset_type],blocks:[r.uuid]});return h.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(d(r.uuid))}),[r,h]}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`No asset with uuid ${e.uuid} found in the store`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return l.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{addOne:a,deleteOne:c}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`No asset with uuid ${e} found in the store`);const r=Kc(e)(o),h=Of(e)(o);this.dispatch(c(e)),this.dispatch(bs(B(r))),this.dispatch(Zt(B(h)));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(y){throw this.dispatch(a(l)),this.dispatch(gs(r)),this.dispatch(Yt(h)),y}}bulkAdd(e,n){const{addMany:a}=this.actions,c=new Date().toISOString(),d=mt.v4(),o=pt(e,Math.min(n??e.length,U)).map(h=>{const y=h.map(f=>_(f));return{batchId:mt.v4(),payload:{transaction_id:d,submitted_at:c,assets:y}}}),l=[];let r=null;for(const h of o){const{batchId:y,payload:f}=h,S=f.assets.map(({uuid:g})=>g),O=f.assets.map(({asset_type:g})=>g),P=f.assets.map(({project:g})=>g),I=f.assets.map(({status:g})=>g),F=this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:f,blockers:(r?[r]:[]).concat(O).concat(P).concat(I),blocks:[y].concat(S)});r=h.batchId,l.push(F)}return Promise.all(l).then(h=>{const y=h.flat();this.dispatch(a(y))}),l}bulkUpdate(e,n){const{store:a}=this.client,{updateMany:c}=this.actions,{selectByIds:d}=this.selectors,o=B(e).toSorted(Wt);if(o.length!==e.length)throw new Error("payloads contains duplicate uuids.");const l=d(o)(a.getState()).toSorted(Os);if(o.length!=l.length)throw new Error(`Attempting to bulk update ${o.length-l.length} assets that dont exist in the store`);const r=[];for(let S=0;S<o.length;S++)r.push({...l[S],...e[S]});this.dispatch(c(r));const h=pt(e,Math.min(n??e.length,U)),y=[];let f=null;for(const S of h){const O=mt.v4(),P=B(S),I=S.map(({status:g})=>g).filter(Boolean),F=this.enqueueRequest({description:T(p.PATCH,this.name,!0),method:p.PATCH,url:`${this.url}/bulk/`,payload:{payloads:S},blockers:(f?[f]:[]).concat(P).concat(I),blocks:[O].concat(P)});y.push(F),f=O}return Promise.all(y).then(S=>{this.dispatch(c(S.flat()))}).catch(()=>{this.dispatch(c(l))}),[r,y]}async bulkDelete(e){const{store:n}=this.client,{addMany:a,deleteMany:c}=this.actions,{selectByIds:d}=this.selectors,o=n.getState(),l=d(e)(o);this.dispatch(c(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!0),method:p.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(r){throw this.dispatch(a(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(d)),d}}class WM extends k{constructor(){super(...arguments);m(this,"name","Asset Stage Completion");m(this,"url","/asset-stage-completions");m(this,"actions",{addOne:po,addMany:mo,setOne:yo,setMany:fo,updateOne:So,updateMany:Ao,deleteOne:wo,deleteMany:To,initialize:ho});m(this,"selectors",{selectById:Po,selectByIds:go})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,o=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,l=new Date().toISOString(),r=_({...e,created_by:o,submitted_at:l});this.dispatch(a(r));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(r),blockers:[e.asset,e.asset_stage],blocks:[r.uuid]});return h.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(d(r.uuid))}),[r,h]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,o=d(e)(n.getState());if(!o)throw new Error(`Expected asset stage completion with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(l){throw this.dispatch(c(o)),l}}bulkAdd(e){var S;const{store:n}=this.client,{addMany:a,setMany:c,deleteMany:d}=this.actions,o=new Date().toISOString(),l=((S=n.getState().userReducer.currentUser)==null?void 0:S.id)??null,r=e.map(O=>_(O)),h=r.map(O=>({...O,created_by:l,submitted_at:o})),y=h.map(({uuid:O})=>O);this.dispatch(a(h));const f=this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:{submitted_at:o,completions:r},blockers:[...e.map(O=>O.asset_procedure),...e.map(O=>O.asset_stage),...e.map(O=>O.asset)],blocks:y});return f.then(O=>{this.dispatch(c(O))}).catch(()=>{this.dispatch(d(y))}),[h,f]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:d}=this.selectors,o=d(e)(n.getState());this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!0),method:p.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(l){throw this.dispatch(c(o)),l}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{asset_procedure__project:e}},n)).flat();return this.dispatch(a(d)),d}}class BM extends k{constructor(){super(...arguments);m(this,"name","Asset Stage");m(this,"url","/asset-stages");m(this,"actions",{addOne:ko,addMany:vo,setOne:Ro,setMany:Mo,updateOne:Eo,updateMany:Vo,deleteOne:Wo,deleteMany:Bo,initialize:_o});m(this,"selectors",{selectById:qo,selectByIds:Co})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,o=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,l=new Date().toISOString(),r=_({...e,created_by:o,submitted_at:l});this.dispatch(a(r));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(r),blockers:[r.asset_procedure_type],blocks:[r.uuid]});return h.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(d(r.uuid))}),[r,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`No asset stage with uuid ${e.uuid} found in the store`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${d.uuid}/`,payload:e,blockers:[d.uuid],blocks:[d.uuid]});return l.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`No asset stage with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class zM extends L{constructor(){super(...arguments);m(this,"name","Asset Type Attachment");m(this,"url","/asset-type-attachments");m(this,"actions",{addOne:$o,addMany:di,setOne:Uo,setMany:Lo,updateOne:No,updateMany:Ho,deleteOne:Go,deleteMany:li,initialize:Do});m(this,"selectors",{selectById:Yo,selectByIds:Zo})}getId(e){return e.uuid}buildModel(e){return _({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,asset_type:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,asset_type:e.asset_type}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.assetTypeUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class qM extends k{constructor(){super(...arguments);m(this,"name","Asset Type Fields Attachment");m(this,"url","/asset-type-fields-attachments");m(this,"actions",{addOne:eu,addMany:tu,setOne:su,setMany:iu,updateOne:nu,updateMany:au,deleteOne:cu,deleteMany:ru,initialize:xo});m(this,"selectors",{selectById:lu,selectByIds:ou})}async bulkAdd(e){var f;const{addMany:n,setMany:a,deleteMany:c}=this.actions,d=new Date().toISOString(),o=((f=this.client.store.getState().userReducer.currentUser)==null?void 0:f.id)??null,l={},r=[],h=[];for(const S of e){const{fieldsRevisionUuid:O,fieldIdentifier:P,file:I}=S,F=await this.client.files.getFilePayload(I);F.sha1 in l||(l[F.sha1]=F);const g=_({file:URL.createObjectURL(I),file_type:I.type,file_name:I.name,file_sha1:F.sha1,created_by:o,fields_revision:O,submitted_at:d,field_identifier:P});r.push(g);const v={uuid:g.uuid,file_name:I.name,field_identifier:P,file_extension:F.extension,file_sha1:F.sha1,fields_revision:O};h.push(v)}this.dispatch(n(r));const y=this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:{submitted_at:d,attachments:h,files:Object.values(l)},blockers:r.map(S=>S.fields_revision),blocks:r.map(S=>S.uuid)});return y.then(S=>{this.client.files.processPresignedUrls(S.presigned_urls),this.dispatch(a(S.attachments))}).catch(()=>{this.dispatch(c(r.map(S=>S.uuid)))}),[r,y.then(({attachments:S})=>S)]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{fields_revision__asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class CM extends k{constructor(){super(...arguments);m(this,"name","Asset Type Fields");m(this,"url","/asset-type-fields");m(this,"actions",{addOne:mu,addMany:yu,setOne:fu,setMany:Su,updateOne:Au,updateMany:wu,deleteOne:Tu,deleteMany:Ou,initialize:pu});m(this,"selectors",{selectById:Fu,selectByIds:Pu})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,o=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,l=new Date().toISOString(),r=_({...e,created_by:o,submitted_at:l});this.dispatch(a(r));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(r),blockers:[r.asset_type],blocks:[r.uuid]});return h.then(f=>{this.dispatch(c(f))}).catch(f=>{throw this.dispatch(d(r.uuid)),f}),[r,h]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class jM extends k{constructor(){super(...arguments);m(this,"name","Asset Type Field Values Attachment");m(this,"url","/asset-type-field-values-attachments");m(this,"actions",{addOne:Ru,addMany:yi,setOne:Mu,setMany:ku,updateOne:vu,updateMany:Eu,deleteOne:Vu,deleteMany:fi,initialize:_u});m(this,"selectors",{selectById:Bu,selectByIds:zu})}async bulkAdd(e,n){var S;const{addMany:a,setMany:c,deleteMany:d}=this.actions,o=new Date().toISOString(),l=((S=this.client.store.getState().userReducer.currentUser)==null?void 0:S.id)??null,r=pt(e,Math.min(n??e.length,U)),h=[],y=[];for(const O of r){const P={},I=[];for(const F of O){const{fieldValuesUuid:g,fieldIdentifier:v,file:V}=F,W=await this.client.files.getFilePayload(V);W.sha1 in P||(P[W.sha1]=W);const C=_({file:URL.createObjectURL(V),file_type:V.type,file_name:V.name,file_sha1:W.sha1,created_by:l,field_values:g,submitted_at:o,field_identifier:v});h.push(C);const q={uuid:C.uuid,file_name:V.name,file_sha1:W.sha1,file_extension:W.extension,field_identifier:v,field_values:g};I.push(q)}y.push({submitted_at:o,attachments:I,files:Object.values(P)})}this.dispatch(a(h));const f=y.map(O=>this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:O,blockers:O.attachments.map(P=>P.field_values),blocks:O.attachments.map(P=>P.uuid)}));return Promise.all(f).then(O=>{for(const I of O)this.client.files.processPresignedUrls(I.presigned_urls);const P=O.flatMap(I=>I.attachments);this.dispatch(c(P))}).catch(O=>{throw this.dispatch(d(h.map(P=>P.uuid))),O}),[h,f.map(O=>O.then(({attachments:P})=>P))]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:d}=this.selectors,o=n.getState(),l=d(e)(o);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!0),method:p.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{field_values__asset__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class DM extends k{constructor(){super(...arguments);m(this,"name","Asset Type Field Values");m(this,"url","/asset-type-field-values");m(this,"actions",{addOne:$u,addMany:Uu,setOne:Lu,setMany:Nu,updateOne:Hu,updateMany:Gu,deleteOne:Ku,deleteMany:Yu,initialize:Du});m(this,"selectors",{selectById:Ju,selectByIds:Qu})}add(e){var f;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,r=new Date().toISOString(),h=_({...e,created_by:l,submitted_at:r}),y=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(h),blockers:[e.asset,e.fields_revision],blocks:[h.uuid]});return this.dispatch(a(h)),y.then(S=>{this.dispatch(c(S))}).catch(()=>{this.dispatch(d(h.uuid))}),[h,y]}bulkAdd(e,n){var O;const{payloads:a,values:c}=e,{addMany:d,setMany:o,deleteMany:l}=this.actions,r=new Date().toISOString(),h=[],y=pt(a,Math.min(n??a.length,U)),f=[];for(const P of y){const I=[];for(const F of P){const g=_({...F,values:F.values,created_by:((O=this.client.store.getState().userReducer.currentUser)==null?void 0:O.id)??null,submitted_at:r});h.push(g),I.push({uuid:g.uuid,asset:F.asset,fields_revision:F.fields_revision,published_at:F.published_at,values:g.values})}f.push({submitted_at:r,values:c,field_values:I})}this.dispatch(d(h));const S=[];for(const P of f){const{field_values:I}=P,F=I.map(({asset:W})=>W),g=I.map(({fields_revision:W})=>W),v=I.map(({uuid:W})=>W),V=this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:P,blockers:F.concat(g),blocks:v});S.push(V)}return Promise.all(S).then(P=>{this.dispatch(o(P.flat()))}).catch(()=>{this.dispatch(l(B(h)))}),[h,S]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=n.getState(),o=c(e.uuid)(d);if(!o)throw new Error(`Expected AssetTypeFieldValues with uuid ${e.uuid} to exist`);const l={...o,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[l.uuid,l.fields_revision,l.asset],blocks:[l.uuid]});return r.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(o))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected submission with uuid ${e} to exist`);const r=qu(e)(o);this.dispatch(a(e)),this.dispatch(fi(B(r)));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(l)),this.dispatch(yi(r)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{asset__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class $M extends k{constructor(){super(...arguments);m(this,"name","Asset Type Identifier");m(this,"url","/asset-type-identifiers");m(this,"actions",{addOne:th,addMany:sh,setOne:ih,setMany:nh,updateOne:ah,updateMany:ch,deleteOne:rh,deleteMany:dh,initialize:eh});m(this,"selectors",{selectById:oh,selectByIds:uh})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,o=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,l=new Date().toISOString(),r=_({...e,created_by:o,submitted_at:l});this.dispatch(a(r));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(r),blockers:[r.asset_type],blocks:[r.uuid]});return h.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(d(r.uuid))}),[r,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Expected asset type identifier with uuid ${e.uuid} to exist`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return l.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected asset type identifier with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class UM extends k{constructor(){super(...arguments);m(this,"name","Asset Type Identifier Value");m(this,"url","/asset-type-identifier-values");m(this,"actions",{addOne:yh,addMany:fh,setOne:Sh,setMany:Ah,updateOne:wh,updateMany:Th,deleteOne:Oh,deleteMany:Ih,initialize:mh});m(this,"selectors",{selectById:Ph,selectByIds:gh})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,o=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,l=new Date().toISOString(),r=_({...e,created_by:o,submitted_at:l});this.dispatch(a(r));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(r),blockers:[e.asset,e.asset_type_identifier],blocks:[r.uuid]});return h.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(d(r.uuid))}),[r,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Expected asset type identifier value with uuid ${e.uuid} to exist`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return l.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected asset type identifier value with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{asset__project:e}},n)).flat();return this.dispatch(a(d)),d}}class LM extends k{constructor(){super(...arguments);m(this,"name","Asset Type");m(this,"url","/asset-types");m(this,"actions",{addOne:vh,addMany:Eh,setOne:Mh,setMany:kh,updateOne:Vh,updateMany:Wh,deleteOne:Bh,deleteMany:zh,initialize:Rh});m(this,"selectors",{selectById:Ch,selectByIds:jh})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,o=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,l=new Date().toISOString(),r=_({...e,created_by:o,submitted_at:l});this.dispatch(a(r));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(r),blockers:[],blocks:[r.uuid]});return h.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(d(r.uuid))}),[r,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Expected asset type with uuid ${e.uuid} to exist`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[d.uuid],blocks:[d.uuid]});return l.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected asset type with uuid ${e} to exist`);const r=co(e)(o),h=Jo(e)(o);this.dispatch(a(e)),this.dispatch(si(B(r))),this.dispatch(li(B(h)));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(y){throw this.dispatch(c(l)),this.dispatch(ti(r)),this.dispatch(di(h)),y}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class NM extends k{constructor(){super(...arguments);m(this,"name","Asset Type Status");m(this,"url","/asset-type-statuses");m(this,"actions",{addOne:Lh,addMany:Nh,setOne:Hh,setMany:Gh,updateOne:Kh,updateMany:Yh,deleteOne:Zh,deleteMany:Jh,initialize:Uh});m(this,"selectors",{selectById:Xh,selectByIds:xh})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,o=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,l=new Date().toISOString(),r=_({...e,created_by:o,submitted_at:l});this.dispatch(a(r));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(r),blockers:[e.asset_type],blocks:[r.uuid]});return h.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(d(r.uuid))}),[r,h]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.client.store.getState(),d=a(e.uuid)(c);if(!d)throw new Error(`Expected an existing asset type status with uuid ${e.uuid}`);const o={...d,...e};this.dispatch(n(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return l.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,o=d(e)(n.getState());if(!o)throw new Error(`No asset type status with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(l){throw this.dispatch(c(o)),l}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class HM extends k{constructor(){super(...arguments);m(this,"name","Category");m(this,"url","/categories");m(this,"actions",{addOne:cp,addMany:rp,setOne:dp,setMany:lp,updateOne:op,updateMany:up,deleteOne:hp,deleteMany:pp,initialize:ap});m(this,"selectors",{selectById:Ri,selectByIds:yp})}add(e){var y;const{store:n}=this.client,{addOne:a,updateOne:c,deleteOne:d}=this.actions,o=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,l=new Date().toISOString(),r=_({...e,created_by:o,submitted_at:l});this.dispatch(a(r));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(r),blockers:[e.project],blocks:[r.uuid]});return h.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(d(r.uuid))}),[r,h]}update(e){const{updateOne:n}=this.actions,{selectById:a}=this.selectors,c=this.client.store.getState(),d=a(e.uuid)(c);if(!d)throw new Error(`Expected an existing category with uuid ${e.uuid}`);const o={...d,...e};this.dispatch(n(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return l.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,o=d(e)(n.getState());if(!o)throw new Error(`No category with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${o.uuid}/`,blockers:[o.uuid],blocks:[]})}catch(l){throw this.dispatch(c(o)),l}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{project__organization:e}},n);return this.dispatch(a(c)),c}}class GM extends L{constructor(){super(...arguments);m(this,"name","Document Attachment");m(this,"url","/document-attachments");m(this,"actions",{addOne:wp,addMany:Tp,setOne:Op,setMany:Ip,updateOne:Fp,updateMany:Pp,deleteOne:gp,deleteMany:bp,initialize:Ap});m(this,"selectors",{selectById:Rp,selectByIds:Mp})}getId(e){return e.uuid}buildModel(e){return _({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,document:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,document:e.document}}async bulkAdd(e){var O;const{store:n}=this.client,{addMany:a,updateMany:c,deleteMany:d}=this.actions,o=((O=n.getState().userReducer.currentUser)==null?void 0:O.id)??null,l=new Date().toISOString(),r=[],h=[],y={},f={};for(const P of e){const{documentUuid:I,file:F}=P,g=await this.client.files.getFilePayload(F);g.sha1 in y||(y[g.sha1]=g,f[g.sha1]=[]);const v=this.buildModel({file:F,file_sha1:g.sha1,submitted_at:l,created_by:o,modelUuid:I});r.push(v),h.push(this.buildPayload(v,g)),f[g.sha1].push(v.uuid)}this.dispatch(a(r));const S=this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:{submitted_at:l,attachments:h,files:Object.values(y)},blocks:r.map(P=>P.uuid),blockers:r.map(P=>P.file_sha1)});return S.then(({attachments:P,presigned_urls:I})=>{this.dispatch(c(P));const F=this.client.files.processPresignedUrls(I);for(const[g,v]of Object.entries(F))v.then(()=>{const V=f[g];for(const W of V)this.makeReadable(W)})}).catch(()=>{this.dispatch(d(r.map(P=>P.uuid)))}),[r,S.then(({attachments:P})=>P)]}async delete(e){return this._delete(e)}makeReadable(e){this.enqueueRequest({description:"Add attachment to AI assistant",method:p.PATCH,url:`${this.url}/${e}/`,payload:{readable_to_assistant:!0},blockers:["index-document-attachment",e],blocks:["index-document-attachment"]})}async refreshStore(e,n){const{initialize:a}=this.actions,c=this.list({queryParams:{document__project__organization:e}},n),d=this.list({queryParams:{document__organization:e}},n),l=(await Promise.all([c,d])).flat();return this.dispatch(a(l)),l}}class KM extends k{constructor(){super(...arguments);m(this,"name","Document");m(this,"url","/documents");m(this,"actions",{addOne:Vp,addMany:Wp,setOne:Bp,setMany:zp,updateOne:qp,updateMany:Cp,deleteOne:jp,deleteMany:Dp,initialize:Ep});m(this,"selectors",{selectById:Up,selectByIds:Lp})}add(e){var y;const{store:n}=this.client,{addOne:a,deleteOne:c,updateOne:d}=this.actions,o=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,l=new Date().toISOString(),r=_({...e,created_by:o,submitted_at:l});this.dispatch(a(r));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(r),blockers:r.parent_document?[r.parent_document]:[],blocks:[r.uuid]});return h.then(f=>{this.dispatch(d(f))}).catch(()=>{this.dispatch(c(r.uuid))}),[r,h]}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`attempting to update a document with uuid ${e.uuid} that does not exist in store.documents`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return l.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c,addMany:d,deleteMany:o}=this.actions,{selectById:l}=this.selectors,r=n.getState(),h=l(e)(r);if(!h)throw new Error(`attempting to delete a document with uuid ${e} that does not exist in store.documents`);const y=Np(e)(r);this.dispatch(a(e)),this.dispatch(o(B(y)));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(f){throw this.dispatch(c(h)),this.dispatch(d(y)),f}}async refreshStore(e,n){const{initialize:a}=this.actions,c=this.list({queryParams:{project__organization:e}},n),d=this.list({queryParams:{organization:e}},n),l=(await Promise.all([c,d])).flat();return this.dispatch(a(l)),l}}class Tt extends yt{async get(s,e){return this.performRequest({url:`${this.url}/${s}/`,method:p.GET},e)}async list(s,e){return this.performRequest({url:`${this.url}/`,method:p.GET,...s},e)}async listPaginated(s,e){return this.performPagination({url:`${this.url}/`,method:p.GET,...s},e)}}class YM extends Tt{constructor(){super(...arguments);m(this,"name","Email Domains");m(this,"url","/organization-email-domains");m(this,"actions",{addOne:Kp,addMany:Yp,setOne:Zp,setMany:Jp,updateOne:Qp,updateMany:Xp,deleteOne:xp,deleteMany:em,initialize:Gp});m(this,"selectors",{selectById:sm,selectByIds:im})}async add(e,n){return this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:{email:n,organization:e},blockers:[e,"create-org"],blocks:[]})}async delete(e){const{deleteOne:n,addOne:a}=this.actions;this.dispatch(n(e.uuid));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e.uuid}/`,blockers:[e.domain],blocks:[]})}catch(c){throw this.dispatch(a(e)),c}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class ZM extends yt{async getVerificationCode(s){return this.enqueueRequest({description:"Get verification code",method:p.GET,url:`/verification/email-verification/${s}/`,isAuthNeeded:!1,blockers:[],blocks:[]})}validateVerificationCode(s,e=void 0){return this.enqueueRequest({description:"Validate verification code",method:p.POST,url:`/verification/email-verification/${s}/`,isAuthNeeded:!1,payload:e,blockers:[],blocks:[]})}}const ps={},sc=new Set;let ms=0,ic=0,nc=0;const JM=20;class QM extends yt{constructor(){super(...arguments);m(this,"host");m(this,"_dbPromise",Eb.openDB("fileCache",1,{upgrade(e){e.createObjectStore("files")}}))}async renewUploadUrl(e){const n=await this.fetchCache(e);if(!n)throw new Error(`File with sha1 ${e} not found in cache`);const a=await Ts(n,e),c=await this.enqueueRequest({description:"Get S3 URL",method:p.GET,url:"/authentication/files/presigned-upload-url/",queryParams:{sha1:await At(n),file_type:n.type,extension:n.name.split(".").pop(),size:n.size.toString()},blockers:[],blocks:[`s3-${a}`]});return"url"in c&&this.dispatch(rm({sha1:e,...c})),c}async addCache(e,n){if(sc.has(n))return;if(!e.type){const d=e.name.split("."),o=d[d.length-1];e=new File([e],e.name,{type:o})}if(!e.name||!e.size||!e.type)throw new Error("Cannot add files to cache that do not have a name, size and type.");const a=await this._dbPromise;!!await a.get("files",n)?(console.error("File already cached (this is unexpected at this point):",e.name,n),ms++):(await a.put("files",e,n),ic++),sc.add(n),nc++,nc%JM===0&&console.debug(`File cache summary: ${ms} hits and ${ic} misses, ${ms/(ms+ic)*100}% hit rate over ${nc} calls to addCache.`)}async removeCache(e){await(await this._dbPromise).delete("files",e),sc.delete(e)}async fetchCache(e){return(await this._dbPromise).get("files",e)}async getOrRenewUploadUrl(e){const n=this.client.store.getState();return dm(e)(n)??await this.renewUploadUrl(e)}async uploadFileToS3(e){const n=await this.fetchCache(e);if(!n)throw new Error(`File with sha1 ${e} not found in cache`);const a=await Ts(n,e),c={file_name:n.name,file_sha1:e,file:a},d=await this.getOrRenewUploadUrl(e);if("warning"in d){if(d.warning==="already_uploaded")return[c,Promise.resolve(void 0)];throw new Error(d.warning)}const o=d.url,l=this.enqueueRequest({url:o,description:"Upload file",method:p.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:e,blockers:[`s3-${a}`],blocks:[e],s3url:d});return[c,l]}async fetchFileFromUrl(e,n,a){const c=e.split("?")[0]??e,d=await this.fetchCache(n);if(d){if(!d.name)throw new Error("Cached file unexpectedly has no name.");return d}if(e.startsWith("blob:")){const h=await Oc(e),y=new File([h],a??n,{type:h.type});return await this.addCache(y,n),y}let o=ps[c],l=!0;o?l=!1:(o=new Promise(h=>{this.enqueueRequest({description:"Download file",method:p.GET,url:e,isExternalUrl:!0,isResponseBlob:!0,isAuthNeeded:!1,blockers:[n],blocks:[n]}).then(y=>{const f=new File([y],a??n,{type:y.type});h(f)})}),ps[c]=o);let r;try{r=await o}catch(h){throw l&&h instanceof D&&delete ps[c],h}if(l){const h=await At(r);if(h!==n){const S=`The hash of the file returned from the server (${h}) does not match the
4
+ Retries:`,e),!(t instanceof Error))throw console.error("ENCOUNTERED NON-ERROR ERROR:",t,"(throwing immediately, which may lead to unexpected behavior)"),t;const n=It(),r=n.getState().outboxReducer.deletedRequests,d=s.payload.uuid;function o(){n.dispatch(OT(d));const h=yt();if(!h)throw new Error("Outbox coordinator not set");h.remove(s.payload.uuid);const f=s.meta.offline.rollback;throw f&&(console.warn("Rolling back request due to SDK error:",s),n.dispatch(f)),t}if(t instanceof D&&t.options.discard&&(console.debug("Discarding request due to explicit discard:",s.payload.url),o()),r.includes(d)&&(console.debug("Discarding request due to deletion:",s.payload.url),o()),t instanceof D){const h=t.status||((c=t.response)==null?void 0:c.status);if(h||console.warn("Error has no status code:",t),h!==void 0&&Xa.includes(h)){console.warn("Discarding request due to error:",t,`
5
+ Action:`,s);const f=yt();if(!f)throw new Error("Outbox coordinator not set");f.remove(s.payload.uuid),t.options.discard=!0,o()}}console.debug("Registering a retry for request:",s.payload.uuid);const l=yt();if(!l)throw new Error("Outbox coordinator not set");return l.registerRetry(s.payload.uuid),!1}function QR(t,s,e){var n;return(n=yt())==null?void 0:n.peek()}function XR(t,s){return It().dispatch(IT(new Date().getTime())),fc}const wt="An unknown error occurred",xR=500,Qg=["non_field_errors","detail"];function eM(t,s){let e;if(t!=null&&t.body)if(typeof t.body=="object"){const n=t.body;if(typeof n.error=="string")e=n.error;else if(typeof n.message=="string")e=n.message;else try{e=Object.entries(n).map(([a,r])=>typeof r=="string"?Qg.includes(a)?r:`${a}: ${r}`:Array.isArray(r)?Qg.includes(a)?r.join(`
6
+ `):r.map(d=>`${a}: ${d}`).join(`
7
+ `):`${a}: ${JSON.stringify(r)}`).join(`
8
+ `)}catch(a){console.error("Failed to extract error message from response body",a)}}else typeof t.body=="string"&&(e=t.body);else t!=null&&t.text?e=t.text:s instanceof Error&&(e=s.message);return!e||e.length>xR?wt:e}class D extends Error{constructor(e){super(wt);m(this,"status");m(this,"response");m(this,"message");m(this,"options");const{response:n,innerError:a}=e;this.message=e.message??eM(n,a)??wt,this.status=(n==null?void 0:n.status)??0,this.response=n,e.discard=e.discard??!1,this.options=e}}function Xg(t){function s(e){return typeof e=="object"&&e!==null&&["ok","redirect","clientError","serverError","error"].every(a=>a in e)}if(s(t))return t;if(typeof t=="object"&&t!==null){const e=t;if(s(e.response))return e.response;if(e.response&&s(e.response.response))return e.response.response}}class tM extends Ug{constructor(s){super(s)}}class ft extends Ug{constructor(e,n){super(e);m(this,"auth");this.auth=n}}class sM extends ft{async startConversation(s,e){return this.enqueueRequest({description:"Start agent conversation",method:p.POST,url:"/agents/prompt/",payload:{prompt:s,active_project:e},blockers:["prompt"],blocks:["prompt"]}).then(n=>(this.dispatch(Mc(n)),n))}async continueConversation(s,e,n){return this.enqueueRequest({description:"Prompt agent",method:p.POST,url:"/agents/prompt/",payload:{prompt:s,active_project:n},blockers:["prompt"],blocks:["prompt"],queryParams:{conversation_id:e}}).then(a=>{this.dispatch(vc(a))})}async fetchDetails(s){return this.enqueueRequest({description:"Get agent conversation",method:p.GET,url:`/agents/conversations/${s}/`,blockers:["conversation"],blocks:["conversation"]}).then(e=>{this.dispatch(kc(e))})}async rate(s,e){return this.enqueueRequest({description:"Rate agent response",method:p.PUT,url:`/agents/responses/${s}/rate/`,payload:{rating:e},blockers:["rate"],blocks:["rate"]})}async list(s,e){return this.performRequest({method:p.GET,url:"/agents/conversations/",...s},e)}async refreshStore(s,e){const n=await this.list({queryParams:{project:s}},e);return this.dispatch(Rc(n)),n}}function T(t,s,e){const n=`${s}${e?"s":""}`;switch(t){case p.GET:return`Get ${n}`;case p.POST:return`Create ${n}`;case p.PATCH:return`Update ${n}`;case p.PUT:return`Update ${n}`;case p.DELETE:return`Delete ${n}`}}class k extends ft{async get(s,e){return this.performRequest({url:`${this.url}/${s}/`,method:p.GET},e)}async list(s,e){return this.performRequest({url:`${this.url}/`,method:p.GET,...s},e)}async listPaginated(s,e){return this.performPagination({url:`${this.url}/`,method:p.GET,...s},e)}}class L extends k{constructor(){super(...arguments);m(this,"pageSize",Dg)}async _bulkAdd(e){var S;const{store:n}=this.client,{addMany:a,updateMany:r,deleteMany:d}=this.actions,o=((S=n.getState().userReducer.currentUser)==null?void 0:S.id)??null,l=new Date().toISOString(),c=[],h=[],f={};for(const O of e){const{modelUuid:P,file:I}=O,F=await this.client.files.getFilePayload(I);F.sha1 in f||(f[F.sha1]=F);const g=this.buildModel({file:I,file_sha1:F.sha1,submitted_at:l,created_by:o,modelUuid:P});c.push(g),h.push(this.buildPayload(g,F))}this.dispatch(a(c));const y=this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:{submitted_at:l,attachments:h,files:Object.values(f)},blocks:c.map(O=>this.getId(O)),blockers:c.map(O=>O.file_sha1)});return y.then(({attachments:O,presigned_urls:P})=>{this.dispatch(r(O)),this.client.files.processPresignedUrls(P)}).catch(()=>{this.dispatch(d(c.map(O=>this.getId(O))))}),[c,y.then(({attachments:O})=>O)]}async _delete(e){const{store:n}=this.client,{addOne:a,deleteOne:r}=this.actions,{selectById:d}=this.selectors,o=d(e)(n.getState());if(!o)throw new Error(`Attempting to delete attachment with uuid ${e} that does not exist in the store`);this.dispatch(r(this.getId(o)));const l=this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return l.then(()=>{this.client.files.removeCache(o.file_sha1)}).catch(()=>{this.dispatch(a(o))}),l}}class iM extends L{constructor(){super(...arguments);m(this,"name","Asset attachment");m(this,"url","/asset-attachments");m(this,"actions",{addOne:Bc,addMany:gs,setOne:zc,setMany:qc,updateOne:jc,updateMany:Cc,deleteOne:Dc,deleteMany:bs,initialize:Wc});m(this,"selectors",{selectById:Uc,selectByIds:Lc})}getId(e){return e.uuid}buildModel(e){return _({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,asset:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,asset:e.asset}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.assetUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{asset__project:e}},n)).flat();return this.dispatch(a(d)),d}}class nM extends L{constructor(){super(...arguments);m(this,"name","Asset Procedure Attachment");m(this,"url","/asset-procedure-type-attachments");m(this,"actions",{addOne:Yc,addMany:Zc,setOne:Jc,setMany:Qc,updateOne:Xc,updateMany:xc,deleteOne:er,deleteMany:tr,initialize:Kc});m(this,"selectors",{selectById:nr,selectByIds:ar})}getId(e){return e.uuid}buildModel(e){return _({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,asset_procedure_type:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,asset_procedure_type:e.asset_procedure_type}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.assetProcedureTypeUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,r=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(r)),r}}class aM extends k{constructor(){super(...arguments);m(this,"name","Asset Procedure Type Fields Attachment");m(this,"url","/asset-procedure-type-fields-attachments");m(this,"actions",{addOne:dr,addMany:lr,setOne:or,setMany:ur,updateOne:hr,updateMany:pr,deleteOne:mr,deleteMany:fr,initialize:rr});m(this,"selectors",{selectById:Ar,selectByIds:wr})}async bulkAdd(e){var y;const{addMany:n,setMany:a,deleteMany:r}=this.actions,d=new Date().toISOString(),o=((y=this.client.store.getState().userReducer.currentUser)==null?void 0:y.id)??null,l={},c=[],h=[];for(const S of e){const{fieldsRevisionUuid:O,fieldIdentifier:P,file:I}=S,F=await this.client.files.getFilePayload(I);F.sha1 in l||(l[F.sha1]=F);const g=_({file:URL.createObjectURL(I),file_type:I.type,file_name:I.name,file_sha1:F.sha1,created_by:o,fields_revision:O,submitted_at:d,field_identifier:P});c.push(g);const v={uuid:g.uuid,file_name:I.name,field_identifier:P,file_extension:F.extension,file_sha1:F.sha1,fields_revision:O};h.push(v)}this.dispatch(n(c));const f=this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:{submitted_at:d,attachments:h,files:Object.values(l)},blockers:c.map(S=>S.fields_revision),blocks:c.map(S=>S.uuid)});return f.then(S=>{this.client.files.processPresignedUrls(S.presigned_urls),this.dispatch(a(S.attachments))}).catch(()=>{this.dispatch(r(c.map(S=>S.uuid)))}),[c,f.then(({attachments:S})=>S)]}async refreshStore(e,n){const{initialize:a}=this.actions,r=await this.list({queryParams:{fields_revision__asset_procedure_type__organization:e}},n);return this.dispatch(a(r)),r}}class cM extends k{constructor(){super(...arguments);m(this,"name","Asset Procedure Type Fields");m(this,"url","/asset-procedure-type-fields");m(this,"actions",{addOne:Ir,addMany:Fr,setOne:Pr,setMany:gr,updateOne:br,updateMany:_r,deleteOne:Rr,deleteMany:Mr,initialize:Or});m(this,"selectors",{selectById:Er,selectByIds:Vr})}add(e){var f;const{store:n}=this.client,{addOne:a,setOne:r,deleteOne:d}=this.actions,o=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,l=new Date().toISOString(),c=_({...e,created_by:o,submitted_at:l});this.dispatch(a(c));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(c),blockers:[c.asset_procedure_type],blocks:[c.uuid]});return h.then(y=>{this.dispatch(r(y))}).catch(y=>{throw this.dispatch(d(c.uuid)),y}),[c,h]}async refreshStore(e,n){const{initialize:a}=this.actions,r=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(r)),r}}function ht(t,s){const e=[];let n=0;const a=t.length;for(;n<a;)e.push(t.slice(n,n+=s));return e}class rM extends k{constructor(){super(...arguments);m(this,"name","Asset Procedure Type Field Values Attachment");m(this,"url","/asset-procedure-type-field-values-attachments");m(this,"actions",{addOne:zr,addMany:Ws,setOne:qr,setMany:jr,updateOne:Cr,updateMany:Dr,deleteOne:$r,deleteMany:Bs,initialize:Br});m(this,"selectors",{selectById:Nr,selectByIds:Hr})}async bulkAdd(e,n){var S;const{addMany:a,setMany:r,deleteMany:d}=this.actions,o=new Date().toISOString(),l=((S=this.client.store.getState().userReducer.currentUser)==null?void 0:S.id)??null,c=ht(e,Math.min(n??e.length,U)),h=[],f=[];for(const O of c){const P={},I=[];for(const F of O){const{fieldValuesUuid:g,fieldIdentifier:v,file:V}=F,W=await this.client.files.getFilePayload(V);W.sha1 in P||(P[W.sha1]=W);const j=_({file:URL.createObjectURL(V),file_type:V.type,file_name:V.name,file_sha1:W.sha1,created_by:l,field_values:g,submitted_at:o,field_identifier:v});h.push(j);const z={uuid:j.uuid,file_name:V.name,file_sha1:W.sha1,file_extension:W.extension,field_identifier:v,field_values:g};I.push(z)}f.push({submitted_at:o,attachments:I,files:Object.values(P)})}this.dispatch(a(h));const y=f.map(O=>this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:O,blockers:O.attachments.map(P=>P.field_values),blocks:O.attachments.map(P=>P.uuid)}));return Promise.all(y).then(O=>{for(const I of O)this.client.files.processPresignedUrls(I.presigned_urls);const P=O.flatMap(I=>I.attachments);this.dispatch(r(P))}).catch(O=>{throw this.dispatch(d(h.map(P=>P.uuid))),O}),[h,y.map(O=>O.then(({attachments:P})=>P))]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:r}=this.actions,{selectByIds:d}=this.selectors,o=n.getState(),l=d(e)(o);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!0),method:p.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(r(l)),c}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{field_values__asset_procedure__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class dM extends k{constructor(){super(...arguments);m(this,"name","Asset Procedure Type Field Values");m(this,"url","/asset-procedure-type-field-values");m(this,"actions",{addOne:Zr,addMany:Jr,setOne:Qr,setMany:Xr,updateOne:xr,updateMany:ed,deleteOne:td,deleteMany:sd,initialize:Yr});m(this,"selectors",{selectById:ad,selectByIds:cd})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:r,deleteOne:d}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,c=new Date().toISOString(),h=_({...e,created_by:l,submitted_at:c}),f=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(h),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[h.uuid]});return this.dispatch(a(h)),f.then(S=>{this.dispatch(r(S))}).catch(()=>{this.dispatch(d(h.uuid))}),[h,f]}bulkAdd(e,n){var P;const{values:a,payloads:r}=e,{addMany:d,setMany:o,deleteMany:l}=this.actions,c=new Date().toISOString(),h=((P=this.client.store.getState().userReducer.currentUser)==null?void 0:P.id)??null,f=[],y=ht(r,Math.min(n??r.length,U)),S=[];for(const I of y){const F=[];for(const g of I){const v=_({...g,values:g.values,created_by:h,submitted_at:c});f.push(v),F.push({uuid:v.uuid,asset:g.asset,fields_revision:g.fields_revision,asset_procedure:g.asset_procedure,published_at:g.published_at,values:v.values})}S.push({submitted_at:c,values:a,field_values:F})}this.dispatch(d(f));const O=[];for(const I of S){const{field_values:F}=I,g=F.map(({asset:z})=>z),v=F.map(({fields_revision:z})=>z),V=F.map(({asset_procedure:z})=>z),W=F.map(({uuid:z})=>z),j=this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:I,blockers:g.concat(v).concat(V),blocks:W});O.push(j)}return Promise.all(O).then(I=>{this.dispatch(o(I.flat()))}).catch(()=>{this.dispatch(l(B(f)))}),[f,O]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:r}=this.selectors,d=n.getState(),o=r(e.uuid)(d);if(!o)throw new Error(`Expected AssetProcedureTypeFieldValues with uuid ${e.uuid} to exist`);const l={...o,...e};this.dispatch(a(l));const c=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[l.fields_revision,l.asset,l.asset_procedure],blocks:[l.uuid]});return c.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(o))}),[l,c]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:r}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected submission with uuid ${e} to exist`);const c=Gr(e)(o);this.dispatch(a(e)),this.dispatch(Bs(B(c)));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(r(l)),this.dispatch(Ws(c)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{asset_procedure__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class lM extends k{constructor(){super(...arguments);m(this,"name","Asset Procedure");m(this,"url","/asset-procedures");m(this,"actions",{addOne:ld,addMany:Cs,setOne:pd,setMany:md,updateOne:od,updateMany:ud,deleteOne:hd,deleteMany:Ds,initialize:dd});m(this,"selectors",{selectById:Ad,selectByIds:wd})}add(e){var f;const{store:n}=this.client,{addOne:a,setOne:r,deleteOne:d}=this.actions,o=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,l=new Date().toISOString(),c=_({...e,created_by:o,submitted_at:l});this.dispatch(a(c));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(c),blockers:[e.asset_procedure_type,e.asset_type],blocks:[c.uuid]});return h.then(y=>{this.dispatch(r(y))}).catch(()=>{this.dispatch(d(c.uuid))}),[c,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:r}=this.selectors,d=r(e.uuid)(n.getState());if(!d)throw new Error(`Expected asset procedure with uuid ${e.uuid} to exist`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[d.uuid],blocks:[d.uuid]});return l.then(c=>{this.dispatch(a(c))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:r}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected asset procedure with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(r(l)),c}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(d)),d}}class oM extends k{constructor(){super(...arguments);m(this,"name","Asset Procedure Type");m(this,"url","/asset-procedure-types");m(this,"actions",{addOne:Id,addMany:Fd,setOne:Rd,setMany:Md,updateOne:Pd,updateMany:gd,deleteOne:bd,deleteMany:_d,initialize:Od});m(this,"selectors",{selectById:Ed,selectByIds:Vd})}add(e){var f;const{store:n}=this.client,{addOne:a,setOne:r,deleteOne:d}=this.actions,o=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,l=new Date().toISOString(),c=_({...e,created_by:o,submitted_at:l});this.dispatch(a(c));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(c),blockers:[],blocks:[c.uuid]});return h.then(y=>{this.dispatch(r(y))}).catch(()=>{this.dispatch(d(c.uuid))}),[c,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:r}=this.selectors,d=r(e.uuid)(n.getState());if(!d)throw new Error(`Expected asset procedure type with uuid ${e.uuid} to exist`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[d.uuid],blocks:[d.uuid]});return l.then(c=>{this.dispatch(a(c))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:r}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected asset procedure type with uuid ${e} to exist`);const c=Sd(e)(o);this.dispatch(a(e)),this.dispatch(Ds(B(c)));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(r(l)),this.dispatch(Cs(c)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,r=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(r)),r}}class uM extends k{constructor(){super(...arguments);m(this,"name","Asset Procedure Step Fields Attachment");m(this,"url","/asset-procedure-step-fields-attachments");m(this,"actions",{addOne:zd,addMany:qd,setOne:jd,setMany:Cd,updateOne:Dd,updateMany:$d,deleteOne:Ud,deleteMany:Ld,initialize:Bd});m(this,"selectors",{selectById:Hd,selectByIds:Gd})}async bulkAdd(e){var y;const{addMany:n,setMany:a,deleteMany:r}=this.actions,d=new Date().toISOString(),o=((y=this.client.store.getState().userReducer.currentUser)==null?void 0:y.id)??null,l={},c=[],h=[];for(const S of e){const{fieldsRevisionUuid:O,fieldIdentifier:P,file:I}=S,F=await this.client.files.getFilePayload(I);F.sha1 in l||(l[F.sha1]=F);const g=_({file:URL.createObjectURL(I),file_type:I.type,file_name:I.name,file_sha1:F.sha1,created_by:o,fields_revision:O,submitted_at:d,field_identifier:P});c.push(g);const v={uuid:g.uuid,file_name:I.name,field_identifier:P,file_extension:F.extension,file_sha1:F.sha1,fields_revision:O};h.push(v)}this.dispatch(n(c));const f=this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:{submitted_at:d,attachments:h,files:Object.values(l)},blockers:c.map(S=>S.fields_revision),blocks:c.map(S=>S.uuid)});return f.then(S=>{this.client.files.processPresignedUrls(S.presigned_urls),this.dispatch(a(S.attachments))}).catch(()=>{this.dispatch(r(c.map(S=>S.uuid)))}),[c,f.then(({attachments:S})=>S)]}async refreshStore(e,n){const{initialize:a}=this.actions,r=await this.list({queryParams:{fields_revision__asset_procedure_step__organization:e}},n);return this.dispatch(a(r)),r}}class hM extends k{constructor(){super(...arguments);m(this,"name","Asset Procedure Step Fields");m(this,"url","/asset-procedure-step-fields");m(this,"actions",{addOne:Jd,addMany:Qd,setOne:Xd,setMany:xd,updateOne:el,updateMany:tl,deleteOne:sl,deleteMany:il,initialize:Zd});m(this,"selectors",{selectById:nl,selectByIds:al})}add(e){var f;const{store:n}=this.client,{addOne:a,setOne:r,deleteOne:d}=this.actions,o=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,l=new Date().toISOString(),c=_({...e,created_by:o,submitted_at:l});this.dispatch(a(c));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(c),blockers:[c.asset_procedure_step],blocks:[c.uuid]});return h.then(y=>{this.dispatch(r(y))}).catch(y=>{throw this.dispatch(d(c.uuid)),y}),[c,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,r=n.getState().assetProcedureStepFieldsReducer.instances[e.uuid];if(!r)throw new Error(`AssetProcedureStepFields with uuid ${e.uuid} not found`);const d={...r,...e};this.dispatch(a(d));const o=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${r.uuid}/`,payload:e,blockers:[r.uuid],blocks:[r.uuid]});return o.then(l=>{this.dispatch(a(l))}).catch(l=>{throw this.dispatch(a(r)),l}),[d,o]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:r}=this.actions,d=n.getState().assetProcedureStepFieldsReducer.instances[e];if(!d)throw new Error(`AssetProcedureStepFields with uuid ${e} not found`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(o){throw this.dispatch(r(d)),o}}async refreshStore(e,n){const{initialize:a}=this.actions,r=await this.list({queryParams:{asset_procedure_step__asset_procedure_type__organization:e}},n);return this.dispatch(a(r)),r}}class pM extends k{constructor(){super(...arguments);m(this,"name","Asset Procedure Step Field Values Attachment");m(this,"url","/asset-procedure-step-field-values-attachments");m(this,"actions",{addOne:ll,addMany:Ys,setOne:ol,setMany:ul,updateOne:hl,updateMany:pl,deleteOne:ml,deleteMany:Zs,initialize:dl});m(this,"selectors",{selectById:yl,selectByIds:Sl})}async bulkAdd(e,n){var S;const{addMany:a,setMany:r,deleteMany:d}=this.actions,o=new Date().toISOString(),l=((S=this.client.store.getState().userReducer.currentUser)==null?void 0:S.id)??null,c=ht(e,Math.min(n??e.length,U)),h=[],f=[];for(const O of c){const P={},I=[];for(const F of O){const{fieldValuesUuid:g,fieldIdentifier:v,file:V}=F,W=await this.client.files.getFilePayload(V);W.sha1 in P||(P[W.sha1]=W);const j=_({file:URL.createObjectURL(V),file_type:V.type,file_name:V.name,file_sha1:W.sha1,created_by:l,field_values:g,submitted_at:o,field_identifier:v});h.push(j);const z={uuid:j.uuid,file_name:V.name,file_sha1:W.sha1,file_extension:W.extension,field_identifier:v,field_values:g};I.push(z)}f.push({submitted_at:o,attachments:I,files:Object.values(P)})}this.dispatch(a(h));const y=f.map(O=>this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:O,blockers:O.attachments.map(P=>P.field_values),blocks:O.attachments.map(P=>P.uuid)}));return Promise.all(y).then(O=>{for(const I of O)this.client.files.processPresignedUrls(I.presigned_urls);const P=O.flatMap(I=>I.attachments);this.dispatch(r(P))}).catch(O=>{throw this.dispatch(d(h.map(P=>P.uuid))),O}),[h,y.map(O=>O.then(({attachments:P})=>P))]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:r}=this.actions,{selectByIds:d}=this.selectors,o=n.getState(),l=d(e)(o);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!0),method:p.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(r(l)),c}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{field_values__asset_procedure__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class mM extends k{constructor(){super(...arguments);m(this,"name","Asset Procedure Step Field Values");m(this,"url","/asset-procedure-step-field-values");m(this,"actions",{addOne:Il,addMany:Fl,setOne:Pl,setMany:gl,updateOne:bl,updateMany:_l,deleteOne:Rl,deleteMany:Ml,initialize:Ol});m(this,"selectors",{selectById:vl,selectByIds:El})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:r,deleteOne:d}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,c=new Date().toISOString(),h=_({...e,created_by:l,submitted_at:c}),f=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(h),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[h.uuid]});return this.dispatch(a(h)),f.then(S=>{this.dispatch(r(S))}).catch(()=>{this.dispatch(d(h.uuid))}),[h,f]}bulkAdd(e,n){var P;const{payloads:a,values:r}=e,{addMany:d,setMany:o,deleteMany:l}=this.actions,c=new Date().toISOString(),h=((P=this.client.store.getState().userReducer.currentUser)==null?void 0:P.id)??null,f=[],y=ht(a,Math.min(n??a.length,U)),S=[];for(const I of y){const F=[];for(const g of I){const v=_({...g,values:g.values,created_by:h,submitted_at:c});f.push(v),F.push({uuid:v.uuid,asset:g.asset,fields_revision:g.fields_revision,asset_procedure:g.asset_procedure,asset_procedure_step:g.asset_procedure_step,published_at:g.published_at,values:v.values})}S.push({submitted_at:c,values:r,field_values:F})}this.dispatch(d(f));const O=[];for(const I of S){const{field_values:F}=I,g=F.map(({asset:z})=>z),v=F.map(({fields_revision:z})=>z),V=F.map(({asset_procedure:z})=>z),W=F.map(({uuid:z})=>z),j=this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:I,blockers:g.concat(v).concat(V),blocks:W});O.push(j)}return Promise.all(O).then(I=>{this.dispatch(o(I.flat()))}).catch(()=>{this.dispatch(l(B(f)))}),[f,O]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:r}=this.selectors,d=n.getState(),o=r(e.uuid)(d);if(!o)throw new Error(`Expected AssetProcedureStepFieldValues with uuid ${e.uuid} to exist`);const l={...o,...e};this.dispatch(a(l));const c=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[l.fields_revision,l.asset,l.asset_procedure],blocks:[l.uuid]});return c.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(o))}),[l,c]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:r}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected submission with uuid ${e} to exist`);const c=Al(e)(o);this.dispatch(a(e)),this.dispatch(Zs(B(c)));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(r(l)),this.dispatch(Ys(c)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{asset_procedure__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class fM extends k{constructor(){super(...arguments);m(this,"name","Asset Procedure Step");m(this,"url","/asset-procedure-steps");m(this,"actions",{addOne:jl,addMany:Cl,setOne:zl,setMany:ql,updateOne:Dl,updateMany:$l,deleteOne:Ul,deleteMany:Ll,initialize:Bl});m(this,"selectors",{selectById:Hl,selectByIds:Gl})}add(e){var f;const{store:n}=this.client,{addOne:a,setOne:r,deleteOne:d}=this.actions,o=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,l=new Date().toISOString(),c=_({...e,created_by:o,submitted_at:l});this.dispatch(a(c));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(c),blockers:[c.asset_procedure_type],blocks:[c.uuid]});return h.then(y=>{this.dispatch(r(y))}).catch(()=>{this.dispatch(d(c.uuid))}),[c,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:r}=this.selectors,d=r(e.uuid)(n.getState());if(!d)throw new Error(`No asset procedure step with uuid ${e.uuid} found in the store`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${d.uuid}/`,payload:{name:e.name,description:e.description,priority:e.order,color:e.color},blockers:[d.uuid],blocks:[d.uuid]});return l.then(c=>{this.dispatch(a(c))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteMany:a,addMany:r,addOne:d,deleteOne:o}=this.actions,{selectById:l}=this.selectors,c=n.getState(),h=l(e)(c);if(!h)throw new Error(`No asset procedure step with uuid ${e} found in the store`);const f=Kl(e)(c);this.dispatch(o(e)),this.dispatch(a(B(f)));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(y){throw this.dispatch(d(h)),this.dispatch(r(f)),y}}async refreshStore(e,n){const{initialize:a}=this.actions,r=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(r)),r}}class yM extends k{constructor(){super(...arguments);m(this,"url","/assets");m(this,"name","Asset");m(this,"actions",{addOne:Jl,addMany:ti,setOne:eo,setMany:to,updateOne:Ql,updateMany:Xl,deleteOne:xl,deleteMany:si,initialize:Zl});m(this,"selectors",{selectById:no,selectByIds:ao})}add(e){var f;const{store:n}=this.client,{addOne:a,updateOne:r,deleteOne:d}=this.actions,o=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,l=new Date().toISOString(),c=_({...e,created_by:o,submitted_at:l});this.dispatch(a(c));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(c),blockers:[c.asset_type],blocks:[c.uuid]});return h.then(y=>{this.dispatch(r(y))}).catch(()=>{this.dispatch(d(c.uuid))}),[c,h]}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:r}=this.selectors,d=r(e.uuid)(n.getState());if(!d)throw new Error(`No asset with uuid ${e.uuid} found in the store`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return l.then(c=>{this.dispatch(a(c))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{addOne:a,deleteOne:r}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`No asset with uuid ${e} found in the store`);const c=Nc(e)(o),h=ay(e)(o);this.dispatch(r(e)),this.dispatch(bs(B(c))),this.dispatch(Zt(B(h)));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(f){throw this.dispatch(a(l)),this.dispatch(gs(c)),this.dispatch(Yt(h)),f}}bulkAdd(e,n){const{addMany:a}=this.actions,r=new Date().toISOString(),d=pt.v4(),o=ht(e,Math.min(n??e.length,U)).map(h=>{const f=h.map(y=>_(y));return{batchId:pt.v4(),payload:{transaction_id:d,submitted_at:r,assets:f}}}),l=[];let c=null;for(const h of o){const{batchId:f,payload:y}=h,S=y.assets.map(({uuid:g})=>g),O=y.assets.map(({asset_type:g})=>g),P=y.assets.map(({project:g})=>g),I=y.assets.map(({status:g})=>g),F=this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:y,blockers:(c?[c]:[]).concat(O).concat(P).concat(I),blocks:[f].concat(S)});c=h.batchId,l.push(F)}return Promise.all(l).then(h=>{const f=h.flat();this.dispatch(a(f))}),l}bulkUpdate(e,n){const{store:a}=this.client,{updateMany:r}=this.actions,{selectByIds:d}=this.selectors,o=B(e).toSorted(Wt);if(o.length!==e.length)throw new Error("payloads contains duplicate uuids.");const l=d(o)(a.getState()).toSorted(Os);if(o.length!=l.length)throw new Error(`Attempting to bulk update ${o.length-l.length} assets that dont exist in the store`);const c=[];for(let S=0;S<o.length;S++)c.push({...l[S],...e[S]});this.dispatch(r(c));const h=ht(e,Math.min(n??e.length,U)),f=[];let y=null;for(const S of h){const O=pt.v4(),P=B(S),I=S.map(({status:g})=>g).filter(Boolean),F=this.enqueueRequest({description:T(p.PATCH,this.name,!0),method:p.PATCH,url:`${this.url}/bulk/`,payload:{payloads:S},blockers:(y?[y]:[]).concat(P).concat(I),blocks:[O].concat(P)});f.push(F),y=O}return Promise.all(f).then(S=>{this.dispatch(r(S.flat()))}).catch(()=>{this.dispatch(r(l))}),[c,f]}async bulkDelete(e){const{store:n}=this.client,{addMany:a,deleteMany:r}=this.actions,{selectByIds:d}=this.selectors,o=n.getState(),l=d(e)(o);this.dispatch(r(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!0),method:p.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(a(l)),c}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(d)),d}}class SM extends k{constructor(){super(...arguments);m(this,"name","Asset Stage Completion");m(this,"url","/asset-stage-completions");m(this,"actions",{addOne:oo,addMany:uo,setOne:ho,setMany:po,updateOne:mo,updateMany:fo,deleteOne:yo,deleteMany:So,initialize:lo});m(this,"selectors",{selectById:Oo,selectByIds:Io})}add(e){var f;const{store:n}=this.client,{addOne:a,setOne:r,deleteOne:d}=this.actions,o=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,l=new Date().toISOString(),c=_({...e,created_by:o,submitted_at:l});this.dispatch(a(c));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(c),blockers:[e.asset,e.asset_stage],blocks:[c.uuid]});return h.then(y=>{this.dispatch(r(y))}).catch(()=>{this.dispatch(d(c.uuid))}),[c,h]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:r}=this.actions,{selectById:d}=this.selectors,o=d(e)(n.getState());if(!o)throw new Error(`Expected asset stage completion with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(l){throw this.dispatch(r(o)),l}}bulkAdd(e){var S;const{store:n}=this.client,{addMany:a,setMany:r,deleteMany:d}=this.actions,o=new Date().toISOString(),l=((S=n.getState().userReducer.currentUser)==null?void 0:S.id)??null,c=e.map(O=>_(O)),h=c.map(O=>({...O,created_by:l,submitted_at:o})),f=h.map(({uuid:O})=>O);this.dispatch(a(h));const y=this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:{submitted_at:o,completions:c},blockers:[...e.map(O=>O.asset_procedure),...e.map(O=>O.asset_stage),...e.map(O=>O.asset)],blocks:f});return y.then(O=>{this.dispatch(r(O))}).catch(()=>{this.dispatch(d(f))}),[h,y]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:r}=this.actions,{selectByIds:d}=this.selectors,o=d(e)(n.getState());this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!0),method:p.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(l){throw this.dispatch(r(o)),l}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{asset_procedure__project:e}},n)).flat();return this.dispatch(a(d)),d}}class AM extends k{constructor(){super(...arguments);m(this,"name","Asset Stage");m(this,"url","/asset-stages");m(this,"actions",{addOne:_o,addMany:Ro,setOne:go,setMany:bo,updateOne:Mo,updateMany:ko,deleteOne:vo,deleteMany:Eo,initialize:Po});m(this,"selectors",{selectById:Wo,selectByIds:Bo})}add(e){var f;const{store:n}=this.client,{addOne:a,setOne:r,deleteOne:d}=this.actions,o=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,l=new Date().toISOString(),c=_({...e,created_by:o,submitted_at:l});this.dispatch(a(c));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(c),blockers:[c.asset_procedure_type],blocks:[c.uuid]});return h.then(y=>{this.dispatch(r(y))}).catch(()=>{this.dispatch(d(c.uuid))}),[c,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:r}=this.selectors,d=r(e.uuid)(n.getState());if(!d)throw new Error(`No asset stage with uuid ${e.uuid} found in the store`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${d.uuid}/`,payload:e,blockers:[d.uuid],blocks:[d.uuid]});return l.then(c=>{this.dispatch(a(c))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:r}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`No asset stage with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(r(l)),c}}async refreshStore(e,n){const{initialize:a}=this.actions,r=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(r)),r}}class wM extends L{constructor(){super(...arguments);m(this,"name","Asset Type Attachment");m(this,"url","/asset-type-attachments");m(this,"actions",{addOne:jo,addMany:di,setOne:Co,setMany:Do,updateOne:$o,updateMany:Uo,deleteOne:Lo,deleteMany:li,initialize:qo});m(this,"selectors",{selectById:Ho,selectByIds:Go})}getId(e){return e.uuid}buildModel(e){return _({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,asset_type:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,asset_type:e.asset_type}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.assetTypeUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,r=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(a(r)),r}}class TM extends k{constructor(){super(...arguments);m(this,"name","Asset Type Fields Attachment");m(this,"url","/asset-type-fields-attachments");m(this,"actions",{addOne:Qo,addMany:Xo,setOne:xo,setMany:eu,updateOne:tu,updateMany:su,deleteOne:iu,deleteMany:nu,initialize:Jo});m(this,"selectors",{selectById:cu,selectByIds:ru})}async bulkAdd(e){var y;const{addMany:n,setMany:a,deleteMany:r}=this.actions,d=new Date().toISOString(),o=((y=this.client.store.getState().userReducer.currentUser)==null?void 0:y.id)??null,l={},c=[],h=[];for(const S of e){const{fieldsRevisionUuid:O,fieldIdentifier:P,file:I}=S,F=await this.client.files.getFilePayload(I);F.sha1 in l||(l[F.sha1]=F);const g=_({file:URL.createObjectURL(I),file_type:I.type,file_name:I.name,file_sha1:F.sha1,created_by:o,fields_revision:O,submitted_at:d,field_identifier:P});c.push(g);const v={uuid:g.uuid,file_name:I.name,field_identifier:P,file_extension:F.extension,file_sha1:F.sha1,fields_revision:O};h.push(v)}this.dispatch(n(c));const f=this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:{submitted_at:d,attachments:h,files:Object.values(l)},blockers:c.map(S=>S.fields_revision),blocks:c.map(S=>S.uuid)});return f.then(S=>{this.client.files.processPresignedUrls(S.presigned_urls),this.dispatch(a(S.attachments))}).catch(()=>{this.dispatch(r(c.map(S=>S.uuid)))}),[c,f.then(({attachments:S})=>S)]}async refreshStore(e,n){const{initialize:a}=this.actions,r=await this.list({queryParams:{fields_revision__asset_type__organization:e}},n);return this.dispatch(a(r)),r}}class OM extends k{constructor(){super(...arguments);m(this,"name","Asset Type Fields");m(this,"url","/asset-type-fields");m(this,"actions",{addOne:uu,addMany:hu,setOne:pu,setMany:mu,updateOne:fu,updateMany:yu,deleteOne:Su,deleteMany:Au,initialize:ou});m(this,"selectors",{selectById:Tu,selectByIds:Ou})}add(e){var f;const{store:n}=this.client,{addOne:a,setOne:r,deleteOne:d}=this.actions,o=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,l=new Date().toISOString(),c=_({...e,created_by:o,submitted_at:l});this.dispatch(a(c));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(c),blockers:[c.asset_type],blocks:[c.uuid]});return h.then(y=>{this.dispatch(r(y))}).catch(y=>{throw this.dispatch(d(c.uuid)),y}),[c,h]}async refreshStore(e,n){const{initialize:a}=this.actions,r=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(a(r)),r}}class IM extends k{constructor(){super(...arguments);m(this,"name","Asset Type Field Values Attachment");m(this,"url","/asset-type-field-values-attachments");m(this,"actions",{addOne:gu,addMany:fi,setOne:bu,setMany:_u,updateOne:Ru,updateMany:Mu,deleteOne:ku,deleteMany:yi,initialize:Pu});m(this,"selectors",{selectById:Eu,selectByIds:Vu})}async bulkAdd(e,n){var S;const{addMany:a,setMany:r,deleteMany:d}=this.actions,o=new Date().toISOString(),l=((S=this.client.store.getState().userReducer.currentUser)==null?void 0:S.id)??null,c=ht(e,Math.min(n??e.length,U)),h=[],f=[];for(const O of c){const P={},I=[];for(const F of O){const{fieldValuesUuid:g,fieldIdentifier:v,file:V}=F,W=await this.client.files.getFilePayload(V);W.sha1 in P||(P[W.sha1]=W);const j=_({file:URL.createObjectURL(V),file_type:V.type,file_name:V.name,file_sha1:W.sha1,created_by:l,field_values:g,submitted_at:o,field_identifier:v});h.push(j);const z={uuid:j.uuid,file_name:V.name,file_sha1:W.sha1,file_extension:W.extension,field_identifier:v,field_values:g};I.push(z)}f.push({submitted_at:o,attachments:I,files:Object.values(P)})}this.dispatch(a(h));const y=f.map(O=>this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:O,blockers:O.attachments.map(P=>P.field_values),blocks:O.attachments.map(P=>P.uuid)}));return Promise.all(y).then(O=>{for(const I of O)this.client.files.processPresignedUrls(I.presigned_urls);const P=O.flatMap(I=>I.attachments);this.dispatch(r(P))}).catch(O=>{throw this.dispatch(d(h.map(P=>P.uuid))),O}),[h,y.map(O=>O.then(({attachments:P})=>P))]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:r}=this.actions,{selectByIds:d}=this.selectors,o=n.getState(),l=d(e)(o);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!0),method:p.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(r(l)),c}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{field_values__asset__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class FM extends k{constructor(){super(...arguments);m(this,"name","Asset Type Field Values");m(this,"url","/asset-type-field-values");m(this,"actions",{addOne:ju,addMany:Cu,setOne:Du,setMany:$u,updateOne:Uu,updateMany:Lu,deleteOne:Nu,deleteMany:Hu,initialize:qu});m(this,"selectors",{selectById:Ku,selectByIds:Yu})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:r,deleteOne:d}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,c=new Date().toISOString(),h=_({...e,created_by:l,submitted_at:c}),f=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(h),blockers:[e.asset,e.fields_revision],blocks:[h.uuid]});return this.dispatch(a(h)),f.then(S=>{this.dispatch(r(S))}).catch(()=>{this.dispatch(d(h.uuid))}),[h,f]}bulkAdd(e,n){var O;const{payloads:a,values:r}=e,{addMany:d,setMany:o,deleteMany:l}=this.actions,c=new Date().toISOString(),h=[],f=ht(a,Math.min(n??a.length,U)),y=[];for(const P of f){const I=[];for(const F of P){const g=_({...F,values:F.values,created_by:((O=this.client.store.getState().userReducer.currentUser)==null?void 0:O.id)??null,submitted_at:c});h.push(g),I.push({uuid:g.uuid,asset:F.asset,fields_revision:F.fields_revision,published_at:F.published_at,values:g.values})}y.push({submitted_at:c,values:r,field_values:I})}this.dispatch(d(h));const S=[];for(const P of y){const{field_values:I}=P,F=I.map(({asset:W})=>W),g=I.map(({fields_revision:W})=>W),v=I.map(({uuid:W})=>W),V=this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:P,blockers:F.concat(g),blocks:v});S.push(V)}return Promise.all(S).then(P=>{this.dispatch(o(P.flat()))}).catch(()=>{this.dispatch(l(B(h)))}),[h,S]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:r}=this.selectors,d=n.getState(),o=r(e.uuid)(d);if(!o)throw new Error(`Expected AssetTypeFieldValues with uuid ${e.uuid} to exist`);const l={...o,...e};this.dispatch(a(l));const c=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[l.uuid,l.fields_revision,l.asset],blocks:[l.uuid]});return c.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(o))}),[l,c]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:r}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected submission with uuid ${e} to exist`);const c=Wu(e)(o);this.dispatch(a(e)),this.dispatch(yi(B(c)));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(r(l)),this.dispatch(fi(c)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{asset__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class PM extends k{constructor(){super(...arguments);m(this,"name","Asset Type Identifier");m(this,"url","/asset-type-identifiers");m(this,"actions",{addOne:Xu,addMany:xu,setOne:eh,setMany:th,updateOne:sh,updateMany:ih,deleteOne:nh,deleteMany:ah,initialize:Qu});m(this,"selectors",{selectById:rh,selectByIds:dh})}add(e){var f;const{store:n}=this.client,{addOne:a,setOne:r,deleteOne:d}=this.actions,o=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,l=new Date().toISOString(),c=_({...e,created_by:o,submitted_at:l});this.dispatch(a(c));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(c),blockers:[c.asset_type],blocks:[c.uuid]});return h.then(y=>{this.dispatch(r(y))}).catch(()=>{this.dispatch(d(c.uuid))}),[c,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:r}=this.selectors,d=r(e.uuid)(n.getState());if(!d)throw new Error(`Expected asset type identifier with uuid ${e.uuid} to exist`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return l.then(c=>{this.dispatch(a(c))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:r}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected asset type identifier with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(r(l)),c}}async refreshStore(e,n){const{initialize:a}=this.actions,r=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(a(r)),r}}class gM extends k{constructor(){super(...arguments);m(this,"name","Asset Type Identifier Value");m(this,"url","/asset-type-identifier-values");m(this,"actions",{addOne:hh,addMany:ph,setOne:mh,setMany:fh,updateOne:yh,updateMany:Sh,deleteOne:Ah,deleteMany:wh,initialize:uh});m(this,"selectors",{selectById:Oh,selectByIds:Ih})}add(e){var f;const{store:n}=this.client,{addOne:a,setOne:r,deleteOne:d}=this.actions,o=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,l=new Date().toISOString(),c=_({...e,created_by:o,submitted_at:l});this.dispatch(a(c));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(c),blockers:[e.asset,e.asset_type_identifier],blocks:[c.uuid]});return h.then(y=>{this.dispatch(r(y))}).catch(()=>{this.dispatch(d(c.uuid))}),[c,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:r}=this.selectors,d=r(e.uuid)(n.getState());if(!d)throw new Error(`Expected asset type identifier value with uuid ${e.uuid} to exist`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return l.then(c=>{this.dispatch(a(c))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:r}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected asset type identifier value with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(r(l)),c}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{asset__project:e}},n)).flat();return this.dispatch(a(d)),d}}class bM extends k{constructor(){super(...arguments);m(this,"name","Asset Type");m(this,"url","/asset-types");m(this,"actions",{addOne:Rh,addMany:Mh,setOne:bh,setMany:_h,updateOne:kh,updateMany:vh,deleteOne:Eh,deleteMany:Vh,initialize:gh});m(this,"selectors",{selectById:Bh,selectByIds:zh})}add(e){var f;const{store:n}=this.client,{addOne:a,setOne:r,deleteOne:d}=this.actions,o=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,l=new Date().toISOString(),c=_({...e,created_by:o,submitted_at:l});this.dispatch(a(c));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(c),blockers:[],blocks:[c.uuid]});return h.then(y=>{this.dispatch(r(y))}).catch(()=>{this.dispatch(d(c.uuid))}),[c,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:r}=this.selectors,d=r(e.uuid)(n.getState());if(!d)throw new Error(`Expected asset type with uuid ${e.uuid} to exist`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[d.uuid],blocks:[d.uuid]});return l.then(c=>{this.dispatch(a(c))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:r}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected asset type with uuid ${e} to exist`);const c=io(e)(o),h=Ko(e)(o);this.dispatch(a(e)),this.dispatch(si(B(c))),this.dispatch(li(B(h)));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(f){throw this.dispatch(r(l)),this.dispatch(ti(c)),this.dispatch(di(h)),f}}async refreshStore(e,n){const{initialize:a}=this.actions,r=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(r)),r}}class _M extends k{constructor(){super(...arguments);m(this,"name","Asset Type Status");m(this,"url","/asset-type-statuses");m(this,"actions",{addOne:Dh,addMany:$h,setOne:Uh,setMany:Lh,updateOne:Nh,updateMany:Hh,deleteOne:Gh,deleteMany:Kh,initialize:Ch});m(this,"selectors",{selectById:Zh,selectByIds:Jh})}add(e){var f;const{store:n}=this.client,{addOne:a,setOne:r,deleteOne:d}=this.actions,o=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,l=new Date().toISOString(),c=_({...e,created_by:o,submitted_at:l});this.dispatch(a(c));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(c),blockers:[e.asset_type],blocks:[c.uuid]});return h.then(y=>{this.dispatch(r(y))}).catch(()=>{this.dispatch(d(c.uuid))}),[c,h]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,r=this.client.store.getState(),d=a(e.uuid)(r);if(!d)throw new Error(`Expected an existing asset type status with uuid ${e.uuid}`);const o={...d,...e};this.dispatch(n(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return l.then(c=>{this.dispatch(n(c))}).catch(()=>{this.dispatch(n(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:r}=this.actions,{selectById:d}=this.selectors,o=d(e)(n.getState());if(!o)throw new Error(`No asset type status with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(l){throw this.dispatch(r(o)),l}}async refreshStore(e,n){const{initialize:a}=this.actions,r=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(a(r)),r}}class RM extends L{constructor(){super(...arguments);m(this,"name","Document Attachment");m(this,"url","/document-attachments");m(this,"actions",{addOne:ip,addMany:np,setOne:ap,setMany:cp,updateOne:rp,updateMany:dp,deleteOne:lp,deleteMany:op,initialize:sp});m(this,"selectors",{selectById:hp,selectByIds:pp})}getId(e){return e.uuid}buildModel(e){return _({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,document:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,document:e.document}}async bulkAdd(e){var O;const{store:n}=this.client,{addMany:a,updateMany:r,deleteMany:d}=this.actions,o=((O=n.getState().userReducer.currentUser)==null?void 0:O.id)??null,l=new Date().toISOString(),c=[],h=[],f={},y={};for(const P of e){const{documentUuid:I,file:F}=P,g=await this.client.files.getFilePayload(F);g.sha1 in f||(f[g.sha1]=g,y[g.sha1]=[]);const v=this.buildModel({file:F,file_sha1:g.sha1,submitted_at:l,created_by:o,modelUuid:I});c.push(v),h.push(this.buildPayload(v,g)),y[g.sha1].push(v.uuid)}this.dispatch(a(c));const S=this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:{submitted_at:l,attachments:h,files:Object.values(f)},blocks:c.map(P=>P.uuid),blockers:c.map(P=>P.file_sha1)});return S.then(({attachments:P,presigned_urls:I})=>{this.dispatch(r(P));const F=this.client.files.processPresignedUrls(I);for(const[g,v]of Object.entries(F))v.then(()=>{const V=y[g];for(const W of V)this.makeReadable(W)})}).catch(()=>{this.dispatch(d(c.map(P=>P.uuid)))}),[c,S.then(({attachments:P})=>P)]}async delete(e){return this._delete(e)}makeReadable(e){this.enqueueRequest({description:"Add attachment to AI assistant",method:p.PATCH,url:`${this.url}/${e}/`,payload:{readable_to_assistant:!0},blockers:["index-document-attachment",e],blocks:["index-document-attachment"]})}async refreshStore(e,n){const{initialize:a}=this.actions,r=this.list({queryParams:{document__project__organization:e}},n),d=this.list({queryParams:{document__organization:e}},n),l=(await Promise.all([r,d])).flat();return this.dispatch(a(l)),l}}class MM extends k{constructor(){super(...arguments);m(this,"name","Document");m(this,"url","/documents");m(this,"actions",{addOne:Sp,addMany:Ap,setOne:wp,setMany:Tp,updateOne:Op,updateMany:Ip,deleteOne:Fp,deleteMany:Pp,initialize:yp});m(this,"selectors",{selectById:bp,selectByIds:_p})}add(e){var f;const{store:n}=this.client,{addOne:a,deleteOne:r,updateOne:d}=this.actions,o=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,l=new Date().toISOString(),c=_({...e,created_by:o,submitted_at:l});this.dispatch(a(c));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(c),blockers:c.parent_document?[c.parent_document]:[],blocks:[c.uuid]});return h.then(y=>{this.dispatch(d(y))}).catch(()=>{this.dispatch(r(c.uuid))}),[c,h]}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:r}=this.selectors,d=r(e.uuid)(n.getState());if(!d)throw new Error(`attempting to update a document with uuid ${e.uuid} that does not exist in store.documents`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return l.then(c=>{this.dispatch(a(c))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:r,addMany:d,deleteMany:o}=this.actions,{selectById:l}=this.selectors,c=n.getState(),h=l(e)(c);if(!h)throw new Error(`attempting to delete a document with uuid ${e} that does not exist in store.documents`);const f=Rp(e)(c);this.dispatch(a(e)),this.dispatch(o(B(f)));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(y){throw this.dispatch(r(h)),this.dispatch(d(f)),y}}async refreshStore(e,n){const{initialize:a}=this.actions,r=this.list({queryParams:{project__organization:e}},n),d=this.list({queryParams:{organization:e}},n),l=(await Promise.all([r,d])).flat();return this.dispatch(a(l)),l}}class Tt extends ft{async get(s,e){return this.performRequest({url:`${this.url}/${s}/`,method:p.GET},e)}async list(s,e){return this.performRequest({url:`${this.url}/`,method:p.GET,...s},e)}async listPaginated(s,e){return this.performPagination({url:`${this.url}/`,method:p.GET,...s},e)}}class kM extends Tt{constructor(){super(...arguments);m(this,"name","Email Domains");m(this,"url","/organization-email-domains");m(this,"actions",{addOne:vp,addMany:Ep,setOne:Vp,setMany:Wp,updateOne:Bp,updateMany:zp,deleteOne:qp,deleteMany:jp,initialize:kp});m(this,"selectors",{selectById:Dp,selectByIds:$p})}async add(e,n){return this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:{email:n,organization:e},blockers:[e,"create-org"],blocks:[]})}async delete(e){const{deleteOne:n,addOne:a}=this.actions;this.dispatch(n(e.uuid));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e.uuid}/`,blockers:[e.domain],blocks:[]})}catch(r){throw this.dispatch(a(e)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,r=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(r)),r}}class vM extends ft{async getVerificationCode(s){return this.enqueueRequest({description:"Get verification code",method:p.GET,url:`/verification/email-verification/${s}/`,isAuthNeeded:!1,blockers:[],blocks:[]})}validateVerificationCode(s,e=void 0){return this.enqueueRequest({description:"Validate verification code",method:p.POST,url:`/verification/email-verification/${s}/`,isAuthNeeded:!1,payload:e,blockers:[],blocks:[]})}}const ps={},xa=new Set;let ms=0,ec=0,tc=0;const EM=20;class VM extends ft{constructor(){super(...arguments);m(this,"host");m(this,"_dbPromise",yb.openDB("fileCache",1,{upgrade(e){e.createObjectStore("files")}}))}async renewUploadUrl(e){const n=await this.fetchCache(e);if(!n)throw new Error(`File with sha1 ${e} not found in cache`);const a=await Ts(n,e),r=await this.enqueueRequest({description:"Get S3 URL",method:p.GET,url:"/authentication/files/presigned-upload-url/",queryParams:{sha1:await At(n),file_type:n.type,extension:n.name.split(".").pop(),size:n.size.toString()},blockers:[],blocks:[`s3-${a}`]});return"url"in r&&this.dispatch(Hp({sha1:e,...r})),r}async addCache(e,n){if(xa.has(n))return;if(!e.type){const d=e.name.split("."),o=d[d.length-1];e=new File([e],e.name,{type:o})}if(!e.name||!e.size||!e.type)throw new Error("Cannot add files to cache that do not have a name, size and type.");const a=await this._dbPromise;!!await a.get("files",n)?(console.error("File already cached (this is unexpected at this point):",e.name,n),ms++):(await a.put("files",e,n),ec++),xa.add(n),tc++,tc%EM===0&&console.debug(`File cache summary: ${ms} hits and ${ec} misses, ${ms/(ms+ec)*100}% hit rate over ${tc} calls to addCache.`)}async removeCache(e){await(await this._dbPromise).delete("files",e),xa.delete(e)}async fetchCache(e){return(await this._dbPromise).get("files",e)}async getOrRenewUploadUrl(e){const n=this.client.store.getState();return Gp(e)(n)??await this.renewUploadUrl(e)}async uploadFileToS3(e){const n=await this.fetchCache(e);if(!n)throw new Error(`File with sha1 ${e} not found in cache`);const a=await Ts(n,e),r={file_name:n.name,file_sha1:e,file:a},d=await this.getOrRenewUploadUrl(e);if("warning"in d){if(d.warning==="already_uploaded")return[r,Promise.resolve(void 0)];throw new Error(d.warning)}const o=d.url,l=this.enqueueRequest({url:o,description:"Upload file",method:p.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:e,blockers:[`s3-${a}`],blocks:[e],s3url:d});return[r,l]}async fetchFileFromUrl(e,n,a){const r=e.split("?")[0]??e,d=await this.fetchCache(n);if(d){if(!d.name)throw new Error("Cached file unexpectedly has no name.");return d}if(e.startsWith("blob:")){const h=await Ac(e),f=new File([h],a??n,{type:h.type});return await this.addCache(f,n),f}let o=ps[r],l=!0;o?l=!1:(o=new Promise(h=>{this.enqueueRequest({description:"Download file",method:p.GET,url:e,isExternalUrl:!0,isResponseBlob:!0,isAuthNeeded:!1,blockers:[n],blocks:[n]}).then(f=>{const y=new File([f],a??n,{type:f.type});h(y)})}),ps[r]=o);let c;try{c=await o}catch(h){throw l&&h instanceof D&&delete ps[r],h}if(l){const h=await At(c);if(h!==n){const S=`The hash of the file returned from the server (${h}) does not match the
9
9
  expected hash (${n}). 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(S)}const y=r.type.split("/")[1];if(!y)throw new Error("File has no extension");const f=a??h+"."+y;if(r=Tc(r,f),!r.name)throw new Error("Failed to set file's name");await this.addCache(r,h),ps[c]=new Promise(S=>{S(r)})}return r}processPresignedUrls(e){const n={};for(const[a,c]of Object.entries(e))n[a]=this.enqueueRequest({url:c.url,description:"Upload file to S3",method:p.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:a,blockers:[`s3-${c.fields.key}`],blocks:[a],s3url:c});return n}async getFilePayload(e){const n=await At(e),a={sha1:n,file_type:e.type,extension:e.name.split(".").pop(),size:e.size};return await this.client.files.addCache(e,n),a}}class XM extends k{constructor(){super(...arguments);m(this,"name","Form Identifier");m(this,"url","/form-identifiers");m(this,"actions",{addOne:hm,addMany:pm,setOne:mm,setMany:ym,updateOne:fm,updateMany:Sm,deleteOne:Am,deleteMany:wm,initialize:um});m(this,"selectors",{selectById:Om,selectByIds:Im})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,o=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,l=new Date().toISOString(),r=_({...e,created_by:o,submitted_at:l});this.dispatch(a(r));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(r),blockers:[r.form],blocks:[r.uuid]});return h.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(d(r.uuid))}),[r,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Expected form identifier with uuid ${e.uuid} to exist`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return l.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected form identifier with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{form__organization:e}},n);return this.dispatch(a(c)),c}}class xM extends k{constructor(){super(...arguments);m(this,"name","Form Identifier Value");m(this,"url","/form-identifier-values");m(this,"actions",{addOne:bm,addMany:_m,setOne:Rm,setMany:Mm,updateOne:km,updateMany:vm,deleteOne:Em,deleteMany:Vm,initialize:gm});m(this,"selectors",{selectById:Bm,selectByIds:zm})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,o=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,l=new Date().toISOString(),r=_({...e,created_by:o,submitted_at:l});this.dispatch(a(r));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(r),blockers:[e.form_submission,e.form_identifier],blocks:[r.uuid]});return h.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(d(r.uuid))}),[r,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Expected form identifier value with uuid ${e.uuid} to exist`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return l.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected form identifier value with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{form_submission__form_revision__form__organization:e}},n)).flat();return this.dispatch(a(d)),d}}class ek extends k{constructor(){super(...arguments);m(this,"name","Form Revision Attachment");m(this,"url","/form-revision-attachments");m(this,"actions",{addOne:Dm,addMany:$m,setOne:Um,setMany:Lm,updateOne:Nm,updateMany:Hm,deleteOne:Gm,deleteMany:Km,initialize:jm});m(this,"selectors",{selectById:Zm,selectByIds:Jm})}async bulkAdd(e){var f;const{addMany:n,setMany:a,deleteMany:c}=this.actions,d=new Date().toISOString(),o=((f=this.client.store.getState().userReducer.currentUser)==null?void 0:f.id)??null,l={},r=[],h=[];for(const S of e){const{revisionUuid:O,fieldIdentifier:P,file:I}=S,F=await this.client.files.getFilePayload(I);F.sha1 in l||(l[F.sha1]=F);const g=_({file:URL.createObjectURL(I),file_type:I.type,file_name:I.name,file_sha1:F.sha1,created_by:o,form_revision:O,submitted_at:d,field_identifier:P});r.push(g);const v={uuid:g.uuid,file_name:I.name,field_identifier:P,file_extension:F.extension,file_sha1:F.sha1,form_revision:O};h.push(v)}this.dispatch(n(r));const y=this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:{submitted_at:d,attachments:h,files:Object.values(l)},blockers:r.map(S=>S.form_revision),blocks:r.map(S=>S.uuid)});return y.then(S=>{this.client.files.processPresignedUrls(S.presigned_urls),this.dispatch(a(S.attachments))}).catch(()=>{this.dispatch(c(r.map(S=>S.uuid)))}),[r,y.then(({attachments:S})=>S)]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{form_revision__form__organization:e}},n);return this.dispatch(a(c)),c}}class tk extends k{constructor(){super(...arguments);m(this,"name","Form Revision");m(this,"url","/form-revisions");m(this,"actions",{addOne:$i,addMany:Ui,setOne:ey,setMany:ty,updateOne:sy,updateMany:iy,deleteOne:Li,deleteMany:Ni,initialize:xm});m(this,"selectors",{selectById:ny,selectByIds:ay})}add(e){var f;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,r=new Date().toISOString(),h=_({...e,created_by:l,submitted_at:r});this.dispatch(a(h));const y=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(h),blockers:[e.form],blocks:[h.uuid]});return y.then(S=>{this.dispatch(c(S))}).catch(()=>{this.dispatch(d(h.uuid))}),[h,y]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{form__organization:e}},n);return this.dispatch(a(c)),c}}class sk extends k{constructor(){super(...arguments);m(this,"name","Form");m(this,"url","/forms");m(this,"actions",{addOne:oy,addMany:uy,setOne:hy,setMany:py,updateOne:my,updateMany:yy,deleteOne:fy,deleteMany:Sy,initialize:ly});m(this,"selectors",{selectById:Ty,selectByIds:Oy})}add(e,n){var f;const{store:a}=this.client,{addOne:c,deleteOne:d}=this.actions,o=new Date().toISOString(),l=((f=a.getState().userReducer.currentUser)==null?void 0:f.id)??null,r=_({...e,submitted_at:o,created_by:l}),h=_({...n,form:r.uuid,submitted_at:o,created_by:l});this.dispatch(c(r)),this.dispatch($i(h));const y=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:{...E(r),initial_revision:{uuid:h.uuid,submitted_at:h.submitted_at,title:h.title,description:h.description,fields:h.fields}},blockers:[],blocks:[r.uuid,h.uuid]});return y.catch(S=>{throw this.dispatch(d(r.uuid)),this.dispatch(Li(h.uuid)),S}),[r,h,y]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error("Expected form to exist");const r=Hy(e)(o),h=cy(e)(o);this.dispatch(a(e)),this.dispatch(sn(B(r))),this.dispatch(Ni(B(h)));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(y){throw this.dispatch(c(l)),this.dispatch(Ui(h)),this.dispatch(tn(r)),y}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class ik extends k{constructor(){super(...arguments);m(this,"name","Form Submission Attachment");m(this,"url","/form-submission-attachments");m(this,"actions",{addOne:Py,addMany:Zi,setOne:gy,setMany:by,updateOne:_y,updateMany:Ry,deleteOne:My,deleteMany:Ji,initialize:Fy});m(this,"selectors",{selectById:ky,selectByIds:vy})}async bulkAdd(e){var f;const{addMany:n,setMany:a,deleteMany:c}=this.actions,d=new Date().toISOString(),o=((f=this.client.store.getState().userReducer.currentUser)==null?void 0:f.id)??null,l={},r=[],h=[];for(const S of e){const{submissionUuid:O,fieldIdentifier:P,file:I}=S,F=await this.client.files.getFilePayload(I);F.sha1 in l||(l[F.sha1]=F);const g=_({file:URL.createObjectURL(I),file_type:I.type,file_name:I.name,file_sha1:F.sha1,created_by:o,form_submission:O,submitted_at:d,field_identifier:P});r.push(g);const v={uuid:g.uuid,file_name:I.name,file_sha1:F.sha1,file_extension:F.extension,field_identifier:P,form_submission:O};h.push(v)}this.dispatch(n(r));const y=this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:{submitted_at:d,attachments:h,files:Object.values(l)},blockers:r.map(S=>S.form_submission),blocks:r.map(S=>S.uuid)});return y.then(S=>{this.client.files.processPresignedUrls(S.presigned_urls),this.dispatch(a(S.attachments))}).catch(S=>{throw this.dispatch(c(r.map(O=>O.uuid))),S}),[r,y.then(({attachments:S})=>S)]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,d=n.getState(),o=xi(e)(d);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!0),method:p.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(l){throw this.dispatch(c(o)),l}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{form_submission__form_revision__form__organization:e}},n)).flat();return this.dispatch(a(d)),d}}class nk extends k{constructor(){super(...arguments);m(this,"name","Form Submission");m(this,"url","/form-submissions");m(this,"actions",{addOne:Cy,addMany:tn,setOne:zy,setMany:qy,updateOne:jy,updateMany:Dy,deleteOne:$y,deleteMany:sn,initialize:By});m(this,"selectors",{selectById:Ly,selectByIds:Ny})}add(e){var f;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,r=new Date().toISOString(),h=_({...e,created_by:l,submitted_at:r}),y=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(h),blockers:[e.form_revision],blocks:[h.uuid]});return this.dispatch(a(h)),y.then(S=>{this.dispatch(c(S))}).catch(()=>{this.dispatch(d(h.uuid))}),[h,y]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=n.getState(),o=c(e.uuid)(d);if(!o)throw new Error(`Expected submission with uuid ${e.uuid} to exist`);const l={...o,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${l.uuid}/`,payload:e,blockers:[l.uuid],blocks:[l.uuid]});return r.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(o))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected submission with uuid ${e} to exist`);const r=Ey(e)(o);this.dispatch(a(e)),this.dispatch(Ji(B(r)));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(l)),this.dispatch(Zi(r)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{limit:this.pageSize,paginate:!0,form_revision__form_organization:e}},n)).flat();return this.dispatch(a(d)),d}}class ak extends k{constructor(){super(...arguments);m(this,"name","Geo Image");m(this,"url","/geo-images");m(this,"actions",{addOne:Qy,addMany:Xy,setOne:Zy,setMany:Jy,updateOne:xy,updateMany:ef,deleteOne:tf,deleteMany:sf,initialize:Yy});m(this,"selectors",{selectById:af,selectByIds:cf})}async add(e){var P;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,{file:o,...l}=e,r=new Date().toISOString(),h=((P=n.getState().userReducer.currentUser)==null?void 0:P.id)??null,y=l.project,f=await this.client.files.getFilePayload(o),S=_({...l,file_name:o.name,file_sha1:f.sha1,file_type:o.type,file:URL.createObjectURL(o),submitted_at:r,created_by:h});this.dispatch(a(S));const O=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:{uuid:S.uuid,submitted_at:r,title:S.title,description:S.description,geo_marker:S.geo_marker,canvas_marker:S.canvas_marker,sha1:S.file_sha1,project:S.project,file_name:S.file_name,direction:S.direction,original_date:S.original_date,file:f},blocks:[y],blockers:[y]});return O.then(I=>{this.client.files.processPresignedUrls(I.presigned_urls),this.dispatch(c(I.geo_image))}).catch(()=>{this.dispatch(d(S.uuid))}),[S,O.then(I=>I.geo_image)]}async bulkAdd(e,n){var P;const{store:a}=this.client,{addMany:c,setMany:d,deleteMany:o}=this.actions,l=new Date().toISOString(),r=((P=a.getState().userReducer.currentUser)==null?void 0:P.id)??null,h=[],y=[],f=[],S={};for(const I of e){const{file:F,...g}=I,v=await this.client.files.getFilePayload(F);v.sha1 in S||(S[v.sha1]=v);const V=_({...g,file_name:F.name,file_sha1:v.sha1,file_type:F.type,file:URL.createObjectURL(F),submitted_at:l,created_by:r,project:n});h.push(V),y.push(V.uuid),f.push({uuid:V.uuid,sha1:V.file_sha1,file_name:V.file_name,title:V.title,description:V.description,geo_marker:V.geo_marker,canvas_marker:V.canvas_marker,direction:V.direction,original_date:V.original_date})}this.dispatch(c(h));const O=this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:{submitted_at:l,project:n,geo_images:f,files:Object.values(S)},blocks:[n],blockers:y});return O.then(I=>{this.client.files.processPresignedUrls(I.presigned_urls),this.dispatch(d(I.geo_images))}).catch(()=>{this.dispatch(o(y))}),[h,O.then(I=>I.geo_images)]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=n.getState(),o=c(e.uuid)(d);if(!o)throw new Error(`Map image with uuid ${e.uuid} does not exist in the store`);const l={...o,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return r.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(o))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Map image with uuid ${e} does not exist in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blocks:[e],blockers:[e]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{project:e}},n);return this.dispatch(a(c)),c}}class ck extends k{constructor(){super(...arguments);m(this,"name","Issue Association");m(this,"url","/issue-associations");m(this,"actions",{addOne:mf,addMany:Yt,setOne:uf,setMany:of,updateOne:hf,updateMany:pf,deleteOne:yf,deleteMany:Zt,initialize:lf});m(this,"selectors",{selectById:Sf,selectByIds:Af})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,o=new Date().toISOString(),l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,r=_({...e,submitted_at:o,created_by:l});this.dispatch(a(r));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(r),blockers:[e.associated_issue,...e.issue?[e.issue]:[],...e.asset?[e.asset]:[]],blocks:[r.uuid]});return h.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(d(r.uuid))}),[r,h]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,o=d(e)(n.getState());if(!o)throw new Error(`Issue association with uuid ${e} not found in store.`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(l){throw this.dispatch(c(o)),l}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{associated_issue__project:e}},n)).flat();return this.dispatch(a(d)),d}}class rk extends L{constructor(){super(...arguments);m(this,"name","Issue Attachment");m(this,"url","/issue-attachments");m(this,"actions",{addOne:gf,addMany:ln,setOne:bf,setMany:_f,updateOne:Rf,updateMany:Mf,deleteOne:kf,deleteMany:on,initialize:Pf});m(this,"selectors",{selectById:Vf,selectByIds:Wf})}getId(e){return e.uuid}buildModel(e){return _({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,issue:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,issue:e.issue}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.issueUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(a(d)),d}}class dk extends L{constructor(){super(...arguments);m(this,"name","Issue Comment Attachment");m(this,"url","/issue-comment-attachments");m(this,"actions",{addOne:Cf,addMany:jf,setOne:Df,setMany:$f,updateOne:Uf,updateMany:Lf,deleteOne:Nf,deleteMany:Hf,initialize:qf});m(this,"selectors",{selectById:Kf,selectByIds:Yf})}getId(e){return e.uuid}buildModel(e){return _({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,issue_comment:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,issue_comment:e.issue_comment}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.issueCommentUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{issue_comment__issue__project:e}},n)).flat();return this.dispatch(a(d)),d}}class lk extends k{constructor(){super(...arguments);m(this,"name","Issue Comment");m(this,"url","/issue-comments");m(this,"actions",{addOne:Xf,addMany:xf,setOne:eS,setMany:tS,updateOne:sS,updateMany:iS,deleteOne:nS,deleteMany:aS,initialize:Qf});m(this,"selectors",{selectById:cS,selectByIds:rS})}add(e){const{store:n}=this.client,{addOne:a,updateOne:c,deleteOne:d}=this.actions,o=_({...e,author:n.getState().userReducer.currentUser.id,submitted_at:new Date().toISOString()});this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(o),blockers:[e.issue],blocks:[o.uuid]});return l.then(r=>{this.dispatch(c(r))}).catch(()=>{this.dispatch(d(o.uuid))}),[o,l]}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Comment with uuid ${e.uuid} not found in store`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return l.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,o=d(e)(n.getState());if(!o)throw new Error(`Comment with uuid ${e} not found in store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(l){throw this.dispatch(c(o)),l}}async refreshStore(e,n){const{setMany:a}=this.actions,d=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(a(d)),d}}class ok extends k{constructor(){super(...arguments);m(this,"name","Issue");m(this,"url","/issues");m(this,"actions",{addOne:uS,addMany:Sn,setOne:hS,setMany:pS,updateOne:mS,updateMany:yS,deleteOne:fS,deleteMany:An,initialize:oS});m(this,"selectors",{selectById:AS,selectByIds:wS})}add(e){var f;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,o=n.getState(),l=new Date().toISOString(),r=((f=o.userReducer.currentUser)==null?void 0:f.id)??null,h=_({...e,submitted_at:l,created_by:r});this.dispatch(a(h));const y=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(h),blockers:[h.project,h.issue_type,...h.category?[h.category]:[]],blocks:[h.uuid]});return y.then(S=>{this.dispatch(c(S))}).catch(S=>{throw this.dispatch(d(h.uuid)),S}),[h,y]}update(e){var y;const{updateOne:n}=this.actions,{selectById:a}=this.selectors,c=this.client.store.getState(),d=a(e.uuid)(c);if(!d)throw new Error(`Attempting to update an issue with uuid ${e.uuid} that doesn't exist in the store`);const o={...d,...e};this.dispatch(n(o));const l={};for(const f of[j.TITLE,j.DESCRIPTION,j.STATUS,j.CATEGORY,j.PRIORITY,j.ASSIGNED_TO,j.DUE_DATE])if(f in e&&e[f]!==d[f])switch(f){case j.PRIORITY:l[f]=e[f];break;case j.DUE_DATE:l[f]=e[f];break;case j.DESCRIPTION:l[f]=e[f];break;case j.TITLE:l[f]=e[f];break;case j.STATUS:{const S=e[f],O=zn(S)(c);if(!O)throw new Error(`Trying to update issue type status with ${S} which does not exist in store`);l[f]={name:O.name,color:O.color,uuid:O.uuid};break}case j.CATEGORY:{const S=e[f];if(S===null)l[f]=null;else{const O=Ri(S)(c);if(!O)throw new Error(`Trying to update category with ${S} which does not exist in store.`);l[f]={name:O.name,color:O.color,uuid:O.uuid}}break}case j.ASSIGNED_TO:{const S=e[f];if(S===null)l[f]=null;else{const O=es(S)(c);if(!O)throw new Error(`Trying to update assigned to with ${S} which does not exist in store.`);l[f]={full_name:O.username,id:O.id}}break}}const r=_({created_by:((y=c.userReducer.currentUser)==null?void 0:y.id)??null,submitted_at:new Date().toISOString(),issue:d.uuid,changes:l});this.dispatch(Cn(r));const h=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return h.then(f=>{this.dispatch(n(f))}).catch(()=>{this.dispatch(n(d)),this.dispatch(Dn(r.uuid))}),[o,h]}bulkUpdate(e,n){const{store:a}=this.client,{updateMany:c}=this.actions,{selectByIds:d}=this.selectors,o=B(e).toSorted(Wt);if(o.length!==e.length)throw new Error("payloads contains duplicate uuids.");const l=d(o)(a.getState()).toSorted(Os);if(o.length!=l.length)throw new Error(`Attempting to bulk update ${o.length-l.length} issues that dont exist in the store`);const r=[];for(let S=0;S<o.length;S++)r.push({...l[S],...e[S]});this.dispatch(c(r));const h=pt(e,Math.min(n??e.length,U)),y=[];let f=null;for(const S of h){const O=mt.v4(),P=B(S),I=S.map(({status:v})=>v).filter(Boolean),F=S.map(({category:v})=>v).filter(Boolean),g=this.enqueueRequest({description:T(p.PATCH,this.name,!0),method:p.PATCH,url:`${this.url}/bulk/`,payload:{payloads:S},blockers:(f?[f]:[]).concat(P).concat(I).concat(F),blocks:[O].concat(P)});y.push(g),f=O}return Promise.all(y).then(S=>{this.dispatch(c(S.flat()))}).catch(()=>{this.dispatch(c(l))}),[r,y]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`No issue with uuid ${e} found in the store`);const r=Ef(e)(o),h=Gw(e)(o),y={};for(const S of wf(e)(o))y[S.uuid]=S;for(const S of Tf(e)(o))y[S.uuid]=S;const f=Object.values(y);this.dispatch(a(e)),this.dispatch(on(B(r))),this.dispatch($n(B(h))),this.dispatch(Zt(B(f)));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(S){throw this.dispatch(c(l)),this.dispatch(ln(r)),this.dispatch(jn(h)),this.dispatch(Yt(f)),S}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(d)),d}}class uk extends L{constructor(){super(...arguments);m(this,"name","Issue Type Attachment");m(this,"url","/issue-type-attachments");m(this,"actions",{addOne:PS,addMany:gS,setOne:bS,setMany:_S,updateOne:RS,updateMany:MS,deleteOne:kS,deleteMany:vS,initialize:FS});m(this,"selectors",{selectById:VS,selectByIds:WS})}getId(e){return e.uuid}buildModel(e){return _({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,issue_type:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,issue_type:e.issue_type}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.issueTypeUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class hk extends k{constructor(){super(...arguments);m(this,"name","Issue Type Fields Attachment");m(this,"url","/issue-type-fields-attachments");m(this,"actions",{addOne:CS,addMany:jS,setOne:DS,setMany:$S,updateOne:US,updateMany:LS,deleteOne:NS,deleteMany:HS,initialize:qS});m(this,"selectors",{selectById:KS,selectByIds:YS})}async bulkAdd(e){var f;const{addMany:n,setMany:a,deleteMany:c}=this.actions,d=new Date().toISOString(),o=((f=this.client.store.getState().userReducer.currentUser)==null?void 0:f.id)??null,l={},r=[],h=[];for(const S of e){const{fieldsRevisionUuid:O,fieldIdentifier:P,file:I}=S,F=await this.client.files.getFilePayload(I);F.sha1 in l||(l[F.sha1]=F);const g=_({file:URL.createObjectURL(I),file_type:I.type,file_name:I.name,file_sha1:F.sha1,created_by:o,fields_revision:O,submitted_at:d,field_identifier:P});r.push(g);const v={uuid:g.uuid,file_name:I.name,file_extension:F.extension,field_identifier:P,file_sha1:F.sha1,fields_revision:O};h.push(v)}this.dispatch(n(r));const y=this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:{submitted_at:d,attachments:h,files:Object.values(l)},blockers:r.map(S=>S.fields_revision),blocks:r.map(S=>S.uuid)});return y.then(S=>{this.client.files.processPresignedUrls(S.presigned_urls),this.dispatch(a(S.attachments))}).catch(()=>{this.dispatch(c(r.map(S=>S.uuid)))}),[r,y.then(({attachments:S})=>S)]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{fields_revision__issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class pk extends k{constructor(){super(...arguments);m(this,"name","Issue Type Fields");m(this,"url","/issue-type-fields");m(this,"actions",{addOne:hA,addMany:pA,setOne:mA,setMany:yA,updateOne:fA,updateMany:SA,deleteOne:AA,deleteMany:wA,initialize:uA});m(this,"selectors",{selectById:OA,selectByIds:IA})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,o=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,l=new Date().toISOString(),r=_({...e,created_by:o,submitted_at:l});this.dispatch(a(r));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(r),blockers:[r.issue_type],blocks:[r.uuid]});return h.then(f=>{this.dispatch(c(f))}).catch(f=>{throw this.dispatch(d(r.uuid)),f}),[r,h]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class mk extends k{constructor(){super(...arguments);m(this,"name","Issue Type Field Values Attachment");m(this,"url","/issue-type-field-values-attachments");m(this,"actions",{addOne:bA,addMany:bn,setOne:_A,setMany:RA,updateOne:MA,updateMany:kA,deleteOne:vA,deleteMany:_n,initialize:gA});m(this,"selectors",{selectById:VA,selectByIds:WA})}async bulkAdd(e){var f;const{addMany:n,setMany:a,deleteMany:c}=this.actions,d=new Date().toISOString(),o=((f=this.client.store.getState().userReducer.currentUser)==null?void 0:f.id)??null,l={},r=[],h=[];for(const S of e){const{fieldValuesUuid:O,fieldIdentifier:P,file:I}=S,F=await this.client.files.getFilePayload(I);F.sha1 in l||(l[F.sha1]=F);const g=_({file:URL.createObjectURL(I),file_type:I.type,file_name:I.name,file_sha1:F.sha1,created_by:o,field_values:O,submitted_at:d,field_identifier:P});r.push(g);const v={uuid:g.uuid,file_name:I.name,file_sha1:F.sha1,file_extension:F.extension,field_identifier:P,field_values:O};h.push(v)}this.dispatch(n(r));const y=this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:{submitted_at:d,attachments:h,files:Object.values(l)},blockers:r.map(S=>S.field_values),blocks:r.map(S=>S.uuid)});return y.then(({presigned_urls:S,attachments:O})=>{this.client.files.processPresignedUrls(S),this.dispatch(a(O))}).catch(S=>{throw this.dispatch(c(r.map(O=>O.uuid))),S}),[r,y.then(({attachments:S})=>S)]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:d}=this.selectors,o=n.getState(),l=d(e)(o);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!0),method:p.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{field_values__issue__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class yk extends k{constructor(){super(...arguments);m(this,"name","Issue Type Field Values");m(this,"url","/issue-type-field-values");m(this,"actions",{addOne:XS,addMany:xS,setOne:eA,setMany:tA,updateOne:sA,updateMany:iA,deleteOne:nA,deleteMany:aA,initialize:QS});m(this,"selectors",{selectById:rA,selectByIds:dA})}add(e){var f;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,r=new Date().toISOString(),h=_({...e,created_by:l,submitted_at:r}),y=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(h),blockers:[e.issue,e.fields_revision],blocks:[h.uuid]});return this.dispatch(a(h)),y.then(S=>{this.dispatch(c(S))}).catch(()=>{this.dispatch(d(h.uuid))}),[h,y]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=n.getState(),o=c(e.uuid)(d);if(!o)throw new Error(`Expected IssueTypeFieldValues with uuid ${e.uuid} to exist`);const l={...o,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[l.uuid,l.fields_revision,l.issue],blocks:[l.uuid]});return r.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(o))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected submission with uuid ${e} to exist`);const r=BA(e)(o);this.dispatch(a(e)),this.dispatch(_n(B(r)));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(l)),this.dispatch(bn(r)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{issue__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class fk extends k{constructor(){super(...arguments);m(this,"name","Issue Type Identifier");m(this,"url","/issue-type-identifiers");m(this,"actions",{addOne:jA,addMany:DA,setOne:$A,setMany:UA,updateOne:LA,updateMany:NA,deleteOne:HA,deleteMany:GA,initialize:CA});m(this,"selectors",{selectById:YA,selectByIds:ZA})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,o=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,l=new Date().toISOString(),r=_({...e,created_by:o,submitted_at:l});this.dispatch(a(r));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(r),blockers:[r.issue_type],blocks:[r.uuid]});return h.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(d(r.uuid))}),[r,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Expected issue type identifier with uuid ${e.uuid} to exist`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return l.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected issue type identifier with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class Sk extends k{constructor(){super(...arguments);m(this,"name","Issue Type Identifier Value");m(this,"url","/issue-type-identifier-values");m(this,"actions",{addOne:xA,addMany:ew,setOne:tw,setMany:sw,updateOne:iw,updateMany:nw,deleteOne:aw,deleteMany:cw,initialize:XA});m(this,"selectors",{selectById:dw,selectByIds:lw})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,o=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,l=new Date().toISOString(),r=_({...e,created_by:o,submitted_at:l});this.dispatch(a(r));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(r),blockers:[e.issue,e.issue_type_identifier],blocks:[r.uuid]});return h.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(d(r.uuid))}),[r,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Expected issue type identifier value with uuid ${e.uuid} to exist`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return l.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected issue type identifier value with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(a(d)),d}}class Ak extends k{constructor(){super(...arguments);m(this,"name","Issue Type");m(this,"url","/issue-types");m(this,"actions",{addOne:pw,addMany:mw,setOne:yw,setMany:fw,updateOne:Sw,updateMany:Aw,deleteOne:ww,deleteMany:Tw,initialize:hw});m(this,"selectors",{selectById:Iw,selectByIds:Fw})}add(e){var f;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,r=new Date().toISOString(),h=_({...e,submitted_at:r,created_by:l});this.dispatch(a(h));const y=this.enqueueRequest({method:p.POST,url:`${this.url}/`,payload:E(h),blockers:[],blocks:[h.uuid]});return y.then(S=>{this.dispatch(c(S))}).catch(()=>{this.dispatch(d(h.uuid))}),[h,y]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=n.getState(),o=c(e.uuid)(d);if(!o)throw new Error(`IssueType with uuid ${e.uuid} does not exist in the store.`);const l={...o,...e};this.dispatch(a(l));const r=this.enqueueRequest({method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(o))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`IssueType with uuid ${e} does not exist in the store.`);const r=TS(e)(o);this.dispatch(a(e)),this.dispatch(An(B(r)));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(l)),this.dispatch(Sn(r)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class wk extends k{constructor(){super(...arguments);m(this,"name","Issue Type Status");m(this,"url","/issue-type-statuses");m(this,"actions",{addOne:_w,addMany:Rw,setOne:Mw,setMany:kw,updateOne:vw,updateMany:Ew,deleteOne:Vw,deleteMany:Ww,initialize:bw});m(this,"selectors",{selectById:zn,selectByIds:zw})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,o=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,l=new Date().toISOString(),r=_({...e,created_by:o,submitted_at:l});this.dispatch(a(r));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(r),blockers:[e.issue_type],blocks:[r.uuid]});return h.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(d(r.uuid))}),[r,h]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.client.store.getState(),d=a(e.uuid)(c);if(!d)throw new Error(`Expected an existing issue type status with uuid ${e.uuid}`);const o={...d,...e};this.dispatch(n(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return l.then(r=>{this.dispatch(n(r))}).catch(()=>{this.dispatch(n(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,o=d(e)(n.getState());if(!o)throw new Error(`No issue type status with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(l){throw this.dispatch(c(o)),l}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class Tk extends k{constructor(){super(...arguments);m(this,"name","Issue Update");m(this,"url","/issue-updates");m(this,"actions",{addOne:Cn,addMany:jn,setOne:Dw,setMany:$w,updateOne:Uw,updateMany:Lw,deleteOne:Dn,deleteMany:$n,initialize:jw});m(this,"selectors",{selectById:Nw,selectByIds:Hw})}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(a(d)),d}}const Ok=1800;function Ik(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 Fk extends AM{constructor(){super(...arguments);m(this,"_getRenewedTokens",async e=>{const n=this.performRequest({method:p.POST,url:this.refreshTokensUrl,payload:{refresh:e},isAuthNeeded:!1,checkAuth:!1});let a;try{a=await n}catch(c){console.error("Could not renew tokens; clearing auth",c),this.clearAuth();return}if(!a.access)throw new Error("Missing access token");return{accessToken:a.access,refreshToken:a.refresh??this.getRefreshToken()}})}clearAuth(){console.debug(this.constructor.name,"clearing auth;"),this.dispatch(sp(!1)),this.clearTokens(),this.dispatch(b()),this.dispatch(b())}async renewTokens(){const e=this.getRefreshToken();if(!e)throw new Error("No refresh token found");console.debug(this.constructor.name,"renewing tokens");try{const n=await this._getRenewedTokens(e);if(!n)return;console.log("Got renewed tokens"),this.setTokens(n)}catch(n){throw console.error("Could not renew tokens; clearing auth",n),this.clearAuth(),n}}tokenIsExpiringSoon(){const e=this.getAccessToken();if(!e)return!1;const n=Date.now()/1e3;let a;try{a=Vb(e).exp??n}catch{a=n}return a-n<Ok}getAuthHeader(){return`Bearer ${this.getAccessToken()}`}async prepareAuth(){if(this.tokenIsExpiringSoon()){console.debug(this.constructor.name,"preparing auth");try{await this.renewTokens()}catch(e){return e instanceof D&&this.clearAuth(),e instanceof Error?Promise.reject(e):Promise.reject(new Error((e??wt).toString()))}}}async handleUnauthorized(e,n){const a=this.client.store.getState();if(e.url.endsWith("/token/refresh/"))throw a.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:n,discard:!0});if(a.authReducer.isLoggedIn)await this.renewTokens();else throw console.debug("Forbidden; user is not logged in."),new D({message:"Incorrect username or password.",response:n,discard:!0})}async initAuth(e){const n=mt.v4();return console.debug(this.constructor.name,"Initiating auth"),this.performRequest({uuid:n,method:p.POST,url:this.initTokensUrl,payload:e,isAuthNeeded:!1,checkAuth:!1}).then(a=>{this.setTokens(Ik(a))})}}class Pk extends Tt{constructor(){super(...arguments);m(this,"name","Organization Access");m(this,"url","/organization-accesses");m(this,"actions",{addOne:rT,addMany:dT,setOne:lT,setMany:oT,updateOne:uT,updateMany:hT,deleteOne:pT,deleteMany:mT,initialize:cT});m(this,"selectors",{selectById:fT,selectByIds:ST})}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState()),o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return l.then(r=>{this.dispatch(a(r))}).catch(r=>{throw this.dispatch(a(d)),r}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o),r=es(l.user)(o);this.dispatch(a(l.uuid)),this.dispatch(Gn(l.user));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${l.uuid}/`,blockers:[l.uuid],blocks:[]})}catch(h){throw this.dispatch(c(l)),this.dispatch(Hn(r)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class gk extends Tt{constructor(){super(...arguments);m(this,"name","Organization");m(this,"url","/organizations");m(this,"actions",{addOne:PT,addMany:FT,setOne:IT,setMany:OT,updateOne:bT,updateMany:gT,deleteOne:_T,deleteMany:RT,initialize:TT});m(this,"selectors",{selectById:vT,selectByIds:ET})}async add(e){const{addOne:n}=this.actions,a=await this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:e,blockers:[],blocks:[]});return this.dispatch(n(a)),a}async update(e){const{setOne:n}=this.actions,a=await this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return this.dispatch(n(a)),a}async invite(e,n){return this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/${e}/invite/${n}/`,blockers:[],blocks:[]})}async refreshStore(e){const{initialize:n}=this.actions,a=await this.list({},e);return this.dispatch(n(a)),a}}class bk extends k{constructor(){super(...arguments);m(this,"name","Project Access");m(this,"url","/project-accesses");m(this,"actions",{addOne:UT,addMany:LT,setOne:NT,setMany:HT,updateOne:GT,updateMany:KT,deleteOne:YT,deleteMany:ZT,initialize:$T});m(this,"selectors",{selectById:QT,selectByIds:XT})}add(e){var r;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,o=_({...e,created_by:((r=n.getState().userReducer.currentUser)==null?void 0:r.id)??null});this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(o),blockers:[o.organization_access,o.project],blocks:[o.uuid]});return l.then(h=>{this.dispatch(c(h))}).catch(h=>{throw this.dispatch(d(o.uuid)),h}),[o,l]}bulkAdd(e){var h;const{store:n}=this.client,{addMany:a,deleteMany:c,updateMany:d}=this.actions,o=((h=n.getState().userReducer.currentUser)==null?void 0:h.id)??null,l=e.map(y=>_({...y,created_by:o}));this.dispatch(a(l));const r=this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:{project_accesses:l.map(y=>E(y))},blockers:l.flatMap(y=>[y.project,y.organization_access]),blocks:l.map(y=>y.uuid)});return r.then(y=>{this.dispatch(d(y))}).catch(y=>{throw this.dispatch(c(l.map(f=>f.uuid))),y}),[l,r]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState()),o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[]});return l.then(r=>{this.dispatch(a(r))}).catch(r=>{throw this.dispatch(a(d)),r}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,o=d(e)(n.getState());this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(l){throw this.dispatch(c(o)),l}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{project__organization:e}},n);return this.dispatch(a(c)),c}}class _k extends L{constructor(){super(...arguments);m(this,"name","Project Attachment");m(this,"url","/project-attachments");m(this,"actions",{addOne:tO,addMany:sO,setOne:iO,setMany:nO,updateOne:aO,updateMany:cO,deleteOne:rO,deleteMany:dO,initialize:eO});m(this,"selectors",{selectById:oO,selectByIds:uO})}getId(e){return e.uuid}buildModel(e){return _({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,project:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,project:e.project}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.projectUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{project__organization:e}},n);return this.dispatch(a(c)),c}}class Rk extends k{constructor(){super(...arguments);m(this,"name","Project File");m(this,"url","/project-files");m(this,"actions",{addOne:SO,addMany:AO,setOne:yO,setMany:fO,updateOne:wO,updateMany:TO,deleteOne:OO,deleteMany:IO,initialize:mO});m(this,"selectors",{selectById:RO,selectByIds:MO})}async saveExisting(e){const{setOne:n}=this.actions;if(!e.uuid)throw new Error("You can only use this method to save existing project files. The one provided has no uuid.");const a={...e};delete a.file;const c=this.enqueueRequest({method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:a,blockers:[e.uuid],blocks:[e.uuid]});return c.then(d=>{this.dispatch(n(d))}),c}saveActive(){const{store:e}=this.client,{setOne:n}=this.actions,a=e.getState(),c=a.projectFileReducer.activeProjectFileId;if(!c)throw new Error("No active project file");const d=a.projectFileReducer.instances[c];if(!d)throw new Error("No active project file");if(!d.bounds&&!d.canvas_bounds)throw new Error("Project file must either have bounds or canvas_bounds set");let o;if(typeof d.file=="string"&&!d.file.startsWith("blob:")){const h={...d};delete h.file,o={method:p.PATCH,url:`${this.url}/${c}/`,payload:h,blockers:[c],blocks:[c]}}else o=new Promise((h,y)=>{this.client.files.uploadFileToS3(d.file_sha1).then(([f])=>{h({method:p.POST,url:`${this.url}/`,payload:{...d,...f},blockers:[c],blocks:[c]})}).catch(y)});const r=Promise.resolve(o).then(h=>this.enqueueRequest(h));return r.then(h=>{this.dispatch(n(h))}),this.dispatch(gO),this.dispatch(PO(null)),this.dispatch(FO(!1)),[d,r]}async delete(e){const{store:n}=this.client,{addOne:a,deleteOne:c}=this.actions,{selectById:d}=this.selectors,o=d(e)(n.getState());if(!o)throw new Error(`Expected project file with uuid ${e} to exist in the store.`);this.dispatch(c(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}`,blockers:[e],blocks:[]})}catch(l){throw this.dispatch(a(o)),l}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(d)),d}}class Mk extends Tt{constructor(){super(...arguments);m(this,"name","Project");m(this,"url","/projects");m(this,"actions",{addOne:zO,addMany:BO,setOne:WO,setMany:VO,updateOne:CO,updateMany:qO,deleteOne:jO,deleteMany:DO,initialize:EO});m(this,"selectors",{selectById:LO,selectByIds:NO})}async add(e){const{addOne:n}=this.actions,a=await this.performRequest({method:p.POST,url:`${this.url}/`,payload:E(e)});return this.dispatch(n(a)),a}async update(e){const{updateOne:n}=this.actions,a=await this.performRequest({method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:E(e)});return this.dispatch(n(a)),a}async delete(e){const{deleteOne:n}=this.actions,a=await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return this.dispatch(n(e)),a}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class kk extends k{constructor(){super(...arguments);m(this,"name","Team Membership");m(this,"url","/team-memberships");m(this,"actions",{addOne:YO,addMany:ZO,setOne:JO,setMany:QO,updateOne:XO,updateMany:xO,deleteOne:eI,deleteMany:tI,initialize:KO});m(this,"selectors",{selectById:nI,selectByIds:aI})}add(e){var r;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,o=_({...e,created_by:((r=n.getState().userReducer.currentUser)==null?void 0:r.id)??null});this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(o),blockers:[e.team],blocks:[o.uuid]});return l.then(h=>{this.dispatch(c(h))}).catch(()=>{this.dispatch(d(o.uuid))}),[o,l]}bulkAdd(e){var h;const{store:n}=this.client,{addMany:a,setMany:c,deleteMany:d}=this.actions,o=((h=n.getState().userReducer.currentUser)==null?void 0:h.id)??null,l=e.map(y=>_({...y,created_by:o}));this.dispatch(a(l));const r=this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:{team_memberships:l.map(y=>E(y))},blockers:l.map(y=>y.team),blocks:l.map(y=>y.uuid)});return r.then(y=>{this.dispatch(c(y))}).catch(()=>{this.dispatch(d(l.map(y=>y.uuid)))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected team membership with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{team__organization:e}},n);return this.dispatch(a(c)),c}}class vk extends k{constructor(){super(...arguments);m(this,"name","Team");m(this,"url","/teams");m(this,"actions",{addOne:dI,addMany:lI,setOne:oI,setMany:uI,updateOne:hI,updateMany:pI,deleteOne:mI,deleteMany:yI,initialize:rI});m(this,"selectors",{selectById:SI,selectByIds:AI})}add(e){var r;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,o=_({...e,submitted_at:new Date().toISOString(),created_by:((r=n.getState().userReducer.currentUser)==null?void 0:r.id)??null});this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(o),blockers:[],blocks:[o.uuid]});return l.then(h=>{this.dispatch(c(h))}).catch(()=>{this.dispatch(d(o.uuid))}),[o,l]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Expected team with uuid ${e.uuid} to exist`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:E(e),blockers:[e.uuid],blocks:[e.uuid]});return l.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected team with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class Ek extends Tt{constructor(){super(...arguments);m(this,"name","User");m(this,"url","/user");m(this,"actions",{addOne:Hn,addMany:Xw,setOne:Qw,setMany:Jw,updateOne:eT,updateMany:xw,deleteOne:Gn,deleteMany:tT,initialize:Zw});m(this,"selectors",{selectById:es,selectByIds:nT})}async list(e,n){const{organizationUuid:a,...c}=e,d=a?`/organizations/${a}${this.url}s/`:`/${this.url}`;return this.performRequest({method:p.GET,url:d,...c},n)}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({organizationUuid:e},n);return this.dispatch(a(c)),c}}class Vk extends k{constructor(){super(...arguments);m(this,"name","Workflow");m(this,"url","/workflows");m(this,"actions",{addOne:II,addMany:da,setOne:FI,setMany:PI,updateOne:gI,updateMany:bI,deleteOne:_I,deleteMany:la,initialize:OI});m(this,"selectors",{selectById:MI,selectByIds:kI})}add(e){var f;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,r=new Date().toISOString(),h=_({...e,created_by:l,submitted_at:r});this.dispatch(a(h));const y=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(h),blockers:[h.project,h.workflow_type],blocks:[h.uuid]});return y.then(S=>{this.dispatch(c(S))}).catch(()=>{this.dispatch(d(h.uuid))}),[h,y]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Expected workflow with uuid ${e.uuid} to exist`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[d.uuid],blocks:[d.uuid]});return l.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected workflow with uuid ${e} to exist`);const r=oP(e)(o),h=NI(e)(o),y=QP(e)(o),f=og(e)(o),S=Fg(e)(o),O=RF(e)(o),P=yF(e)(o),I=DF(e)(o),F={};for(const v of P)for(const V of ya(v.uuid)(o))F[V.uuid]=V;const g=Object.values(F);this.dispatch(a(e)),this.dispatch(Ea(B(r))),this.dispatch(ha(B(h))),this.dispatch($a(B(y))),this.dispatch(Na(B(f))),this.dispatch(Ka(B(S))),this.dispatch(Oa(B(O))),this.dispatch(Pa(B(I))),this.dispatch(Aa(B(P))),this.dispatch(cs(B(g)));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(v){throw this.dispatch(c(l)),this.dispatch(va(r)),this.dispatch(ua(h)),this.dispatch(Da(y)),this.dispatch(La(f)),this.dispatch(Ga(S)),this.dispatch(Ta(O)),this.dispatch(Fa(I)),this.dispatch(Sa(P)),this.dispatch(as(g)),v}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(d)),d}}class Wk extends k{constructor(){super(...arguments);m(this,"name","Workflow Step Assignee");m(this,"url","/workflow-step-assignees");m(this,"actions",{addOne:BI,addMany:ua,setOne:zI,setMany:qI,updateOne:CI,updateMany:jI,deleteOne:DI,deleteMany:ha,initialize:WI});m(this,"selectors",{selectById:UI,selectByIds:LI})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,o=new Date().toISOString(),l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,r=_({...e,submitted_at:o,created_by:l});this.dispatch(a(r));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(r),blockers:[e.workflow,e.workflow_step],blocks:[r.uuid]});return h.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(d(r.uuid))}),[r,h]}bulkAdd(e){var y;const{store:n}=this.client,{addMany:a,setMany:c,deleteMany:d}=this.actions,o=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,l=new Date().toISOString(),r=e.map(f=>_({...f,submitted_at:l,created_by:o}));this.dispatch(a(r));const h=this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:{assignees:r.map(f=>E(f))},blockers:r.flatMap(f=>[f.workflow,f.workflow_step]),blocks:r.map(f=>f.uuid)});return h.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(d(r.map(f=>f.uuid)))}),[r,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Expected workflow step assignee with uuid ${e.uuid} to exist`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return l.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected workflow step assignee with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(r){throw this.dispatch(c(l)),r}}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:d}=this.selectors,o=n.getState(),l=d(e)(o);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!0),method:p.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{workflow__project:e}},n)).flat();return this.dispatch(a(d)),d}}class Bk extends L{constructor(){super(...arguments);m(this,"name","Workflow Step Comment Attachment");m(this,"url","/workflow-step-comment-attachments");m(this,"actions",{addOne:YI,addMany:as,setOne:ZI,setMany:JI,updateOne:QI,updateMany:XI,deleteOne:xI,deleteMany:cs,initialize:KI});m(this,"selectors",{selectById:tF,selectByIds:sF})}getId(e){return e.uuid}buildModel(e){return _({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,workflow_step_comment:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,workflow_step_comment:e.workflow_step_comment}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.workflowStepCommentUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{workflow_step_comment__workflow__project:e}},n)).flat();return this.dispatch(a(d)),d}}class zk extends k{constructor(){super(...arguments);m(this,"name","Workflow Step Comment");m(this,"url","/workflow-step-comments");m(this,"actions",{addOne:cF,addMany:Sa,setOne:rF,setMany:dF,updateOne:lF,updateMany:oF,deleteOne:uF,deleteMany:Aa,initialize:aF});m(this,"selectors",{selectById:pF,selectByIds:mF})}add(e){var r;const{store:n}=this.client,{addOne:a,updateOne:c,deleteOne:d}=this.actions,o=_({...e,created_by:((r=n.getState().userReducer.currentUser)==null?void 0:r.id)??null,submitted_at:new Date().toISOString()});this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(o),blockers:[e.workflow,e.workflow_step],blocks:[o.uuid]});return l.then(h=>{this.dispatch(c(h))}).catch(()=>{this.dispatch(d(o.uuid))}),[o,l]}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Comment with uuid ${e.uuid} not found in store`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return l.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,o=d(e)(n.getState());if(!o)throw new Error(`Comment with uuid ${e} not found in store`);const l=ya(e)(n.getState());this.dispatch(a(e)),this.dispatch(cs(B(l)));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(c(o)),this.dispatch(as(l)),r}}async refreshStore(e,n){const{setMany:a}=this.actions,d=(await this.listPaginated({queryParams:{workflow__project:e}},n)).flat();return this.dispatch(a(d)),d}}class qk extends k{constructor(){super(...arguments);m(this,"name","Workflow Step Completion");m(this,"url","/workflow-step-completions");m(this,"actions",{addOne:wF,addMany:Ta,setOne:TF,setMany:OF,updateOne:IF,updateMany:FF,deleteOne:PF,deleteMany:Oa,initialize:AF});m(this,"selectors",{selectById:bF,selectByIds:_F})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,o=new Date().toISOString(),l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,r=_({...e,submitted_at:o,created_by:l});this.dispatch(a(r));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(r),blockers:[e.workflow,e.workflow_step],blocks:[r.uuid]});return h.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(d(r.uuid))}),[r,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Expected workflow step completion with uuid ${e.uuid} to exist`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return l.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected workflow step completion with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{workflow__project:e}},n)).flat();return this.dispatch(a(d)),d}}class Ck extends k{constructor(){super(...arguments);m(this,"name","Workflow Step Event");m(this,"url","/workflow-step-events");m(this,"actions",{addOne:EF,addMany:Fa,setOne:VF,setMany:WF,updateOne:BF,updateMany:zF,deleteOne:qF,deleteMany:Pa,initialize:vF});m(this,"selectors",{selectById:CF,selectByIds:jF})}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{workflow__project:e}},n)).flat();return this.dispatch(a(d)),d}}class jk extends k{constructor(){super(...arguments);m(this,"name","Workflow Step Field Values Attachment");m(this,"url","/workflow-step-field-values-attachments");m(this,"actions",{addOne:NF,addMany:_a,setOne:HF,setMany:GF,updateOne:KF,updateMany:YF,deleteOne:ZF,deleteMany:Ra,initialize:LF});m(this,"selectors",{selectById:QF,selectByIds:XF})}async bulkAdd(e){var f;const{addMany:n,setMany:a,deleteMany:c}=this.actions,d=new Date().toISOString(),o=((f=this.client.store.getState().userReducer.currentUser)==null?void 0:f.id)??null,l={},r=[],h=[];for(const S of e){const{fieldValuesUuid:O,fieldIdentifier:P,file:I}=S,F=await this.client.files.getFilePayload(I);F.sha1 in l||(l[F.sha1]=F);const g=_({file:URL.createObjectURL(I),file_type:I.type,file_name:I.name,file_sha1:F.sha1,created_by:o,field_values:O,submitted_at:d,field_identifier:P});r.push(g);const v={uuid:g.uuid,file_name:I.name,file_sha1:F.sha1,file_extension:F.extension,field_identifier:P,field_values:O};h.push(v)}this.dispatch(n(r));const y=this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:{submitted_at:d,attachments:h,files:Object.values(l)},blockers:r.map(S=>S.field_values),blocks:r.map(S=>S.uuid)});return y.then(({presigned_urls:S,attachments:O})=>{this.client.files.processPresignedUrls(S),this.dispatch(a(O))}).catch(S=>{throw this.dispatch(c(r.map(O=>O.uuid))),S}),[r,y.then(({attachments:S})=>S)]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:d}=this.selectors,o=n.getState(),l=d(e)(o);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!0),method:p.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{field_values__workflow__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class Dk extends k{constructor(){super(...arguments);m(this,"name","Workflow Step Field Values");m(this,"url","/workflow-step-field-values");m(this,"actions",{addOne:iP,addMany:va,setOne:nP,setMany:aP,updateOne:cP,updateMany:rP,deleteOne:dP,deleteMany:Ea,initialize:sP});m(this,"selectors",{selectById:uP,selectByIds:hP})}add(e){var f;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,r=new Date().toISOString(),h=_({...e,created_by:l,submitted_at:r}),y=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(h),blockers:[e.workflow,e.workflow_step,e.fields_revision],blocks:[h.uuid]});return this.dispatch(a(h)),y.then(S=>{this.dispatch(c(S))}).catch(()=>{this.dispatch(d(h.uuid))}),[h,y]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=n.getState(),o=c(e.uuid)(d);if(!o)throw new Error(`Expected WorkflowStepFieldValues with uuid ${e.uuid} to exist`);const l={...o,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[l.uuid,l.fields_revision,l.workflow,l.workflow_step],blocks:[l.uuid]});return r.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(o))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected submission with uuid ${e} to exist`);const r=xF(e)(o);this.dispatch(a(e)),this.dispatch(Ra(B(r)));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(l)),this.dispatch(_a(r)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{workflow__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class $k extends k{constructor(){super(...arguments);m(this,"name","Workflow Step Fields Attachment");m(this,"url","/workflow-step-fields-attachments");m(this,"actions",{addOne:fP,addMany:Wa,setOne:SP,setMany:AP,updateOne:wP,updateMany:TP,deleteOne:OP,deleteMany:Ba,initialize:yP});m(this,"selectors",{selectById:PP,selectByIds:gP})}async bulkAdd(e){var f;const{addMany:n,setMany:a,deleteMany:c}=this.actions,d=new Date().toISOString(),o=((f=this.client.store.getState().userReducer.currentUser)==null?void 0:f.id)??null,l={},r=[],h=[];for(const S of e){const{fieldsRevisionUuid:O,fieldIdentifier:P,file:I}=S,F=await this.client.files.getFilePayload(I);F.sha1 in l||(l[F.sha1]=F);const g=_({file:URL.createObjectURL(I),file_type:I.type,file_name:I.name,file_sha1:F.sha1,created_by:o,fields_revision:O,submitted_at:d,field_identifier:P});r.push(g);const v={uuid:g.uuid,file_name:I.name,field_identifier:P,file_extension:F.extension,file_sha1:F.sha1,fields_revision:O};h.push(v)}this.dispatch(n(r));const y=this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:{submitted_at:d,attachments:h,files:Object.values(l)},blockers:r.map(S=>S.fields_revision),blocks:r.map(S=>S.uuid)});return y.then(S=>{this.client.files.processPresignedUrls(S.presigned_urls),this.dispatch(a(S.attachments))}).catch(()=>{this.dispatch(c(r.map(S=>S.uuid)))}),[r,y.then(({attachments:S})=>S)]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{fields_revision__workflow_step__workflow_type__organization:e}},n);return this.dispatch(a(c)),c}}class Uk extends k{constructor(){super(...arguments);m(this,"name","Workflow Step Fields");m(this,"url","/workflow-step-fields");m(this,"actions",{addOne:MP,addMany:kP,setOne:vP,setMany:EP,updateOne:VP,updateMany:WP,deleteOne:BP,deleteMany:zP,initialize:RP});m(this,"selectors",{selectById:qP,selectByIds:CP})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,o=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,l=new Date().toISOString(),r=_({...e,created_by:o,submitted_at:l});this.dispatch(a(r));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(r),blockers:[r.workflow_step],blocks:[r.uuid]});return h.then(f=>{this.dispatch(c(f))}).catch(f=>{throw this.dispatch(d(r.uuid)),f}),[r,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,c=n.getState().workflowStepFieldsReducer.instances[e.uuid];if(!c)throw new Error(`WorkflowStepFields with uuid ${e.uuid} not found`);const d={...c,...e};this.dispatch(a(d));const o=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${c.uuid}/`,payload:e,blockers:[c.uuid],blocks:[c.uuid]});return o.then(l=>{this.dispatch(a(l))}).catch(l=>{throw this.dispatch(a(c)),l}),[d,o]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,d=n.getState().workflowStepFieldsReducer.instances[e];if(!d)throw new Error(`WorkflowStepFields with uuid ${e} not found`);const o=FP(e)(n.getState());this.dispatch(a(e)),this.dispatch(Ba(B(o)));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(l){throw this.dispatch(c(d)),this.dispatch(Wa(o)),l}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{workflow_step__workflow_type__organization:e}},n);return this.dispatch(a(c)),c}}class Lk extends k{constructor(){super(...arguments);m(this,"name","Workflow Step Reviewer");m(this,"url","/workflow-step-reviewers");m(this,"actions",{addOne:UP,addMany:Da,setOne:LP,setMany:NP,updateOne:HP,updateMany:GP,deleteOne:KP,deleteMany:$a,initialize:$P});m(this,"selectors",{selectById:ZP,selectByIds:JP})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,o=new Date().toISOString(),l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,r=_({...e,submitted_at:o,created_by:l});this.dispatch(a(r));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(r),blockers:[e.workflow,e.workflow_step],blocks:[r.uuid]});return h.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(d(r.uuid))}),[r,h]}bulkAdd(e){var y;const{store:n}=this.client,{addMany:a,setMany:c,deleteMany:d}=this.actions,o=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,l=new Date().toISOString(),r=e.map(f=>_({...f,submitted_at:l,created_by:o}));this.dispatch(a(r));const h=this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:{reviewers:r.map(f=>E(f))},blockers:r.flatMap(f=>[f.workflow,f.workflow_step]),blocks:r.map(f=>f.uuid)});return h.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(d(r.map(f=>f.uuid)))}),[r,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Expected workflow step reviewer with uuid ${e.uuid} to exist`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return l.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected workflow step reviewer with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(r){throw this.dispatch(c(l)),r}}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:d}=this.selectors,o=n.getState(),l=d(e)(o);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!0),method:p.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{workflow__project:e}},n)).flat();return this.dispatch(a(d)),d}}class Nk extends k{constructor(){super(...arguments);m(this,"name","Workflow Step Review Request");m(this,"url","/workflow-step-review-requests");m(this,"actions",{addOne:tg,addMany:La,setOne:sg,setMany:ig,updateOne:ng,updateMany:ag,deleteOne:cg,deleteMany:Na,initialize:eg});m(this,"selectors",{selectById:dg,selectByIds:lg})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,o=new Date().toISOString(),l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,r=_({...e,submitted_at:o,created_by:l});this.dispatch(a(r));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(r),blockers:[e.workflow,e.workflow_step],blocks:[r.uuid]});return h.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(d(r.uuid))}),[r,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Expected workflow step review request with uuid ${e.uuid} to exist`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return l.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected workflow step review request with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{workflow__project:e}},n)).flat();return this.dispatch(a(d)),d}}class Hk extends k{constructor(){super(...arguments);m(this,"name","Workflow Step Review");m(this,"url","/workflow-step-reviews");m(this,"actions",{addOne:mg,addMany:Ga,setOne:yg,setMany:fg,updateOne:Sg,updateMany:Ag,deleteOne:wg,deleteMany:Ka,initialize:pg});m(this,"selectors",{selectById:Og,selectByIds:Ig})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,o=new Date().toISOString(),l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,r=_({...e,submitted_at:o,created_by:l});this.dispatch(a(r));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(r),blockers:[e.workflow,e.workflow_step],blocks:[r.uuid]});return h.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(d(r.uuid))}),[r,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Expected workflow step review with uuid ${e.uuid} to exist`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return l.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected workflow step review with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{workflow__project:e}},n)).flat();return this.dispatch(a(d)),d}}class Gk extends k{constructor(){super(...arguments);m(this,"name","Workflow Step");m(this,"url","/workflow-steps");m(this,"actions",{addOne:_g,addMany:Za,setOne:Rg,setMany:Mg,updateOne:kg,updateMany:vg,deleteOne:Eg,deleteMany:Ja,initialize:bg});m(this,"selectors",{selectById:Bg,selectByIds:qg})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,o=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,l=new Date().toISOString(),r=_({...e,created_by:o,submitted_at:l});this.dispatch(a(r));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(r),blockers:[r.workflow_type],blocks:[r.uuid]});return h.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(d(r.uuid))}),[r,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`No workflow step with uuid ${e.uuid} found in the store`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${d.uuid}/`,payload:{name:e.name,order:e.order},blockers:[d.uuid],blocks:[d.uuid]});return l.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`No workflow step with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{workflow_type__organization:e}},n);return this.dispatch(a(c)),c}}class Kk extends k{constructor(){super(...arguments);m(this,"name","Workflow Type");m(this,"url","/workflow-types");m(this,"actions",{addOne:Dg,addMany:$g,setOne:Ug,setMany:Lg,updateOne:Ng,updateMany:Hg,deleteOne:Gg,deleteMany:Kg,initialize:jg});m(this,"selectors",{selectById:Zg,selectByIds:Jg})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,o=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,l=new Date().toISOString(),r=_({...e,created_by:o,submitted_at:l});this.dispatch(a(r));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(r),blockers:[],blocks:[r.uuid]});return h.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(d(r.uuid))}),[r,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Expected workflow type with uuid ${e.uuid} to exist`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[d.uuid],blocks:[d.uuid]});return l.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected workflow type with uuid ${e} to exist`);const r=vI(e)(o),h=zg(e)(o);this.dispatch(a(e)),this.dispatch(la(B(r))),this.dispatch(Ja(B(h)));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(y){throw this.dispatch(c(l)),this.dispatch(da(r)),this.dispatch(Za(h)),y}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}async function ac(t,s,e,n,a){const c=n instanceof yt;c&&s.checkAuth!==!1&&await n.auth.prepareAuth();const d={queryParams:"",isAuthNeeded:!0},{s3url:o,payload:l,headers:r,method:h,queryParams:y,attachmentHash:f,isExternalUrl:S,isAuthNeeded:O,isResponseBlob:P}={...d,...s};let I=s.url;const F=f?await e.files.fetchCache(f):void 0;if(f&&!F)throw new Error(`Cannot upload file ${f} because it's not cached.`);!S&&!I.startsWith("http")&&(!I.startsWith("/")&&!I.startsWith("blob:")&&(I="/"+I),I=t+I);const g=C=>{if(f){if(!o)throw new Error(`No S3 URL for file ${f}`);if("warning"in o)throw new Error(`S3 URL warning for file ${f}`);if(!F)throw new Error(`No file for file ${f}`);const q=o.fields["x-amz-checksum-sha1"];if(!q)throw new Error(`No checksum for file ${f}`);return C.set("x-amz-checksum-sha1",q).field({...l,...o.fields}).attach("file",F)}return C.send(l)},V={[p.GET]:()=>P?St.get(I.toString()).responseType("blob"):St.get(I.toString()),[p.POST]:()=>{const C=St.post(I.toString());return g(C)},[p.PATCH]:()=>{const C=St.patch(I.toString());return g(C)},[p.PUT]:()=>{const C=St.put(I.toString());return g(C)},[p.DELETE]:()=>{const C=St.delete(I.toString());return g(C)}}[h];let W=V();if(a==null||a.addEventListener("abort",()=>{console.debug("aborting request:",s.url),W.abort()}),O&&c){const C=n.auth.getAuthHeader();W=W.set("Authorization",C)}r&&(W=W.set(r));try{return await W.query(y)}catch(C){const q=mb(C),bb=q==null?void 0:q.status;if(c&&bb===401)return await n.auth.handleUnauthorized(W,q),W.query(y);throw new D({response:q,innerError:C,discard:tc.includes(bb)})}}class Yk{constructor(s){m(this,"store");this.store=s}_performRequest(s,e,n,a){const c=new fs,d={...e,uuid:e.uuid??mt.v4()};return ac(s,d,this,n,a).then(o=>{c.resolve(o.body)}).catch(o=>{o instanceof Error?c.reject(o):c.reject(new Error((o??wt).toString()))}),c}async performRequest(s,e,n,a){return this._performRequest(s,e,n,a).then(c=>{if(c instanceof D)throw c;return c})}async enqueueRequest(s,e,n){return this._enqueueRequest(s,e,n).then(a=>{if(a instanceof D)throw a;return a})}_enqueueRequest(s,e,n){const a=new fs,c={...s,BASE_URL:e,serviceName:n},d=this.store.dispatch(zT(c)),o=r=>{if(r)a.resolve(r.body);else{const h=new D({message:"Could not get a response from the server.",response:r,discard:!0});a.reject(h)}},l=r=>{r instanceof D?r.options.discard=!0:(console.error("Received an unexpected error while processing a request:",r,`
15
- Converting error to APIError and discarding.`),r=new D({message:"An error occurred while processing the request.",innerError:r,discard:!0})),a.reject(r)};return d.then(o,l),a}async performPagination(s,e,n,a,c){const d={...e,queryParams:{...e.queryParams,paginate:!0,limit:n}},{method:o}=d,l=[];let r=await this.performRequest(s,d,a,c);for(l.push(r.results);r.next;)r=await this.performRequest(s,{url:r.next,method:o},a,c),l.push(r.results);return l}}class Ot{constructor(){m(this,"graph");m(this,"requestAttemptCounter");this.graph=new Wb.DepGraph,this.requestAttemptCounter={}}static _fromOutbox(s){const e=new Ot;for(let n=0;n<s.length;n++){const a=s[n];if(!a){console.error("Outbox item was undefined");continue}e.sneakRequest(a);for(let c=0;c<n;c++){const d=s[c];if(!d){console.error("Previous outbox item was undefined");continue}d.payload.uuid!==a.payload.uuid&&d.payload.blocks.some(o=>a.payload.blockers.includes(o))&&Ot._addDependency(a.payload.uuid,d.payload.uuid,e.graph)}}return e}_addDependency(s,e){Ot._addDependency(s,e,this.graph)}static _addDependency(s,e,n){if(s===e)throw new Error(`Tried to add dependency from node to itself: ${s}`);if(!n.hasNode(s))throw new Error(`Tried to add dependency from non-existent node: ${s} (to node: ${e})`);if(!n.hasNode(e))throw new Error(`Tried to add dependency to non-existent node: ${e} (from node: ${s})`);n.addDependency(s,e)}addRequest(s){if(this.graph.addNode(s.payload.uuid,s),!(s.payload.blockers.length===0||this.graph.size()===1))for(const e of this.graph.overallOrder()){if(e===s.payload.uuid)continue;const n=this.graph.getNodeData(e),a=new Set(n.payload.blocks);s.payload.blockers.some(c=>a.has(c))&&this._addDependency(s.payload.uuid,e)}}insertRequest(s){this.graph.addNode(s.payload.uuid,s);for(const e of this.graph.overallOrder()){if(e===s.payload.uuid)continue;const n=this.graph.getNodeData(e),a=new Set(s.payload.blocks);n.payload.blockers.some(c=>a.has(c))&&this._addDependency(e,s.payload.uuid)}}sneakRequest(s){this.graph.addNode(s.payload.uuid,s)}_getNextNode(){const s=this.graph.overallOrder(!0);let e=1/0,n;for(const a of s){const c=this.requestAttemptCounter[a]||0;c<e&&(e=c,n=a)}return n}peek(){const s=this._getNextNode();if(s)return this.graph.getNodeData(s)}remove(s){this.graph.removeNode(s),delete this.requestAttemptCounter[s]}pop(){const s=this.peek();return s&&this.graph.removeNode(s.payload.uuid),s}getQueue(){const s=this.graph.overallOrder().map(n=>this.graph.getNodeData(n)),e=this._getNextNode();if(e){const n=this.graph.getNodeData(e),a=s.findIndex(c=>c.payload.uuid===n.payload.uuid);a!==-1&&(s.splice(a,1),s.unshift(n))}return s}getReady(){let s=this.graph.overallOrder(!0).map(e=>this.graph.getNodeData(e));return s=s.sort((e,n)=>e.meta.offline.effect.timestamp.localeCompare(n.meta.offline.effect.timestamp)),s=s.sort((e,n)=>{const a=this.requestAttemptCounter[e.payload.uuid]||0,c=this.requestAttemptCounter[n.payload.uuid]||0;return a-c}),s}registerRetry(s){this.requestAttemptCounter[s]=(this.requestAttemptCounter[s]||0)+1}}let yb;function fb(t){yb=t}function It(){return yb}let Sb;function Ab(t){Sb=t}function wb(){return Sb}let cc=null;function ft(){const t=It();if(!t)return console.warn("Client store not set; cannot get outbox coordinator yet."),null;if(cc)return cc;const s=t.getState().offline.outbox,e=Ot._fromOutbox(s);return cc=e,e}const Zk=(t,s)=>{const e=new s(t);return Ab(e),fb(t),e};class Jk{constructor(s){m(this,"_all");m(this,"_previous");this._all=[s],this._previous=s,this.then=this.then.bind(this),this.compile=this.compile.bind(this)}then(s){return this._previous&&(this._previous.next=s),this._all.push(s),this._previous=s,{then:this.then,compile:this.compile}}compile(){return this._all}}class rc{constructor(){m(this,"next");this.next=null}then(s){return new Jk(this).then(s)}async run(s){if(this.next)return this.next.run(s);{if(console.debug("Middleware finished. Performing request:",s.payload.url),!It())throw new Error("Client store not set");const n=wb();if(!n)throw new Error("Client SDK not set");return ub(s,n)}}}class Tb extends rc{async run(s){return super.run(s)}}class Ob extends rc{async run(s){return super.run(s)}}const Ib=new Tb().then(new Ob).compile();function Fb(t){var s;return(s=Ib[0])==null?void 0:s.run(t)}var Pb=(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))(Pb||{});i.ALL_MIDDLEWARE=Ib,i.APIError=D,i.ATTACHMENT_MODEL_DEFAULT_PAGE_SIZE=sb,i.AgentService=wM,i.AssetAttachmentService=TM,i.AssetProcedureService=bM,i.AssetProcedureStepFieldValuesAttachmentService=kM,i.AssetProcedureStepFieldValuesService=vM,i.AssetProcedureStepFieldsAttachmentService=RM,i.AssetProcedureStepFieldsService=MM,i.AssetProcedureStepService=EM,i.AssetProcedureTypeAttachmentService=OM,i.AssetProcedureTypeFieldValuesAttachmentService=PM,i.AssetProcedureTypeFieldValuesService=gM,i.AssetProcedureTypeFieldsAttachmentService=IM,i.AssetProcedureTypeFieldsService=FM,i.AssetProcedureTypeService=_M,i.AssetService=VM,i.AssetStageCompletionService=WM,i.AssetStageService=BM,i.AssetStatusType=pc,i.AssetTypeAttachmentService=zM,i.AssetTypeFieldValuesAttachmentService=jM,i.AssetTypeFieldValuesService=DM,i.AssetTypeFieldsAttachmentService=qM,i.AssetTypeFieldsService=CM,i.AssetTypeIdentifierService=$M,i.AssetTypeIdentifierValueService=UM,i.AssetTypeService=LM,i.AssetTypeStatusService=NM,i.AttachmentModel=mc,i.BaseApiService=yt,i.BaseModelApiService=Tt,i.BaseOfflineAttachmentModelService=L,i.BaseOfflineModelApiService=k,i.BaseSDK=Yk,i.COMMON_AUTO_FIELDS=Fc,i.CategoryService=HM,i.DEFAULT_ISSUE_PRIORITY=Bb,i.DEFAULT_PAGE_SIZE=tb,i.DISCARD_HTTP_STATUSES=tc,i.DeferredPromise=fs,i.DocumentAttachmentService=GM,i.DocumentService=KM,i.EMPTY_ARRAY=oc,i.EMPTY_OBJECT=uc,i.EmailDomainsService=YM,i.EmailVerificationService=ZM,i.FileService=QM,i.FormIdentifierService=XM,i.FormIdentifierValueService=xM,i.FormRevisionAttachmentService=ek,i.FormRevisionService=tk,i.FormService=sk,i.FormSubmissionAttachmentService=ik,i.FormSubmissionService=nk,i.GeoImageService=ak,i.HttpMethod=p,i.IssueAssociationService=ck,i.IssueAttachmentService=rk,i.IssueCommentAttachmentService=dk,i.IssueCommentService=lk,i.IssuePriority=ys,i.IssueService=ok,i.IssueStatusType=yc,i.IssueTypeAttachmentService=uk,i.IssueTypeFieldValuesAttachmentService=mk,i.IssueTypeFieldValuesService=yk,i.IssueTypeFieldsAttachmentService=hk,i.IssueTypeFieldsService=pk,i.IssueTypeIdentifierService=fk,i.IssueTypeIdentifierValueService=Sk,i.IssueTypeService=Ak,i.IssueTypeStatusService=wk,i.IssueUpdateChange=j,i.IssueUpdateService=Tk,i.JWTService=Fk,i.MAX_SERVICE_BATCH_SIZE=U,i.OUTBOX_RETRY_DELAY=Ac,i.OfflineAnalyticsMiddleware=Tb,i.OfflineMiddleware=rc,i.OrganizationAccessLevel=hc,i.OrganizationAccessService=Pk,i.OrganizationService=gk,i.OutboxCoordinator=Ot,i.ProjectAccessService=bk,i.ProjectAttachmentService=_k,i.ProjectFileService=Rk,i.ProjectService=Mk,i.RESET_ORGANIZATION_STATE=M,i.RESET_PROJECT_STATE=z,i.RESET_STATE=b,i.RateLimitingMiddleware=Ob,i.SelectorBuilder=a_,i.TeamMembershipService=kk,i.TeamService=vk,i.UNKNOWN_ERROR_MESSAGE=wt,i.UserService=Ek,i.VERSION_REDUCER_KEY=Ft,i.VerificationCodeType=Pb,i.WorkflowReviewType=fc,i.WorkflowService=Vk,i.WorkflowStepAssigneeService=Wk,i.WorkflowStepCommentAttachmentService=Bk,i.WorkflowStepCommentService=zk,i.WorkflowStepCompletionService=qk,i.WorkflowStepEventService=Ck,i.WorkflowStepEventType=Sc,i.WorkflowStepFieldValuesAttachmentService=jk,i.WorkflowStepFieldValuesService=Dk,i.WorkflowStepFieldsAttachmentService=$k,i.WorkflowStepFieldsService=Uk,i.WorkflowStepReviewRequestService=Nk,i.WorkflowStepReviewService=Hk,i.WorkflowStepReviewerService=Lk,i.WorkflowStepService=Gk,i.WorkflowTypeService=Kk,i._setLatestRetryTime=CT,i.addAsset=xl,i.addAssetAttachment=Cc,i.addAssetAttachments=gs,i.addAssetProcedure=hd,i.addAssetProcedureStep=$l,i.addAssetProcedureStepFieldValues=gl,i.addAssetProcedureStepFieldValuesAttachment=hl,i.addAssetProcedureStepFieldValuesAttachments=Ys,i.addAssetProcedureStepFieldValuesMany=bl,i.addAssetProcedureStepFields=xd,i.addAssetProcedureStepFieldsAttachment=jd,i.addAssetProcedureStepFieldsAttachments=Dd,i.addAssetProcedureStepFieldsMany=el,i.addAssetProcedureSteps=Ul,i.addAssetProcedureType=gd,i.addAssetProcedureTypeAttachment=Qc,i.addAssetProcedureTypeAttachments=Xc,i.addAssetProcedureTypeFieldValues=Xr,i.addAssetProcedureTypeFieldValuesAttachment=jr,i.addAssetProcedureTypeFieldValuesAttachments=Ws,i.addAssetProcedureTypeFieldValuesMany=xr,i.addAssetProcedureTypeFields=gr,i.addAssetProcedureTypeFieldsAttachment=ur,i.addAssetProcedureTypeFieldsAttachments=hr,i.addAssetProcedureTypeFieldsMany=br,i.addAssetProcedureTypes=bd,i.addAssetProcedures=js,i.addAssetStage=ko,i.addAssetStageCompletion=po,i.addAssetStageCompletions=mo,i.addAssetStages=vo,i.addAssetType=vh,i.addAssetTypeAttachment=$o,i.addAssetTypeAttachments=di,i.addAssetTypeFieldValues=$u,i.addAssetTypeFieldValuesAttachment=Ru,i.addAssetTypeFieldValuesAttachments=yi,i.addAssetTypeFieldValuesMany=Uu,i.addAssetTypeFields=mu,i.addAssetTypeFieldsAttachment=eu,i.addAssetTypeFieldsAttachments=tu,i.addAssetTypeFieldsMany=yu,i.addAssetTypeIdentifier=th,i.addAssetTypeIdentifierValue=yh,i.addAssetTypeIdentifierValues=fh,i.addAssetTypeIdentifiers=sh,i.addAssetTypeStatus=Lh,i.addAssetTypeStatuses=Nh,i.addAssetTypes=Eh,i.addAssets=ti,i.addCategories=rp,i.addCategory=cp,i.addConversation=Ec,i.addConversations=c_,i.addDocument=Vp,i.addDocumentAttachment=wp,i.addDocumentAttachments=Tp,i.addDocuments=Wp,i.addEmailDomain=Kp,i.addEmailDomains=Yp,i.addForm=oy,i.addFormIdentifier=hm,i.addFormIdentifierValue=bm,i.addFormIdentifierValues=_m,i.addFormIdentifiers=pm,i.addFormRevision=$i,i.addFormRevisionAttachment=Dm,i.addFormRevisionAttachments=$m,i.addFormRevisions=Ui,i.addFormSubmission=Cy,i.addFormSubmissionAttachment=Py,i.addFormSubmissionAttachments=Zi,i.addFormSubmissions=tn,i.addForms=uy,i.addGeoImage=Qy,i.addGeoImages=Xy,i.addIssue=uS,i.addIssueAssociation=mf,i.addIssueAssociations=Yt,i.addIssueAttachment=gf,i.addIssueAttachments=ln,i.addIssueComment=Xf,i.addIssueCommentAttachment=Cf,i.addIssueCommentAttachments=jf,i.addIssueComments=xf,i.addIssueType=pw,i.addIssueTypeAttachment=PS,i.addIssueTypeAttachments=gS,i.addIssueTypeFieldValues=XS,i.addIssueTypeFieldValuesAttachment=bA,i.addIssueTypeFieldValuesAttachments=bn,i.addIssueTypeFieldValuesMany=xS,i.addIssueTypeFields=hA,i.addIssueTypeFieldsAttachment=CS,i.addIssueTypeFieldsAttachments=jS,i.addIssueTypeFieldsMany=pA,i.addIssueTypeIdentifier=jA,i.addIssueTypeIdentifierValue=xA,i.addIssueTypeIdentifierValues=ew,i.addIssueTypeIdentifiers=DA,i.addIssueTypeStatus=_w,i.addIssueTypeStatuses=Rw,i.addIssueTypes=mw,i.addIssueUpdate=Cn,i.addIssueUpdates=jn,i.addIssues=Sn,i.addOrganization=PT,i.addOrganizationAccess=rT,i.addOrganizationAccesses=dT,i.addOrganizations=FT,i.addProject=zO,i.addProjectAccess=UT,i.addProjectAccesses=LT,i.addProjectAttachment=tO,i.addProjectAttachments=sO,i.addProjectFile=SO,i.addProjectFiles=AO,i.addProjects=BO,i.addTeam=dI,i.addTeamMembership=YO,i.addTeamMemberships=ZO,i.addTeams=lI,i.addUser=Hn,i.addUsers=Xw,i.addWorkflow=II,i.addWorkflowStep=_g,i.addWorkflowStepAssignee=BI,i.addWorkflowStepAssignees=ua,i.addWorkflowStepComment=cF,i.addWorkflowStepCommentAttachment=YI,i.addWorkflowStepCommentAttachments=as,i.addWorkflowStepComments=Sa,i.addWorkflowStepCompletion=wF,i.addWorkflowStepCompletions=Ta,i.addWorkflowStepEvent=EF,i.addWorkflowStepEvents=Fa,i.addWorkflowStepFieldValues=iP,i.addWorkflowStepFieldValuesAttachment=NF,i.addWorkflowStepFieldValuesAttachments=_a,i.addWorkflowStepFieldValuesMany=va,i.addWorkflowStepFields=MP,i.addWorkflowStepFieldsAttachment=fP,i.addWorkflowStepFieldsAttachments=Wa,i.addWorkflowStepFieldsMany=kP,i.addWorkflowStepReview=mg,i.addWorkflowStepReviewRequest=tg,i.addWorkflowStepReviewRequests=La,i.addWorkflowStepReviewer=UP,i.addWorkflowStepReviewers=Da,i.addWorkflowStepReviews=Ga,i.addWorkflowSteps=Za,i.addWorkflowType=Dg,i.addWorkflowTypes=$g,i.addWorkflows=da,i.agentsReducer=Bc,i.agentsSlice=Is,i.areArraysEqual=jb,i.assetAttachmentReducer=Yc,i.assetAttachmentSlice=Ps,i.assetProcedureReducer=Ad,i.assetProcedureSlice=Cs,i.assetProcedureStepFieldValuesAttachmentReducer=Il,i.assetProcedureStepFieldValuesAttachmentSlice=Ks,i.assetProcedureStepFieldValuesReducer=zl,i.assetProcedureStepFieldValuesSlice=Qs,i.assetProcedureStepFieldsAttachmentReducer=Jd,i.assetProcedureStepFieldsAttachmentSlice=Ls,i.assetProcedureStepFieldsReducer=ll,i.assetProcedureStepFieldsSlice=Hs,i.assetProcedureStepReducer=Kl,i.assetProcedureStepSlice=Xs,i.assetProcedureTypeAttachmentReducer=ar,i.assetProcedureTypeAttachmentSlice=Rs,i.assetProcedureTypeFieldValuesAttachmentReducer=Hr,i.assetProcedureTypeFieldValuesAttachmentSlice=Vs,i.assetProcedureTypeFieldValuesReducer=cd,i.assetProcedureTypeFieldValuesSlice=qs,i.assetProcedureTypeFieldsAttachmentReducer=wr,i.assetProcedureTypeFieldsAttachmentSlice=ks,i.assetProcedureTypeFieldsReducer=Vr,i.assetProcedureTypeFieldsSlice=Es,i.assetProcedureTypeReducer=Vd,i.assetProcedureTypeSlice=$s,i.assetReducer=oo,i.assetSlice=ei,i.assetStageCompletionReducer=Oo,i.assetStageCompletionSlice=ii,i.assetStageReducer=zo,i.assetStageSlice=ni,i.assetTypeAttachmentReducer=Qo,i.assetTypeAttachmentSlice=ri,i.assetTypeFieldValuesAttachmentReducer=Cu,i.assetTypeFieldValuesAttachmentSlice=mi,i.assetTypeFieldValuesReducer=Xu,i.assetTypeFieldValuesSlice=Ai,i.assetTypeFieldsAttachmentReducer=uu,i.assetTypeFieldsAttachmentSlice=ui,i.assetTypeFieldsReducer=gu,i.assetTypeFieldsSlice=pi,i.assetTypeIdentifierReducer=hh,i.assetTypeIdentifierSlice=wi,i.assetTypeIdentifierValueReducer=bh,i.assetTypeIdentifierValueSlice=Oi,i.assetTypeReducer=Dh,i.assetTypeSlice=Ii,i.assetTypeStatusReducer=ep,i.assetTypeStatusSlice=Pi,i.assetTypeStatusSortFn=bc,i.authReducer=ip,i.authSlice=Lt,i.baseReducer=nM,i.baseReducers=ec,i.blobToBase64=Yb,i.categoryReducer=fp,i.categorySlice=bi,i.clearTokens=N_,i.constructUploadedFilePayloads=Kb,i.createModelAdapter=R,i.createOfflineAction=WT,i.createPayload=E,i.createSelectionAdapter=zb,i.deleteAsset=so,i.deleteAssetAttachment=Lc,i.deleteAssetAttachments=bs,i.deleteAssetProcedure=yd,i.deleteAssetProcedureStep=Hl,i.deleteAssetProcedureStepFieldValues=vl,i.deleteAssetProcedureStepFieldValuesAttachment=Sl,i.deleteAssetProcedureStepFieldValuesAttachments=Zs,i.deleteAssetProcedureStepFieldValuesMany=El,i.deleteAssetProcedureStepFields=al,i.deleteAssetProcedureStepFieldsAttachment=Hd,i.deleteAssetProcedureStepFieldsAttachments=Gd,i.deleteAssetProcedureStepFieldsMany=cl,i.deleteAssetProcedureSteps=Gl,i.deleteAssetProcedureType=Md,i.deleteAssetProcedureTypeAttachment=ir,i.deleteAssetProcedureTypeAttachments=nr,i.deleteAssetProcedureTypeFieldValues=nd,i.deleteAssetProcedureTypeFieldValuesAttachment=Nr,i.deleteAssetProcedureTypeFieldValuesAttachments=Bs,i.deleteAssetProcedureTypeFieldValuesMany=ad,i.deleteAssetProcedureTypeFields=vr,i.deleteAssetProcedureTypeFieldsAttachment=Sr,i.deleteAssetProcedureTypeFieldsAttachments=Ar,i.deleteAssetProcedureTypeFieldsMany=Er,i.deleteAssetProcedureTypes=kd,i.deleteAssetProcedures=Ds,i.deleteAssetStage=Wo,i.deleteAssetStageCompletion=wo,i.deleteAssetStageCompletions=To,i.deleteAssetStages=Bo,i.deleteAssetType=Bh,i.deleteAssetTypeAttachment=Go,i.deleteAssetTypeAttachments=li,i.deleteAssetTypeFieldValues=Ku,i.deleteAssetTypeFieldValuesAttachment=Vu,i.deleteAssetTypeFieldValuesAttachments=fi,i.deleteAssetTypeFieldValuesMany=Yu,i.deleteAssetTypeFields=Tu,i.deleteAssetTypeFieldsAttachment=cu,i.deleteAssetTypeFieldsAttachments=ru,i.deleteAssetTypeFieldsMany=Ou,i.deleteAssetTypeIdentifier=rh,i.deleteAssetTypeIdentifierValue=Oh,i.deleteAssetTypeIdentifierValues=Ih,i.deleteAssetTypeIdentifiers=dh,i.deleteAssetTypeStatus=Zh,i.deleteAssetTypeStatuses=Jh,i.deleteAssetTypes=zh,i.deleteAssets=si,i.deleteCategories=pp,i.deleteCategory=hp,i.deleteConversation=l_,i.deleteConversations=o_,i.deleteDocument=jp,i.deleteDocumentAttachment=gp,i.deleteDocumentAttachments=bp,i.deleteDocuments=Dp,i.deleteEmailDomain=xp,i.deleteEmailDomains=em,i.deleteForm=fy,i.deleteFormIdentifier=Am,i.deleteFormIdentifierValue=Em,i.deleteFormIdentifierValues=Vm,i.deleteFormIdentifiers=wm,i.deleteFormRevision=Li,i.deleteFormRevisionAttachment=Gm,i.deleteFormRevisionAttachments=Km,i.deleteFormRevisions=Ni,i.deleteFormSubmission=$y,i.deleteFormSubmissionAttachment=My,i.deleteFormSubmissionAttachments=Ji,i.deleteFormSubmissions=sn,i.deleteForms=Sy,i.deleteGeoImage=tf,i.deleteGeoImages=sf,i.deleteIssue=fS,i.deleteIssueAssociation=yf,i.deleteIssueAssociations=Zt,i.deleteIssueAttachment=kf,i.deleteIssueAttachments=on,i.deleteIssueComment=nS,i.deleteIssueCommentAttachment=Nf,i.deleteIssueCommentAttachments=Hf,i.deleteIssueComments=aS,i.deleteIssueType=ww,i.deleteIssueTypeAttachment=kS,i.deleteIssueTypeAttachments=vS,i.deleteIssueTypeFieldValues=nA,i.deleteIssueTypeFieldValuesAttachment=vA,i.deleteIssueTypeFieldValuesAttachments=_n,i.deleteIssueTypeFieldValuesMany=aA,i.deleteIssueTypeFields=AA,i.deleteIssueTypeFieldsAttachment=NS,i.deleteIssueTypeFieldsAttachments=HS,i.deleteIssueTypeFieldsMany=wA,i.deleteIssueTypeIdentifier=HA,i.deleteIssueTypeIdentifierValue=aw,i.deleteIssueTypeIdentifierValues=cw,i.deleteIssueTypeIdentifiers=GA,i.deleteIssueTypeStatus=Vw,i.deleteIssueTypeStatuses=Ww,i.deleteIssueTypes=Tw,i.deleteIssueUpdate=Dn,i.deleteIssueUpdates=$n,i.deleteIssues=An,i.deleteOrganization=_T,i.deleteOrganizationAccess=pT,i.deleteOrganizationAccesses=mT,i.deleteOrganizations=RT,i.deleteProject=jO,i.deleteProjectAccess=YT,i.deleteProjectAccesses=ZT,i.deleteProjectAttachment=rO,i.deleteProjectAttachments=dO,i.deleteProjectFile=OO,i.deleteProjectFiles=IO,i.deleteProjects=DO,i.deleteTeam=mI,i.deleteTeamMembership=eI,i.deleteTeamMemberships=tI,i.deleteTeams=yI,i.deleteUser=Gn,i.deleteUsers=tT,i.deleteWorkflow=_I,i.deleteWorkflowStep=Eg,i.deleteWorkflowStepAssignee=DI,i.deleteWorkflowStepAssignees=ha,i.deleteWorkflowStepComment=uF,i.deleteWorkflowStepCommentAttachment=xI,i.deleteWorkflowStepCommentAttachments=cs,i.deleteWorkflowStepComments=Aa,i.deleteWorkflowStepCompletion=PF,i.deleteWorkflowStepCompletions=Oa,i.deleteWorkflowStepEvent=qF,i.deleteWorkflowStepEvents=Pa,i.deleteWorkflowStepFieldValues=dP,i.deleteWorkflowStepFieldValuesAttachment=ZF,i.deleteWorkflowStepFieldValuesAttachments=Ra,i.deleteWorkflowStepFieldValuesMany=Ea,i.deleteWorkflowStepFields=BP,i.deleteWorkflowStepFieldsAttachment=OP,i.deleteWorkflowStepFieldsAttachments=Ba,i.deleteWorkflowStepFieldsMany=zP,i.deleteWorkflowStepReview=wg,i.deleteWorkflowStepReviewRequest=cg,i.deleteWorkflowStepReviewRequests=Na,i.deleteWorkflowStepReviewer=KP,i.deleteWorkflowStepReviewers=$a,i.deleteWorkflowStepReviews=Ka,i.deleteWorkflowSteps=Ja,i.deleteWorkflowType=Gg,i.deleteWorkflowTypes=Kg,i.deleteWorkflows=la,i.dequeue=ob,i.discard=hb,i.documentAttachmentReducer=kp,i.documentAttachmentSlice=Mi,i.documentSlice=vi,i.documentsReducer=$p,i.downloadFile=Zb,i.downloadInMemoryFile=Gb,i.emailDomainsReducer=nm,i.emailDomainsSlice=Vi,i.emailRegex=s_,i.enqueue=lb,i.enqueueRequest=zT,i.extractResponseFromError=mb,i.fallbackToEmptyArray=w,i.fallbackToEmptyObject=Vt,i.fileReducer=lm,i.fileSlice=Bi,i.fileToBlob=Oc,i.formIdentifierReducer=Fm,i.formIdentifierSlice=zi,i.formIdentifierValueReducer=qm,i.formIdentifierValueSlice=Ci,i.formReducer=Ay,i.formRevisionAttachmentReducer=Qm,i.formRevisionAttachmentSlice=ji,i.formRevisionReducer=ry,i.formRevisionsSlice=Di,i.formSlice=Gi,i.formSubmissionAttachmentReducer=Vy,i.formSubmissionAttachmentSlice=Yi,i.formSubmissionReducer=Gy,i.formSubmissionSlice=en,i.geoImageReducer=rf,i.geoImageSlice=an,i.getAssetProcedureStepSubTree=gc,i.getAssetProcedureStepTrees=i_,i.getClientSDK=wb,i.getClientStore=It,i.getDocumentSubTree=Mc,i.getDocumentTrees=n_,i.getFileIdentifier=Hb,i.getFileS3Key=Ts,i.getLocalDateString=wc,i.getLocalRelativeDateString=Lb,i.getOutboxCoordinator=ft,i.getRenamedFile=Tc,i.getRequestDescription=T,i.hashFile=At,i.initSDK=Zk,i.initializeAssetAttachments=qc,i.initializeAssetProcedureStepFieldValues=Pl,i.initializeAssetProcedureStepFieldValuesAttachments=ul,i.initializeAssetProcedureStepFields=Xd,i.initializeAssetProcedureStepFieldsAttachments=Cd,i.initializeAssetProcedureSteps=Cl,i.initializeAssetProcedureTypeAttachments=Jc,i.initializeAssetProcedureTypeFieldValues=Qr,i.initializeAssetProcedureTypeFieldValuesAttachments=Cr,i.initializeAssetProcedureTypeFields=Pr,i.initializeAssetProcedureTypeFieldsAttachments=or,i.initializeAssetProcedureTypes=Pd,i.initializeAssetProcedures=ud,i.initializeAssetStageCompletions=ho,i.initializeAssetStages=_o,i.initializeAssetTypeAttachments=Do,i.initializeAssetTypeFieldValues=Du,i.initializeAssetTypeFieldValuesAttachments=_u,i.initializeAssetTypeFields=pu,i.initializeAssetTypeFieldsAttachments=xo,i.initializeAssetTypeIdentifierValues=mh,i.initializeAssetTypeIdentifiers=eh,i.initializeAssetTypeStatuses=Uh,i.initializeAssetTypes=Rh,i.initializeAssets=Xl,i.initializeCategories=ap,i.initializeConversations=vc,i.initializeDocumentAttachments=Ap,i.initializeDocuments=Ep,i.initializeEmailDomains=Gp,i.initializeFormIdentifierValues=gm,i.initializeFormIdentifiers=um,i.initializeFormRevisionAttachments=jm,i.initializeFormRevisions=xm,i.initializeFormSubmissionAttachments=Fy,i.initializeFormSubmissions=By,i.initializeForms=ly,i.initializeGeoImages=Yy,i.initializeIssueAssociations=lf,i.initializeIssueAttachments=Pf,i.initializeIssueCommentAttachments=qf,i.initializeIssueComments=Qf,i.initializeIssueTypeAttachments=FS,i.initializeIssueTypeFieldValues=QS,i.initializeIssueTypeFieldValuesAttachments=gA,i.initializeIssueTypeFields=uA,i.initializeIssueTypeFieldsAttachments=qS,i.initializeIssueTypeIdentifierValues=XA,i.initializeIssueTypeIdentifiers=CA,i.initializeIssueTypeStatuses=bw,i.initializeIssueTypes=hw,i.initializeIssueUpdates=jw,i.initializeIssues=oS,i.initializeOrganizationAccesses=cT,i.initializeOrganizations=TT,i.initializeProjectAccesses=$T,i.initializeProjectAttachments=eO,i.initializeProjectFiles=mO,i.initializeProjects=EO,i.initializeTeamMemberships=KO,i.initializeTeams=rI,i.initializeUsers=Zw,i.initializeWorkflowStepAssignees=WI,i.initializeWorkflowStepCommentAttachments=KI,i.initializeWorkflowStepComments=aF,i.initializeWorkflowStepCompletions=AF,i.initializeWorkflowStepEvents=vF,i.initializeWorkflowStepFieldValues=sP,i.initializeWorkflowStepFieldValuesAttachments=LF,i.initializeWorkflowStepFields=RP,i.initializeWorkflowStepFieldsAttachments=yP,i.initializeWorkflowStepReviewRequests=eg,i.initializeWorkflowStepReviewers=$P,i.initializeWorkflowStepReviews=pg,i.initializeWorkflowSteps=bg,i.initializeWorkflowTypes=jg,i.initializeWorkflows=OI,i.isToday=Ub,i.issueAssociationReducer=If,i.issueAssociationSlice=rn,i.issueAttachmentReducer=Bf,i.issueAttachmentSlice=dn,i.issueCommentAttachmentReducer=Zf,i.issueCommentAttachmentSlice=hn,i.issueCommentReducer=dS,i.issueCommentSlice=mn,i.issueReducer=OS,i.issueSlice=fn,i.issueTypeAttachmentReducer=BS,i.issueTypeAttachmentSlice=wn,i.issueTypeFieldValuesAttachmentReducer=zA,i.issueTypeFieldValuesAttachmentSlice=gn,i.issueTypeFieldValuesReducer=lA,i.issueTypeFieldValuesSlice=Fn,i.issueTypeFieldsAttachmentReducer=ZS,i.issueTypeFieldsAttachmentSlice=On,i.issueTypeFieldsReducer=FA,i.issueTypeFieldsSlice=Pn,i.issueTypeIdentifierReducer=JA,i.issueTypeIdentifierSlice=Mn,i.issueTypeIdentifierValueReducer=ow,i.issueTypeIdentifierValueSlice=vn,i.issueTypeReducer=Pw,i.issueTypeSlice=En,i.issueTypeStatusReducer=qw,i.issueTypeStatusSlice=Wn,i.issueTypeStatusSortFn=_c,i.issueUpdateReducer=Kw,i.issueUpdateSlice=qn,i.logOnlyOnce=Jb,i.markAsDeleted=qT,i.markForDeletion=bR,i.memoize=As,i.organizationAccessReducer=yT,i.organizationAccessSlice=Yn,i.organizationReducer=VT,i.organizationSlice=Zn,i.outboxReducer=jT,i.outboxSlice=Jn,i.overmapEnhancer=pM,i.overmapReducer=aM,i.overmapReducers=eb,i.performRequest=ac,i.performRequestFromAction=ub,i.projectAccessReducer=JT,i.projectAccessSlice=Qn,i.projectAttachmentReducer=hO,i.projectAttachmentSlice=xn,i.projectFileReducer=kO,i.projectFileSlice=ta,i.projectReducer=$O,i.projectSlice=sa,i.rehydratedReducer=HO,i.rehydratedSlice=ia,i.restructureSelectorWithArgs=A,i.runMiddleware=Fb,i.saveActiveProjectFileBounds=gO,i.selectAccessToken=H_,i.selectAccessesByUserOfProject=RR,i.selectAccessibleProjects=VR,i.selectActiveOrganizationAccess=IR,i.selectActiveProjectFileId=vR,i.selectAllDocumentAttachments=ki,i.selectAssetAttachmentById=Hc,i.selectAssetAttachmentMapping=Nc,i.selectAssetAttachments=_s,i.selectAssetAttachmentsByIds=Gc,i.selectAssetById=ro,i.selectAssetProcedureById=Od,i.selectAssetProcedureStepById=Yl,i.selectAssetProcedureStepFieldValues=Pt,i.selectAssetProcedureStepFieldValuesAttachmentById=wl,i.selectAssetProcedureStepFieldValuesAttachments=Js,i.selectAssetProcedureStepFieldValuesAttachmentsByIds=Tl,i.selectAssetProcedureStepFieldValuesAttachmentsMapping=Al,i.selectAssetProcedureStepFieldValuesById=Wl,i.selectAssetProcedureStepFieldValuesByIds=Bl,i.selectAssetProcedureStepFieldValuesMapping=Vl,i.selectAssetProcedureStepFieldValuesOfAsset=g_,i.selectAssetProcedureStepFieldValuesOfAssetProcedure=b_,i.selectAssetProcedureStepFieldValuesOfAssetProcedureStep=__,i.selectAssetProcedureStepFields=Ct,i.selectAssetProcedureStepFieldsAttachmentById=Yd,i.selectAssetProcedureStepFieldsAttachments=Ns,i.selectAssetProcedureStepFieldsAttachmentsByIds=Zd,i.selectAssetProcedureStepFieldsAttachmentsMapping=Kd,i.selectAssetProcedureStepFieldsById=rl,i.selectAssetProcedureStepFieldsByIds=dl,i.selectAssetProcedureStepFieldsMapping=Gs,i.selectAssetProcedureStepFieldsOfAssetProcedureStep=I_,i.selectAssetProcedureStepMapping=jt,i.selectAssetProcedureSteps=xs,i.selectAssetProcedureStepsByIds=Zl,i.selectAssetProcedureStepsMappingOfAssetProcedureType=R_,i.selectAssetProcedureStepsOfAssetProcedureType=M_,i.selectAssetProcedureTypeAttachmentById=rr,i.selectAssetProcedureTypeAttachmentMapping=cr,i.selectAssetProcedureTypeAttachments=Ms,i.selectAssetProcedureTypeAttachmentsByIds=dr,i.selectAssetProcedureTypeById=Bd,i.selectAssetProcedureTypeFieldValues=zt,i.selectAssetProcedureTypeFieldValuesAttachmentById=Kr,i.selectAssetProcedureTypeFieldValuesAttachments=zs,i.selectAssetProcedureTypeFieldValuesAttachmentsByIds=Yr,i.selectAssetProcedureTypeFieldValuesAttachmentsMapping=Gr,i.selectAssetProcedureTypeFieldValuesById=dd,i.selectAssetProcedureTypeFieldValuesByIds=ld,i.selectAssetProcedureTypeFieldValuesMapping=rd,i.selectAssetProcedureTypeFieldValuesOfAsset=S_,i.selectAssetProcedureTypeFields=Bt,i.selectAssetProcedureTypeFieldsAttachmentById=Or,i.selectAssetProcedureTypeFieldsAttachments=vs,i.selectAssetProcedureTypeFieldsAttachmentsByIds=Ir,i.selectAssetProcedureTypeFieldsAttachmentsMapping=Tr,i.selectAssetProcedureTypeFieldsById=Br,i.selectAssetProcedureTypeFieldsByIds=zr,i.selectAssetProcedureTypeFieldsMapping=Wr,i.selectAssetProcedureTypeFieldsOfAssetProcedureType=y_,i.selectAssetProcedureTypes=Us,i.selectAssetProcedureTypesByIds=zd,i.selectAssetProcedureTypesMapping=Wd,i.selectAssetProcedureTypesOfOrganization=T_,i.selectAssetProcedures=qt,i.selectAssetProceduresByIds=Id,i.selectAssetProceduresMapping=wd,i.selectAssetProceduresOfAssetProcedureType=Td,i.selectAssetProceduresOfAssetType=w_,i.selectAssetStageById=qo,i.selectAssetStageCompletionById=Po,i.selectAssetStageCompletionMapping=Io,i.selectAssetStageCompletions=Fo,i.selectAssetStageCompletionsByIds=go,i.selectAssetStages=ci,i.selectAssetStagesByIds=Co,i.selectAssetStagesMappingOfAssetProcedureType=v_,i.selectAssetStagesOfAssetProcedureType=E_,i.selectAssetTypeAttachmentById=Yo,i.selectAssetTypeAttachmentMapping=Ko,i.selectAssetTypeAttachments=oi,i.selectAssetTypeAttachmentsByIds=Zo,i.selectAssetTypeById=Ch,i.selectAssetTypeFieldValues=$t,i.selectAssetTypeFieldValuesAttachmentById=Bu,i.selectAssetTypeFieldValuesAttachments=Si,i.selectAssetTypeFieldValuesAttachmentsByIds=zu,i.selectAssetTypeFieldValuesAttachmentsMapping=Wu,i.selectAssetTypeFieldValuesById=Ju,i.selectAssetTypeFieldValuesByIds=Qu,i.selectAssetTypeFieldValuesMapping=Zu,i.selectAssetTypeFieldValuesOfAsset=z_,i.selectAssetTypeFields=gt,i.selectAssetTypeFieldsAttachmentById=lu,i.selectAssetTypeFieldsAttachments=hi,i.selectAssetTypeFieldsAttachmentsByIds=ou,i.selectAssetTypeFieldsAttachmentsMapping=du,i.selectAssetTypeFieldsById=Fu,i.selectAssetTypeFieldsByIds=Pu,i.selectAssetTypeFieldsMapping=Iu,i.selectAssetTypeFieldsOfAssetType=W_,i.selectAssetTypeIdentifierById=oh,i.selectAssetTypeIdentifierMapping=lh,i.selectAssetTypeIdentifierValueById=Ph,i.selectAssetTypeIdentifierValueMapping=Fh,i.selectAssetTypeIdentifierValues=Ut,i.selectAssetTypeIdentifierValuesByIds=gh,i.selectAssetTypeIdentifierValuesOfAsset=j_,i.selectAssetTypeIdentifierValuesOfIdentifier=D_,i.selectAssetTypeIdentifiers=Ti,i.selectAssetTypeIdentifiersByIds=uh,i.selectAssetTypeIdentifiersOfAssetType=C_,i.selectAssetTypeStatusById=Xh,i.selectAssetTypeStatusMapping=Qh,i.selectAssetTypeStatuses=gi,i.selectAssetTypeStatusesByIds=xh,i.selectAssetTypeStatusesOfAssetType=U_,i.selectAssetTypeValuesOfAssetType=q_,i.selectAssetTypes=Fi,i.selectAssetTypesByIds=jh,i.selectAssetTypesMapping=qh,i.selectAssetTypesOfOrganization=$_,i.selectAssets=Dt,i.selectAssetsByIds=lo,i.selectAssetsMapping=ao,i.selectAssetsOfAssetType=co,i.selectAssetsOfProject=k_,i.selectAttachmentsOfAsset=Kc,i.selectAttachmentsOfAssetProcedureStepFieldValues=Ol,i.selectAttachmentsOfAssetProcedureStepFields=O_,i.selectAttachmentsOfAssetProcedureType=p_,i.selectAttachmentsOfAssetProcedureTypeFieldValues=Zr,i.selectAttachmentsOfAssetProcedureTypeFields=m_,i.selectAttachmentsOfAssetType=Jo,i.selectAttachmentsOfAssetTypeFieldValues=qu,i.selectAttachmentsOfAssetTypeFields=V_,i.selectAttachmentsOfDocument=Y_,i.selectAttachmentsOfFormRevision=sR,i.selectAttachmentsOfFormSubmission=Ey,i.selectAttachmentsOfIssue=Ef,i.selectAttachmentsOfIssueComment=cR,i.selectAttachmentsOfIssueType=lR,i.selectAttachmentsOfIssueTypeFieldValues=BA,i.selectAttachmentsOfIssueTypeFields=oR,i.selectAttachmentsOfProject=kR,i.selectAttachmentsOfWorkflowStepComment=ya,i.selectAttachmentsOfWorkflowStepFieldValues=xF,i.selectAttachmentsOfWorkflowStepFields=FP,i.selectCategories=_i,i.selectCategoriesByIds=yp,i.selectCategoriesOfProject=K_,i.selectCategoryById=Ri,i.selectCategoryMapping=mp,i.selectCommentsOfIssue=rR,i.selectCommentsOfWorkflow=yF,i.selectCommentsOfWorkflowStep=NR,i.selectConversation=h_,i.selectConversationMapping=Fs,i.selectConversations=u_,i.selectCurrentUser=iT,i.selectDeletedRequests=PR,i.selectDescendantsOfAssetProcedureStep=Jl,i.selectDescendantsOfDocument=Np,i.selectDocumentAttachmentById=Rp,i.selectDocumentAttachmentMapping=_p,i.selectDocumentAttachmentsByIds=Mp,i.selectDocumentById=Up,i.selectDocuments=Nt,i.selectDocumentsByIds=Lp,i.selectDocumentsMapping=Ei,i.selectEmailDomainById=sm,i.selectEmailDomains=Wi,i.selectEmailDomainsAsMapping=tm,i.selectEmailDomainsByIds=im,i.selectEmailDomainsOfOrganization=Q_,i.selectFieldValuesOfAssetProcedure=A_,i.selectFormById=Ty,i.selectFormIdentifierById=Om,i.selectFormIdentifierMapping=Tm,i.selectFormIdentifierValueById=Bm,i.selectFormIdentifierValueMapping=Wm,i.selectFormIdentifierValues=Ht,i.selectFormIdentifierValuesByIds=zm,i.selectFormIdentifierValuesOfFormSubmission=eR,i.selectFormIdentifierValuesOfIdentifier=tR,i.selectFormIdentifiers=qi,i.selectFormIdentifiersByIds=Im,i.selectFormIdentifiersOfForm=x_,i.selectFormMapping=wy,i.selectFormRevisionAttachmentById=Zm,i.selectFormRevisionAttachments=Ym,i.selectFormRevisionAttachmentsByIds=Jm,i.selectFormRevisionAttachmentsMapping=Gt,i.selectFormRevisionById=ny,i.selectFormRevisionMapping=Hi,i.selectFormRevisions=Kt,i.selectFormRevisionsByIds=ay,i.selectFormRevisionsOfForm=cy,i.selectFormSubmissionAttachemntsByIds=xi,i.selectFormSubmissionAttachmentById=ky,i.selectFormSubmissionAttachments=Xi,i.selectFormSubmissionAttachmentsByIds=vy,i.selectFormSubmissionAttachmentsMapping=Qi,i.selectFormSubmissionById=Ly,i.selectFormSubmissions=Uy,i.selectFormSubmissionsByIds=Ny,i.selectFormSubmissionsMapping=nn,i.selectFormSubmissionsOfForm=Hy,i.selectForms=Ki,i.selectFormsByIds=Oy,i.selectFormsOfOrganization=nR,i.selectGeoImageById=af,i.selectGeoImageMapping=nf,i.selectGeoImages=cn,i.selectGeoImagesByIds=cf,i.selectGeoImagesOfProject=aR,i.selectIsImportingProjectFile=ER,i.selectIsLoggedIn=G_,i.selectIssueAssociationById=Sf,i.selectIssueAssociationMapping=bt,i.selectIssueAssociations=ff,i.selectIssueAssociationsByIds=Af,i.selectIssueAssociationsOfAsset=Of,i.selectIssueAssociationsOfIssue=Tf,i.selectIssueAssociationsToIssue=wf,i.selectIssueAttachmentById=Vf,i.selectIssueAttachmentMapping=vf,i.selectIssueAttachments=un,i.selectIssueAttachmentsByIds=Wf,i.selectIssueById=AS,i.selectIssueCommentAttachmentById=Kf,i.selectIssueCommentAttachmentMapping=Gf,i.selectIssueCommentAttachments=pn,i.selectIssueCommentAttachmentsByIds=Yf,i.selectIssueCommentById=cS,i.selectIssueCommentMapping=yn,i.selectIssueCommentsByIds=rS,i.selectIssueMapping=SS,i.selectIssueTypeAttachmentById=VS,i.selectIssueTypeAttachmentMapping=ES,i.selectIssueTypeAttachments=Tn,i.selectIssueTypeAttachmentsByIds=WS,i.selectIssueTypeById=Iw,i.selectIssueTypeFieldValues=Qt,i.selectIssueTypeFieldValuesAttachmentById=VA,i.selectIssueTypeFieldValuesAttachments=Rn,i.selectIssueTypeFieldValuesAttachmentsByIds=WA,i.selectIssueTypeFieldValuesAttachmentsMapping=EA,i.selectIssueTypeFieldValuesById=rA,i.selectIssueTypeFieldValuesByIds=dA,i.selectIssueTypeFieldValuesMapping=cA,i.selectIssueTypeFieldValuesOfIssue=uR,i.selectIssueTypeFields=_t,i.selectIssueTypeFieldsAttachmentById=KS,i.selectIssueTypeFieldsAttachments=In,i.selectIssueTypeFieldsAttachmentsByIds=YS,i.selectIssueTypeFieldsAttachmentsMapping=GS,i.selectIssueTypeFieldsById=OA,i.selectIssueTypeFieldsByIds=IA,i.selectIssueTypeFieldsMapping=TA,i.selectIssueTypeFieldsOfIssueType=hR,i.selectIssueTypeIdentifierById=YA,i.selectIssueTypeIdentifierMapping=KA,i.selectIssueTypeIdentifierValueById=dw,i.selectIssueTypeIdentifierValueMapping=rw,i.selectIssueTypeIdentifierValues=Xt,i.selectIssueTypeIdentifierValuesByIds=lw,i.selectIssueTypeIdentifierValuesOfIdentifier=SR,i.selectIssueTypeIdentifierValuesOfIssue=fR,i.selectIssueTypeIdentifiers=kn,i.selectIssueTypeIdentifiersByIds=ZA,i.selectIssueTypeIdentifiersOfIssueType=yR,i.selectIssueTypeMapping=Ow,i.selectIssueTypeStatusById=zn,i.selectIssueTypeStatusMapping=Bw,i.selectIssueTypeStatuses=Bn,i.selectIssueTypeStatusesByIds=zw,i.selectIssueTypeStatusesOfIssueType=wR,i.selectIssueTypeValuesOfIssueType=mR,i.selectIssueTypes=Vn,i.selectIssueTypesByIds=Fw,i.selectIssueTypesOfOrganization=AR,i.selectIssueUpdateById=Nw,i.selectIssueUpdateMapping=Un,i.selectIssueUpdates=Ln,i.selectIssueUpdatesByIds=Hw,i.selectIssueUpdatesOfIssue=Gw,i.selectIssues=Jt,i.selectIssuesByIds=wS,i.selectIssuesOfIssueType=TS,i.selectIssuesOfProject=dR,i.selectLatestAssetProcedureStepFieldsOfAssetProcedureStep=F_,i.selectLatestAssetProcedureTypeFieldsOfAssetProcedureType=f_,i.selectLatestAssetTypeFieldsOfAssetType=B_,i.selectLatestFieldsByAssetProcedureStep=P_,i.selectLatestFieldsByWorkflowStep=QR,i.selectLatestFormRevisionOfForm=iR,i.selectLatestIssueTypeFieldsOfIssueType=pR,i.selectLatestRetryTime=gR,i.selectLatestWorkflowStepFieldsOfWorkflowStep=JR,i.selectMembershipsByUserOfTeam=CR,i.selectOrganizationAccessById=fT,i.selectOrganizationAccessMapping=ts,i.selectOrganizationAccessUserMapping=AT,i.selectOrganizationAccessesByIds=ST,i.selectOrganizationById=vT,i.selectOrganizationDocuments=J_,i.selectOrganizations=kT,i.selectOrganizationsByIds=ET,i.selectOrganizationsMapping=MT,i.selectProjectAccessById=QT,i.selectProjectAccessMapping=Xn,i.selectProjectAccesses=Rt,i.selectProjectAccessesByIds=XT,i.selectProjectAccessesOfProject=_R,i.selectProjectAttachmentById=oO,i.selectProjectAttachmentMapping=lO,i.selectProjectAttachments=ea,i.selectProjectAttachmentsByIds=uO,i.selectProjectById=LO,i.selectProjectDocuments=Z_,i.selectProjectFileById=RO,i.selectProjectFileMapping=bO,i.selectProjectFiles=_O,i.selectProjectFilesByIds=MO,i.selectProjectMapping=UO,i.selectProjects=ss,i.selectProjectsByIds=NO,i.selectProjectsOfOrganization=WR,i.selectRehydrated=qR,i.selectStageMapping=ai,i.selectTeamById=SI,i.selectTeamMembershipById=nI,i.selectTeamMemberships=is,i.selectTeamMembershipsByIds=aI,i.selectTeamMembershipsMapping=iI,i.selectTeams=ca,i.selectTeamsByIds=AI,i.selectTeamsMapping=fI,i.selectTeamsOfOrganization=DR,i.selectUploadUrl=dm,i.selectUserById=es,i.selectUsers=xt,i.selectUsersByIds=nT,i.selectUsersMapping=Kn,i.selectUsersOfOrganization=FR,i.selectUsersOfProject=MR,i.selectUsersOfTeam=jR,i.selectWorkflowById=MI,i.selectWorkflowMapping=RI,i.selectWorkflowStepAssigneeById=UI,i.selectWorkflowStepAssigneeMapping=$I,i.selectWorkflowStepAssignees=Mt,i.selectWorkflowStepAssigneesByIds=LI,i.selectWorkflowStepAssigneesOfUser=LR,i.selectWorkflowStepAssigneesOfWorkflow=NI,i.selectWorkflowStepAssigneesOfWorkflowStep=UR,i.selectWorkflowStepById=Bg,i.selectWorkflowStepCommentAttachmentById=tF,i.selectWorkflowStepCommentAttachmentMapping=eF,i.selectWorkflowStepCommentAttachments=ma,i.selectWorkflowStepCommentAttachmentsByIds=sF,i.selectWorkflowStepCommentById=pF,i.selectWorkflowStepCommentMapping=hF,i.selectWorkflowStepComments=rs,i.selectWorkflowStepCommentsByIds=mF,i.selectWorkflowStepCompletionById=bF,i.selectWorkflowStepCompletionMapping=gF,i.selectWorkflowStepCompletions=ds,i.selectWorkflowStepCompletionsByIds=_F,i.selectWorkflowStepCompletionsOfWorkflow=RF,i.selectWorkflowStepCompletionsOfWorkflowStep=HR,i.selectWorkflowStepEventById=CF,i.selectWorkflowStepEventMapping=ga,i.selectWorkflowStepEvents=ls,i.selectWorkflowStepEventsByIds=jF,i.selectWorkflowStepEventsOfWorkflow=DF,i.selectWorkflowStepEventsOfWorkflowStep=GR,i.selectWorkflowStepFieldValues=kt,i.selectWorkflowStepFieldValuesAttachmentById=QF,i.selectWorkflowStepFieldValuesAttachments=Ma,i.selectWorkflowStepFieldValuesAttachmentsByIds=XF,i.selectWorkflowStepFieldValuesAttachmentsMapping=JF,i.selectWorkflowStepFieldValuesById=uP,i.selectWorkflowStepFieldValuesByIds=hP,i.selectWorkflowStepFieldValuesMapping=lP,i.selectWorkflowStepFieldValuesOfFieldsRevision=YR,i.selectWorkflowStepFieldValuesOfWorkflow=oP,i.selectWorkflowStepFieldValuesOfWorkflowStep=KR,i.selectWorkflowStepFields=os,i.selectWorkflowStepFieldsAttachmentById=PP,i.selectWorkflowStepFieldsAttachments=za,i.selectWorkflowStepFieldsAttachmentsByIds=gP,i.selectWorkflowStepFieldsAttachmentsMapping=IP,i.selectWorkflowStepFieldsById=qP,i.selectWorkflowStepFieldsByIds=CP,i.selectWorkflowStepFieldsMapping=Ca,i.selectWorkflowStepFieldsOfWorkflowStep=ZR,i.selectWorkflowStepMapping=Wg,i.selectWorkflowStepReviewById=Og,i.selectWorkflowStepReviewMapping=Tg,i.selectWorkflowStepReviewRequestById=dg,i.selectWorkflowStepReviewRequestMapping=rg,i.selectWorkflowStepReviewRequests=us,i.selectWorkflowStepReviewRequestsByIds=lg,i.selectWorkflowStepReviewRequestsOfWorkflow=og,i.selectWorkflowStepReviewRequestsOfWorkflowStep=eM,i.selectWorkflowStepReviewerById=ZP,i.selectWorkflowStepReviewerMapping=YP,i.selectWorkflowStepReviewers=vt,i.selectWorkflowStepReviewersByIds=JP,i.selectWorkflowStepReviewersOfUser=xR,i.selectWorkflowStepReviewersOfWorkflow=QP,i.selectWorkflowStepReviewersOfWorkflowStep=XR,i.selectWorkflowStepReviews=hs,i.selectWorkflowStepReviewsByIds=Ig,i.selectWorkflowStepReviewsOfWorkflow=Fg,i.selectWorkflowStepReviewsOfWorkflowStep=tM,i.selectWorkflowSteps=Qa,i.selectWorkflowStepsByIds=qg,i.selectWorkflowStepsOfWorkflowType=zg,i.selectWorkflowTypeById=Zg,i.selectWorkflowTypeMapping=Yg,i.selectWorkflowTypes=xa,i.selectWorkflowTypesByIds=Jg,i.selectWorkflowTypesOfOrganization=sM,i.selectWorkflows=ns,i.selectWorkflowsByIds=kI,i.selectWorkflowsOfProject=$R,i.selectWorkflowsOfWorkflowType=vI,i.setActiveProjectFileId=PO,i.setAsset=io,i.setAssetAttachment=jc,i.setAssetAttachments=Dc,i.setAssetProcedure=fd,i.setAssetProcedureStep=jl,i.setAssetProcedureStepFieldValues=_l,i.setAssetProcedureStepFieldValuesAttachment=pl,i.setAssetProcedureStepFieldValuesAttachments=ml,i.setAssetProcedureStepFieldValuesMany=Rl,i.setAssetProcedureStepFields=tl,i.setAssetProcedureStepFieldsAttachment=$d,i.setAssetProcedureStepFieldsAttachments=Ud,i.setAssetProcedureStepFieldsMany=sl,i.setAssetProcedureSteps=Dl,i.setAssetProcedureType=vd,i.setAssetProcedureTypeAttachment=xc,i.setAssetProcedureTypeAttachments=er,i.setAssetProcedureTypeFieldValues=ed,i.setAssetProcedureTypeFieldValuesAttachment=Dr,i.setAssetProcedureTypeFieldValuesAttachments=$r,i.setAssetProcedureTypeFieldValuesMany=td,i.setAssetProcedureTypeFields=_r,i.setAssetProcedureTypeFieldsAttachment=pr,i.setAssetProcedureTypeFieldsAttachments=mr,i.setAssetProcedureTypeFieldsMany=Rr,i.setAssetProcedureTypes=Ed,i.setAssetProcedures=Sd,i.setAssetStage=Ro,i.setAssetStageCompletion=yo,i.setAssetStageCompletions=fo,i.setAssetStages=Mo,i.setAssetType=Mh,i.setAssetTypeAttachment=Uo,i.setAssetTypeAttachments=Lo,i.setAssetTypeFieldValues=Lu,i.setAssetTypeFieldValuesAttachment=Mu,i.setAssetTypeFieldValuesAttachments=ku,i.setAssetTypeFieldValuesMany=Nu,i.setAssetTypeFields=fu,i.setAssetTypeFieldsAttachment=su,i.setAssetTypeFieldsAttachments=iu,i.setAssetTypeFieldsMany=Su,i.setAssetTypeIdentifier=ih,i.setAssetTypeIdentifierValue=Sh,i.setAssetTypeIdentifierValues=Ah,i.setAssetTypeIdentifiers=nh,i.setAssetTypeStatus=Hh,i.setAssetTypeStatuses=Gh,i.setAssetTypes=kh,i.setAssets=no,i.setCategories=lp,i.setCategory=dp,i.setClientSDK=Ab,i.setClientStore=fb,i.setConversation=Vc,i.setConversations=r_,i.setCurrentUser=TR,i.setDocument=Bp,i.setDocumentAttachment=Op,i.setDocumentAttachments=Ip,i.setDocuments=zp,i.setEmailDomain=Zp,i.setEmailDomains=Jp,i.setForm=hy,i.setFormIdentifier=mm,i.setFormIdentifierValue=Rm,i.setFormIdentifierValues=Mm,i.setFormIdentifiers=ym,i.setFormRevision=ey,i.setFormRevisionAttachment=Um,i.setFormRevisionAttachments=Lm,i.setFormRevisions=ty,i.setFormSubmission=zy,i.setFormSubmissionAttachment=gy,i.setFormSubmissionAttachments=by,i.setFormSubmissions=qy,i.setForms=py,i.setGeoImage=Zy,i.setGeoImages=Jy,i.setIsImportingProjectFile=FO,i.setIssue=hS,i.setIssueAssociation=uf,i.setIssueAssociations=of,i.setIssueAttachment=bf,i.setIssueAttachments=_f,i.setIssueComment=eS,i.setIssueCommentAttachment=Df,i.setIssueCommentAttachments=$f,i.setIssueComments=tS,i.setIssueType=yw,i.setIssueTypeAttachment=bS,i.setIssueTypeAttachments=_S,i.setIssueTypeFieldValues=eA,i.setIssueTypeFieldValuesAttachment=_A,i.setIssueTypeFieldValuesAttachments=RA,i.setIssueTypeFieldValuesMany=tA,i.setIssueTypeFields=mA,i.setIssueTypeFieldsAttachment=DS,i.setIssueTypeFieldsAttachments=$S,i.setIssueTypeFieldsMany=yA,i.setIssueTypeIdentifier=$A,i.setIssueTypeIdentifierValue=tw,i.setIssueTypeIdentifierValues=sw,i.setIssueTypeIdentifiers=UA,i.setIssueTypeStatus=Mw,i.setIssueTypeStatuses=kw,i.setIssueTypes=fw,i.setIssueUpdate=Dw,i.setIssueUpdates=$w,i.setIssues=pS,i.setLoggedIn=sp,i.setOrganization=IT,i.setOrganizationAccess=lT,i.setOrganizationAccesses=oT,i.setOrganizations=OT,i.setProfilePicture=OR,i.setProject=WO,i.setProjectAccess=NT,i.setProjectAccesses=HT,i.setProjectAttachment=iO,i.setProjectAttachments=nO,i.setProjectFile=yO,i.setProjectFiles=fO,i.setProjects=VO,i.setRehydrated=zR,i.setTeam=oI,i.setTeamMembership=JO,i.setTeamMemberships=QO,i.setTeams=uI,i.setTokens=L_,i.setUploadUrl=rm,i.setUser=Qw,i.setUsers=Jw,i.setWorkflow=FI,i.setWorkflowStep=Rg,i.setWorkflowStepAssignee=zI,i.setWorkflowStepAssignees=qI,i.setWorkflowStepComment=rF,i.setWorkflowStepCommentAttachment=ZI,i.setWorkflowStepCommentAttachments=JI,i.setWorkflowStepComments=dF,i.setWorkflowStepCompletion=TF,i.setWorkflowStepCompletions=OF,i.setWorkflowStepEvent=VF,i.setWorkflowStepEvents=WF,i.setWorkflowStepFieldValues=nP,i.setWorkflowStepFieldValuesAttachment=HF,i.setWorkflowStepFieldValuesAttachments=GF,i.setWorkflowStepFieldValuesMany=aP,i.setWorkflowStepFields=vP,i.setWorkflowStepFieldsAttachment=SP,i.setWorkflowStepFieldsAttachments=AP,i.setWorkflowStepFieldsMany=EP,i.setWorkflowStepReview=yg,i.setWorkflowStepReviewRequest=sg,i.setWorkflowStepReviewRequests=ig,i.setWorkflowStepReviewer=LP,i.setWorkflowStepReviewers=NP,i.setWorkflowStepReviews=fg,i.setWorkflowSteps=Mg,i.setWorkflowType=Ug,i.setWorkflowTypes=Lg,i.setWorkflows=PI,i.shallowEqual=Cb,i.slugify=e_,i.spacesToDashesLower=xb,i.teamMembershipReducer=sI,i.teamMembershipSlice=na,i.teamReducer=wI,i.teamSlice=aa,i.toFileNameSafeString=Xb,i.toUuidArray=B,i.toUuidIdRecord=Qb,i.truncate=t_,i.updateAsset=eo,i.updateAssetAttachment=$c,i.updateAssetAttachments=Uc,i.updateAssetProcedure=pd,i.updateAssetProcedureStep=Ll,i.updateAssetProcedureStepFieldValues=Ml,i.updateAssetProcedureStepFieldValuesAttachment=yl,i.updateAssetProcedureStepFieldValuesAttachments=fl,i.updateAssetProcedureStepFieldValuesMany=kl,i.updateAssetProcedureStepFields=il,i.updateAssetProcedureStepFieldsAttachment=Ld,i.updateAssetProcedureStepFieldsAttachments=Nd,i.updateAssetProcedureStepFieldsMany=nl,i.updateAssetProcedureSteps=Nl,i.updateAssetProcedureType=_d,i.updateAssetProcedureTypeAttachment=tr,i.updateAssetProcedureTypeAttachments=sr,i.updateAssetProcedureTypeFieldValues=sd,i.updateAssetProcedureTypeFieldValuesAttachment=Ur,i.updateAssetProcedureTypeFieldValuesAttachments=Lr,i.updateAssetProcedureTypeFieldValuesMany=id,i.updateAssetProcedureTypeFields=Mr,i.updateAssetProcedureTypeFieldsAttachment=yr,i.updateAssetProcedureTypeFieldsAttachments=fr,i.updateAssetProcedureTypeFieldsMany=kr,i.updateAssetProcedureTypes=Rd,i.updateAssetProcedures=md,i.updateAssetStage=Eo,i.updateAssetStageCompletion=So,i.updateAssetStageCompletions=Ao,i.updateAssetStages=Vo,i.updateAssetType=Vh,i.updateAssetTypeAttachment=No,i.updateAssetTypeAttachments=Ho,i.updateAssetTypeFieldValues=Hu,i.updateAssetTypeFieldValuesAttachment=vu,i.updateAssetTypeFieldValuesAttachments=Eu,i.updateAssetTypeFieldValuesMany=Gu,i.updateAssetTypeFields=Au,i.updateAssetTypeFieldsAttachment=nu,i.updateAssetTypeFieldsAttachments=au,i.updateAssetTypeFieldsMany=wu,i.updateAssetTypeIdentifier=ah,i.updateAssetTypeIdentifierValue=wh,i.updateAssetTypeIdentifierValues=Th,i.updateAssetTypeIdentifiers=ch,i.updateAssetTypeStatus=Kh,i.updateAssetTypeStatuses=Yh,i.updateAssetTypes=Wh,i.updateAssets=to,i.updateCategories=up,i.updateCategory=op,i.updateConversation=Wc,i.updateConversations=d_,i.updateDocument=qp,i.updateDocumentAttachment=Fp,i.updateDocumentAttachments=Pp,i.updateDocuments=Cp,i.updateEmailDomain=Qp,i.updateEmailDomains=Xp,i.updateForm=my,i.updateFormIdentifier=fm,i.updateFormIdentifierValue=km,i.updateFormIdentifierValues=vm,i.updateFormIdentifiers=Sm,i.updateFormRevision=sy,i.updateFormRevisionAttachment=Nm,i.updateFormRevisionAttachments=Hm,i.updateFormRevisions=iy,i.updateFormSubmission=jy,i.updateFormSubmissionAttachment=_y,i.updateFormSubmissionAttachments=Ry,i.updateFormSubmissions=Dy,i.updateForms=yy,i.updateGeoImage=xy,i.updateGeoImages=ef,i.updateIssue=mS,i.updateIssueAssociation=hf,i.updateIssueAssociations=pf,i.updateIssueAttachment=Rf,i.updateIssueAttachments=Mf,i.updateIssueComment=sS,i.updateIssueCommentAttachment=Uf,i.updateIssueCommentAttachments=Lf,i.updateIssueComments=iS,i.updateIssueType=Sw,i.updateIssueTypeAttachment=RS,i.updateIssueTypeAttachments=MS,i.updateIssueTypeFieldValues=sA,i.updateIssueTypeFieldValuesAttachment=MA,i.updateIssueTypeFieldValuesAttachments=kA,i.updateIssueTypeFieldValuesMany=iA,i.updateIssueTypeFields=fA,i.updateIssueTypeFieldsAttachment=US,i.updateIssueTypeFieldsAttachments=LS,i.updateIssueTypeFieldsMany=SA,i.updateIssueTypeIdentifier=LA,i.updateIssueTypeIdentifierValue=iw,i.updateIssueTypeIdentifierValues=nw,i.updateIssueTypeIdentifiers=NA,i.updateIssueTypeStatus=vw,i.updateIssueTypeStatuses=Ew,i.updateIssueTypes=Aw,i.updateIssueUpdate=Uw,i.updateIssueUpdates=Lw,i.updateIssues=yS,i.updateOrganization=bT,i.updateOrganizationAccess=uT,i.updateOrganizationAccesses=hT,i.updateOrganizations=gT,i.updateProject=CO,i.updateProjectAccess=GT,i.updateProjectAccesses=KT,i.updateProjectAttachment=aO,i.updateProjectAttachments=cO,i.updateProjectFile=wO,i.updateProjectFiles=TO,i.updateProjects=qO,i.updateTeam=hI,i.updateTeamMembership=XO,i.updateTeamMemberships=xO,i.updateTeams=pI,i.updateUser=eT,i.updateUsers=xw,i.updateWorkflow=gI,i.updateWorkflowStep=kg,i.updateWorkflowStepAssignee=CI,i.updateWorkflowStepAssignees=jI,i.updateWorkflowStepComment=lF,i.updateWorkflowStepCommentAttachment=QI,i.updateWorkflowStepCommentAttachments=XI,i.updateWorkflowStepComments=oF,i.updateWorkflowStepCompletion=IF,i.updateWorkflowStepCompletions=FF,i.updateWorkflowStepEvent=BF,i.updateWorkflowStepEvents=zF,i.updateWorkflowStepFieldValues=cP,i.updateWorkflowStepFieldValuesAttachment=KF,i.updateWorkflowStepFieldValuesAttachments=YF,i.updateWorkflowStepFieldValuesMany=rP,i.updateWorkflowStepFields=VP,i.updateWorkflowStepFieldsAttachment=wP,i.updateWorkflowStepFieldsAttachments=TP,i.updateWorkflowStepFieldsMany=WP,i.updateWorkflowStepReview=Sg,i.updateWorkflowStepReviewRequest=ng,i.updateWorkflowStepReviewRequests=ag,i.updateWorkflowStepReviewer=HP,i.updateWorkflowStepReviewers=GP,i.updateWorkflowStepReviews=Ag,i.updateWorkflowSteps=vg,i.updateWorkflowType=Ng,i.updateWorkflowTypes=Hg,i.updateWorkflows=bI,i.useSelectorBuilder=qb,i.userReducer=sT,i.userSlice=Nn,i.uuidObj=_,i.uuidObjSortFn=Os,i.uuidSortFn=Wt,i.versioningReducer=xg,i.versioningSlice=Xg,i.workflowReducer=EI,i.workflowSlice=ra,i.workflowStepAssigneeReducer=HI,i.workflowStepAssigneeSlice=oa,i.workflowStepCommentAttachmentReducer=iF,i.workflowStepCommentAttachmentSlice=pa,i.workflowStepCommentReducer=fF,i.workflowStepCommentSlice=fa,i.workflowStepCompletionReducer=MF,i.workflowStepCompletionSlice=wa,i.workflowStepEventReducer=$F,i.workflowStepEventSlice=Ia,i.workflowStepFieldValuesAttachmentReducer=eP,i.workflowStepFieldValuesAttachmentSlice=ba,i.workflowStepFieldValuesReducer=pP,i.workflowStepFieldValuesSlice=ka,i.workflowStepFieldsAttachmentReducer=bP,i.workflowStepFieldsAttachmentSlice=Va,i.workflowStepFieldsReducer=jP,i.workflowStepFieldsSlice=qa,i.workflowStepReducer=Vg,i.workflowStepReviewReducer=Pg,i.workflowStepReviewRequestReducer=ug,i.workflowStepReviewRequestSlice=Ua,i.workflowStepReviewSlice=Ha,i.workflowStepReviewerReducer=XP,i.workflowStepReviewerSlice=ja,i.workflowStepSlice=Ya,i.workflowTypeReducer=Qg,i.workflowTypeSlice=Xa,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
14
+ external URLs and therefore not prepended with VITE_API_URL.`;throw new Error(S)}const f=c.type.split("/")[1];if(!f)throw new Error("File has no extension");const y=a??h+"."+f;if(c=Sc(c,y),!c.name)throw new Error("Failed to set file's name");await this.addCache(c,h),ps[r]=new Promise(S=>{S(c)})}return c}processPresignedUrls(e){const n={};for(const[a,r]of Object.entries(e))n[a]=this.enqueueRequest({url:r.url,description:"Upload file to S3",method:p.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:a,blockers:[`s3-${r.fields.key}`],blocks:[a],s3url:r});return n}async getFilePayload(e){const n=await At(e),a={sha1:n,file_type:e.type,extension:e.name.split(".").pop(),size:e.size};return await this.client.files.addCache(e,n),a}}class WM extends k{constructor(){super(...arguments);m(this,"name","Form Identifier");m(this,"url","/form-identifiers");m(this,"actions",{addOne:Jp,addMany:Qp,setOne:Xp,setMany:xp,updateOne:em,updateMany:tm,deleteOne:sm,deleteMany:im,initialize:Zp});m(this,"selectors",{selectById:am,selectByIds:cm})}add(e){var f;const{store:n}=this.client,{addOne:a,setOne:r,deleteOne:d}=this.actions,o=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,l=new Date().toISOString(),c=_({...e,created_by:o,submitted_at:l});this.dispatch(a(c));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(c),blockers:[c.form],blocks:[c.uuid]});return h.then(y=>{this.dispatch(r(y))}).catch(()=>{this.dispatch(d(c.uuid))}),[c,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:r}=this.selectors,d=r(e.uuid)(n.getState());if(!d)throw new Error(`Expected form identifier with uuid ${e.uuid} to exist`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return l.then(c=>{this.dispatch(a(c))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:r}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected form identifier with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(r(l)),c}}async refreshStore(e,n){const{initialize:a}=this.actions,r=await this.list({queryParams:{form__organization:e}},n);return this.dispatch(a(r)),r}}class BM extends k{constructor(){super(...arguments);m(this,"name","Form Identifier Value");m(this,"url","/form-identifier-values");m(this,"actions",{addOne:om,addMany:um,setOne:hm,setMany:pm,updateOne:mm,updateMany:fm,deleteOne:ym,deleteMany:Sm,initialize:lm});m(this,"selectors",{selectById:wm,selectByIds:Tm})}add(e){var f;const{store:n}=this.client,{addOne:a,setOne:r,deleteOne:d}=this.actions,o=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,l=new Date().toISOString(),c=_({...e,created_by:o,submitted_at:l});this.dispatch(a(c));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(c),blockers:[e.form_submission,e.form_identifier],blocks:[c.uuid]});return h.then(y=>{this.dispatch(r(y))}).catch(()=>{this.dispatch(d(c.uuid))}),[c,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:r}=this.selectors,d=r(e.uuid)(n.getState());if(!d)throw new Error(`Expected form identifier value with uuid ${e.uuid} to exist`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return l.then(c=>{this.dispatch(a(c))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:r}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected form identifier value with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(r(l)),c}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{form_submission__form_revision__form__organization:e}},n)).flat();return this.dispatch(a(d)),d}}class zM extends k{constructor(){super(...arguments);m(this,"name","Form Revision Attachment");m(this,"url","/form-revision-attachments");m(this,"actions",{addOne:Pm,addMany:gm,setOne:bm,setMany:_m,updateOne:Rm,updateMany:Mm,deleteOne:km,deleteMany:vm,initialize:Fm});m(this,"selectors",{selectById:Vm,selectByIds:Wm})}async bulkAdd(e){var y;const{addMany:n,setMany:a,deleteMany:r}=this.actions,d=new Date().toISOString(),o=((y=this.client.store.getState().userReducer.currentUser)==null?void 0:y.id)??null,l={},c=[],h=[];for(const S of e){const{revisionUuid:O,fieldIdentifier:P,file:I}=S,F=await this.client.files.getFilePayload(I);F.sha1 in l||(l[F.sha1]=F);const g=_({file:URL.createObjectURL(I),file_type:I.type,file_name:I.name,file_sha1:F.sha1,created_by:o,form_revision:O,submitted_at:d,field_identifier:P});c.push(g);const v={uuid:g.uuid,file_name:I.name,field_identifier:P,file_extension:F.extension,file_sha1:F.sha1,form_revision:O};h.push(v)}this.dispatch(n(c));const f=this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:{submitted_at:d,attachments:h,files:Object.values(l)},blockers:c.map(S=>S.form_revision),blocks:c.map(S=>S.uuid)});return f.then(S=>{this.client.files.processPresignedUrls(S.presigned_urls),this.dispatch(a(S.attachments))}).catch(()=>{this.dispatch(r(c.map(S=>S.uuid)))}),[c,f.then(({attachments:S})=>S)]}async refreshStore(e,n){const{initialize:a}=this.actions,r=await this.list({queryParams:{form_revision__form__organization:e}},n);return this.dispatch(a(r)),r}}class qM extends k{constructor(){super(...arguments);m(this,"name","Form Revision");m(this,"url","/form-revisions");m(this,"actions",{addOne:ji,addMany:Ci,setOne:jm,setMany:Cm,updateOne:Dm,updateMany:$m,deleteOne:Di,deleteMany:$i,initialize:qm});m(this,"selectors",{selectById:Um,selectByIds:Lm})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:r,deleteOne:d}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,c=new Date().toISOString(),h=_({...e,created_by:l,submitted_at:c});this.dispatch(a(h));const f=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(h),blockers:[e.form],blocks:[h.uuid]});return f.then(S=>{this.dispatch(r(S))}).catch(()=>{this.dispatch(d(h.uuid))}),[h,f]}async refreshStore(e,n){const{initialize:a}=this.actions,r=await this.list({queryParams:{form__organization:e}},n);return this.dispatch(a(r)),r}}class jM extends k{constructor(){super(...arguments);m(this,"name","Form");m(this,"url","/forms");m(this,"actions",{addOne:Ym,addMany:Zm,setOne:Jm,setMany:Qm,updateOne:Xm,updateMany:xm,deleteOne:ef,deleteMany:tf,initialize:Km});m(this,"selectors",{selectById:af,selectByIds:cf})}add(e,n){var y;const{store:a}=this.client,{addOne:r,deleteOne:d}=this.actions,o=new Date().toISOString(),l=((y=a.getState().userReducer.currentUser)==null?void 0:y.id)??null,c=_({...e,submitted_at:o,created_by:l}),h=_({...n,form:c.uuid,submitted_at:o,created_by:l});this.dispatch(r(c)),this.dispatch(ji(h));const f=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:{...E(c),initial_revision:{uuid:h.uuid,submitted_at:h.submitted_at,title:h.title,description:h.description,fields:h.fields}},blockers:[],blocks:[c.uuid,h.uuid]});return f.catch(S=>{throw this.dispatch(d(c.uuid)),this.dispatch(Di(h.uuid)),S}),[c,h,f]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:r}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error("Expected form to exist");const c=kf(e)(o),h=Nm(e)(o);this.dispatch(a(e)),this.dispatch(xi(B(c))),this.dispatch($i(B(h)));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(f){throw this.dispatch(r(l)),this.dispatch(Ci(h)),this.dispatch(Xi(c)),f}}async refreshStore(e,n){const{initialize:a}=this.actions,r=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(r)),r}}class CM extends k{constructor(){super(...arguments);m(this,"name","Form Submission Attachment");m(this,"url","/form-submission-attachments");m(this,"actions",{addOne:lf,addMany:Gi,setOne:of,setMany:uf,updateOne:hf,updateMany:pf,deleteOne:mf,deleteMany:Ki,initialize:df});m(this,"selectors",{selectById:ff,selectByIds:yf})}async bulkAdd(e){var y;const{addMany:n,setMany:a,deleteMany:r}=this.actions,d=new Date().toISOString(),o=((y=this.client.store.getState().userReducer.currentUser)==null?void 0:y.id)??null,l={},c=[],h=[];for(const S of e){const{submissionUuid:O,fieldIdentifier:P,file:I}=S,F=await this.client.files.getFilePayload(I);F.sha1 in l||(l[F.sha1]=F);const g=_({file:URL.createObjectURL(I),file_type:I.type,file_name:I.name,file_sha1:F.sha1,created_by:o,form_submission:O,submitted_at:d,field_identifier:P});c.push(g);const v={uuid:g.uuid,file_name:I.name,file_sha1:F.sha1,file_extension:F.extension,field_identifier:P,form_submission:O};h.push(v)}this.dispatch(n(c));const f=this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:{submitted_at:d,attachments:h,files:Object.values(l)},blockers:c.map(S=>S.form_submission),blocks:c.map(S=>S.uuid)});return f.then(S=>{this.client.files.processPresignedUrls(S.presigned_urls),this.dispatch(a(S.attachments))}).catch(S=>{throw this.dispatch(r(c.map(O=>O.uuid))),S}),[c,f.then(({attachments:S})=>S)]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:r}=this.actions,d=n.getState(),o=Ji(e)(d);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!0),method:p.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(l){throw this.dispatch(r(o)),l}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{form_submission__form_revision__form__organization:e}},n)).flat();return this.dispatch(a(d)),d}}class DM extends k{constructor(){super(...arguments);m(this,"name","Form Submission");m(this,"url","/form-submissions");m(this,"actions",{addOne:Ff,addMany:Xi,setOne:Of,setMany:If,updateOne:Pf,updateMany:gf,deleteOne:bf,deleteMany:xi,initialize:Tf});m(this,"selectors",{selectById:Rf,selectByIds:Mf})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:r,deleteOne:d}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,c=new Date().toISOString(),h=_({...e,created_by:l,submitted_at:c}),f=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(h),blockers:[e.form_revision],blocks:[h.uuid]});return this.dispatch(a(h)),f.then(S=>{this.dispatch(r(S))}).catch(()=>{this.dispatch(d(h.uuid))}),[h,f]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:r}=this.selectors,d=n.getState(),o=r(e.uuid)(d);if(!o)throw new Error(`Expected submission with uuid ${e.uuid} to exist`);const l={...o,...e};this.dispatch(a(l));const c=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${l.uuid}/`,payload:e,blockers:[l.uuid],blocks:[l.uuid]});return c.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(o))}),[l,c]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:r}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected submission with uuid ${e} to exist`);const c=Sf(e)(o);this.dispatch(a(e)),this.dispatch(Ki(B(c)));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(r(l)),this.dispatch(Gi(c)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{limit:this.pageSize,paginate:!0,form_revision__form_organization:e}},n)).flat();return this.dispatch(a(d)),d}}class $M extends k{constructor(){super(...arguments);m(this,"name","Geo Image");m(this,"url","/geo-images");m(this,"actions",{addOne:zf,addMany:qf,setOne:Wf,setMany:Bf,updateOne:jf,updateMany:Cf,deleteOne:Df,deleteMany:$f,initialize:Vf});m(this,"selectors",{selectById:Lf,selectByIds:Nf})}async add(e){var P;const{store:n}=this.client,{addOne:a,setOne:r,deleteOne:d}=this.actions,{file:o,...l}=e,c=new Date().toISOString(),h=((P=n.getState().userReducer.currentUser)==null?void 0:P.id)??null,f=l.project,y=await this.client.files.getFilePayload(o),S=_({...l,file_name:o.name,file_sha1:y.sha1,file_type:o.type,file:URL.createObjectURL(o),submitted_at:c,created_by:h});this.dispatch(a(S));const O=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:{uuid:S.uuid,submitted_at:c,title:S.title,description:S.description,geo_marker:S.geo_marker,canvas_marker:S.canvas_marker,sha1:S.file_sha1,project:S.project,file_name:S.file_name,direction:S.direction,original_date:S.original_date,file:y},blocks:[f],blockers:[f]});return O.then(I=>{this.client.files.processPresignedUrls(I.presigned_urls),this.dispatch(r(I.geo_image))}).catch(()=>{this.dispatch(d(S.uuid))}),[S,O.then(I=>I.geo_image)]}async bulkAdd(e,n){var P;const{store:a}=this.client,{addMany:r,setMany:d,deleteMany:o}=this.actions,l=new Date().toISOString(),c=((P=a.getState().userReducer.currentUser)==null?void 0:P.id)??null,h=[],f=[],y=[],S={};for(const I of e){const{file:F,...g}=I,v=await this.client.files.getFilePayload(F);v.sha1 in S||(S[v.sha1]=v);const V=_({...g,file_name:F.name,file_sha1:v.sha1,file_type:F.type,file:URL.createObjectURL(F),submitted_at:l,created_by:c,project:n});h.push(V),f.push(V.uuid),y.push({uuid:V.uuid,sha1:V.file_sha1,file_name:V.file_name,title:V.title,description:V.description,geo_marker:V.geo_marker,canvas_marker:V.canvas_marker,direction:V.direction,original_date:V.original_date})}this.dispatch(r(h));const O=this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:{submitted_at:l,project:n,geo_images:y,files:Object.values(S)},blocks:[n],blockers:f});return O.then(I=>{this.client.files.processPresignedUrls(I.presigned_urls),this.dispatch(d(I.geo_images))}).catch(()=>{this.dispatch(o(f))}),[h,O.then(I=>I.geo_images)]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:r}=this.selectors,d=n.getState(),o=r(e.uuid)(d);if(!o)throw new Error(`Map image with uuid ${e.uuid} does not exist in the store`);const l={...o,...e};this.dispatch(a(l));const c=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return c.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(o))}),[l,c]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:r}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Map image with uuid ${e} does not exist in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blocks:[e],blockers:[e]})}catch(c){throw this.dispatch(r(l)),c}}async refreshStore(e,n){const{initialize:a}=this.actions,r=await this.list({queryParams:{project:e}},n);return this.dispatch(a(r)),r}}class UM extends k{constructor(){super(...arguments);m(this,"name","Issue Association");m(this,"url","/issue-associations");m(this,"actions",{addOne:Xf,addMany:Yt,setOne:Zf,setMany:Yf,updateOne:Jf,updateMany:Qf,deleteOne:xf,deleteMany:Zt,initialize:Kf});m(this,"selectors",{selectById:ty,selectByIds:sy})}add(e){var f;const{store:n}=this.client,{addOne:a,setOne:r,deleteOne:d}=this.actions,o=new Date().toISOString(),l=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,c=_({...e,submitted_at:o,created_by:l});this.dispatch(a(c));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(c),blockers:[e.associated_issue,...e.issue?[e.issue]:[],...e.asset?[e.asset]:[]],blocks:[c.uuid]});return h.then(y=>{this.dispatch(r(y))}).catch(()=>{this.dispatch(d(c.uuid))}),[c,h]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:r}=this.actions,{selectById:d}=this.selectors,o=d(e)(n.getState());if(!o)throw new Error(`Issue association with uuid ${e} not found in store.`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(l){throw this.dispatch(r(o)),l}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{associated_issue__project:e}},n)).flat();return this.dispatch(a(d)),d}}class LM extends L{constructor(){super(...arguments);m(this,"name","Issue Attachment");m(this,"url","/issue-attachments");m(this,"actions",{addOne:ly,addMany:cn,setOne:oy,setMany:uy,updateOne:hy,updateMany:py,deleteOne:my,deleteMany:rn,initialize:dy});m(this,"selectors",{selectById:Sy,selectByIds:Ay})}getId(e){return e.uuid}buildModel(e){return _({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,issue:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,issue:e.issue}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.issueUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(a(d)),d}}class NM extends L{constructor(){super(...arguments);m(this,"name","Issue Comment Attachment");m(this,"url","/issue-comment-attachments");m(this,"actions",{addOne:Iy,addMany:Fy,setOne:Py,setMany:gy,updateOne:by,updateMany:_y,deleteOne:Ry,deleteMany:My,initialize:Oy});m(this,"selectors",{selectById:vy,selectByIds:Ey})}getId(e){return e.uuid}buildModel(e){return _({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,issue_comment:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,issue_comment:e.issue_comment}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.issueCommentUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{issue_comment__issue__project:e}},n)).flat();return this.dispatch(a(d)),d}}class HM extends k{constructor(){super(...arguments);m(this,"name","Issue Comment");m(this,"url","/issue-comments");m(this,"actions",{addOne:zy,addMany:qy,setOne:jy,setMany:Cy,updateOne:Dy,updateMany:$y,deleteOne:Uy,deleteMany:Ly,initialize:By});m(this,"selectors",{selectById:Ny,selectByIds:Hy})}add(e){const{store:n}=this.client,{addOne:a,updateOne:r,deleteOne:d}=this.actions,o=_({...e,author:n.getState().userReducer.currentUser.id,submitted_at:new Date().toISOString()});this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(o),blockers:[e.issue],blocks:[o.uuid]});return l.then(c=>{this.dispatch(r(c))}).catch(()=>{this.dispatch(d(o.uuid))}),[o,l]}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:r}=this.selectors,d=r(e.uuid)(n.getState());if(!d)throw new Error(`Comment with uuid ${e.uuid} not found in store`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return l.then(c=>{this.dispatch(a(c))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:r}=this.actions,{selectById:d}=this.selectors,o=d(e)(n.getState());if(!o)throw new Error(`Comment with uuid ${e} not found in store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(l){throw this.dispatch(r(o)),l}}async refreshStore(e,n){const{setMany:a}=this.actions,d=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(a(d)),d}}class GM extends k{constructor(){super(...arguments);m(this,"name","Issue");m(this,"url","/issues");m(this,"actions",{addOne:Zy,addMany:mn,setOne:Jy,setMany:Qy,updateOne:Xy,updateMany:xy,deleteOne:eS,deleteMany:fn,initialize:Yy});m(this,"selectors",{selectById:sS,selectByIds:iS})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:r,deleteOne:d}=this.actions,o=n.getState(),l=new Date().toISOString(),c=((y=o.userReducer.currentUser)==null?void 0:y.id)??null,h=_({...e,submitted_at:l,created_by:c});this.dispatch(a(h));const f=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(h),blockers:[h.project,h.issue_type,h.status],blocks:[h.uuid]});return f.then(S=>{this.dispatch(r(S))}).catch(S=>{throw this.dispatch(d(h.uuid)),S}),[h,f]}update(e){var f;const{updateOne:n}=this.actions,{selectById:a}=this.selectors,r=this.client.store.getState(),d=a(e.uuid)(r);if(!d)throw new Error(`Attempting to update an issue with uuid ${e.uuid} that doesn't exist in the store`);const o={...d,...e};this.dispatch(n(o));const l={};for(const y of[C.TITLE,C.DESCRIPTION,C.STATUS,C.PRIORITY,C.ASSIGNED_TO,C.DUE_DATE])if(y in e&&e[y]!==d[y])switch(y){case C.PRIORITY:l[y]=e[y];break;case C.DUE_DATE:l[y]=e[y];break;case C.DESCRIPTION:l[y]=e[y];break;case C.TITLE:l[y]=e[y];break;case C.STATUS:{const S=e[y],O=Vn(S)(r);if(!O)throw new Error(`Trying to update issue type status with ${S} which does not exist in store`);l[y]={name:O.name,color:O.color,uuid:O.uuid};break}case C.ASSIGNED_TO:{const S=e[y];if(S===null)l[y]=null;else{const O=es(S)(r);if(!O)throw new Error(`Trying to update assigned to with ${S} which does not exist in store.`);l[y]={full_name:O.username,id:O.id}}break}}const c=_({created_by:((f=r.userReducer.currentUser)==null?void 0:f.id)??null,submitted_at:new Date().toISOString(),issue:d.uuid,changes:l});this.dispatch(Bn(c));const h=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return h.then(y=>{this.dispatch(n(y))}).catch(()=>{this.dispatch(n(d)),this.dispatch(qn(c.uuid))}),[o,h]}bulkUpdate(e,n){const{store:a}=this.client,{updateMany:r}=this.actions,{selectByIds:d}=this.selectors,o=B(e).toSorted(Wt);if(o.length!==e.length)throw new Error("payloads contains duplicate uuids.");const l=d(o)(a.getState()).toSorted(Os);if(o.length!=l.length)throw new Error(`Attempting to bulk update ${o.length-l.length} issues that dont exist in the store`);const c=[];for(let S=0;S<o.length;S++)c.push({...l[S],...e[S]});this.dispatch(r(c));const h=ht(e,Math.min(n??e.length,U)),f=[];let y=null;for(const S of h){const O=pt.v4(),P=B(S),I=S.map(({status:g})=>g).filter(Boolean),F=this.enqueueRequest({description:T(p.PATCH,this.name,!0),method:p.PATCH,url:`${this.url}/bulk/`,payload:{payloads:S},blockers:(y?[y]:[]).concat(P).concat(I),blocks:[O].concat(P)});f.push(F),y=O}return Promise.all(f).then(S=>{this.dispatch(r(S.flat()))}).catch(()=>{this.dispatch(r(l))}),[c,f]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:r}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`No issue with uuid ${e} found in the store`);const c=yy(e)(o),h=kw(e)(o),f={};for(const S of iy(e)(o))f[S.uuid]=S;for(const S of ny(e)(o))f[S.uuid]=S;const y=Object.values(f);this.dispatch(a(e)),this.dispatch(rn(B(c))),this.dispatch(jn(B(h))),this.dispatch(Zt(B(y)));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(S){throw this.dispatch(r(l)),this.dispatch(cn(c)),this.dispatch(zn(h)),this.dispatch(Yt(y)),S}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(d)),d}}class KM extends L{constructor(){super(...arguments);m(this,"name","Issue Type Attachment");m(this,"url","/issue-type-attachments");m(this,"actions",{addOne:dS,addMany:lS,setOne:oS,setMany:uS,updateOne:hS,updateMany:pS,deleteOne:mS,deleteMany:fS,initialize:rS});m(this,"selectors",{selectById:SS,selectByIds:AS})}getId(e){return e.uuid}buildModel(e){return _({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,issue_type:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,issue_type:e.issue_type}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.issueTypeUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,r=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(a(r)),r}}class YM extends k{constructor(){super(...arguments);m(this,"name","Issue Type Fields Attachment");m(this,"url","/issue-type-fields-attachments");m(this,"actions",{addOne:IS,addMany:FS,setOne:PS,setMany:gS,updateOne:bS,updateMany:_S,deleteOne:RS,deleteMany:MS,initialize:OS});m(this,"selectors",{selectById:vS,selectByIds:ES})}async bulkAdd(e){var y;const{addMany:n,setMany:a,deleteMany:r}=this.actions,d=new Date().toISOString(),o=((y=this.client.store.getState().userReducer.currentUser)==null?void 0:y.id)??null,l={},c=[],h=[];for(const S of e){const{fieldsRevisionUuid:O,fieldIdentifier:P,file:I}=S,F=await this.client.files.getFilePayload(I);F.sha1 in l||(l[F.sha1]=F);const g=_({file:URL.createObjectURL(I),file_type:I.type,file_name:I.name,file_sha1:F.sha1,created_by:o,fields_revision:O,submitted_at:d,field_identifier:P});c.push(g);const v={uuid:g.uuid,file_name:I.name,file_extension:F.extension,field_identifier:P,file_sha1:F.sha1,fields_revision:O};h.push(v)}this.dispatch(n(c));const f=this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:{submitted_at:d,attachments:h,files:Object.values(l)},blockers:c.map(S=>S.fields_revision),blocks:c.map(S=>S.uuid)});return f.then(S=>{this.client.files.processPresignedUrls(S.presigned_urls),this.dispatch(a(S.attachments))}).catch(()=>{this.dispatch(r(c.map(S=>S.uuid)))}),[c,f.then(({attachments:S})=>S)]}async refreshStore(e,n){const{initialize:a}=this.actions,r=await this.list({queryParams:{fields_revision__issue_type__organization:e}},n);return this.dispatch(a(r)),r}}class ZM extends k{constructor(){super(...arguments);m(this,"name","Issue Type Fields");m(this,"url","/issue-type-fields");m(this,"actions",{addOne:JS,addMany:QS,setOne:XS,setMany:xS,updateOne:eA,updateMany:tA,deleteOne:sA,deleteMany:iA,initialize:ZS});m(this,"selectors",{selectById:aA,selectByIds:cA})}add(e){var f;const{store:n}=this.client,{addOne:a,setOne:r,deleteOne:d}=this.actions,o=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,l=new Date().toISOString(),c=_({...e,created_by:o,submitted_at:l});this.dispatch(a(c));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(c),blockers:[c.issue_type],blocks:[c.uuid]});return h.then(y=>{this.dispatch(r(y))}).catch(y=>{throw this.dispatch(d(c.uuid)),y}),[c,h]}async refreshStore(e,n){const{initialize:a}=this.actions,r=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(a(r)),r}}class JM extends k{constructor(){super(...arguments);m(this,"name","Issue Type Field Values Attachment");m(this,"url","/issue-type-field-values-attachments");m(this,"actions",{addOne:oA,addMany:Fn,setOne:uA,setMany:hA,updateOne:pA,updateMany:mA,deleteOne:fA,deleteMany:Pn,initialize:lA});m(this,"selectors",{selectById:SA,selectByIds:AA})}async bulkAdd(e){var y;const{addMany:n,setMany:a,deleteMany:r}=this.actions,d=new Date().toISOString(),o=((y=this.client.store.getState().userReducer.currentUser)==null?void 0:y.id)??null,l={},c=[],h=[];for(const S of e){const{fieldValuesUuid:O,fieldIdentifier:P,file:I}=S,F=await this.client.files.getFilePayload(I);F.sha1 in l||(l[F.sha1]=F);const g=_({file:URL.createObjectURL(I),file_type:I.type,file_name:I.name,file_sha1:F.sha1,created_by:o,field_values:O,submitted_at:d,field_identifier:P});c.push(g);const v={uuid:g.uuid,file_name:I.name,file_sha1:F.sha1,file_extension:F.extension,field_identifier:P,field_values:O};h.push(v)}this.dispatch(n(c));const f=this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:{submitted_at:d,attachments:h,files:Object.values(l)},blockers:c.map(S=>S.field_values),blocks:c.map(S=>S.uuid)});return f.then(({presigned_urls:S,attachments:O})=>{this.client.files.processPresignedUrls(S),this.dispatch(a(O))}).catch(S=>{throw this.dispatch(r(c.map(O=>O.uuid))),S}),[c,f.then(({attachments:S})=>S)]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:r}=this.actions,{selectByIds:d}=this.selectors,o=n.getState(),l=d(e)(o);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!0),method:p.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(r(l)),c}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{field_values__issue__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class QM extends k{constructor(){super(...arguments);m(this,"name","Issue Type Field Values");m(this,"url","/issue-type-field-values");m(this,"actions",{addOne:zS,addMany:qS,setOne:jS,setMany:CS,updateOne:DS,updateMany:$S,deleteOne:US,deleteMany:LS,initialize:BS});m(this,"selectors",{selectById:HS,selectByIds:GS})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:r,deleteOne:d}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,c=new Date().toISOString(),h=_({...e,created_by:l,submitted_at:c}),f=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(h),blockers:[e.issue,e.fields_revision],blocks:[h.uuid]});return this.dispatch(a(h)),f.then(S=>{this.dispatch(r(S))}).catch(()=>{this.dispatch(d(h.uuid))}),[h,f]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:r}=this.selectors,d=n.getState(),o=r(e.uuid)(d);if(!o)throw new Error(`Expected IssueTypeFieldValues with uuid ${e.uuid} to exist`);const l={...o,...e};this.dispatch(a(l));const c=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[l.uuid,l.fields_revision,l.issue],blocks:[l.uuid]});return c.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(o))}),[l,c]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:r}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected submission with uuid ${e} to exist`);const c=wA(e)(o);this.dispatch(a(e)),this.dispatch(Pn(B(c)));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(r(l)),this.dispatch(Fn(c)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{issue__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class XM extends k{constructor(){super(...arguments);m(this,"name","Issue Type Identifier");m(this,"url","/issue-type-identifiers");m(this,"actions",{addOne:FA,addMany:PA,setOne:gA,setMany:bA,updateOne:_A,updateMany:RA,deleteOne:MA,deleteMany:kA,initialize:IA});m(this,"selectors",{selectById:EA,selectByIds:VA})}add(e){var f;const{store:n}=this.client,{addOne:a,setOne:r,deleteOne:d}=this.actions,o=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,l=new Date().toISOString(),c=_({...e,created_by:o,submitted_at:l});this.dispatch(a(c));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(c),blockers:[c.issue_type],blocks:[c.uuid]});return h.then(y=>{this.dispatch(r(y))}).catch(()=>{this.dispatch(d(c.uuid))}),[c,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:r}=this.selectors,d=r(e.uuid)(n.getState());if(!d)throw new Error(`Expected issue type identifier with uuid ${e.uuid} to exist`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return l.then(c=>{this.dispatch(a(c))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:r}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected issue type identifier with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(r(l)),c}}async refreshStore(e,n){const{initialize:a}=this.actions,r=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(a(r)),r}}class xM extends k{constructor(){super(...arguments);m(this,"name","Issue Type Identifier Value");m(this,"url","/issue-type-identifier-values");m(this,"actions",{addOne:qA,addMany:jA,setOne:CA,setMany:DA,updateOne:$A,updateMany:UA,deleteOne:LA,deleteMany:NA,initialize:zA});m(this,"selectors",{selectById:GA,selectByIds:KA})}add(e){var f;const{store:n}=this.client,{addOne:a,setOne:r,deleteOne:d}=this.actions,o=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,l=new Date().toISOString(),c=_({...e,created_by:o,submitted_at:l});this.dispatch(a(c));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(c),blockers:[e.issue,e.issue_type_identifier],blocks:[c.uuid]});return h.then(y=>{this.dispatch(r(y))}).catch(()=>{this.dispatch(d(c.uuid))}),[c,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:r}=this.selectors,d=r(e.uuid)(n.getState());if(!d)throw new Error(`Expected issue type identifier value with uuid ${e.uuid} to exist`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return l.then(c=>{this.dispatch(a(c))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:r}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected issue type identifier value with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(r(l)),c}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(a(d)),d}}class ek extends k{constructor(){super(...arguments);m(this,"name","Issue Type");m(this,"url","/issue-types");m(this,"actions",{addOne:QA,addMany:XA,setOne:xA,setMany:ew,updateOne:tw,updateMany:sw,deleteOne:iw,deleteMany:nw,initialize:JA});m(this,"selectors",{selectById:cw,selectByIds:rw})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:r,deleteOne:d}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,c=new Date().toISOString(),h=_({...e,submitted_at:c,created_by:l});this.dispatch(a(h));const f=this.enqueueRequest({method:p.POST,url:`${this.url}/`,payload:E(h),blockers:[],blocks:[h.uuid]});return f.then(S=>{this.dispatch(r(S))}).catch(()=>{this.dispatch(d(h.uuid))}),[h,f]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:r}=this.selectors,d=n.getState(),o=r(e.uuid)(d);if(!o)throw new Error(`IssueType with uuid ${e.uuid} does not exist in the store.`);const l={...o,...e};this.dispatch(a(l));const c=this.enqueueRequest({method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(o))}),[l,c]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:r}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`IssueType with uuid ${e} does not exist in the store.`);const c=nS(e)(o);this.dispatch(a(e)),this.dispatch(fn(B(c)));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(r(l)),this.dispatch(mn(c)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,r=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(r)),r}}class tk extends k{constructor(){super(...arguments);m(this,"name","Issue Type Status");m(this,"url","/issue-type-statuses");m(this,"actions",{addOne:uw,addMany:hw,setOne:pw,setMany:mw,updateOne:fw,updateMany:yw,deleteOne:Sw,deleteMany:Aw,initialize:ow});m(this,"selectors",{selectById:Vn,selectByIds:Tw})}add(e){var f;const{store:n}=this.client,{addOne:a,setOne:r,deleteOne:d}=this.actions,o=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,l=new Date().toISOString(),c=_({...e,created_by:o,submitted_at:l});this.dispatch(a(c));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(c),blockers:[e.issue_type],blocks:[c.uuid]});return h.then(y=>{this.dispatch(r(y))}).catch(()=>{this.dispatch(d(c.uuid))}),[c,h]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,r=this.client.store.getState(),d=a(e.uuid)(r);if(!d)throw new Error(`Expected an existing issue type status with uuid ${e.uuid}`);const o={...d,...e};this.dispatch(n(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return l.then(c=>{this.dispatch(n(c))}).catch(()=>{this.dispatch(n(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:r}=this.actions,{selectById:d}=this.selectors,o=d(e)(n.getState());if(!o)throw new Error(`No issue type status with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(l){throw this.dispatch(r(o)),l}}async refreshStore(e,n){const{initialize:a}=this.actions,r=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(a(r)),r}}class sk extends k{constructor(){super(...arguments);m(this,"name","Issue Update");m(this,"url","/issue-updates");m(this,"actions",{addOne:Bn,addMany:zn,setOne:Pw,setMany:gw,updateOne:bw,updateMany:_w,deleteOne:qn,deleteMany:jn,initialize:Fw});m(this,"selectors",{selectById:Rw,selectByIds:Mw})}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(a(d)),d}}const ik=1800;function nk(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 ak extends tM{constructor(){super(...arguments);m(this,"_getRenewedTokens",async e=>{const n=this.performRequest({method:p.POST,url:this.refreshTokensUrl,payload:{refresh:e},isAuthNeeded:!1,checkAuth:!1});let a;try{a=await n}catch(r){console.error("Could not renew tokens; clearing auth",r),this.clearAuth();return}if(!a.access)throw new Error("Missing access token");return{accessToken:a.access,refreshToken:a.refresh??this.getRefreshToken()}})}clearAuth(){console.debug(this.constructor.name,"clearing auth;"),this.dispatch(xh(!1)),this.clearTokens(),this.dispatch(b()),this.dispatch(b())}async renewTokens(){const e=this.getRefreshToken();if(!e)throw new Error("No refresh token found");console.debug(this.constructor.name,"renewing tokens");try{const n=await this._getRenewedTokens(e);if(!n)return;console.log("Got renewed tokens"),this.setTokens(n)}catch(n){throw console.error("Could not renew tokens; clearing auth",n),this.clearAuth(),n}}tokenIsExpiringSoon(){const e=this.getAccessToken();if(!e)return!1;const n=Date.now()/1e3;let a;try{a=Sb(e).exp??n}catch{a=n}return a-n<ik}getAuthHeader(){return`Bearer ${this.getAccessToken()}`}async prepareAuth(){if(this.tokenIsExpiringSoon()){console.debug(this.constructor.name,"preparing auth");try{await this.renewTokens()}catch(e){return e instanceof D&&this.clearAuth(),e instanceof Error?Promise.reject(e):Promise.reject(new Error((e??wt).toString()))}}}async handleUnauthorized(e,n){const a=this.client.store.getState();if(e.url.endsWith("/token/refresh/"))throw a.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:n,discard:!0});if(a.authReducer.isLoggedIn)await this.renewTokens();else throw console.debug("Forbidden; user is not logged in."),new D({message:"Incorrect username or password.",response:n,discard:!0})}async initAuth(e){const n=pt.v4();return console.debug(this.constructor.name,"Initiating auth"),this.performRequest({uuid:n,method:p.POST,url:this.initTokensUrl,payload:e,isAuthNeeded:!1,checkAuth:!1}).then(a=>{this.setTokens(nk(a))})}}class ck extends Tt{constructor(){super(...arguments);m(this,"name","Organization Access");m(this,"url","/organization-accesses");m(this,"actions",{addOne:Hw,addMany:Gw,setOne:Kw,setMany:Yw,updateOne:Zw,updateMany:Jw,deleteOne:Qw,deleteMany:Xw,initialize:Nw});m(this,"selectors",{selectById:eT,selectByIds:tT})}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:r}=this.selectors,d=r(e.uuid)(n.getState()),o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return l.then(c=>{this.dispatch(a(c))}).catch(c=>{throw this.dispatch(a(d)),c}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:r}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o),c=es(l.user)(o);this.dispatch(a(l.uuid)),this.dispatch(Ln(l.user));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${l.uuid}/`,blockers:[l.uuid],blocks:[]})}catch(h){throw this.dispatch(r(l)),this.dispatch(Un(c)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,r=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(r)),r}}class rk extends Tt{constructor(){super(...arguments);m(this,"name","Organization");m(this,"url","/organizations");m(this,"actions",{addOne:dT,addMany:rT,setOne:cT,setMany:aT,updateOne:oT,updateMany:lT,deleteOne:uT,deleteMany:hT,initialize:nT});m(this,"selectors",{selectById:fT,selectByIds:yT})}async add(e){const{addOne:n}=this.actions,a=await this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:e,blockers:[],blocks:[]});return this.dispatch(n(a)),a}async update(e){const{setOne:n}=this.actions,a=await this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return this.dispatch(n(a)),a}async invite(e,n){return this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/${e}/invite/${n}/`,blockers:[],blocks:[]})}async refreshStore(e){const{initialize:n}=this.actions,a=await this.list({},e);return this.dispatch(n(a)),a}}class dk extends k{constructor(){super(...arguments);m(this,"name","Project Access");m(this,"url","/project-accesses");m(this,"actions",{addOne:bT,addMany:_T,setOne:RT,setMany:MT,updateOne:kT,updateMany:vT,deleteOne:ET,deleteMany:VT,initialize:gT});m(this,"selectors",{selectById:BT,selectByIds:zT})}add(e){var c;const{store:n}=this.client,{addOne:a,setOne:r,deleteOne:d}=this.actions,o=_({...e,created_by:((c=n.getState().userReducer.currentUser)==null?void 0:c.id)??null});this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(o),blockers:[o.organization_access,o.project],blocks:[o.uuid]});return l.then(h=>{this.dispatch(r(h))}).catch(h=>{throw this.dispatch(d(o.uuid)),h}),[o,l]}bulkAdd(e){var h;const{store:n}=this.client,{addMany:a,deleteMany:r,updateMany:d}=this.actions,o=((h=n.getState().userReducer.currentUser)==null?void 0:h.id)??null,l=e.map(f=>_({...f,created_by:o}));this.dispatch(a(l));const c=this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:{project_accesses:l.map(f=>E(f))},blockers:l.flatMap(f=>[f.project,f.organization_access]),blocks:l.map(f=>f.uuid)});return c.then(f=>{this.dispatch(d(f))}).catch(f=>{throw this.dispatch(r(l.map(y=>y.uuid))),f}),[l,c]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:r}=this.selectors,d=r(e.uuid)(n.getState()),o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[]});return l.then(c=>{this.dispatch(a(c))}).catch(c=>{throw this.dispatch(a(d)),c}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:r}=this.actions,{selectById:d}=this.selectors,o=d(e)(n.getState());this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(l){throw this.dispatch(r(o)),l}}async refreshStore(e,n){const{initialize:a}=this.actions,r=await this.list({queryParams:{project__organization:e}},n);return this.dispatch(a(r)),r}}class lk extends L{constructor(){super(...arguments);m(this,"name","Project Attachment");m(this,"url","/project-attachments");m(this,"actions",{addOne:CT,addMany:DT,setOne:$T,setMany:UT,updateOne:LT,updateMany:NT,deleteOne:HT,deleteMany:GT,initialize:jT});m(this,"selectors",{selectById:YT,selectByIds:ZT})}getId(e){return e.uuid}buildModel(e){return _({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,project:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,project:e.project}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.projectUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,r=await this.list({queryParams:{project__organization:e}},n);return this.dispatch(a(r)),r}}class ok extends k{constructor(){super(...arguments);m(this,"name","Project File");m(this,"url","/project-files");m(this,"actions",{addOne:tO,addMany:sO,setOne:xT,setMany:eO,updateOne:iO,updateMany:nO,deleteOne:aO,deleteMany:cO,initialize:XT});m(this,"selectors",{selectById:hO,selectByIds:pO})}async saveExisting(e){const{setOne:n}=this.actions;if(!e.uuid)throw new Error("You can only use this method to save existing project files. The one provided has no uuid.");const a={...e};delete a.file;const r=this.enqueueRequest({method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:a,blockers:[e.uuid],blocks:[e.uuid]});return r.then(d=>{this.dispatch(n(d))}),r}saveActive(){const{store:e}=this.client,{setOne:n}=this.actions,a=e.getState(),r=a.projectFileReducer.activeProjectFileId;if(!r)throw new Error("No active project file");const d=a.projectFileReducer.instances[r];if(!d)throw new Error("No active project file");if(!d.bounds&&!d.canvas_bounds)throw new Error("Project file must either have bounds or canvas_bounds set");let o;if(typeof d.file=="string"&&!d.file.startsWith("blob:")){const h={...d};delete h.file,o={method:p.PATCH,url:`${this.url}/${r}/`,payload:h,blockers:[r],blocks:[r]}}else o=new Promise((h,f)=>{this.client.files.uploadFileToS3(d.file_sha1).then(([y])=>{h({method:p.POST,url:`${this.url}/`,payload:{...d,...y},blockers:[r],blocks:[r]})}).catch(f)});const c=Promise.resolve(o).then(h=>this.enqueueRequest(h));return c.then(h=>{this.dispatch(n(h))}),this.dispatch(lO),this.dispatch(dO(null)),this.dispatch(rO(!1)),[d,c]}async delete(e){const{store:n}=this.client,{addOne:a,deleteOne:r}=this.actions,{selectById:d}=this.selectors,o=d(e)(n.getState());if(!o)throw new Error(`Expected project file with uuid ${e} to exist in the store.`);this.dispatch(r(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}`,blockers:[e],blocks:[]})}catch(l){throw this.dispatch(a(o)),l}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(d)),d}}class uk extends Tt{constructor(){super(...arguments);m(this,"name","Project");m(this,"url","/projects");m(this,"actions",{addOne:TO,addMany:wO,setOne:AO,setMany:SO,updateOne:IO,updateMany:OO,deleteOne:FO,deleteMany:PO,initialize:yO});m(this,"selectors",{selectById:_O,selectByIds:RO})}async add(e){const{addOne:n}=this.actions,a=await this.performRequest({method:p.POST,url:`${this.url}/`,payload:E(e)});return this.dispatch(n(a)),a}async update(e){const{updateOne:n}=this.actions,a=await this.performRequest({method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:E(e)});return this.dispatch(n(a)),a}async delete(e){const{deleteOne:n}=this.actions,a=await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return this.dispatch(n(e)),a}async refreshStore(e,n){const{initialize:a}=this.actions,r=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(r)),r}}class hk extends k{constructor(){super(...arguments);m(this,"name","Team Membership");m(this,"url","/team-memberships");m(this,"actions",{addOne:EO,addMany:VO,setOne:WO,setMany:BO,updateOne:zO,updateMany:qO,deleteOne:jO,deleteMany:CO,initialize:vO});m(this,"selectors",{selectById:UO,selectByIds:LO})}add(e){var c;const{store:n}=this.client,{addOne:a,setOne:r,deleteOne:d}=this.actions,o=_({...e,created_by:((c=n.getState().userReducer.currentUser)==null?void 0:c.id)??null});this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(o),blockers:[e.team],blocks:[o.uuid]});return l.then(h=>{this.dispatch(r(h))}).catch(()=>{this.dispatch(d(o.uuid))}),[o,l]}bulkAdd(e){var h;const{store:n}=this.client,{addMany:a,setMany:r,deleteMany:d}=this.actions,o=((h=n.getState().userReducer.currentUser)==null?void 0:h.id)??null,l=e.map(f=>_({...f,created_by:o}));this.dispatch(a(l));const c=this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:{team_memberships:l.map(f=>E(f))},blockers:l.map(f=>f.team),blocks:l.map(f=>f.uuid)});return c.then(f=>{this.dispatch(r(f))}).catch(()=>{this.dispatch(d(l.map(f=>f.uuid)))}),[l,c]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:r}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected team membership with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(c){throw this.dispatch(r(l)),c}}async refreshStore(e,n){const{initialize:a}=this.actions,r=await this.list({queryParams:{team__organization:e}},n);return this.dispatch(a(r)),r}}class pk extends k{constructor(){super(...arguments);m(this,"name","Team");m(this,"url","/teams");m(this,"actions",{addOne:GO,addMany:KO,setOne:YO,setMany:ZO,updateOne:JO,updateMany:QO,deleteOne:XO,deleteMany:xO,initialize:HO});m(this,"selectors",{selectById:tI,selectByIds:sI})}add(e){var c;const{store:n}=this.client,{addOne:a,setOne:r,deleteOne:d}=this.actions,o=_({...e,submitted_at:new Date().toISOString(),created_by:((c=n.getState().userReducer.currentUser)==null?void 0:c.id)??null});this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(o),blockers:[],blocks:[o.uuid]});return l.then(h=>{this.dispatch(r(h))}).catch(()=>{this.dispatch(d(o.uuid))}),[o,l]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:r}=this.selectors,d=r(e.uuid)(n.getState());if(!d)throw new Error(`Expected team with uuid ${e.uuid} to exist`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:E(e),blockers:[e.uuid],blocks:[e.uuid]});return l.then(c=>{this.dispatch(a(c))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:r}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected team with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(c){throw this.dispatch(r(l)),c}}async refreshStore(e,n){const{initialize:a}=this.actions,r=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(r)),r}}class mk extends Tt{constructor(){super(...arguments);m(this,"name","User");m(this,"url","/user");m(this,"actions",{addOne:Un,addMany:zw,setOne:Bw,setMany:Ww,updateOne:jw,updateMany:qw,deleteOne:Ln,deleteMany:Cw,initialize:Vw});m(this,"selectors",{selectById:es,selectByIds:Uw})}async list(e,n){const{organizationUuid:a,...r}=e,d=a?`/organizations/${a}${this.url}s/`:`/${this.url}`;return this.performRequest({method:p.GET,url:d,...r},n)}async refreshStore(e,n){const{initialize:a}=this.actions,r=await this.list({organizationUuid:e},n);return this.dispatch(a(r)),r}}class fk extends k{constructor(){super(...arguments);m(this,"name","Workflow");m(this,"url","/workflows");m(this,"actions",{addOne:cI,addMany:aa,setOne:rI,setMany:dI,updateOne:lI,updateMany:oI,deleteOne:uI,deleteMany:ca,initialize:aI});m(this,"selectors",{selectById:pI,selectByIds:mI})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:r,deleteOne:d}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,c=new Date().toISOString(),h=_({...e,created_by:l,submitted_at:c});this.dispatch(a(h));const f=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(h),blockers:[h.project,h.workflow_type],blocks:[h.uuid]});return f.then(S=>{this.dispatch(r(S))}).catch(()=>{this.dispatch(d(h.uuid))}),[h,f]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:r}=this.selectors,d=r(e.uuid)(n.getState());if(!d)throw new Error(`Expected workflow with uuid ${e.uuid} to exist`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[d.uuid],blocks:[d.uuid]});return l.then(c=>{this.dispatch(a(c))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:r}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected workflow with uuid ${e} to exist`);const c=YF(e)(o),h=RI(e)(o),f=BP(e)(o),y=YP(e)(o),S=rg(e)(o),O=hF(e)(o),P=xI(e)(o),I=PF(e)(o),F={};for(const v of P)for(const V of ha(v.uuid)(o))F[V.uuid]=V;const g=Object.values(F);this.dispatch(a(e)),this.dispatch(Ma(B(c))),this.dispatch(la(B(h))),this.dispatch(ja(B(f))),this.dispatch($a(B(y))),this.dispatch(Na(B(S))),this.dispatch(Aa(B(O))),this.dispatch(Oa(B(I))),this.dispatch(fa(B(P))),this.dispatch(cs(B(g)));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(v){throw this.dispatch(r(l)),this.dispatch(Ra(c)),this.dispatch(da(h)),this.dispatch(qa(f)),this.dispatch(Da(y)),this.dispatch(La(S)),this.dispatch(Sa(O)),this.dispatch(Ta(I)),this.dispatch(ma(P)),this.dispatch(as(g)),v}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(d)),d}}class yk extends k{constructor(){super(...arguments);m(this,"name","Workflow Step Assignee");m(this,"url","/workflow-step-assignees");m(this,"actions",{addOne:wI,addMany:da,setOne:TI,setMany:OI,updateOne:II,updateMany:FI,deleteOne:PI,deleteMany:la,initialize:AI});m(this,"selectors",{selectById:bI,selectByIds:_I})}add(e){var f;const{store:n}=this.client,{addOne:a,setOne:r,deleteOne:d}=this.actions,o=new Date().toISOString(),l=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,c=_({...e,submitted_at:o,created_by:l});this.dispatch(a(c));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(c),blockers:[e.workflow,e.workflow_step],blocks:[c.uuid]});return h.then(y=>{this.dispatch(r(y))}).catch(()=>{this.dispatch(d(c.uuid))}),[c,h]}bulkAdd(e){var f;const{store:n}=this.client,{addMany:a,setMany:r,deleteMany:d}=this.actions,o=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,l=new Date().toISOString(),c=e.map(y=>_({...y,submitted_at:l,created_by:o}));this.dispatch(a(c));const h=this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:{assignees:c.map(y=>E(y)),submitted_at:l},blockers:c.flatMap(y=>[y.workflow,y.workflow_step]),blocks:c.map(y=>y.uuid)});return h.then(y=>{this.dispatch(r(y))}).catch(()=>{this.dispatch(d(c.map(y=>y.uuid)))}),[c,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:r}=this.selectors,d=r(e.uuid)(n.getState());if(!d)throw new Error(`Expected workflow step assignee with uuid ${e.uuid} to exist`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return l.then(c=>{this.dispatch(a(c))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:r}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected workflow step assignee with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(c){throw this.dispatch(r(l)),c}}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:r}=this.actions,{selectByIds:d}=this.selectors,o=n.getState(),l=d(e)(o);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!0),method:p.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(r(l)),c}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{workflow__project:e}},n)).flat();return this.dispatch(a(d)),d}}class Sk extends L{constructor(){super(...arguments);m(this,"name","Workflow Step Comment Attachment");m(this,"url","/workflow-step-comment-attachments");m(this,"actions",{addOne:EI,addMany:as,setOne:VI,setMany:WI,updateOne:BI,updateMany:zI,deleteOne:qI,deleteMany:cs,initialize:vI});m(this,"selectors",{selectById:CI,selectByIds:DI})}getId(e){return e.uuid}buildModel(e){return _({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,workflow_step_comment:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,workflow_step_comment:e.workflow_step_comment}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.workflowStepCommentUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{workflow_step_comment__workflow__project:e}},n)).flat();return this.dispatch(a(d)),d}}class Ak extends k{constructor(){super(...arguments);m(this,"name","Workflow Step Comment");m(this,"url","/workflow-step-comments");m(this,"actions",{addOne:NI,addMany:ma,setOne:HI,setMany:GI,updateOne:KI,updateMany:YI,deleteOne:ZI,deleteMany:fa,initialize:LI});m(this,"selectors",{selectById:QI,selectByIds:XI})}add(e){var c;const{store:n}=this.client,{addOne:a,updateOne:r,deleteOne:d}=this.actions,o=_({...e,created_by:((c=n.getState().userReducer.currentUser)==null?void 0:c.id)??null,submitted_at:new Date().toISOString()});this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(o),blockers:[e.workflow,e.workflow_step],blocks:[o.uuid]});return l.then(h=>{this.dispatch(r(h))}).catch(()=>{this.dispatch(d(o.uuid))}),[o,l]}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:r}=this.selectors,d=r(e.uuid)(n.getState());if(!d)throw new Error(`Comment with uuid ${e.uuid} not found in store`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return l.then(c=>{this.dispatch(a(c))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:r}=this.actions,{selectById:d}=this.selectors,o=d(e)(n.getState());if(!o)throw new Error(`Comment with uuid ${e} not found in store`);const l=ha(e)(n.getState());this.dispatch(a(e)),this.dispatch(cs(B(l)));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(r(o)),this.dispatch(as(l)),c}}async refreshStore(e,n){const{setMany:a}=this.actions,d=(await this.listPaginated({queryParams:{workflow__project:e}},n)).flat();return this.dispatch(a(d)),d}}class wk extends k{constructor(){super(...arguments);m(this,"name","Workflow Step Completion");m(this,"url","/workflow-step-completions");m(this,"actions",{addOne:iF,addMany:Sa,setOne:nF,setMany:aF,updateOne:cF,updateMany:rF,deleteOne:dF,deleteMany:Aa,initialize:sF});m(this,"selectors",{selectById:oF,selectByIds:uF})}add(e){var f;const{store:n}=this.client,{addOne:a,setOne:r,deleteOne:d}=this.actions,o=new Date().toISOString(),l=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,c=_({...e,submitted_at:o,created_by:l});this.dispatch(a(c));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(c),blockers:[e.workflow,e.workflow_step],blocks:[c.uuid]});return h.then(y=>{this.dispatch(r(y))}).catch(()=>{this.dispatch(d(c.uuid))}),[c,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:r}=this.selectors,d=r(e.uuid)(n.getState());if(!d)throw new Error(`Expected workflow step completion with uuid ${e.uuid} to exist`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return l.then(c=>{this.dispatch(a(c))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:r}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected workflow step completion with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(c){throw this.dispatch(r(l)),c}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{workflow__project:e}},n)).flat();return this.dispatch(a(d)),d}}class Tk extends k{constructor(){super(...arguments);m(this,"name","Workflow Step Event");m(this,"url","/workflow-step-events");m(this,"actions",{addOne:yF,addMany:Ta,setOne:SF,setMany:AF,updateOne:wF,updateMany:TF,deleteOne:OF,deleteMany:Oa,initialize:fF});m(this,"selectors",{selectById:IF,selectByIds:FF})}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{workflow__project:e}},n)).flat();return this.dispatch(a(d)),d}}class Ok extends k{constructor(){super(...arguments);m(this,"name","Workflow Step Field Values Attachment");m(this,"url","/workflow-step-field-values-attachments");m(this,"actions",{addOne:RF,addMany:Pa,setOne:MF,setMany:kF,updateOne:vF,updateMany:EF,deleteOne:VF,deleteMany:ga,initialize:_F});m(this,"selectors",{selectById:BF,selectByIds:zF})}async bulkAdd(e){var y;const{addMany:n,setMany:a,deleteMany:r}=this.actions,d=new Date().toISOString(),o=((y=this.client.store.getState().userReducer.currentUser)==null?void 0:y.id)??null,l={},c=[],h=[];for(const S of e){const{fieldValuesUuid:O,fieldIdentifier:P,file:I}=S,F=await this.client.files.getFilePayload(I);F.sha1 in l||(l[F.sha1]=F);const g=_({file:URL.createObjectURL(I),file_type:I.type,file_name:I.name,file_sha1:F.sha1,created_by:o,field_values:O,submitted_at:d,field_identifier:P});c.push(g);const v={uuid:g.uuid,file_name:I.name,file_sha1:F.sha1,file_extension:F.extension,field_identifier:P,field_values:O};h.push(v)}this.dispatch(n(c));const f=this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:{submitted_at:d,attachments:h,files:Object.values(l)},blockers:c.map(S=>S.field_values),blocks:c.map(S=>S.uuid)});return f.then(({presigned_urls:S,attachments:O})=>{this.client.files.processPresignedUrls(S),this.dispatch(a(O))}).catch(S=>{throw this.dispatch(r(c.map(O=>O.uuid))),S}),[c,f.then(({attachments:S})=>S)]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:r}=this.actions,{selectByIds:d}=this.selectors,o=n.getState(),l=d(e)(o);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!0),method:p.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(r(l)),c}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{field_values__workflow__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class Ik extends k{constructor(){super(...arguments);m(this,"name","Workflow Step Field Values");m(this,"url","/workflow-step-field-values");m(this,"actions",{addOne:$F,addMany:Ra,setOne:UF,setMany:LF,updateOne:NF,updateMany:HF,deleteOne:GF,deleteMany:Ma,initialize:DF});m(this,"selectors",{selectById:ZF,selectByIds:JF})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:r,deleteOne:d}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,c=new Date().toISOString(),h=_({...e,created_by:l,submitted_at:c}),f=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(h),blockers:[e.workflow,e.workflow_step,e.fields_revision],blocks:[h.uuid]});return this.dispatch(a(h)),f.then(S=>{this.dispatch(r(S))}).catch(()=>{this.dispatch(d(h.uuid))}),[h,f]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:r}=this.selectors,d=n.getState(),o=r(e.uuid)(d);if(!o)throw new Error(`Expected WorkflowStepFieldValues with uuid ${e.uuid} to exist`);const l={...o,...e};this.dispatch(a(l));const c=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[l.uuid,l.fields_revision,l.workflow,l.workflow_step],blocks:[l.uuid]});return c.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(o))}),[l,c]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:r}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected submission with uuid ${e} to exist`);const c=qF(e)(o);this.dispatch(a(e)),this.dispatch(ga(B(c)));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(r(l)),this.dispatch(Pa(c)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{workflow__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class Fk extends k{constructor(){super(...arguments);m(this,"name","Workflow Step Fields Attachment");m(this,"url","/workflow-step-fields-attachments");m(this,"actions",{addOne:eP,addMany:va,setOne:tP,setMany:sP,updateOne:iP,updateMany:nP,deleteOne:aP,deleteMany:Ea,initialize:xF});m(this,"selectors",{selectById:dP,selectByIds:lP})}async bulkAdd(e){var y;const{addMany:n,setMany:a,deleteMany:r}=this.actions,d=new Date().toISOString(),o=((y=this.client.store.getState().userReducer.currentUser)==null?void 0:y.id)??null,l={},c=[],h=[];for(const S of e){const{fieldsRevisionUuid:O,fieldIdentifier:P,file:I}=S,F=await this.client.files.getFilePayload(I);F.sha1 in l||(l[F.sha1]=F);const g=_({file:URL.createObjectURL(I),file_type:I.type,file_name:I.name,file_sha1:F.sha1,created_by:o,fields_revision:O,submitted_at:d,field_identifier:P});c.push(g);const v={uuid:g.uuid,file_name:I.name,field_identifier:P,file_extension:F.extension,file_sha1:F.sha1,fields_revision:O};h.push(v)}this.dispatch(n(c));const f=this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:{submitted_at:d,attachments:h,files:Object.values(l)},blockers:c.map(S=>S.fields_revision),blocks:c.map(S=>S.uuid)});return f.then(S=>{this.client.files.processPresignedUrls(S.presigned_urls),this.dispatch(a(S.attachments))}).catch(()=>{this.dispatch(r(c.map(S=>S.uuid)))}),[c,f.then(({attachments:S})=>S)]}async refreshStore(e,n){const{initialize:a}=this.actions,r=await this.list({queryParams:{fields_revision__workflow_step__workflow_type__organization:e}},n);return this.dispatch(a(r)),r}}class Pk extends k{constructor(){super(...arguments);m(this,"name","Workflow Step Fields");m(this,"url","/workflow-step-fields");m(this,"actions",{addOne:pP,addMany:mP,setOne:fP,setMany:yP,updateOne:SP,updateMany:AP,deleteOne:wP,deleteMany:TP,initialize:hP});m(this,"selectors",{selectById:OP,selectByIds:IP})}add(e){var f;const{store:n}=this.client,{addOne:a,setOne:r,deleteOne:d}=this.actions,o=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,l=new Date().toISOString(),c=_({...e,created_by:o,submitted_at:l});this.dispatch(a(c));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(c),blockers:[c.workflow_step],blocks:[c.uuid]});return h.then(y=>{this.dispatch(r(y))}).catch(y=>{throw this.dispatch(d(c.uuid)),y}),[c,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,r=n.getState().workflowStepFieldsReducer.instances[e.uuid];if(!r)throw new Error(`WorkflowStepFields with uuid ${e.uuid} not found`);const d={...r,...e};this.dispatch(a(d));const o=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${r.uuid}/`,payload:e,blockers:[r.uuid],blocks:[r.uuid]});return o.then(l=>{this.dispatch(a(l))}).catch(l=>{throw this.dispatch(a(r)),l}),[d,o]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:r}=this.actions,d=n.getState().workflowStepFieldsReducer.instances[e];if(!d)throw new Error(`WorkflowStepFields with uuid ${e} not found`);const o=rP(e)(n.getState());this.dispatch(a(e)),this.dispatch(Ea(B(o)));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(l){throw this.dispatch(r(d)),this.dispatch(va(o)),l}}async refreshStore(e,n){const{initialize:a}=this.actions,r=await this.list({queryParams:{workflow_step__workflow_type__organization:e}},n);return this.dispatch(a(r)),r}}class gk extends k{constructor(){super(...arguments);m(this,"name","Workflow Step Reviewer");m(this,"url","/workflow-step-reviewers");m(this,"actions",{addOne:bP,addMany:qa,setOne:_P,setMany:RP,updateOne:MP,updateMany:kP,deleteOne:vP,deleteMany:ja,initialize:gP});m(this,"selectors",{selectById:VP,selectByIds:WP})}add(e){var f;const{store:n}=this.client,{addOne:a,setOne:r,deleteOne:d}=this.actions,o=new Date().toISOString(),l=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,c=_({...e,submitted_at:o,created_by:l});this.dispatch(a(c));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(c),blockers:[e.workflow,e.workflow_step],blocks:[c.uuid]});return h.then(y=>{this.dispatch(r(y))}).catch(()=>{this.dispatch(d(c.uuid))}),[c,h]}bulkAdd(e){var f;const{store:n}=this.client,{addMany:a,setMany:r,deleteMany:d}=this.actions,o=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,l=new Date().toISOString(),c=e.map(y=>_({...y,submitted_at:l,created_by:o}));this.dispatch(a(c));const h=this.enqueueRequest({description:T(p.POST,this.name,!0),method:p.POST,url:`${this.url}/bulk/`,payload:{reviewers:c.map(y=>E(y)),submitted_at:l},blockers:c.flatMap(y=>[y.workflow,y.workflow_step]),blocks:c.map(y=>y.uuid)});return h.then(y=>{this.dispatch(r(y))}).catch(()=>{this.dispatch(d(c.map(y=>y.uuid)))}),[c,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:r}=this.selectors,d=r(e.uuid)(n.getState());if(!d)throw new Error(`Expected workflow step reviewer with uuid ${e.uuid} to exist`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return l.then(c=>{this.dispatch(a(c))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:r}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected workflow step reviewer with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(c){throw this.dispatch(r(l)),c}}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:r}=this.actions,{selectByIds:d}=this.selectors,o=n.getState(),l=d(e)(o);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!0),method:p.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(r(l)),c}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{workflow__project:e}},n)).flat();return this.dispatch(a(d)),d}}class bk extends k{constructor(){super(...arguments);m(this,"name","Workflow Step Review Request");m(this,"url","/workflow-step-review-requests");m(this,"actions",{addOne:CP,addMany:Da,setOne:DP,setMany:$P,updateOne:UP,updateMany:LP,deleteOne:NP,deleteMany:$a,initialize:jP});m(this,"selectors",{selectById:GP,selectByIds:KP})}add(e){var f;const{store:n}=this.client,{addOne:a,setOne:r,deleteOne:d}=this.actions,o=new Date().toISOString(),l=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,c=_({...e,submitted_at:o,created_by:l});this.dispatch(a(c));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(c),blockers:[e.workflow,e.workflow_step],blocks:[c.uuid]});return h.then(y=>{this.dispatch(r(y))}).catch(()=>{this.dispatch(d(c.uuid))}),[c,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:r}=this.selectors,d=r(e.uuid)(n.getState());if(!d)throw new Error(`Expected workflow step review request with uuid ${e.uuid} to exist`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return l.then(c=>{this.dispatch(a(c))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:r}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected workflow step review request with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(c){throw this.dispatch(r(l)),c}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{workflow__project:e}},n)).flat();return this.dispatch(a(d)),d}}class _k extends k{constructor(){super(...arguments);m(this,"name","Workflow Step Review");m(this,"url","/workflow-step-reviews");m(this,"actions",{addOne:XP,addMany:La,setOne:xP,setMany:eg,updateOne:tg,updateMany:sg,deleteOne:ig,deleteMany:Na,initialize:QP});m(this,"selectors",{selectById:ag,selectByIds:cg})}add(e){var f;const{store:n}=this.client,{addOne:a,setOne:r,deleteOne:d}=this.actions,o=new Date().toISOString(),l=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,c=_({...e,submitted_at:o,created_by:l});this.dispatch(a(c));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(c),blockers:[e.workflow,e.workflow_step],blocks:[c.uuid]});return h.then(y=>{this.dispatch(r(y))}).catch(()=>{this.dispatch(d(c.uuid))}),[c,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:r}=this.selectors,d=r(e.uuid)(n.getState());if(!d)throw new Error(`Expected workflow step review with uuid ${e.uuid} to exist`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return l.then(c=>{this.dispatch(a(c))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:r}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected workflow step review with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(c){throw this.dispatch(r(l)),c}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{workflow__project:e}},n)).flat();return this.dispatch(a(d)),d}}class Rk extends k{constructor(){super(...arguments);m(this,"name","Workflow Step");m(this,"url","/workflow-steps");m(this,"actions",{addOne:ug,addMany:Ga,setOne:hg,setMany:pg,updateOne:mg,updateMany:fg,deleteOne:yg,deleteMany:Ka,initialize:og});m(this,"selectors",{selectById:wg,selectByIds:Og})}add(e){var f;const{store:n}=this.client,{addOne:a,setOne:r,deleteOne:d}=this.actions,o=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,l=new Date().toISOString(),c=_({...e,created_by:o,submitted_at:l});this.dispatch(a(c));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(c),blockers:[c.workflow_type],blocks:[c.uuid]});return h.then(y=>{this.dispatch(r(y))}).catch(()=>{this.dispatch(d(c.uuid))}),[c,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:r}=this.selectors,d=r(e.uuid)(n.getState());if(!d)throw new Error(`No workflow step with uuid ${e.uuid} found in the store`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${d.uuid}/`,payload:{name:e.name,order:e.order},blockers:[d.uuid],blocks:[d.uuid]});return l.then(c=>{this.dispatch(a(c))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:r}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`No workflow step with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(r(l)),c}}async refreshStore(e,n){const{initialize:a}=this.actions,r=await this.list({queryParams:{workflow_type__organization:e}},n);return this.dispatch(a(r)),r}}class Mk extends k{constructor(){super(...arguments);m(this,"name","Workflow Type");m(this,"url","/workflow-types");m(this,"actions",{addOne:Pg,addMany:gg,setOne:bg,setMany:_g,updateOne:Rg,updateMany:Mg,deleteOne:kg,deleteMany:vg,initialize:Fg});m(this,"selectors",{selectById:Vg,selectByIds:Wg})}add(e){var f;const{store:n}=this.client,{addOne:a,setOne:r,deleteOne:d}=this.actions,o=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,l=new Date().toISOString(),c=_({...e,created_by:o,submitted_at:l});this.dispatch(a(c));const h=this.enqueueRequest({description:T(p.POST,this.name,!1),method:p.POST,url:`${this.url}/`,payload:E(c),blockers:[],blocks:[c.uuid]});return h.then(y=>{this.dispatch(r(y))}).catch(()=>{this.dispatch(d(c.uuid))}),[c,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:r}=this.selectors,d=r(e.uuid)(n.getState());if(!d)throw new Error(`Expected workflow type with uuid ${e.uuid} to exist`);const o={...d,...e};this.dispatch(a(o));const l=this.enqueueRequest({description:T(p.PATCH,this.name,!1),method:p.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[d.uuid],blocks:[d.uuid]});return l.then(c=>{this.dispatch(a(c))}).catch(()=>{this.dispatch(a(d))}),[o,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:r}=this.actions,{selectById:d}=this.selectors,o=n.getState(),l=d(e)(o);if(!l)throw new Error(`Expected workflow type with uuid ${e} to exist`);const c=fI(e)(o),h=Tg(e)(o);this.dispatch(a(e)),this.dispatch(ca(B(c))),this.dispatch(Ka(B(h)));try{return await this.enqueueRequest({description:T(p.DELETE,this.name,!1),method:p.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(f){throw this.dispatch(r(l)),this.dispatch(aa(c)),this.dispatch(Ga(h)),f}}async refreshStore(e,n){const{initialize:a}=this.actions,r=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(r)),r}}async function sc(t,s,e,n,a){const r=n instanceof ft;r&&s.checkAuth!==!1&&await n.auth.prepareAuth();const d={queryParams:"",isAuthNeeded:!0},{s3url:o,payload:l,headers:c,method:h,queryParams:f,attachmentHash:y,isExternalUrl:S,isAuthNeeded:O,isResponseBlob:P}={...d,...s};let I=s.url;const F=y?await e.files.fetchCache(y):void 0;if(y&&!F)throw new Error(`Cannot upload file ${y} because it's not cached.`);!S&&!I.startsWith("http")&&(!I.startsWith("/")&&!I.startsWith("blob:")&&(I="/"+I),I=t+I);const g=z=>{if(y){if(!o)throw new Error(`No S3 URL for file ${y}`);if("warning"in o)throw new Error(`S3 URL warning for file ${y}`);if(!F)throw new Error(`No file for file ${y}`);const mt=o.fields["x-amz-checksum-sha1"];if(!mt)throw new Error(`No checksum for file ${y}`);return z.set("x-amz-checksum-sha1",mt).field({...l,...o.fields}).attach("file",F)}return z.send(l)},V={[p.GET]:()=>P?St.get(I.toString()).responseType("blob"):St.get(I.toString()),[p.POST]:()=>{const z=St.post(I.toString());return g(z)},[p.PATCH]:()=>{const z=St.patch(I.toString());return g(z)},[p.PUT]:()=>{const z=St.put(I.toString());return g(z)},[p.DELETE]:()=>{const z=St.delete(I.toString());return g(z)}}[h];let W=V();const j=()=>{console.debug("aborting request:",s.url),W.abort()};if(a==null||a.addEventListener("abort",j),O&&r){const z=n.auth.getAuthHeader();W=W.set("Authorization",z)}c&&(W=W.set(c));try{return await W.query(f)}catch(z){const mt=Xg(z),ob=mt==null?void 0:mt.status;if(r&&ob===401)return await n.auth.handleUnauthorized(W,mt),W.query(f);throw new D({response:mt,innerError:z,discard:Xa.includes(ob)})}finally{a==null||a.removeEventListener("abort",j)}}class kk{constructor(s){m(this,"store");this.store=s}_performRequest(s,e,n,a){const r=new ys,d={...e,uuid:e.uuid??pt.v4()};return sc(s,d,this,n,a).then(o=>{r.resolve(o.body)}).catch(o=>{o instanceof Error?r.reject(o):r.reject(new Error((o??wt).toString()))}),r}async performRequest(s,e,n,a){return this._performRequest(s,e,n,a).then(r=>{if(r instanceof D)throw r;return r})}async enqueueRequest(s,e,n){return this._enqueueRequest(s,e,n).then(a=>{if(a instanceof D)throw a;return a})}_enqueueRequest(s,e,n){const a=new ys,r={...s,BASE_URL:e,serviceName:n},d=this.store.dispatch(TT(r)),o=c=>{if(c)a.resolve(c.body);else{const h=new D({message:"Could not get a response from the server.",response:c,discard:!0});a.reject(h)}},l=c=>{c instanceof D?c.options.discard=!0:(console.error("Received an unexpected error while processing a request:",c,`
15
+ Converting error to APIError and discarding.`),c=new D({message:"An error occurred while processing the request.",innerError:c,discard:!0})),a.reject(c)};return d.then(o,l),a}async performPagination(s,e,n,a,r){const d={...e,queryParams:{...e.queryParams,paginate:!0,limit:n}},{method:o}=d,l=[];let c=await this.performRequest(s,d,a,r);for(l.push(c.results);c.next;)c=await this.performRequest(s,{url:c.next,method:o},a,r),l.push(c.results);return l}}class Ot{constructor(){m(this,"graph");m(this,"requestAttemptCounter");this.graph=new Ab.DepGraph,this.requestAttemptCounter={}}static _fromOutbox(s){const e=new Ot;for(let n=0;n<s.length;n++){const a=s[n];if(!a){console.error("Outbox item was undefined");continue}e.sneakRequest(a);for(let r=0;r<n;r++){const d=s[r];if(!d){console.error("Previous outbox item was undefined");continue}d.payload.uuid!==a.payload.uuid&&d.payload.blocks.some(o=>a.payload.blockers.includes(o))&&Ot._addDependency(a.payload.uuid,d.payload.uuid,e.graph)}}return e}_addDependency(s,e){Ot._addDependency(s,e,this.graph)}static _addDependency(s,e,n){if(s===e)throw new Error(`Tried to add dependency from node to itself: ${s}`);if(!n.hasNode(s))throw new Error(`Tried to add dependency from non-existent node: ${s} (to node: ${e})`);if(!n.hasNode(e))throw new Error(`Tried to add dependency to non-existent node: ${e} (from node: ${s})`);n.addDependency(s,e)}addRequest(s){if(this.graph.addNode(s.payload.uuid,s),!(s.payload.blockers.length===0||this.graph.size()===1))for(const e of this.graph.overallOrder()){if(e===s.payload.uuid)continue;const n=this.graph.getNodeData(e),a=new Set(n.payload.blocks);s.payload.blockers.some(r=>a.has(r))&&this._addDependency(s.payload.uuid,e)}}insertRequest(s){this.graph.addNode(s.payload.uuid,s);for(const e of this.graph.overallOrder()){if(e===s.payload.uuid)continue;const n=this.graph.getNodeData(e),a=new Set(s.payload.blocks);n.payload.blockers.some(r=>a.has(r))&&this._addDependency(e,s.payload.uuid)}}sneakRequest(s){this.graph.addNode(s.payload.uuid,s)}_getNextNode(){const s=this.graph.overallOrder(!0);let e=1/0,n;for(const a of s){const r=this.requestAttemptCounter[a]||0;r<e&&(e=r,n=a)}return n}peek(){const s=this._getNextNode();if(s)return this.graph.getNodeData(s)}remove(s){this.graph.removeNode(s),delete this.requestAttemptCounter[s]}pop(){const s=this.peek();return s&&this.graph.removeNode(s.payload.uuid),s}getQueue(){const s=this.graph.overallOrder().map(n=>this.graph.getNodeData(n)),e=this._getNextNode();if(e){const n=this.graph.getNodeData(e),a=s.findIndex(r=>r.payload.uuid===n.payload.uuid);a!==-1&&(s.splice(a,1),s.unshift(n))}return s}getReady(){let s=this.graph.overallOrder(!0).map(e=>this.graph.getNodeData(e));return s=s.sort((e,n)=>e.meta.offline.effect.timestamp.localeCompare(n.meta.offline.effect.timestamp)),s=s.sort((e,n)=>{const a=this.requestAttemptCounter[e.payload.uuid]||0,r=this.requestAttemptCounter[n.payload.uuid]||0;return a-r}),s}registerRetry(s){this.requestAttemptCounter[s]=(this.requestAttemptCounter[s]||0)+1}}let xg;function eb(t){xg=t}function It(){return xg}let tb;function sb(t){tb=t}function ib(){return tb}let ic=null;function yt(){const t=It();if(!t)return console.warn("Client store not set; cannot get outbox coordinator yet."),null;if(ic)return ic;const s=t.getState().offline.outbox,e=Ot._fromOutbox(s);return ic=e,e}const vk=(t,s)=>{const e=new s(t);return sb(e),eb(t),e};class Ek{constructor(s){m(this,"_all");m(this,"_previous");this._all=[s],this._previous=s,this.then=this.then.bind(this),this.compile=this.compile.bind(this)}then(s){return this._previous&&(this._previous.next=s),this._all.push(s),this._previous=s,{then:this.then,compile:this.compile}}compile(){return this._all}}class nc{constructor(){m(this,"next");this.next=null}then(s){return new Ek(this).then(s)}async run(s){if(this.next)return this.next.run(s);{if(console.debug("Middleware finished. Performing request:",s.payload.url),!It())throw new Error("Client store not set");const n=ib();if(!n)throw new Error("Client SDK not set");return Zg(s,n)}}}class nb extends nc{async run(s){return super.run(s)}}class ab extends nc{async run(s){return super.run(s)}}const cb=new nb().then(new ab).compile();function rb(t){var s;return(s=cb[0])==null?void 0:s.run(t)}var db=(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))(db||{});i.ALL_MIDDLEWARE=cb,i.APIError=D,i.ATTACHMENT_MODEL_DEFAULT_PAGE_SIZE=Dg,i.AgentService=sM,i.AssetAttachmentService=iM,i.AssetProcedureService=lM,i.AssetProcedureStepFieldValuesAttachmentService=pM,i.AssetProcedureStepFieldValuesService=mM,i.AssetProcedureStepFieldsAttachmentService=uM,i.AssetProcedureStepFieldsService=hM,i.AssetProcedureStepService=fM,i.AssetProcedureTypeAttachmentService=nM,i.AssetProcedureTypeFieldValuesAttachmentService=rM,i.AssetProcedureTypeFieldValuesService=dM,i.AssetProcedureTypeFieldsAttachmentService=aM,i.AssetProcedureTypeFieldsService=cM,i.AssetProcedureTypeService=oM,i.AssetService=yM,i.AssetStageCompletionService=SM,i.AssetStageService=AM,i.AssetStatusType=oc,i.AssetTypeAttachmentService=wM,i.AssetTypeFieldValuesAttachmentService=IM,i.AssetTypeFieldValuesService=FM,i.AssetTypeFieldsAttachmentService=TM,i.AssetTypeFieldsService=OM,i.AssetTypeIdentifierService=PM,i.AssetTypeIdentifierValueService=gM,i.AssetTypeService=bM,i.AssetTypeStatusService=_M,i.AttachmentModel=uc,i.BaseApiService=ft,i.BaseModelApiService=Tt,i.BaseOfflineAttachmentModelService=L,i.BaseOfflineModelApiService=k,i.BaseSDK=kk,i.COMMON_AUTO_FIELDS=Tc,i.DEFAULT_ISSUE_PRIORITY=wb,i.DEFAULT_PAGE_SIZE=Cg,i.DISCARD_HTTP_STATUSES=Xa,i.DeferredPromise=ys,i.DocumentAttachmentService=RM,i.DocumentService=MM,i.EMPTY_ARRAY=rc,i.EMPTY_OBJECT=dc,i.EmailDomainsService=kM,i.EmailVerificationService=vM,i.FileService=VM,i.FormIdentifierService=WM,i.FormIdentifierValueService=BM,i.FormRevisionAttachmentService=zM,i.FormRevisionService=qM,i.FormService=jM,i.FormSubmissionAttachmentService=CM,i.FormSubmissionService=DM,i.GeoImageService=$M,i.HttpMethod=p,i.IssueAssociationService=UM,i.IssueAttachmentService=LM,i.IssueCommentAttachmentService=NM,i.IssueCommentService=HM,i.IssuePriority=fs,i.IssueService=GM,i.IssueStatusType=hc,i.IssueTypeAttachmentService=KM,i.IssueTypeFieldValuesAttachmentService=JM,i.IssueTypeFieldValuesService=QM,i.IssueTypeFieldsAttachmentService=YM,i.IssueTypeFieldsService=ZM,i.IssueTypeIdentifierService=XM,i.IssueTypeIdentifierValueService=xM,i.IssueTypeService=ek,i.IssueTypeStatusService=tk,i.IssueUpdateChange=C,i.IssueUpdateService=sk,i.JWTService=ak,i.MAX_SERVICE_BATCH_SIZE=U,i.OUTBOX_RETRY_DELAY=fc,i.OfflineAnalyticsMiddleware=nb,i.OfflineMiddleware=nc,i.OrganizationAccessLevel=lc,i.OrganizationAccessService=ck,i.OrganizationService=rk,i.OutboxCoordinator=Ot,i.ProjectAccessService=dk,i.ProjectAttachmentService=lk,i.ProjectFileService=ok,i.ProjectService=uk,i.RESET_ORGANIZATION_STATE=M,i.RESET_PROJECT_STATE=q,i.RESET_STATE=b,i.RateLimitingMiddleware=ab,i.SelectorBuilder=Lb,i.TeamMembershipService=hk,i.TeamService=pk,i.UNKNOWN_ERROR_MESSAGE=wt,i.UserService=mk,i.VERSION_REDUCER_KEY=Ft,i.VerificationCodeType=db,i.WorkflowReviewType=pc,i.WorkflowService=fk,i.WorkflowStepAssigneeService=yk,i.WorkflowStepCommentAttachmentService=Sk,i.WorkflowStepCommentService=Ak,i.WorkflowStepCompletionService=wk,i.WorkflowStepEventService=Tk,i.WorkflowStepEventType=mc,i.WorkflowStepFieldValuesAttachmentService=Ok,i.WorkflowStepFieldValuesService=Ik,i.WorkflowStepFieldsAttachmentService=Fk,i.WorkflowStepFieldsService=Pk,i.WorkflowStepReviewRequestService=bk,i.WorkflowStepReviewService=_k,i.WorkflowStepReviewerService=gk,i.WorkflowStepService=Rk,i.WorkflowTypeService=Mk,i._setLatestRetryTime=IT,i.addAsset=Jl,i.addAssetAttachment=Bc,i.addAssetAttachments=gs,i.addAssetProcedure=ld,i.addAssetProcedureStep=jl,i.addAssetProcedureStepFieldValues=Il,i.addAssetProcedureStepFieldValuesAttachment=ll,i.addAssetProcedureStepFieldValuesAttachments=Ys,i.addAssetProcedureStepFieldValuesMany=Fl,i.addAssetProcedureStepFields=Jd,i.addAssetProcedureStepFieldsAttachment=zd,i.addAssetProcedureStepFieldsAttachments=qd,i.addAssetProcedureStepFieldsMany=Qd,i.addAssetProcedureSteps=Cl,i.addAssetProcedureType=Id,i.addAssetProcedureTypeAttachment=Yc,i.addAssetProcedureTypeAttachments=Zc,i.addAssetProcedureTypeFieldValues=Zr,i.addAssetProcedureTypeFieldValuesAttachment=zr,i.addAssetProcedureTypeFieldValuesAttachments=Ws,i.addAssetProcedureTypeFieldValuesMany=Jr,i.addAssetProcedureTypeFields=Ir,i.addAssetProcedureTypeFieldsAttachment=dr,i.addAssetProcedureTypeFieldsAttachments=lr,i.addAssetProcedureTypeFieldsMany=Fr,i.addAssetProcedureTypes=Fd,i.addAssetProcedures=Cs,i.addAssetStage=_o,i.addAssetStageCompletion=oo,i.addAssetStageCompletions=uo,i.addAssetStages=Ro,i.addAssetType=Rh,i.addAssetTypeAttachment=jo,i.addAssetTypeAttachments=di,i.addAssetTypeFieldValues=ju,i.addAssetTypeFieldValuesAttachment=gu,i.addAssetTypeFieldValuesAttachments=fi,i.addAssetTypeFieldValuesMany=Cu,i.addAssetTypeFields=uu,i.addAssetTypeFieldsAttachment=Qo,i.addAssetTypeFieldsAttachments=Xo,i.addAssetTypeFieldsMany=hu,i.addAssetTypeIdentifier=Xu,i.addAssetTypeIdentifierValue=hh,i.addAssetTypeIdentifierValues=ph,i.addAssetTypeIdentifiers=xu,i.addAssetTypeStatus=Dh,i.addAssetTypeStatuses=$h,i.addAssetTypes=Mh,i.addAssets=ti,i.addConversation=Mc,i.addConversations=Nb,i.addDocument=Sp,i.addDocumentAttachment=ip,i.addDocumentAttachments=np,i.addDocuments=Ap,i.addEmailDomain=vp,i.addEmailDomains=Ep,i.addForm=Ym,i.addFormIdentifier=Jp,i.addFormIdentifierValue=om,i.addFormIdentifierValues=um,i.addFormIdentifiers=Qp,i.addFormRevision=ji,i.addFormRevisionAttachment=Pm,i.addFormRevisionAttachments=gm,i.addFormRevisions=Ci,i.addFormSubmission=Ff,i.addFormSubmissionAttachment=lf,i.addFormSubmissionAttachments=Gi,i.addFormSubmissions=Xi,i.addForms=Zm,i.addGeoImage=zf,i.addGeoImages=qf,i.addIssue=Zy,i.addIssueAssociation=Xf,i.addIssueAssociations=Yt,i.addIssueAttachment=ly,i.addIssueAttachments=cn,i.addIssueComment=zy,i.addIssueCommentAttachment=Iy,i.addIssueCommentAttachments=Fy,i.addIssueComments=qy,i.addIssueType=QA,i.addIssueTypeAttachment=dS,i.addIssueTypeAttachments=lS,i.addIssueTypeFieldValues=zS,i.addIssueTypeFieldValuesAttachment=oA,i.addIssueTypeFieldValuesAttachments=Fn,i.addIssueTypeFieldValuesMany=qS,i.addIssueTypeFields=JS,i.addIssueTypeFieldsAttachment=IS,i.addIssueTypeFieldsAttachments=FS,i.addIssueTypeFieldsMany=QS,i.addIssueTypeIdentifier=FA,i.addIssueTypeIdentifierValue=qA,i.addIssueTypeIdentifierValues=jA,i.addIssueTypeIdentifiers=PA,i.addIssueTypeStatus=uw,i.addIssueTypeStatuses=hw,i.addIssueTypes=XA,i.addIssueUpdate=Bn,i.addIssueUpdates=zn,i.addIssues=mn,i.addOrganization=dT,i.addOrganizationAccess=Hw,i.addOrganizationAccesses=Gw,i.addOrganizations=rT,i.addProject=TO,i.addProjectAccess=bT,i.addProjectAccesses=_T,i.addProjectAttachment=CT,i.addProjectAttachments=DT,i.addProjectFile=tO,i.addProjectFiles=sO,i.addProjects=wO,i.addTeam=GO,i.addTeamMembership=EO,i.addTeamMemberships=VO,i.addTeams=KO,i.addUser=Un,i.addUsers=zw,i.addWorkflow=cI,i.addWorkflowStep=ug,i.addWorkflowStepAssignee=wI,i.addWorkflowStepAssignees=da,i.addWorkflowStepComment=NI,i.addWorkflowStepCommentAttachment=EI,i.addWorkflowStepCommentAttachments=as,i.addWorkflowStepComments=ma,i.addWorkflowStepCompletion=iF,i.addWorkflowStepCompletions=Sa,i.addWorkflowStepEvent=yF,i.addWorkflowStepEvents=Ta,i.addWorkflowStepFieldValues=$F,i.addWorkflowStepFieldValuesAttachment=RF,i.addWorkflowStepFieldValuesAttachments=Pa,i.addWorkflowStepFieldValuesMany=Ra,i.addWorkflowStepFields=pP,i.addWorkflowStepFieldsAttachment=eP,i.addWorkflowStepFieldsAttachments=va,i.addWorkflowStepFieldsMany=mP,i.addWorkflowStepReview=XP,i.addWorkflowStepReviewRequest=CP,i.addWorkflowStepReviewRequests=Da,i.addWorkflowStepReviewer=bP,i.addWorkflowStepReviewers=qa,i.addWorkflowStepReviews=La,i.addWorkflowSteps=Ga,i.addWorkflowType=Pg,i.addWorkflowTypes=gg,i.addWorkflows=aa,i.agentsReducer=Ec,i.agentsSlice=Is,i.areArraysEqual=Fb,i.assetAttachmentReducer=Hc,i.assetAttachmentSlice=Ps,i.assetProcedureReducer=fd,i.assetProcedureSlice=js,i.assetProcedureStepFieldValuesAttachmentReducer=wl,i.assetProcedureStepFieldValuesAttachmentSlice=Ks,i.assetProcedureStepFieldValuesReducer=Vl,i.assetProcedureStepFieldValuesSlice=Qs,i.assetProcedureStepFieldsAttachmentReducer=Kd,i.assetProcedureStepFieldsAttachmentSlice=Ls,i.assetProcedureStepFieldsReducer=cl,i.assetProcedureStepFieldsSlice=Hs,i.assetProcedureStepReducer=Nl,i.assetProcedureStepSlice=Xs,i.assetProcedureTypeAttachmentReducer=sr,i.assetProcedureTypeAttachmentSlice=Rs,i.assetProcedureTypeFieldValuesAttachmentReducer=Ur,i.assetProcedureTypeFieldValuesAttachmentSlice=Vs,i.assetProcedureTypeFieldValuesReducer=id,i.assetProcedureTypeFieldValuesSlice=qs,i.assetProcedureTypeFieldsAttachmentReducer=yr,i.assetProcedureTypeFieldsAttachmentSlice=ks,i.assetProcedureTypeFieldsReducer=kr,i.assetProcedureTypeFieldsSlice=Es,i.assetProcedureTypeReducer=kd,i.assetProcedureTypeSlice=$s,i.assetReducer=co,i.assetSlice=ei,i.assetStageCompletionReducer=Ao,i.assetStageCompletionSlice=ii,i.assetStageReducer=Vo,i.assetStageSlice=ni,i.assetTypeAttachmentReducer=Yo,i.assetTypeAttachmentSlice=ri,i.assetTypeFieldValuesAttachmentReducer=Bu,i.assetTypeFieldValuesAttachmentSlice=mi,i.assetTypeFieldValuesReducer=Zu,i.assetTypeFieldValuesSlice=Ai,i.assetTypeFieldsAttachmentReducer=du,i.assetTypeFieldsAttachmentSlice=ui,i.assetTypeFieldsReducer=Iu,i.assetTypeFieldsSlice=pi,i.assetTypeIdentifierReducer=lh,i.assetTypeIdentifierSlice=wi,i.assetTypeIdentifierValueReducer=Fh,i.assetTypeIdentifierValueSlice=Oi,i.assetTypeReducer=qh,i.assetTypeSlice=Ii,i.assetTypeStatusReducer=Qh,i.assetTypeStatusSlice=Pi,i.assetTypeStatusSortFn=Fc,i.authReducer=ep,i.authSlice=Lt,i.baseReducer=$R,i.baseReducers=Qa,i.blobToBase64=Eb,i.clearTokens=R_,i.constructUploadedFilePayloads=vb,i.createModelAdapter=R,i.createOfflineAction=AT,i.createPayload=E,i.createSelectionAdapter=Tb,i.deleteAsset=xl,i.deleteAssetAttachment=Dc,i.deleteAssetAttachments=bs,i.deleteAssetProcedure=hd,i.deleteAssetProcedureStep=Ul,i.deleteAssetProcedureStepFieldValues=Rl,i.deleteAssetProcedureStepFieldValuesAttachment=ml,i.deleteAssetProcedureStepFieldValuesAttachments=Zs,i.deleteAssetProcedureStepFieldValuesMany=Ml,i.deleteAssetProcedureStepFields=sl,i.deleteAssetProcedureStepFieldsAttachment=Ud,i.deleteAssetProcedureStepFieldsAttachments=Ld,i.deleteAssetProcedureStepFieldsMany=il,i.deleteAssetProcedureSteps=Ll,i.deleteAssetProcedureType=bd,i.deleteAssetProcedureTypeAttachment=er,i.deleteAssetProcedureTypeAttachments=tr,i.deleteAssetProcedureTypeFieldValues=td,i.deleteAssetProcedureTypeFieldValuesAttachment=$r,i.deleteAssetProcedureTypeFieldValuesAttachments=Bs,i.deleteAssetProcedureTypeFieldValuesMany=sd,i.deleteAssetProcedureTypeFields=Rr,i.deleteAssetProcedureTypeFieldsAttachment=mr,i.deleteAssetProcedureTypeFieldsAttachments=fr,i.deleteAssetProcedureTypeFieldsMany=Mr,i.deleteAssetProcedureTypes=_d,i.deleteAssetProcedures=Ds,i.deleteAssetStage=vo,i.deleteAssetStageCompletion=yo,i.deleteAssetStageCompletions=So,i.deleteAssetStages=Eo,i.deleteAssetType=Eh,i.deleteAssetTypeAttachment=Lo,i.deleteAssetTypeAttachments=li,i.deleteAssetTypeFieldValues=Nu,i.deleteAssetTypeFieldValuesAttachment=ku,i.deleteAssetTypeFieldValuesAttachments=yi,i.deleteAssetTypeFieldValuesMany=Hu,i.deleteAssetTypeFields=Su,i.deleteAssetTypeFieldsAttachment=iu,i.deleteAssetTypeFieldsAttachments=nu,i.deleteAssetTypeFieldsMany=Au,i.deleteAssetTypeIdentifier=nh,i.deleteAssetTypeIdentifierValue=Ah,i.deleteAssetTypeIdentifierValues=wh,i.deleteAssetTypeIdentifiers=ah,i.deleteAssetTypeStatus=Gh,i.deleteAssetTypeStatuses=Kh,i.deleteAssetTypes=Vh,i.deleteAssets=si,i.deleteConversation=Kb,i.deleteConversations=Yb,i.deleteDocument=Fp,i.deleteDocumentAttachment=lp,i.deleteDocumentAttachments=op,i.deleteDocuments=Pp,i.deleteEmailDomain=qp,i.deleteEmailDomains=jp,i.deleteForm=ef,i.deleteFormIdentifier=sm,i.deleteFormIdentifierValue=ym,i.deleteFormIdentifierValues=Sm,i.deleteFormIdentifiers=im,i.deleteFormRevision=Di,i.deleteFormRevisionAttachment=km,i.deleteFormRevisionAttachments=vm,i.deleteFormRevisions=$i,i.deleteFormSubmission=bf,i.deleteFormSubmissionAttachment=mf,i.deleteFormSubmissionAttachments=Ki,i.deleteFormSubmissions=xi,i.deleteForms=tf,i.deleteGeoImage=Df,i.deleteGeoImages=$f,i.deleteIssue=eS,i.deleteIssueAssociation=xf,i.deleteIssueAssociations=Zt,i.deleteIssueAttachment=my,i.deleteIssueAttachments=rn,i.deleteIssueComment=Uy,i.deleteIssueCommentAttachment=Ry,i.deleteIssueCommentAttachments=My,i.deleteIssueComments=Ly,i.deleteIssueType=iw,i.deleteIssueTypeAttachment=mS,i.deleteIssueTypeAttachments=fS,i.deleteIssueTypeFieldValues=US,i.deleteIssueTypeFieldValuesAttachment=fA,i.deleteIssueTypeFieldValuesAttachments=Pn,i.deleteIssueTypeFieldValuesMany=LS,i.deleteIssueTypeFields=sA,i.deleteIssueTypeFieldsAttachment=RS,i.deleteIssueTypeFieldsAttachments=MS,i.deleteIssueTypeFieldsMany=iA,i.deleteIssueTypeIdentifier=MA,i.deleteIssueTypeIdentifierValue=LA,i.deleteIssueTypeIdentifierValues=NA,i.deleteIssueTypeIdentifiers=kA,i.deleteIssueTypeStatus=Sw,i.deleteIssueTypeStatuses=Aw,i.deleteIssueTypes=nw,i.deleteIssueUpdate=qn,i.deleteIssueUpdates=jn,i.deleteIssues=fn,i.deleteOrganization=uT,i.deleteOrganizationAccess=Qw,i.deleteOrganizationAccesses=Xw,i.deleteOrganizations=hT,i.deleteProject=FO,i.deleteProjectAccess=ET,i.deleteProjectAccesses=VT,i.deleteProjectAttachment=HT,i.deleteProjectAttachments=GT,i.deleteProjectFile=aO,i.deleteProjectFiles=cO,i.deleteProjects=PO,i.deleteTeam=XO,i.deleteTeamMembership=jO,i.deleteTeamMemberships=CO,i.deleteTeams=xO,i.deleteUser=Ln,i.deleteUsers=Cw,i.deleteWorkflow=uI,i.deleteWorkflowStep=yg,i.deleteWorkflowStepAssignee=PI,i.deleteWorkflowStepAssignees=la,i.deleteWorkflowStepComment=ZI,i.deleteWorkflowStepCommentAttachment=qI,i.deleteWorkflowStepCommentAttachments=cs,i.deleteWorkflowStepComments=fa,i.deleteWorkflowStepCompletion=dF,i.deleteWorkflowStepCompletions=Aa,i.deleteWorkflowStepEvent=OF,i.deleteWorkflowStepEvents=Oa,i.deleteWorkflowStepFieldValues=GF,i.deleteWorkflowStepFieldValuesAttachment=VF,i.deleteWorkflowStepFieldValuesAttachments=ga,i.deleteWorkflowStepFieldValuesMany=Ma,i.deleteWorkflowStepFields=wP,i.deleteWorkflowStepFieldsAttachment=aP,i.deleteWorkflowStepFieldsAttachments=Ea,i.deleteWorkflowStepFieldsMany=TP,i.deleteWorkflowStepReview=ig,i.deleteWorkflowStepReviewRequest=NP,i.deleteWorkflowStepReviewRequests=$a,i.deleteWorkflowStepReviewer=vP,i.deleteWorkflowStepReviewers=ja,i.deleteWorkflowStepReviews=Na,i.deleteWorkflowSteps=Ka,i.deleteWorkflowType=kg,i.deleteWorkflowTypes=vg,i.deleteWorkflows=ca,i.dequeue=Yg,i.discard=Jg,i.documentAttachmentReducer=mp,i.documentAttachmentSlice=bi,i.documentSlice=Ri,i.documentsReducer=gp,i.downloadFile=Vb,i.downloadInMemoryFile=kb,i.emailDomainsReducer=Up,i.emailDomainsSlice=ki,i.emailRegex=Db,i.enqueue=Kg,i.enqueueRequest=TT,i.extractResponseFromError=Xg,i.fallbackToEmptyArray=w,i.fallbackToEmptyObject=Vt,i.fileReducer=Kp,i.fileSlice=Ei,i.fileToBlob=Ac,i.formIdentifierReducer=rm,i.formIdentifierSlice=Vi,i.formIdentifierValueReducer=Om,i.formIdentifierValueSlice=Bi,i.formReducer=sf,i.formRevisionAttachmentReducer=Bm,i.formRevisionAttachmentSlice=zi,i.formRevisionReducer=Hm,i.formRevisionsSlice=qi,i.formSlice=Li,i.formSubmissionAttachmentReducer=Af,i.formSubmissionAttachmentSlice=Hi,i.formSubmissionReducer=vf,i.formSubmissionSlice=Qi,i.geoImageReducer=Hf,i.geoImageSlice=tn,i.getAssetProcedureStepSubTree=Ic,i.getAssetProcedureStepTrees=$b,i.getClientSDK=ib,i.getClientStore=It,i.getDocumentSubTree=bc,i.getDocumentTrees=Ub,i.getFileIdentifier=Mb,i.getFileS3Key=Ts,i.getLocalDateString=yc,i.getLocalRelativeDateString=_b,i.getOutboxCoordinator=yt,i.getRenamedFile=Sc,i.getRequestDescription=T,i.hashFile=At,i.initSDK=vk,i.initializeAssetAttachments=Wc,i.initializeAssetProcedureStepFieldValues=Ol,i.initializeAssetProcedureStepFieldValuesAttachments=dl,i.initializeAssetProcedureStepFields=Zd,i.initializeAssetProcedureStepFieldsAttachments=Bd,i.initializeAssetProcedureSteps=Bl,i.initializeAssetProcedureTypeAttachments=Kc,i.initializeAssetProcedureTypeFieldValues=Yr,i.initializeAssetProcedureTypeFieldValuesAttachments=Br,i.initializeAssetProcedureTypeFields=Or,i.initializeAssetProcedureTypeFieldsAttachments=rr,i.initializeAssetProcedureTypes=Od,i.initializeAssetProcedures=dd,i.initializeAssetStageCompletions=lo,i.initializeAssetStages=Po,i.initializeAssetTypeAttachments=qo,i.initializeAssetTypeFieldValues=qu,i.initializeAssetTypeFieldValuesAttachments=Pu,i.initializeAssetTypeFields=ou,i.initializeAssetTypeFieldsAttachments=Jo,i.initializeAssetTypeIdentifierValues=uh,i.initializeAssetTypeIdentifiers=Qu,i.initializeAssetTypeStatuses=Ch,i.initializeAssetTypes=gh,i.initializeAssets=Zl,i.initializeConversations=Rc,i.initializeDocumentAttachments=sp,i.initializeDocuments=yp,i.initializeEmailDomains=kp,i.initializeFormIdentifierValues=lm,i.initializeFormIdentifiers=Zp,i.initializeFormRevisionAttachments=Fm,i.initializeFormRevisions=qm,i.initializeFormSubmissionAttachments=df,i.initializeFormSubmissions=Tf,i.initializeForms=Km,i.initializeGeoImages=Vf,i.initializeIssueAssociations=Kf,i.initializeIssueAttachments=dy,i.initializeIssueCommentAttachments=Oy,i.initializeIssueComments=By,i.initializeIssueTypeAttachments=rS,i.initializeIssueTypeFieldValues=BS,i.initializeIssueTypeFieldValuesAttachments=lA,i.initializeIssueTypeFields=ZS,i.initializeIssueTypeFieldsAttachments=OS,i.initializeIssueTypeIdentifierValues=zA,i.initializeIssueTypeIdentifiers=IA,i.initializeIssueTypeStatuses=ow,i.initializeIssueTypes=JA,i.initializeIssueUpdates=Fw,i.initializeIssues=Yy,i.initializeOrganizationAccesses=Nw,i.initializeOrganizations=nT,i.initializeProjectAccesses=gT,i.initializeProjectAttachments=jT,i.initializeProjectFiles=XT,i.initializeProjects=yO,i.initializeTeamMemberships=vO,i.initializeTeams=HO,i.initializeUsers=Vw,i.initializeWorkflowStepAssignees=AI,i.initializeWorkflowStepCommentAttachments=vI,i.initializeWorkflowStepComments=LI,i.initializeWorkflowStepCompletions=sF,i.initializeWorkflowStepEvents=fF,i.initializeWorkflowStepFieldValues=DF,i.initializeWorkflowStepFieldValuesAttachments=_F,i.initializeWorkflowStepFields=hP,i.initializeWorkflowStepFieldsAttachments=xF,i.initializeWorkflowStepReviewRequests=jP,i.initializeWorkflowStepReviewers=gP,i.initializeWorkflowStepReviews=QP,i.initializeWorkflowSteps=og,i.initializeWorkflowTypes=Fg,i.initializeWorkflows=aI,i.isToday=bb,i.issueAssociationReducer=cy,i.issueAssociationSlice=nn,i.issueAttachmentReducer=wy,i.issueAttachmentSlice=an,i.issueCommentAttachmentReducer=Vy,i.issueCommentAttachmentSlice=ln,i.issueCommentReducer=Gy,i.issueCommentSlice=un,i.issueReducer=aS,i.issueSlice=pn,i.issueTypeAttachmentReducer=wS,i.issueTypeAttachmentSlice=yn,i.issueTypeFieldValuesAttachmentReducer=TA,i.issueTypeFieldValuesAttachmentSlice=In,i.issueTypeFieldValuesReducer=KS,i.issueTypeFieldValuesSlice=Tn,i.issueTypeFieldsAttachmentReducer=VS,i.issueTypeFieldsAttachmentSlice=An,i.issueTypeFieldsReducer=rA,i.issueTypeFieldsSlice=On,i.issueTypeIdentifierReducer=WA,i.issueTypeIdentifierSlice=bn,i.issueTypeIdentifierValueReducer=YA,i.issueTypeIdentifierValueSlice=Rn,i.issueTypeReducer=dw,i.issueTypeSlice=Mn,i.issueTypeStatusReducer=Ow,i.issueTypeStatusSlice=vn,i.issueTypeStatusSortFn=Pc,i.issueUpdateReducer=vw,i.issueUpdateSlice=Wn,i.logOnlyOnce=Wb,i.markAsDeleted=OT,i.markForDeletion=lR,i.memoize=As,i.organizationAccessReducer=xw,i.organizationAccessSlice=Hn,i.organizationReducer=ST,i.organizationSlice=Gn,i.outboxReducer=FT,i.outboxSlice=Kn,i.overmapEnhancer=JR,i.overmapReducer=UR,i.overmapReducers=jg,i.performRequest=sc,i.performRequestFromAction=Zg,i.projectAccessReducer=WT,i.projectAccessSlice=Yn,i.projectAttachmentReducer=JT,i.projectAttachmentSlice=Jn,i.projectFileReducer=mO,i.projectFileSlice=Xn,i.projectReducer=gO,i.projectSlice=xn,i.rehydratedReducer=MO,i.rehydratedSlice=ea,i.restructureSelectorWithArgs=A,i.runMiddleware=rb,i.saveActiveProjectFileBounds=lO,i.selectAccessToken=M_,i.selectAccessesByUserOfProject=uR,i.selectAccessibleProjects=yR,i.selectActiveOrganizationAccess=aR,i.selectActiveProjectFileId=mR,i.selectAllDocumentAttachments=_i,i.selectAssetAttachmentById=Uc,i.selectAssetAttachmentMapping=$c,i.selectAssetAttachments=_s,i.selectAssetAttachmentsByIds=Lc,i.selectAssetById=no,i.selectAssetProcedureById=Ad,i.selectAssetProcedureStepById=Hl,i.selectAssetProcedureStepFieldValues=Pt,i.selectAssetProcedureStepFieldValuesAttachmentById=yl,i.selectAssetProcedureStepFieldValuesAttachments=Js,i.selectAssetProcedureStepFieldValuesAttachmentsByIds=Sl,i.selectAssetProcedureStepFieldValuesAttachmentsMapping=fl,i.selectAssetProcedureStepFieldValuesById=vl,i.selectAssetProcedureStepFieldValuesByIds=El,i.selectAssetProcedureStepFieldValuesMapping=kl,i.selectAssetProcedureStepFieldValuesOfAsset=l_,i.selectAssetProcedureStepFieldValuesOfAssetProcedure=o_,i.selectAssetProcedureStepFieldValuesOfAssetProcedureStep=u_,i.selectAssetProcedureStepFields=jt,i.selectAssetProcedureStepFieldsAttachmentById=Hd,i.selectAssetProcedureStepFieldsAttachments=Ns,i.selectAssetProcedureStepFieldsAttachmentsByIds=Gd,i.selectAssetProcedureStepFieldsAttachmentsMapping=Nd,i.selectAssetProcedureStepFieldsById=nl,i.selectAssetProcedureStepFieldsByIds=al,i.selectAssetProcedureStepFieldsMapping=Gs,i.selectAssetProcedureStepFieldsOfAssetProcedureStep=c_,i.selectAssetProcedureStepMapping=Ct,i.selectAssetProcedureSteps=xs,i.selectAssetProcedureStepsByIds=Gl,i.selectAssetProcedureStepsMappingOfAssetProcedureType=h_,i.selectAssetProcedureStepsOfAssetProcedureType=p_,i.selectAssetProcedureTypeAttachmentById=nr,i.selectAssetProcedureTypeAttachmentMapping=ir,i.selectAssetProcedureTypeAttachments=Ms,i.selectAssetProcedureTypeAttachmentsByIds=ar,i.selectAssetProcedureTypeById=Ed,i.selectAssetProcedureTypeFieldValues=zt,i.selectAssetProcedureTypeFieldValuesAttachmentById=Nr,i.selectAssetProcedureTypeFieldValuesAttachments=zs,i.selectAssetProcedureTypeFieldValuesAttachmentsByIds=Hr,i.selectAssetProcedureTypeFieldValuesAttachmentsMapping=Lr,i.selectAssetProcedureTypeFieldValuesById=ad,i.selectAssetProcedureTypeFieldValuesByIds=cd,i.selectAssetProcedureTypeFieldValuesMapping=nd,i.selectAssetProcedureTypeFieldValuesOfAsset=t_,i.selectAssetProcedureTypeFields=Bt,i.selectAssetProcedureTypeFieldsAttachmentById=Ar,i.selectAssetProcedureTypeFieldsAttachments=vs,i.selectAssetProcedureTypeFieldsAttachmentsByIds=wr,i.selectAssetProcedureTypeFieldsAttachmentsMapping=Sr,i.selectAssetProcedureTypeFieldsById=Er,i.selectAssetProcedureTypeFieldsByIds=Vr,i.selectAssetProcedureTypeFieldsMapping=vr,i.selectAssetProcedureTypeFieldsOfAssetProcedureType=xb,i.selectAssetProcedureTypes=Us,i.selectAssetProcedureTypesByIds=Vd,i.selectAssetProcedureTypesMapping=vd,i.selectAssetProcedureTypesOfOrganization=n_,i.selectAssetProcedures=qt,i.selectAssetProceduresByIds=wd,i.selectAssetProceduresMapping=yd,i.selectAssetProceduresOfAssetProcedureType=Sd,i.selectAssetProceduresOfAssetType=i_,i.selectAssetStageById=Wo,i.selectAssetStageCompletionById=Oo,i.selectAssetStageCompletionMapping=wo,i.selectAssetStageCompletions=To,i.selectAssetStageCompletionsByIds=Io,i.selectAssetStages=ci,i.selectAssetStagesByIds=Bo,i.selectAssetStagesMappingOfAssetProcedureType=f_,i.selectAssetStagesOfAssetProcedureType=y_,i.selectAssetTypeAttachmentById=Ho,i.selectAssetTypeAttachmentMapping=No,i.selectAssetTypeAttachments=oi,i.selectAssetTypeAttachmentsByIds=Go,i.selectAssetTypeById=Bh,i.selectAssetTypeFieldValues=$t,i.selectAssetTypeFieldValuesAttachmentById=Eu,i.selectAssetTypeFieldValuesAttachments=Si,i.selectAssetTypeFieldValuesAttachmentsByIds=Vu,i.selectAssetTypeFieldValuesAttachmentsMapping=vu,i.selectAssetTypeFieldValuesById=Ku,i.selectAssetTypeFieldValuesByIds=Yu,i.selectAssetTypeFieldValuesMapping=Gu,i.selectAssetTypeFieldValuesOfAsset=T_,i.selectAssetTypeFields=gt,i.selectAssetTypeFieldsAttachmentById=cu,i.selectAssetTypeFieldsAttachments=hi,i.selectAssetTypeFieldsAttachmentsByIds=ru,i.selectAssetTypeFieldsAttachmentsMapping=au,i.selectAssetTypeFieldsById=Tu,i.selectAssetTypeFieldsByIds=Ou,i.selectAssetTypeFieldsMapping=wu,i.selectAssetTypeFieldsOfAssetType=A_,i.selectAssetTypeIdentifierById=rh,i.selectAssetTypeIdentifierMapping=ch,i.selectAssetTypeIdentifierValueById=Oh,i.selectAssetTypeIdentifierValueMapping=Th,i.selectAssetTypeIdentifierValues=Ut,i.selectAssetTypeIdentifierValuesByIds=Ih,i.selectAssetTypeIdentifierValuesOfAsset=F_,i.selectAssetTypeIdentifierValuesOfIdentifier=P_,i.selectAssetTypeIdentifiers=Ti,i.selectAssetTypeIdentifiersByIds=dh,i.selectAssetTypeIdentifiersOfAssetType=I_,i.selectAssetTypeStatusById=Zh,i.selectAssetTypeStatusMapping=Yh,i.selectAssetTypeStatuses=gi,i.selectAssetTypeStatusesByIds=Jh,i.selectAssetTypeStatusesOfAssetType=b_,i.selectAssetTypeValuesOfAssetType=O_,i.selectAssetTypes=Fi,i.selectAssetTypesByIds=zh,i.selectAssetTypesMapping=Wh,i.selectAssetTypesOfOrganization=g_,i.selectAssets=Dt,i.selectAssetsByIds=ao,i.selectAssetsMapping=so,i.selectAssetsOfAssetType=io,i.selectAssetsOfProject=m_,i.selectAttachmentsOfAsset=Nc,i.selectAttachmentsOfAssetProcedureStepFieldValues=Al,i.selectAttachmentsOfAssetProcedureStepFields=a_,i.selectAttachmentsOfAssetProcedureType=Qb,i.selectAttachmentsOfAssetProcedureTypeFieldValues=Gr,i.selectAttachmentsOfAssetProcedureTypeFields=Xb,i.selectAttachmentsOfAssetType=Ko,i.selectAttachmentsOfAssetTypeFieldValues=Wu,i.selectAttachmentsOfAssetTypeFields=S_,i.selectAttachmentsOfDocument=v_,i.selectAttachmentsOfFormRevision=C_,i.selectAttachmentsOfFormSubmission=Sf,i.selectAttachmentsOfIssue=yy,i.selectAttachmentsOfIssueComment=L_,i.selectAttachmentsOfIssueType=G_,i.selectAttachmentsOfIssueTypeFieldValues=wA,i.selectAttachmentsOfIssueTypeFields=K_,i.selectAttachmentsOfProject=pR,i.selectAttachmentsOfWorkflowStepComment=ha,i.selectAttachmentsOfWorkflowStepFieldValues=qF,i.selectAttachmentsOfWorkflowStepFields=rP,i.selectCommentsOfIssue=N_,i.selectCommentsOfWorkflow=xI,i.selectCommentsOfWorkflowStep=_R,i.selectConversation=Jb,i.selectConversationMapping=Fs,i.selectConversations=Zb,i.selectCurrentUser=$w,i.selectDeletedRequests=rR,i.selectDescendantsOfAssetProcedureStep=Kl,i.selectDescendantsOfDocument=Rp,i.selectDocumentAttachmentById=hp,i.selectDocumentAttachmentMapping=up,i.selectDocumentAttachmentsByIds=pp,i.selectDocumentById=bp,i.selectDocuments=Nt,i.selectDocumentsByIds=_p,i.selectDocumentsMapping=Mi,i.selectEmailDomainById=Dp,i.selectEmailDomains=vi,i.selectEmailDomainsAsMapping=Cp,i.selectEmailDomainsByIds=$p,i.selectEmailDomainsOfOrganization=W_,i.selectFieldValuesOfAssetProcedure=s_,i.selectFormById=af,i.selectFormIdentifierById=am,i.selectFormIdentifierMapping=nm,i.selectFormIdentifierValueById=wm,i.selectFormIdentifierValueMapping=Am,i.selectFormIdentifierValues=Ht,i.selectFormIdentifierValuesByIds=Tm,i.selectFormIdentifierValuesOfFormSubmission=q_,i.selectFormIdentifierValuesOfIdentifier=j_,i.selectFormIdentifiers=Wi,i.selectFormIdentifiersByIds=cm,i.selectFormIdentifiersOfForm=z_,i.selectFormMapping=nf,i.selectFormRevisionAttachmentById=Vm,i.selectFormRevisionAttachments=Em,i.selectFormRevisionAttachmentsByIds=Wm,i.selectFormRevisionAttachmentsMapping=Gt,i.selectFormRevisionById=Um,i.selectFormRevisionMapping=Ui,i.selectFormRevisions=Kt,i.selectFormRevisionsByIds=Lm,i.selectFormRevisionsOfForm=Nm,i.selectFormSubmissionAttachemntsByIds=Ji,i.selectFormSubmissionAttachmentById=ff,i.selectFormSubmissionAttachments=Zi,i.selectFormSubmissionAttachmentsByIds=yf,i.selectFormSubmissionAttachmentsMapping=Yi,i.selectFormSubmissionById=Rf,i.selectFormSubmissions=_f,i.selectFormSubmissionsByIds=Mf,i.selectFormSubmissionsMapping=en,i.selectFormSubmissionsOfForm=kf,i.selectForms=Ni,i.selectFormsByIds=cf,i.selectFormsOfOrganization=$_,i.selectGeoImageById=Lf,i.selectGeoImageMapping=Uf,i.selectGeoImages=sn,i.selectGeoImagesByIds=Nf,i.selectGeoImagesOfProject=U_,i.selectIsImportingProjectFile=fR,i.selectIsLoggedIn=k_,i.selectIssueAssociationById=ty,i.selectIssueAssociationMapping=bt,i.selectIssueAssociations=ey,i.selectIssueAssociationsByIds=sy,i.selectIssueAssociationsOfAsset=ay,i.selectIssueAssociationsOfIssue=ny,i.selectIssueAssociationsToIssue=iy,i.selectIssueAttachmentById=Sy,i.selectIssueAttachmentMapping=fy,i.selectIssueAttachments=dn,i.selectIssueAttachmentsByIds=Ay,i.selectIssueById=sS,i.selectIssueCommentAttachmentById=vy,i.selectIssueCommentAttachmentMapping=ky,i.selectIssueCommentAttachments=on,i.selectIssueCommentAttachmentsByIds=Ey,i.selectIssueCommentById=Ny,i.selectIssueCommentMapping=hn,i.selectIssueCommentsByIds=Hy,i.selectIssueMapping=tS,i.selectIssueTypeAttachmentById=SS,i.selectIssueTypeAttachmentMapping=yS,i.selectIssueTypeAttachments=Sn,i.selectIssueTypeAttachmentsByIds=AS,i.selectIssueTypeById=cw,i.selectIssueTypeFieldValues=Qt,i.selectIssueTypeFieldValuesAttachmentById=SA,i.selectIssueTypeFieldValuesAttachments=gn,i.selectIssueTypeFieldValuesAttachmentsByIds=AA,i.selectIssueTypeFieldValuesAttachmentsMapping=yA,i.selectIssueTypeFieldValuesById=HS,i.selectIssueTypeFieldValuesByIds=GS,i.selectIssueTypeFieldValuesMapping=NS,i.selectIssueTypeFieldValuesOfIssue=Y_,i.selectIssueTypeFields=_t,i.selectIssueTypeFieldsAttachmentById=vS,i.selectIssueTypeFieldsAttachments=wn,i.selectIssueTypeFieldsAttachmentsByIds=ES,i.selectIssueTypeFieldsAttachmentsMapping=kS,i.selectIssueTypeFieldsById=aA,i.selectIssueTypeFieldsByIds=cA,i.selectIssueTypeFieldsMapping=nA,i.selectIssueTypeFieldsOfIssueType=Z_,i.selectIssueTypeIdentifierById=EA,i.selectIssueTypeIdentifierMapping=vA,i.selectIssueTypeIdentifierValueById=GA,i.selectIssueTypeIdentifierValueMapping=HA,i.selectIssueTypeIdentifierValues=Xt,i.selectIssueTypeIdentifierValuesByIds=KA,i.selectIssueTypeIdentifierValuesOfIdentifier=eR,i.selectIssueTypeIdentifierValuesOfIssue=x_,i.selectIssueTypeIdentifiers=_n,i.selectIssueTypeIdentifiersByIds=VA,i.selectIssueTypeIdentifiersOfIssueType=X_,i.selectIssueTypeMapping=aw,i.selectIssueTypeStatusById=Vn,i.selectIssueTypeStatusMapping=ww,i.selectIssueTypeStatuses=En,i.selectIssueTypeStatusesByIds=Tw,i.selectIssueTypeStatusesOfIssueType=sR,i.selectIssueTypeValuesOfIssueType=Q_,i.selectIssueTypes=kn,i.selectIssueTypesByIds=rw,i.selectIssueTypesOfOrganization=tR,i.selectIssueUpdateById=Rw,i.selectIssueUpdateMapping=Cn,i.selectIssueUpdates=Dn,i.selectIssueUpdatesByIds=Mw,i.selectIssueUpdatesOfIssue=kw,i.selectIssues=Jt,i.selectIssuesByIds=iS,i.selectIssuesOfIssueType=nS,i.selectIssuesOfProject=H_,i.selectLatestAssetProcedureStepFieldsOfAssetProcedureStep=r_,i.selectLatestAssetProcedureTypeFieldsOfAssetProcedureType=e_,i.selectLatestAssetTypeFieldsOfAssetType=w_,i.selectLatestFieldsByAssetProcedureStep=d_,i.selectLatestFieldsByWorkflowStep=WR,i.selectLatestFormRevisionOfForm=D_,i.selectLatestIssueTypeFieldsOfIssueType=J_,i.selectLatestRetryTime=dR,i.selectLatestWorkflowStepFieldsOfWorkflowStep=VR,i.selectMembershipsByUserOfTeam=OR,i.selectOrganizationAccessById=eT,i.selectOrganizationAccessMapping=ts,i.selectOrganizationAccessUserMapping=sT,i.selectOrganizationAccessesByIds=tT,i.selectOrganizationById=fT,i.selectOrganizationDocuments=V_,i.selectOrganizations=mT,i.selectOrganizationsByIds=yT,i.selectOrganizationsMapping=pT,i.selectProjectAccessById=BT,i.selectProjectAccessMapping=Zn,i.selectProjectAccesses=Rt,i.selectProjectAccessesByIds=zT,i.selectProjectAccessesOfProject=oR,i.selectProjectAttachmentById=YT,i.selectProjectAttachmentMapping=KT,i.selectProjectAttachments=Qn,i.selectProjectAttachmentsByIds=ZT,i.selectProjectById=_O,i.selectProjectDocuments=E_,i.selectProjectFileById=hO,i.selectProjectFileMapping=oO,i.selectProjectFiles=uO,i.selectProjectFilesByIds=pO,i.selectProjectMapping=bO,i.selectProjects=ss,i.selectProjectsByIds=RO,i.selectProjectsOfOrganization=SR,i.selectRehydrated=TR,i.selectStageMapping=ai,i.selectTeamById=tI,i.selectTeamMembershipById=UO,i.selectTeamMemberships=is,i.selectTeamMembershipsByIds=LO,i.selectTeamMembershipsMapping=$O,i.selectTeams=ia,i.selectTeamsByIds=sI,i.selectTeamsMapping=eI,i.selectTeamsOfOrganization=FR,i.selectUploadUrl=Gp,i.selectUserById=es,i.selectUsers=xt,i.selectUsersByIds=Uw,i.selectUsersMapping=Nn,i.selectUsersOfOrganization=cR,i.selectUsersOfProject=hR,i.selectUsersOfTeam=IR,i.selectWorkflowById=pI,i.selectWorkflowMapping=hI,i.selectWorkflowStepAssigneeById=bI,i.selectWorkflowStepAssigneeMapping=gI,i.selectWorkflowStepAssignees=Mt,i.selectWorkflowStepAssigneesByIds=_I,i.selectWorkflowStepAssigneesOfUser=bR,i.selectWorkflowStepAssigneesOfWorkflow=RI,i.selectWorkflowStepAssigneesOfWorkflowStep=gR,i.selectWorkflowStepById=wg,i.selectWorkflowStepCommentAttachmentById=CI,i.selectWorkflowStepCommentAttachmentMapping=jI,i.selectWorkflowStepCommentAttachments=ua,i.selectWorkflowStepCommentAttachmentsByIds=DI,i.selectWorkflowStepCommentById=QI,i.selectWorkflowStepCommentMapping=JI,i.selectWorkflowStepComments=rs,i.selectWorkflowStepCommentsByIds=XI,i.selectWorkflowStepCompletionById=oF,i.selectWorkflowStepCompletionMapping=lF,i.selectWorkflowStepCompletions=ds,i.selectWorkflowStepCompletionsByIds=uF,i.selectWorkflowStepCompletionsOfWorkflow=hF,i.selectWorkflowStepCompletionsOfWorkflowStep=RR,i.selectWorkflowStepEventById=IF,i.selectWorkflowStepEventMapping=Ia,i.selectWorkflowStepEvents=ls,i.selectWorkflowStepEventsByIds=FF,i.selectWorkflowStepEventsOfWorkflow=PF,i.selectWorkflowStepEventsOfWorkflowStep=MR,i.selectWorkflowStepFieldValues=kt,i.selectWorkflowStepFieldValuesAttachmentById=BF,i.selectWorkflowStepFieldValuesAttachments=ba,i.selectWorkflowStepFieldValuesAttachmentsByIds=zF,i.selectWorkflowStepFieldValuesAttachmentsMapping=WF,i.selectWorkflowStepFieldValuesById=ZF,i.selectWorkflowStepFieldValuesByIds=JF,i.selectWorkflowStepFieldValuesMapping=KF,i.selectWorkflowStepFieldValuesOfFieldsRevision=vR,i.selectWorkflowStepFieldValuesOfWorkflow=YF,i.selectWorkflowStepFieldValuesOfWorkflowStep=kR,i.selectWorkflowStepFields=os,i.selectWorkflowStepFieldsAttachmentById=dP,i.selectWorkflowStepFieldsAttachments=Va,i.selectWorkflowStepFieldsAttachmentsByIds=lP,i.selectWorkflowStepFieldsAttachmentsMapping=cP,i.selectWorkflowStepFieldsById=OP,i.selectWorkflowStepFieldsByIds=IP,i.selectWorkflowStepFieldsMapping=Ba,i.selectWorkflowStepFieldsOfWorkflowStep=ER,i.selectWorkflowStepMapping=Ag,i.selectWorkflowStepReviewById=ag,i.selectWorkflowStepReviewMapping=ng,i.selectWorkflowStepReviewRequestById=GP,i.selectWorkflowStepReviewRequestMapping=HP,i.selectWorkflowStepReviewRequests=us,i.selectWorkflowStepReviewRequestsByIds=KP,i.selectWorkflowStepReviewRequestsOfWorkflow=YP,i.selectWorkflowStepReviewRequestsOfWorkflowStep=qR,i.selectWorkflowStepReviewerById=VP,i.selectWorkflowStepReviewerMapping=EP,i.selectWorkflowStepReviewers=vt,i.selectWorkflowStepReviewersByIds=WP,i.selectWorkflowStepReviewersOfUser=zR,i.selectWorkflowStepReviewersOfWorkflow=BP,i.selectWorkflowStepReviewersOfWorkflowStep=BR,i.selectWorkflowStepReviews=hs,i.selectWorkflowStepReviewsByIds=cg,i.selectWorkflowStepReviewsOfWorkflow=rg,i.selectWorkflowStepReviewsOfWorkflowStep=jR,i.selectWorkflowSteps=Ya,i.selectWorkflowStepsByIds=Og,i.selectWorkflowStepsOfWorkflowType=Tg,i.selectWorkflowTypeById=Vg,i.selectWorkflowTypeMapping=Eg,i.selectWorkflowTypes=Ja,i.selectWorkflowTypesByIds=Wg,i.selectWorkflowTypesOfOrganization=CR,i.selectWorkflows=ns,i.selectWorkflowsByIds=mI,i.selectWorkflowsOfProject=PR,i.selectWorkflowsOfWorkflowType=fI,i.setActiveProjectFileId=dO,i.setAsset=eo,i.setAssetAttachment=zc,i.setAssetAttachments=qc,i.setAssetProcedure=pd,i.setAssetProcedureStep=zl,i.setAssetProcedureStepFieldValues=Pl,i.setAssetProcedureStepFieldValuesAttachment=ol,i.setAssetProcedureStepFieldValuesAttachments=ul,i.setAssetProcedureStepFieldValuesMany=gl,i.setAssetProcedureStepFields=Xd,i.setAssetProcedureStepFieldsAttachment=jd,i.setAssetProcedureStepFieldsAttachments=Cd,i.setAssetProcedureStepFieldsMany=xd,i.setAssetProcedureSteps=ql,i.setAssetProcedureType=Rd,i.setAssetProcedureTypeAttachment=Jc,i.setAssetProcedureTypeAttachments=Qc,i.setAssetProcedureTypeFieldValues=Qr,i.setAssetProcedureTypeFieldValuesAttachment=qr,i.setAssetProcedureTypeFieldValuesAttachments=jr,i.setAssetProcedureTypeFieldValuesMany=Xr,i.setAssetProcedureTypeFields=Pr,i.setAssetProcedureTypeFieldsAttachment=or,i.setAssetProcedureTypeFieldsAttachments=ur,i.setAssetProcedureTypeFieldsMany=gr,i.setAssetProcedureTypes=Md,i.setAssetProcedures=md,i.setAssetStage=go,i.setAssetStageCompletion=ho,i.setAssetStageCompletions=po,i.setAssetStages=bo,i.setAssetType=bh,i.setAssetTypeAttachment=Co,i.setAssetTypeAttachments=Do,i.setAssetTypeFieldValues=Du,i.setAssetTypeFieldValuesAttachment=bu,i.setAssetTypeFieldValuesAttachments=_u,i.setAssetTypeFieldValuesMany=$u,i.setAssetTypeFields=pu,i.setAssetTypeFieldsAttachment=xo,i.setAssetTypeFieldsAttachments=eu,i.setAssetTypeFieldsMany=mu,i.setAssetTypeIdentifier=eh,i.setAssetTypeIdentifierValue=mh,i.setAssetTypeIdentifierValues=fh,i.setAssetTypeIdentifiers=th,i.setAssetTypeStatus=Uh,i.setAssetTypeStatuses=Lh,i.setAssetTypes=_h,i.setAssets=to,i.setClientSDK=sb,i.setClientStore=eb,i.setConversation=kc,i.setConversations=Hb,i.setCurrentUser=iR,i.setDocument=wp,i.setDocumentAttachment=ap,i.setDocumentAttachments=cp,i.setDocuments=Tp,i.setEmailDomain=Vp,i.setEmailDomains=Wp,i.setForm=Jm,i.setFormIdentifier=Xp,i.setFormIdentifierValue=hm,i.setFormIdentifierValues=pm,i.setFormIdentifiers=xp,i.setFormRevision=jm,i.setFormRevisionAttachment=bm,i.setFormRevisionAttachments=_m,i.setFormRevisions=Cm,i.setFormSubmission=Of,i.setFormSubmissionAttachment=of,i.setFormSubmissionAttachments=uf,i.setFormSubmissions=If,i.setForms=Qm,i.setGeoImage=Wf,i.setGeoImages=Bf,i.setIsImportingProjectFile=rO,i.setIssue=Jy,i.setIssueAssociation=Zf,i.setIssueAssociations=Yf,i.setIssueAttachment=oy,i.setIssueAttachments=uy,i.setIssueComment=jy,i.setIssueCommentAttachment=Py,i.setIssueCommentAttachments=gy,i.setIssueComments=Cy,i.setIssueType=xA,i.setIssueTypeAttachment=oS,i.setIssueTypeAttachments=uS,i.setIssueTypeFieldValues=jS,i.setIssueTypeFieldValuesAttachment=uA,i.setIssueTypeFieldValuesAttachments=hA,i.setIssueTypeFieldValuesMany=CS,i.setIssueTypeFields=XS,i.setIssueTypeFieldsAttachment=PS,i.setIssueTypeFieldsAttachments=gS,i.setIssueTypeFieldsMany=xS,i.setIssueTypeIdentifier=gA,i.setIssueTypeIdentifierValue=CA,i.setIssueTypeIdentifierValues=DA,i.setIssueTypeIdentifiers=bA,i.setIssueTypeStatus=pw,i.setIssueTypeStatuses=mw,i.setIssueTypes=ew,i.setIssueUpdate=Pw,i.setIssueUpdates=gw,i.setIssues=Qy,i.setLoggedIn=xh,i.setOrganization=cT,i.setOrganizationAccess=Kw,i.setOrganizationAccesses=Yw,i.setOrganizations=aT,i.setProfilePicture=nR,i.setProject=AO,i.setProjectAccess=RT,i.setProjectAccesses=MT,i.setProjectAttachment=$T,i.setProjectAttachments=UT,i.setProjectFile=xT,i.setProjectFiles=eO,i.setProjects=SO,i.setRehydrated=wR,i.setTeam=YO,i.setTeamMembership=WO,i.setTeamMemberships=BO,i.setTeams=ZO,i.setTokens=__,i.setUploadUrl=Hp,i.setUser=Bw,i.setUsers=Ww,i.setWorkflow=rI,i.setWorkflowStep=hg,i.setWorkflowStepAssignee=TI,i.setWorkflowStepAssignees=OI,i.setWorkflowStepComment=HI,i.setWorkflowStepCommentAttachment=VI,i.setWorkflowStepCommentAttachments=WI,i.setWorkflowStepComments=GI,i.setWorkflowStepCompletion=nF,i.setWorkflowStepCompletions=aF,i.setWorkflowStepEvent=SF,i.setWorkflowStepEvents=AF,i.setWorkflowStepFieldValues=UF,i.setWorkflowStepFieldValuesAttachment=MF,i.setWorkflowStepFieldValuesAttachments=kF,i.setWorkflowStepFieldValuesMany=LF,i.setWorkflowStepFields=fP,i.setWorkflowStepFieldsAttachment=tP,i.setWorkflowStepFieldsAttachments=sP,i.setWorkflowStepFieldsMany=yP,i.setWorkflowStepReview=xP,i.setWorkflowStepReviewRequest=DP,i.setWorkflowStepReviewRequests=$P,i.setWorkflowStepReviewer=_P,i.setWorkflowStepReviewers=RP,i.setWorkflowStepReviews=eg,i.setWorkflowSteps=pg,i.setWorkflowType=bg,i.setWorkflowTypes=_g,i.setWorkflows=dI,i.shallowEqual=Ib,i.slugify=jb,i.spacesToDashesLower=qb,i.teamMembershipReducer=DO,i.teamMembershipSlice=ta,i.teamReducer=iI,i.teamSlice=sa,i.toFileNameSafeString=zb,i.toUuidArray=B,i.toUuidIdRecord=Bb,i.truncate=Cb,i.updateAsset=Ql,i.updateAssetAttachment=jc,i.updateAssetAttachments=Cc,i.updateAssetProcedure=od,i.updateAssetProcedureStep=Dl,i.updateAssetProcedureStepFieldValues=bl,i.updateAssetProcedureStepFieldValuesAttachment=hl,i.updateAssetProcedureStepFieldValuesAttachments=pl,i.updateAssetProcedureStepFieldValuesMany=_l,i.updateAssetProcedureStepFields=el,i.updateAssetProcedureStepFieldsAttachment=Dd,i.updateAssetProcedureStepFieldsAttachments=$d,i.updateAssetProcedureStepFieldsMany=tl,i.updateAssetProcedureSteps=$l,i.updateAssetProcedureType=Pd,i.updateAssetProcedureTypeAttachment=Xc,i.updateAssetProcedureTypeAttachments=xc,i.updateAssetProcedureTypeFieldValues=xr,i.updateAssetProcedureTypeFieldValuesAttachment=Cr,i.updateAssetProcedureTypeFieldValuesAttachments=Dr,i.updateAssetProcedureTypeFieldValuesMany=ed,i.updateAssetProcedureTypeFields=br,i.updateAssetProcedureTypeFieldsAttachment=hr,i.updateAssetProcedureTypeFieldsAttachments=pr,i.updateAssetProcedureTypeFieldsMany=_r,i.updateAssetProcedureTypes=gd,i.updateAssetProcedures=ud,i.updateAssetStage=Mo,i.updateAssetStageCompletion=mo,i.updateAssetStageCompletions=fo,i.updateAssetStages=ko,i.updateAssetType=kh,i.updateAssetTypeAttachment=$o,i.updateAssetTypeAttachments=Uo,i.updateAssetTypeFieldValues=Uu,i.updateAssetTypeFieldValuesAttachment=Ru,i.updateAssetTypeFieldValuesAttachments=Mu,i.updateAssetTypeFieldValuesMany=Lu,i.updateAssetTypeFields=fu,i.updateAssetTypeFieldsAttachment=tu,i.updateAssetTypeFieldsAttachments=su,i.updateAssetTypeFieldsMany=yu,i.updateAssetTypeIdentifier=sh,i.updateAssetTypeIdentifierValue=yh,i.updateAssetTypeIdentifierValues=Sh,i.updateAssetTypeIdentifiers=ih,i.updateAssetTypeStatus=Nh,i.updateAssetTypeStatuses=Hh,i.updateAssetTypes=vh,i.updateAssets=Xl,i.updateConversation=vc,i.updateConversations=Gb,i.updateDocument=Op,i.updateDocumentAttachment=rp,i.updateDocumentAttachments=dp,i.updateDocuments=Ip,i.updateEmailDomain=Bp,i.updateEmailDomains=zp,i.updateForm=Xm,i.updateFormIdentifier=em,i.updateFormIdentifierValue=mm,i.updateFormIdentifierValues=fm,i.updateFormIdentifiers=tm,i.updateFormRevision=Dm,i.updateFormRevisionAttachment=Rm,i.updateFormRevisionAttachments=Mm,i.updateFormRevisions=$m,i.updateFormSubmission=Pf,i.updateFormSubmissionAttachment=hf,i.updateFormSubmissionAttachments=pf,i.updateFormSubmissions=gf,i.updateForms=xm,i.updateGeoImage=jf,i.updateGeoImages=Cf,i.updateIssue=Xy,i.updateIssueAssociation=Jf,i.updateIssueAssociations=Qf,i.updateIssueAttachment=hy,i.updateIssueAttachments=py,i.updateIssueComment=Dy,i.updateIssueCommentAttachment=by,i.updateIssueCommentAttachments=_y,i.updateIssueComments=$y,i.updateIssueType=tw,i.updateIssueTypeAttachment=hS,i.updateIssueTypeAttachments=pS,i.updateIssueTypeFieldValues=DS,i.updateIssueTypeFieldValuesAttachment=pA,i.updateIssueTypeFieldValuesAttachments=mA,i.updateIssueTypeFieldValuesMany=$S,i.updateIssueTypeFields=eA,i.updateIssueTypeFieldsAttachment=bS,i.updateIssueTypeFieldsAttachments=_S,i.updateIssueTypeFieldsMany=tA,i.updateIssueTypeIdentifier=_A,i.updateIssueTypeIdentifierValue=$A,i.updateIssueTypeIdentifierValues=UA,i.updateIssueTypeIdentifiers=RA,i.updateIssueTypeStatus=fw,i.updateIssueTypeStatuses=yw,i.updateIssueTypes=sw,i.updateIssueUpdate=bw,i.updateIssueUpdates=_w,i.updateIssues=xy,i.updateOrganization=oT,i.updateOrganizationAccess=Zw,i.updateOrganizationAccesses=Jw,i.updateOrganizations=lT,i.updateProject=IO,i.updateProjectAccess=kT,i.updateProjectAccesses=vT,i.updateProjectAttachment=LT,i.updateProjectAttachments=NT,i.updateProjectFile=iO,i.updateProjectFiles=nO,i.updateProjects=OO,i.updateTeam=JO,i.updateTeamMembership=zO,i.updateTeamMemberships=qO,i.updateTeams=QO,i.updateUser=jw,i.updateUsers=qw,i.updateWorkflow=lI,i.updateWorkflowStep=mg,i.updateWorkflowStepAssignee=II,i.updateWorkflowStepAssignees=FI,i.updateWorkflowStepComment=KI,i.updateWorkflowStepCommentAttachment=BI,i.updateWorkflowStepCommentAttachments=zI,i.updateWorkflowStepComments=YI,i.updateWorkflowStepCompletion=cF,i.updateWorkflowStepCompletions=rF,i.updateWorkflowStepEvent=wF,i.updateWorkflowStepEvents=TF,i.updateWorkflowStepFieldValues=NF,i.updateWorkflowStepFieldValuesAttachment=vF,i.updateWorkflowStepFieldValuesAttachments=EF,i.updateWorkflowStepFieldValuesMany=HF,i.updateWorkflowStepFields=SP,i.updateWorkflowStepFieldsAttachment=iP,i.updateWorkflowStepFieldsAttachments=nP,i.updateWorkflowStepFieldsMany=AP,i.updateWorkflowStepReview=tg,i.updateWorkflowStepReviewRequest=UP,i.updateWorkflowStepReviewRequests=LP,i.updateWorkflowStepReviewer=MP,i.updateWorkflowStepReviewers=kP,i.updateWorkflowStepReviews=sg,i.updateWorkflowSteps=fg,i.updateWorkflowType=Rg,i.updateWorkflowTypes=Mg,i.updateWorkflows=oI,i.useSelectorBuilder=Ob,i.userReducer=Dw,i.userSlice=$n,i.uuidObj=_,i.uuidObjSortFn=Os,i.uuidSortFn=Wt,i.versioningReducer=qg,i.versioningSlice=zg,i.workflowReducer=yI,i.workflowSlice=na,i.workflowStepAssigneeReducer=MI,i.workflowStepAssigneeSlice=ra,i.workflowStepCommentAttachmentReducer=$I,i.workflowStepCommentAttachmentSlice=oa,i.workflowStepCommentReducer=eF,i.workflowStepCommentSlice=pa,i.workflowStepCompletionReducer=pF,i.workflowStepCompletionSlice=ya,i.workflowStepEventReducer=gF,i.workflowStepEventSlice=wa,i.workflowStepFieldValuesAttachmentReducer=jF,i.workflowStepFieldValuesAttachmentSlice=Fa,i.workflowStepFieldValuesReducer=QF,i.workflowStepFieldValuesSlice=_a,i.workflowStepFieldsAttachmentReducer=oP,i.workflowStepFieldsAttachmentSlice=ka,i.workflowStepFieldsReducer=FP,i.workflowStepFieldsSlice=Wa,i.workflowStepReducer=Sg,i.workflowStepReviewReducer=dg,i.workflowStepReviewRequestReducer=ZP,i.workflowStepReviewRequestSlice=Ca,i.workflowStepReviewSlice=Ua,i.workflowStepReviewerReducer=zP,i.workflowStepReviewerSlice=za,i.workflowStepSlice=Ha,i.workflowTypeReducer=Bg,i.workflowTypeSlice=Za,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});