@overmap-ai/core 1.0.78-project-file-service-fix.0 → 1.0.78-required-model-names.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/overmap-core.js +3265 -3264
- package/dist/overmap-core.umd.cjs +7 -7
- package/dist/sdk/base.d.ts +1 -1
- package/dist/sdk/constants.d.ts +3 -4
- package/dist/sdk/index.d.ts +3 -1
- package/dist/sdk/middleware/OfflineAnalyticsMiddleware.d.ts +6 -0
- package/dist/sdk/middleware/OfflineMiddleware.d.ts +13 -0
- package/dist/sdk/middleware/RateLimitingMiddleware.d.ts +6 -0
- package/dist/sdk/middleware/constants.d.ts +1 -0
- package/dist/sdk/middleware/index.d.ts +5 -0
- package/dist/sdk/middleware/utils.d.ts +2 -0
- package/dist/sdk/outbox/globals.d.ts +2 -0
- package/dist/sdk/{classes → outbox}/index.d.ts +1 -0
- package/dist/sdk/services/AgentService.d.ts +1 -1
- package/dist/sdk/services/AssetAttachmentService.d.ts +1 -1
- package/dist/sdk/services/AssetProcedureAttachmentService.d.ts +1 -1
- package/dist/sdk/services/AssetProcedureFieldValuesAttachmentService.d.ts +1 -1
- package/dist/sdk/services/AssetProcedureFieldValuesService.d.ts +1 -1
- package/dist/sdk/services/AssetProcedureFieldsAttachmentService.d.ts +1 -1
- package/dist/sdk/services/AssetProcedureFieldsService.d.ts +1 -1
- package/dist/sdk/services/AssetProcedureInstanceService.d.ts +1 -1
- package/dist/sdk/services/AssetProcedureService.d.ts +1 -1
- package/dist/sdk/services/AssetProcedureStepFieldValuesAttachmentService.d.ts +1 -1
- package/dist/sdk/services/AssetProcedureStepFieldValuesService.d.ts +1 -1
- package/dist/sdk/services/AssetProcedureStepFieldsAttachmentService.d.ts +1 -1
- package/dist/sdk/services/AssetProcedureStepFieldsService.d.ts +1 -1
- package/dist/sdk/services/AssetProcedureStepService.d.ts +1 -1
- package/dist/sdk/services/AssetService.d.ts +1 -1
- package/dist/sdk/services/AssetStageCompletionService.d.ts +1 -1
- package/dist/sdk/services/AssetStageService.d.ts +1 -1
- package/dist/sdk/services/AssetTypeAttachmentService.d.ts +1 -1
- package/dist/sdk/services/AssetTypeFieldValuesAttachmentService.d.ts +1 -1
- package/dist/sdk/services/AssetTypeFieldValuesService.d.ts +1 -1
- package/dist/sdk/services/AssetTypeFieldsAttachmentService.d.ts +1 -1
- package/dist/sdk/services/AssetTypeFieldsService.d.ts +1 -1
- package/dist/sdk/services/AssetTypeIdentifierService.d.ts +1 -1
- package/dist/sdk/services/AssetTypeIdentifierValueService.d.ts +1 -1
- package/dist/sdk/services/AssetTypeService.d.ts +1 -1
- package/dist/sdk/services/CategoryService.d.ts +1 -1
- package/dist/sdk/services/DocumentAttachmentService.d.ts +1 -1
- package/dist/sdk/services/DocumentService.d.ts +1 -1
- package/dist/sdk/services/EmailDomainsService.d.ts +1 -1
- package/dist/sdk/services/FileService.d.ts +1 -1
- package/dist/sdk/services/FormIdentifierService.d.ts +1 -1
- package/dist/sdk/services/FormIdentifierValueService.d.ts +3 -3
- package/dist/sdk/services/FormRevisionAttachmentService.d.ts +1 -1
- package/dist/sdk/services/FormRevisionService.d.ts +1 -1
- package/dist/sdk/services/FormService.d.ts +1 -1
- package/dist/sdk/services/FormSubmissionAttachmentService.d.ts +3 -3
- package/dist/sdk/services/FormSubmissionService.d.ts +3 -3
- package/dist/sdk/services/GeoImageService.d.ts +1 -1
- package/dist/sdk/services/IssueAssociationService.d.ts +1 -1
- package/dist/sdk/services/IssueAttachmentService.d.ts +1 -1
- package/dist/sdk/services/IssueCommentAttachmentService.d.ts +1 -1
- package/dist/sdk/services/IssueCommentService.d.ts +1 -1
- package/dist/sdk/services/IssueService.d.ts +1 -1
- package/dist/sdk/services/IssueTypeAttachmentService.d.ts +1 -1
- package/dist/sdk/services/IssueTypeFieldValuesAttachmentService.d.ts +1 -1
- package/dist/sdk/services/IssueTypeFieldValuesService.d.ts +1 -1
- package/dist/sdk/services/IssueTypeFieldsAttachmentService.d.ts +1 -1
- package/dist/sdk/services/IssueTypeFieldsService.d.ts +1 -1
- package/dist/sdk/services/IssueTypeIdentifierService.d.ts +1 -1
- package/dist/sdk/services/IssueTypeIdentifierValueService.d.ts +1 -1
- package/dist/sdk/services/IssueTypeService.d.ts +1 -1
- package/dist/sdk/services/IssueUpdateService.d.ts +1 -1
- package/dist/sdk/services/JWTAuthService.d.ts +1 -1
- package/dist/sdk/services/OrganizationAccessService.d.ts +1 -1
- package/dist/sdk/services/OrganizationService.d.ts +1 -1
- package/dist/sdk/services/ProjectAccessService.d.ts +1 -1
- package/dist/sdk/services/ProjectAttachmentService.d.ts +1 -1
- package/dist/sdk/services/ProjectFileService.d.ts +1 -1
- package/dist/sdk/services/ProjectService.d.ts +1 -1
- package/dist/sdk/services/TeamMembershipService.d.ts +1 -1
- package/dist/sdk/services/TeamService.d.ts +1 -1
- package/dist/sdk/services/UserService.d.ts +1 -1
- package/dist/sdk/typings.d.ts +1 -1
- package/dist/store/slices/agentsSlice.d.ts +1 -1
- package/dist/store/slices/assetAttachmentSlice.d.ts +1 -1
- package/dist/store/slices/assetProcedureAttachmentSlice.d.ts +1 -1
- package/dist/store/slices/assetProcedureFieldValuesAttachmentSlice.d.ts +1 -1
- package/dist/store/slices/assetProcedureFieldValuesSlice.d.ts +1 -1
- package/dist/store/slices/assetProcedureFieldsAttachmentSlice.d.ts +1 -1
- package/dist/store/slices/assetProcedureFieldsSlice.d.ts +1 -1
- package/dist/store/slices/assetProcedureInstanceSlice.d.ts +1 -1
- package/dist/store/slices/assetProcedureSlice.d.ts +1 -1
- package/dist/store/slices/assetProcedureStepFieldValuesAttachmentSlice.d.ts +1 -1
- package/dist/store/slices/assetProcedureStepFieldValuesSlice.d.ts +1 -1
- package/dist/store/slices/assetProcedureStepFieldsAttachmentSlice.d.ts +1 -1
- package/dist/store/slices/assetProcedureStepFieldsSlice.d.ts +1 -1
- package/dist/store/slices/assetProcedureStepSlice.d.ts +1 -1
- package/dist/store/slices/assetSlice.d.ts +1 -1
- package/dist/store/slices/assetStageCompletionSlice.d.ts +1 -1
- package/dist/store/slices/assetStageSlice.d.ts +1 -1
- package/dist/store/slices/assetTypeAttachmentSlice.d.ts +1 -1
- package/dist/store/slices/assetTypeFieldValuesAttachmentSlice.d.ts +1 -1
- package/dist/store/slices/assetTypeFieldValuesSlice.d.ts +1 -1
- package/dist/store/slices/assetTypeFieldsAttachmentSlice.d.ts +1 -1
- package/dist/store/slices/assetTypeFieldsSlice.d.ts +1 -1
- package/dist/store/slices/assetTypeIdentifierSlice.d.ts +1 -1
- package/dist/store/slices/assetTypeIdentifierValueSlice.d.ts +1 -1
- package/dist/store/slices/assetTypeSlice.d.ts +1 -1
- package/dist/store/slices/categorySlice.d.ts +1 -1
- package/dist/store/slices/documentAttachmentSlice.d.ts +1 -1
- package/dist/store/slices/emailDomainsSlice.d.ts +1 -1
- package/dist/store/slices/formIdentifierSlice.d.ts +1 -1
- package/dist/store/slices/formIdentifierValueSlice.d.ts +1 -1
- package/dist/store/slices/formRevisionAttachmentSlice.d.ts +1 -1
- package/dist/store/slices/formRevisionSlice.d.ts +1 -1
- package/dist/store/slices/formSlice.d.ts +1 -1
- package/dist/store/slices/formSubmissionAttachmentSlice.d.ts +1 -1
- package/dist/store/slices/formSubmissionSlice.d.ts +2 -4
- package/dist/store/slices/geoImageSlice.d.ts +1 -1
- package/dist/store/slices/issueAssociationSlice.d.ts +1 -1
- package/dist/store/slices/issueAttachmentSlice.d.ts +1 -1
- package/dist/store/slices/issueCommentAttachmentSlice.d.ts +1 -1
- package/dist/store/slices/issueCommentSlice.d.ts +1 -1
- package/dist/store/slices/issueSlice.d.ts +1 -1
- package/dist/store/slices/issueTypeAttachmentSlice.d.ts +1 -1
- package/dist/store/slices/issueTypeFieldValuesAttachmentSlice.d.ts +1 -1
- package/dist/store/slices/issueTypeFieldValuesSlice.d.ts +1 -1
- package/dist/store/slices/issueTypeFieldsAttachmentSlice.d.ts +1 -1
- package/dist/store/slices/issueTypeFieldsSlice.d.ts +1 -1
- package/dist/store/slices/issueTypeIdentifierSlice.d.ts +1 -1
- package/dist/store/slices/issueTypeIdentifierValueSlice.d.ts +1 -1
- package/dist/store/slices/issueTypeSlice.d.ts +1 -1
- package/dist/store/slices/issueUpdateSlice.d.ts +1 -1
- package/dist/store/slices/organizationAccessSlice.d.ts +1 -1
- package/dist/store/slices/organizationSlice.d.ts +1 -1
- package/dist/store/slices/projectAccessSlice.d.ts +1 -1
- package/dist/store/slices/projectAttachmentSlice.d.ts +1 -1
- package/dist/store/slices/projectFileSlice.d.ts +1 -1
- package/dist/store/slices/projectSlice.d.ts +1 -1
- package/dist/store/slices/teamMembershipSlice.d.ts +1 -1
- package/dist/store/slices/teamSlice.d.ts +1 -1
- package/dist/store/slices/userSlice.d.ts +1 -1
- package/dist/store/store.d.ts +1 -2
- package/dist/typings/models/assets.d.ts +8 -7
- package/dist/typings/models/base.d.ts +4 -1
- package/dist/typings/models/forms.d.ts +0 -3
- package/dist/typings/models/issues.d.ts +3 -3
- package/dist/typings/models/teams.d.ts +2 -2
- package/package.json +29 -45
- package/dist/typings/models/store.d.ts +0 -0
- /package/dist/sdk/{classes → outbox}/OutboxCoordinator.d.ts +0 -0
- /package/dist/sdk/{classes → outbox}/OutboxCoordinator.spec.d.ts +0 -0
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
(function(s,U){typeof exports=="object"&&typeof module<"u"?U(exports,require("@redux-offline/redux-offline/lib/types"),require("@reduxjs/toolkit"),require("superagent"),require("uuid"),require("file-saver"),require("react"),require("@redux-offline/redux-offline"),require("@redux-offline/redux-offline/lib/defaults"),require("buffer"),require("localforage"),require("redux-persist-migrate"),require("@overmap-ai/forms"),require("idb"),require("jwt-decode"),require("dependency-graph"),require("@tiptap/core")):typeof define=="function"&&define.amd?define(["exports","@redux-offline/redux-offline/lib/types","@reduxjs/toolkit","superagent","uuid","file-saver","react","@redux-offline/redux-offline","@redux-offline/redux-offline/lib/defaults","buffer","localforage","redux-persist-migrate","@overmap-ai/forms","idb","jwt-decode","dependency-graph","@tiptap/core"],U):(s=typeof globalThis<"u"?globalThis:s||self,U(s["overmap-core"]={},null,s.toolkit,s.request,s.uuid,s.fileSaver,s.react,s.reduxOffline,s.offlineConfig,null,s.localforage,s.createMigration,null,s.idb,s.jwtDecode,s.dependencyGraph))})(this,function(s,U,d,Ze,Je,Mp,Ep,Vp,sc,RF,jp,qp,vF,zp,Up,Dp){"use strict";var OF=Object.defineProperty;var _F=(s,U,d)=>U in s?OF(s,U,{enumerable:!0,configurable:!0,writable:!0,value:d}):s[U]=d;var S=(s,U,d)=>_F(s,typeof U!="symbol"?U+"":U,d);var wp;const ic=Object.freeze([]),ac=Object.freeze({});var nc=(t=>(t[t.GUEST=0]="GUEST",t[t.BASIC=2]="BASIC",t[t.ADMIN=4]="ADMIN",t))(nc||{}),l=(t=>(t.GET="GET",t.POST="POST",t.PATCH="PATCH",t.PUT="PUT",t.DELETE="DELETE",t))(l||{}),cc=(t=>(t.Issue="issue",t.Asset="asset",t.AssetType="asset_type",t.Project="project",t.Document="document",t))(cc||{}),es=(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))(es||{}),ts=(t=>(t[t.BACKLOG=0]="BACKLOG",t[t.SELECTED=2]="SELECTED",t[t.DONE=4]="DONE",t))(ts||{}),V=(t=>(t.STATUS="status",t.PRIORITY="priority",t.CATEGORY="category",t.DESCRIPTION="description",t.TITLE="title",t.ASSIGNED_TO="assigned_to",t.DUE_DATE="due_date",t))(V||{});const Cp=ts.BACKLOG,kp=es.MEDIUM,rc=6e4;function P(t){return{addOne:(p,A)=>{const f=t(A.payload);p.instances[f]=A.payload},addMany:(p,A)=>{for(const f of A.payload){const T=t(f);p.instances[T]=f}},setOne:(p,A)=>{const f=t(A.payload);p.instances[f]=A.payload},setMany:(p,A)=>{for(const f of A.payload){const T=t(f);p.instances[T]=f}},updateOne:(p,A)=>{const f=t(A.payload);p.instances[f]=A.payload},updateMany:(p,A)=>{for(const f of A.payload){const T=t(f);p.instances[T]=f}},deleteOne:(p,A)=>{delete p.instances[A.payload]},deleteMany:(p,A)=>{for(const f of A.payload)delete p.instances[f]},initialize:(p,A)=>{p.instances={};const f=new Set;for(const T of A.payload){const F=t(T);f.add(F),p.instances[F]=T}f.size!==A.payload.length&&console.warn("duplicate ids detected when initializing model instances.")},getInitialState:p=>({...p,instances:{}})}}function Bp(){return{initializeSelection:(m,o)=>{m.selection=Array.from(new Set(o.payload))},selectOne:(m,o)=>{new Set(m.selection).has(o.payload)||m.selection.push(o.payload)},selectMany:(m,o)=>{const h=new Set(m.selection);for(const p of o.payload)h.has(p)||h.add(p);m.selection=Array.from(h)},unselectOne:(m,o)=>{const h=new Set(m.selection);h.has(o.payload)&&(h.delete(o.payload),m.selection=Array.from(h))},unselectMany:(m,o)=>{const h=new Set(m.selection);for(const p of o.payload)h.has(p)&&h.delete(p);m.selection=Array.from(h)},toggleOne:(m,o)=>{const h=new Set(m.selection);h.has(o.payload)?h.delete(o.payload):h.add(o.payload),m.selection=Array.from(h)},toggleMany:(m,o)=>{const h=new Set(m.selection);for(const p of o.payload)h.has(p)?h.delete(p):h.add(p);m.selection=Array.from(h)},getInitialState:m=>({...m,selection:[]})}}const tt="versioning",g=d.createAction("RESET"),M=d.createAction("RESET_PROJECT_STATE"),O=d.createAction("RESET_ORGANIZATION_STATE");wp=Symbol.toStringTag;class dc{constructor(){S(this,wp,"Promise");S(this,"_promise");S(this,"_resolve");S(this,"_reject");S(this,"_state","pending");this._resolve=null,this._reject=null,this._promise=new Promise((e,i)=>{this._resolve=e,this._reject=i})}get state(){return this._state}then(e,i){return this._promise.then(e,i)}catch(e){return this._promise.catch(e)}resolve(e){if(!this._resolve)throw new Error("No resolve callback");this._resolve(e),this._state="fulfilled"}reject(e){if(!this._reject)throw e;this._reject(e),this._state="rejected"}finally(e){throw new Error("`finally` not implemented")}}let ss=!1;["true","1"].includes("".toLowerCase())&&(ss=!0);function Gp(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;const i=Object.keys(t),a=Object.keys(e),n=i.length;if(n!==a.length)return!1;for(let c=0;c<n;c++){const r=i[c];if(!Object.prototype.hasOwnProperty.call(e,r)||t[r]!==e[r])return!1}return!0}function is(t){const e={};return function(){const i=Array.prototype.slice.call(arguments);return i in e?(ss&&console.debug(`Memoization debug: Using memorized return value for ${t.toString()}(`,i,")"),e[i]):(ss&&console.debug(`Memoization debug: Cache miss! Memoizing ${t.toString()}(`,i,")"),e[i]=t.apply(this,i))}}function $p(t,e){if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}const I=t=>t.length===0?ic:t,Pt=t=>Object.keys(t).length===0?ac:t,uc=is(t=>{if(!t)return"";const e=new Date(t),i=e.getFullYear()===as.getFullYear(),a={day:"numeric",month:"short"};return i||(a.year="numeric"),e.toLocaleDateString([],a)}),Lp=new Intl.RelativeTimeFormat([],{style:"long",numeric:"auto"}),Np=1e3*86400,as=new Date,Hp=t=>new Date(t).toDateString()===as.toDateString(),Wp=is((t,e,i)=>{const a=Math.round((new Date(t).getTime()-as.getTime())/Np);return a<e||a>i?uc(t):Lp.format(a,"days")});function Yp(t){return new Uint8Array(t).reduce((i,a)=>i+a.toString(16).padStart(2,"0"),"")}const ns=async(t,e)=>{e||(e=await Xe(t));let i=t.type;if(i.includes("/")&&(i=i.split("/")[1]),!i)throw new Error(`Could not extract file type from ${t.type}`);return`${e}.${i}`};function Xe(t){return new Promise((e,i)=>{const a=new FileReader;a.onload=()=>{const n=a.result;if(!n){i(new Error("FileReader did not return a valid ArrayBuffer."));return}crypto.subtle.digest("SHA-1",n).then(c=>{const r=Yp(c);e(r)})},a.readAsArrayBuffer(t)})}function Kp(t){if(!t.name||!t.type||!t.size){const e="File has no name, type, and/or size";throw new Error(e)}return`${t.name}&${t.type}${t.size}`}function oc(t,e){return new File([t],e,{type:t.type})}function Zp(t,e){const i=document.createElement("a");i.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(e)),i.setAttribute("download",t),i.style.display="none",document.body.appendChild(i),i.click(),document.body.removeChild(i)}const Jp=async t=>{const e={};for(const i of t){const a=await Xe(i);e[a]={sha1:a,extension:i.name.split(".").pop()||"",file_type:i.type,size:i.size}}return Object.values(e)},lc=async t=>(await fetch(t)).blob(),Xp=t=>new Promise((e,i)=>{const a=new FileReader;a.onloadend=()=>{var n;e(((n=a.result)==null?void 0:n.toString())||"")},a.readAsDataURL(t)});function Qp(t){const e=new Blob([t]);Mp.saveAs(e,t.name)}const hc={};function xp(t,e,i,...a){const n=hc[t];let c=!1;n?n[e]||(n[e]=!0,c=!0):(hc[t]={[e]:!0},c=!0),c&&console[i](...a)}const mc=["created_at","updated_at","index","revision"];function b(t){return{...t,uuid:Je.v4()}}function pc(t){const e={};for(const i of t)e[i.uuid]=i;return e}function eA(t,e=void 0,i=255){let a=t.replace(/[^a-z0-9_\-.]/gi,"_").replace(/_{2,}/g,"_");if(!e){const c=t.split(".");c.length>1&&(e=c[c.length-1])}e&&!e.startsWith(".")&&(e="."+e);const n=e?e.length:0;return a.length+n>i&&(a=a.slice(0,i-n)+(e||"")),a}function tA(t){return t.toLowerCase().replace(" ","-")}function sA(t,e=!1){return t.normalize("NFKD").toLowerCase().replace(/[^\w\s-]/g,"").trim().replace(/[-\s]+/g,e?"_":"-")}function iA(t,e){if(t.length<=e)return t;const i=t.slice(0,e-1);return i.slice(0,i.lastIndexOf(" "))+"…"}const y=t=>e=>i=>t(i,e);function Ac(t,e,i){return i.findIndex(a=>a.uuid===t.uuid)===e}function aA(t,e,i){return i.findIndex(a=>a.file_sha1===t.file_sha1)===e}const nA=/^.+@.+\..+$/;function v(t){const e={...t};for(const i of[...mc,"created_by"])i in e&&delete e[i];return e}const k=P(t=>t.uuid),fc=k.getInitialState({}),cs=d.createSlice({name:"agents",initialState:fc,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,fc)),reducers:{initializeConversations:k.initialize,addConversation:k.addOne,addConversations:k.addMany,setConversation:k.setOne,setConversations:k.setMany,updateConversation:k.updateOne,updateConversations:k.updateMany,deleteConversation:k.deleteOne,deleteConversations:k.deleteMany}}),{initializeConversations:yc,addConversation:Sc,addConversations:cA,setConversation:Ic,setConversations:rA,updateConversation:Tc,updateConversations:dA,deleteConversation:uA,deleteConversations:oA}=cs.actions,rs=t=>t.agentsReducer.instances,lA=d.createSelector([rs],t=>Object.values(t)),hA=y(d.createSelector([rs,(t,e)=>e],(t,e)=>t[e])),gc=cs.reducer,B=P(t=>t.uuid),bc=B.getInitialState({}),ds=d.createSlice({name:"assetAttachments",initialState:bc,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,bc)),reducers:{initializeAssetAttachments:B.initialize,addAssetAttachment:B.addOne,addAssetAttachments:B.addMany,setAssetAttachment:B.setOne,setAssetAttachments:B.setMany,updateAssetAttachment:B.updateOne,updateAssetAttachments:B.updateMany,deleteAssetAttachment:B.deleteOne,deleteAssetAttachments:B.deleteMany}}),{initializeAssetAttachments:us,addAssetAttachment:mA,addAssetAttachments:os,setAssetAttachment:Fc,setAssetAttachments:pA,updateAssetAttachment:AA,updateAssetAttachments:Pc,deleteAssetAttachment:Oc,deleteAssetAttachments:ls}=ds.actions,_c=t=>t.assetAttachmentReducer.instances,Rc=d.createSelector([_c],t=>Object.values(t)),vc=t=>e=>e.assetAttachmentReducer.instances[t],wc=y(d.createSelector([Rc,(t,e)=>e],(t,e)=>I(t.filter(({asset:i})=>e===i)))),Mc=ds.reducer,G=P(t=>t.uuid),Ec=G.getInitialState({}),hs=d.createSlice({name:"assetProcedureAttachments",initialState:Ec,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Ec)),reducers:{initializeAssetProcedureAttachments:G.initialize,addAssetProcedureAttachment:G.addOne,addAssetProcedureAttachments:G.addMany,setAssetProcedureAttachment:G.setOne,setAssetProcedureAttachments:G.setMany,updateAssetProcedureAttachment:G.updateOne,updateAssetProcedureAttachments:G.updateMany,deleteAssetProcedureAttachment:G.deleteOne,deleteAssetProcedureAttachments:G.deleteMany}}),{initializeAssetProcedureAttachments:Vc,addAssetProcedureAttachment:fA,addAssetProcedureAttachments:jc,setAssetProcedureAttachment:qc,setAssetProcedureAttachments:yA,updateAssetProcedureAttachment:SA,updateAssetProcedureAttachments:zc,deleteAssetProcedureAttachment:Uc,deleteAssetProcedureAttachments:Dc}=hs.actions,Cc=hs.reducer,kc=t=>t.assetProcedureAttachmentReducer.instances,Bc=d.createSelector([kc],t=>Object.values(t)),Gc=t=>e=>e.assetProcedureAttachmentReducer.instances[t],IA=y(d.createSelector([Bc,(t,e)=>e],(t,e)=>I(t.filter(({asset_procedure:i})=>e===i)))),$=P(t=>t.uuid),$c=$.getInitialState({}),ms=d.createSlice({name:"assetProcedureFieldsAttachments",initialState:$c,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,$c)),reducers:{initializeAssetProcedureFieldsAttachments:$.initialize,addAssetProcedureFieldsAttachment:$.addOne,addAssetProcedureFieldsAttachments:$.addMany,setAssetProcedureFieldsAttachment:$.setOne,setAssetProcedureFieldsAttachments:$.setMany,updateAssetProcedureFieldsAttachment:$.updateOne,updateAssetProcedureFieldsAttachments:$.updateMany,deleteAssetProcedureFieldsAttachment:$.deleteOne,deleteAssetProcedureFieldsAttachments:$.deleteMany}}),{initializeAssetProcedureFieldsAttachments:Lc,addAssetProcedureFieldsAttachment:TA,addAssetProcedureFieldsAttachments:Nc,setAssetProcedureFieldsAttachment:gA,setAssetProcedureFieldsAttachments:bA,updateAssetProcedureFieldsAttachment:FA,updateAssetProcedureFieldsAttachments:Hc,deleteAssetProcedureFieldsAttachment:PA,deleteAssetProcedureFieldsAttachments:Wc}=ms.actions,Yc=t=>t.assetProcedureFieldsAttachmentReducer.instances,Kc=d.createSelector([Yc],t=>Object.values(t)),OA=y(d.createSelector([Kc,(t,e)=>e],(t,e)=>I(t.filter(i=>i.fields_revision===e)))),_A=t=>e=>e.assetProcedureFieldsAttachmentReducer.instances[t],Zc=ms.reducer,L=P(t=>t.uuid),Jc=L.getInitialState({}),ps=d.createSlice({name:"assetProcedureFields",initialState:Jc,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Jc)),reducers:{initializeAssetProcedureFields:L.initialize,addAssetProcedureFields:L.addOne,addAssetProcedureFieldsMany:L.addMany,setAssetProcedureFields:L.setOne,setAssetProcedureFieldsMany:L.setMany,updateAssetProcedureFields:L.updateOne,updateAssetProcedureFieldsMany:L.updateMany,deleteAssetProcedureFields:L.deleteOne,deleteAssetProcedureFieldsMany:L.deleteMany}}),{initializeAssetProcedureFields:Xc,addAssetProcedureFields:Qc,addAssetProcedureFieldsMany:RA,setAssetProcedureFields:vA,setAssetProcedureFieldsMany:wA,updateAssetProcedureFields:xc,updateAssetProcedureFieldsMany:MA,deleteAssetProcedureFields:er,deleteAssetProcedureFieldsMany:EA}=ps.actions,tr=t=>t.assetProcedureFieldsReducer.instances,As=d.createSelector([tr],t=>Object.values(t)),VA=y(d.createSelector([As,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset_procedure===e)))),jA=y(d.createSelector([As,(t,e)=>e],(t,e)=>t.filter(i=>i.asset_procedure===e).sort((i,a)=>i.submitted_at>a.submitted_at?-1:1)[0])),qA=t=>e=>e.assetProcedureFieldsReducer.instances[t],sr=ps.reducer,N=P(t=>t.uuid),ir=N.getInitialState({}),fs=d.createSlice({name:"assetProcedureFieldValuesAttachments",initialState:ir,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,ir)),reducers:{initializeAssetProcedureFieldValuesAttachments:N.initialize,addAssetProcedureFieldValuesAttachment:N.addOne,addAssetProcedureFieldValuesAttachments:N.addMany,setAssetProcedureFieldValuesAttachment:N.setOne,setAssetProcedureFieldValuesAttachments:N.setMany,updateAssetProcedureFieldValuesAttachment:N.updateOne,updateAssetProcedureFieldValuesAttachments:N.updateMany,deleteAssetProcedureFieldValuesAttachment:N.deleteOne,deleteAssetProcedureFieldValuesAttachments:N.deleteMany}}),{initializeAssetProcedureFieldValuesAttachments:ar,addAssetProcedureFieldValuesAttachment:zA,addAssetProcedureFieldValuesAttachments:Ot,setAssetProcedureFieldValuesAttachment:UA,setAssetProcedureFieldValuesAttachments:DA,updateAssetProcedureFieldValuesAttachment:CA,updateAssetProcedureFieldValuesAttachments:nr,deleteAssetProcedureFieldValuesAttachment:kA,deleteAssetProcedureFieldValuesAttachments:_t}=fs.actions,ys=t=>t.assetProcedureFieldValuesAttachmentReducer.instances,cr=d.createSelector([ys],t=>Object.values(t)),BA=t=>e=>e.assetProcedureFieldValuesAttachmentReducer.instances[t],rr=y(d.createSelector([ys,(t,e)=>e],(t,e)=>{const i=new Set(e);return I(Object.values(t).filter(a=>i.has(a.uuid)))})),dr=y(d.createSelector([cr,(t,e)=>e],(t,e)=>I(t.filter(i=>i.field_values===e)))),ur=fs.reducer,H=P(t=>t.uuid),or=H.getInitialState({}),Ss=d.createSlice({name:"assetProcedureFieldValues",initialState:or,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,or)),reducers:{initializeAssetProcedureFieldValues:H.initialize,addAssetProcedureFieldValues:H.addOne,addAssetProcedureFieldValuesMany:H.addMany,setAssetProcedureFieldValues:H.setOne,setAssetProcedureFieldValuesMany:H.setMany,updateAssetProcedureFieldValues:H.updateOne,updateAssetProcedureFieldValuesMany:H.updateMany,deleteAssetProcedureFieldValues:H.deleteOne,deleteAssetProcedureFieldValuesMany:H.deleteMany}}),{initializeAssetProcedureFieldValues:lr,addAssetProcedureFieldValues:Is,addAssetProcedureFieldValuesMany:hr,setAssetProcedureFieldValues:GA,setAssetProcedureFieldValuesMany:$A,updateAssetProcedureFieldValues:st,updateAssetProcedureFieldValuesMany:mr,deleteAssetProcedureFieldValues:Ts,deleteAssetProcedureFieldValuesMany:pr}=Ss.actions,Ar=Ss.reducer,fr=t=>t.assetProcedureFieldValuesReducer.instances,gs=d.createSelector([fr],t=>Object.values(t)),LA=y(d.createSelector([gs,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset===e)))),NA=y(d.createSelector([gs,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset_procedure_instance===e)))),bs=t=>e=>e.assetProcedureFieldValuesReducer.instances[t],W=P(t=>t.uuid),yr=W.getInitialState({}),Fs=d.createSlice({name:"assetProcedureInstances",initialState:yr,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,yr)),reducers:{initializeAssetProcedureInstances:W.initialize,addAssetProcedureInstance:W.addOne,addAssetProcedureInstances:W.addMany,setAssetProcedureInstance:W.setOne,setAssetProcedureInstances:W.setMany,updateAssetProcedureInstance:W.updateOne,updateAssetProcedureInstances:W.updateMany,deleteAssetProcedureInstance:W.deleteOne,deleteAssetProcedureInstances:W.deleteMany}}),{initializeAssetProcedureInstances:Sr,addAssetProcedureInstance:Ps,addAssetProcedureInstances:Ir,updateAssetProcedureInstance:it,updateAssetProcedureInstances:HA,deleteAssetProcedureInstance:Os,deleteAssetProcedureInstances:Tr,setAssetProcedureInstance:WA,setAssetProcedureInstances:YA}=Fs.actions,gr=Fs.reducer,_s=t=>t.assetProcedureInstanceReducer.instances,Rs=d.createSelector([_s],t=>Object.values(t)),br=y(d.createSelector([Rs,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset_procedure===e)))),KA=y(d.createSelector([Rs,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset_type===e)))),vs=t=>e=>e.assetProcedureInstanceReducer.instances[t],ZA=y(d.createSelector([_s,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n&&i.push(n)}return I(i)})),Y=P(t=>t.uuid),Fr=Y.getInitialState({}),ws=d.createSlice({name:"assetProcedures",initialState:Fr,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Fr)),reducers:{initializeAssetProcedures:Y.initialize,addAssetProcedure:Y.addOne,addAssetProcedures:Y.addMany,setAssetProcedure:Y.setOne,setAssetProcedures:Y.setMany,updateAssetProcedure:Y.updateOne,updateAssetProcedures:Y.updateMany,deleteAssetProcedure:Y.deleteOne,deleteAssetProcedures:Y.deleteMany}}),{initializeAssetProcedures:Pr,addAssetProcedure:Ms,addAssetProcedures:JA,updateAssetProcedure:at,updateAssetProcedures:XA,deleteAssetProcedure:Es,deleteAssetProcedures:QA,setAssetProcedure:xA,setAssetProcedures:ef}=ws.actions,Or=ws.reducer,Vs=t=>t.assetProcedureReducer.instances,_r=d.createSelector([Vs],t=>Object.values(t)),js=t=>e=>e.assetProcedureReducer.instances[t],tf=y(d.createSelector([Vs,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n&&i.push(n)}return I(i)})),sf=y(d.createSelector([_r,(t,e)=>e],(t,e)=>I(t.filter(i=>i.organization===e)))),K=P(t=>t.uuid),Rr=K.getInitialState({}),qs=d.createSlice({name:"assetProcedureStepFieldsAttachments",initialState:Rr,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Rr)),reducers:{initializeAssetProcedureStepFieldsAttachments:K.initialize,addAssetProcedureStepFieldsAttachment:K.addOne,addAssetProcedureStepFieldsAttachments:K.addMany,setAssetProcedureStepFieldsAttachment:K.setOne,setAssetProcedureStepFieldsAttachments:K.setMany,updateAssetProcedureStepFieldsAttachment:K.updateOne,updateAssetProcedureStepFieldsAttachments:K.updateMany,deleteAssetProcedureStepFieldsAttachment:K.deleteOne,deleteAssetProcedureStepFieldsAttachments:K.deleteMany}}),{initializeAssetProcedureStepFieldsAttachments:vr,addAssetProcedureStepFieldsAttachment:af,addAssetProcedureStepFieldsAttachments:wr,setAssetProcedureStepFieldsAttachment:nf,setAssetProcedureStepFieldsAttachments:cf,updateAssetProcedureStepFieldsAttachment:rf,updateAssetProcedureStepFieldsAttachments:Mr,deleteAssetProcedureStepFieldsAttachment:df,deleteAssetProcedureStepFieldsAttachments:Er}=qs.actions,Vr=t=>t.assetProcedureStepFieldsAttachmentReducer.instances,jr=d.createSelector([Vr],t=>Object.values(t)),uf=y(d.createSelector([jr,(t,e)=>e],(t,e)=>I(t.filter(i=>i.fields_revision===e)))),of=t=>e=>e.assetProcedureStepFieldsAttachmentReducer.instances[t],qr=qs.reducer,Z=P(t=>t.uuid),zr=Z.getInitialState({}),zs=d.createSlice({name:"assetProcedureStepFields",initialState:zr,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,zr)),reducers:{initializeAssetProcedureStepFields:Z.initialize,addAssetProcedureStepFields:Z.addOne,addAssetProcedureStepFieldsMany:Z.addMany,setAssetProcedureStepFields:Z.setOne,setAssetProcedureStepFieldsMany:Z.setMany,updateAssetProcedureStepFields:Z.updateOne,updateAssetProcedureStepFieldsMany:Z.updateMany,deleteAssetProcedureStepFields:Z.deleteOne,deleteAssetProcedureStepFieldsMany:Z.deleteMany}}),{initializeAssetProcedureStepFields:Ur,addAssetProcedureStepFields:Us,addAssetProcedureStepFieldsMany:lf,setAssetProcedureStepFields:hf,setAssetProcedureStepFieldsMany:mf,updateAssetProcedureStepFields:nt,updateAssetProcedureStepFieldsMany:pf,deleteAssetProcedureStepFields:Ds,deleteAssetProcedureStepFieldsMany:Af}=zs.actions,Cs=t=>t.assetProcedureStepFieldsReducer.instances,ks=d.createSelector([Cs],t=>Object.values(t)),ff=y(d.createSelector([ks,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset_procedure_step===e)))),yf=y(d.createSelector([ks,(t,e)=>e],(t,e)=>t.filter(i=>i.asset_procedure_step===e).sort((i,a)=>i.submitted_at>a.submitted_at?-1:1)[0])),Sf=d.createSelector([Cs],t=>{const e={};for(const i of Object.values(t)){const a=e[i.asset_procedure_step];(!a||a.submitted_at<i.submitted_at)&&(e[i.asset_procedure_step]=i)}return e}),If=t=>e=>e.assetProcedureStepFieldsReducer.instances[t],Dr=zs.reducer,J=P(t=>t.uuid),Cr=J.getInitialState({}),Bs=d.createSlice({name:"assetProcedureStepFieldValuesAttachments",initialState:Cr,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,Cr)),reducers:{initializeAssetProcedureStepFieldValuesAttachments:J.initialize,addAssetProcedureStepFieldValuesAttachment:J.addOne,addAssetProcedureStepFieldValuesAttachments:J.addMany,setAssetProcedureStepFieldValuesAttachment:J.setOne,setAssetProcedureStepFieldValuesAttachments:J.setMany,updateAssetProcedureStepFieldValuesAttachment:J.updateOne,updateAssetProcedureStepFieldValuesAttachments:J.updateMany,deleteAssetProcedureStepFieldValuesAttachment:J.deleteOne,deleteAssetProcedureStepFieldValuesAttachments:J.deleteMany}}),{initializeAssetProcedureStepFieldValuesAttachments:kr,addAssetProcedureStepFieldValuesAttachment:Tf,addAssetProcedureStepFieldValuesAttachments:Rt,setAssetProcedureStepFieldValuesAttachment:gf,setAssetProcedureStepFieldValuesAttachments:bf,updateAssetProcedureStepFieldValuesAttachment:Ff,updateAssetProcedureStepFieldValuesAttachments:Br,deleteAssetProcedureStepFieldValuesAttachment:Pf,deleteAssetProcedureStepFieldValuesAttachments:vt}=Bs.actions,Gs=t=>t.assetProcedureStepFieldValuesAttachmentReducer.instances,Gr=d.createSelector([Gs],t=>Object.values(t)),Of=t=>e=>e.assetProcedureStepFieldValuesAttachmentReducer.instances[t],$r=y(d.createSelector([Gs,(t,e)=>e],(t,e)=>{const i=new Set(e);return I(Object.values(t).filter(a=>i.has(a.uuid)))})),Lr=y(d.createSelector([Gr,(t,e)=>e],(t,e)=>I(t.filter(i=>i.field_values===e)))),Nr=Bs.reducer,X=P(t=>t.uuid),Hr=X.getInitialState({}),$s=d.createSlice({name:"assetProcedureStepFieldValues",initialState:Hr,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,Hr)),reducers:{initializeAssetProcedureStepFieldValues:X.initialize,addAssetProcedureStepFieldValues:X.addOne,addAssetProcedureStepFieldValuesMany:X.addMany,setAssetProcedureStepFieldValues:X.setOne,setAssetProcedureStepFieldValuesMany:X.setMany,updateAssetProcedureStepFieldValues:X.updateOne,updateAssetProcedureStepFieldValuesMany:X.updateMany,deleteAssetProcedureStepFieldValues:X.deleteOne,deleteAssetProcedureStepFieldValuesMany:X.deleteMany}}),{initializeAssetProcedureStepFieldValues:Wr,addAssetProcedureStepFieldValues:Ls,addAssetProcedureStepFieldValuesMany:Yr,setAssetProcedureStepFieldValues:_f,setAssetProcedureStepFieldValuesMany:Rf,updateAssetProcedureStepFieldValues:ct,updateAssetProcedureStepFieldValuesMany:Kr,deleteAssetProcedureStepFieldValues:Ns,deleteAssetProcedureStepFieldValuesMany:Zr}=$s.actions,Jr=t=>t.assetProcedureStepFieldValuesReducer.instances,wt=d.createSelector([Jr],t=>Object.values(t)),vf=y(d.createSelector([wt,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset===e)))),wf=y(d.createSelector([wt,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset_procedure_instance===e)))),Mf=y(d.createSelector([wt,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset_procedure_step===e)))),Hs=t=>e=>e.assetProcedureStepFieldValuesReducer.instances[t],Xr=$s.reducer,Q=P(t=>t.uuid),Qr=Q.getInitialState({}),Ws=d.createSlice({name:"assetProcedureSteps",initialState:Qr,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Qr)),reducers:{initializeAssetProcedureSteps:Q.initialize,setAssetProcedureStep:Q.setOne,setAssetProcedureSteps:Q.setMany,addAssetProcedureStep:Q.addOne,addAssetProcedureSteps:Q.addMany,updateAssetProcedureStep:Q.updateOne,updateAssetProcedureSteps:Q.updateMany,deleteAssetProcedureStep:Q.deleteOne,deleteAssetProcedureSteps:Q.deleteMany}}),{initializeAssetProcedureSteps:xr,setAssetProcedureStep:ed,setAssetProcedureSteps:Ef,addAssetProcedureStep:Ys,addAssetProcedureSteps:Vf,updateAssetProcedureStep:Mt,updateAssetProcedureSteps:jf,deleteAssetProcedureStep:Ks,deleteAssetProcedureSteps:qf}=Ws.actions,td=Ws.reducer,Et=t=>t.assetProcedureStepReducer.instances,Zs=t=>e=>e.assetProcedureStepReducer.instances[t],sd=d.createSelector([Et],t=>Object.values(t)),zf=y(d.createSelector([Et,(t,e)=>e],(t,e)=>{const i={};for(const[a,n]of Object.entries(t))n.asset_procedure===e&&(i[a]=n);return Pt(i)})),Uf=y(d.createSelector([sd,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset_procedure===e)))),Df=y(d.createSelector([Et,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n?i.push(n):console.warn("selectAssetProcedureStepsByIds: No step exists with the id",a)}return I(i)})),x=P(t=>t.uuid),id=x.getInitialState({}),Js=d.createSlice({name:"assets",initialState:id,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,id)),reducers:{initializeAssets:x.initialize,addAsset:x.addOne,addAssets:x.addMany,setAsset:x.setOne,setAssets:x.setMany,updateAsset:x.updateOne,updateAssets:x.updateMany,deleteAsset:x.deleteOne,deleteAssets:x.deleteMany}}),{initializeAssets:ad,addAsset:Xs,addAssets:Vt,updateAsset:rt,updateAssets:Cf,deleteAsset:Qs,deleteAssets:xs,setAsset:kf,setAssets:Bf}=Js.actions,ei=t=>t.assetReducer.instances,nd=d.createSelector([ei],t=>I(Object.values(t))),ti=y(d.createSelector([nd,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset_type===e)))),si=t=>e=>e.assetReducer.instances[t],cd=y(d.createSelector([ei,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n&&i.push(n)}return I(i)})),Gf=t=>e=>ti(t)(e).length,rd=Js.reducer,ee=P(t=>t.uuid),dd=ee.getInitialState({}),ii=d.createSlice({name:"assetStageCompletions",initialState:dd,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,dd)),reducers:{initializeAssetStageCompletions:ee.initialize,addAssetStageCompletion:ee.addOne,addAssetStageCompletions:ee.addMany,setAssetStageCompletion:ee.setOne,setAssetStageCompletions:ee.setMany,updateAssetStageCompletion:ee.updateOne,updateAssetStageCompletions:ee.updateMany,deleteAssetStageCompletion:ee.deleteOne,deleteAssetStageCompletions:ee.deleteMany}}),{initializeAssetStageCompletions:ud,addAssetStageCompletion:ai,addAssetStageCompletions:ni,setAssetStageCompletion:$f,setAssetStageCompletions:Lf,updateAssetStageCompletion:od,updateAssetStageCompletions:ld,deleteAssetStageCompletion:ci,deleteAssetStageCompletions:ri}=ii.actions,hd=ii.reducer,di=t=>t.assetStageCompletionReducer.instances,Nf=d.createSelector([di],t=>Object.values(t)),md=t=>e=>e.assetStageCompletionReducer.instances[t],pd=y(d.createSelector([di,(t,e)=>e],(t,e)=>{const i=new Set(e);return I(Object.values(t).filter(a=>i.has(a.uuid)))})),te=P(t=>t.uuid),Ad=te.getInitialState({}),ui=d.createSlice({name:"assetStages",initialState:Ad,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Ad)),reducers:{initializeAssetStages:te.initialize,setAssetStage:te.setOne,setAssetStages:te.setMany,addAssetStage:te.addOne,addAssetStages:te.addMany,updateAssetStage:te.updateOne,updateAssetStages:te.updateMany,deleteAssetStage:te.deleteOne,deleteAssetStages:te.deleteMany}}),{initializeAssetStages:fd,setAssetStage:yd,setAssetStages:Hf,addAssetStage:oi,addAssetStages:Wf,updateAssetStage:jt,updateAssetStages:Yf,deleteAssetStage:li,deleteAssetStages:Kf}=ui.actions,Sd=ui.reducer,qt=t=>t.assetStageReducer.instances,hi=t=>e=>e.assetStageReducer.instances[t],Id=d.createSelector([qt],t=>Object.values(t)),Zf=y(d.createSelector([qt,(t,e)=>e],(t,e)=>{const i={};for(const[a,n]of Object.entries(t))n.asset_procedure===e&&(i[a]=n);return Pt(i)})),Jf=y(d.createSelector([Id,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset_procedure===e)))),Xf=y(d.createSelector([qt,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n?i.push(n):console.warn("selectStagesFromStageIds: No stage exists with the id",a)}return I(i)})),se=P(t=>t.uuid),Td=se.getInitialState({}),mi=d.createSlice({name:"assetTypeAttachments",initialState:Td,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Td)),reducers:{initializeAssetTypeAttachments:se.initialize,addAssetTypeAttachment:se.addOne,addAssetTypeAttachments:se.addMany,setAssetTypeAttachment:se.setOne,setAssetTypeAttachments:se.setMany,updateAssetTypeAttachment:se.updateOne,updateAssetTypeAttachments:se.updateMany,deleteAssetTypeAttachment:se.deleteOne,deleteAssetTypeAttachments:se.deleteMany}}),{initializeAssetTypeAttachments:gd,addAssetTypeAttachment:Qf,addAssetTypeAttachments:pi,setAssetTypeAttachment:bd,setAssetTypeAttachments:xf,updateAssetTypeAttachment:ey,updateAssetTypeAttachments:Fd,deleteAssetTypeAttachment:Pd,deleteAssetTypeAttachments:Ai}=mi.actions,Od=t=>t.assetTypeAttachmentReducer.instances,_d=d.createSelector([Od],t=>Object.values(t)),Rd=t=>e=>e.assetTypeAttachmentReducer.instances[t],vd=y(d.createSelector([_d,(t,e)=>e],(t,e)=>I(t.filter(({asset_type:i})=>e===i)))),wd=mi.reducer,ie=P(t=>t.uuid),Md=ie.getInitialState({}),fi=d.createSlice({name:"assetTypeFieldsAttachments",initialState:Md,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Md)),reducers:{initializeAssetTypeFieldsAttachments:ie.initialize,addAssetTypeFieldsAttachment:ie.addOne,addAssetTypeFieldsAttachments:ie.addMany,setAssetTypeFieldsAttachment:ie.setOne,setAssetTypeFieldsAttachments:ie.setMany,updateAssetTypeFieldsAttachment:ie.updateOne,updateAssetTypeFieldsAttachments:ie.updateMany,deleteAssetTypeFieldsAttachment:ie.deleteOne,deleteAssetTypeFieldsAttachments:ie.deleteMany}}),{initializeAssetTypeFieldsAttachments:Ed,addAssetTypeFieldsAttachment:ty,addAssetTypeFieldsAttachments:Vd,setAssetTypeFieldsAttachment:sy,setAssetTypeFieldsAttachments:iy,updateAssetTypeFieldsAttachment:ay,updateAssetTypeFieldsAttachments:jd,deleteAssetTypeFieldsAttachment:ny,deleteAssetTypeFieldsAttachments:qd}=fi.actions,zd=t=>t.assetTypeFieldsAttachmentReducer.instances,Ud=d.createSelector([zd],t=>Object.values(t)),cy=y(d.createSelector([Ud,(t,e)=>e],(t,e)=>I(t.filter(i=>i.fields_revision===e)))),ry=t=>e=>e.assetTypeFieldsAttachmentReducer.instances[t],Dd=fi.reducer,ae=P(t=>t.uuid),Cd=ae.getInitialState({}),yi=d.createSlice({name:"assetTypeFields",initialState:Cd,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Cd)),reducers:{initializeAssetTypeFields:ae.initialize,addAssetTypeFields:ae.addOne,addAssetTypeFieldsMany:ae.addMany,setAssetTypeFields:ae.setOne,setAssetTypeFieldsMany:ae.setMany,updateAssetTypeFields:ae.updateOne,updateAssetTypeFieldsMany:ae.updateMany,deleteAssetTypeFields:ae.deleteOne,deleteAssetTypeFieldsMany:ae.deleteMany}}),{initializeAssetTypeFields:kd,addAssetTypeFields:Bd,addAssetTypeFieldsMany:dy,setAssetTypeFields:uy,setAssetTypeFieldsMany:oy,updateAssetTypeFields:Gd,updateAssetTypeFieldsMany:ly,deleteAssetTypeFields:$d,deleteAssetTypeFieldsMany:hy}=yi.actions,Ld=t=>t.assetTypeFieldsReducer.instances,zt=d.createSelector([Ld],t=>Object.values(t)),my=y(d.createSelector([zt,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset_type===e)))),py=y(d.createSelector([zt,(t,e)=>e],(t,e)=>t.filter(i=>i.asset_type===e).sort((i,a)=>i.submitted_at>a.submitted_at?-1:1)[0])),Ay=t=>e=>e.assetTypeFieldsReducer.instances[t],Nd=yi.reducer,ne=P(t=>t.uuid),Hd=ne.getInitialState({}),Si=d.createSlice({name:"assetTypeFieldValuesAttachments",initialState:Hd,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,Hd)),reducers:{initializeAssetTypeFieldValuesAttachments:ne.initialize,addAssetTypeFieldValuesAttachment:ne.addOne,addAssetTypeFieldValuesAttachments:ne.addMany,setAssetTypeFieldValuesAttachment:ne.setOne,setAssetTypeFieldValuesAttachments:ne.setMany,updateAssetTypeFieldValuesAttachment:ne.updateOne,updateAssetTypeFieldValuesAttachments:ne.updateMany,deleteAssetTypeFieldValuesAttachment:ne.deleteOne,deleteAssetTypeFieldValuesAttachments:ne.deleteMany}}),{initializeAssetTypeFieldValuesAttachments:Wd,addAssetTypeFieldValuesAttachment:fy,addAssetTypeFieldValuesAttachments:Ut,setAssetTypeFieldValuesAttachment:yy,setAssetTypeFieldValuesAttachments:Sy,updateAssetTypeFieldValuesAttachment:Iy,updateAssetTypeFieldValuesAttachments:Yd,deleteAssetTypeFieldValuesAttachment:Ty,deleteAssetTypeFieldValuesAttachments:Dt}=Si.actions,Ii=t=>t.assetTypeFieldValuesAttachmentReducer.instances,Kd=d.createSelector([Ii],t=>Object.values(t)),gy=t=>e=>e.assetTypeFieldValuesAttachmentReducer.instances[t],Zd=y(d.createSelector([Ii,(t,e)=>e],(t,e)=>{const i=new Set(e);return I(Object.values(t).filter(a=>i.has(a.uuid)))})),Jd=y(d.createSelector([Kd,(t,e)=>e],(t,e)=>I(t.filter(i=>i.field_values===e)))),Xd=Si.reducer,ce=P(t=>t.uuid),Qd=ce.getInitialState({}),Ti=d.createSlice({name:"assetTypeFieldValues",initialState:Qd,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,Qd)),reducers:{initializeAssetTypeFieldValues:ce.initialize,addAssetTypeFieldValues:ce.addOne,addAssetTypeFieldValuesMany:ce.addMany,setAssetTypeFieldValues:ce.setOne,setAssetTypeFieldValuesMany:ce.setMany,updateAssetTypeFieldValues:ce.updateOne,updateAssetTypeFieldValuesMany:ce.updateMany,deleteAssetTypeFieldValues:ce.deleteOne,deleteAssetTypeFieldValuesMany:ce.deleteMany}}),{initializeAssetTypeFieldValues:xd,addAssetTypeFieldValues:gi,addAssetTypeFieldValuesMany:eu,setAssetTypeFieldValues:by,setAssetTypeFieldValuesMany:Fy,updateAssetTypeFieldValues:dt,updateAssetTypeFieldValuesMany:tu,deleteAssetTypeFieldValues:bi,deleteAssetTypeFieldValuesMany:su}=Ti.actions,iu=t=>t.assetTypeFieldValuesReducer.instances,Fi=d.createSelector([iu],t=>Object.values(t)),Py=y(d.createSelector([Fi,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset===e)))),Oy=y(d.createSelector([zt,Fi,(t,e)=>e],(t,e,i)=>{const a=new Set(t.filter(n=>n.asset_type===i).map(n=>n.uuid));return I(e.filter(n=>a.has(n.fields_revision)))})),Pi=t=>e=>e.assetTypeFieldValuesReducer.instances[t],au=Ti.reducer,re=P(t=>t.uuid),nu=re.getInitialState({}),Oi=d.createSlice({name:"assetTypeIdentifiers",initialState:nu,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,nu)),reducers:{initializeAssetTypeIdentifiers:re.initialize,addAssetTypeIdentifier:re.addOne,addAssetTypeIdentifiers:re.addMany,setAssetTypeIdentifier:re.setOne,setAssetTypeIdentifiers:re.setMany,updateAssetTypeIdentifier:re.updateOne,updateAssetTypeIdentifiers:re.updateMany,deleteAssetTypeIdentifier:re.deleteOne,deleteAssetTypeIdentifiers:re.deleteMany}}),{initializeAssetTypeIdentifiers:cu,addAssetTypeIdentifier:_i,addAssetTypeIdentifiers:_y,setAssetTypeIdentifier:Ry,setAssetTypeIdentifiers:vy,updateAssetTypeIdentifier:ut,updateAssetTypeIdentifiers:wy,deleteAssetTypeIdentifier:Ri,deleteAssetTypeIdentifiers:My}=Oi.actions,ru=t=>t.assetTypeIdentifierReducer.instances,du=d.createSelector([ru],t=>Object.values(t)),vi=t=>e=>e.assetTypeIdentifierReducer.instances[t],Ey=y(d.createSelector([du,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset_type===e)))),uu=Oi.reducer,de=P(t=>t.uuid),ou=de.getInitialState({}),wi=d.createSlice({name:"assetTypeIdentifierValues",initialState:ou,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,ou)),reducers:{initializeAssetTypeIdentifierValues:de.initialize,addAssetTypeIdentifierValue:de.addOne,addAssetTypeIdentifierValues:de.addMany,setAssetTypeIdentifierValue:de.setOne,setAssetTypeIdentifierValues:de.setMany,updateAssetTypeIdentifierValue:de.updateOne,updateAssetTypeIdentifierValues:de.updateMany,deleteAssetTypeIdentifierValue:de.deleteOne,deleteAssetTypeIdentifierValues:de.deleteMany}}),{initializeAssetTypeIdentifierValues:lu,addAssetTypeIdentifierValue:Mi,addAssetTypeIdentifierValues:Vy,setAssetTypeIdentifierValue:jy,setAssetTypeIdentifierValues:qy,updateAssetTypeIdentifierValue:ot,updateAssetTypeIdentifierValues:zy,deleteAssetTypeIdentifierValue:Ei,deleteAssetTypeIdentifierValues:Uy}=wi.actions,hu=t=>t.assetTypeIdentifierValueReducer.instances,Vi=d.createSelector([hu],t=>Object.values(t)),ji=t=>e=>e.assetTypeIdentifierValueReducer.instances[t],Dy=y(d.createSelector([Vi,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset===e)))),Cy=y(d.createSelector([Vi,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset_type_identifier===e)))),mu=wi.reducer,ue=P(t=>t.uuid),pu=ue.getInitialState({}),qi=d.createSlice({name:"assetTypes",initialState:pu,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,pu)),reducers:{initializeAssetTypes:ue.initialize,setAssetType:ue.setOne,setAssetTypes:ue.setMany,addAssetType:ue.addOne,addAssetTypes:ue.addMany,updateAssetType:ue.updateOne,updateAssetTypes:ue.updateMany,deleteAssetType:ue.deleteOne,deleteAssetTypes:ue.deleteMany}}),{initializeAssetTypes:Au,setAssetType:ky,setAssetTypes:By,addAssetType:zi,addAssetTypes:Gy,updateAssetType:lt,updateAssetTypes:$y,deleteAssetType:Ui,deleteAssetTypes:Ly}=qi.actions,Di=t=>t.assetTypeReducer.instances,fu=d.createSelector([Di],t=>Object.values(t)),Ci=t=>e=>e.assetTypeReducer.instances[t],Ny=y(d.createSelector([Di,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n?i.push(n):console.warn("selectAssetTypesByIds: No assetType exists with the id",a)}return I(i)})),Hy=y(d.createSelector([fu,(t,e)=>e],(t,e)=>I(t.filter(i=>i.organization===e)))),yu=qi.reducer,Su={accessToken:"",refreshToken:"",isLoggedIn:!1},Ct=d.createSlice({name:"auth",initialState:Su,extraReducers:t=>t.addCase(g,e=>Object.assign(e,Su)),reducers:{setTokens:(t,e)=>{t.accessToken=e.payload.accessToken,t.refreshToken=e.payload.refreshToken},clearTokens:t=>{t.accessToken="",t.refreshToken=""},setLoggedIn:(t,e)=>{e.payload||Ct.caseReducers.clearTokens(t),t.isLoggedIn=e.payload}}}),{setTokens:Wy,clearTokens:Yy,setLoggedIn:Iu}=Ct.actions,Ky=t=>t.authReducer.accessToken,Zy=t=>t.authReducer.isLoggedIn,Tu=Ct.reducer,oe=P(t=>t.uuid),gu=oe.getInitialState({}),ki=d.createSlice({name:"categories",initialState:gu,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,gu)),reducers:{initializeCategories:oe.initialize,addCategory:oe.addOne,addCategories:oe.addMany,setCategory:oe.setOne,setCategories:oe.setMany,updateCategory:oe.updateOne,updateCategories:oe.updateMany,deleteCategory:oe.deleteOne,deleteCategories:oe.deleteMany}}),{initializeCategories:bu,addCategory:Bi,addCategories:Jy,setCategory:Xy,setCategories:Qy,updateCategory:Fu,updateCategories:xy,deleteCategory:Pu,deleteCategories:eS}=ki.actions,Gi=t=>t.categoryReducer.instances,Ou=d.createSelector([Gi],t=>Object.values(t)),$i=t=>e=>e.categoryReducer.instances[t],tS=y(d.createSelector([Gi,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n?i.push(n):console.warn("selectCategoryByIds: No category exists with the id",a)}return I(i)})),sS=y(d.createSelector([Ou,(t,e)=>e],(t,e)=>I(t.filter(i=>i.project===e)))),_u=ki.reducer,le=P(t=>t.uuid),Ru=le.getInitialState({}),Li=d.createSlice({name:"documentAttachments",initialState:Ru,extraReducers:t=>t.addCase(g,e=>Object.assign(e,Ru)),reducers:{initializeDocumentAttachments:le.initialize,addDocumentAttachment:le.addOne,addDocumentAttachments:le.addMany,setDocumentAttachment:le.setOne,setDocumentAttachments:le.setMany,updateDocumentAttachment:le.updateOne,updateDocumentAttachments:le.updateMany,deleteDocumentAttachment:le.deleteOne,deleteDocumentAttachments:le.deleteMany}}),{initializeDocumentAttachments:vu,addDocumentAttachment:iS,addDocumentAttachments:wu,setDocumentAttachment:Mu,setDocumentAttachments:aS,updateDocumentAttachment:nS,updateDocumentAttachments:Eu,deleteDocumentAttachment:Vu,deleteDocumentAttachments:ju}=Li.actions,qu=t=>t.documentAttachmentReducer.instances,zu=d.createSelector([qu],t=>Object.values(t)),Uu=t=>e=>e.documentAttachmentReducer.instances[t],cS=y(d.createSelector([zu,(t,e)=>e],(t,e)=>I(t.filter(({document:i})=>e===i)))),Du=Li.reducer,Cu={documents:{}},Ni=d.createSlice({name:"documents",initialState:Cu,extraReducers:t=>t.addCase(g,e=>{Object.assign(e,Cu)}),reducers:{setDocuments:(t,e)=>{if(e.payload.filter(Ac).length!==e.payload.length)throw new Error("Tried to use setIssues reducer with duplicate ID's");t.documents=pc(e.payload)},addDocuments:(t,e)=>{for(const i of e.payload)if(i.uuid in t.documents)throw new Error(`attempting to add a document with uuid ${i.uuid} which already exists in state.documents.`);for(const i of e.payload){if(i.parent_document&&t.documents[i.parent_document]){const a=t.documents[i.parent_document];t.documents[i.parent_document]={...a,children_documents:[...a.children_documents,i.uuid]}}t.documents[i.uuid]=i}},updateDocuments:(t,e)=>{for(const i of e.payload)if(!(i.uuid in t.documents))throw new Error(`attempting to update a document with uuid ${i.uuid} which doesn't exists in state.documents.`);for(const i of e.payload){const a=t.documents[i.uuid];if(i.organization!==void 0&&i.organization!==a.organization)throw new Error("organization cannot be updated");if(i.project!==void 0&&i.project!==a.project)throw new Error("project cannot be updated");t.documents[i.uuid]={...a,...i}}},removeDocuments:(t,e)=>{for(const i of e.payload)if(!(i in t.documents))throw new Error(`attempting to delete a document with uuid ${i} which doesn't exists in state.documents.`);for(const i of e.payload){const a=t.documents[i];if(a.parent_document&&t.documents[a.parent_document]){const n=t.documents[a.parent_document];t.documents[a.parent_document]={...n,children_documents:n.children_documents.filter(c=>c!==a.uuid)}}delete t.documents[i]}}}}),{setDocuments:ku,addDocuments:Bu,updateDocuments:Qe,removeDocuments:Hi}=Ni.actions,kt=t=>t.documentsReducer.documents,Wi=d.createSelector([kt],t=>Object.values(t)),Gu=t=>e=>e.documentsReducer.documents[t],rS=y(d.createSelector([kt,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n?i.push(n):console.warn("selectDocumentByIds: No document exists with the id",a)}return I(i)})),dS=y(d.createSelector([Wi,(t,e)=>e],(t,e)=>t.filter(i=>i.project===e))),uS=y(d.createSelector([Wi,(t,e)=>e],(t,e)=>t.filter(i=>i.organization===e))),$u=Ni.reducer,he=P(t=>t.uuid),Lu=he.getInitialState({}),Yi=d.createSlice({name:"emailDomains",initialState:Lu,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Lu)),reducers:{initializeEmailDomains:he.initialize,addEmailDomain:he.addOne,addEmailDomains:he.addMany,setEmailDomain:he.setOne,setEmailDomains:he.setMany,updateEmailDomain:he.updateOne,updateEmailDomains:he.updateMany,deleteEmailDomain:he.deleteOne,deleteEmailDomains:he.deleteMany}}),{initializeEmailDomains:Nu,addEmailDomain:Hu,addEmailDomains:oS,setEmailDomain:lS,setEmailDomains:hS,updateEmailDomain:mS,updateEmailDomains:pS,deleteEmailDomain:Wu,deleteEmailDomains:AS}=Yi.actions,Yu=t=>t.emailDomainsReducer.instances,Ku=d.createSelector([Yu],t=>Object.values(t)),fS=y(d.createSelector([Ku,(t,e)=>e],(t,e)=>I(t.filter(i=>i.organization===e)))),Zu=Yi.reducer,Ju={s3Urls:{}},Xu=1e3*60*60,yS=Xu*24*7,Ki=d.createSlice({name:"file",initialState:Ju,extraReducers:t=>t.addCase(g,e=>Object.assign(e,Ju)),reducers:{setUploadUrl:(t,e)=>{const{url:i,fields:a,sha1:n}=e.payload,c=new Date,r=new Date(c.getTime()+yS);t.s3Urls[n]={url:i,fields:a,exp:r.getTime()}}}}),{setUploadUrl:Qu}=Ki.actions,xu=t=>e=>{const i=e.fileReducer.s3Urls[t];if(!i)return;const a=new Date().getTime();if(!((i.exp??a)-a<Xu))return i},eo=Ki.reducer,me=P(t=>t.uuid),to=me.getInitialState({}),Zi=d.createSlice({name:"formIdentifiers",initialState:to,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,to)),reducers:{initializeFormIdentifiers:me.initialize,addFormIdentifier:me.addOne,addFormIdentifiers:me.addMany,setFormIdentifier:me.setOne,setFormIdentifiers:me.setMany,updateFormIdentifier:me.updateOne,updateFormIdentifiers:me.updateMany,deleteFormIdentifier:me.deleteOne,deleteFormIdentifiers:me.deleteMany}}),{initializeFormIdentifiers:so,addFormIdentifier:Ji,addFormIdentifiers:SS,setFormIdentifier:IS,setFormIdentifiers:TS,updateFormIdentifier:ht,updateFormIdentifiers:gS,deleteFormIdentifier:Xi,deleteFormIdentifiers:bS}=Zi.actions,io=t=>t.formIdentifierReducer.instances,ao=d.createSelector([io],t=>Object.values(t)),Qi=t=>e=>e.formIdentifierReducer.instances[t],FS=y(d.createSelector([ao,(t,e)=>e],(t,e)=>I(t.filter(i=>i.form===e)))),no=Zi.reducer,pe=P(t=>t.uuid),co=pe.getInitialState({}),xi=d.createSlice({name:"formIdentifierValues",initialState:co,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,co)),reducers:{initializeFormIdentifierValues:pe.initialize,addFormIdentifierValue:pe.addOne,addFormIdentifierValues:pe.addMany,setFormIdentifierValue:pe.setOne,setFormIdentifierValues:pe.setMany,updateFormIdentifierValue:pe.updateOne,updateFormIdentifierValues:pe.updateMany,deleteFormIdentifierValue:pe.deleteOne,deleteFormIdentifierValues:pe.deleteMany}}),{initializeFormIdentifierValues:ro,addFormIdentifierValue:ea,addFormIdentifierValues:PS,setFormIdentifierValue:OS,setFormIdentifierValues:_S,updateFormIdentifierValue:mt,updateFormIdentifierValues:RS,deleteFormIdentifierValue:ta,deleteFormIdentifierValues:vS}=xi.actions,uo=t=>t.formIdentifierValueReducer.instances,sa=d.createSelector([uo],t=>Object.values(t)),ia=t=>e=>e.formIdentifierValueReducer.instances[t],wS=y(d.createSelector([sa,(t,e)=>e],(t,e)=>I(t.filter(i=>i.form_submission===e)))),MS=y(d.createSelector([sa,(t,e)=>e],(t,e)=>I(t.filter(i=>i.form_identifier===e)))),oo=xi.reducer,Ae=P(t=>t.uuid),lo=Ae.getInitialState({}),aa=d.createSlice({name:"formRevisionAttachments",initialState:lo,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,lo)),reducers:{initializeFormRevisionAttachments:Ae.initialize,addFormRevisionAttachment:Ae.addOne,addFormRevisionAttachments:Ae.addMany,setFormRevisionAttachment:Ae.setOne,setFormRevisionAttachments:Ae.setMany,updateFormRevisionAttachment:Ae.updateOne,updateFormRevisionAttachments:Ae.updateMany,deleteFormRevisionAttachment:Ae.deleteOne,deleteFormRevisionAttachments:Ae.deleteMany}}),{initializeFormRevisionAttachments:ho,addFormRevisionAttachment:ES,addFormRevisionAttachments:mo,setFormRevisionAttachment:VS,setFormRevisionAttachments:jS,updateFormRevisionAttachment:qS,updateFormRevisionAttachments:po,deleteFormRevisionAttachment:zS,deleteFormRevisionAttachments:Ao}=aa.actions,fo=t=>t.formRevisionAttachmentReducer.instances,US=y(d.createSelector([fo,(t,e)=>e],(t,e)=>I(Object.values(t).filter(i=>i.form_revision===e)))),yo=aa.reducer,fe=P(t=>t.uuid),So=fe.getInitialState({}),na=d.createSlice({name:"formRevisions",initialState:So,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,So)),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:Io,addFormRevision:ca,addFormRevisions:To,setFormRevision:go,setFormRevisions:DS,updateFormRevision:CS,updateFormRevisions:kS,deleteFormRevision:ra,deleteFormRevisions:bo}=na.actions,da=t=>t.formRevisionReducer.instances,ua=d.createSelector([da],t=>Object.values(t)),BS=t=>e=>e.formRevisionReducer.instances[t],GS=y(d.createSelector([ua,(t,e)=>e],(t,e)=>t.filter(i=>i.form===e).sort((i,a)=>i.submitted_at>a.submitted_at?-1:1)[0])),Fo=y(d.createSelector([ua,(t,e)=>e],(t,e)=>I(t.filter(i=>i.form===e)))),Po=na.reducer,ye=P(t=>t.uuid),Oo=ye.getInitialState({}),oa=d.createSlice({name:"forms",initialState:Oo,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Oo)),reducers:{initializeForms:ye.initialize,addForm:ye.addOne,addForms:ye.addMany,setForm:ye.setOne,setForms:ye.setMany,updateForm:ye.updateOne,updateForms:ye.updateMany,deleteForm:ye.deleteOne,deleteForms:ye.deleteMany}}),{initializeForms:_o,addForm:la,addForms:$S,setForm:LS,setForms:NS,updateForm:HS,updateForms:WS,deleteForm:ha,deleteForms:YS}=oa.actions,Ro=oa.reducer,vo=t=>t.formReducer.instances,wo=d.createSelector([vo],t=>Object.values(t)),Mo=t=>e=>e.formReducer.instances[t],KS=y(d.createSelector([wo,(t,e)=>e],(t,e)=>I(t.filter(i=>i.organization===e)))),Se=P(t=>t.uuid),Eo=Se.getInitialState({}),ma=d.createSlice({name:"formSubmissionAttachments",initialState:Eo,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,Eo)),reducers:{initializeFormSubmissionAttachments:Se.initialize,addFormSubmissionAttachment:Se.addOne,addFormSubmissionAttachments:Se.addMany,setFormSubmissionAttachment:Se.setOne,setFormSubmissionAttachments:Se.setMany,updateFormSubmissionAttachment:Se.updateOne,updateFormSubmissionAttachments:Se.updateMany,deleteFormSubmissionAttachment:Se.deleteOne,deleteFormSubmissionAttachments:Se.deleteMany}}),{initializeFormSubmissionAttachments:Vo,addFormSubmissionAttachment:ZS,addFormSubmissionAttachments:Bt,setFormSubmissionAttachment:JS,setFormSubmissionAttachments:XS,updateFormSubmissionAttachment:QS,updateFormSubmissionAttachments:jo,deleteFormSubmissionAttachment:xS,deleteFormSubmissionAttachments:Gt}=ma.actions,qo=t=>t.formSubmissionAttachmentReducer.instances,pa=d.createSelector([qo],t=>Object.values(t)),zo=y(d.createSelector([pa,(t,e)=>e],(t,e)=>{const i=new Set(e);return I(t.filter(a=>i.has(a.uuid)))})),Uo=y(d.createSelector([pa,(t,e)=>e],(t,e)=>I(t.filter(i=>i.form_submission===e)))),Do=ma.reducer,Ie=P(t=>t.uuid),Co=Ie.getInitialState({}),Aa=d.createSlice({name:"formSubmissions",initialState:Co,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,Co)),reducers:{initializeFormSubmissions:Ie.initialize,setFormSubmission:Ie.setOne,setFormSubmissions:Ie.setMany,addFormSubmission:Ie.addOne,addFormSubmissions:Ie.addMany,updateFormSubmission:Ie.updateOne,updateFormSubmissions:Ie.updateMany,deleteFormSubmission:Ie.deleteOne,deleteFormSubmissions:Ie.deleteMany}}),{initializeFormSubmissions:ko,setFormSubmission:$t,setFormSubmissions:eI,addFormSubmission:fa,addFormSubmissions:Lt,updateFormSubmission:Bo,updateFormSubmissions:tI,deleteFormSubmission:ya,deleteFormSubmissions:Nt}=Aa.actions,Sa=t=>t.formSubmissionReducer.instances,Ia=d.createSelector([Sa],t=>Object.values(t)),Ta=t=>e=>e.formSubmissionReducer.instances[t],Go=y(d.createSelector([Sa,da,(t,e)=>e],(t,e,i)=>{const a=new Set;for(const n of Object.values(e))n.form===i&&a.add(n.uuid);return Object.values(t).filter(n=>a.has(n.form_revision))})),$o=y(d.createSelector([Ia,(t,e)=>e],(t,e)=>Object.values(t).filter(i=>i.issue===e))),Lo=y(d.createSelector([Ia,(t,e)=>e],(t,e)=>t.filter(i=>i.asset===e))),No=Aa.reducer,Te=P(t=>t.uuid),Ho=Te.getInitialState({}),ga=d.createSlice({name:"geoImages",initialState:Ho,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,Ho)),reducers:{initializeGeoImages:Te.initialize,setGeoImage:Te.setOne,setGeoImages:Te.setMany,addGeoImage:Te.addOne,addGeoImages:Te.addMany,updateGeoImage:Te.updateOne,updateGeoImages:Te.updateMany,deleteGeoImage:Te.deleteOne,deleteGeoImages:Te.deleteMany}}),{initializeGeoImages:Wo,setGeoImage:pt,setGeoImages:Yo,addGeoImage:Ko,addGeoImages:Zo,updateGeoImage:Jo,updateGeoImages:sI,deleteGeoImage:ba,deleteGeoImages:Xo}=ga.actions,Qo=t=>t.geoImageReducer.instances,xo=d.createSelector([Qo],t=>Object.values(t)),Fa=t=>e=>e.geoImageReducer.instances[t],iI=y(d.createSelector([xo,(t,e)=>e],(t,e)=>I(t.filter(i=>i.project===e)))),el=ga.reducer,ge=P(t=>t.uuid),tl=ge.getInitialState({}),Pa=d.createSlice({name:"issueAssociations",initialState:tl,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,tl)),reducers:{initializeIssueAssociations:ge.initialize,addIssueAssociation:ge.addOne,addIssueAssociations:ge.addMany,setIssueAssociation:ge.setOne,setIssueAssociations:ge.setMany,updateIssueAssociation:ge.updateOne,updateIssueAssociations:ge.updateMany,deleteIssueAssociation:ge.deleteOne,deleteIssueAssociations:ge.deleteMany}}),{initializeIssueAssociations:sl,setIssueAssociations:aI,setIssueAssociation:nI,updateIssueAssociation:il,updateIssueAssociations:cI,addIssueAssociation:Oa,addIssueAssociations:_a,deleteIssueAssociation:Ra,deleteIssueAssociations:va}=Pa.actions,At=t=>t.issueAssociationReducer.instances,rI=d.createSelector([At],t=>Object.values(t)),al=t=>e=>e.issueAssociationReducer.instances[t],nl=y(d.createSelector([At,(t,e)=>e],(t,e)=>I(Object.values(t).filter(i=>i.associated_issue===e)))),cl=y(d.createSelector([At,(t,e)=>e],(t,e)=>I(Object.values(t).filter(i=>i.issue===e)))),rl=y(d.createSelector([At,(t,e)=>e],(t,e)=>I(Object.values(t).filter(i=>i.asset===e)))),dl=Pa.reducer,be=P(t=>t.uuid),ul=be.getInitialState({}),wa=d.createSlice({name:"issueAttachments",initialState:ul,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,ul)),reducers:{initializeIssueAttachments:be.initialize,addIssueAttachment:be.addOne,addIssueAttachments:be.addMany,setIssueAttachment:be.setOne,setIssueAttachments:be.setMany,updateIssueAttachment:be.updateOne,updateIssueAttachments:be.updateMany,deleteIssueAttachment:be.deleteOne,deleteIssueAttachments:be.deleteMany}}),{initializeIssueAttachments:Ma,addIssueAttachment:dI,addIssueAttachments:Ea,setIssueAttachment:ol,setIssueAttachments:uI,updateIssueAttachment:oI,updateIssueAttachments:ll,deleteIssueAttachment:hl,deleteIssueAttachments:Va}=wa.actions,ml=t=>t.issueAttachmentReducer.instances,pl=d.createSelector([ml],t=>Object.values(t)),Al=y(d.createSelector([pl,(t,e)=>e],(t,e)=>I(t.filter(({issue:i})=>e===i)))),fl=t=>e=>e.issueAttachmentReducer.instances[t],yl=wa.reducer,Fe=P(t=>t.uuid),Sl=Fe.getInitialState({}),ja=d.createSlice({name:"issueCommentAttachments",initialState:Sl,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,Sl)),reducers:{initializeIssueCommentAttachments:Fe.initialize,addIssueCommentAttachment:Fe.addOne,addIssueCommentAttachments:Fe.addMany,setIssueCommentAttachment:Fe.setOne,setIssueCommentAttachments:Fe.setMany,updateIssueCommentAttachment:Fe.updateOne,updateIssueCommentAttachments:Fe.updateMany,deleteIssueCommentAttachment:Fe.deleteOne,deleteIssueCommentAttachments:Fe.deleteMany}}),{initializeIssueCommentAttachments:qa,addIssueCommentAttachment:lI,addIssueCommentAttachments:Il,setIssueCommentAttachment:Tl,setIssueCommentAttachments:hI,updateIssueCommentAttachment:mI,updateIssueCommentAttachments:gl,deleteIssueCommentAttachment:bl,deleteIssueCommentAttachments:Fl}=ja.actions,Pl=t=>t.issueCommentAttachmentReducer.instances,Ol=d.createSelector([Pl],t=>Object.values(t)),_l=t=>e=>e.issueCommentAttachmentReducer.instances[t],pI=y(d.createSelector([Ol,(t,e)=>e],(t,e)=>I(t.filter(({issue_comment:i})=>e===i)))),Rl=ja.reducer,Pe=P(t=>t.uuid),vl=Pe.getInitialState({}),za=d.createSlice({name:"issueComments",initialState:vl,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,vl)),reducers:{initializeIssueComments:Pe.initialize,addIssueComment:Pe.addOne,addIssueComments:Pe.addMany,setIssueComment:Pe.setOne,setIssueComments:Pe.setMany,updateIssueComment:Pe.updateOne,updateIssueComments:Pe.updateMany,deleteIssueComment:Pe.deleteOne,deleteIssueComments:Pe.deleteMany}}),{initializeIssueComments:AI,addIssueComment:Ua,addIssueComments:fI,setIssueComment:Da,setIssueComments:wl,updateIssueComment:yI,updateIssueComments:SI,deleteIssueComment:Ca,deleteIssueComments:II}=za.actions,Ml=t=>t.issueCommentReducer.instances,ka=t=>e=>e.issueCommentReducer.instances[t],TI=y(d.createSelector([Ml,(t,e)=>e],(t,e)=>I(Object.values(t).filter(i=>i.issue===e)))),El=za.reducer,Oe=P(t=>t.uuid),Vl=Oe.getInitialState({}),Ba=d.createSlice({name:"issues",initialState:Vl,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,Vl)),reducers:{initializeIssues:Oe.initialize,addIssue:Oe.addOne,addIssues:Oe.addMany,setIssue:Oe.setOne,setIssues:Oe.setMany,updateIssue:Oe.updateOne,updateIssues:Oe.updateMany,deleteIssue:Oe.deleteOne,deleteIssues:Oe.deleteMany}}),{initializeIssues:jl,addIssue:Ga,addIssues:ql,setIssue:gI,setIssues:bI,updateIssue:Ht,updateIssues:FI,deleteIssue:$a,deleteIssues:zl}=Ba.actions,La=t=>t.issueReducer.instances,Na=d.createSelector([La],t=>Object.values(t)),Ha=t=>e=>e.issueReducer.instances[t],PI=y(d.createSelector([La,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n?i.push(n):console.warn("selectIssuesByIds: No issue exists with the id",a)}return I(i)})),OI=y(d.createSelector([Na,(t,e)=>e],(t,e)=>t.filter(i=>i.project===e))),Ul=y(d.createSelector([Na,(t,e)=>e],(t,e)=>t.filter(i=>i.issue_type===e))),Dl=Ba.reducer,_e=P(t=>t.uuid),Cl=_e.getInitialState({}),Wa=d.createSlice({name:"issueTypeAttachments",initialState:Cl,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Cl)),reducers:{initializeIssueTypeAttachments:_e.initialize,addIssueTypeAttachment:_e.addOne,addIssueTypeAttachments:_e.addMany,setIssueTypeAttachment:_e.setOne,setIssueTypeAttachments:_e.setMany,updateIssueTypeAttachment:_e.updateOne,updateIssueTypeAttachments:_e.updateMany,deleteIssueTypeAttachment:_e.deleteOne,deleteIssueTypeAttachments:_e.deleteMany}}),{initializeIssueTypeAttachments:Ya,addIssueTypeAttachment:_I,addIssueTypeAttachments:kl,setIssueTypeAttachment:Bl,setIssueTypeAttachments:RI,updateIssueTypeAttachment:vI,updateIssueTypeAttachments:Gl,deleteIssueTypeAttachment:$l,deleteIssueTypeAttachments:Ll}=Wa.actions,Nl=t=>t.issueTypeAttachmentReducer.instances,Hl=d.createSelector([Nl],t=>Object.values(t)),Wl=t=>e=>e.issueTypeAttachmentReducer.instances[t],wI=y(d.createSelector([Hl,(t,e)=>e],(t,e)=>I(t.filter(({issue_type:i})=>e===i)))),Yl=Wa.reducer,Re=P(t=>t.uuid),Kl=Re.getInitialState({}),Ka=d.createSlice({name:"issueTypeFieldsAttachments",initialState:Kl,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Kl)),reducers:{initializeIssueTypeFieldsAttachments:Re.initialize,addIssueTypeFieldsAttachment:Re.addOne,addIssueTypeFieldsAttachments:Re.addMany,setIssueTypeFieldsAttachment:Re.setOne,setIssueTypeFieldsAttachments:Re.setMany,updateIssueTypeFieldsAttachment:Re.updateOne,updateIssueTypeFieldsAttachments:Re.updateMany,deleteIssueTypeFieldsAttachment:Re.deleteOne,deleteIssueTypeFieldsAttachments:Re.deleteMany}}),{initializeIssueTypeFieldsAttachments:Zl,addIssueTypeFieldsAttachment:MI,addIssueTypeFieldsAttachments:Jl,setIssueTypeFieldsAttachment:EI,setIssueTypeFieldsAttachments:VI,updateIssueTypeFieldsAttachment:jI,updateIssueTypeFieldsAttachments:Xl,deleteIssueTypeFieldsAttachment:qI,deleteIssueTypeFieldsAttachments:Ql}=Ka.actions,xl=t=>t.issueTypeFieldsAttachmentReducer.instances,eh=d.createSelector([xl],t=>Object.values(t)),zI=y(d.createSelector([eh,(t,e)=>e],(t,e)=>I(t.filter(i=>i.fields_revision===e)))),UI=t=>e=>e.issueTypeFieldsAttachmentReducer.instances[t],th=Ka.reducer,ve=P(t=>t.uuid),sh=ve.getInitialState({}),Za=d.createSlice({name:"issueTypeFieldValues",initialState:sh,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,sh)),reducers:{initializeIssueTypeFieldValues:ve.initialize,addIssueTypeFieldValues:ve.addOne,addIssueTypeFieldValuesMany:ve.addMany,setIssueTypeFieldValues:ve.setOne,setIssueTypeFieldValuesMany:ve.setMany,updateIssueTypeFieldValues:ve.updateOne,updateIssueTypeFieldValuesMany:ve.updateMany,deleteIssueTypeFieldValues:ve.deleteOne,deleteIssueTypeFieldValuesMany:ve.deleteMany}}),{initializeIssueTypeFieldValues:ih,addIssueTypeFieldValues:Ja,addIssueTypeFieldValuesMany:DI,setIssueTypeFieldValues:CI,setIssueTypeFieldValuesMany:kI,updateIssueTypeFieldValues:ft,updateIssueTypeFieldValuesMany:BI,deleteIssueTypeFieldValues:Xa,deleteIssueTypeFieldValuesMany:GI}=Za.actions,ah=t=>t.issueTypeFieldValuesReducer.instances,Qa=d.createSelector([ah],t=>Object.values(t)),$I=y(d.createSelector([Qa,(t,e)=>e],(t,e)=>I(t.filter(i=>i.issue===e)))),xa=t=>e=>e.issueTypeFieldValuesReducer.instances[t],nh=Za.reducer,we=P(t=>t.uuid),ch=we.getInitialState({}),en=d.createSlice({name:"issueTypeFields",initialState:ch,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,ch)),reducers:{initializeIssueTypeFields:we.initialize,addIssueTypeFields:we.addOne,addIssueTypeFieldsMany:we.addMany,setIssueTypeFields:we.setOne,setIssueTypeFieldsMany:we.setMany,updateIssueTypeFields:we.updateOne,updateIssueTypeFieldsMany:we.updateMany,deleteIssueTypeFields:we.deleteOne,deleteIssueTypeFieldsMany:we.deleteMany}}),{initializeIssueTypeFields:rh,addIssueTypeFields:dh,addIssueTypeFieldsMany:LI,setIssueTypeFields:NI,setIssueTypeFieldsMany:HI,updateIssueTypeFields:uh,updateIssueTypeFieldsMany:WI,deleteIssueTypeFields:oh,deleteIssueTypeFieldsMany:YI}=en.actions,lh=t=>t.issueTypeFieldsReducer.instances,Wt=d.createSelector([lh],t=>Object.values(t)),KI=y(d.createSelector([Wt,(t,e)=>e],(t,e)=>I(t.filter(i=>i.issue_type===e)))),ZI=y(d.createSelector([Wt,(t,e)=>e],(t,e)=>t.filter(i=>i.issue_type===e).sort((i,a)=>i.submitted_at>a.submitted_at?-1:1)[0])),JI=y(d.createSelector([Wt,Qa,(t,e)=>e],(t,e,i)=>{const a=new Set(t.filter(n=>n.issue_type===i).map(n=>n.uuid));return I(e.filter(n=>a.has(n.fields_revision)))})),XI=t=>e=>e.issueTypeFieldsReducer.instances[t],hh=en.reducer,Me=P(t=>t.uuid),mh=Me.getInitialState({}),tn=d.createSlice({name:"issueTypeFieldValuesAttachments",initialState:mh,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,mh)),reducers:{initializeIssueTypeFieldValuesAttachments:Me.initialize,addIssueTypeFieldValuesAttachment:Me.addOne,addIssueTypeFieldValuesAttachments:Me.addMany,setIssueTypeFieldValuesAttachment:Me.setOne,setIssueTypeFieldValuesAttachments:Me.setMany,updateIssueTypeFieldValuesAttachment:Me.updateOne,updateIssueTypeFieldValuesAttachments:Me.updateMany,deleteIssueTypeFieldValuesAttachment:Me.deleteOne,deleteIssueTypeFieldValuesAttachments:Me.deleteMany}}),{initializeIssueTypeFieldValuesAttachments:ph,addIssueTypeFieldValuesAttachment:QI,addIssueTypeFieldValuesAttachments:Yt,setIssueTypeFieldValuesAttachment:xI,setIssueTypeFieldValuesAttachments:eT,updateIssueTypeFieldValuesAttachment:tT,updateIssueTypeFieldValuesAttachments:Ah,deleteIssueTypeFieldValuesAttachment:sT,deleteIssueTypeFieldValuesAttachments:Kt}=tn.actions,fh=t=>t.issueTypeFieldValuesAttachmentReducer.instances,sn=d.createSelector([fh],t=>Object.values(t)),iT=t=>e=>e.issueTypeFieldValuesAttachmentReducer.instances[t],yh=y(d.createSelector([sn,(t,e)=>e],(t,e)=>{const i=new Set(e);return I(t.filter(a=>i.has(a.uuid)))})),Sh=y(d.createSelector([sn,(t,e)=>e],(t,e)=>I(t.filter(i=>i.field_values===e)))),Ih=tn.reducer,Ee=P(t=>t.uuid),Th=Ee.getInitialState({}),an=d.createSlice({name:"issueTypeIdentifiers",initialState:Th,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Th)),reducers:{initializeIssueTypeIdentifiers:Ee.initialize,addIssueTypeIdentifier:Ee.addOne,addIssueTypeIdentifiers:Ee.addMany,setIssueTypeIdentifier:Ee.setOne,setIssueTypeIdentifiers:Ee.setMany,updateIssueTypeIdentifier:Ee.updateOne,updateIssueTypeIdentifiers:Ee.updateMany,deleteIssueTypeIdentifier:Ee.deleteOne,deleteIssueTypeIdentifiers:Ee.deleteMany}}),{initializeIssueTypeIdentifiers:gh,addIssueTypeIdentifier:nn,addIssueTypeIdentifiers:aT,setIssueTypeIdentifier:nT,setIssueTypeIdentifiers:cT,updateIssueTypeIdentifier:yt,updateIssueTypeIdentifiers:rT,deleteIssueTypeIdentifier:cn,deleteIssueTypeIdentifiers:dT}=an.actions,bh=t=>t.issueTypeIdentifierReducer.instances,Fh=d.createSelector([bh],t=>Object.values(t)),rn=t=>e=>e.issueTypeIdentifierReducer.instances[t],uT=y(d.createSelector([Fh,(t,e)=>e],(t,e)=>I(t.filter(i=>i.issue_type===e)))),Ph=an.reducer,Ve=P(t=>t.uuid),Oh=Ve.getInitialState({}),dn=d.createSlice({name:"issueTypeIdentifierValues",initialState:Oh,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,Oh)),reducers:{initializeIssueTypeIdentifierValues:Ve.initialize,addIssueTypeIdentifierValue:Ve.addOne,addIssueTypeIdentifierValues:Ve.addMany,setIssueTypeIdentifierValue:Ve.setOne,setIssueTypeIdentifierValues:Ve.setMany,updateIssueTypeIdentifierValue:Ve.updateOne,updateIssueTypeIdentifierValues:Ve.updateMany,deleteIssueTypeIdentifierValue:Ve.deleteOne,deleteIssueTypeIdentifierValues:Ve.deleteMany}}),{initializeIssueTypeIdentifierValues:_h,addIssueTypeIdentifierValue:un,addIssueTypeIdentifierValues:oT,setIssueTypeIdentifierValue:lT,setIssueTypeIdentifierValues:hT,updateIssueTypeIdentifierValue:St,updateIssueTypeIdentifierValues:mT,deleteIssueTypeIdentifierValue:on,deleteIssueTypeIdentifierValues:pT}=dn.actions,Rh=t=>t.issueTypeIdentifierValueReducer.instances,ln=d.createSelector([Rh],t=>Object.values(t)),hn=t=>e=>e.issueTypeIdentifierValueReducer.instances[t],AT=y(d.createSelector([ln,(t,e)=>e],(t,e)=>I(t.filter(i=>i.issue===e)))),fT=y(d.createSelector([ln,(t,e)=>e],(t,e)=>I(t.filter(i=>i.issue_type_identifier===e)))),vh=dn.reducer,C=P(t=>t.uuid),wh=C.getInitialState({}),mn=d.createSlice({name:"issueTypes",initialState:wh,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,wh)),reducers:{initializeIssueTypes:C.initialize,addIssueType:C.addOne,addIssueTypes:C.addMany,setIssueType:C.setOne,setIssueTypes:C.setMany,updateIssueType:C.updateOne,updateIssueTypes:C.updateMany,deleteIssueType:C.deleteOne,deleteIssueTypes:C.deleteMany,removeIssueType:C.deleteOne}}),{initializeIssueTypes:Mh,addIssueType:Eh,addIssueTypes:yT,setIssueType:It,setIssueTypes:ST,updateIssueType:Vh,updateIssueTypes:IT,deleteIssueType:TT,deleteIssueTypes:gT,removeIssueType:pn}=mn.actions,An=t=>t.issueTypeReducer.instances,jh=d.createSelector(An,t=>Object.values(t)),fn=t=>e=>e.issueTypeReducer.instances[t],bT=y(d.createSelector([An,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n?i.push(n):console.warn("selectIssueTypesByIds: No issue type exists with the id",a)}return i})),FT=y(d.createSelector([jh,(t,e)=>e],(t,e)=>I(t.filter(i=>i.organization===e)))),qh=mn.reducer,je=P(t=>t.uuid),zh=je.getInitialState({}),yn=d.createSlice({name:"issueUpdates",initialState:zh,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,zh)),reducers:{initializeIssueUpdates:je.initialize,addIssueUpdate:je.addOne,addIssueUpdates:je.addMany,setIssueUpdate:je.setOne,setIssueUpdates:je.setMany,updateIssueUpdate:je.updateOne,updateIssueUpdates:je.updateMany,deleteIssueUpdate:je.deleteOne,deleteIssueUpdates:je.deleteMany}}),{initializeIssueUpdates:Uh,addIssueUpdate:Dh,addIssueUpdates:Ch,setIssueUpdate:PT,setIssueUpdates:OT,updateIssueUpdate:_T,updateIssueUpdates:RT,deleteIssueUpdate:kh,deleteIssueUpdates:Bh}=yn.actions,Gh=t=>t.issueUpdateReducer.instances,$h=d.createSelector([Gh],t=>Object.values(t)),Lh=y(d.createSelector([$h,(t,e)=>e],(t,e)=>I(t.filter(i=>i.issue===e)))),Nh=yn.reducer,qe=P(t=>t.id),Hh=qe.getInitialState({currentUser:null}),Sn=d.createSlice({name:"users",initialState:Hh,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Hh)),reducers:{initializeUsers:qe.initialize,setUsers:qe.setMany,setUser:qe.setOne,addUsers:qe.addMany,addUser:qe.addOne,updateUsers:qe.updateMany,updateUser:qe.updateOne,deleteUser:qe.deleteOne,deleteUsers:qe.deleteMany,setCurrentUser:(t,e)=>{t.currentUser=e.payload},setProfilePicture:(t,e)=>{if(!t.currentUser)return;t.currentUser.profile.file=e.payload.file??null,t.currentUser.profile.file_sha1=e.payload.file_sha1??null;const i=t.instances[t.currentUser.id];if(!i)throw new Error("Unable to find current user in users slice");i.profile.file=e.payload.file??null,i.profile.file_sha1=e.payload.file_sha1??null}}}),{initializeUsers:Wh,setUsers:vT,setUser:wT,addUsers:MT,addUser:Yh,updateUsers:ET,updateUser:VT,deleteUser:Kh,deleteUsers:jT,setCurrentUser:qT,setProfilePicture:zT}=Sn.actions,Zh=Sn.reducer,Jh=t=>t.userReducer.currentUser,Zt=t=>t.userReducer.instances,In=d.createSelector([Zt],t=>Object.values(t)),Xh=t=>e=>e.userReducer.instances[t],UT=y(d.createSelector([Zt,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n?i.push(n):console.warn("selectUsersByIds: No user exists with the id",a)}return I(i)})),ze=P(t=>t.uuid),Qh=ze.getInitialState({}),Tn=d.createSlice({name:"organizationAccess",initialState:Qh,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Qh)),reducers:{initializeOrganizationAccesses:ze.initialize,addOrganizationAccess:ze.addOne,addOrganizationAccesses:ze.addMany,setOrganizationAccess:ze.setOne,setOrganizationAccesses:ze.setMany,updateOrganizationAccess:ze.updateOne,updateOrganizationAccesses:ze.updateMany,deleteOrganizationAccess:ze.deleteOne,deleteOrganizationAccesses:ze.deleteMany}}),{initializeOrganizationAccesses:xh,addOrganizationAccess:em,addOrganizationAccesses:DT,setOrganizationAccess:CT,setOrganizationAccesses:kT,updateOrganizationAccess:Jt,updateOrganizationAccesses:BT,deleteOrganizationAccess:tm,deleteOrganizationAccesses:GT}=Tn.actions,sm=Tn.reducer,gn=t=>t.organizationAccessReducer.instances,bn=t=>e=>e.organizationAccessReducer.instances[t],$T=d.createSelector([Jh,gn],(t,e)=>Object.values(e).find(a=>a.user===(t==null?void 0:t.id))??null),im=d.createSelector([gn],t=>{const e={};for(const i of Object.values(t))e[i.user]=i;return Pt(e)}),LT=y(d.createSelector([Zt,im,(t,e)=>e],(t,e,i)=>I(Object.values(t).filter(a=>{const n=e[a.id];return!!n&&n.organization===i})))),Ue=P(t=>t.uuid),am=Ue.getInitialState({}),Fn=d.createSlice({name:"organizations",initialState:am,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,am)),reducers:{initializeOrganizations:Ue.initialize,setOrganizations:Ue.setMany,setOrganization:Ue.setOne,addOrganizations:Ue.addMany,addOrganization:Ue.addOne,updateOrganizations:Ue.updateMany,updateOrganization:Ue.updateOne,deleteOrganization:Ue.deleteOne,deleteOrganizations:Ue.deleteMany}}),{initializeOrganizations:nm,setOrganizations:NT,setOrganization:HT,addOrganizations:WT,addOrganization:cm,updateOrganizations:YT,updateOrganization:rm,deleteOrganization:KT,deleteOrganizations:ZT}=Fn.actions,dm=t=>t.organizationReducer.instances,JT=d.createSelector([dm],t=>Object.values(t)),XT=t=>e=>e.organizationReducer.instances[t],um=Fn.reducer,om=(t,e,i)=>{const a=t.uuid?t:{...t,uuid:Je.v4()};return{payload:a,type:"",meta:{offline:{effect:{timestamp:new Date().toISOString(),request:a,BASE_URL:e,serviceName:i}}}}},lm={deletedRequests:[],latestRetryTime:0},Pn=d.createSlice({name:"outbox",initialState:lm,extraReducers:t=>t.addCase(g,e=>Object.assign(e,lm)),reducers:{enqueueRequest:{reducer:(t,e)=>t,prepare:t=>{console.debug("Preparing to enqueue request",t);const{BASE_URL:e,serviceName:i,...a}=t;return om(a,e,i)}},markForDeletion(t,e){t.deletedRequests.push(e.payload)},markAsDeleted(t,e){const i=t.deletedRequests.indexOf(e.payload);i!==-1&&t.deletedRequests.splice(i,1)},_setLatestRetryTime:(t,e)=>{t.latestRetryTime=e.payload}}}),QT=t=>t.outboxReducer.deletedRequests,xT=t=>t.outboxReducer.latestRetryTime,{enqueueRequest:hm,markForDeletion:eg,markAsDeleted:mm,_setLatestRetryTime:pm}=Pn.actions,Am=Pn.reducer,De=P(t=>t.uuid),fm=De.getInitialState({}),On=d.createSlice({name:"projectAccess",initialState:fm,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,fm)),reducers:{initializeProjectAccesses:De.initialize,addProjectAccess:De.addOne,addProjectAccesses:De.addMany,setProjectAccess:De.setOne,setProjectAccesses:De.setMany,updateProjectAccess:De.updateOne,updateProjectAccesses:De.updateMany,deleteProjectAccess:De.deleteOne,deleteProjectAccesses:De.deleteMany}}),{initializeProjectAccesses:ym,addProjectAccess:_n,addProjectAccesses:Rn,setProjectAccess:tg,setProjectAccesses:sg,updateProjectAccess:Tt,updateProjectAccesses:Sm,deleteProjectAccess:vn,deleteProjectAccesses:wn}=On.actions,Im=On.reducer,Mn=t=>t.projectAccessReducer.instances,Xt=d.createSelector(Mn,t=>Object.values(t)),En=t=>e=>e.projectAccessReducer.instances[t],Tm=y(d.createSelector([Mn,(t,e)=>e],(t,e)=>I(Object.values(t).filter(i=>i.project===e)))),ig=y(d.createSelector([Xt,(t,e)=>e],(t,e)=>{const i={};for(const a of t.filter(n=>n.project===e))i[a.user]=a;return i})),ag=y(d.createSelector([In,Xt,(t,e)=>e],(t,e,i)=>{const a=new Set(e.filter(n=>n.project===i).map(n=>n.user));return I(t.filter(n=>a.has(n.id)))})),Ce=P(t=>t.uuid),gm=Ce.getInitialState({}),Vn=d.createSlice({name:"projectAttachments",initialState:gm,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,gm)),reducers:{initializeProjectAttachments:Ce.initialize,addProjectAttachment:Ce.addOne,addProjectAttachments:Ce.addMany,setProjectAttachment:Ce.setOne,setProjectAttachments:Ce.setMany,updateProjectAttachment:Ce.updateOne,updateProjectAttachments:Ce.updateMany,deleteProjectAttachment:Ce.deleteOne,deleteProjectAttachments:Ce.deleteMany}}),{initializeProjectAttachments:bm,addProjectAttachment:ng,addProjectAttachments:Fm,setProjectAttachment:Pm,setProjectAttachments:Om,updateProjectAttachment:cg,updateProjectAttachments:_m,deleteProjectAttachment:Rm,deleteProjectAttachments:jn}=Vn.actions,vm=t=>t.projectAttachmentReducer.instances,wm=d.createSelector([vm],t=>Object.values(t)),Mm=t=>e=>e.projectAttachmentReducer.instances[t],Em=y(d.createSelector([wm,(t,e)=>e],(t,e)=>I(t.filter(({project:i})=>e===i)))),Vm=Vn.reducer,ke=P(t=>t.uuid),jm=ke.getInitialState({activeProjectFileId:null,isImportingProjectFile:!1}),qn=d.createSlice({name:"projectFiles",initialState:jm,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,jm)),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,e)=>{t.isImportingProjectFile=e.payload},saveActiveProjectFileBounds:(t,e)=>{const i=t.activeProjectFileId;if(!i)throw new Error("Tried to save bounds for active project file, but no active project file was set.");if(!t.instances[i])throw new Error(`Tried to save bounds for active project file, but project file with ID ${i}
|
|
2
|
-
doesn't exist.`);t.instances[i].bounds=e.payload},setActiveProjectFileId:(t,e)=>{t.activeProjectFileId=e.payload},resetProjectFileObjectUrls:(t,...e)=>{for(const i in t.instances)delete t.instances[i].objectURL}}}),{initializeProjectFiles:qm,setProjectFile:rg,setProjectFiles:dg,addProjectFile:ug,addProjectFiles:zm,updateProjectFile:zn,updateProjectFiles:og,deleteProjectFile:Um,deleteProjectFiles:Dm,setIsImportingProjectFile:Cm,setActiveProjectFileId:km,saveActiveProjectFileBounds:Bm,resetProjectFileObjectUrls:lg}=qn.actions,Gm=t=>t.projectFileReducer.instances,$m=d.createSelector([Gm],t=>I(Object.values(t).sort((e,i)=>e.z_index-i.z_index))),hg=t=>e=>e.projectFileReducer.instances[t],mg=t=>t.projectFileReducer.activeProjectFileId,pg=t=>t.projectFileReducer.isImportingProjectFile,Lm=qn.reducer,Be=P(t=>t.uuid),Nm=Be.getInitialState({}),Un=d.createSlice({name:"projects",initialState:Nm,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Nm)),reducers:{initializeProjects:Be.initialize,setProjects:Be.setMany,setProject:Be.setOne,addProjects:Be.addMany,addProject:Be.addOne,updateProjects:Be.updateMany,updateProject:Be.updateOne,deleteProject:Be.deleteOne,deleteProjects:Be.deleteMany}}),{initializeProjects:Hm,setProjects:Ag,setProject:fg,addProjects:yg,addProject:Dn,updateProjects:Sg,updateProject:Wm,deleteProject:Cn,deleteProjects:Ig}=Un.actions,Ym=Un.reducer,Km=t=>t.projectReducer.instances,kn=d.createSelector([Km],t=>I(Object.values(t))),Zm=t=>e=>e.projectReducer.instances[t],Tg=y(d.createSelector([kn,Xt,(t,e)=>e],(t,e,i)=>{const a=new Set(e.filter(n=>n.user===i).map(n=>n.project));return I(t.filter(n=>a.has(n.uuid)))})),gg=y(d.createSelector([kn,(t,e)=>e],(t,e)=>I(t.filter(i=>i.organization===e)))),bg={isRehydrated:!1},Bn=d.createSlice({name:"rehydrated",initialState:bg,reducers:{setRehydrated:(t,e)=>{t.isRehydrated=e.payload}}}),{setRehydrated:Fg}=Bn.actions,Pg=t=>t.rehydratedReducer.isRehydrated,Jm=Bn.reducer,Ge=P(t=>t.uuid),Xm=Ge.getInitialState({}),Gn=d.createSlice({name:"teamMemberships",initialState:Xm,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Xm)),reducers:{initializeTeamMemberships:Ge.initialize,addTeamMembership:Ge.addOne,addTeamMemberships:Ge.addMany,setTeamMembership:Ge.setOne,setTeamMemberships:Ge.setMany,updateTeamMembership:Ge.updateOne,updateTeamMemberships:Ge.updateMany,deleteTeamMembership:Ge.deleteOne,deleteTeamMemberships:Ge.deleteMany}}),{initializeTeamMemberships:Qm,addTeamMembership:xm,addTeamMemberships:ep,setTeamMembership:$n,setTeamMemberships:tp,updateTeamMembership:Og,updateTeamMemberships:_g,deleteTeamMembership:Ln,deleteTeamMemberships:sp}=Gn.actions,ip=Gn.reducer,ap=t=>t.teamMembershipReducer.instances,Nn=d.createSelector([ap],t=>Object.values(t)),np=t=>e=>e.teamMembershipReducer.instances[t],Rg=y(d.createSelector([Nn,(t,e)=>e],(t,e)=>{const i={};for(const a of t.filter(n=>n.team===e))i[a.user]=a;return i})),vg=y(d.createSelector([In,Nn,(t,e)=>e],(t,e,i)=>{const a=new Set(e.filter(n=>n.team===i).map(n=>n.user));return I(t.filter(n=>a.has(n.id)))})),$e=P(t=>t.uuid),cp=$e.getInitialState({}),Hn=d.createSlice({name:"teams",initialState:cp,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,cp)),reducers:{initializeTeams:$e.initialize,addTeam:$e.addOne,addTeams:$e.addMany,setTeam:$e.setOne,setTeams:$e.setMany,updateTeam:$e.updateOne,updateTeams:$e.updateMany,deleteTeam:$e.deleteOne,deleteTeams:$e.deleteMany}}),{initializeTeams:rp,addTeam:dp,addTeams:wg,setTeam:gt,setTeams:Mg,updateTeam:up,updateTeams:Eg,deleteTeam:Wn,deleteTeams:Vg}=Hn.actions,Yn=t=>t.teamReducer.instances,op=d.createSelector([Yn],t=>Object.values(t)),Kn=t=>e=>e.teamReducer.instances[t],jg=y(d.createSelector([Yn,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n?i.push(n):console.warn("selectTeamsByIds: No team exists with the id",a)}return I(i)})),qg=y(d.createSelector([op,(t,e)=>e],(t,e)=>I(t.filter(i=>i.organization===e)))),lp=Hn.reducer,zg={version:0},hp=d.createSlice({name:"versioning",initialState:zg,reducers:{}}),mp=hp.reducer,Zn={outboxReducer:Am,fileReducer:eo,authReducer:Tu},Ug=d.combineReducers(Zn),pp={...Zn,[tt]:mp,categoryReducer:_u,assetReducer:rd,assetAttachmentReducer:Mc,assetStageCompletionReducer:hd,assetStageReducer:Sd,assetTypeReducer:yu,assetTypeAttachmentReducer:wd,issueReducer:Dl,issueAttachmentReducer:yl,issueTypeReducer:qh,issueTypeAttachmentReducer:Yl,organizationReducer:um,projectReducer:Ym,projectAttachmentReducer:Vm,projectAccessReducer:Im,organizationAccessReducer:sm,projectFileReducer:Lm,rehydratedReducer:Jm,formReducer:Ro,formRevisionReducer:Po,formRevisionAttachmentReducer:yo,formSubmissionAttachmentReducer:Do,formSubmissionReducer:No,formIdentifierReducer:no,formIdentifierValueReducer:oo,userReducer:Zh,emailDomainsReducer:Zu,documentsReducer:$u,documentAttachmentReducer:Du,teamReducer:lp,agentsReducer:gc,issueCommentReducer:El,issueCommentAttachmentReducer:Rl,issueUpdateReducer:Nh,geoImageReducer:el,issueAssociationReducer:dl,issueTypeFieldsReducer:hh,issueTypeFieldValuesReducer:nh,issueTypeFieldsAttachmentReducer:th,issueTypeFieldValuesAttachmentReducer:Ih,issueTypeIdentifierReducer:Ph,issueTypeIdentifierValueReducer:vh,assetTypeFieldsReducer:Nd,assetTypeFieldValuesReducer:au,assetTypeFieldsAttachmentReducer:Dd,assetTypeFieldValuesAttachmentReducer:Xd,assetTypeIdentifierReducer:uu,assetTypeIdentifierValueReducer:mu,assetProcedureReducer:Or,assetProcedureInstanceReducer:gr,assetProcedureFieldsReducer:sr,assetProcedureFieldValuesReducer:Ar,assetProcedureFieldsAttachmentReducer:Zc,assetProcedureFieldValuesAttachmentReducer:ur,assetProcedureAttachmentReducer:Cc,assetProcedureStepFieldsAttachmentReducer:qr,assetProcedureStepFieldsReducer:Dr,assetProcedureStepFieldValuesAttachmentReducer:Nr,assetProcedureStepFieldValuesReducer:Xr,assetProcedureStepReducer:td,teamMembershipReducer:ip},Dg=d.combineReducers(pp);function Cg(t,e){return Ep.useMemo(t,e)}class kg{constructor(e){S(this,"operations",[]);S(this,"getData");this.getData=e}performOperations(e){let i=e;for(const a of this.operations)i=a(i);return i}filter(e,i){return this.operations.push(a=>a.filter(n=>n[e]===i)),this}exclude(e,i){return this.operations.push(a=>a.filter(n=>n[e]!==i)),this}orderBy(e){return this.operations.push(i=>[...i].sort((a,n)=>a[e]<=n[e]?1:-1)),this}reverse(){return this.operations.push(e=>[...e].reverse()),this}all(){return this.operations.push(e=>e),this}get(e,i){return d.createSelector([this.getData],a=>this.performOperations(a).find(n=>n[e]===i))}count(){return d.createSelector([this.getData],e=>this.performOperations(e).length)}first(){return d.createSelector([this.getData],e=>this.performOperations(e)[0])}last(){return d.createSelector([this.getData],e=>{const i=this.performOperations(e);return i[i.length-1]})}exists(){return d.createSelector([this.getData],e=>this.performOperations(e).length>0)}toSelector(){return d.createSelector([this.getData],e=>I(this.performOperations(e)))}}let Ap;function Bg(t){Ap=t}function bt(){return Ap}let fp;function Gg(t){fp=t}function $g(){return fp}const yp={};class Sp{constructor(e){S(this,"client");yp[this.constructor.name]=this,this.client=e}async enqueueRequest(e,i){return this.client.enqueueRequest(e,this.host,this.constructor.name,i)}async performPagination(e,i,a){const n=[];let c=await this.client.enqueueRequest(e,this.host,this.constructor.name,a);for(n.push(c.results);c.next;)c=await this.client.enqueueRequest(i(c.next),this.host,this.constructor.name,a),n.push(c.results);return n}dispatch(e){this.client.store.dispatch(e)}}const Ip=()=>bp.length-1,Tp=t=>(t[tt]={version:Ip()},t),gp=()=>Tp({}),Lg=t=>(t.outboxReducer&&(t.outboxReducer.deletedRequests=[]),t),Ng=t=>e=>{var i;return e===void 0&&(e={}),((i=e[tt])==null?void 0:i.version)===Ip()?e:t(e)},bp=[Tp,gp,gp,Lg],Hg=Object.fromEntries(bp.map((t,e)=>[e,Ng(t)]));let Jn=null;function Ye(){const t=bt();if(!t)return console.warn("Client store not set; cannot get outbox coordinator yet."),null;if(Jn)return Jn;const e=t.getState().offline.outbox,i=et._fromOutbox(e);return Jn=i,i}const Wg=t=>{if(t)throw t;const e=bt();e?e.dispatch({type:"rehydrated/setRehydrated",payload:!0}):console.error("Client store not set")},Fp=(t,e,i)=>{const a=Ye();return a?(a.addRequest(e),a.getQueue()):(console.warn("Outbox coordinator not set; cannot enqueue request yet."),[])},Pp=(t,e,i)=>{const a=Ye();if(!a)return console.warn("Outbox coordinator not set; cannot dequeue request yet."),[];const c=e.meta.offlineAction.payload.uuid;return a.remove(c),a.getQueue()};async function Yg(t,e){if(!e.payload)throw new Error("Received empty payload");return sb(e)}const Kg={...sc,effect:Yg,discard:Qn,returnPromises:!0,persistCallback:Wg,retry:ab,persistOptions:{storage:jp},queue:{...sc.queue,enqueue:Fp,dequeue:Pp,peek:(...t)=>ib(...t)}},Zg=qp(Hg,tt),Jg=d.compose(Vp.offline(Kg),Zg);function Xg(t){function e(i){return typeof i=="object"&&i!==null&&["ok","redirect","clientError","serverError","error"].every(n=>n in i)}if(e(t))return t;if(typeof t=="object"&&t!==null){const i=t;if(e(i.response))return i.response;if(i.response&&e(i.response.response))return i.response.response}}async function Xn(t,e,i){const a=yp[t.meta.offline.effect.serviceName];if(!a)throw new Error(`Service ${t.meta.offline.effect.serviceName} not found`);const n=a instanceof R;if(e.store.getState().outboxReducer.deletedRequests.includes(t.payload.uuid))throw new Error("Request was marked for deletion");n&&t.payload.checkAuth!==!1&&await a.auth.prepareAuth();const r={queryParams:"",isAuthNeeded:!0},u=t.meta.offline.effect,{payload:m,headers:o,method:h,queryParams:p,attachmentHash:A,isExternalUrl:f,isAuthNeeded:T,isResponseBlob:F}={...r,...u.request},_=u.request;let w=_.url;const z=A?await e.files.fetchCache(A):void 0;if(A&&!z)throw new Error(`Cannot upload file ${A} because it's not cached.`);!f&&!w.startsWith("http")&&(!w.startsWith("/")&&!w.startsWith("blob:")&&(w="/"+w),w=t.meta.offline.effect.BASE_URL+w);const Le=q=>{if(A){const Ne=_.s3url;if(!Ne)throw new Error(`No S3 URL for file ${A}`);if("warning"in Ne)throw new Error(`S3 URL warning for file ${A}`);if(!z)throw new Error(`No file for file ${A}`);const Ft=Ne.fields["x-amz-checksum-sha1"];if(!Ft)throw new Error(`No checksum for file ${A}`);return q.set("x-amz-checksum-sha1",Ft).field({...m,...Ne.fields}).attach("file",z)}return q.send(m)},PF={[l.GET]:()=>F?Ze.get(w.toString()).responseType("blob"):Ze.get(w.toString()),[l.POST]:()=>{const q=Ze.post(w.toString());return Le(q)},[l.PATCH]:()=>{const q=Ze.patch(w.toString());return Le(q)},[l.PUT]:()=>{const q=Ze.put(w.toString());return Le(q)},[l.DELETE]:()=>{const q=Ze.delete(w.toString());return Le(q)}}[h];let We=PF();if(i==null||i.addEventListener("abort",()=>{console.debug("aborting request:",_),We.abort()}),T&&n){const q=a.auth.getAuthHeader();We=We.set("Authorization",q)}o&&(We=We.set(o));try{return await We.query(p)}catch(q){const Ne=Xg(q),Ft=Ne==null?void 0:Ne.status;if(n&&Ft===401)return await a.auth.handleUnauthorized(We,Ne),We.query(p);throw new D({response:Ne,innerError:q,discard:_p.includes(Ft)})}}class Qg{constructor(e){S(this,"_all");S(this,"_previous");this._all=[e],this._previous=e,this.then=this.then.bind(this),this.compile=this.compile.bind(this)}then(e){return this._previous&&(this._previous.next=e),this._all.push(e),this._previous=e,{then:this.then,compile:this.compile}}compile(){return this._all}}class Op{constructor(){S(this,"next");this.next=null}then(e){return new Qg(this).then(e)}async run(e){if(this.next)return this.next.run(e);{if(console.debug("Middleware finished. Performing request:",e),!bt())throw new Error("Client store not set");const a=$g();if(!a)throw new Error("Client SDK not set");return Xn(e,a)}}}class xg extends Op{async run(e){return super.run(e)}}class eb extends Op{async run(e){return super.run(e)}}const tb=new xg().then(new eb).compile();function sb(t){var e;return(e=tb[0])==null?void 0:e.run(t)}const _p=[400,409,403,404,405,500];function Qn(t,e,i=0){var o;if(console.debug("Considering discarding request due to error:",t,`(${typeof t})`,`
|
|
1
|
+
(function(s,U){typeof exports=="object"&&typeof module<"u"?U(exports,require("@redux-offline/redux-offline/lib/types"),require("@reduxjs/toolkit"),require("superagent"),require("uuid"),require("file-saver"),require("react"),require("@redux-offline/redux-offline"),require("@redux-offline/redux-offline/lib/defaults"),require("buffer"),require("localforage"),require("redux-persist-migrate"),require("@overmap-ai/forms"),require("idb"),require("jwt-decode"),require("dependency-graph"),require("@tiptap/core")):typeof define=="function"&&define.amd?define(["exports","@redux-offline/redux-offline/lib/types","@reduxjs/toolkit","superagent","uuid","file-saver","react","@redux-offline/redux-offline","@redux-offline/redux-offline/lib/defaults","buffer","localforage","redux-persist-migrate","@overmap-ai/forms","idb","jwt-decode","dependency-graph","@tiptap/core"],U):(s=typeof globalThis<"u"?globalThis:s||self,U(s["overmap-core"]={},null,s.toolkit,s.request,s.uuid,s.fileSaver,s.react,s.reduxOffline,s.offlineConfig,null,s.localforage,s.createMigration,null,s.idb,s.jwtDecode,s.dependencyGraph))})(this,function(s,U,d,Je,Xe,zp,Up,Dp,tc,PF,Cp,kp,OF,Bp,$p,Gp){"use strict";var bF=Object.defineProperty;var FF=(s,U,d)=>U in s?bF(s,U,{enumerable:!0,configurable:!0,writable:!0,value:d}):s[U]=d;var S=(s,U,d)=>FF(s,typeof U!="symbol"?U+"":U,d);var qp;const sc=Object.freeze([]),ic=Object.freeze({});var ac=(t=>(t[t.GUEST=0]="GUEST",t[t.BASIC=2]="BASIC",t[t.ADMIN=4]="ADMIN",t))(ac||{}),l=(t=>(t.GET="GET",t.POST="POST",t.PATCH="PATCH",t.PUT="PUT",t.DELETE="DELETE",t))(l||{}),nc=(t=>(t.Issue="issue",t.Asset="asset",t.AssetType="asset_type",t.Project="project",t.Document="document",t))(nc||{}),xt=(t=>(t[t.LOWEST=0]="LOWEST",t[t.LOW=2]="LOW",t[t.MEDIUM=4]="MEDIUM",t[t.HIGH=6]="HIGH",t[t.HIGHEST=8]="HIGHEST",t))(xt||{}),es=(t=>(t[t.BACKLOG=0]="BACKLOG",t[t.SELECTED=2]="SELECTED",t[t.DONE=4]="DONE",t))(es||{}),E=(t=>(t.STATUS="status",t.PRIORITY="priority",t.CATEGORY="category",t.DESCRIPTION="description",t.TITLE="title",t.ASSIGNED_TO="assigned_to",t.DUE_DATE="due_date",t))(E||{});const Lp=es.BACKLOG,Np=xt.MEDIUM,cc=6e4;function P(t){return{addOne:(p,A)=>{const f=t(A.payload);p.instances[f]=A.payload},addMany:(p,A)=>{for(const f of A.payload){const T=t(f);p.instances[T]=f}},setOne:(p,A)=>{const f=t(A.payload);p.instances[f]=A.payload},setMany:(p,A)=>{for(const f of A.payload){const T=t(f);p.instances[T]=f}},updateOne:(p,A)=>{const f=t(A.payload);p.instances[f]=A.payload},updateMany:(p,A)=>{for(const f of A.payload){const T=t(f);p.instances[T]=f}},deleteOne:(p,A)=>{delete p.instances[A.payload]},deleteMany:(p,A)=>{for(const f of A.payload)delete p.instances[f]},initialize:(p,A)=>{p.instances={};const f=new Set;for(const T of A.payload){const F=t(T);f.add(F),p.instances[F]=T}f.size!==A.payload.length&&console.warn("duplicate ids detected when initializing model instances.")},getInitialState:p=>({...p,instances:{}})}}function Hp(){return{initializeSelection:(m,o)=>{m.selection=Array.from(new Set(o.payload))},selectOne:(m,o)=>{new Set(m.selection).has(o.payload)||m.selection.push(o.payload)},selectMany:(m,o)=>{const h=new Set(m.selection);for(const p of o.payload)h.has(p)||h.add(p);m.selection=Array.from(h)},unselectOne:(m,o)=>{const h=new Set(m.selection);h.has(o.payload)&&(h.delete(o.payload),m.selection=Array.from(h))},unselectMany:(m,o)=>{const h=new Set(m.selection);for(const p of o.payload)h.has(p)&&h.delete(p);m.selection=Array.from(h)},toggleOne:(m,o)=>{const h=new Set(m.selection);h.has(o.payload)?h.delete(o.payload):h.add(o.payload),m.selection=Array.from(h)},toggleMany:(m,o)=>{const h=new Set(m.selection);for(const p of o.payload)h.has(p)?h.delete(p):h.add(p);m.selection=Array.from(h)},getInitialState:m=>({...m,selection:[]})}}const it="versioning",g=d.createAction("RESET"),M=d.createAction("RESET_PROJECT_STATE"),O=d.createAction("RESET_ORGANIZATION_STATE");qp=Symbol.toStringTag;class rc{constructor(){S(this,qp,"Promise");S(this,"_promise");S(this,"_resolve");S(this,"_reject");S(this,"_state","pending");this._resolve=null,this._reject=null,this._promise=new Promise((e,i)=>{this._resolve=e,this._reject=i})}get state(){return this._state}then(e,i){return this._promise.then(e,i)}catch(e){return this._promise.catch(e)}resolve(e){if(!this._resolve)throw new Error("No resolve callback");this._resolve(e),this._state="fulfilled"}reject(e){if(!this._reject)throw e;this._reject(e),this._state="rejected"}finally(e){throw new Error("`finally` not implemented")}}let ts=!1;["true","1"].includes("".toLowerCase())&&(ts=!0);function Wp(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;const i=Object.keys(t),a=Object.keys(e),n=i.length;if(n!==a.length)return!1;for(let c=0;c<n;c++){const r=i[c];if(!Object.prototype.hasOwnProperty.call(e,r)||t[r]!==e[r])return!1}return!0}function ss(t){const e={};return function(){const i=Array.prototype.slice.call(arguments);return i in e?(ts&&console.debug(`Memoization debug: Using memorized return value for ${t.toString()}(`,i,")"),e[i]):(ts&&console.debug(`Memoization debug: Cache miss! Memoizing ${t.toString()}(`,i,")"),e[i]=t.apply(this,i))}}function Kp(t,e){if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}const I=t=>t.length===0?sc:t,Ot=t=>Object.keys(t).length===0?ic:t,dc=ss(t=>{if(!t)return"";const e=new Date(t),i=e.getFullYear()===is.getFullYear(),a={day:"numeric",month:"short"};return i||(a.year="numeric"),e.toLocaleDateString([],a)}),Yp=new Intl.RelativeTimeFormat([],{style:"long",numeric:"auto"}),Zp=1e3*86400,is=new Date,Jp=t=>new Date(t).toDateString()===is.toDateString(),Xp=ss((t,e,i)=>{const a=Math.round((new Date(t).getTime()-is.getTime())/Zp);return a<e||a>i?dc(t):Yp.format(a,"days")});function Qp(t){return new Uint8Array(t).reduce((i,a)=>i+a.toString(16).padStart(2,"0"),"")}const as=async(t,e)=>{e||(e=await Qe(t));let i=t.type;if(i.includes("/")&&(i=i.split("/")[1]),!i)throw new Error(`Could not extract file type from ${t.type}`);return`${e}.${i}`};function Qe(t){return new Promise((e,i)=>{const a=new FileReader;a.onload=()=>{const n=a.result;if(!n){i(new Error("FileReader did not return a valid ArrayBuffer."));return}crypto.subtle.digest("SHA-1",n).then(c=>{const r=Qp(c);e(r)})},a.readAsArrayBuffer(t)})}function xp(t){if(!t.name||!t.type||!t.size){const e="File has no name, type, and/or size";throw new Error(e)}return`${t.name}&${t.type}${t.size}`}function uc(t,e){return new File([t],e,{type:t.type})}function eA(t,e){const i=document.createElement("a");i.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(e)),i.setAttribute("download",t),i.style.display="none",document.body.appendChild(i),i.click(),document.body.removeChild(i)}const tA=async t=>{const e={};for(const i of t){const a=await Qe(i);e[a]={sha1:a,extension:i.name.split(".").pop()||"",file_type:i.type,size:i.size}}return Object.values(e)},oc=async t=>(await fetch(t)).blob(),sA=t=>new Promise((e,i)=>{const a=new FileReader;a.onloadend=()=>{var n;e(((n=a.result)==null?void 0:n.toString())||"")},a.readAsDataURL(t)});function iA(t){const e=new Blob([t]);zp.saveAs(e,t.name)}const lc={};function aA(t,e,i,...a){const n=lc[t];let c=!1;n?n[e]||(n[e]=!0,c=!0):(lc[t]={[e]:!0},c=!0),c&&console[i](...a)}const hc=["created_at","updated_at","index","revision"];function b(t){return{...t,uuid:Xe.v4()}}function mc(t){const e={};for(const i of t)e[i.uuid]=i;return e}function nA(t,e=void 0,i=255){let a=t.replace(/[^a-z0-9_\-.]/gi,"_").replace(/_{2,}/g,"_");if(!e){const c=t.split(".");c.length>1&&(e=c[c.length-1])}e&&!e.startsWith(".")&&(e="."+e);const n=e?e.length:0;return a.length+n>i&&(a=a.slice(0,i-n)+(e||"")),a}function cA(t){return t.toLowerCase().replace(" ","-")}function rA(t,e=!1){return t.normalize("NFKD").toLowerCase().replace(/[^\w\s-]/g,"").trim().replace(/[-\s]+/g,e?"_":"-")}function dA(t,e){if(t.length<=e)return t;const i=t.slice(0,e-1);return i.slice(0,i.lastIndexOf(" "))+"…"}const y=t=>e=>i=>t(i,e);function pc(t,e,i){return i.findIndex(a=>a.uuid===t.uuid)===e}function uA(t,e,i){return i.findIndex(a=>a.file_sha1===t.file_sha1)===e}const oA=/^.+@.+\..+$/;function v(t){const e={...t};for(const i of[...hc,"created_by"])i in e&&delete e[i];return e}const k=P(t=>t.uuid),Ac=k.getInitialState({}),ns=d.createSlice({name:"agents",initialState:Ac,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,Ac)),reducers:{initializeConversations:k.initialize,addConversation:k.addOne,addConversations:k.addMany,setConversation:k.setOne,setConversations:k.setMany,updateConversation:k.updateOne,updateConversations:k.updateMany,deleteConversation:k.deleteOne,deleteConversations:k.deleteMany}}),{initializeConversations:fc,addConversation:yc,addConversations:lA,setConversation:Sc,setConversations:hA,updateConversation:Ic,updateConversations:mA,deleteConversation:pA,deleteConversations:AA}=ns.actions,cs=t=>t.agentsReducer.instances,fA=d.createSelector([cs],t=>Object.values(t)),yA=y(d.createSelector([cs,(t,e)=>e],(t,e)=>t[e])),Tc=ns.reducer,B=P(t=>t.uuid),gc=B.getInitialState({}),rs=d.createSlice({name:"assetAttachments",initialState:gc,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,gc)),reducers:{initializeAssetAttachments:B.initialize,addAssetAttachment:B.addOne,addAssetAttachments:B.addMany,setAssetAttachment:B.setOne,setAssetAttachments:B.setMany,updateAssetAttachment:B.updateOne,updateAssetAttachments:B.updateMany,deleteAssetAttachment:B.deleteOne,deleteAssetAttachments:B.deleteMany}}),{initializeAssetAttachments:ds,addAssetAttachment:SA,addAssetAttachments:us,setAssetAttachment:bc,setAssetAttachments:IA,updateAssetAttachment:TA,updateAssetAttachments:Fc,deleteAssetAttachment:Pc,deleteAssetAttachments:os}=rs.actions,Oc=t=>t.assetAttachmentReducer.instances,_c=d.createSelector([Oc],t=>Object.values(t)),Rc=t=>e=>e.assetAttachmentReducer.instances[t],vc=y(d.createSelector([_c,(t,e)=>e],(t,e)=>I(t.filter(({asset:i})=>e===i)))),wc=rs.reducer,$=P(t=>t.uuid),Mc=$.getInitialState({}),ls=d.createSlice({name:"assetProcedureAttachments",initialState:Mc,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Mc)),reducers:{initializeAssetProcedureAttachments:$.initialize,addAssetProcedureAttachment:$.addOne,addAssetProcedureAttachments:$.addMany,setAssetProcedureAttachment:$.setOne,setAssetProcedureAttachments:$.setMany,updateAssetProcedureAttachment:$.updateOne,updateAssetProcedureAttachments:$.updateMany,deleteAssetProcedureAttachment:$.deleteOne,deleteAssetProcedureAttachments:$.deleteMany}}),{initializeAssetProcedureAttachments:Ec,addAssetProcedureAttachment:gA,addAssetProcedureAttachments:Vc,setAssetProcedureAttachment:jc,setAssetProcedureAttachments:bA,updateAssetProcedureAttachment:FA,updateAssetProcedureAttachments:qc,deleteAssetProcedureAttachment:zc,deleteAssetProcedureAttachments:Uc}=ls.actions,Dc=ls.reducer,Cc=t=>t.assetProcedureAttachmentReducer.instances,kc=d.createSelector([Cc],t=>Object.values(t)),Bc=t=>e=>e.assetProcedureAttachmentReducer.instances[t],PA=y(d.createSelector([kc,(t,e)=>e],(t,e)=>I(t.filter(({asset_procedure:i})=>e===i)))),G=P(t=>t.uuid),$c=G.getInitialState({}),hs=d.createSlice({name:"assetProcedureFieldsAttachments",initialState:$c,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,$c)),reducers:{initializeAssetProcedureFieldsAttachments:G.initialize,addAssetProcedureFieldsAttachment:G.addOne,addAssetProcedureFieldsAttachments:G.addMany,setAssetProcedureFieldsAttachment:G.setOne,setAssetProcedureFieldsAttachments:G.setMany,updateAssetProcedureFieldsAttachment:G.updateOne,updateAssetProcedureFieldsAttachments:G.updateMany,deleteAssetProcedureFieldsAttachment:G.deleteOne,deleteAssetProcedureFieldsAttachments:G.deleteMany}}),{initializeAssetProcedureFieldsAttachments:Gc,addAssetProcedureFieldsAttachment:OA,addAssetProcedureFieldsAttachments:Lc,setAssetProcedureFieldsAttachment:_A,setAssetProcedureFieldsAttachments:RA,updateAssetProcedureFieldsAttachment:vA,updateAssetProcedureFieldsAttachments:Nc,deleteAssetProcedureFieldsAttachment:wA,deleteAssetProcedureFieldsAttachments:Hc}=hs.actions,Wc=t=>t.assetProcedureFieldsAttachmentReducer.instances,Kc=d.createSelector([Wc],t=>Object.values(t)),MA=y(d.createSelector([Kc,(t,e)=>e],(t,e)=>I(t.filter(i=>i.fields_revision===e)))),EA=t=>e=>e.assetProcedureFieldsAttachmentReducer.instances[t],Yc=hs.reducer,L=P(t=>t.uuid),Zc=L.getInitialState({}),ms=d.createSlice({name:"assetProcedureFields",initialState:Zc,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Zc)),reducers:{initializeAssetProcedureFields:L.initialize,addAssetProcedureFields:L.addOne,addAssetProcedureFieldsMany:L.addMany,setAssetProcedureFields:L.setOne,setAssetProcedureFieldsMany:L.setMany,updateAssetProcedureFields:L.updateOne,updateAssetProcedureFieldsMany:L.updateMany,deleteAssetProcedureFields:L.deleteOne,deleteAssetProcedureFieldsMany:L.deleteMany}}),{initializeAssetProcedureFields:Jc,addAssetProcedureFields:Xc,addAssetProcedureFieldsMany:VA,setAssetProcedureFields:jA,setAssetProcedureFieldsMany:qA,updateAssetProcedureFields:Qc,updateAssetProcedureFieldsMany:zA,deleteAssetProcedureFields:xc,deleteAssetProcedureFieldsMany:UA}=ms.actions,er=t=>t.assetProcedureFieldsReducer.instances,ps=d.createSelector([er],t=>Object.values(t)),DA=y(d.createSelector([ps,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset_procedure===e)))),CA=y(d.createSelector([ps,(t,e)=>e],(t,e)=>t.filter(i=>i.asset_procedure===e).sort((i,a)=>i.submitted_at>a.submitted_at?-1:1)[0])),kA=t=>e=>e.assetProcedureFieldsReducer.instances[t],tr=ms.reducer,N=P(t=>t.uuid),sr=N.getInitialState({}),As=d.createSlice({name:"assetProcedureFieldValuesAttachments",initialState:sr,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,sr)),reducers:{initializeAssetProcedureFieldValuesAttachments:N.initialize,addAssetProcedureFieldValuesAttachment:N.addOne,addAssetProcedureFieldValuesAttachments:N.addMany,setAssetProcedureFieldValuesAttachment:N.setOne,setAssetProcedureFieldValuesAttachments:N.setMany,updateAssetProcedureFieldValuesAttachment:N.updateOne,updateAssetProcedureFieldValuesAttachments:N.updateMany,deleteAssetProcedureFieldValuesAttachment:N.deleteOne,deleteAssetProcedureFieldValuesAttachments:N.deleteMany}}),{initializeAssetProcedureFieldValuesAttachments:ir,addAssetProcedureFieldValuesAttachment:BA,addAssetProcedureFieldValuesAttachments:_t,setAssetProcedureFieldValuesAttachment:$A,setAssetProcedureFieldValuesAttachments:GA,updateAssetProcedureFieldValuesAttachment:LA,updateAssetProcedureFieldValuesAttachments:ar,deleteAssetProcedureFieldValuesAttachment:NA,deleteAssetProcedureFieldValuesAttachments:Rt}=As.actions,fs=t=>t.assetProcedureFieldValuesAttachmentReducer.instances,nr=d.createSelector([fs],t=>Object.values(t)),HA=t=>e=>e.assetProcedureFieldValuesAttachmentReducer.instances[t],cr=y(d.createSelector([fs,(t,e)=>e],(t,e)=>{const i=new Set(e);return I(Object.values(t).filter(a=>i.has(a.uuid)))})),rr=y(d.createSelector([nr,(t,e)=>e],(t,e)=>I(t.filter(i=>i.field_values===e)))),dr=As.reducer,H=P(t=>t.uuid),ur=H.getInitialState({}),ys=d.createSlice({name:"assetProcedureFieldValues",initialState:ur,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,ur)),reducers:{initializeAssetProcedureFieldValues:H.initialize,addAssetProcedureFieldValues:H.addOne,addAssetProcedureFieldValuesMany:H.addMany,setAssetProcedureFieldValues:H.setOne,setAssetProcedureFieldValuesMany:H.setMany,updateAssetProcedureFieldValues:H.updateOne,updateAssetProcedureFieldValuesMany:H.updateMany,deleteAssetProcedureFieldValues:H.deleteOne,deleteAssetProcedureFieldValuesMany:H.deleteMany}}),{initializeAssetProcedureFieldValues:or,addAssetProcedureFieldValues:Ss,addAssetProcedureFieldValuesMany:lr,setAssetProcedureFieldValues:WA,setAssetProcedureFieldValuesMany:KA,updateAssetProcedureFieldValues:at,updateAssetProcedureFieldValuesMany:hr,deleteAssetProcedureFieldValues:Is,deleteAssetProcedureFieldValuesMany:mr}=ys.actions,pr=ys.reducer,Ar=t=>t.assetProcedureFieldValuesReducer.instances,Ts=d.createSelector([Ar],t=>Object.values(t)),YA=y(d.createSelector([Ts,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset===e)))),ZA=y(d.createSelector([Ts,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset_procedure_instance===e)))),gs=t=>e=>e.assetProcedureFieldValuesReducer.instances[t],W=P(t=>t.uuid),fr=W.getInitialState({}),bs=d.createSlice({name:"assetProcedureInstances",initialState:fr,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,fr)),reducers:{initializeAssetProcedureInstances:W.initialize,addAssetProcedureInstance:W.addOne,addAssetProcedureInstances:W.addMany,setAssetProcedureInstance:W.setOne,setAssetProcedureInstances:W.setMany,updateAssetProcedureInstance:W.updateOne,updateAssetProcedureInstances:W.updateMany,deleteAssetProcedureInstance:W.deleteOne,deleteAssetProcedureInstances:W.deleteMany}}),{initializeAssetProcedureInstances:yr,addAssetProcedureInstance:Fs,addAssetProcedureInstances:Sr,updateAssetProcedureInstance:nt,updateAssetProcedureInstances:JA,deleteAssetProcedureInstance:Ps,deleteAssetProcedureInstances:Ir,setAssetProcedureInstance:XA,setAssetProcedureInstances:QA}=bs.actions,Tr=bs.reducer,Os=t=>t.assetProcedureInstanceReducer.instances,_s=d.createSelector([Os],t=>Object.values(t)),gr=y(d.createSelector([_s,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset_procedure===e)))),xA=y(d.createSelector([_s,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset_type===e)))),Rs=t=>e=>e.assetProcedureInstanceReducer.instances[t],ef=y(d.createSelector([Os,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n&&i.push(n)}return I(i)})),K=P(t=>t.uuid),br=K.getInitialState({}),vs=d.createSlice({name:"assetProcedures",initialState:br,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,br)),reducers:{initializeAssetProcedures:K.initialize,addAssetProcedure:K.addOne,addAssetProcedures:K.addMany,setAssetProcedure:K.setOne,setAssetProcedures:K.setMany,updateAssetProcedure:K.updateOne,updateAssetProcedures:K.updateMany,deleteAssetProcedure:K.deleteOne,deleteAssetProcedures:K.deleteMany}}),{initializeAssetProcedures:Fr,addAssetProcedure:ws,addAssetProcedures:tf,updateAssetProcedure:ct,updateAssetProcedures:sf,deleteAssetProcedure:Ms,deleteAssetProcedures:af,setAssetProcedure:nf,setAssetProcedures:cf}=vs.actions,Pr=vs.reducer,Es=t=>t.assetProcedureReducer.instances,Or=d.createSelector([Es],t=>Object.values(t)),Vs=t=>e=>e.assetProcedureReducer.instances[t],rf=y(d.createSelector([Es,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n&&i.push(n)}return I(i)})),df=y(d.createSelector([Or,(t,e)=>e],(t,e)=>I(t.filter(i=>i.organization===e)))),Y=P(t=>t.uuid),_r=Y.getInitialState({}),js=d.createSlice({name:"assetProcedureStepFieldsAttachments",initialState:_r,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,_r)),reducers:{initializeAssetProcedureStepFieldsAttachments:Y.initialize,addAssetProcedureStepFieldsAttachment:Y.addOne,addAssetProcedureStepFieldsAttachments:Y.addMany,setAssetProcedureStepFieldsAttachment:Y.setOne,setAssetProcedureStepFieldsAttachments:Y.setMany,updateAssetProcedureStepFieldsAttachment:Y.updateOne,updateAssetProcedureStepFieldsAttachments:Y.updateMany,deleteAssetProcedureStepFieldsAttachment:Y.deleteOne,deleteAssetProcedureStepFieldsAttachments:Y.deleteMany}}),{initializeAssetProcedureStepFieldsAttachments:Rr,addAssetProcedureStepFieldsAttachment:uf,addAssetProcedureStepFieldsAttachments:vr,setAssetProcedureStepFieldsAttachment:of,setAssetProcedureStepFieldsAttachments:lf,updateAssetProcedureStepFieldsAttachment:hf,updateAssetProcedureStepFieldsAttachments:wr,deleteAssetProcedureStepFieldsAttachment:mf,deleteAssetProcedureStepFieldsAttachments:Mr}=js.actions,Er=t=>t.assetProcedureStepFieldsAttachmentReducer.instances,Vr=d.createSelector([Er],t=>Object.values(t)),pf=y(d.createSelector([Vr,(t,e)=>e],(t,e)=>I(t.filter(i=>i.fields_revision===e)))),Af=t=>e=>e.assetProcedureStepFieldsAttachmentReducer.instances[t],jr=js.reducer,Z=P(t=>t.uuid),qr=Z.getInitialState({}),qs=d.createSlice({name:"assetProcedureStepFields",initialState:qr,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,qr)),reducers:{initializeAssetProcedureStepFields:Z.initialize,addAssetProcedureStepFields:Z.addOne,addAssetProcedureStepFieldsMany:Z.addMany,setAssetProcedureStepFields:Z.setOne,setAssetProcedureStepFieldsMany:Z.setMany,updateAssetProcedureStepFields:Z.updateOne,updateAssetProcedureStepFieldsMany:Z.updateMany,deleteAssetProcedureStepFields:Z.deleteOne,deleteAssetProcedureStepFieldsMany:Z.deleteMany}}),{initializeAssetProcedureStepFields:zr,addAssetProcedureStepFields:zs,addAssetProcedureStepFieldsMany:ff,setAssetProcedureStepFields:yf,setAssetProcedureStepFieldsMany:Sf,updateAssetProcedureStepFields:rt,updateAssetProcedureStepFieldsMany:If,deleteAssetProcedureStepFields:Us,deleteAssetProcedureStepFieldsMany:Tf}=qs.actions,Ds=t=>t.assetProcedureStepFieldsReducer.instances,Cs=d.createSelector([Ds],t=>Object.values(t)),gf=y(d.createSelector([Cs,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset_procedure_step===e)))),bf=y(d.createSelector([Cs,(t,e)=>e],(t,e)=>t.filter(i=>i.asset_procedure_step===e).sort((i,a)=>i.submitted_at>a.submitted_at?-1:1)[0])),Ff=d.createSelector([Ds],t=>{const e={};for(const i of Object.values(t)){const a=e[i.asset_procedure_step];(!a||a.submitted_at<i.submitted_at)&&(e[i.asset_procedure_step]=i)}return e}),Pf=t=>e=>e.assetProcedureStepFieldsReducer.instances[t],Ur=qs.reducer,J=P(t=>t.uuid),Dr=J.getInitialState({}),ks=d.createSlice({name:"assetProcedureStepFieldValuesAttachments",initialState:Dr,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,Dr)),reducers:{initializeAssetProcedureStepFieldValuesAttachments:J.initialize,addAssetProcedureStepFieldValuesAttachment:J.addOne,addAssetProcedureStepFieldValuesAttachments:J.addMany,setAssetProcedureStepFieldValuesAttachment:J.setOne,setAssetProcedureStepFieldValuesAttachments:J.setMany,updateAssetProcedureStepFieldValuesAttachment:J.updateOne,updateAssetProcedureStepFieldValuesAttachments:J.updateMany,deleteAssetProcedureStepFieldValuesAttachment:J.deleteOne,deleteAssetProcedureStepFieldValuesAttachments:J.deleteMany}}),{initializeAssetProcedureStepFieldValuesAttachments:Cr,addAssetProcedureStepFieldValuesAttachment:Of,addAssetProcedureStepFieldValuesAttachments:vt,setAssetProcedureStepFieldValuesAttachment:_f,setAssetProcedureStepFieldValuesAttachments:Rf,updateAssetProcedureStepFieldValuesAttachment:vf,updateAssetProcedureStepFieldValuesAttachments:kr,deleteAssetProcedureStepFieldValuesAttachment:wf,deleteAssetProcedureStepFieldValuesAttachments:wt}=ks.actions,Bs=t=>t.assetProcedureStepFieldValuesAttachmentReducer.instances,Br=d.createSelector([Bs],t=>Object.values(t)),Mf=t=>e=>e.assetProcedureStepFieldValuesAttachmentReducer.instances[t],$r=y(d.createSelector([Bs,(t,e)=>e],(t,e)=>{const i=new Set(e);return I(Object.values(t).filter(a=>i.has(a.uuid)))})),Gr=y(d.createSelector([Br,(t,e)=>e],(t,e)=>I(t.filter(i=>i.field_values===e)))),Lr=ks.reducer,X=P(t=>t.uuid),Nr=X.getInitialState({}),$s=d.createSlice({name:"assetProcedureStepFieldValues",initialState:Nr,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,Nr)),reducers:{initializeAssetProcedureStepFieldValues:X.initialize,addAssetProcedureStepFieldValues:X.addOne,addAssetProcedureStepFieldValuesMany:X.addMany,setAssetProcedureStepFieldValues:X.setOne,setAssetProcedureStepFieldValuesMany:X.setMany,updateAssetProcedureStepFieldValues:X.updateOne,updateAssetProcedureStepFieldValuesMany:X.updateMany,deleteAssetProcedureStepFieldValues:X.deleteOne,deleteAssetProcedureStepFieldValuesMany:X.deleteMany}}),{initializeAssetProcedureStepFieldValues:Hr,addAssetProcedureStepFieldValues:Gs,addAssetProcedureStepFieldValuesMany:Wr,setAssetProcedureStepFieldValues:Ef,setAssetProcedureStepFieldValuesMany:Vf,updateAssetProcedureStepFieldValues:dt,updateAssetProcedureStepFieldValuesMany:Kr,deleteAssetProcedureStepFieldValues:Ls,deleteAssetProcedureStepFieldValuesMany:Yr}=$s.actions,Zr=t=>t.assetProcedureStepFieldValuesReducer.instances,Mt=d.createSelector([Zr],t=>Object.values(t)),jf=y(d.createSelector([Mt,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset===e)))),qf=y(d.createSelector([Mt,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset_procedure_instance===e)))),zf=y(d.createSelector([Mt,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset_procedure_step===e)))),Ns=t=>e=>e.assetProcedureStepFieldValuesReducer.instances[t],Jr=$s.reducer,Q=P(t=>t.uuid),Xr=Q.getInitialState({}),Hs=d.createSlice({name:"assetProcedureSteps",initialState:Xr,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Xr)),reducers:{initializeAssetProcedureSteps:Q.initialize,setAssetProcedureStep:Q.setOne,setAssetProcedureSteps:Q.setMany,addAssetProcedureStep:Q.addOne,addAssetProcedureSteps:Q.addMany,updateAssetProcedureStep:Q.updateOne,updateAssetProcedureSteps:Q.updateMany,deleteAssetProcedureStep:Q.deleteOne,deleteAssetProcedureSteps:Q.deleteMany}}),{initializeAssetProcedureSteps:Qr,setAssetProcedureStep:xr,setAssetProcedureSteps:Uf,addAssetProcedureStep:Ws,addAssetProcedureSteps:Df,updateAssetProcedureStep:Et,updateAssetProcedureSteps:Cf,deleteAssetProcedureStep:Ks,deleteAssetProcedureSteps:kf}=Hs.actions,ed=Hs.reducer,Vt=t=>t.assetProcedureStepReducer.instances,Ys=t=>e=>e.assetProcedureStepReducer.instances[t],td=d.createSelector([Vt],t=>Object.values(t)),Bf=y(d.createSelector([Vt,(t,e)=>e],(t,e)=>{const i={};for(const[a,n]of Object.entries(t))n.asset_procedure===e&&(i[a]=n);return Ot(i)})),$f=y(d.createSelector([td,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset_procedure===e)))),Gf=y(d.createSelector([Vt,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n?i.push(n):console.warn("selectAssetProcedureStepsByIds: No step exists with the id",a)}return I(i)})),x=P(t=>t.uuid),sd=x.getInitialState({}),Zs=d.createSlice({name:"assets",initialState:sd,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,sd)),reducers:{initializeAssets:x.initialize,addAsset:x.addOne,addAssets:x.addMany,setAsset:x.setOne,setAssets:x.setMany,updateAsset:x.updateOne,updateAssets:x.updateMany,deleteAsset:x.deleteOne,deleteAssets:x.deleteMany}}),{initializeAssets:id,addAsset:Js,addAssets:jt,updateAsset:ut,updateAssets:Lf,deleteAsset:Xs,deleteAssets:Qs,setAsset:Nf,setAssets:Hf}=Zs.actions,xs=t=>t.assetReducer.instances,ad=d.createSelector([xs],t=>I(Object.values(t))),ei=y(d.createSelector([ad,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset_type===e)))),ti=t=>e=>e.assetReducer.instances[t],nd=y(d.createSelector([xs,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n&&i.push(n)}return I(i)})),Wf=t=>e=>ei(t)(e).length,cd=Zs.reducer,ee=P(t=>t.uuid),rd=ee.getInitialState({}),si=d.createSlice({name:"assetStageCompletions",initialState:rd,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,rd)),reducers:{initializeAssetStageCompletions:ee.initialize,addAssetStageCompletion:ee.addOne,addAssetStageCompletions:ee.addMany,setAssetStageCompletion:ee.setOne,setAssetStageCompletions:ee.setMany,updateAssetStageCompletion:ee.updateOne,updateAssetStageCompletions:ee.updateMany,deleteAssetStageCompletion:ee.deleteOne,deleteAssetStageCompletions:ee.deleteMany}}),{initializeAssetStageCompletions:dd,addAssetStageCompletion:ii,addAssetStageCompletions:ai,setAssetStageCompletion:Kf,setAssetStageCompletions:Yf,updateAssetStageCompletion:ud,updateAssetStageCompletions:od,deleteAssetStageCompletion:ni,deleteAssetStageCompletions:ci}=si.actions,ld=si.reducer,ri=t=>t.assetStageCompletionReducer.instances,Zf=d.createSelector([ri],t=>Object.values(t)),hd=t=>e=>e.assetStageCompletionReducer.instances[t],md=y(d.createSelector([ri,(t,e)=>e],(t,e)=>{const i=new Set(e);return I(Object.values(t).filter(a=>i.has(a.uuid)))})),te=P(t=>t.uuid),pd=te.getInitialState({}),di=d.createSlice({name:"assetStages",initialState:pd,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,pd)),reducers:{initializeAssetStages:te.initialize,setAssetStage:te.setOne,setAssetStages:te.setMany,addAssetStage:te.addOne,addAssetStages:te.addMany,updateAssetStage:te.updateOne,updateAssetStages:te.updateMany,deleteAssetStage:te.deleteOne,deleteAssetStages:te.deleteMany}}),{initializeAssetStages:Ad,setAssetStage:fd,setAssetStages:Jf,addAssetStage:ui,addAssetStages:Xf,updateAssetStage:qt,updateAssetStages:Qf,deleteAssetStage:oi,deleteAssetStages:xf}=di.actions,yd=di.reducer,zt=t=>t.assetStageReducer.instances,li=t=>e=>e.assetStageReducer.instances[t],Sd=d.createSelector([zt],t=>Object.values(t)),ey=y(d.createSelector([zt,(t,e)=>e],(t,e)=>{const i={};for(const[a,n]of Object.entries(t))n.asset_procedure===e&&(i[a]=n);return Ot(i)})),ty=y(d.createSelector([Sd,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset_procedure===e)))),sy=y(d.createSelector([zt,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n?i.push(n):console.warn("selectStagesFromStageIds: No stage exists with the id",a)}return I(i)})),se=P(t=>t.uuid),Id=se.getInitialState({}),hi=d.createSlice({name:"assetTypeAttachments",initialState:Id,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Id)),reducers:{initializeAssetTypeAttachments:se.initialize,addAssetTypeAttachment:se.addOne,addAssetTypeAttachments:se.addMany,setAssetTypeAttachment:se.setOne,setAssetTypeAttachments:se.setMany,updateAssetTypeAttachment:se.updateOne,updateAssetTypeAttachments:se.updateMany,deleteAssetTypeAttachment:se.deleteOne,deleteAssetTypeAttachments:se.deleteMany}}),{initializeAssetTypeAttachments:Td,addAssetTypeAttachment:iy,addAssetTypeAttachments:mi,setAssetTypeAttachment:gd,setAssetTypeAttachments:ay,updateAssetTypeAttachment:ny,updateAssetTypeAttachments:bd,deleteAssetTypeAttachment:Fd,deleteAssetTypeAttachments:pi}=hi.actions,Pd=t=>t.assetTypeAttachmentReducer.instances,Od=d.createSelector([Pd],t=>Object.values(t)),_d=t=>e=>e.assetTypeAttachmentReducer.instances[t],Rd=y(d.createSelector([Od,(t,e)=>e],(t,e)=>I(t.filter(({asset_type:i})=>e===i)))),vd=hi.reducer,ie=P(t=>t.uuid),wd=ie.getInitialState({}),Ai=d.createSlice({name:"assetTypeFieldsAttachments",initialState:wd,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,wd)),reducers:{initializeAssetTypeFieldsAttachments:ie.initialize,addAssetTypeFieldsAttachment:ie.addOne,addAssetTypeFieldsAttachments:ie.addMany,setAssetTypeFieldsAttachment:ie.setOne,setAssetTypeFieldsAttachments:ie.setMany,updateAssetTypeFieldsAttachment:ie.updateOne,updateAssetTypeFieldsAttachments:ie.updateMany,deleteAssetTypeFieldsAttachment:ie.deleteOne,deleteAssetTypeFieldsAttachments:ie.deleteMany}}),{initializeAssetTypeFieldsAttachments:Md,addAssetTypeFieldsAttachment:cy,addAssetTypeFieldsAttachments:Ed,setAssetTypeFieldsAttachment:ry,setAssetTypeFieldsAttachments:dy,updateAssetTypeFieldsAttachment:uy,updateAssetTypeFieldsAttachments:Vd,deleteAssetTypeFieldsAttachment:oy,deleteAssetTypeFieldsAttachments:jd}=Ai.actions,qd=t=>t.assetTypeFieldsAttachmentReducer.instances,zd=d.createSelector([qd],t=>Object.values(t)),ly=y(d.createSelector([zd,(t,e)=>e],(t,e)=>I(t.filter(i=>i.fields_revision===e)))),hy=t=>e=>e.assetTypeFieldsAttachmentReducer.instances[t],Ud=Ai.reducer,ae=P(t=>t.uuid),Dd=ae.getInitialState({}),fi=d.createSlice({name:"assetTypeFields",initialState:Dd,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Dd)),reducers:{initializeAssetTypeFields:ae.initialize,addAssetTypeFields:ae.addOne,addAssetTypeFieldsMany:ae.addMany,setAssetTypeFields:ae.setOne,setAssetTypeFieldsMany:ae.setMany,updateAssetTypeFields:ae.updateOne,updateAssetTypeFieldsMany:ae.updateMany,deleteAssetTypeFields:ae.deleteOne,deleteAssetTypeFieldsMany:ae.deleteMany}}),{initializeAssetTypeFields:Cd,addAssetTypeFields:kd,addAssetTypeFieldsMany:my,setAssetTypeFields:py,setAssetTypeFieldsMany:Ay,updateAssetTypeFields:Bd,updateAssetTypeFieldsMany:fy,deleteAssetTypeFields:$d,deleteAssetTypeFieldsMany:yy}=fi.actions,Gd=t=>t.assetTypeFieldsReducer.instances,Ut=d.createSelector([Gd],t=>Object.values(t)),Sy=y(d.createSelector([Ut,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset_type===e)))),Iy=y(d.createSelector([Ut,(t,e)=>e],(t,e)=>t.filter(i=>i.asset_type===e).sort((i,a)=>i.submitted_at>a.submitted_at?-1:1)[0])),Ty=t=>e=>e.assetTypeFieldsReducer.instances[t],Ld=fi.reducer,ne=P(t=>t.uuid),Nd=ne.getInitialState({}),yi=d.createSlice({name:"assetTypeFieldValuesAttachments",initialState:Nd,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,Nd)),reducers:{initializeAssetTypeFieldValuesAttachments:ne.initialize,addAssetTypeFieldValuesAttachment:ne.addOne,addAssetTypeFieldValuesAttachments:ne.addMany,setAssetTypeFieldValuesAttachment:ne.setOne,setAssetTypeFieldValuesAttachments:ne.setMany,updateAssetTypeFieldValuesAttachment:ne.updateOne,updateAssetTypeFieldValuesAttachments:ne.updateMany,deleteAssetTypeFieldValuesAttachment:ne.deleteOne,deleteAssetTypeFieldValuesAttachments:ne.deleteMany}}),{initializeAssetTypeFieldValuesAttachments:Hd,addAssetTypeFieldValuesAttachment:gy,addAssetTypeFieldValuesAttachments:Dt,setAssetTypeFieldValuesAttachment:by,setAssetTypeFieldValuesAttachments:Fy,updateAssetTypeFieldValuesAttachment:Py,updateAssetTypeFieldValuesAttachments:Wd,deleteAssetTypeFieldValuesAttachment:Oy,deleteAssetTypeFieldValuesAttachments:Ct}=yi.actions,Si=t=>t.assetTypeFieldValuesAttachmentReducer.instances,Kd=d.createSelector([Si],t=>Object.values(t)),_y=t=>e=>e.assetTypeFieldValuesAttachmentReducer.instances[t],Yd=y(d.createSelector([Si,(t,e)=>e],(t,e)=>{const i=new Set(e);return I(Object.values(t).filter(a=>i.has(a.uuid)))})),Zd=y(d.createSelector([Kd,(t,e)=>e],(t,e)=>I(t.filter(i=>i.field_values===e)))),Jd=yi.reducer,ce=P(t=>t.uuid),Xd=ce.getInitialState({}),Ii=d.createSlice({name:"assetTypeFieldValues",initialState:Xd,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,Xd)),reducers:{initializeAssetTypeFieldValues:ce.initialize,addAssetTypeFieldValues:ce.addOne,addAssetTypeFieldValuesMany:ce.addMany,setAssetTypeFieldValues:ce.setOne,setAssetTypeFieldValuesMany:ce.setMany,updateAssetTypeFieldValues:ce.updateOne,updateAssetTypeFieldValuesMany:ce.updateMany,deleteAssetTypeFieldValues:ce.deleteOne,deleteAssetTypeFieldValuesMany:ce.deleteMany}}),{initializeAssetTypeFieldValues:Qd,addAssetTypeFieldValues:Ti,addAssetTypeFieldValuesMany:xd,setAssetTypeFieldValues:Ry,setAssetTypeFieldValuesMany:vy,updateAssetTypeFieldValues:ot,updateAssetTypeFieldValuesMany:eu,deleteAssetTypeFieldValues:gi,deleteAssetTypeFieldValuesMany:tu}=Ii.actions,su=t=>t.assetTypeFieldValuesReducer.instances,bi=d.createSelector([su],t=>Object.values(t)),wy=y(d.createSelector([bi,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset===e)))),My=y(d.createSelector([Ut,bi,(t,e)=>e],(t,e,i)=>{const a=new Set(t.filter(n=>n.asset_type===i).map(n=>n.uuid));return I(e.filter(n=>a.has(n.fields_revision)))})),Fi=t=>e=>e.assetTypeFieldValuesReducer.instances[t],iu=Ii.reducer,re=P(t=>t.uuid),au=re.getInitialState({}),Pi=d.createSlice({name:"assetTypeIdentifiers",initialState:au,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,au)),reducers:{initializeAssetTypeIdentifiers:re.initialize,addAssetTypeIdentifier:re.addOne,addAssetTypeIdentifiers:re.addMany,setAssetTypeIdentifier:re.setOne,setAssetTypeIdentifiers:re.setMany,updateAssetTypeIdentifier:re.updateOne,updateAssetTypeIdentifiers:re.updateMany,deleteAssetTypeIdentifier:re.deleteOne,deleteAssetTypeIdentifiers:re.deleteMany}}),{initializeAssetTypeIdentifiers:nu,addAssetTypeIdentifier:Oi,addAssetTypeIdentifiers:Ey,setAssetTypeIdentifier:Vy,setAssetTypeIdentifiers:jy,updateAssetTypeIdentifier:lt,updateAssetTypeIdentifiers:qy,deleteAssetTypeIdentifier:_i,deleteAssetTypeIdentifiers:zy}=Pi.actions,cu=t=>t.assetTypeIdentifierReducer.instances,ru=d.createSelector([cu],t=>Object.values(t)),Ri=t=>e=>e.assetTypeIdentifierReducer.instances[t],Uy=y(d.createSelector([ru,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset_type===e)))),du=Pi.reducer,de=P(t=>t.uuid),uu=de.getInitialState({}),vi=d.createSlice({name:"assetTypeIdentifierValues",initialState:uu,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,uu)),reducers:{initializeAssetTypeIdentifierValues:de.initialize,addAssetTypeIdentifierValue:de.addOne,addAssetTypeIdentifierValues:de.addMany,setAssetTypeIdentifierValue:de.setOne,setAssetTypeIdentifierValues:de.setMany,updateAssetTypeIdentifierValue:de.updateOne,updateAssetTypeIdentifierValues:de.updateMany,deleteAssetTypeIdentifierValue:de.deleteOne,deleteAssetTypeIdentifierValues:de.deleteMany}}),{initializeAssetTypeIdentifierValues:ou,addAssetTypeIdentifierValue:wi,addAssetTypeIdentifierValues:Dy,setAssetTypeIdentifierValue:Cy,setAssetTypeIdentifierValues:ky,updateAssetTypeIdentifierValue:ht,updateAssetTypeIdentifierValues:By,deleteAssetTypeIdentifierValue:Mi,deleteAssetTypeIdentifierValues:$y}=vi.actions,lu=t=>t.assetTypeIdentifierValueReducer.instances,Ei=d.createSelector([lu],t=>Object.values(t)),Vi=t=>e=>e.assetTypeIdentifierValueReducer.instances[t],Gy=y(d.createSelector([Ei,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset===e)))),Ly=y(d.createSelector([Ei,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset_type_identifier===e)))),hu=vi.reducer,ue=P(t=>t.uuid),mu=ue.getInitialState({}),ji=d.createSlice({name:"assetTypes",initialState:mu,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,mu)),reducers:{initializeAssetTypes:ue.initialize,setAssetType:ue.setOne,setAssetTypes:ue.setMany,addAssetType:ue.addOne,addAssetTypes:ue.addMany,updateAssetType:ue.updateOne,updateAssetTypes:ue.updateMany,deleteAssetType:ue.deleteOne,deleteAssetTypes:ue.deleteMany}}),{initializeAssetTypes:pu,setAssetType:Ny,setAssetTypes:Hy,addAssetType:qi,addAssetTypes:Wy,updateAssetType:mt,updateAssetTypes:Ky,deleteAssetType:zi,deleteAssetTypes:Yy}=ji.actions,Ui=t=>t.assetTypeReducer.instances,Au=d.createSelector([Ui],t=>Object.values(t)),Di=t=>e=>e.assetTypeReducer.instances[t],Zy=y(d.createSelector([Ui,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n?i.push(n):console.warn("selectAssetTypesByIds: No assetType exists with the id",a)}return I(i)})),Jy=y(d.createSelector([Au,(t,e)=>e],(t,e)=>I(t.filter(i=>i.organization===e)))),fu=ji.reducer,yu={accessToken:"",refreshToken:"",isLoggedIn:!1},kt=d.createSlice({name:"auth",initialState:yu,extraReducers:t=>t.addCase(g,e=>Object.assign(e,yu)),reducers:{setTokens:(t,e)=>{t.accessToken=e.payload.accessToken,t.refreshToken=e.payload.refreshToken},clearTokens:t=>{t.accessToken="",t.refreshToken=""},setLoggedIn:(t,e)=>{e.payload||kt.caseReducers.clearTokens(t),t.isLoggedIn=e.payload}}}),{setTokens:Xy,clearTokens:Qy,setLoggedIn:Su}=kt.actions,xy=t=>t.authReducer.accessToken,eS=t=>t.authReducer.isLoggedIn,Iu=kt.reducer,oe=P(t=>t.uuid),Tu=oe.getInitialState({}),Ci=d.createSlice({name:"categories",initialState:Tu,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Tu)),reducers:{initializeCategories:oe.initialize,addCategory:oe.addOne,addCategories:oe.addMany,setCategory:oe.setOne,setCategories:oe.setMany,updateCategory:oe.updateOne,updateCategories:oe.updateMany,deleteCategory:oe.deleteOne,deleteCategories:oe.deleteMany}}),{initializeCategories:gu,addCategory:ki,addCategories:tS,setCategory:sS,setCategories:iS,updateCategory:bu,updateCategories:aS,deleteCategory:Fu,deleteCategories:nS}=Ci.actions,Bi=t=>t.categoryReducer.instances,Pu=d.createSelector([Bi],t=>Object.values(t)),$i=t=>e=>e.categoryReducer.instances[t],cS=y(d.createSelector([Bi,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n?i.push(n):console.warn("selectCategoryByIds: No category exists with the id",a)}return I(i)})),rS=y(d.createSelector([Pu,(t,e)=>e],(t,e)=>I(t.filter(i=>i.project===e)))),Ou=Ci.reducer,le=P(t=>t.uuid),_u=le.getInitialState({}),Gi=d.createSlice({name:"documentAttachments",initialState:_u,extraReducers:t=>t.addCase(g,e=>Object.assign(e,_u)),reducers:{initializeDocumentAttachments:le.initialize,addDocumentAttachment:le.addOne,addDocumentAttachments:le.addMany,setDocumentAttachment:le.setOne,setDocumentAttachments:le.setMany,updateDocumentAttachment:le.updateOne,updateDocumentAttachments:le.updateMany,deleteDocumentAttachment:le.deleteOne,deleteDocumentAttachments:le.deleteMany}}),{initializeDocumentAttachments:Ru,addDocumentAttachment:dS,addDocumentAttachments:vu,setDocumentAttachment:wu,setDocumentAttachments:uS,updateDocumentAttachment:oS,updateDocumentAttachments:Mu,deleteDocumentAttachment:Eu,deleteDocumentAttachments:Vu}=Gi.actions,ju=t=>t.documentAttachmentReducer.instances,qu=d.createSelector([ju],t=>Object.values(t)),zu=t=>e=>e.documentAttachmentReducer.instances[t],lS=y(d.createSelector([qu,(t,e)=>e],(t,e)=>I(t.filter(({document:i})=>e===i)))),Uu=Gi.reducer,Du={documents:{}},Li=d.createSlice({name:"documents",initialState:Du,extraReducers:t=>t.addCase(g,e=>{Object.assign(e,Du)}),reducers:{setDocuments:(t,e)=>{if(e.payload.filter(pc).length!==e.payload.length)throw new Error("Tried to use setIssues reducer with duplicate ID's");t.documents=mc(e.payload)},addDocuments:(t,e)=>{for(const i of e.payload)if(i.uuid in t.documents)throw new Error(`attempting to add a document with uuid ${i.uuid} which already exists in state.documents.`);for(const i of e.payload){if(i.parent_document&&t.documents[i.parent_document]){const a=t.documents[i.parent_document];t.documents[i.parent_document]={...a,children_documents:[...a.children_documents,i.uuid]}}t.documents[i.uuid]=i}},updateDocuments:(t,e)=>{for(const i of e.payload)if(!(i.uuid in t.documents))throw new Error(`attempting to update a document with uuid ${i.uuid} which doesn't exists in state.documents.`);for(const i of e.payload){const a=t.documents[i.uuid];if(i.organization!==void 0&&i.organization!==a.organization)throw new Error("organization cannot be updated");if(i.project!==void 0&&i.project!==a.project)throw new Error("project cannot be updated");t.documents[i.uuid]={...a,...i}}},removeDocuments:(t,e)=>{for(const i of e.payload)if(!(i in t.documents))throw new Error(`attempting to delete a document with uuid ${i} which doesn't exists in state.documents.`);for(const i of e.payload){const a=t.documents[i];if(a.parent_document&&t.documents[a.parent_document]){const n=t.documents[a.parent_document];t.documents[a.parent_document]={...n,children_documents:n.children_documents.filter(c=>c!==a.uuid)}}delete t.documents[i]}}}}),{setDocuments:Cu,addDocuments:ku,updateDocuments:xe,removeDocuments:Ni}=Li.actions,Bt=t=>t.documentsReducer.documents,Hi=d.createSelector([Bt],t=>Object.values(t)),Bu=t=>e=>e.documentsReducer.documents[t],hS=y(d.createSelector([Bt,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n?i.push(n):console.warn("selectDocumentByIds: No document exists with the id",a)}return I(i)})),mS=y(d.createSelector([Hi,(t,e)=>e],(t,e)=>t.filter(i=>i.project===e))),pS=y(d.createSelector([Hi,(t,e)=>e],(t,e)=>t.filter(i=>i.organization===e))),$u=Li.reducer,he=P(t=>t.uuid),Gu=he.getInitialState({}),Wi=d.createSlice({name:"emailDomains",initialState:Gu,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Gu)),reducers:{initializeEmailDomains:he.initialize,addEmailDomain:he.addOne,addEmailDomains:he.addMany,setEmailDomain:he.setOne,setEmailDomains:he.setMany,updateEmailDomain:he.updateOne,updateEmailDomains:he.updateMany,deleteEmailDomain:he.deleteOne,deleteEmailDomains:he.deleteMany}}),{initializeEmailDomains:Lu,addEmailDomain:Nu,addEmailDomains:AS,setEmailDomain:fS,setEmailDomains:yS,updateEmailDomain:SS,updateEmailDomains:IS,deleteEmailDomain:Hu,deleteEmailDomains:TS}=Wi.actions,Wu=t=>t.emailDomainsReducer.instances,Ku=d.createSelector([Wu],t=>Object.values(t)),gS=y(d.createSelector([Ku,(t,e)=>e],(t,e)=>I(t.filter(i=>i.organization===e)))),Yu=Wi.reducer,Zu={s3Urls:{}},Ju=1e3*60*60,bS=Ju*24*7,Ki=d.createSlice({name:"file",initialState:Zu,extraReducers:t=>t.addCase(g,e=>Object.assign(e,Zu)),reducers:{setUploadUrl:(t,e)=>{const{url:i,fields:a,sha1:n}=e.payload,c=new Date,r=new Date(c.getTime()+bS);t.s3Urls[n]={url:i,fields:a,exp:r.getTime()}}}}),{setUploadUrl:Xu}=Ki.actions,Qu=t=>e=>{const i=e.fileReducer.s3Urls[t];if(!i)return;const a=new Date().getTime();if(!((i.exp??a)-a<Ju))return i},xu=Ki.reducer,me=P(t=>t.uuid),eo=me.getInitialState({}),Yi=d.createSlice({name:"formIdentifiers",initialState:eo,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,eo)),reducers:{initializeFormIdentifiers:me.initialize,addFormIdentifier:me.addOne,addFormIdentifiers:me.addMany,setFormIdentifier:me.setOne,setFormIdentifiers:me.setMany,updateFormIdentifier:me.updateOne,updateFormIdentifiers:me.updateMany,deleteFormIdentifier:me.deleteOne,deleteFormIdentifiers:me.deleteMany}}),{initializeFormIdentifiers:to,addFormIdentifier:Zi,addFormIdentifiers:FS,setFormIdentifier:PS,setFormIdentifiers:OS,updateFormIdentifier:pt,updateFormIdentifiers:_S,deleteFormIdentifier:Ji,deleteFormIdentifiers:RS}=Yi.actions,so=t=>t.formIdentifierReducer.instances,io=d.createSelector([so],t=>Object.values(t)),Xi=t=>e=>e.formIdentifierReducer.instances[t],vS=y(d.createSelector([io,(t,e)=>e],(t,e)=>I(t.filter(i=>i.form===e)))),ao=Yi.reducer,pe=P(t=>t.uuid),no=pe.getInitialState({}),Qi=d.createSlice({name:"formIdentifierValues",initialState:no,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,no)),reducers:{initializeFormIdentifierValues:pe.initialize,addFormIdentifierValue:pe.addOne,addFormIdentifierValues:pe.addMany,setFormIdentifierValue:pe.setOne,setFormIdentifierValues:pe.setMany,updateFormIdentifierValue:pe.updateOne,updateFormIdentifierValues:pe.updateMany,deleteFormIdentifierValue:pe.deleteOne,deleteFormIdentifierValues:pe.deleteMany}}),{initializeFormIdentifierValues:co,addFormIdentifierValue:xi,addFormIdentifierValues:wS,setFormIdentifierValue:MS,setFormIdentifierValues:ES,updateFormIdentifierValue:At,updateFormIdentifierValues:VS,deleteFormIdentifierValue:ea,deleteFormIdentifierValues:jS}=Qi.actions,ro=t=>t.formIdentifierValueReducer.instances,ta=d.createSelector([ro],t=>Object.values(t)),sa=t=>e=>e.formIdentifierValueReducer.instances[t],qS=y(d.createSelector([ta,(t,e)=>e],(t,e)=>I(t.filter(i=>i.form_submission===e)))),zS=y(d.createSelector([ta,(t,e)=>e],(t,e)=>I(t.filter(i=>i.form_identifier===e)))),uo=Qi.reducer,Ae=P(t=>t.uuid),oo=Ae.getInitialState({}),ia=d.createSlice({name:"formRevisionAttachments",initialState:oo,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,oo)),reducers:{initializeFormRevisionAttachments:Ae.initialize,addFormRevisionAttachment:Ae.addOne,addFormRevisionAttachments:Ae.addMany,setFormRevisionAttachment:Ae.setOne,setFormRevisionAttachments:Ae.setMany,updateFormRevisionAttachment:Ae.updateOne,updateFormRevisionAttachments:Ae.updateMany,deleteFormRevisionAttachment:Ae.deleteOne,deleteFormRevisionAttachments:Ae.deleteMany}}),{initializeFormRevisionAttachments:lo,addFormRevisionAttachment:US,addFormRevisionAttachments:ho,setFormRevisionAttachment:DS,setFormRevisionAttachments:CS,updateFormRevisionAttachment:kS,updateFormRevisionAttachments:mo,deleteFormRevisionAttachment:BS,deleteFormRevisionAttachments:po}=ia.actions,Ao=t=>t.formRevisionAttachmentReducer.instances,$S=y(d.createSelector([Ao,(t,e)=>e],(t,e)=>I(Object.values(t).filter(i=>i.form_revision===e)))),fo=ia.reducer,fe=P(t=>t.uuid),yo=fe.getInitialState({}),aa=d.createSlice({name:"formRevisions",initialState:yo,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,yo)),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:So,addFormRevision:na,addFormRevisions:Io,setFormRevision:To,setFormRevisions:GS,updateFormRevision:LS,updateFormRevisions:NS,deleteFormRevision:ca,deleteFormRevisions:go}=aa.actions,ra=t=>t.formRevisionReducer.instances,da=d.createSelector([ra],t=>Object.values(t)),HS=t=>e=>e.formRevisionReducer.instances[t],WS=y(d.createSelector([da,(t,e)=>e],(t,e)=>t.filter(i=>i.form===e).sort((i,a)=>i.submitted_at>a.submitted_at?-1:1)[0])),bo=y(d.createSelector([da,(t,e)=>e],(t,e)=>I(t.filter(i=>i.form===e)))),Fo=aa.reducer,ye=P(t=>t.uuid),Po=ye.getInitialState({}),ua=d.createSlice({name:"forms",initialState:Po,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Po)),reducers:{initializeForms:ye.initialize,addForm:ye.addOne,addForms:ye.addMany,setForm:ye.setOne,setForms:ye.setMany,updateForm:ye.updateOne,updateForms:ye.updateMany,deleteForm:ye.deleteOne,deleteForms:ye.deleteMany}}),{initializeForms:Oo,addForm:oa,addForms:KS,setForm:YS,setForms:ZS,updateForm:JS,updateForms:XS,deleteForm:la,deleteForms:QS}=ua.actions,_o=ua.reducer,Ro=t=>t.formReducer.instances,vo=d.createSelector([Ro],t=>Object.values(t)),wo=t=>e=>e.formReducer.instances[t],xS=y(d.createSelector([vo,(t,e)=>e],(t,e)=>I(t.filter(i=>i.organization===e)))),Se=P(t=>t.uuid),Mo=Se.getInitialState({}),ha=d.createSlice({name:"formSubmissionAttachments",initialState:Mo,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Mo)),reducers:{initializeFormSubmissionAttachments:Se.initialize,addFormSubmissionAttachment:Se.addOne,addFormSubmissionAttachments:Se.addMany,setFormSubmissionAttachment:Se.setOne,setFormSubmissionAttachments:Se.setMany,updateFormSubmissionAttachment:Se.updateOne,updateFormSubmissionAttachments:Se.updateMany,deleteFormSubmissionAttachment:Se.deleteOne,deleteFormSubmissionAttachments:Se.deleteMany}}),{initializeFormSubmissionAttachments:Eo,addFormSubmissionAttachment:eI,addFormSubmissionAttachments:$t,setFormSubmissionAttachment:tI,setFormSubmissionAttachments:sI,updateFormSubmissionAttachment:iI,updateFormSubmissionAttachments:Vo,deleteFormSubmissionAttachment:aI,deleteFormSubmissionAttachments:Gt}=ha.actions,jo=t=>t.formSubmissionAttachmentReducer.instances,ma=d.createSelector([jo],t=>Object.values(t)),qo=y(d.createSelector([ma,(t,e)=>e],(t,e)=>{const i=new Set(e);return I(t.filter(a=>i.has(a.uuid)))})),zo=y(d.createSelector([ma,(t,e)=>e],(t,e)=>I(t.filter(i=>i.form_submission===e)))),Uo=ha.reducer,Ie=P(t=>t.uuid),Do=Ie.getInitialState({}),pa=d.createSlice({name:"formSubmissions",initialState:Do,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Do)),reducers:{initializeFormSubmissions:Ie.initialize,setFormSubmission:Ie.setOne,setFormSubmissions:Ie.setMany,addFormSubmission:Ie.addOne,addFormSubmissions:Ie.addMany,updateFormSubmission:Ie.updateOne,updateFormSubmissions:Ie.updateMany,deleteFormSubmission:Ie.deleteOne,deleteFormSubmissions:Ie.deleteMany}}),{initializeFormSubmissions:Co,setFormSubmission:Lt,setFormSubmissions:nI,addFormSubmission:Aa,addFormSubmissions:ko,updateFormSubmission:Bo,updateFormSubmissions:cI,deleteFormSubmission:fa,deleteFormSubmissions:$o}=pa.actions,ya=t=>t.formSubmissionReducer.instances,rI=d.createSelector([ya],t=>Object.values(t)),Sa=t=>e=>e.formSubmissionReducer.instances[t],Go=y(d.createSelector([ya,ra,(t,e)=>e],(t,e,i)=>{const a=new Set;for(const n of Object.values(e))n.form===i&&a.add(n.uuid);return Object.values(t).filter(n=>a.has(n.form_revision))})),Lo=pa.reducer,Te=P(t=>t.uuid),No=Te.getInitialState({}),Ia=d.createSlice({name:"geoImages",initialState:No,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,No)),reducers:{initializeGeoImages:Te.initialize,setGeoImage:Te.setOne,setGeoImages:Te.setMany,addGeoImage:Te.addOne,addGeoImages:Te.addMany,updateGeoImage:Te.updateOne,updateGeoImages:Te.updateMany,deleteGeoImage:Te.deleteOne,deleteGeoImages:Te.deleteMany}}),{initializeGeoImages:Ho,setGeoImage:ft,setGeoImages:Wo,addGeoImage:Ko,addGeoImages:Yo,updateGeoImage:Zo,updateGeoImages:dI,deleteGeoImage:Ta,deleteGeoImages:Jo}=Ia.actions,Xo=t=>t.geoImageReducer.instances,Qo=d.createSelector([Xo],t=>Object.values(t)),ga=t=>e=>e.geoImageReducer.instances[t],uI=y(d.createSelector([Qo,(t,e)=>e],(t,e)=>I(t.filter(i=>i.project===e)))),xo=Ia.reducer,ge=P(t=>t.uuid),el=ge.getInitialState({}),ba=d.createSlice({name:"issueAssociations",initialState:el,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,el)),reducers:{initializeIssueAssociations:ge.initialize,addIssueAssociation:ge.addOne,addIssueAssociations:ge.addMany,setIssueAssociation:ge.setOne,setIssueAssociations:ge.setMany,updateIssueAssociation:ge.updateOne,updateIssueAssociations:ge.updateMany,deleteIssueAssociation:ge.deleteOne,deleteIssueAssociations:ge.deleteMany}}),{initializeIssueAssociations:tl,setIssueAssociations:oI,setIssueAssociation:lI,updateIssueAssociation:sl,updateIssueAssociations:hI,addIssueAssociation:Fa,addIssueAssociations:Pa,deleteIssueAssociation:Oa,deleteIssueAssociations:_a}=ba.actions,yt=t=>t.issueAssociationReducer.instances,mI=d.createSelector([yt],t=>Object.values(t)),il=t=>e=>e.issueAssociationReducer.instances[t],al=y(d.createSelector([yt,(t,e)=>e],(t,e)=>I(Object.values(t).filter(i=>i.associated_issue===e)))),nl=y(d.createSelector([yt,(t,e)=>e],(t,e)=>I(Object.values(t).filter(i=>i.issue===e)))),cl=y(d.createSelector([yt,(t,e)=>e],(t,e)=>I(Object.values(t).filter(i=>i.asset===e)))),rl=ba.reducer,be=P(t=>t.uuid),dl=be.getInitialState({}),Ra=d.createSlice({name:"issueAttachments",initialState:dl,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,dl)),reducers:{initializeIssueAttachments:be.initialize,addIssueAttachment:be.addOne,addIssueAttachments:be.addMany,setIssueAttachment:be.setOne,setIssueAttachments:be.setMany,updateIssueAttachment:be.updateOne,updateIssueAttachments:be.updateMany,deleteIssueAttachment:be.deleteOne,deleteIssueAttachments:be.deleteMany}}),{initializeIssueAttachments:va,addIssueAttachment:pI,addIssueAttachments:wa,setIssueAttachment:ul,setIssueAttachments:AI,updateIssueAttachment:fI,updateIssueAttachments:ol,deleteIssueAttachment:ll,deleteIssueAttachments:Ma}=Ra.actions,hl=t=>t.issueAttachmentReducer.instances,ml=d.createSelector([hl],t=>Object.values(t)),pl=y(d.createSelector([ml,(t,e)=>e],(t,e)=>I(t.filter(({issue:i})=>e===i)))),Al=t=>e=>e.issueAttachmentReducer.instances[t],fl=Ra.reducer,Fe=P(t=>t.uuid),yl=Fe.getInitialState({}),Ea=d.createSlice({name:"issueCommentAttachments",initialState:yl,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,yl)),reducers:{initializeIssueCommentAttachments:Fe.initialize,addIssueCommentAttachment:Fe.addOne,addIssueCommentAttachments:Fe.addMany,setIssueCommentAttachment:Fe.setOne,setIssueCommentAttachments:Fe.setMany,updateIssueCommentAttachment:Fe.updateOne,updateIssueCommentAttachments:Fe.updateMany,deleteIssueCommentAttachment:Fe.deleteOne,deleteIssueCommentAttachments:Fe.deleteMany}}),{initializeIssueCommentAttachments:Va,addIssueCommentAttachment:yI,addIssueCommentAttachments:Sl,setIssueCommentAttachment:Il,setIssueCommentAttachments:SI,updateIssueCommentAttachment:II,updateIssueCommentAttachments:Tl,deleteIssueCommentAttachment:gl,deleteIssueCommentAttachments:bl}=Ea.actions,Fl=t=>t.issueCommentAttachmentReducer.instances,Pl=d.createSelector([Fl],t=>Object.values(t)),Ol=t=>e=>e.issueCommentAttachmentReducer.instances[t],TI=y(d.createSelector([Pl,(t,e)=>e],(t,e)=>I(t.filter(({issue_comment:i})=>e===i)))),_l=Ea.reducer,Pe=P(t=>t.uuid),Rl=Pe.getInitialState({}),ja=d.createSlice({name:"issueComments",initialState:Rl,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,Rl)),reducers:{initializeIssueComments:Pe.initialize,addIssueComment:Pe.addOne,addIssueComments:Pe.addMany,setIssueComment:Pe.setOne,setIssueComments:Pe.setMany,updateIssueComment:Pe.updateOne,updateIssueComments:Pe.updateMany,deleteIssueComment:Pe.deleteOne,deleteIssueComments:Pe.deleteMany}}),{initializeIssueComments:gI,addIssueComment:qa,addIssueComments:bI,setIssueComment:za,setIssueComments:vl,updateIssueComment:FI,updateIssueComments:PI,deleteIssueComment:Ua,deleteIssueComments:OI}=ja.actions,wl=t=>t.issueCommentReducer.instances,Da=t=>e=>e.issueCommentReducer.instances[t],_I=y(d.createSelector([wl,(t,e)=>e],(t,e)=>I(Object.values(t).filter(i=>i.issue===e)))),Ml=ja.reducer,Oe=P(t=>t.uuid),El=Oe.getInitialState({}),Ca=d.createSlice({name:"issues",initialState:El,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,El)),reducers:{initializeIssues:Oe.initialize,addIssue:Oe.addOne,addIssues:Oe.addMany,setIssue:Oe.setOne,setIssues:Oe.setMany,updateIssue:Oe.updateOne,updateIssues:Oe.updateMany,deleteIssue:Oe.deleteOne,deleteIssues:Oe.deleteMany}}),{initializeIssues:Vl,addIssue:ka,addIssues:jl,setIssue:RI,setIssues:vI,updateIssue:Nt,updateIssues:wI,deleteIssue:Ba,deleteIssues:ql}=Ca.actions,$a=t=>t.issueReducer.instances,Ga=d.createSelector([$a],t=>Object.values(t)),La=t=>e=>e.issueReducer.instances[t],MI=y(d.createSelector([$a,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n?i.push(n):console.warn("selectIssuesByIds: No issue exists with the id",a)}return I(i)})),EI=y(d.createSelector([Ga,(t,e)=>e],(t,e)=>t.filter(i=>i.project===e))),zl=y(d.createSelector([Ga,(t,e)=>e],(t,e)=>t.filter(i=>i.issue_type===e))),Ul=Ca.reducer,_e=P(t=>t.uuid),Dl=_e.getInitialState({}),Na=d.createSlice({name:"issueTypeAttachments",initialState:Dl,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Dl)),reducers:{initializeIssueTypeAttachments:_e.initialize,addIssueTypeAttachment:_e.addOne,addIssueTypeAttachments:_e.addMany,setIssueTypeAttachment:_e.setOne,setIssueTypeAttachments:_e.setMany,updateIssueTypeAttachment:_e.updateOne,updateIssueTypeAttachments:_e.updateMany,deleteIssueTypeAttachment:_e.deleteOne,deleteIssueTypeAttachments:_e.deleteMany}}),{initializeIssueTypeAttachments:Ha,addIssueTypeAttachment:VI,addIssueTypeAttachments:Cl,setIssueTypeAttachment:kl,setIssueTypeAttachments:jI,updateIssueTypeAttachment:qI,updateIssueTypeAttachments:Bl,deleteIssueTypeAttachment:$l,deleteIssueTypeAttachments:Gl}=Na.actions,Ll=t=>t.issueTypeAttachmentReducer.instances,Nl=d.createSelector([Ll],t=>Object.values(t)),Hl=t=>e=>e.issueTypeAttachmentReducer.instances[t],zI=y(d.createSelector([Nl,(t,e)=>e],(t,e)=>I(t.filter(({issue_type:i})=>e===i)))),Wl=Na.reducer,Re=P(t=>t.uuid),Kl=Re.getInitialState({}),Wa=d.createSlice({name:"issueTypeFieldsAttachments",initialState:Kl,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Kl)),reducers:{initializeIssueTypeFieldsAttachments:Re.initialize,addIssueTypeFieldsAttachment:Re.addOne,addIssueTypeFieldsAttachments:Re.addMany,setIssueTypeFieldsAttachment:Re.setOne,setIssueTypeFieldsAttachments:Re.setMany,updateIssueTypeFieldsAttachment:Re.updateOne,updateIssueTypeFieldsAttachments:Re.updateMany,deleteIssueTypeFieldsAttachment:Re.deleteOne,deleteIssueTypeFieldsAttachments:Re.deleteMany}}),{initializeIssueTypeFieldsAttachments:Yl,addIssueTypeFieldsAttachment:UI,addIssueTypeFieldsAttachments:Zl,setIssueTypeFieldsAttachment:DI,setIssueTypeFieldsAttachments:CI,updateIssueTypeFieldsAttachment:kI,updateIssueTypeFieldsAttachments:Jl,deleteIssueTypeFieldsAttachment:BI,deleteIssueTypeFieldsAttachments:Xl}=Wa.actions,Ql=t=>t.issueTypeFieldsAttachmentReducer.instances,xl=d.createSelector([Ql],t=>Object.values(t)),$I=y(d.createSelector([xl,(t,e)=>e],(t,e)=>I(t.filter(i=>i.fields_revision===e)))),GI=t=>e=>e.issueTypeFieldsAttachmentReducer.instances[t],eh=Wa.reducer,ve=P(t=>t.uuid),th=ve.getInitialState({}),Ka=d.createSlice({name:"issueTypeFieldValues",initialState:th,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,th)),reducers:{initializeIssueTypeFieldValues:ve.initialize,addIssueTypeFieldValues:ve.addOne,addIssueTypeFieldValuesMany:ve.addMany,setIssueTypeFieldValues:ve.setOne,setIssueTypeFieldValuesMany:ve.setMany,updateIssueTypeFieldValues:ve.updateOne,updateIssueTypeFieldValuesMany:ve.updateMany,deleteIssueTypeFieldValues:ve.deleteOne,deleteIssueTypeFieldValuesMany:ve.deleteMany}}),{initializeIssueTypeFieldValues:sh,addIssueTypeFieldValues:Ya,addIssueTypeFieldValuesMany:LI,setIssueTypeFieldValues:NI,setIssueTypeFieldValuesMany:HI,updateIssueTypeFieldValues:St,updateIssueTypeFieldValuesMany:WI,deleteIssueTypeFieldValues:Za,deleteIssueTypeFieldValuesMany:KI}=Ka.actions,ih=t=>t.issueTypeFieldValuesReducer.instances,Ja=d.createSelector([ih],t=>Object.values(t)),YI=y(d.createSelector([Ja,(t,e)=>e],(t,e)=>I(t.filter(i=>i.issue===e)))),Xa=t=>e=>e.issueTypeFieldValuesReducer.instances[t],ah=Ka.reducer,we=P(t=>t.uuid),nh=we.getInitialState({}),Qa=d.createSlice({name:"issueTypeFields",initialState:nh,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,nh)),reducers:{initializeIssueTypeFields:we.initialize,addIssueTypeFields:we.addOne,addIssueTypeFieldsMany:we.addMany,setIssueTypeFields:we.setOne,setIssueTypeFieldsMany:we.setMany,updateIssueTypeFields:we.updateOne,updateIssueTypeFieldsMany:we.updateMany,deleteIssueTypeFields:we.deleteOne,deleteIssueTypeFieldsMany:we.deleteMany}}),{initializeIssueTypeFields:ch,addIssueTypeFields:rh,addIssueTypeFieldsMany:ZI,setIssueTypeFields:JI,setIssueTypeFieldsMany:XI,updateIssueTypeFields:dh,updateIssueTypeFieldsMany:QI,deleteIssueTypeFields:uh,deleteIssueTypeFieldsMany:xI}=Qa.actions,oh=t=>t.issueTypeFieldsReducer.instances,Ht=d.createSelector([oh],t=>Object.values(t)),eT=y(d.createSelector([Ht,(t,e)=>e],(t,e)=>I(t.filter(i=>i.issue_type===e)))),tT=y(d.createSelector([Ht,(t,e)=>e],(t,e)=>t.filter(i=>i.issue_type===e).sort((i,a)=>i.submitted_at>a.submitted_at?-1:1)[0])),sT=y(d.createSelector([Ht,Ja,(t,e)=>e],(t,e,i)=>{const a=new Set(t.filter(n=>n.issue_type===i).map(n=>n.uuid));return I(e.filter(n=>a.has(n.fields_revision)))})),iT=t=>e=>e.issueTypeFieldsReducer.instances[t],lh=Qa.reducer,Me=P(t=>t.uuid),hh=Me.getInitialState({}),xa=d.createSlice({name:"issueTypeFieldValuesAttachments",initialState:hh,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,hh)),reducers:{initializeIssueTypeFieldValuesAttachments:Me.initialize,addIssueTypeFieldValuesAttachment:Me.addOne,addIssueTypeFieldValuesAttachments:Me.addMany,setIssueTypeFieldValuesAttachment:Me.setOne,setIssueTypeFieldValuesAttachments:Me.setMany,updateIssueTypeFieldValuesAttachment:Me.updateOne,updateIssueTypeFieldValuesAttachments:Me.updateMany,deleteIssueTypeFieldValuesAttachment:Me.deleteOne,deleteIssueTypeFieldValuesAttachments:Me.deleteMany}}),{initializeIssueTypeFieldValuesAttachments:mh,addIssueTypeFieldValuesAttachment:aT,addIssueTypeFieldValuesAttachments:Wt,setIssueTypeFieldValuesAttachment:nT,setIssueTypeFieldValuesAttachments:cT,updateIssueTypeFieldValuesAttachment:rT,updateIssueTypeFieldValuesAttachments:ph,deleteIssueTypeFieldValuesAttachment:dT,deleteIssueTypeFieldValuesAttachments:Kt}=xa.actions,Ah=t=>t.issueTypeFieldValuesAttachmentReducer.instances,en=d.createSelector([Ah],t=>Object.values(t)),uT=t=>e=>e.issueTypeFieldValuesAttachmentReducer.instances[t],fh=y(d.createSelector([en,(t,e)=>e],(t,e)=>{const i=new Set(e);return I(t.filter(a=>i.has(a.uuid)))})),yh=y(d.createSelector([en,(t,e)=>e],(t,e)=>I(t.filter(i=>i.field_values===e)))),Sh=xa.reducer,Ee=P(t=>t.uuid),Ih=Ee.getInitialState({}),tn=d.createSlice({name:"issueTypeIdentifiers",initialState:Ih,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Ih)),reducers:{initializeIssueTypeIdentifiers:Ee.initialize,addIssueTypeIdentifier:Ee.addOne,addIssueTypeIdentifiers:Ee.addMany,setIssueTypeIdentifier:Ee.setOne,setIssueTypeIdentifiers:Ee.setMany,updateIssueTypeIdentifier:Ee.updateOne,updateIssueTypeIdentifiers:Ee.updateMany,deleteIssueTypeIdentifier:Ee.deleteOne,deleteIssueTypeIdentifiers:Ee.deleteMany}}),{initializeIssueTypeIdentifiers:Th,addIssueTypeIdentifier:sn,addIssueTypeIdentifiers:oT,setIssueTypeIdentifier:lT,setIssueTypeIdentifiers:hT,updateIssueTypeIdentifier:It,updateIssueTypeIdentifiers:mT,deleteIssueTypeIdentifier:an,deleteIssueTypeIdentifiers:pT}=tn.actions,gh=t=>t.issueTypeIdentifierReducer.instances,bh=d.createSelector([gh],t=>Object.values(t)),nn=t=>e=>e.issueTypeIdentifierReducer.instances[t],AT=y(d.createSelector([bh,(t,e)=>e],(t,e)=>I(t.filter(i=>i.issue_type===e)))),Fh=tn.reducer,Ve=P(t=>t.uuid),Ph=Ve.getInitialState({}),cn=d.createSlice({name:"issueTypeIdentifierValues",initialState:Ph,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,Ph)),reducers:{initializeIssueTypeIdentifierValues:Ve.initialize,addIssueTypeIdentifierValue:Ve.addOne,addIssueTypeIdentifierValues:Ve.addMany,setIssueTypeIdentifierValue:Ve.setOne,setIssueTypeIdentifierValues:Ve.setMany,updateIssueTypeIdentifierValue:Ve.updateOne,updateIssueTypeIdentifierValues:Ve.updateMany,deleteIssueTypeIdentifierValue:Ve.deleteOne,deleteIssueTypeIdentifierValues:Ve.deleteMany}}),{initializeIssueTypeIdentifierValues:Oh,addIssueTypeIdentifierValue:rn,addIssueTypeIdentifierValues:fT,setIssueTypeIdentifierValue:yT,setIssueTypeIdentifierValues:ST,updateIssueTypeIdentifierValue:Tt,updateIssueTypeIdentifierValues:IT,deleteIssueTypeIdentifierValue:dn,deleteIssueTypeIdentifierValues:TT}=cn.actions,_h=t=>t.issueTypeIdentifierValueReducer.instances,un=d.createSelector([_h],t=>Object.values(t)),on=t=>e=>e.issueTypeIdentifierValueReducer.instances[t],gT=y(d.createSelector([un,(t,e)=>e],(t,e)=>I(t.filter(i=>i.issue===e)))),bT=y(d.createSelector([un,(t,e)=>e],(t,e)=>I(t.filter(i=>i.issue_type_identifier===e)))),Rh=cn.reducer,C=P(t=>t.uuid),vh=C.getInitialState({}),ln=d.createSlice({name:"issueTypes",initialState:vh,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,vh)),reducers:{initializeIssueTypes:C.initialize,addIssueType:C.addOne,addIssueTypes:C.addMany,setIssueType:C.setOne,setIssueTypes:C.setMany,updateIssueType:C.updateOne,updateIssueTypes:C.updateMany,deleteIssueType:C.deleteOne,deleteIssueTypes:C.deleteMany,removeIssueType:C.deleteOne}}),{initializeIssueTypes:wh,addIssueType:Mh,addIssueTypes:FT,setIssueType:gt,setIssueTypes:PT,updateIssueType:Eh,updateIssueTypes:OT,deleteIssueType:_T,deleteIssueTypes:RT,removeIssueType:hn}=ln.actions,mn=t=>t.issueTypeReducer.instances,Vh=d.createSelector(mn,t=>Object.values(t)),pn=t=>e=>e.issueTypeReducer.instances[t],vT=y(d.createSelector([mn,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n?i.push(n):console.warn("selectIssueTypesByIds: No issue type exists with the id",a)}return i})),wT=y(d.createSelector([Vh,(t,e)=>e],(t,e)=>I(t.filter(i=>i.organization===e)))),jh=ln.reducer,je=P(t=>t.uuid),qh=je.getInitialState({}),An=d.createSlice({name:"issueUpdates",initialState:qh,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,qh)),reducers:{initializeIssueUpdates:je.initialize,addIssueUpdate:je.addOne,addIssueUpdates:je.addMany,setIssueUpdate:je.setOne,setIssueUpdates:je.setMany,updateIssueUpdate:je.updateOne,updateIssueUpdates:je.updateMany,deleteIssueUpdate:je.deleteOne,deleteIssueUpdates:je.deleteMany}}),{initializeIssueUpdates:zh,addIssueUpdate:Uh,addIssueUpdates:Dh,setIssueUpdate:MT,setIssueUpdates:ET,updateIssueUpdate:VT,updateIssueUpdates:jT,deleteIssueUpdate:Ch,deleteIssueUpdates:kh}=An.actions,Bh=t=>t.issueUpdateReducer.instances,$h=d.createSelector([Bh],t=>Object.values(t)),Gh=y(d.createSelector([$h,(t,e)=>e],(t,e)=>I(t.filter(i=>i.issue===e)))),Lh=An.reducer,qe=P(t=>t.id),Nh=qe.getInitialState({currentUser:null}),fn=d.createSlice({name:"users",initialState:Nh,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Nh)),reducers:{initializeUsers:qe.initialize,setUsers:qe.setMany,setUser:qe.setOne,addUsers:qe.addMany,addUser:qe.addOne,updateUsers:qe.updateMany,updateUser:qe.updateOne,deleteUser:qe.deleteOne,deleteUsers:qe.deleteMany,setCurrentUser:(t,e)=>{t.currentUser=e.payload},setProfilePicture:(t,e)=>{if(!t.currentUser)return;t.currentUser.profile.file=e.payload.file??null,t.currentUser.profile.file_sha1=e.payload.file_sha1??null;const i=t.instances[t.currentUser.id];if(!i)throw new Error("Unable to find current user in users slice");i.profile.file=e.payload.file??null,i.profile.file_sha1=e.payload.file_sha1??null}}}),{initializeUsers:Hh,setUsers:qT,setUser:zT,addUsers:UT,addUser:Wh,updateUsers:DT,updateUser:CT,deleteUser:Kh,deleteUsers:kT,setCurrentUser:BT,setProfilePicture:$T}=fn.actions,Yh=fn.reducer,Zh=t=>t.userReducer.currentUser,Yt=t=>t.userReducer.instances,yn=d.createSelector([Yt],t=>Object.values(t)),Jh=t=>e=>e.userReducer.instances[t],GT=y(d.createSelector([Yt,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n?i.push(n):console.warn("selectUsersByIds: No user exists with the id",a)}return I(i)})),ze=P(t=>t.uuid),Xh=ze.getInitialState({}),Sn=d.createSlice({name:"organizationAccess",initialState:Xh,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Xh)),reducers:{initializeOrganizationAccesses:ze.initialize,addOrganizationAccess:ze.addOne,addOrganizationAccesses:ze.addMany,setOrganizationAccess:ze.setOne,setOrganizationAccesses:ze.setMany,updateOrganizationAccess:ze.updateOne,updateOrganizationAccesses:ze.updateMany,deleteOrganizationAccess:ze.deleteOne,deleteOrganizationAccesses:ze.deleteMany}}),{initializeOrganizationAccesses:Qh,addOrganizationAccess:xh,addOrganizationAccesses:LT,setOrganizationAccess:NT,setOrganizationAccesses:HT,updateOrganizationAccess:Zt,updateOrganizationAccesses:WT,deleteOrganizationAccess:em,deleteOrganizationAccesses:KT}=Sn.actions,tm=Sn.reducer,In=t=>t.organizationAccessReducer.instances,Tn=t=>e=>e.organizationAccessReducer.instances[t],YT=d.createSelector([Zh,In],(t,e)=>Object.values(e).find(a=>a.user===(t==null?void 0:t.id))??null),sm=d.createSelector([In],t=>{const e={};for(const i of Object.values(t))e[i.user]=i;return Ot(e)}),ZT=y(d.createSelector([Yt,sm,(t,e)=>e],(t,e,i)=>I(Object.values(t).filter(a=>{const n=e[a.id];return!!n&&n.organization===i})))),Ue=P(t=>t.uuid),im=Ue.getInitialState({}),gn=d.createSlice({name:"organizations",initialState:im,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,im)),reducers:{initializeOrganizations:Ue.initialize,setOrganizations:Ue.setMany,setOrganization:Ue.setOne,addOrganizations:Ue.addMany,addOrganization:Ue.addOne,updateOrganizations:Ue.updateMany,updateOrganization:Ue.updateOne,deleteOrganization:Ue.deleteOne,deleteOrganizations:Ue.deleteMany}}),{initializeOrganizations:am,setOrganizations:JT,setOrganization:XT,addOrganizations:QT,addOrganization:nm,updateOrganizations:xT,updateOrganization:cm,deleteOrganization:eg,deleteOrganizations:tg}=gn.actions,rm=t=>t.organizationReducer.instances,sg=d.createSelector([rm],t=>Object.values(t)),ig=t=>e=>e.organizationReducer.instances[t],dm=gn.reducer,um=(t,e,i)=>{const a=t.uuid?t:{...t,uuid:Xe.v4()};return{payload:a,type:"",meta:{offline:{effect:{timestamp:new Date().toISOString(),request:a,BASE_URL:e,serviceName:i}}}}},om={deletedRequests:[],latestRetryTime:0},bn=d.createSlice({name:"outbox",initialState:om,extraReducers:t=>t.addCase(g,e=>Object.assign(e,om)),reducers:{enqueueRequest:{reducer:(t,e)=>t,prepare:t=>{console.debug("Preparing to enqueue request",t);const{BASE_URL:e,serviceName:i,...a}=t;return um(a,e,i)}},markForDeletion(t,e){t.deletedRequests.push(e.payload)},markAsDeleted(t,e){const i=t.deletedRequests.indexOf(e.payload);i!==-1&&t.deletedRequests.splice(i,1)},_setLatestRetryTime:(t,e)=>{t.latestRetryTime=e.payload}}}),ag=t=>t.outboxReducer.deletedRequests,ng=t=>t.outboxReducer.latestRetryTime,{enqueueRequest:lm,markForDeletion:cg,markAsDeleted:hm,_setLatestRetryTime:mm}=bn.actions,pm=bn.reducer,De=P(t=>t.uuid),Am=De.getInitialState({}),Fn=d.createSlice({name:"projectAccess",initialState:Am,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Am)),reducers:{initializeProjectAccesses:De.initialize,addProjectAccess:De.addOne,addProjectAccesses:De.addMany,setProjectAccess:De.setOne,setProjectAccesses:De.setMany,updateProjectAccess:De.updateOne,updateProjectAccesses:De.updateMany,deleteProjectAccess:De.deleteOne,deleteProjectAccesses:De.deleteMany}}),{initializeProjectAccesses:fm,addProjectAccess:Pn,addProjectAccesses:On,setProjectAccess:rg,setProjectAccesses:dg,updateProjectAccess:bt,updateProjectAccesses:ym,deleteProjectAccess:_n,deleteProjectAccesses:Rn}=Fn.actions,Sm=Fn.reducer,vn=t=>t.projectAccessReducer.instances,Jt=d.createSelector(vn,t=>Object.values(t)),wn=t=>e=>e.projectAccessReducer.instances[t],Im=y(d.createSelector([vn,(t,e)=>e],(t,e)=>I(Object.values(t).filter(i=>i.project===e)))),ug=y(d.createSelector([Jt,(t,e)=>e],(t,e)=>{const i={};for(const a of t.filter(n=>n.project===e))i[a.user]=a;return i})),og=y(d.createSelector([yn,Jt,(t,e)=>e],(t,e,i)=>{const a=new Set(e.filter(n=>n.project===i).map(n=>n.user));return I(t.filter(n=>a.has(n.id)))})),Ce=P(t=>t.uuid),Tm=Ce.getInitialState({}),Mn=d.createSlice({name:"projectAttachments",initialState:Tm,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Tm)),reducers:{initializeProjectAttachments:Ce.initialize,addProjectAttachment:Ce.addOne,addProjectAttachments:Ce.addMany,setProjectAttachment:Ce.setOne,setProjectAttachments:Ce.setMany,updateProjectAttachment:Ce.updateOne,updateProjectAttachments:Ce.updateMany,deleteProjectAttachment:Ce.deleteOne,deleteProjectAttachments:Ce.deleteMany}}),{initializeProjectAttachments:gm,addProjectAttachment:lg,addProjectAttachments:bm,setProjectAttachment:Fm,setProjectAttachments:Pm,updateProjectAttachment:hg,updateProjectAttachments:Om,deleteProjectAttachment:_m,deleteProjectAttachments:En}=Mn.actions,Rm=t=>t.projectAttachmentReducer.instances,vm=d.createSelector([Rm],t=>Object.values(t)),wm=t=>e=>e.projectAttachmentReducer.instances[t],Mm=y(d.createSelector([vm,(t,e)=>e],(t,e)=>I(t.filter(({project:i})=>e===i)))),Em=Mn.reducer,ke=P(t=>t.uuid),Vm=ke.getInitialState({activeProjectFileId:null,isImportingProjectFile:!1}),Vn=d.createSlice({name:"projectFiles",initialState:Vm,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,Vm)),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,e)=>{t.isImportingProjectFile=e.payload},saveActiveProjectFileBounds:(t,e)=>{const i=t.activeProjectFileId;if(!i)throw new Error("Tried to save bounds for active project file, but no active project file was set.");if(!t.instances[i])throw new Error(`Tried to save bounds for active project file, but project file with ID ${i}
|
|
2
|
+
doesn't exist.`);t.instances[i].bounds=e.payload},setActiveProjectFileId:(t,e)=>{t.activeProjectFileId=e.payload},resetProjectFileObjectUrls:(t,...e)=>{for(const i in t.instances)delete t.instances[i].objectURL}}}),{initializeProjectFiles:jm,setProjectFile:mg,setProjectFiles:pg,addProjectFile:Ag,addProjectFiles:qm,updateProjectFile:jn,updateProjectFiles:fg,deleteProjectFile:zm,deleteProjectFiles:Um,setIsImportingProjectFile:Dm,setActiveProjectFileId:Cm,saveActiveProjectFileBounds:km,resetProjectFileObjectUrls:yg}=Vn.actions,Bm=t=>t.projectFileReducer.instances,$m=d.createSelector([Bm],t=>I(Object.values(t).sort((e,i)=>e.z_index-i.z_index))),Sg=t=>e=>e.projectFileReducer.instances[t],Ig=t=>t.projectFileReducer.activeProjectFileId,Tg=t=>t.projectFileReducer.isImportingProjectFile,Gm=Vn.reducer,Be=P(t=>t.uuid),Lm=Be.getInitialState({}),qn=d.createSlice({name:"projects",initialState:Lm,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Lm)),reducers:{initializeProjects:Be.initialize,setProjects:Be.setMany,setProject:Be.setOne,addProjects:Be.addMany,addProject:Be.addOne,updateProjects:Be.updateMany,updateProject:Be.updateOne,deleteProject:Be.deleteOne,deleteProjects:Be.deleteMany}}),{initializeProjects:Nm,setProjects:gg,setProject:bg,addProjects:Fg,addProject:zn,updateProjects:Pg,updateProject:Hm,deleteProject:Un,deleteProjects:Og}=qn.actions,Wm=qn.reducer,Km=t=>t.projectReducer.instances,Dn=d.createSelector([Km],t=>I(Object.values(t))),Ym=t=>e=>e.projectReducer.instances[t],_g=y(d.createSelector([Dn,Jt,(t,e)=>e],(t,e,i)=>{const a=new Set(e.filter(n=>n.user===i).map(n=>n.project));return I(t.filter(n=>a.has(n.uuid)))})),Rg=y(d.createSelector([Dn,(t,e)=>e],(t,e)=>I(t.filter(i=>i.organization===e)))),vg={isRehydrated:!1},Cn=d.createSlice({name:"rehydrated",initialState:vg,reducers:{setRehydrated:(t,e)=>{t.isRehydrated=e.payload}}}),{setRehydrated:wg}=Cn.actions,Mg=t=>t.rehydratedReducer.isRehydrated,Zm=Cn.reducer,$e=P(t=>t.uuid),Jm=$e.getInitialState({}),kn=d.createSlice({name:"teamMemberships",initialState:Jm,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Jm)),reducers:{initializeTeamMemberships:$e.initialize,addTeamMembership:$e.addOne,addTeamMemberships:$e.addMany,setTeamMembership:$e.setOne,setTeamMemberships:$e.setMany,updateTeamMembership:$e.updateOne,updateTeamMemberships:$e.updateMany,deleteTeamMembership:$e.deleteOne,deleteTeamMemberships:$e.deleteMany}}),{initializeTeamMemberships:Xm,addTeamMembership:Qm,addTeamMemberships:xm,setTeamMembership:Bn,setTeamMemberships:ep,updateTeamMembership:Eg,updateTeamMemberships:Vg,deleteTeamMembership:$n,deleteTeamMemberships:tp}=kn.actions,sp=kn.reducer,ip=t=>t.teamMembershipReducer.instances,Gn=d.createSelector([ip],t=>Object.values(t)),ap=t=>e=>e.teamMembershipReducer.instances[t],jg=y(d.createSelector([Gn,(t,e)=>e],(t,e)=>{const i={};for(const a of t.filter(n=>n.team===e))i[a.user]=a;return i})),qg=y(d.createSelector([yn,Gn,(t,e)=>e],(t,e,i)=>{const a=new Set(e.filter(n=>n.team===i).map(n=>n.user));return I(t.filter(n=>a.has(n.id)))})),Ge=P(t=>t.uuid),np=Ge.getInitialState({}),Ln=d.createSlice({name:"teams",initialState:np,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,np)),reducers:{initializeTeams:Ge.initialize,addTeam:Ge.addOne,addTeams:Ge.addMany,setTeam:Ge.setOne,setTeams:Ge.setMany,updateTeam:Ge.updateOne,updateTeams:Ge.updateMany,deleteTeam:Ge.deleteOne,deleteTeams:Ge.deleteMany}}),{initializeTeams:cp,addTeam:rp,addTeams:zg,setTeam:Ft,setTeams:Ug,updateTeam:dp,updateTeams:Dg,deleteTeam:Nn,deleteTeams:Cg}=Ln.actions,Hn=t=>t.teamReducer.instances,up=d.createSelector([Hn],t=>Object.values(t)),Wn=t=>e=>e.teamReducer.instances[t],kg=y(d.createSelector([Hn,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n?i.push(n):console.warn("selectTeamsByIds: No team exists with the id",a)}return I(i)})),Bg=y(d.createSelector([up,(t,e)=>e],(t,e)=>I(t.filter(i=>i.organization===e)))),op=Ln.reducer,$g={version:0},lp=d.createSlice({name:"versioning",initialState:$g,reducers:{}}),hp=lp.reducer,Kn={outboxReducer:pm,fileReducer:xu,authReducer:Iu},Gg=d.combineReducers(Kn),mp={...Kn,[it]:hp,categoryReducer:Ou,assetReducer:cd,assetAttachmentReducer:wc,assetStageCompletionReducer:ld,assetStageReducer:yd,assetTypeReducer:fu,assetTypeAttachmentReducer:vd,issueReducer:Ul,issueAttachmentReducer:fl,issueTypeReducer:jh,issueTypeAttachmentReducer:Wl,organizationReducer:dm,projectReducer:Wm,projectAttachmentReducer:Em,projectAccessReducer:Sm,organizationAccessReducer:tm,projectFileReducer:Gm,rehydratedReducer:Zm,formReducer:_o,formRevisionReducer:Fo,formRevisionAttachmentReducer:fo,formSubmissionAttachmentReducer:Uo,formSubmissionReducer:Lo,formIdentifierReducer:ao,formIdentifierValueReducer:uo,userReducer:Yh,emailDomainsReducer:Yu,documentsReducer:$u,documentAttachmentReducer:Uu,teamReducer:op,agentsReducer:Tc,issueCommentReducer:Ml,issueCommentAttachmentReducer:_l,issueUpdateReducer:Lh,geoImageReducer:xo,issueAssociationReducer:rl,issueTypeFieldsReducer:lh,issueTypeFieldValuesReducer:ah,issueTypeFieldsAttachmentReducer:eh,issueTypeFieldValuesAttachmentReducer:Sh,issueTypeIdentifierReducer:Fh,issueTypeIdentifierValueReducer:Rh,assetTypeFieldsReducer:Ld,assetTypeFieldValuesReducer:iu,assetTypeFieldsAttachmentReducer:Ud,assetTypeFieldValuesAttachmentReducer:Jd,assetTypeIdentifierReducer:du,assetTypeIdentifierValueReducer:hu,assetProcedureReducer:Pr,assetProcedureInstanceReducer:Tr,assetProcedureFieldsReducer:tr,assetProcedureFieldValuesReducer:pr,assetProcedureFieldsAttachmentReducer:Yc,assetProcedureFieldValuesAttachmentReducer:dr,assetProcedureAttachmentReducer:Dc,assetProcedureStepFieldsAttachmentReducer:jr,assetProcedureStepFieldsReducer:Ur,assetProcedureStepFieldValuesAttachmentReducer:Lr,assetProcedureStepFieldValuesReducer:Jr,assetProcedureStepReducer:ed,teamMembershipReducer:sp},Lg=d.combineReducers(mp);function Ng(t,e){return Up.useMemo(t,e)}class Hg{constructor(e){S(this,"operations",[]);S(this,"getData");this.getData=e}performOperations(e){let i=e;for(const a of this.operations)i=a(i);return i}filter(e,i){return this.operations.push(a=>a.filter(n=>n[e]===i)),this}exclude(e,i){return this.operations.push(a=>a.filter(n=>n[e]!==i)),this}orderBy(e){return this.operations.push(i=>[...i].sort((a,n)=>a[e]<=n[e]?1:-1)),this}reverse(){return this.operations.push(e=>[...e].reverse()),this}all(){return this.operations.push(e=>e),this}get(e,i){return d.createSelector([this.getData],a=>this.performOperations(a).find(n=>n[e]===i))}count(){return d.createSelector([this.getData],e=>this.performOperations(e).length)}first(){return d.createSelector([this.getData],e=>this.performOperations(e)[0])}last(){return d.createSelector([this.getData],e=>{const i=this.performOperations(e);return i[i.length-1]})}exists(){return d.createSelector([this.getData],e=>this.performOperations(e).length>0)}toSelector(){return d.createSelector([this.getData],e=>I(this.performOperations(e)))}}const pp={};class Ap{constructor(e){S(this,"client");pp[this.constructor.name]=this,this.client=e}async enqueueRequest(e,i){return this.client.enqueueRequest(e,this.host,this.constructor.name,i)}async performPagination(e,i,a){const n=[];let c=await this.client.enqueueRequest(e,this.host,this.constructor.name,a);for(n.push(c.results);c.next;)c=await this.client.enqueueRequest(i(c.next),this.host,this.constructor.name,a),n.push(c.results);return n}dispatch(e){this.client.store.dispatch(e)}}const fp=()=>Ip.length-1,yp=t=>(t[it]={version:fp()},t),Sp=()=>yp({}),Wg=t=>(t.outboxReducer&&(t.outboxReducer.deletedRequests=[]),t),Kg=t=>e=>{var i;return e===void 0&&(e={}),((i=e[it])==null?void 0:i.version)===fp()?e:t(e)},Ip=[yp,Sp,Sp,Wg],Yg=Object.fromEntries(Ip.map((t,e)=>[e,Kg(t)])),Zg=t=>{if(t)throw t;const e=st();e?e.dispatch({type:"rehydrated/setRehydrated",payload:!0}):console.error("Client store not set")},Tp=(t,e,i)=>{const a=Ze();return a?(a.addRequest(e),a.getQueue()):(console.warn("Outbox coordinator not set; cannot enqueue request yet."),[])},gp=(t,e,i)=>{const a=Ze();if(!a)return console.warn("Outbox coordinator not set; cannot dequeue request yet."),[];const c=e.meta.offlineAction.payload.uuid;return a.remove(c),a.getQueue()};async function Jg(t,e){if(!e.payload)throw new Error("Received empty payload");return Vp(e)}const Xg={...tc,effect:Jg,discard:Zn,returnPromises:!0,persistCallback:Zg,retry:sb,persistOptions:{storage:Cp},queue:{...tc.queue,enqueue:Tp,dequeue:gp,peek:(...t)=>tb(...t)}},Qg=kp(Yg,it),xg=d.compose(Dp.offline(Xg),Qg);function eb(t){function e(i){return typeof i=="object"&&i!==null&&["ok","redirect","clientError","serverError","error"].every(n=>n in i)}if(e(t))return t;if(typeof t=="object"&&t!==null){const i=t;if(e(i.response))return i.response;if(i.response&&e(i.response.response))return i.response.response}}async function Yn(t,e,i){const a=pp[t.meta.offline.effect.serviceName];if(!a)throw new Error(`Service ${t.meta.offline.effect.serviceName} not found`);const n=a instanceof R;if(e.store.getState().outboxReducer.deletedRequests.includes(t.payload.uuid))throw new Error("Request was marked for deletion");n&&t.payload.checkAuth!==!1&&await a.auth.prepareAuth();const r={queryParams:"",isAuthNeeded:!0},u=t.meta.offline.effect,{payload:m,headers:o,method:h,queryParams:p,attachmentHash:A,isExternalUrl:f,isAuthNeeded:T,isResponseBlob:F}={...r,...u.request},_=u.request;let w=_.url;const z=A?await e.files.fetchCache(A):void 0;if(A&&!z)throw new Error(`Cannot upload file ${A} because it's not cached.`);!f&&!w.startsWith("http")&&(!w.startsWith("/")&&!w.startsWith("blob:")&&(w="/"+w),w=t.meta.offline.effect.BASE_URL+w);const Le=q=>{if(A){const Ne=_.s3url;if(!Ne)throw new Error(`No S3 URL for file ${A}`);if("warning"in Ne)throw new Error(`S3 URL warning for file ${A}`);if(!z)throw new Error(`No file for file ${A}`);const Pt=Ne.fields["x-amz-checksum-sha1"];if(!Pt)throw new Error(`No checksum for file ${A}`);return q.set("x-amz-checksum-sha1",Pt).field({...m,...Ne.fields}).attach("file",z)}return q.send(m)},gF={[l.GET]:()=>F?Je.get(w.toString()).responseType("blob"):Je.get(w.toString()),[l.POST]:()=>{const q=Je.post(w.toString());return Le(q)},[l.PATCH]:()=>{const q=Je.patch(w.toString());return Le(q)},[l.PUT]:()=>{const q=Je.put(w.toString());return Le(q)},[l.DELETE]:()=>{const q=Je.delete(w.toString());return Le(q)}}[h];let Ke=gF();if(i==null||i.addEventListener("abort",()=>{console.debug("aborting request:",_),Ke.abort()}),T&&n){const q=a.auth.getAuthHeader();Ke=Ke.set("Authorization",q)}o&&(Ke=Ke.set(o));try{return await Ke.query(p)}catch(q){const Ne=eb(q),Pt=Ne==null?void 0:Ne.status;if(n&&Pt===401)return await a.auth.handleUnauthorized(Ke,Ne),Ke.query(p);throw new D({response:Ne,innerError:q,discard:bp.includes(Pt)})}}const bp=[400,409,403,404,405,500];function Zn(t,e,i=0){var o;if(console.debug("Considering discarding request due to error:",t,`(${typeof t})`,`
|
|
3
3
|
Action:`,e,`
|
|
4
|
-
Retries:`,i),!(t instanceof Error))throw console.error("ENCOUNTERED NON-ERROR ERROR:",t,"(throwing immediately, which may lead to unexpected behavior)"),t;const a=
|
|
5
|
-
Action:`,e);const p=
|
|
4
|
+
Retries:`,i),!(t instanceof Error))throw console.error("ENCOUNTERED NON-ERROR ERROR:",t,"(throwing immediately, which may lead to unexpected behavior)"),t;const a=st(),c=a.getState().outboxReducer.deletedRequests,r=e.payload.uuid;function u(){a.dispatch(hm(r));const h=Ze();if(!h)throw new Error("Outbox coordinator not set");h.remove(e.payload.uuid);const p=e.meta.offline.rollback;throw p&&(console.warn("Rolling back request due to SDK error:",e),a.dispatch(p)),t}if(t instanceof D&&t.options.discard)return console.debug("Discarding request due to explicit discard:",e),u();if(c.includes(r))return console.debug("Discarding request due to deletion:",e),u();if(t instanceof D){const h=t.status||((o=t.response)==null?void 0:o.status);if(h||console.warn("Error has no status code:",t),h!==void 0&&bp.includes(h)){console.warn("Discarding request due to error:",t,`
|
|
5
|
+
Action:`,e);const p=Ze();if(!p)throw new Error("Outbox coordinator not set");p.remove(e.payload.uuid),t.options.discard=!0,u()}}console.debug("Registering a retry for request:",e.payload.uuid);const m=Ze();if(!m)throw new Error("Outbox coordinator not set");return m.registerRetry(e.payload.uuid),!1}function tb(t,e,i){var a;return(a=Ze())==null?void 0:a.peek()}function sb(t,e){return st().dispatch(mm(new Date().getTime())),cc}const et="An unknown error occurred",ib=500,Fp=["non_field_errors","detail"];function ab(t,e){let i;if(t!=null&&t.body)if(typeof t.body=="object"){const a=t.body;if(typeof a.error=="string")i=a.error;else if(typeof a.message=="string")i=a.message;else try{i=Object.entries(a).map(([n,c])=>typeof c=="string"?Fp.includes(n)?c:`${n}: ${c}`:Array.isArray(c)?Fp.includes(n)?c.join(`
|
|
6
6
|
`):c.map(r=>`${n}: ${r}`).join(`
|
|
7
7
|
`):`${n}: ${JSON.stringify(c)}`).join(`
|
|
8
|
-
`)}catch(n){console.error("Failed to extract error message from response body",n)}}else typeof t.body=="string"&&(i=t.body);else t!=null&&t.text?i=t.text:e instanceof Error&&(i=e.message);return!i||i.length>nb?xe:i}class D extends Error{constructor(i){super(xe);S(this,"status");S(this,"response");S(this,"message");S(this,"options");const{response:a,innerError:n}=i;this.message=i.message??cb(a,n)??xe,this.status=(a==null?void 0:a.status)??0,this.response=a,i.discard=i.discard??!1,this.options=i}}class rb extends Sp{constructor(e){super(e)}}class R extends Sp{constructor(i,a){super(i);S(this,"auth");this.auth=a}}class db extends R{async startConversation(e,i){return this.enqueueRequest({description:"Start agent conversation",method:l.POST,url:"/agents/prompt/",payload:{prompt:e,active_project:i},blockers:["prompt"],blocks:["prompt"]}).then(a=>(this.dispatch(Sc(a)),a))}async continueConversation(e,i,a){return this.enqueueRequest({description:"Prompt agent",method:l.POST,url:"/agents/prompt/",payload:{prompt:e,active_project:a},blockers:["prompt"],blocks:["prompt"],queryParams:{conversation_id:i}}).then(n=>{this.dispatch(Tc(n))})}async fetchDetails(e){return this.enqueueRequest({description:"Get agent conversation",method:l.GET,url:`/agents/conversations/${e}/`,blockers:["conversation"],blocks:["conversation"]}).then(i=>{this.dispatch(Ic(i))})}async rate(e,i){return this.enqueueRequest({description:"Rate agent response",method:l.PUT,url:`/agents/responses/${e}/rate/`,payload:{rating:i},blockers:["rate"],blocks:["rate"]})}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get agent conversation history",method:l.GET,url:"/agents/conversations/",queryParams:{project:e},blockers:["agent-conversations"],blocks:["agent-conversations"]},i);return this.dispatch(yc(a)),a}}const ub=5e4,E=1e3,ob="limit";class j extends R{getNumberOfAttachmentsWithSha1(e){const{issueAttachmentReducer:i,assetAttachmentReducer:a,assetTypeAttachmentReducer:n,documentAttachmentReducer:c,projectAttachmentReducer:r,formRevisionAttachmentReducer:u,formSubmissionAttachmentReducer:m,geoImageReducer:o,assetTypeFieldsAttachmentReducer:h,assetTypeFieldValuesAttachmentReducer:p,issueTypeFieldsAttachmentReducer:A,issueTypeFieldValuesAttachmentReducer:f}=this.client.store.getState();return[].concat(Object.values(i.instances),Object.values(a.instances),Object.values(n.instances),Object.values(c.instances),Object.values(r.instances),Object.values(u.instances),Object.values(m.instances),Object.values(o.instances),Object.values(h.instances),Object.values(p.instances),Object.values(A.instances),Object.values(f.instances)).filter(F=>F.file_sha1===e).length}processPresignedUrls(e){const i={};for(const[a,n]of Object.entries(e))i[a]=this.enqueueRequest({url:n.url,description:"Upload file to S3",method:l.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:a,blockers:[`s3-${n.fields.key}`],blocks:[a],s3url:n});return i}async getFilePayload(e){const i=await Xe(e),a={sha1:i,file_type:e.type,extension:e.name.split(".").pop(),size:e.size};return await this.client.files.addCache(e,i),a}}class He extends j{async _bulkAdd(e){var o;const{store:i}=this.client,a=(o=i.getState().userReducer.currentUser)==null?void 0:o.id,n=new Date().toISOString(),c=[],r=[],u={};for(const h of e){const{modelUuid:p,file:A}=h,f=await this.getFilePayload(A);f.sha1 in u||(u[f.sha1]=f);const T=this.buildOfflineAttachment({file:A,file_sha1:f.sha1,submitted_at:n,created_by:a,description:"",modelUuid:p});c.push(T),r.push(this.buildAttachmentPayload({uuid:T.uuid,file_name:T.file_name,file_sha1:T.file_sha1,file_extension:f.extension,description:T.description,modelUuid:p}))}this.dispatch(this.addAttachments(c));const m=this.enqueueRequest({description:`Add ${this.name}`,method:l.POST,url:`${this.url}/bulk/`,payload:{submitted_at:n,attachments:r,files:Object.values(u)},blocks:c.map(h=>h.uuid),blockers:c.map(h=>h.file_sha1)});return m.then(({attachments:h,presigned_urls:p})=>{this.dispatch(this.updateAttachments(h)),this.processPresignedUrls(p)}).catch(()=>{this.dispatch(this.removeAttachments(c.map(h=>h.uuid)))}),[c,m.then(({attachments:h})=>h)]}async _delete(e){const{store:i}=this.client,a=this.selectAttachment(e)(i.getState());if(!a)throw new Error(`Attempting to delete attachment with uuid ${e} that does not exist in the store`);this.dispatch(this.removeAttachment(a.uuid));const n=this.enqueueRequest({description:`Delete ${this.name}`,method:l.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return n.then(()=>{this.getNumberOfAttachmentsWithSha1(a.file_sha1)===0&&this.client.files.removeCache(a.file_sha1)}).catch(()=>{this.dispatch(this.setAttachment(a))}),n}}class lb extends He{constructor(){super(...arguments);S(this,"name","Asset Attachment");S(this,"url","/asset-attachments");S(this,"initializeAttachments",us);S(this,"addAttachments",os);S(this,"updateAttachments",Pc);S(this,"removeAttachments",ls);S(this,"removeAttachment",Oc);S(this,"setAttachment",Fc);S(this,"selectAttachment",vc)}buildOfflineAttachment(i){return b({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,asset:i.modelUuid})}buildAttachmentPayload(i){return{...i,asset:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.assetUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const c=(await this.performPagination({immediate:!0,description:"Get asset attachments",method:l.GET,url:`${this.url}/`,queryParams:{limit:E,paginate:!0,asset__project:i},blocks:[],blockers:[]},r=>({immediate:!0,description:"Get asset attachments",method:l.GET,url:r,blockers:[],blocks:[]}),a)).flat();return this.dispatch(us(c)),c}}class hb extends He{constructor(){super(...arguments);S(this,"name","Asset Procedure Attachment");S(this,"url","/asset-procedure-attachments");S(this,"addAttachments",jc);S(this,"updateAttachments",zc);S(this,"removeAttachments",Dc);S(this,"removeAttachment",Uc);S(this,"setAttachment",qc);S(this,"selectAttachment",Gc)}buildOfflineAttachment(i){return b({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,asset_procedure:i.modelUuid})}buildAttachmentPayload(i){return{...i,asset_procedure:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.assetProcedureUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const n=await this.enqueueRequest({immediate:!0,description:"Get asset procedure attachments",method:l.GET,url:`${this.url}/`,queryParams:{asset_procedure__organization:i},blocks:[],blockers:[]},a);return this.dispatch(Vc(n)),n}}class mb extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const o of e){const{fieldsRevisionUuid:h,fieldIdentifier:p,file:A}=o,f=await this.getFilePayload(A);f.sha1 in n||(n[f.sha1]=f);const T=b({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:f.sha1,created_by:a,fields_revision:h,submitted_at:i,field_identifier:p});c.push(T);const F={uuid:T.uuid,file_name:A.name,field_identifier:p,file_extension:f.extension,file_sha1:f.sha1,fields_revision:h};r.push(F)}this.dispatch(Nc(c));const u=this.enqueueRequest({description:"Add asset procedure fields attachments",method:l.POST,url:"/asset-procedure-fields-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(o=>o.fields_revision),blocks:c.map(o=>o.uuid)});return u.then(o=>{this.processPresignedUrls(o.presigned_urls),this.dispatch(Hc(o.attachments))}).catch(()=>{this.dispatch(Wc(c.map(o=>o.uuid)))}),[c,u.then(({attachments:o})=>o)]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset procedure fields attachments",method:l.GET,url:"/asset-procedure-fields-attachments/",queryParams:{fields_revision__asset_procedure__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Lc(a)),a}}class pb extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(Qc(c));const r=this.enqueueRequest({description:"Add Asset Procedure Fields",method:l.POST,url:"/asset-procedure-fields/",payload:v(c),blockers:[c.asset_procedure],blocks:[c.uuid]});return r.then(m=>{this.dispatch(xc(m))}).catch(m=>{throw this.dispatch(er(c.uuid)),m}),[c,r]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get Asset Procedure Fields",method:l.GET,url:"/asset-procedure-fields/",queryParams:{asset_procedure__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Xc(a)),a}}function Ke(t,e){const i=[];let a=0;const n=t.length;for(;a<n;)i.push(t.slice(a,a+=e));return i}class Ab extends j{async bulkAdd(e,i){var o;const a=new Date().toISOString(),n=(o=this.client.store.getState().userReducer.currentUser)==null?void 0:o.id,c=Ke(e,i??e.length),r=[],u=[];for(const h of c){const p={},A=[];for(const f of h){const{fieldValuesUuid:T,fieldIdentifier:F,file:_}=f,w=await this.getFilePayload(_);w.sha1 in p||(p[w.sha1]=w);const z=b({file:URL.createObjectURL(_),file_type:_.type,file_name:_.name,file_sha1:w.sha1,created_by:n,field_values:T,submitted_at:a,field_identifier:F});r.push(z);const Le={uuid:z.uuid,file_name:_.name,file_sha1:w.sha1,file_extension:w.extension,field_identifier:F,field_values:T};A.push(Le)}u.push({submitted_at:a,attachments:A,files:Object.values(p)})}this.dispatch(Ot(r));const m=u.map(h=>this.enqueueRequest({description:"Add asset procedure field values attachments",method:l.POST,url:"/asset-procedure-field-values-attachments/bulk/",payload:h,blockers:h.attachments.map(p=>p.field_values),blocks:h.attachments.map(p=>p.uuid)}));return Promise.all(m).then(h=>{for(const A of h)this.processPresignedUrls(A.presigned_urls);const p=h.flatMap(A=>A.attachments);this.dispatch(nr(p))}).catch(h=>{throw this.dispatch(_t(r.map(p=>p.uuid))),h}),[r,m.map(h=>h.then(({attachments:p})=>p))]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),n=rr(e)(a);this.dispatch(_t(e));try{await this.enqueueRequest({description:"Delete asset procedure field values attachments",method:l.DELETE,url:"/asset-procedure-field-values-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(Ot(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset procedure field values attachments",method:l.GET,url:"/asset-procedure-field-values-attachments/",queryParams:{limit:E,paginate:!0,field_values__asset_procedure_instance__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset procedure field values attachments",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(ar(n)),n}}class fb extends R{add(e){var r;const{store:i}=this.client,a=i.getState(),n=b({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),c=this.enqueueRequest({description:"Add asset procedure field values",method:l.POST,url:"/asset-procedure-field-values/",payload:v(n),blockers:[e.asset,e.fields_revision,e.asset_procedure_instance],blocks:[n.uuid]});return this.dispatch(Is(n)),c.then(u=>(this.dispatch(st(u)),u)).catch(()=>{this.dispatch(Ts(n.uuid))}),[n,c]}bulkAdd(e,i){var m;const a=new Date().toISOString(),n=[],c=Ke(e.payloads,i??e.payloads.length),r=[];for(const o of c){const h=[];for(const p of o){const A=b({...p,values:p.values,created_by:(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,submitted_at:a});n.push(A),h.push({uuid:A.uuid,asset:p.asset,fields_revision:p.fields_revision,asset_procedure_instance:p.asset_procedure_instance,published_at:p.published_at,values:A.values})}r.push({submitted_at:a,values:e.values,field_values:h})}this.dispatch(hr(n));const u=[];for(const o of r){const h=o.field_values.map(F=>F.asset),p=o.field_values.map(F=>F.fields_revision),A=o.field_values.map(F=>F.asset_procedure_instance),f=o.field_values.map(F=>F.uuid),T=this.enqueueRequest({description:"Bulk add asset procedure field values",method:l.POST,url:"/asset-procedure-field-values/bulk/",payload:o,blockers:[...h,...p,...A],blocks:f});u.push(T)}return Promise.all(u).then(o=>{this.dispatch(mr(o.flat()))}).catch(()=>{this.dispatch(pr(n.map(o=>o.uuid)))}),[n,u]}update(e){const{store:i}=this.client,a=i.getState(),n=bs(e.uuid)(a);if(!n)throw new Error(`Expected AssetProcedureFieldValues with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(st(c));const r=this.enqueueRequest({description:"Update asset procedure field values",method:l.PATCH,url:`/asset-procedure-field-values/${e.uuid}/`,payload:e,blockers:[c.fields_revision,c.asset,c.asset_procedure_instance],blocks:[c.uuid]});return r.then(u=>{this.dispatch(st(u))}).catch(()=>{this.dispatch(st(n))}),[c,r]}async delete(e){const{store:i}=this.client,a=i.getState(),n=bs(e)(a);if(!n)throw new Error(`Expected submission with uuid ${e} to exist`);const c=dr(e)(a);this.dispatch(Ts(e)),this.dispatch(_t(c.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete asset procedure field values",method:l.DELETE,url:`/asset-procedure-field-values/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(Is(n)),this.dispatch(Ot(c)),r}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset procedure field values",method:l.GET,url:"/asset-procedure-field-values/",queryParams:{limit:E,paginate:!0,asset_procedure_instance__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset procedure field values",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(lr(n)),n}}class yb extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(Ps(c));const r=this.enqueueRequest({description:"Create asset procedure instance",method:l.POST,url:"/asset-procedure-instances/",payload:v(c),blockers:[e.asset_procedure,e.asset_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(it(m))}).catch(()=>{this.dispatch(Os(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=vs(e.uuid)(i.getState());if(!a)throw new Error(`Expected asset procedure instance with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(it(n));const c=this.enqueueRequest({description:"Update asset procedure instance",method:l.PATCH,url:`/asset-procedure-instances/${e.uuid}/`,payload:e,blockers:[a.uuid],blocks:[a.uuid]});return c.then(r=>{this.dispatch(it(r))}).catch(()=>{this.dispatch(it(a))}),[n,c]}async remove(e){const{store:i}=this.client,a=i.getState(),n=vs(e)(a);if(!n)throw new Error(`Expected asset procedure instance with uuid ${e} to exist`);return this.dispatch(Os(e)),this.enqueueRequest({description:"Delete asset procedure instance",method:l.DELETE,url:`/asset-procedure-instances/${e}/`,blockers:[e],blocks:[]}).catch(c=>{throw this.dispatch(Ps(n)),c})}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset procedure instances",method:l.GET,url:"/asset-procedure-instances/",queryParams:{limit:E,paginate:!0,project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset procedure instances",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Sr(n)),n}}class Sb extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(Ms(c));const r=this.enqueueRequest({description:"Create asset procedure",method:l.POST,url:"/asset-procedures/",payload:v(c),blockers:[],blocks:[c.uuid]});return r.then(m=>{this.dispatch(at(m))}).catch(()=>{this.dispatch(Es(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=js(e.uuid)(i.getState());if(!a)throw new Error(`Expected asset procedure with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(at(n));const c=this.enqueueRequest({description:"Update asset procedure",method:l.PATCH,url:`/asset-procedures/${e.uuid}/`,payload:e,blockers:[a.uuid],blocks:[a.uuid]});return c.then(r=>{this.dispatch(at(r))}).catch(()=>{this.dispatch(at(a))}),[n,c]}async remove(e){const{store:i}=this.client,a=i.getState(),n=js(e)(a);if(!n)throw new Error(`Expected asset procedure with uuid ${e} to exist`);const c=br(e)(a);return this.dispatch(Es(e)),this.dispatch(Tr(c.map(r=>r.uuid))),this.enqueueRequest({description:"Delete asset procedure",method:l.DELETE,url:`/asset-procedures/${e}/`,blockers:[e],blocks:[]}).catch(r=>{throw this.dispatch(Ms(n)),this.dispatch(Ir(c)),r})}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset procedures",method:l.GET,url:"/asset-procedures/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(Pr(a)),a}}class Ib extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const o of e){const{fieldsRevisionUuid:h,fieldIdentifier:p,file:A}=o,f=await this.getFilePayload(A);f.sha1 in n||(n[f.sha1]=f);const T=b({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:f.sha1,created_by:a,fields_revision:h,submitted_at:i,field_identifier:p});c.push(T);const F={uuid:T.uuid,file_name:A.name,field_identifier:p,file_extension:f.extension,file_sha1:f.sha1,fields_revision:h};r.push(F)}this.dispatch(wr(c));const u=this.enqueueRequest({description:"Add asset procedure step fields attachments",method:l.POST,url:"/asset-procedure-step-fields-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(o=>o.fields_revision),blocks:c.map(o=>o.uuid)});return u.then(o=>{this.processPresignedUrls(o.presigned_urls),this.dispatch(Mr(o.attachments))}).catch(()=>{this.dispatch(Er(c.map(o=>o.uuid)))}),[c,u.then(({attachments:o})=>o)]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset procedure step fields attachments",method:l.GET,url:"/asset-procedure-step-fields-attachments/",queryParams:{fields_revision__asset_procedure_step__organization:e},blockers:[],blocks:[]},i);return this.dispatch(vr(a)),a}}class Tb extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(Us(c));const r=this.enqueueRequest({description:"Add Asset Procedure Step Fields",method:l.POST,url:"/asset-procedure-step-fields/",payload:v(c),blockers:[c.asset_procedure_step],blocks:[c.uuid]});return r.then(m=>{this.dispatch(nt(m))}).catch(m=>{throw this.dispatch(Ds(c.uuid)),m}),[c,r]}update(e){const{store:i}=this.client,a=i.getState().assetProcedureStepFieldsReducer.instances[e.uuid];if(!a)throw new Error(`AssetProcedureStepFields with uuid ${e.uuid} not found`);const n={...a,...e};this.dispatch(nt(n));const c=this.enqueueRequest({description:"Update Asset Procedure Step Fields",method:l.PATCH,url:`/asset-procedure-step-fields/${a.uuid}/`,payload:e,blockers:[a.uuid],blocks:[a.uuid]});return c.then(r=>{this.dispatch(nt(r))}).catch(r=>{throw this.dispatch(nt(a)),r}),[n,c]}delete(e){const{store:i}=this.client,a=i.getState().assetProcedureStepFieldsReducer.instances[e];if(!a)throw new Error(`AssetProcedureStepFields with uuid ${e} not found`);this.dispatch(Ds(e));const n=this.enqueueRequest({description:"Delete Asset Procedure Step Fields",method:l.DELETE,url:`/asset-procedure-step-fields/${e}/`,blockers:[e],blocks:[e]});return n.catch(c=>{throw this.dispatch(Us(a)),c}),n}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get Asset Procedure Step Fields",method:l.GET,url:"/asset-procedure-step-fields/",queryParams:{asset_procedure_step__asset_procedure__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Ur(a)),a}}class gb extends j{async bulkAdd(e,i){var o;const a=new Date().toISOString(),n=(o=this.client.store.getState().userReducer.currentUser)==null?void 0:o.id,c=Ke(e,i??e.length),r=[],u=[];for(const h of c){const p={},A=[];for(const f of h){const{fieldValuesUuid:T,fieldIdentifier:F,file:_}=f,w=await this.getFilePayload(_);w.sha1 in p||(p[w.sha1]=w);const z=b({file:URL.createObjectURL(_),file_type:_.type,file_name:_.name,file_sha1:w.sha1,created_by:n,field_values:T,submitted_at:a,field_identifier:F});r.push(z);const Le={uuid:z.uuid,file_name:_.name,file_sha1:w.sha1,file_extension:w.extension,field_identifier:F,field_values:T};A.push(Le)}u.push({submitted_at:a,attachments:A,files:Object.values(p)})}this.dispatch(Rt(r));const m=u.map(h=>this.enqueueRequest({description:"Add asset procedure step field values attachments",method:l.POST,url:"/asset-procedure-step-field-values-attachments/bulk/",payload:h,blockers:h.attachments.map(p=>p.field_values),blocks:h.attachments.map(p=>p.uuid)}));return Promise.all(m).then(h=>{for(const A of h)this.processPresignedUrls(A.presigned_urls);const p=h.flatMap(A=>A.attachments);this.dispatch(Br(p))}).catch(h=>{throw this.dispatch(vt(r.map(p=>p.uuid))),h}),[r,m.map(h=>h.then(({attachments:p})=>p))]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),n=$r(e)(a);this.dispatch(vt(e));try{await this.enqueueRequest({description:"Delete asset procedure step field values attachments",method:l.DELETE,url:"/asset-procedure-step-field-values-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(Rt(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset procedure step field values attachments",method:l.GET,url:"/asset-procedure-step-field-values-attachments/",queryParams:{limit:E,paginate:!0,field_values__asset_procedure_instance__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset procedure step field values attachments",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(kr(n)),n}}class bb extends R{add(e){var r;const{store:i}=this.client,a=i.getState(),n=b({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),c=this.enqueueRequest({description:"Add asset procedure step field values",method:l.POST,url:"/asset-procedure-step-field-values/",payload:v(n),blockers:[e.asset,e.fields_revision,e.asset_procedure_instance],blocks:[n.uuid]});return this.dispatch(Ls(n)),c.then(u=>(this.dispatch(ct(u)),u)).catch(()=>{this.dispatch(Ns(n.uuid))}),[n,c]}bulkAdd(e,i){var m;const a=new Date().toISOString(),n=[],c=Ke(e.payloads,i??e.payloads.length),r=[];for(const o of c){const h=[];for(const p of o){const A=b({...p,values:p.values,created_by:(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,submitted_at:a});n.push(A),h.push({uuid:A.uuid,asset:p.asset,fields_revision:p.fields_revision,asset_procedure_instance:p.asset_procedure_instance,asset_procedure_step:p.asset_procedure_step,published_at:p.published_at,values:A.values})}r.push({submitted_at:a,values:e.values,field_values:h})}this.dispatch(Yr(n));const u=[];for(const o of r){const h=o.field_values.map(F=>F.asset),p=o.field_values.map(F=>F.fields_revision),A=o.field_values.map(F=>F.asset_procedure_instance),f=o.field_values.map(F=>F.uuid),T=this.enqueueRequest({description:"Bulk add asset procedure step field values",method:l.POST,url:"/asset-procedure-step-field-values/bulk/",payload:o,blockers:[...h,...p,...A],blocks:f});u.push(T)}return Promise.all(u).then(o=>{this.dispatch(Kr(o.flat()))}).catch(()=>{this.dispatch(Zr(n.map(o=>o.uuid)))}),[n,u]}update(e){const{store:i}=this.client,a=i.getState(),n=Hs(e.uuid)(a);if(!n)throw new Error(`Expected AssetProcedureStepFieldValues with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(ct(c));const r=this.enqueueRequest({description:"Update asset procedure step field values",method:l.PATCH,url:`/asset-procedure-step-field-values/${e.uuid}/`,payload:e,blockers:[c.fields_revision,c.asset,c.asset_procedure_instance],blocks:[c.uuid]});return r.then(u=>{this.dispatch(ct(u))}).catch(()=>{this.dispatch(ct(n))}),[c,r]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Hs(e)(a);if(!n)throw new Error(`Expected submission with uuid ${e} to exist`);const c=Lr(e)(a);this.dispatch(Ns(e)),this.dispatch(vt(c.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete asset procedure step field values",method:l.DELETE,url:`/asset-procedure-step-field-values/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(Ls(n)),this.dispatch(Rt(c)),r}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset procedure step field values",method:l.GET,url:"/asset-procedure-step-field-values/",queryParams:{limit:E,paginate:!0,asset_procedure_instance__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset procedure step field values",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Wr(n)),n}}class Fb extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(Ys(c));const r=this.enqueueRequest({description:"Create asset procedure step",method:l.POST,url:"/asset-procedure-steps/",payload:v(c),blockers:[c.asset_procedure],blocks:[c.uuid]});return r.then(m=>{this.dispatch(Mt(m))}).catch(()=>{this.dispatch(Ks(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=Zs(e.uuid)(i.getState());if(!a)throw new Error(`No asset procedure step with uuid ${e.uuid} found in the store`);const n={...a,...e};this.dispatch(Mt(n));const c=this.enqueueRequest({description:"Update asset procedure step",method:l.PATCH,url:`/asset-procedure-steps/${a.uuid}/`,payload:{name:e.name,description:e.description,priority:e.order,color:e.color},blockers:[a.uuid],blocks:[a.uuid]});return c.then(r=>{this.dispatch(Mt(r))}).catch(()=>{this.dispatch(ed(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Zs(e)(a);if(!n)throw new Error(`No asset procedure step with uuid ${e} found in the store`);return this.dispatch(Ks(e)),this.enqueueRequest({description:"Delete asset stage",method:l.DELETE,url:`/asset-stages/${e}/`,blockers:[e],blocks:[]}).catch(c=>{throw this.dispatch(Ys(n)),c})}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset procedure steps",method:l.GET,url:"/asset-procedure-steps/",queryParams:{asset_procedure__organization:e},blockers:[],blocks:[]},i);return this.dispatch(xr(a)),a}}class Pb extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(Xs(c));const r=this.enqueueRequest({description:"Create asset",method:l.POST,url:"/assets/",payload:v(c),blockers:[c.asset_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(rt(m))}).catch(()=>{this.dispatch(Qs(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=si(e.uuid)(i.getState());if(!a)throw new Error(`No asset with uuid ${e.uuid} found in the store`);const n={...a,...e};this.dispatch(rt(n));const c=this.enqueueRequest({description:"Edit asset",method:l.PATCH,url:`/assets/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(rt(r))}).catch(()=>{this.dispatch(rt(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=si(e)(a);if(!n)throw new Error(`No asset with uuid ${e} found in the store`);const c=wc(e)(a),r=Lo(e)(a),u=rl(e)(a);if(this.dispatch(Qs(e)),c.length>0){const m=c.map(({uuid:o})=>o);this.dispatch(ls(m))}if(r.length>0){const m=r.map(({uuid:o})=>o);this.dispatch(Nt(m))}if(u.length>0){const m=u.map(({uuid:o})=>o);this.dispatch(va(m))}return this.enqueueRequest({description:"Delete asset",method:l.DELETE,url:`/assets/${e}/`,blockers:[e],blocks:[]}).catch(m=>{throw this.dispatch(Xs(n)),this.dispatch(os(c)),this.dispatch(Lt(r)),this.dispatch(_a(u)),m})}bulkAdd(e,i,a,n){const c=new Date().toISOString(),r=Je.v4(),u=Ke(e,n).map(h=>{const p=h.map(A=>b(A));return{batchId:Je.v4(),payload:{transaction_id:r,submitted_at:c,asset_type:i,project:a,assets:p}}}),m=[];let o=null;for(const h of u){const{batchId:p,payload:A}=h,f=A.assets.map(w=>w.uuid),T=[i];o&&T.push(o);const F=f;F.push(p);const _=this.enqueueRequest({description:"Batch create assets",method:l.POST,url:"/assets/bulk/",payload:A,blockers:T,blocks:F});o=h.batchId,m.push(_)}return Promise.all(m).then(h=>{const p=h.flat();this.dispatch(Vt(p))}),m}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),n=cd(e)(a);this.dispatch(xs(e));try{await this.enqueueRequest({description:"Bulk delete assets",method:l.DELETE,url:"/assets/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(Vt(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get assets",method:l.GET,url:"/assets/",queryParams:{limit:E,paginate:!0,project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get assets",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(ad(n)),n}}class Ob extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(ai(c));const r=this.enqueueRequest({description:"Add asset stage completion",method:l.POST,url:"/asset-stage-completions/",payload:v(c),blockers:[e.asset,e.stage],blocks:[c.uuid]});return r.then(m=>{this.dispatch(od(m))}).catch(()=>{this.dispatch(ci(c.uuid))}),[c,r]}delete(e){const{store:i}=this.client,a=md(e)(i.getState());if(!a)throw new Error(`Expected asset stage completion with uuid ${e} to exist`);this.dispatch(ci(e));const n=this.enqueueRequest({description:"Delete asset stage completion",method:l.DELETE,url:`/asset-stage-completions/${e}/`,blockers:[e],blocks:[]});return n.catch(()=>{this.dispatch(ai(a))}),n}bulkAdd(e){var o;const{store:i}=this.client,a=new Date().toISOString(),n=(o=i.getState().userReducer.currentUser)==null?void 0:o.id,c=e.map(h=>b(h)),r=c.map(h=>({...h,created_by:n,submitted_at:a})),u=r.map(({uuid:h})=>h);this.dispatch(ni(r));const m=this.enqueueRequest({description:"Bulk create asset stage completions",method:l.POST,url:"/asset-stage-completions/bulk/",payload:{submitted_at:a,completions:c},blockers:[...e.map(h=>h.asset_procedure_instance),...e.map(h=>h.stage),...e.map(h=>h.asset)],blocks:u});return m.then(h=>{this.dispatch(ld(h))}).catch(()=>{this.dispatch(ri(u))}),[r,m]}bulkDelete(e){const{store:i}=this.client,a=pd(e)(i.getState());this.dispatch(ri(e));const n=this.enqueueRequest({description:"Deleting asset stage completions",method:l.DELETE,url:"/asset-stage-completions/bulk/",payload:{uuids:e},blockers:e,blocks:[]});return n.catch(()=>{this.dispatch(ni(a))}),n}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset stage completions",method:l.GET,url:"/asset-stage-completions/",queryParams:{limit:E,paginate:!0,asset_procedure_instance__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset stage completions",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(ud(n)),n}}class _b extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(oi(c));const r=this.enqueueRequest({description:"Create asset",method:l.POST,url:"/asset-stages/",payload:v(c),blockers:[c.asset_procedure],blocks:[c.uuid]});return r.then(m=>{this.dispatch(jt(m))}).catch(()=>{this.dispatch(li(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=hi(e.uuid)(i.getState());if(!a)throw new Error(`No asset stage with uuid ${e.uuid} found in the store`);const n={...a,...e};this.dispatch(jt(n));const c=this.enqueueRequest({description:"Update asset stage",method:l.PATCH,url:`/asset-stages/${a.uuid}/`,payload:e,blockers:[a.uuid],blocks:[a.uuid]});return c.then(r=>{this.dispatch(jt(r))}).catch(()=>{this.dispatch(yd(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=hi(e)(a);if(!n)throw new Error(`No asset stage with uuid ${e} found in the store`);return this.dispatch(li(e)),this.enqueueRequest({description:"Delete asset stage",method:l.DELETE,url:`/asset-stages/${e}/`,blockers:[e],blocks:[]}).catch(c=>{throw this.dispatch(oi(n)),c})}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset stages",method:l.GET,url:"/asset-stages/",queryParams:{asset_procedure__organization:e},blockers:[],blocks:[]},i);return this.dispatch(fd(a)),a}}class Rb extends He{constructor(){super(...arguments);S(this,"name","Asset Type Attachment");S(this,"url","/asset-type-attachments");S(this,"addAttachments",pi);S(this,"updateAttachments",Fd);S(this,"removeAttachments",Ai);S(this,"removeAttachment",Pd);S(this,"setAttachment",bd);S(this,"selectAttachment",Rd)}buildOfflineAttachment(i){return b({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,asset_type:i.modelUuid})}buildAttachmentPayload(i){return{...i,asset_type:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.assetTypeUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const n=await this.enqueueRequest({immediate:!0,description:"Get asset type attachments",method:l.GET,url:`${this.url}/`,queryParams:{asset_type__organization:i},blocks:[],blockers:[]},a);return this.dispatch(gd(n)),n}}class vb extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const o of e){const{fieldsRevisionUuid:h,fieldIdentifier:p,file:A}=o,f=await this.getFilePayload(A);f.sha1 in n||(n[f.sha1]=f);const T=b({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:f.sha1,created_by:a,fields_revision:h,submitted_at:i,field_identifier:p});c.push(T);const F={uuid:T.uuid,file_name:A.name,field_identifier:p,file_extension:f.extension,file_sha1:f.sha1,fields_revision:h};r.push(F)}this.dispatch(Vd(c));const u=this.enqueueRequest({description:"Add asset type fields attachments",method:l.POST,url:"/asset-type-fields-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(o=>o.fields_revision),blocks:c.map(o=>o.uuid)});return u.then(o=>{this.processPresignedUrls(o.presigned_urls),this.dispatch(jd(o.attachments))}).catch(()=>{this.dispatch(qd(c.map(o=>o.uuid)))}),[c,u.then(({attachments:o})=>o)]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset type fields attachments",method:l.GET,url:"/asset-type-fields-attachments/",queryParams:{fields_revision__asset_type__organization:e},blockers:[e],blocks:[]},i);return this.dispatch(Ed(a)),a}}class wb extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(Bd(c));const r=this.enqueueRequest({description:"Add Asset Type Fields",method:l.POST,url:"/asset-type-fields/",payload:v(c),blockers:[c.asset_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(Gd(m))}).catch(m=>{throw this.dispatch($d(c.uuid)),m}),[c,r]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get Asset Type Fields",method:l.GET,url:"/asset-type-fields/",queryParams:{asset_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(kd(a)),a}}class Mb extends j{async bulkAdd(e,i){var o;const a=new Date().toISOString(),n=(o=this.client.store.getState().userReducer.currentUser)==null?void 0:o.id,c=Ke(e,i??e.length),r=[],u=[];for(const h of c){const p={},A=[];for(const f of h){const{fieldValuesUuid:T,fieldIdentifier:F,file:_}=f,w=await this.getFilePayload(_);w.sha1 in p||(p[w.sha1]=w);const z=b({file:URL.createObjectURL(_),file_type:_.type,file_name:_.name,file_sha1:w.sha1,created_by:n,field_values:T,submitted_at:a,field_identifier:F});r.push(z);const Le={uuid:z.uuid,file_name:_.name,file_sha1:w.sha1,file_extension:w.extension,field_identifier:F,field_values:T};A.push(Le)}u.push({submitted_at:a,attachments:A,files:Object.values(p)})}this.dispatch(Ut(r));const m=u.map(h=>this.enqueueRequest({description:"Add asset type field values attachments",method:l.POST,url:"/asset-type-field-values-attachments/bulk/",payload:h,blockers:h.attachments.map(p=>p.field_values),blocks:h.attachments.map(p=>p.uuid)}));return Promise.all(m).then(h=>{for(const A of h)this.processPresignedUrls(A.presigned_urls);const p=h.flatMap(A=>A.attachments);this.dispatch(Yd(p))}).catch(h=>{throw this.dispatch(Dt(r.map(p=>p.uuid))),h}),[r,m.map(h=>h.then(({attachments:p})=>p))]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),n=Zd(e)(a);this.dispatch(Dt(e));try{await this.enqueueRequest({description:"Delete asset type field values attachments",method:l.DELETE,url:"/asset-type-field-values-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(Ut(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset type field values attachments",method:l.GET,url:"/asset-type-field-values-attachments/",queryParams:{limit:E,paginate:!0,field_values__asset__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset type field values attachments",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Wd(n)),n}}class Eb extends R{add(e){var r;const{store:i}=this.client,a=i.getState(),n=b({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),c=this.enqueueRequest({description:"Add asset type field values",method:l.POST,url:"/asset-type-field-values/",payload:v(n),blockers:[e.asset,e.fields_revision],blocks:[n.uuid]});return this.dispatch(gi(n)),c.then(u=>(this.dispatch(dt(u)),u)).catch(()=>{this.dispatch(bi(n.uuid))}),[n,c]}bulkAdd(e,i){var m;const a=new Date().toISOString(),n=[],c=Ke(e.payloads,i??e.payloads.length),r=[];for(const o of c){const h=[];for(const p of o){const A=b({...p,values:p.values,created_by:(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,submitted_at:a});n.push(A),h.push({uuid:A.uuid,asset:p.asset,fields_revision:p.fields_revision,published_at:p.published_at,values:A.values})}r.push({submitted_at:a,values:e.values,field_values:h})}this.dispatch(eu(n));const u=[];for(const o of r){const h=o.field_values.map(T=>T.asset),p=o.field_values.map(T=>T.fields_revision),A=o.field_values.map(T=>T.uuid),f=this.enqueueRequest({description:"Bulk add asset type field values",method:l.POST,url:"/asset-type-field-values/bulk/",payload:o,blockers:[...h,...p],blocks:A});u.push(f)}return Promise.all(u).then(o=>{this.dispatch(tu(o.flat()))}).catch(()=>{this.dispatch(su(n.map(o=>o.uuid)))}),[n,u]}update(e){const{store:i}=this.client,a=i.getState(),n=Pi(e.uuid)(a);if(!n)throw new Error(`Expected AssetTypeFieldValues with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(dt(c));const r=this.enqueueRequest({description:"Delete asset type field values",method:l.PATCH,url:`/asset-type-field-values/${e.uuid}/`,payload:e,blockers:[c.uuid,c.fields_revision,c.asset],blocks:[c.uuid]});return r.then(u=>{this.dispatch(dt(u))}).catch(()=>{this.dispatch(dt(n))}),[c,r]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Pi(e)(a);if(!n)throw new Error(`Expected submission with uuid ${e} to exist`);const c=Jd(e)(a);this.dispatch(bi(e)),this.dispatch(Dt(c.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete asset type field values",method:l.DELETE,url:`/asset-type-field-values/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(gi(n)),this.dispatch(Ut(c)),r}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset type field values",method:l.GET,url:"/asset-type-field-values/",queryParams:{limit:E,paginate:!0,asset__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset type field values",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(xd(n)),n}}class Vb extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(_i(c));const r=this.enqueueRequest({description:"Create asset type identifier",method:l.POST,url:"/asset-type-identifiers/",payload:v(c),blockers:[c.asset_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(ut(m))}).catch(()=>{this.dispatch(Ri(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=vi(e.uuid)(i.getState());if(!a)throw new Error(`Expected asset type identifier with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(ut(n));const c=this.enqueueRequest({description:"Update asset type identifier",method:l.PATCH,url:`/asset-type-identifiers/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(ut(r))}).catch(()=>{this.dispatch(ut(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=vi(e)(a);if(!n)throw new Error(`Expected asset type identifier with uuid ${e} to exist`);this.dispatch(Ri(e));try{return await this.enqueueRequest({description:"Delete asset type identifier",method:l.DELETE,url:`/asset-type-identifiers/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(_i(n)),c}}async refreshStore(e,i){const a=await this.enqueueRequest({description:"Get asset type identifiers",method:l.GET,url:"/asset-type-identifiers/",queryParams:{asset_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(cu(a)),a}}class jb extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(Mi(c));const r=this.enqueueRequest({description:"Create asset type identifier value",method:l.POST,url:"/asset-type-identifier-values/",payload:v(c),blockers:[e.asset,e.asset_type_identifier],blocks:[c.uuid]});return r.then(m=>{this.dispatch(ot(m))}).catch(()=>{this.dispatch(Ei(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=ji(e.uuid)(i.getState());if(!a)throw new Error(`Expected asset type identifier value with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(ot(n));const c=this.enqueueRequest({description:"Update asset type identifier value",method:l.PATCH,url:`/asset-type-identifier-values/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(ot(r))}).catch(()=>{this.dispatch(ot(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=ji(e)(a);if(!n)throw new Error(`Expected asset type identifier value with uuid ${e} to exist`);this.dispatch(Ei(e));try{return await this.enqueueRequest({description:"Delete asset type identifier value",method:l.DELETE,url:`/asset-type-identifier-values/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(Mi(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset type identifier values",method:l.GET,url:"/asset-type-identifier-values/",queryParams:{limit:E,paginate:!0,asset__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset type identifier values",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(lu(n)),n}}class qb extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(zi(c));const r=this.enqueueRequest({description:"Create asset type",method:l.POST,url:"/asset-types/",payload:v(c),blockers:[],blocks:[c.uuid]});return r.then(m=>{this.dispatch(lt(m))}).catch(()=>{this.dispatch(Ui(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=Ci(e.uuid)(i.getState());if(!a)throw new Error(`Expected asset type with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(lt(n));const c=this.enqueueRequest({description:"Update asset type",method:l.PATCH,url:`/asset-types/${e.uuid}/`,payload:{icon:e.icon,color:e.color,name:e.name,description:e.description},blockers:[a.uuid],blocks:[a.uuid]});return c.then(r=>{this.dispatch(lt(r))}).catch(()=>{this.dispatch(lt(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Ci(e)(a);if(!n)throw new Error(`Expected asset type with uuid ${e} to exist`);const c=ti(e)(a),r=vd(e)(a);return this.dispatch(Ui(e)),this.dispatch(xs(c.map(u=>u.uuid))),this.dispatch(Ai(r.map(({uuid:u})=>u))),this.enqueueRequest({description:"Delete asset type",method:l.DELETE,url:`/asset-types/${e}/`,blockers:[e],blocks:[]}).catch(u=>{throw this.dispatch(zi(n)),this.dispatch(Vt(c)),this.dispatch(pi(r)),u})}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset types",method:l.GET,url:"/asset-types/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(Au(a)),a}}class zb extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(Bi(c));const r=this.enqueueRequest({description:"Create Category",method:l.POST,url:"/categories/",payload:v(c),blockers:[e.project],blocks:[c.uuid]});return[c,r]}update(e){const i=this.client.store.getState(),a=$i(e.uuid)(i);if(!a)throw new Error(`Expected an existing category with uuid ${e.uuid}`);const n={...a,...e};this.dispatch(Fu(n));const c=this.enqueueRequest({description:"Edit Category",method:l.PATCH,url:`/categories/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return[n,c]}remove(e){const{store:i}=this.client,a=$i(e)(i.getState());if(!a)throw new Error(`No category with uuid ${e} found in the store`);this.dispatch(Pu(e));const n=this.enqueueRequest({description:"Delete Category",method:l.DELETE,url:`/categories/${a.uuid}/`,blockers:[a.uuid],blocks:[]});return n.catch(()=>{this.dispatch(Bi(a))}),n}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get categories",method:l.GET,url:"/categories/",queryParams:{project__organization:e},blocks:[],blockers:[]},i);return this.dispatch(bu(a)),a}}class Ub extends He{constructor(){super(...arguments);S(this,"name","Document Attachment");S(this,"url","/document-attachments");S(this,"addAttachments",wu);S(this,"updateAttachments",Eu);S(this,"removeAttachments",ju);S(this,"removeAttachment",Vu);S(this,"setAttachment",Mu);S(this,"selectAttachment",Uu)}buildOfflineAttachment(i){return b({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,document:i.modelUuid})}buildAttachmentPayload(i){return{...i,document:i.modelUuid}}async bulkAdd(i){var p;const{store:a}=this.client,n=(p=a.getState().userReducer.currentUser)==null?void 0:p.id,c=new Date().toISOString(),r=[],u=[],m={},o={};for(const A of i){const{documentUuid:f,file:T}=A,F=await this.getFilePayload(T);F.sha1 in m||(m[F.sha1]=F,o[F.sha1]=[]);const _=this.buildOfflineAttachment({file:T,file_sha1:F.sha1,submitted_at:c,created_by:n,description:"",modelUuid:f});r.push(_),u.push({uuid:_.uuid,file_name:_.file_name,file_sha1:_.file_sha1,file_extension:F.extension,description:_.description,document:f}),o[F.sha1].push(_.uuid)}this.dispatch(this.addAttachments(r));const h=this.enqueueRequest({description:"Attach files to document",method:l.POST,url:"/document-attachments/bulk/",payload:{submitted_at:c,attachments:u,files:Object.values(m)},blocks:r.map(A=>A.uuid),blockers:r.map(A=>A.file_sha1)});return h.then(({attachments:A,presigned_urls:f})=>{this.dispatch(this.updateAttachments(A));const T=this.processPresignedUrls(f);for(const[F,_]of Object.entries(T))_.then(()=>{const w=o[F];for(const z of w)this.makeReadable(z)})}).catch(()=>{this.dispatch(this.removeAttachments(r.map(A=>A.uuid)))}),[r,h.then(({attachments:A})=>A)]}async delete(i){return this._delete(i)}makeReadable(i){this.enqueueRequest({description:"Add attachment to AI assistant",method:l.PATCH,url:`/document-attachments/${i}/`,payload:{readable_to_assistant:!0},blockers:["index-document-attachment",i],blocks:["index-document-attachment"]})}async refreshStore(i,a){const n=await this.enqueueRequest({immediate:!0,description:"Get document attachments",method:l.GET,url:"/document-attachments/",queryParams:{document__project__organization:i},blocks:[],blockers:[]},a),c=await this.enqueueRequest({immediate:!0,description:"Get document attachments",method:l.GET,url:"/document-attachments/",queryParams:{document__organization:i},blocks:[],blockers:[]},a),r=[...n,...c];return this.dispatch(vu(r)),r}}class Db extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(Bu([c]));const r=this.enqueueRequest({description:"Create Document",method:l.POST,url:"/documents/",payload:v(c),queryParams:{parent_document:c.parent_document??void 0},blockers:c.parent_document?[c.parent_document]:[],blocks:[c.uuid]});return r.catch(()=>{this.dispatch(Hi([c.uuid]))}),[c,r]}update(e){const{store:i}=this.client,a=i.getState().documentsReducer.documents[e.uuid];if(!a)throw new Error(`attempting to update a document with uuid ${e.uuid} that does not exist in store.documents`);const n={...a,...e};this.dispatch(Qe([n]));const c=this.enqueueRequest({description:"Update Document",method:l.PATCH,url:`/documents/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.catch(()=>{Qe([a])}),[n,c]}delete(e){const{store:i}=this.client,a=kt(i.getState()),n=Gu(e)(i.getState());if(!n)throw new Error(`attempting to delete a document with uuid ${e} that does not exist in store.documents`);const c=n.parent_document?a[n.parent_document]:void 0;this.dispatch(Hi([e]));const r=this.enqueueRequest({description:"Delete Document",method:l.DELETE,url:`/documents/${e}/`,blockers:[e],blocks:[]});return r.then(u=>{this.dispatch(Qe(u))}).catch(()=>{this.dispatch(Qe([n])),c&&this.dispatch(Qe([c]))}),r}async refreshStore(e,i){const a=this.enqueueRequest({immediate:!0,description:"Get project documents",method:l.GET,url:"/documents/",queryParams:{project__organization:e},blockers:[],blocks:[]},i),n=this.enqueueRequest({immediate:!0,description:"Get organization documents",method:l.GET,url:"/documents/",queryParams:{organization:e},blockers:[],blocks:[]},i),c=[...await a,...await n];return this.dispatch(ku(c)),c}}class Cb extends R{async add(e,i){return this.enqueueRequest({description:"Add email domain to organization",method:l.POST,url:"/organization-email-domains/",payload:{email:i,organization:e},blockers:[e,"create-org"],blocks:[]})}async remove(e){return this.dispatch(Wu(e.uuid)),this.enqueueRequest({description:"Remove email domain from organization",method:l.DELETE,url:`/organization-email-domains/${e.uuid}/`,blockers:[e.domain],blocks:[]}).catch(i=>{throw this.dispatch(Hu(e)),i})}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch email domains for organization",method:l.GET,url:"/organization-email-domains/",queryParams:{organization:e},blockers:[e],blocks:[]},i);return this.dispatch(Nu(a)),a}}class kb extends R{async getVerificationCode(e){return this.enqueueRequest({description:"Get verification code",method:l.GET,url:`/verification/email-verification/${e}/`,isAuthNeeded:!1,blockers:[],blocks:[]})}validateVerificationCode(e,i=void 0){return this.enqueueRequest({description:"Validate verification code",method:l.POST,url:`/verification/email-verification/${e}/`,isAuthNeeded:!1,payload:i,blockers:[],blocks:[]})}}const Qt={},xn=new Set;let xt=0,ec=0,tc=0;const Bb=20;class Gb extends R{constructor(){super(...arguments);S(this,"host");S(this,"_dbPromise",zp.openDB("fileCache",1,{upgrade(i){i.createObjectStore("files")}}))}async renewUploadUrl(i){const a=await this.fetchCache(i);if(!a)throw new Error(`File with sha1 ${i} not found in cache`);const n=await ns(a,i),c=await this.enqueueRequest({description:"Get S3 URL",method:l.GET,url:"/authentication/files/presigned-upload-url/",queryParams:{sha1:await Xe(a),file_type:a.type,extension:a.name.split(".").pop(),size:a.size.toString()},blockers:[],blocks:[`s3-${n}`]});return"url"in c&&this.dispatch(Qu({sha1:i,...c})),c}async addCache(i,a){if(xn.has(a))return;if(!i.type){const r=i.name.split("."),u=r[r.length-1];i=new File([i],i.name,{type:u})}if(!i.name||!i.size||!i.type)throw new Error("Cannot add files to cache that do not have a name, size and type.");const n=await this._dbPromise;!!await n.get("files",a)?(console.error("File already cached (this is unexpected at this point):",i.name,a),xt++):(await n.put("files",i,a),ec++),xn.add(a),tc++,tc%Bb===0&&console.debug(`File cache summary: ${xt} hits and ${ec} misses, ${xt/(xt+ec)*100}% hit rate over ${tc} calls to addCache.`)}async removeCache(i){await(await this._dbPromise).delete("files",i),xn.delete(i)}async fetchCache(i){return(await this._dbPromise).get("files",i)}async getOrRenewUploadUrl(i){const a=this.client.store.getState();return xu(i)(a)??await this.renewUploadUrl(i)}async uploadFileToS3(i){const a=await this.fetchCache(i);if(!a)throw new Error(`File with sha1 ${i} not found in cache`);const n=await ns(a,i),c={file_name:a.name,file_sha1:i,file:n},r=await this.getOrRenewUploadUrl(i);if("warning"in r){if(r.warning==="already_uploaded")return[c,Promise.resolve(void 0).then()];throw new Error(r.warning)}const u=r.url,m=this.enqueueRequest({url:u,description:"Upload file",method:l.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:i,blockers:[`s3-${n}`],blocks:[i],s3url:r});return[c,m]}async fetchFileFromUrl(i,a,n){const c=i.split("?")[0]??i,r=await this.fetchCache(a);if(r){if(!r.name)throw new Error("Cached file unexpectedly has no name.");return r}if(i.startsWith("blob:")){const h=await lc(i),p=new File([h],n??a,{type:h.type});return await this.addCache(p,a),p}let u=Qt[c],m=!0;u?m=!1:(u=new Promise(h=>{this.enqueueRequest({description:"Download file",method:l.GET,url:i,isExternalUrl:!0,isResponseBlob:!0,isAuthNeeded:!1,blockers:[a],blocks:[a]}).then(p=>{const A=new File([p],n??a,{type:p.type});h(A)})}),Qt[c]=u);let o;try{o=await u}catch(h){throw m&&h instanceof D&&delete Qt[c],h}if(m){const h=await Xe(o);if(h!==a){const f=`The hash of the file returned from the server (${h}) does not match the
|
|
8
|
+
`)}catch(n){console.error("Failed to extract error message from response body",n)}}else typeof t.body=="string"&&(i=t.body);else t!=null&&t.text?i=t.text:e instanceof Error&&(i=e.message);return!i||i.length>ib?et:i}class D extends Error{constructor(i){super(et);S(this,"status");S(this,"response");S(this,"message");S(this,"options");const{response:a,innerError:n}=i;this.message=i.message??ab(a,n)??et,this.status=(a==null?void 0:a.status)??0,this.response=a,i.discard=i.discard??!1,this.options=i}}class nb extends Ap{constructor(e){super(e)}}class R extends Ap{constructor(i,a){super(i);S(this,"auth");this.auth=a}}class cb extends R{async startConversation(e,i){return this.enqueueRequest({description:"Start agent conversation",method:l.POST,url:"/agents/prompt/",payload:{prompt:e,active_project:i},blockers:["prompt"],blocks:["prompt"]}).then(a=>(this.dispatch(yc(a)),a))}async continueConversation(e,i,a){return this.enqueueRequest({description:"Prompt agent",method:l.POST,url:"/agents/prompt/",payload:{prompt:e,active_project:a},blockers:["prompt"],blocks:["prompt"],queryParams:{conversation_id:i}}).then(n=>{this.dispatch(Ic(n))})}async fetchDetails(e){return this.enqueueRequest({description:"Get agent conversation",method:l.GET,url:`/agents/conversations/${e}/`,blockers:["conversation"],blocks:["conversation"]}).then(i=>{this.dispatch(Sc(i))})}async rate(e,i){return this.enqueueRequest({description:"Rate agent response",method:l.PUT,url:`/agents/responses/${e}/rate/`,payload:{rating:i},blockers:["rate"],blocks:["rate"]})}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get agent conversation history",method:l.GET,url:"/agents/conversations/",queryParams:{project:e},blockers:["agent-conversations"],blocks:["agent-conversations"]},i);return this.dispatch(fc(a)),a}}const V=1e3,He=200;class j extends R{getNumberOfAttachmentsWithSha1(e){const{issueAttachmentReducer:i,assetAttachmentReducer:a,assetTypeAttachmentReducer:n,documentAttachmentReducer:c,projectAttachmentReducer:r,formRevisionAttachmentReducer:u,formSubmissionAttachmentReducer:m,geoImageReducer:o,assetTypeFieldsAttachmentReducer:h,assetTypeFieldValuesAttachmentReducer:p,issueTypeFieldsAttachmentReducer:A,issueTypeFieldValuesAttachmentReducer:f}=this.client.store.getState();return[].concat(Object.values(i.instances),Object.values(a.instances),Object.values(n.instances),Object.values(c.instances),Object.values(r.instances),Object.values(u.instances),Object.values(m.instances),Object.values(o.instances),Object.values(h.instances),Object.values(p.instances),Object.values(A.instances),Object.values(f.instances)).filter(F=>F.file_sha1===e).length}processPresignedUrls(e){const i={};for(const[a,n]of Object.entries(e))i[a]=this.enqueueRequest({url:n.url,description:"Upload file to S3",method:l.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:a,blockers:[`s3-${n.fields.key}`],blocks:[a],s3url:n});return i}async getFilePayload(e){const i=await Qe(e),a={sha1:i,file_type:e.type,extension:e.name.split(".").pop(),size:e.size};return await this.client.files.addCache(e,i),a}}class We extends j{async _bulkAdd(e){var o;const{store:i}=this.client,a=(o=i.getState().userReducer.currentUser)==null?void 0:o.id,n=new Date().toISOString(),c=[],r=[],u={};for(const h of e){const{modelUuid:p,file:A}=h,f=await this.getFilePayload(A);f.sha1 in u||(u[f.sha1]=f);const T=this.buildOfflineAttachment({file:A,file_sha1:f.sha1,submitted_at:n,created_by:a,description:"",modelUuid:p});c.push(T),r.push(this.buildAttachmentPayload({uuid:T.uuid,file_name:T.file_name,file_sha1:T.file_sha1,file_extension:f.extension,description:T.description,modelUuid:p}))}this.dispatch(this.addAttachments(c));const m=this.enqueueRequest({description:`Add ${this.name}`,method:l.POST,url:`${this.url}/bulk/`,payload:{submitted_at:n,attachments:r,files:Object.values(u)},blocks:c.map(h=>h.uuid),blockers:c.map(h=>h.file_sha1)});return m.then(({attachments:h,presigned_urls:p})=>{this.dispatch(this.updateAttachments(h)),this.processPresignedUrls(p)}).catch(()=>{this.dispatch(this.removeAttachments(c.map(h=>h.uuid)))}),[c,m.then(({attachments:h})=>h)]}async _delete(e){const{store:i}=this.client,a=this.selectAttachment(e)(i.getState());if(!a)throw new Error(`Attempting to delete attachment with uuid ${e} that does not exist in the store`);this.dispatch(this.removeAttachment(a.uuid));const n=this.enqueueRequest({description:`Delete ${this.name}`,method:l.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return n.then(()=>{this.getNumberOfAttachmentsWithSha1(a.file_sha1)===0&&this.client.files.removeCache(a.file_sha1)}).catch(()=>{this.dispatch(this.setAttachment(a))}),n}}class rb extends We{constructor(){super(...arguments);S(this,"name","Asset Attachment");S(this,"url","/asset-attachments");S(this,"initializeAttachments",ds);S(this,"addAttachments",us);S(this,"updateAttachments",Fc);S(this,"removeAttachments",os);S(this,"removeAttachment",Pc);S(this,"setAttachment",bc);S(this,"selectAttachment",Rc)}buildOfflineAttachment(i){return b({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,asset:i.modelUuid})}buildAttachmentPayload(i){return{...i,asset:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.assetUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const c=(await this.performPagination({immediate:!0,description:"Get asset attachments",method:l.GET,url:`${this.url}/`,queryParams:{limit:He,paginate:!0,asset__project:i},blocks:[],blockers:[]},r=>({immediate:!0,description:"Get asset attachments",method:l.GET,url:r,blockers:[],blocks:[]}),a)).flat();return this.dispatch(ds(c)),c}}class db extends We{constructor(){super(...arguments);S(this,"name","Asset Procedure Attachment");S(this,"url","/asset-procedure-attachments");S(this,"addAttachments",Vc);S(this,"updateAttachments",qc);S(this,"removeAttachments",Uc);S(this,"removeAttachment",zc);S(this,"setAttachment",jc);S(this,"selectAttachment",Bc)}buildOfflineAttachment(i){return b({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,asset_procedure:i.modelUuid})}buildAttachmentPayload(i){return{...i,asset_procedure:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.assetProcedureUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const n=await this.enqueueRequest({immediate:!0,description:"Get asset procedure attachments",method:l.GET,url:`${this.url}/`,queryParams:{asset_procedure__organization:i},blocks:[],blockers:[]},a);return this.dispatch(Ec(n)),n}}class ub extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const o of e){const{fieldsRevisionUuid:h,fieldIdentifier:p,file:A}=o,f=await this.getFilePayload(A);f.sha1 in n||(n[f.sha1]=f);const T=b({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:f.sha1,created_by:a,fields_revision:h,submitted_at:i,field_identifier:p});c.push(T);const F={uuid:T.uuid,file_name:A.name,field_identifier:p,file_extension:f.extension,file_sha1:f.sha1,fields_revision:h};r.push(F)}this.dispatch(Lc(c));const u=this.enqueueRequest({description:"Add asset procedure fields attachments",method:l.POST,url:"/asset-procedure-fields-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(o=>o.fields_revision),blocks:c.map(o=>o.uuid)});return u.then(o=>{this.processPresignedUrls(o.presigned_urls),this.dispatch(Nc(o.attachments))}).catch(()=>{this.dispatch(Hc(c.map(o=>o.uuid)))}),[c,u.then(({attachments:o})=>o)]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset procedure fields attachments",method:l.GET,url:"/asset-procedure-fields-attachments/",queryParams:{fields_revision__asset_procedure__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Gc(a)),a}}class ob extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(Xc(c));const r=this.enqueueRequest({description:"Add Asset Procedure Fields",method:l.POST,url:"/asset-procedure-fields/",payload:v(c),blockers:[c.asset_procedure],blocks:[c.uuid]});return r.then(m=>{this.dispatch(Qc(m))}).catch(m=>{throw this.dispatch(xc(c.uuid)),m}),[c,r]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get Asset Procedure Fields",method:l.GET,url:"/asset-procedure-fields/",queryParams:{asset_procedure__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Jc(a)),a}}function Ye(t,e){const i=[];let a=0;const n=t.length;for(;a<n;)i.push(t.slice(a,a+=e));return i}class lb extends j{async bulkAdd(e,i){var o;const a=new Date().toISOString(),n=(o=this.client.store.getState().userReducer.currentUser)==null?void 0:o.id,c=Ye(e,i??e.length),r=[],u=[];for(const h of c){const p={},A=[];for(const f of h){const{fieldValuesUuid:T,fieldIdentifier:F,file:_}=f,w=await this.getFilePayload(_);w.sha1 in p||(p[w.sha1]=w);const z=b({file:URL.createObjectURL(_),file_type:_.type,file_name:_.name,file_sha1:w.sha1,created_by:n,field_values:T,submitted_at:a,field_identifier:F});r.push(z);const Le={uuid:z.uuid,file_name:_.name,file_sha1:w.sha1,file_extension:w.extension,field_identifier:F,field_values:T};A.push(Le)}u.push({submitted_at:a,attachments:A,files:Object.values(p)})}this.dispatch(_t(r));const m=u.map(h=>this.enqueueRequest({description:"Add asset procedure field values attachments",method:l.POST,url:"/asset-procedure-field-values-attachments/bulk/",payload:h,blockers:h.attachments.map(p=>p.field_values),blocks:h.attachments.map(p=>p.uuid)}));return Promise.all(m).then(h=>{for(const A of h)this.processPresignedUrls(A.presigned_urls);const p=h.flatMap(A=>A.attachments);this.dispatch(ar(p))}).catch(h=>{throw this.dispatch(Rt(r.map(p=>p.uuid))),h}),[r,m.map(h=>h.then(({attachments:p})=>p))]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),n=cr(e)(a);this.dispatch(Rt(e));try{await this.enqueueRequest({description:"Delete asset procedure field values attachments",method:l.DELETE,url:"/asset-procedure-field-values-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(_t(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset procedure field values attachments",method:l.GET,url:"/asset-procedure-field-values-attachments/",queryParams:{limit:He,paginate:!0,field_values__asset_procedure_instance__project:e,latest:!0},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset procedure field values attachments",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(ir(n)),n}}class hb extends R{add(e){var r;const{store:i}=this.client,a=i.getState(),n=b({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),c=this.enqueueRequest({description:"Add asset procedure field values",method:l.POST,url:"/asset-procedure-field-values/",payload:v(n),blockers:[e.asset,e.fields_revision,e.asset_procedure_instance],blocks:[n.uuid]});return this.dispatch(Ss(n)),c.then(u=>(this.dispatch(at(u)),u)).catch(()=>{this.dispatch(Is(n.uuid))}),[n,c]}bulkAdd(e,i){var m;const a=new Date().toISOString(),n=[],c=Ye(e.payloads,i??e.payloads.length),r=[];for(const o of c){const h=[];for(const p of o){const A=b({...p,values:p.values,created_by:(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,submitted_at:a});n.push(A),h.push({uuid:A.uuid,asset:p.asset,fields_revision:p.fields_revision,asset_procedure_instance:p.asset_procedure_instance,published_at:p.published_at,values:A.values})}r.push({submitted_at:a,values:e.values,field_values:h})}this.dispatch(lr(n));const u=[];for(const o of r){const h=o.field_values.map(F=>F.asset),p=o.field_values.map(F=>F.fields_revision),A=o.field_values.map(F=>F.asset_procedure_instance),f=o.field_values.map(F=>F.uuid),T=this.enqueueRequest({description:"Bulk add asset procedure field values",method:l.POST,url:"/asset-procedure-field-values/bulk/",payload:o,blockers:[...h,...p,...A],blocks:f});u.push(T)}return Promise.all(u).then(o=>{this.dispatch(hr(o.flat()))}).catch(()=>{this.dispatch(mr(n.map(o=>o.uuid)))}),[n,u]}update(e){const{store:i}=this.client,a=i.getState(),n=gs(e.uuid)(a);if(!n)throw new Error(`Expected AssetProcedureFieldValues with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(at(c));const r=this.enqueueRequest({description:"Update asset procedure field values",method:l.PATCH,url:`/asset-procedure-field-values/${e.uuid}/`,payload:e,blockers:[c.fields_revision,c.asset,c.asset_procedure_instance],blocks:[c.uuid]});return r.then(u=>{this.dispatch(at(u))}).catch(()=>{this.dispatch(at(n))}),[c,r]}async delete(e){const{store:i}=this.client,a=i.getState(),n=gs(e)(a);if(!n)throw new Error(`Expected submission with uuid ${e} to exist`);const c=rr(e)(a);this.dispatch(Is(e)),this.dispatch(Rt(c.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete asset procedure field values",method:l.DELETE,url:`/asset-procedure-field-values/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(Ss(n)),this.dispatch(_t(c)),r}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset procedure field values",method:l.GET,url:"/asset-procedure-field-values/",queryParams:{limit:V,paginate:!0,asset_procedure_instance__project:e,latest:!0},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset procedure field values",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(or(n)),n}}class mb extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(Fs(c));const r=this.enqueueRequest({description:"Create asset procedure instance",method:l.POST,url:"/asset-procedure-instances/",payload:v(c),blockers:[e.asset_procedure,e.asset_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(nt(m))}).catch(()=>{this.dispatch(Ps(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=Rs(e.uuid)(i.getState());if(!a)throw new Error(`Expected asset procedure instance with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(nt(n));const c=this.enqueueRequest({description:"Update asset procedure instance",method:l.PATCH,url:`/asset-procedure-instances/${e.uuid}/`,payload:e,blockers:[a.uuid],blocks:[a.uuid]});return c.then(r=>{this.dispatch(nt(r))}).catch(()=>{this.dispatch(nt(a))}),[n,c]}async remove(e){const{store:i}=this.client,a=i.getState(),n=Rs(e)(a);if(!n)throw new Error(`Expected asset procedure instance with uuid ${e} to exist`);return this.dispatch(Ps(e)),this.enqueueRequest({description:"Delete asset procedure instance",method:l.DELETE,url:`/asset-procedure-instances/${e}/`,blockers:[e],blocks:[]}).catch(c=>{throw this.dispatch(Fs(n)),c})}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset procedure instances",method:l.GET,url:"/asset-procedure-instances/",queryParams:{limit:V,paginate:!0,project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset procedure instances",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(yr(n)),n}}class pb extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(ws(c));const r=this.enqueueRequest({description:"Create asset procedure",method:l.POST,url:"/asset-procedures/",payload:v(c),blockers:[],blocks:[c.uuid]});return r.then(m=>{this.dispatch(ct(m))}).catch(()=>{this.dispatch(Ms(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=Vs(e.uuid)(i.getState());if(!a)throw new Error(`Expected asset procedure with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(ct(n));const c=this.enqueueRequest({description:"Update asset procedure",method:l.PATCH,url:`/asset-procedures/${e.uuid}/`,payload:e,blockers:[a.uuid],blocks:[a.uuid]});return c.then(r=>{this.dispatch(ct(r))}).catch(()=>{this.dispatch(ct(a))}),[n,c]}async remove(e){const{store:i}=this.client,a=i.getState(),n=Vs(e)(a);if(!n)throw new Error(`Expected asset procedure with uuid ${e} to exist`);const c=gr(e)(a);return this.dispatch(Ms(e)),this.dispatch(Ir(c.map(r=>r.uuid))),this.enqueueRequest({description:"Delete asset procedure",method:l.DELETE,url:`/asset-procedures/${e}/`,blockers:[e],blocks:[]}).catch(r=>{throw this.dispatch(ws(n)),this.dispatch(Sr(c)),r})}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset procedures",method:l.GET,url:"/asset-procedures/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(Fr(a)),a}}class Ab extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const o of e){const{fieldsRevisionUuid:h,fieldIdentifier:p,file:A}=o,f=await this.getFilePayload(A);f.sha1 in n||(n[f.sha1]=f);const T=b({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:f.sha1,created_by:a,fields_revision:h,submitted_at:i,field_identifier:p});c.push(T);const F={uuid:T.uuid,file_name:A.name,field_identifier:p,file_extension:f.extension,file_sha1:f.sha1,fields_revision:h};r.push(F)}this.dispatch(vr(c));const u=this.enqueueRequest({description:"Add asset procedure step fields attachments",method:l.POST,url:"/asset-procedure-step-fields-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(o=>o.fields_revision),blocks:c.map(o=>o.uuid)});return u.then(o=>{this.processPresignedUrls(o.presigned_urls),this.dispatch(wr(o.attachments))}).catch(()=>{this.dispatch(Mr(c.map(o=>o.uuid)))}),[c,u.then(({attachments:o})=>o)]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset procedure step fields attachments",method:l.GET,url:"/asset-procedure-step-fields-attachments/",queryParams:{fields_revision__asset_procedure_step__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Rr(a)),a}}class fb extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(zs(c));const r=this.enqueueRequest({description:"Add Asset Procedure Step Fields",method:l.POST,url:"/asset-procedure-step-fields/",payload:v(c),blockers:[c.asset_procedure_step],blocks:[c.uuid]});return r.then(m=>{this.dispatch(rt(m))}).catch(m=>{throw this.dispatch(Us(c.uuid)),m}),[c,r]}update(e){const{store:i}=this.client,a=i.getState().assetProcedureStepFieldsReducer.instances[e.uuid];if(!a)throw new Error(`AssetProcedureStepFields with uuid ${e.uuid} not found`);const n={...a,...e};this.dispatch(rt(n));const c=this.enqueueRequest({description:"Update Asset Procedure Step Fields",method:l.PATCH,url:`/asset-procedure-step-fields/${a.uuid}/`,payload:e,blockers:[a.uuid],blocks:[a.uuid]});return c.then(r=>{this.dispatch(rt(r))}).catch(r=>{throw this.dispatch(rt(a)),r}),[n,c]}delete(e){const{store:i}=this.client,a=i.getState().assetProcedureStepFieldsReducer.instances[e];if(!a)throw new Error(`AssetProcedureStepFields with uuid ${e} not found`);this.dispatch(Us(e));const n=this.enqueueRequest({description:"Delete Asset Procedure Step Fields",method:l.DELETE,url:`/asset-procedure-step-fields/${e}/`,blockers:[e],blocks:[e]});return n.catch(c=>{throw this.dispatch(zs(a)),c}),n}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get Asset Procedure Step Fields",method:l.GET,url:"/asset-procedure-step-fields/",queryParams:{asset_procedure_step__asset_procedure__organization:e},blockers:[],blocks:[]},i);return this.dispatch(zr(a)),a}}class yb extends j{async bulkAdd(e,i){var o;const a=new Date().toISOString(),n=(o=this.client.store.getState().userReducer.currentUser)==null?void 0:o.id,c=Ye(e,i??e.length),r=[],u=[];for(const h of c){const p={},A=[];for(const f of h){const{fieldValuesUuid:T,fieldIdentifier:F,file:_}=f,w=await this.getFilePayload(_);w.sha1 in p||(p[w.sha1]=w);const z=b({file:URL.createObjectURL(_),file_type:_.type,file_name:_.name,file_sha1:w.sha1,created_by:n,field_values:T,submitted_at:a,field_identifier:F});r.push(z);const Le={uuid:z.uuid,file_name:_.name,file_sha1:w.sha1,file_extension:w.extension,field_identifier:F,field_values:T};A.push(Le)}u.push({submitted_at:a,attachments:A,files:Object.values(p)})}this.dispatch(vt(r));const m=u.map(h=>this.enqueueRequest({description:"Add asset procedure step field values attachments",method:l.POST,url:"/asset-procedure-step-field-values-attachments/bulk/",payload:h,blockers:h.attachments.map(p=>p.field_values),blocks:h.attachments.map(p=>p.uuid)}));return Promise.all(m).then(h=>{for(const A of h)this.processPresignedUrls(A.presigned_urls);const p=h.flatMap(A=>A.attachments);this.dispatch(kr(p))}).catch(h=>{throw this.dispatch(wt(r.map(p=>p.uuid))),h}),[r,m.map(h=>h.then(({attachments:p})=>p))]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),n=$r(e)(a);this.dispatch(wt(e));try{await this.enqueueRequest({description:"Delete asset procedure step field values attachments",method:l.DELETE,url:"/asset-procedure-step-field-values-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(vt(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset procedure step field values attachments",method:l.GET,url:"/asset-procedure-step-field-values-attachments/",queryParams:{limit:He,paginate:!0,field_values__asset_procedure_instance__project:e,latest:!0},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset procedure step field values attachments",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Cr(n)),n}}class Sb extends R{add(e){var r;const{store:i}=this.client,a=i.getState(),n=b({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),c=this.enqueueRequest({description:"Add asset procedure step field values",method:l.POST,url:"/asset-procedure-step-field-values/",payload:v(n),blockers:[e.asset,e.fields_revision,e.asset_procedure_instance],blocks:[n.uuid]});return this.dispatch(Gs(n)),c.then(u=>(this.dispatch(dt(u)),u)).catch(()=>{this.dispatch(Ls(n.uuid))}),[n,c]}bulkAdd(e,i){var m;const a=new Date().toISOString(),n=[],c=Ye(e.payloads,i??e.payloads.length),r=[];for(const o of c){const h=[];for(const p of o){const A=b({...p,values:p.values,created_by:(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,submitted_at:a});n.push(A),h.push({uuid:A.uuid,asset:p.asset,fields_revision:p.fields_revision,asset_procedure_instance:p.asset_procedure_instance,asset_procedure_step:p.asset_procedure_step,published_at:p.published_at,values:A.values})}r.push({submitted_at:a,values:e.values,field_values:h})}this.dispatch(Wr(n));const u=[];for(const o of r){const h=o.field_values.map(F=>F.asset),p=o.field_values.map(F=>F.fields_revision),A=o.field_values.map(F=>F.asset_procedure_instance),f=o.field_values.map(F=>F.uuid),T=this.enqueueRequest({description:"Bulk add asset procedure step field values",method:l.POST,url:"/asset-procedure-step-field-values/bulk/",payload:o,blockers:[...h,...p,...A],blocks:f});u.push(T)}return Promise.all(u).then(o=>{this.dispatch(Kr(o.flat()))}).catch(()=>{this.dispatch(Yr(n.map(o=>o.uuid)))}),[n,u]}update(e){const{store:i}=this.client,a=i.getState(),n=Ns(e.uuid)(a);if(!n)throw new Error(`Expected AssetProcedureStepFieldValues with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(dt(c));const r=this.enqueueRequest({description:"Update asset procedure step field values",method:l.PATCH,url:`/asset-procedure-step-field-values/${e.uuid}/`,payload:e,blockers:[c.fields_revision,c.asset,c.asset_procedure_instance],blocks:[c.uuid]});return r.then(u=>{this.dispatch(dt(u))}).catch(()=>{this.dispatch(dt(n))}),[c,r]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Ns(e)(a);if(!n)throw new Error(`Expected submission with uuid ${e} to exist`);const c=Gr(e)(a);this.dispatch(Ls(e)),this.dispatch(wt(c.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete asset procedure step field values",method:l.DELETE,url:`/asset-procedure-step-field-values/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(Gs(n)),this.dispatch(vt(c)),r}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset procedure step field values",method:l.GET,url:"/asset-procedure-step-field-values/",queryParams:{limit:V,paginate:!0,asset_procedure_instance__project:e,latest:!0},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset procedure step field values",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Hr(n)),n}}class Ib extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(Ws(c));const r=this.enqueueRequest({description:"Create asset procedure step",method:l.POST,url:"/asset-procedure-steps/",payload:v(c),blockers:[c.asset_procedure],blocks:[c.uuid]});return r.then(m=>{this.dispatch(Et(m))}).catch(()=>{this.dispatch(Ks(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=Ys(e.uuid)(i.getState());if(!a)throw new Error(`No asset procedure step with uuid ${e.uuid} found in the store`);const n={...a,...e};this.dispatch(Et(n));const c=this.enqueueRequest({description:"Update asset procedure step",method:l.PATCH,url:`/asset-procedure-steps/${a.uuid}/`,payload:{name:e.name,description:e.description,priority:e.order,color:e.color},blockers:[a.uuid],blocks:[a.uuid]});return c.then(r=>{this.dispatch(Et(r))}).catch(()=>{this.dispatch(xr(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Ys(e)(a);if(!n)throw new Error(`No asset procedure step with uuid ${e} found in the store`);return this.dispatch(Ks(e)),this.enqueueRequest({description:"Delete asset stage",method:l.DELETE,url:`/asset-stages/${e}/`,blockers:[e],blocks:[]}).catch(c=>{throw this.dispatch(Ws(n)),c})}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset procedure steps",method:l.GET,url:"/asset-procedure-steps/",queryParams:{asset_procedure__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Qr(a)),a}}class Tb extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(Js(c));const r=this.enqueueRequest({description:"Create asset",method:l.POST,url:"/assets/",payload:v(c),blockers:[c.asset_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(ut(m))}).catch(()=>{this.dispatch(Xs(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=ti(e.uuid)(i.getState());if(!a)throw new Error(`No asset with uuid ${e.uuid} found in the store`);const n={...a,...e};this.dispatch(ut(n));const c=this.enqueueRequest({description:"Edit asset",method:l.PATCH,url:`/assets/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(ut(r))}).catch(()=>{this.dispatch(ut(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=ti(e)(a);if(!n)throw new Error(`No asset with uuid ${e} found in the store`);const c=vc(e)(a),r=cl(e)(a);if(this.dispatch(Xs(e)),c.length>0){const u=c.map(({uuid:m})=>m);this.dispatch(os(u))}if(r.length>0){const u=r.map(({uuid:m})=>m);this.dispatch(_a(u))}return this.enqueueRequest({description:"Delete asset",method:l.DELETE,url:`/assets/${e}/`,blockers:[e],blocks:[]}).catch(u=>{throw this.dispatch(Js(n)),this.dispatch(us(c)),this.dispatch(Pa(r)),u})}bulkAdd(e,i,a,n){const c=new Date().toISOString(),r=Xe.v4(),u=Ye(e,n).map(h=>{const p=h.map(A=>b(A));return{batchId:Xe.v4(),payload:{transaction_id:r,submitted_at:c,asset_type:i,project:a,assets:p}}}),m=[];let o=null;for(const h of u){const{batchId:p,payload:A}=h,f=A.assets.map(w=>w.uuid),T=[i];o&&T.push(o);const F=f;F.push(p);const _=this.enqueueRequest({description:"Batch create assets",method:l.POST,url:"/assets/bulk/",payload:A,blockers:T,blocks:F});o=h.batchId,m.push(_)}return Promise.all(m).then(h=>{const p=h.flat();this.dispatch(jt(p))}),m}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),n=nd(e)(a);this.dispatch(Qs(e));try{await this.enqueueRequest({description:"Bulk delete assets",method:l.DELETE,url:"/assets/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(jt(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get assets",method:l.GET,url:"/assets/",queryParams:{limit:V,paginate:!0,project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get assets",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(id(n)),n}}class gb extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(ii(c));const r=this.enqueueRequest({description:"Add asset stage completion",method:l.POST,url:"/asset-stage-completions/",payload:v(c),blockers:[e.asset,e.stage],blocks:[c.uuid]});return r.then(m=>{this.dispatch(ud(m))}).catch(()=>{this.dispatch(ni(c.uuid))}),[c,r]}delete(e){const{store:i}=this.client,a=hd(e)(i.getState());if(!a)throw new Error(`Expected asset stage completion with uuid ${e} to exist`);this.dispatch(ni(e));const n=this.enqueueRequest({description:"Delete asset stage completion",method:l.DELETE,url:`/asset-stage-completions/${e}/`,blockers:[e],blocks:[]});return n.catch(()=>{this.dispatch(ii(a))}),n}bulkAdd(e){var o;const{store:i}=this.client,a=new Date().toISOString(),n=(o=i.getState().userReducer.currentUser)==null?void 0:o.id,c=e.map(h=>b(h)),r=c.map(h=>({...h,created_by:n,submitted_at:a})),u=r.map(({uuid:h})=>h);this.dispatch(ai(r));const m=this.enqueueRequest({description:"Bulk create asset stage completions",method:l.POST,url:"/asset-stage-completions/bulk/",payload:{submitted_at:a,completions:c},blockers:[...e.map(h=>h.asset_procedure_instance),...e.map(h=>h.stage),...e.map(h=>h.asset)],blocks:u});return m.then(h=>{this.dispatch(od(h))}).catch(()=>{this.dispatch(ci(u))}),[r,m]}bulkDelete(e){const{store:i}=this.client,a=md(e)(i.getState());this.dispatch(ci(e));const n=this.enqueueRequest({description:"Deleting asset stage completions",method:l.DELETE,url:"/asset-stage-completions/bulk/",payload:{uuids:e},blockers:e,blocks:[]});return n.catch(()=>{this.dispatch(ai(a))}),n}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset stage completions",method:l.GET,url:"/asset-stage-completions/",queryParams:{limit:V,paginate:!0,asset_procedure_instance__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset stage completions",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(dd(n)),n}}class bb extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(ui(c));const r=this.enqueueRequest({description:"Create asset",method:l.POST,url:"/asset-stages/",payload:v(c),blockers:[c.asset_procedure],blocks:[c.uuid]});return r.then(m=>{this.dispatch(qt(m))}).catch(()=>{this.dispatch(oi(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=li(e.uuid)(i.getState());if(!a)throw new Error(`No asset stage with uuid ${e.uuid} found in the store`);const n={...a,...e};this.dispatch(qt(n));const c=this.enqueueRequest({description:"Update asset stage",method:l.PATCH,url:`/asset-stages/${a.uuid}/`,payload:e,blockers:[a.uuid],blocks:[a.uuid]});return c.then(r=>{this.dispatch(qt(r))}).catch(()=>{this.dispatch(fd(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=li(e)(a);if(!n)throw new Error(`No asset stage with uuid ${e} found in the store`);return this.dispatch(oi(e)),this.enqueueRequest({description:"Delete asset stage",method:l.DELETE,url:`/asset-stages/${e}/`,blockers:[e],blocks:[]}).catch(c=>{throw this.dispatch(ui(n)),c})}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset stages",method:l.GET,url:"/asset-stages/",queryParams:{asset_procedure__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Ad(a)),a}}class Fb extends We{constructor(){super(...arguments);S(this,"name","Asset Type Attachment");S(this,"url","/asset-type-attachments");S(this,"addAttachments",mi);S(this,"updateAttachments",bd);S(this,"removeAttachments",pi);S(this,"removeAttachment",Fd);S(this,"setAttachment",gd);S(this,"selectAttachment",_d)}buildOfflineAttachment(i){return b({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,asset_type:i.modelUuid})}buildAttachmentPayload(i){return{...i,asset_type:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.assetTypeUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const n=await this.enqueueRequest({immediate:!0,description:"Get asset type attachments",method:l.GET,url:`${this.url}/`,queryParams:{asset_type__organization:i},blocks:[],blockers:[]},a);return this.dispatch(Td(n)),n}}class Pb extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const o of e){const{fieldsRevisionUuid:h,fieldIdentifier:p,file:A}=o,f=await this.getFilePayload(A);f.sha1 in n||(n[f.sha1]=f);const T=b({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:f.sha1,created_by:a,fields_revision:h,submitted_at:i,field_identifier:p});c.push(T);const F={uuid:T.uuid,file_name:A.name,field_identifier:p,file_extension:f.extension,file_sha1:f.sha1,fields_revision:h};r.push(F)}this.dispatch(Ed(c));const u=this.enqueueRequest({description:"Add asset type fields attachments",method:l.POST,url:"/asset-type-fields-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(o=>o.fields_revision),blocks:c.map(o=>o.uuid)});return u.then(o=>{this.processPresignedUrls(o.presigned_urls),this.dispatch(Vd(o.attachments))}).catch(()=>{this.dispatch(jd(c.map(o=>o.uuid)))}),[c,u.then(({attachments:o})=>o)]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset type fields attachments",method:l.GET,url:"/asset-type-fields-attachments/",queryParams:{fields_revision__asset_type__organization:e},blockers:[e],blocks:[]},i);return this.dispatch(Md(a)),a}}class Ob extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(kd(c));const r=this.enqueueRequest({description:"Add Asset Type Fields",method:l.POST,url:"/asset-type-fields/",payload:v(c),blockers:[c.asset_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(Bd(m))}).catch(m=>{throw this.dispatch($d(c.uuid)),m}),[c,r]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get Asset Type Fields",method:l.GET,url:"/asset-type-fields/",queryParams:{asset_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Cd(a)),a}}class _b extends j{async bulkAdd(e,i){var o;const a=new Date().toISOString(),n=(o=this.client.store.getState().userReducer.currentUser)==null?void 0:o.id,c=Ye(e,i??e.length),r=[],u=[];for(const h of c){const p={},A=[];for(const f of h){const{fieldValuesUuid:T,fieldIdentifier:F,file:_}=f,w=await this.getFilePayload(_);w.sha1 in p||(p[w.sha1]=w);const z=b({file:URL.createObjectURL(_),file_type:_.type,file_name:_.name,file_sha1:w.sha1,created_by:n,field_values:T,submitted_at:a,field_identifier:F});r.push(z);const Le={uuid:z.uuid,file_name:_.name,file_sha1:w.sha1,file_extension:w.extension,field_identifier:F,field_values:T};A.push(Le)}u.push({submitted_at:a,attachments:A,files:Object.values(p)})}this.dispatch(Dt(r));const m=u.map(h=>this.enqueueRequest({description:"Add asset type field values attachments",method:l.POST,url:"/asset-type-field-values-attachments/bulk/",payload:h,blockers:h.attachments.map(p=>p.field_values),blocks:h.attachments.map(p=>p.uuid)}));return Promise.all(m).then(h=>{for(const A of h)this.processPresignedUrls(A.presigned_urls);const p=h.flatMap(A=>A.attachments);this.dispatch(Wd(p))}).catch(h=>{throw this.dispatch(Ct(r.map(p=>p.uuid))),h}),[r,m.map(h=>h.then(({attachments:p})=>p))]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),n=Yd(e)(a);this.dispatch(Ct(e));try{await this.enqueueRequest({description:"Delete asset type field values attachments",method:l.DELETE,url:"/asset-type-field-values-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(Dt(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset type field values attachments",method:l.GET,url:"/asset-type-field-values-attachments/",queryParams:{limit:He,paginate:!0,field_values__asset__project:e,latest:!0},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset type field values attachments",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Hd(n)),n}}class Rb extends R{add(e){var r;const{store:i}=this.client,a=i.getState(),n=b({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),c=this.enqueueRequest({description:"Add asset type field values",method:l.POST,url:"/asset-type-field-values/",payload:v(n),blockers:[e.asset,e.fields_revision],blocks:[n.uuid]});return this.dispatch(Ti(n)),c.then(u=>(this.dispatch(ot(u)),u)).catch(()=>{this.dispatch(gi(n.uuid))}),[n,c]}bulkAdd(e,i){var m;const a=new Date().toISOString(),n=[],c=Ye(e.payloads,i??e.payloads.length),r=[];for(const o of c){const h=[];for(const p of o){const A=b({...p,values:p.values,created_by:(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,submitted_at:a});n.push(A),h.push({uuid:A.uuid,asset:p.asset,fields_revision:p.fields_revision,published_at:p.published_at,values:A.values})}r.push({submitted_at:a,values:e.values,field_values:h})}this.dispatch(xd(n));const u=[];for(const o of r){const h=o.field_values.map(T=>T.asset),p=o.field_values.map(T=>T.fields_revision),A=o.field_values.map(T=>T.uuid),f=this.enqueueRequest({description:"Bulk add asset type field values",method:l.POST,url:"/asset-type-field-values/bulk/",payload:o,blockers:[...h,...p],blocks:A});u.push(f)}return Promise.all(u).then(o=>{this.dispatch(eu(o.flat()))}).catch(()=>{this.dispatch(tu(n.map(o=>o.uuid)))}),[n,u]}update(e){const{store:i}=this.client,a=i.getState(),n=Fi(e.uuid)(a);if(!n)throw new Error(`Expected AssetTypeFieldValues with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(ot(c));const r=this.enqueueRequest({description:"Delete asset type field values",method:l.PATCH,url:`/asset-type-field-values/${e.uuid}/`,payload:e,blockers:[c.uuid,c.fields_revision,c.asset],blocks:[c.uuid]});return r.then(u=>{this.dispatch(ot(u))}).catch(()=>{this.dispatch(ot(n))}),[c,r]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Fi(e)(a);if(!n)throw new Error(`Expected submission with uuid ${e} to exist`);const c=Zd(e)(a);this.dispatch(gi(e)),this.dispatch(Ct(c.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete asset type field values",method:l.DELETE,url:`/asset-type-field-values/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(Ti(n)),this.dispatch(Dt(c)),r}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset type field values",method:l.GET,url:"/asset-type-field-values/",queryParams:{limit:V,paginate:!0,asset__project:e,latest:!0},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset type field values",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Qd(n)),n}}class vb extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(Oi(c));const r=this.enqueueRequest({description:"Create asset type identifier",method:l.POST,url:"/asset-type-identifiers/",payload:v(c),blockers:[c.asset_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(lt(m))}).catch(()=>{this.dispatch(_i(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=Ri(e.uuid)(i.getState());if(!a)throw new Error(`Expected asset type identifier with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(lt(n));const c=this.enqueueRequest({description:"Update asset type identifier",method:l.PATCH,url:`/asset-type-identifiers/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(lt(r))}).catch(()=>{this.dispatch(lt(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Ri(e)(a);if(!n)throw new Error(`Expected asset type identifier with uuid ${e} to exist`);this.dispatch(_i(e));try{return await this.enqueueRequest({description:"Delete asset type identifier",method:l.DELETE,url:`/asset-type-identifiers/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(Oi(n)),c}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset type identifiers",method:l.GET,url:"/asset-type-identifiers/",queryParams:{asset_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(nu(a)),a}}class wb extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(wi(c));const r=this.enqueueRequest({description:"Create asset type identifier value",method:l.POST,url:"/asset-type-identifier-values/",payload:v(c),blockers:[e.asset,e.asset_type_identifier],blocks:[c.uuid]});return r.then(m=>{this.dispatch(ht(m))}).catch(()=>{this.dispatch(Mi(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=Vi(e.uuid)(i.getState());if(!a)throw new Error(`Expected asset type identifier value with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(ht(n));const c=this.enqueueRequest({description:"Update asset type identifier value",method:l.PATCH,url:`/asset-type-identifier-values/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(ht(r))}).catch(()=>{this.dispatch(ht(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Vi(e)(a);if(!n)throw new Error(`Expected asset type identifier value with uuid ${e} to exist`);this.dispatch(Mi(e));try{return await this.enqueueRequest({description:"Delete asset type identifier value",method:l.DELETE,url:`/asset-type-identifier-values/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(wi(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset type identifier values",method:l.GET,url:"/asset-type-identifier-values/",queryParams:{limit:V,paginate:!0,asset__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset type identifier values",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(ou(n)),n}}class Mb extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(qi(c));const r=this.enqueueRequest({description:"Create asset type",method:l.POST,url:"/asset-types/",payload:v(c),blockers:[],blocks:[c.uuid]});return r.then(m=>{this.dispatch(mt(m))}).catch(()=>{this.dispatch(zi(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=Di(e.uuid)(i.getState());if(!a)throw new Error(`Expected asset type with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(mt(n));const c=this.enqueueRequest({description:"Update asset type",method:l.PATCH,url:`/asset-types/${e.uuid}/`,payload:e,blockers:[a.uuid],blocks:[a.uuid]});return c.then(r=>{this.dispatch(mt(r))}).catch(()=>{this.dispatch(mt(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Di(e)(a);if(!n)throw new Error(`Expected asset type with uuid ${e} to exist`);const c=ei(e)(a),r=Rd(e)(a);return this.dispatch(zi(e)),this.dispatch(Qs(c.map(u=>u.uuid))),this.dispatch(pi(r.map(({uuid:u})=>u))),this.enqueueRequest({description:"Delete asset type",method:l.DELETE,url:`/asset-types/${e}/`,blockers:[e],blocks:[]}).catch(u=>{throw this.dispatch(qi(n)),this.dispatch(jt(c)),this.dispatch(mi(r)),u})}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset types",method:l.GET,url:"/asset-types/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(pu(a)),a}}class Eb extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(ki(c));const r=this.enqueueRequest({description:"Create Category",method:l.POST,url:"/categories/",payload:v(c),blockers:[e.project],blocks:[c.uuid]});return[c,r]}update(e){const i=this.client.store.getState(),a=$i(e.uuid)(i);if(!a)throw new Error(`Expected an existing category with uuid ${e.uuid}`);const n={...a,...e};this.dispatch(bu(n));const c=this.enqueueRequest({description:"Edit Category",method:l.PATCH,url:`/categories/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return[n,c]}remove(e){const{store:i}=this.client,a=$i(e)(i.getState());if(!a)throw new Error(`No category with uuid ${e} found in the store`);this.dispatch(Fu(e));const n=this.enqueueRequest({description:"Delete Category",method:l.DELETE,url:`/categories/${a.uuid}/`,blockers:[a.uuid],blocks:[]});return n.catch(()=>{this.dispatch(ki(a))}),n}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get categories",method:l.GET,url:"/categories/",queryParams:{project__organization:e},blocks:[],blockers:[]},i);return this.dispatch(gu(a)),a}}class Vb extends We{constructor(){super(...arguments);S(this,"name","Document Attachment");S(this,"url","/document-attachments");S(this,"addAttachments",vu);S(this,"updateAttachments",Mu);S(this,"removeAttachments",Vu);S(this,"removeAttachment",Eu);S(this,"setAttachment",wu);S(this,"selectAttachment",zu)}buildOfflineAttachment(i){return b({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,document:i.modelUuid})}buildAttachmentPayload(i){return{...i,document:i.modelUuid}}async bulkAdd(i){var p;const{store:a}=this.client,n=(p=a.getState().userReducer.currentUser)==null?void 0:p.id,c=new Date().toISOString(),r=[],u=[],m={},o={};for(const A of i){const{documentUuid:f,file:T}=A,F=await this.getFilePayload(T);F.sha1 in m||(m[F.sha1]=F,o[F.sha1]=[]);const _=this.buildOfflineAttachment({file:T,file_sha1:F.sha1,submitted_at:c,created_by:n,description:"",modelUuid:f});r.push(_),u.push({uuid:_.uuid,file_name:_.file_name,file_sha1:_.file_sha1,file_extension:F.extension,description:_.description,document:f}),o[F.sha1].push(_.uuid)}this.dispatch(this.addAttachments(r));const h=this.enqueueRequest({description:"Attach files to document",method:l.POST,url:"/document-attachments/bulk/",payload:{submitted_at:c,attachments:u,files:Object.values(m)},blocks:r.map(A=>A.uuid),blockers:r.map(A=>A.file_sha1)});return h.then(({attachments:A,presigned_urls:f})=>{this.dispatch(this.updateAttachments(A));const T=this.processPresignedUrls(f);for(const[F,_]of Object.entries(T))_.then(()=>{const w=o[F];for(const z of w)this.makeReadable(z)})}).catch(()=>{this.dispatch(this.removeAttachments(r.map(A=>A.uuid)))}),[r,h.then(({attachments:A})=>A)]}async delete(i){return this._delete(i)}makeReadable(i){this.enqueueRequest({description:"Add attachment to AI assistant",method:l.PATCH,url:`/document-attachments/${i}/`,payload:{readable_to_assistant:!0},blockers:["index-document-attachment",i],blocks:["index-document-attachment"]})}async refreshStore(i,a){const n=await this.enqueueRequest({immediate:!0,description:"Get document attachments",method:l.GET,url:"/document-attachments/",queryParams:{document__project__organization:i},blocks:[],blockers:[]},a),c=await this.enqueueRequest({immediate:!0,description:"Get document attachments",method:l.GET,url:"/document-attachments/",queryParams:{document__organization:i},blocks:[],blockers:[]},a),r=[...n,...c];return this.dispatch(Ru(r)),r}}class jb extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(ku([c]));const r=this.enqueueRequest({description:"Create Document",method:l.POST,url:"/documents/",payload:v(c),queryParams:{parent_document:c.parent_document??void 0},blockers:c.parent_document?[c.parent_document]:[],blocks:[c.uuid]});return r.catch(()=>{this.dispatch(Ni([c.uuid]))}),[c,r]}update(e){const{store:i}=this.client,a=i.getState().documentsReducer.documents[e.uuid];if(!a)throw new Error(`attempting to update a document with uuid ${e.uuid} that does not exist in store.documents`);const n={...a,...e};this.dispatch(xe([n]));const c=this.enqueueRequest({description:"Update Document",method:l.PATCH,url:`/documents/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.catch(()=>{xe([a])}),[n,c]}delete(e){const{store:i}=this.client,a=Bt(i.getState()),n=Bu(e)(i.getState());if(!n)throw new Error(`attempting to delete a document with uuid ${e} that does not exist in store.documents`);const c=n.parent_document?a[n.parent_document]:void 0;this.dispatch(Ni([e]));const r=this.enqueueRequest({description:"Delete Document",method:l.DELETE,url:`/documents/${e}/`,blockers:[e],blocks:[]});return r.then(u=>{this.dispatch(xe(u))}).catch(()=>{this.dispatch(xe([n])),c&&this.dispatch(xe([c]))}),r}async refreshStore(e,i){const a=this.enqueueRequest({immediate:!0,description:"Get project documents",method:l.GET,url:"/documents/",queryParams:{project__organization:e},blockers:[],blocks:[]},i),n=this.enqueueRequest({immediate:!0,description:"Get organization documents",method:l.GET,url:"/documents/",queryParams:{organization:e},blockers:[],blocks:[]},i),c=[...await a,...await n];return this.dispatch(Cu(c)),c}}class qb extends R{async add(e,i){return this.enqueueRequest({description:"Add email domain to organization",method:l.POST,url:"/organization-email-domains/",payload:{email:i,organization:e},blockers:[e,"create-org"],blocks:[]})}async remove(e){return this.dispatch(Hu(e.uuid)),this.enqueueRequest({description:"Remove email domain from organization",method:l.DELETE,url:`/organization-email-domains/${e.uuid}/`,blockers:[e.domain],blocks:[]}).catch(i=>{throw this.dispatch(Nu(e)),i})}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch email domains for organization",method:l.GET,url:"/organization-email-domains/",queryParams:{organization:e},blockers:[e],blocks:[]},i);return this.dispatch(Lu(a)),a}}class zb extends R{async getVerificationCode(e){return this.enqueueRequest({description:"Get verification code",method:l.GET,url:`/verification/email-verification/${e}/`,isAuthNeeded:!1,blockers:[],blocks:[]})}validateVerificationCode(e,i=void 0){return this.enqueueRequest({description:"Validate verification code",method:l.POST,url:`/verification/email-verification/${e}/`,isAuthNeeded:!1,payload:i,blockers:[],blocks:[]})}}const Xt={},Jn=new Set;let Qt=0,Xn=0,Qn=0;const Ub=20;class Db extends R{constructor(){super(...arguments);S(this,"host");S(this,"_dbPromise",Bp.openDB("fileCache",1,{upgrade(i){i.createObjectStore("files")}}))}async renewUploadUrl(i){const a=await this.fetchCache(i);if(!a)throw new Error(`File with sha1 ${i} not found in cache`);const n=await as(a,i),c=await this.enqueueRequest({description:"Get S3 URL",method:l.GET,url:"/authentication/files/presigned-upload-url/",queryParams:{sha1:await Qe(a),file_type:a.type,extension:a.name.split(".").pop(),size:a.size.toString()},blockers:[],blocks:[`s3-${n}`]});return"url"in c&&this.dispatch(Xu({sha1:i,...c})),c}async addCache(i,a){if(Jn.has(a))return;if(!i.type){const r=i.name.split("."),u=r[r.length-1];i=new File([i],i.name,{type:u})}if(!i.name||!i.size||!i.type)throw new Error("Cannot add files to cache that do not have a name, size and type.");const n=await this._dbPromise;!!await n.get("files",a)?(console.error("File already cached (this is unexpected at this point):",i.name,a),Qt++):(await n.put("files",i,a),Xn++),Jn.add(a),Qn++,Qn%Ub===0&&console.debug(`File cache summary: ${Qt} hits and ${Xn} misses, ${Qt/(Qt+Xn)*100}% hit rate over ${Qn} calls to addCache.`)}async removeCache(i){await(await this._dbPromise).delete("files",i),Jn.delete(i)}async fetchCache(i){return(await this._dbPromise).get("files",i)}async getOrRenewUploadUrl(i){const a=this.client.store.getState();return Qu(i)(a)??await this.renewUploadUrl(i)}async uploadFileToS3(i){const a=await this.fetchCache(i);if(!a)throw new Error(`File with sha1 ${i} not found in cache`);const n=await as(a,i),c={file_name:a.name,file_sha1:i,file:n},r=await this.getOrRenewUploadUrl(i);if("warning"in r){if(r.warning==="already_uploaded")return[c,Promise.resolve(void 0)];throw new Error(r.warning)}const u=r.url,m=this.enqueueRequest({url:u,description:"Upload file",method:l.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:i,blockers:[`s3-${n}`],blocks:[i],s3url:r});return[c,m]}async fetchFileFromUrl(i,a,n){const c=i.split("?")[0]??i,r=await this.fetchCache(a);if(r){if(!r.name)throw new Error("Cached file unexpectedly has no name.");return r}if(i.startsWith("blob:")){const h=await oc(i),p=new File([h],n??a,{type:h.type});return await this.addCache(p,a),p}let u=Xt[c],m=!0;u?m=!1:(u=new Promise(h=>{this.enqueueRequest({description:"Download file",method:l.GET,url:i,isExternalUrl:!0,isResponseBlob:!0,isAuthNeeded:!1,blockers:[a],blocks:[a]}).then(p=>{const A=new File([p],n??a,{type:p.type});h(A)})}),Xt[c]=u);let o;try{o=await u}catch(h){throw m&&h instanceof D&&delete Xt[c],h}if(m){const h=await Qe(o);if(h!==a){const f=`The hash of the file returned from the server (${h}) does not match the
|
|
9
9
|
expected hash (${a}). This can happen if you're using a local development server and the
|
|
10
10
|
isExternalUrl flag in the request details is set to true, because instead of requesting the local
|
|
11
11
|
REST API, you will be requesting localhost:80 (where this app runs), resulting in a transformed blob
|
|
12
12
|
(with an uuid attached) being returned. Alternatively, you may be running with
|
|
13
13
|
import.meta.env.PROD, which will result in some file requests being treated as
|
|
14
|
-
external URLs and therefore not prepended with VITE_API_URL.`;throw new Error(f)}const p=o.type.split("/")[1];if(!p)throw new Error("File has no extension");const A=n??h+"."+p;if(o=oc(o,A),!o.name)throw new Error("Failed to set file's name");await this.addCache(o,h),Qt[c]=new Promise(f=>{f(o)})}return o}}class $b extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(Ji(c));const r=this.enqueueRequest({description:"Create form identifier",method:l.POST,url:"/form-identifiers/",payload:v(c),blockers:[c.form],blocks:[c.uuid]});return r.then(m=>{this.dispatch(ht(m))}).catch(()=>{this.dispatch(Xi(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=Qi(e.uuid)(i.getState());if(!a)throw new Error(`Expected form identifier with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(ht(n));const c=this.enqueueRequest({description:"Update form identifier",method:l.PATCH,url:`/form-identifiers/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(ht(r))}).catch(()=>{this.dispatch(ht(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Qi(e)(a);if(!n)throw new Error(`Expected form identifier with uuid ${e} to exist`);this.dispatch(Xi(e));try{return await this.enqueueRequest({description:"Delete form identifier",method:l.DELETE,url:`/form-identifiers/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(Ji(n)),c}}async refreshStore(e,i){const a=await this.enqueueRequest({description:"Get form identifiers",method:l.GET,url:"/form-identifiers/",queryParams:{form__organization:e},blockers:[],blocks:[]},i);return this.dispatch(so(a)),a}}class Lb extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(ea(c));const r=this.enqueueRequest({description:"Create form identifier value",method:l.POST,url:"/form-identifier-values/",payload:v(c),blockers:[e.form_submission,e.form_identifier],blocks:[c.uuid]});return r.then(m=>{this.dispatch(mt(m))}).catch(()=>{this.dispatch(ta(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=ia(e.uuid)(i.getState());if(!a)throw new Error(`Expected form identifier value with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(mt(n));const c=this.enqueueRequest({description:"Update form identifier value",method:l.PATCH,url:`/form-identifier-values/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(mt(r))}).catch(()=>{this.dispatch(mt(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=ia(e)(a);if(!n)throw new Error(`Expected form identifier value with uuid ${e} to exist`);this.dispatch(ta(e));try{return await this.enqueueRequest({description:"Delete form identifier value",method:l.DELETE,url:`/form-identifier-values/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(ea(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get form identifier values",method:l.GET,url:"/form-identifier-values/",queryParams:{limit:E,paginate:!0,form_submission__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get form identifier values",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(ro(n)),n}}class Nb extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const o of e){const{revisionUuid:h,fieldIdentifier:p,file:A}=o,f=await this.getFilePayload(A);f.sha1 in n||(n[f.sha1]=f);const T=b({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:f.sha1,created_by:a,form_revision:h,submitted_at:i,field_identifier:p});c.push(T);const F={uuid:T.uuid,file_name:A.name,field_identifier:p,file_extension:f.extension,file_sha1:f.sha1,form_revision:h};r.push(F)}this.dispatch(mo(c));const u=this.enqueueRequest({description:"Attach files to form revision",method:l.POST,url:"/form-revision-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(o=>o.form_revision),blocks:c.map(o=>o.uuid)});return u.then(o=>{this.processPresignedUrls(o.presigned_urls),this.dispatch(po(o.attachments))}).catch(()=>{this.dispatch(Ao(c.map(o=>o.uuid)))}),[c,u.then(({attachments:o})=>o)]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch organization form revision attachments",method:l.GET,url:"/form-revision-attachments/",queryParams:{form_revision__form__organization:e},blockers:[e],blocks:[]},i);return this.dispatch(ho(a)),a}}class Hb extends j{add(e){var u;const{store:i}=this.client,n=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,c=b({...e,created_by:n,submitted_at:new Date().toISOString()});this.dispatch(ca(c));const r=this.enqueueRequest({description:"Create form revision",method:l.POST,url:"/form-revisions/",payload:v(c),blockers:[e.form],blocks:[c.uuid]});return r.then(m=>{this.dispatch(go(m))}).catch(()=>{this.dispatch(ra(c.uuid))}),[c,r]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get organization form revisions",method:l.GET,url:"/form-revisions/",queryParams:{form__organization:e},blockers:[e],blocks:[]},i);return this.dispatch(Io(a)),a}}class Wb extends j{add(e,i){var o;const{store:a}=this.client,n=new Date().toISOString(),c=(o=a.getState().userReducer.currentUser)==null?void 0:o.id,r=b({...e,submitted_at:n,created_by:c}),u=b({...i,form:r.uuid,submitted_at:n,created_by:c});this.dispatch(la(r)),this.dispatch(ca(u));const m=this.enqueueRequest({description:"Create form",method:l.POST,url:"/forms/",payload:{...v(r),initial_revision:{uuid:u.uuid,submitted_at:u.submitted_at,title:u.title,description:u.description,fields:u.fields}},blockers:[],blocks:[r.uuid,u.uuid]});return m.catch(h=>{throw this.dispatch(ha(r.uuid)),this.dispatch(ra(u.uuid)),h}),[r,u,m]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Mo(e)(a);if(!n)throw new Error("Expected form to exist");const c=Go(e)(a);c.length>0&&this.dispatch(Nt(c.map(({uuid:u})=>u)));const r=Fo(e)(a);r.length>0&&this.dispatch(bo(r.map(({uuid:u})=>u))),this.dispatch(ha(e));try{return await this.enqueueRequest({description:"Delete form",method:l.DELETE,url:`/forms/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(la(n)),r.length>0&&this.dispatch(To(r)),c.length>0&&this.dispatch(Lt(c)),u}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch organization forms",method:l.GET,url:"/forms/",queryParams:{organization:e},blockers:[e],blocks:[]},i);return this.dispatch(_o(a)),a}}class Yb extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const o of e){const{submissionUuid:h,fieldIdentifier:p,file:A}=o,f=await this.getFilePayload(A);f.sha1 in n||(n[f.sha1]=f);const T=b({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:f.sha1,created_by:a,form_submission:h,submitted_at:i,field_identifier:p});c.push(T);const F={uuid:T.uuid,file_name:A.name,file_sha1:f.sha1,file_extension:f.extension,field_identifier:p,form_submission:h};r.push(F)}this.dispatch(Bt(c));const u=this.enqueueRequest({description:"Attach files to form submission",method:l.POST,url:"/form-submission-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(o=>o.form_submission),blocks:c.map(o=>o.uuid)});return u.then(o=>{this.processPresignedUrls(o.presigned_urls),this.dispatch(jo(o.attachments))}).catch(o=>{throw this.dispatch(Gt(c.map(h=>h.uuid))),o}),[c,u.then(({attachments:o})=>o)]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),n=zo(e)(a);this.dispatch(Gt(e));try{await this.enqueueRequest({description:"Delete form submission attachments",method:l.DELETE,url:"/form-submission-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(Bt(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get form submission attachments",method:l.GET,url:"/form-submission-attachments/",queryParams:{limit:E,paginate:!0,form_submission__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get form submission attachments",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Vo(n)),n}}class Kb extends j{add(e){var r;const{store:i}=this.client,a=i.getState(),n=b({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),c=this.enqueueRequest({description:"Add form submission",method:l.POST,url:"/form-submissions/",payload:v(n),blockers:[e.form_revision,...e.issue?[e.issue]:[],...e.asset?[e.asset]:[]],blocks:[n.uuid]});return this.dispatch(fa(n)),c.then(u=>(this.dispatch($t(u)),u)).catch(()=>{this.dispatch(ya(n.uuid))}),[n,c]}update(e){const{store:i}=this.client,a=i.getState(),n=Ta(e.uuid)(a);if(!n)throw new Error(`Expected submission with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(Bo(c));const r=this.enqueueRequest({description:"Delete user form submissions",method:l.PATCH,url:`/form-submissions/${c.uuid}/`,payload:e,blockers:[c.uuid],blocks:[c.uuid]});return r.then(u=>{this.dispatch($t(u))}).catch(()=>{this.dispatch($t(n))}),[c,r]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Ta(e)(a);if(!n)throw new Error(`Expected submission with uuid ${e} to exist`);const c=Uo(e)(a);this.dispatch(ya(e)),this.dispatch(Gt(c.map(r=>r.uuid)));try{return await this.enqueueRequest({description:"Delete user form submissions",method:l.DELETE,url:`/form-submissions/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(fa(n)),this.dispatch(Bt(c)),r}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Fetch form submissions",method:l.GET,url:"/form-submissions/",queryParams:{limit:E,paginate:!0,project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Fetch form submissions",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(ko(n)),n}}class Zb extends j{async add(e){var p;const{store:i}=this.client,{file:a,...n}=e,c=new Date().toISOString(),r=(p=i.getState().userReducer.currentUser)==null?void 0:p.id,u=n.project,m=await this.getFilePayload(a),o=b({...n,file_name:a.name,file_sha1:m.sha1,file:URL.createObjectURL(a),submitted_at:c,created_by:r});this.dispatch(Ko(o));const h=this.enqueueRequest({description:"Add geo image",method:l.POST,url:"/geo-images/",payload:{uuid:o.uuid,submitted_at:c,title:o.title,description:o.description,geo_marker:o.geo_marker,canvas_marker:o.canvas_marker,sha1:o.file_sha1,project:o.project,file_name:o.file_name,direction:o.direction,original_date:o.original_date,file:m},blocks:[u],blockers:[u]});return h.then(A=>{this.processPresignedUrls(A.presigned_urls),this.dispatch(pt(A.geo_image))}).catch(()=>{this.dispatch(ba(o.uuid))}),[o,h.then(A=>A.geo_image)]}async bulkAdd(e,i){var p;const{store:a}=this.client,n=new Date().toISOString(),c=(p=a.getState().userReducer.currentUser)==null?void 0:p.id,r=[],u=[],m=[],o={};for(const A of e){const{file:f,...T}=A,F=await this.getFilePayload(f);F.sha1 in o||(o[F.sha1]=F);const _=b({...T,file_name:f.name,file_sha1:F.sha1,file:URL.createObjectURL(f),submitted_at:n,created_by:c,project:i});r.push(_),u.push(_.uuid),m.push({uuid:_.uuid,sha1:_.file_sha1,file_name:_.file_name,title:_.title,description:_.description,geo_marker:_.geo_marker,canvas_marker:_.canvas_marker,direction:_.direction,original_date:_.original_date})}this.dispatch(Zo(r));const h=this.enqueueRequest({description:"Bulk add geo images",method:l.POST,url:"/geo-images/bulk/",payload:{submitted_at:n,project:i,geo_images:m,files:Object.values(o)},blocks:[i],blockers:u});return h.then(A=>{this.processPresignedUrls(A.presigned_urls),this.dispatch(Yo(A.geo_images))}).catch(()=>{this.dispatch(Xo(u))}),[r,h.then(A=>A.geo_images)]}update(e){const{store:i}=this.client,a=i.getState(),n=Fa(e.uuid)(a);if(!n)throw new Error(`Map image with uuid ${e.uuid} does not exist in the store`);const c={...n,...e};this.dispatch(Jo(c));const r=this.enqueueRequest({description:"Update geo image",method:l.PATCH,url:`/geo-images/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return r.then(u=>{this.dispatch(pt(u))}).catch(()=>{this.dispatch(pt(n))}),[c,r]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Fa(e)(a);if(!n)throw new Error(`Map image with uuid ${e} does not exist in the store`);this.dispatch(ba(e));const c=this.enqueueRequest({description:"Delete geo image",method:l.DELETE,url:`/geo-images/${e}/`,blocks:[e],blockers:[e]});return c.catch(()=>{this.dispatch(pt(n))}),c}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get geo images",method:l.GET,url:"/geo-images/",queryParams:{project:e},blocks:[e],blockers:[]},i);return this.dispatch(Wo(a)),a}}class Jb extends R{add(e){var u;const{store:i}=this.client,a=new Date().toISOString(),n=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,c=b({...e,submitted_at:a,created_by:n});this.dispatch(Oa(c));const r=this.enqueueRequest({description:"Add issue association",method:l.POST,url:"/issue-associations/",payload:v(c),blockers:[e.associated_issue,...e.issue?[e.issue]:[],...e.asset?[e.asset]:[]],blocks:[c.uuid]});return r.then(m=>{this.dispatch(il(m))}).catch(()=>{this.dispatch(Ra(c.uuid))}),[c,r]}async delete(e){const{store:i}=this.client,a=al(e)(i.getState());if(!a)throw new Error(`Issue association with uuid ${e} not found in store.`);this.dispatch(Ra(e));const n=this.enqueueRequest({description:"Delete issue association",method:l.DELETE,url:`/issue-associations/${e}/`,blockers:[e],blocks:[]});return n.catch(()=>{this.dispatch(Oa(a))}),n}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Fetch issue associations",method:l.GET,url:"/issue-associations/",queryParams:{limit:E,paginate:!0,associated_issue__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Fetch issue associations",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(sl(n)),n}}class Xb extends He{constructor(){super(...arguments);S(this,"name","Issue Attachment");S(this,"url","/issue-attachments");S(this,"initializeAttachments",Ma);S(this,"addAttachments",Ea);S(this,"updateAttachments",ll);S(this,"removeAttachments",Va);S(this,"removeAttachment",hl);S(this,"setAttachment",ol);S(this,"selectAttachment",fl)}buildOfflineAttachment(i){return b({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,issue:i.modelUuid})}buildAttachmentPayload(i){return{...i,issue:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.issueUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const c=(await this.performPagination({immediate:!0,description:"Get issue attachments",method:l.GET,url:`${this.url}/`,queryParams:{limit:E,paginate:!0,issue__project:i},blocks:[],blockers:[]},r=>({immediate:!0,description:"Get issue attachments",method:l.GET,url:r,blockers:[],blocks:[]}),a)).flat();return this.dispatch(Ma(c)),c}}class Qb extends He{constructor(){super(...arguments);S(this,"name","Issue Comment Attachment");S(this,"url","/issue-comment-attachments");S(this,"initializeAttachments",qa);S(this,"addAttachments",Il);S(this,"updateAttachments",gl);S(this,"removeAttachments",Fl);S(this,"removeAttachment",bl);S(this,"setAttachment",Tl);S(this,"selectAttachment",_l)}buildOfflineAttachment(i){return b({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,issue_comment:i.modelUuid})}buildAttachmentPayload(i){return{...i,issue_comment:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.issueCommentUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const c=(await this.performPagination({immediate:!0,description:"Get issue comment attachments",method:l.GET,url:`${this.url}/`,queryParams:{limit:E,paginate:!0,issue_comment__issue__project:i},blocks:[],blockers:[]},r=>({immediate:!0,description:"Get issue comment attachments",method:l.GET,url:r,blockers:[],blocks:[]}),a)).flat();return this.dispatch(qa(c)),c}}class xb extends R{add(e){var c;const{store:i}=this.client,a=b({...e,author:(c=i.getState().userReducer.currentUser)==null?void 0:c.id,submitted_at:new Date().toISOString()});this.dispatch(Ua(a));const n=this.enqueueRequest({description:"Add issue comment",method:l.POST,url:"/issue-comments/",payload:v(a),blockers:[e.issue],blocks:[a.uuid]});return n.catch(()=>{this.dispatch(Ca(a.uuid))}),[a,n]}update(e){const{store:i}=this.client,a=ka(e.uuid)(i.getState());if(!a)throw new Error(`Comment with uuid ${e.uuid} not found in store`);const n={...a,...e};this.dispatch(Da(n));const c=this.enqueueRequest({description:"Edit issue comment",method:l.PATCH,url:`/issue-comments/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.catch(()=>{this.dispatch(Da(a))}),[n,c]}remove(e){const{store:i}=this.client,a=ka(e)(i.getState());if(!a)throw new Error(`Comment with uuid ${e} not found in store`);this.dispatch(Ca(e));const n=this.enqueueRequest({description:"Delete comment",method:l.DELETE,url:`/issue-comments/${e}/`,blockers:[e],blocks:[]});return n.catch(()=>{this.dispatch(Ua(a))}),n}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get comments",method:l.GET,url:"/issue-comments/",queryParams:{issue__project:e},blockers:[],blocks:[]},i);return this.dispatch(wl(a)),a}}class eF extends R{add(e){var m;const{store:i}=this.client,a=i.getState(),n=new Date().toISOString(),c=(m=a.userReducer.currentUser)==null?void 0:m.id,r=b({...e,submitted_at:n,created_by:c});this.dispatch(Ga(r));const u=this.enqueueRequest({description:"Create issue",method:l.POST,url:"/issues/",payload:v(r),blockers:[r.project,r.issue_type,...r.category?[r.category]:[]],blocks:[r.uuid]});return u.then(o=>{this.dispatch(Ht(o))}).catch(o=>{throw this.dispatch($a(r.uuid)),o}),[r,u]}update(e){var m;const i=this.client.store.getState(),a=Ha(e.uuid)(i);if(!a)throw new Error(`Attempting to update an issue with uuid ${e.uuid} that doesn't exist in the store`);const n={...a,...e};this.dispatch(Ht(n));const c={};for(const o of[V.TITLE,V.DESCRIPTION,V.STATUS,V.CATEGORY,V.PRIORITY,V.ASSIGNED_TO,V.DUE_DATE])if(o in e&&e[o]!==a[o])switch(o){case V.PRIORITY:case V.STATUS:{const h=e[o];c[o]=h!==void 0?Number(h):null;break}case V.DUE_DATE:case V.DESCRIPTION:case V.TITLE:c[o]=e[o]??null;break;case V.CATEGORY:{let h=null;const p=e[o];if(p&&(h=i.categoryReducer.instances[p]??null,!h))throw new Error(`Trying to update issue category to ${p} which does not exist in store`);c[o]=h?{name:h.name,color:h.color,uuid:h.uuid}:null;break}case V.ASSIGNED_TO:{let h=null;const p=e[o];if(p&&(h=i.userReducer.instances[p]??null,!h))throw new Error(`Trying to update issue assigned_to to ${p} which does not exist in store`);c[o]=h?{full_name:h.username,id:h.id}:null;break}}const r=b({created_by:(m=i.userReducer.currentUser)==null?void 0:m.id,submitted_at:new Date().toISOString(),issue:a.uuid,changes:c});this.dispatch(Dh(r));const u=this.enqueueRequest({description:"Edit issue",method:l.PATCH,url:`/issues/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.catch(()=>{this.dispatch(Ht(a)),this.dispatch(kh(r.uuid))}),[n,u]}async remove(e){const{store:i}=this.client,a=i.getState(),n=Ha(e)(a);if(!n)throw new Error(`No issue with uuid ${e} found in the store`);const c=Al(e)(a),r=Lh(e)(a),u=$o(e)(a),m={};for(const h of nl(e)(a))m[h.uuid]=h;for(const h of cl(e)(a))m[h.uuid]=h;const o=Object.values(m);this.dispatch($a(e)),c.length>0&&this.dispatch(Va(c.map(({uuid:h})=>h))),r.length>0&&this.dispatch(Bh(r.map(({uuid:h})=>h))),u.length>0&&this.dispatch(Nt(u.map(({uuid:h})=>h))),o.length>0&&this.dispatch(va(o.map(({uuid:h})=>h)));try{return await this.enqueueRequest({description:"Delete issue",method:l.DELETE,url:`/issues/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(Ga(n)),this.dispatch(Ea(c)),this.dispatch(Ch(r)),this.dispatch(Lt(u)),this.dispatch(_a(o)),h}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get issues",method:l.GET,url:"/issues/",queryParams:{limit:E,paginate:!0,project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get issues",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(jl(n)),n}}class tF extends He{constructor(){super(...arguments);S(this,"name","Issue Type Attachment");S(this,"url","/issue-type-attachments");S(this,"initializeAttachments",Ya);S(this,"addAttachments",kl);S(this,"updateAttachments",Gl);S(this,"removeAttachments",Ll);S(this,"removeAttachment",$l);S(this,"setAttachment",Bl);S(this,"selectAttachment",Wl)}buildOfflineAttachment(i){return b({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,issue_type:i.modelUuid})}buildAttachmentPayload(i){return{...i,issue_type:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.issueTypeUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const n=await this.enqueueRequest({immediate:!0,description:"Get issue type attachments",method:l.GET,url:`${this.url}/`,queryParams:{issue_type__organization:i},blocks:[],blockers:[]},a);return this.dispatch(Ya(n)),n}}class sF extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const o of e){const{fieldsRevisionUuid:h,fieldIdentifier:p,file:A}=o,f=await this.getFilePayload(A);f.sha1 in n||(n[f.sha1]=f);const T=b({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:f.sha1,created_by:a,fields_revision:h,submitted_at:i,field_identifier:p});c.push(T);const F={uuid:T.uuid,file_name:A.name,file_extension:f.extension,field_identifier:p,file_sha1:f.sha1,fields_revision:h};r.push(F)}this.dispatch(Jl(c));const u=this.enqueueRequest({description:"Add issue type fields attachments",method:l.POST,url:"/issue-type-fields-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(o=>o.fields_revision),blocks:c.map(o=>o.uuid)});return u.then(o=>{this.processPresignedUrls(o.presigned_urls),this.dispatch(Xl(o.attachments))}).catch(()=>{this.dispatch(Ql(c.map(o=>o.uuid)))}),[c,u.then(({attachments:o})=>o)]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"get issue type fields attachments",method:l.GET,url:"/issue-type-fields-attachments/",queryParams:{fields_revision__issue_type__organization:e},blockers:[e],blocks:[]},i);return this.dispatch(Zl(a)),a}}class iF extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(dh(c));const r=this.enqueueRequest({description:"Add Issue Type Fields",method:l.POST,url:"/issue-type-fields/",payload:v(c),blockers:[c.issue_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(uh(m))}).catch(m=>{throw this.dispatch(oh(c.uuid)),m}),[c,r]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get Issue Type Fields",method:l.GET,url:"/issue-type-fields/",queryParams:{issue_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(rh(a)),a}}class aF extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const o of e){const{fieldValuesUuid:h,fieldIdentifier:p,file:A}=o,f=await this.getFilePayload(A);f.sha1 in n||(n[f.sha1]=f);const T=b({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:f.sha1,created_by:a,field_values:h,submitted_at:i,field_identifier:p});c.push(T);const F={uuid:T.uuid,file_name:A.name,file_sha1:f.sha1,file_extension:f.extension,field_identifier:p,field_values:h};r.push(F)}this.dispatch(Yt(c));const u=this.enqueueRequest({description:"Add issue type field values attachments",method:l.POST,url:"/issue-type-field-values-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(o=>o.field_values),blocks:c.map(o=>o.uuid)});return u.then(({presigned_urls:o,attachments:h})=>{this.processPresignedUrls(o),this.dispatch(Ah(h))}).catch(o=>{throw this.dispatch(Kt(c.map(h=>h.uuid))),o}),[c,u.then(({attachments:o})=>o)]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),n=yh(e)(a);this.dispatch(Kt(e));try{await this.enqueueRequest({description:"Delete issue type field values attachments",method:l.DELETE,url:"/issue-type-field-values-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(Yt(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get issue type field values attachments",method:l.GET,url:"/issue-type-field-values-attachments/",queryParams:{limit:E,paginate:!0,field_values__issue__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get issue type field values attachments",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(ph(n)),n}}class nF extends R{add(e){var r;const{store:i}=this.client,a=i.getState(),n=b({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),c=this.enqueueRequest({description:"Add issue type field values",method:l.POST,url:"/issue-type-field-values/",payload:v(n),blockers:[e.issue,e.fields_revision],blocks:[n.uuid]});return this.dispatch(Ja(n)),c.then(u=>(this.dispatch(ft(u)),u)).catch(()=>{this.dispatch(Xa(n.uuid))}),[n,c]}update(e){const{store:i}=this.client,a=i.getState(),n=xa(e.uuid)(a);if(!n)throw new Error(`Expected IssueTypeFieldValues with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(ft(c));const r=this.enqueueRequest({description:"Update issue type field values",method:l.PATCH,url:`/issue-type-field-values/${e.uuid}/`,payload:e,blockers:[c.uuid,c.fields_revision,c.issue],blocks:[c.uuid]});return r.then(u=>{this.dispatch(ft(u))}).catch(()=>{this.dispatch(ft(n))}),[c,r]}async delete(e){const{store:i}=this.client,a=i.getState(),n=xa(e)(a);if(!n)throw new Error(`Expected submission with uuid ${e} to exist`);const c=Sh(e)(a);this.dispatch(Xa(e)),this.dispatch(Kt(c.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete issue type field values",method:l.DELETE,url:`/issue-type-field-values/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(Ja(n)),this.dispatch(Yt(c)),r}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get issue type field values",method:l.GET,url:"/issue-type-field-values/",queryParams:{limit:E,paginate:!0,issue__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get issue type field values",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(ih(n)),n}}class cF extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(nn(c));const r=this.enqueueRequest({description:"Create issue type identifier",method:l.POST,url:"/issue-type-identifiers/",payload:v(c),blockers:[c.issue_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(yt(m))}).catch(()=>{this.dispatch(cn(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=rn(e.uuid)(i.getState());if(!a)throw new Error(`Expected issue type identifier with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(yt(n));const c=this.enqueueRequest({description:"Update issue type identifier",method:l.PATCH,url:`/issue-type-identifiers/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(yt(r))}).catch(()=>{this.dispatch(yt(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=rn(e)(a);if(!n)throw new Error(`Expected issue type identifier with uuid ${e} to exist`);this.dispatch(cn(e));try{return await this.enqueueRequest({description:"Delete issue type identifier",method:l.DELETE,url:`/issue-type-identifiers/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(nn(n)),c}}async refreshStore(e,i){const a=await this.enqueueRequest({description:"Get issue type identifiers",method:l.GET,url:"/issue-type-identifiers/",queryParams:{issue_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(gh(a)),a}}class rF extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(un(c));const r=this.enqueueRequest({description:"Create issue type identifier value",method:l.POST,url:"/issue-type-identifier-values/",payload:v(c),blockers:[e.issue,e.issue_type_identifier],blocks:[c.uuid]});return r.then(m=>{this.dispatch(St(m))}).catch(()=>{this.dispatch(on(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=hn(e.uuid)(i.getState());if(!a)throw new Error(`Expected issue type identifier value with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(St(n));const c=this.enqueueRequest({description:"Update issue type identifier value",method:l.PATCH,url:`/issue-type-identifier-values/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(St(r))}).catch(()=>{this.dispatch(St(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=hn(e)(a);if(!n)throw new Error(`Expected issue type identifier value with uuid ${e} to exist`);this.dispatch(on(e));try{return await this.enqueueRequest({description:"Delete issue type identifier value",method:l.DELETE,url:`/issue-type-identifier-values/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(un(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get issue type identifier values",method:l.GET,url:"/issue-type-identifier-values/",queryParams:{limit:E,paginate:!0,issue__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get issue type identifier values",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(_h(n)),n}}class dF extends R{add(e){var r;const{store:i}=this.client,a=i.getState(),n=b({...e,submitted_at:new Date().toISOString(),created_by:(r=a.userReducer.currentUser)==null?void 0:r.id});this.dispatch(Eh(n));const c=this.enqueueRequest({method:l.POST,url:"/issue-types/",payload:v(n),blockers:[],blocks:[n.uuid]});return c.then(u=>{this.dispatch(It(u))}).catch(()=>{this.dispatch(pn(n.uuid))}),[n,c]}update(e){const{store:i}=this.client,a=i.getState(),n=fn(e.uuid)(a);if(!n)throw new Error(`IssueType with uuid ${e.uuid} does not exist in the store.`);const c={...n,...e};this.dispatch(Vh(c));const r=this.enqueueRequest({method:l.PATCH,url:`/issue-types/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(It(u))}).catch(()=>{this.dispatch(It(n))}),[c,r]}delete(e){const{store:i}=this.client,a=i.getState(),n=fn(e)(a);if(!n)throw new Error(`IssueType with uuid ${e} does not exist in the store.`);const c=Ul(e)(a);this.dispatch(pn(e)),this.dispatch(zl(c.map(u=>u.uuid)));const r=this.enqueueRequest({method:l.DELETE,url:`/issue-types/${e}/`,blockers:[e],blocks:[]});return r.catch(()=>{this.dispatch(It(n)),this.dispatch(ql(c))}),r}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,method:l.GET,url:"/issue-types/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(Mh(a)),a}}class uF extends R{async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get issue updates",method:l.GET,url:"/issue-updates/",queryParams:{limit:E,paginate:!0,issue__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get issue updates",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Uh(n)),n}}const oF=1800;function lF(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 hF extends rb{constructor(){super(...arguments);S(this,"_getRenewedTokens",async i=>{const a=this.enqueueRequest({description:"Get renewed tokens",method:l.POST,url:this.refreshTokensUrl,payload:{refresh:i},isAuthNeeded:!1,blockers:[],blocks:[],checkAuth:!1,immediate:!0});let n;try{n=await a}catch(c){console.error("Could not renew tokens; clearing auth",c),this.clearAuth();return}if(!n.access)throw new Error("Missing access token");return{accessToken:n.access,refreshToken:n.refresh??this.getRefreshToken()}})}clearAuth(){console.debug(this.constructor.name,"clearing auth;"),this.dispatch(Iu(!1)),this.clearTokens(),this.dispatch(g()),this.dispatch(g())}async renewTokens(){const i=this.getRefreshToken();if(!i)throw new Error("No refresh token found");console.debug(this.constructor.name,"renewing tokens");try{const a=await this._getRenewedTokens(i);if(!a)return;console.log("Got renewed tokens"),this.setTokens(a)}catch(a){throw console.error("Could not renew tokens; clearing auth",a),this.clearAuth(),a}}tokenIsExpiringSoon(){const i=this.getAccessToken();if(!i)return!1;const a=Date.now()/1e3;let n;try{n=Up(i).exp??a}catch{n=a}return n-a<oF}getAuthHeader(){return`Bearer ${this.getAccessToken()}`}async prepareAuth(){if(this.tokenIsExpiringSoon()){console.debug(this.constructor.name,"preparing auth");try{await this.renewTokens()}catch(i){return i instanceof D&&this.clearAuth(),i instanceof Error?Promise.reject(i):Promise.reject(new Error((i??xe).toString()))}}}async handleUnauthorized(i,a){const n=this.client.store.getState();if(i.url.endsWith("/token/refresh/"))throw n.authReducer.isLoggedIn&&console.warn("No signed-in user to sign out."),this.clearAuth(),new D({message:"You have been signed out due to inactivity.",response:a,discard:!0});if(n.authReducer.isLoggedIn)await this.renewTokens();else throw console.debug("Forbidden; user is not logged in."),new D({message:"Incorrect username or password.",response:a,discard:!0})}async initAuth(i){const a=Je.v4();return console.debug(this.constructor.name,"Initiating auth"),this.enqueueRequest({uuid:a,description:"Get token pair",method:l.POST,url:this.initTokensUrl,payload:i,isAuthNeeded:!1,checkAuth:!1,immediate:!0,blockers:[],blocks:[]}).then(n=>{this.setTokens(lF(n))})}}class mF extends R{update(e){const{store:i}=this.client,a=bn(e.uuid)(i.getState()),n={...a,...e};this.dispatch(Jt(n));const c=this.enqueueRequest({description:"Edit organization access",method:l.PATCH,url:`/organization-accesses/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(Jt(r))}).catch(r=>{throw this.dispatch(Jt(a)),r}),[n,c]}async remove(e){const{store:i}=this.client,a=i.getState(),n=bn(e)(a),c=Xh(n.user)(a);this.dispatch(tm(n.uuid)),this.dispatch(Kh(n.user));try{await this.enqueueRequest({description:"Remove organization access",method:l.DELETE,url:`/organization-accesses/${n.uuid}/`,blockers:[n.uuid],blocks:[]})}catch(r){throw this.dispatch(em(n)),this.dispatch(Yh(c)),r}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get organization accesses",method:l.GET,url:"/organization-accesses/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(xh(a)),a}}class pF extends R{async add(e){const i=await this.enqueueRequest({description:"Create organization",method:l.POST,url:"/organizations/",payload:e,blockers:[],blocks:[]});return this.dispatch(cm(i)),i}async update(e){const i=await this.enqueueRequest({description:"Edit organization",method:l.PATCH,url:`/organizations/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return this.dispatch(rm(i)),i}async invite(e,i){return this.enqueueRequest({description:"Invite user to organization",method:l.POST,url:`/organizations/${e}/invite/${i}/`,blockers:[],blocks:[]})}async refreshStore(e){const i=await this.enqueueRequest({immediate:!0,description:"Fetch organizations",method:l.GET,url:"/organizations/",blockers:[],blocks:[]},e);return this.dispatch(nm(i)),i}}class AF extends R{add(e){var c;const{store:i}=this.client,a=b({...e,created_by:(c=i.getState().userReducer.currentUser)==null?void 0:c.id});this.dispatch(_n(a));const n=this.enqueueRequest({description:"Add project access",method:l.POST,url:"/project-accesses/",payload:v(a),blockers:[a.organization_access,a.project],blocks:[a.uuid]});return n.then(r=>{this.dispatch(Tt(r))}).catch(r=>{throw this.dispatch(vn(a.uuid)),r}),[a,n]}bulkAdd(e){var r;const{store:i}=this.client,a=(r=i.getState().userReducer.currentUser)==null?void 0:r.id,n=e.map(u=>b({...u,created_by:a}));this.dispatch(Rn(n));const c=this.enqueueRequest({description:"Add project accesses",method:l.POST,url:"/project-accesses/bulk/",payload:{project_accesses:n.map(u=>v(u))},blockers:n.flatMap(u=>[u.project,u.organization_access]),blocks:n.map(u=>u.uuid)});return c.then(u=>{this.dispatch(Sm(u))}).catch(u=>{throw this.dispatch(wn(n.map(m=>m.uuid))),u}),[n,c]}update(e){const{store:i}=this.client,a=En(e.uuid)(i.getState()),n={...a,...e};this.dispatch(Tt(n));const c=this.enqueueRequest({description:"Edit project access",method:l.PATCH,url:`/project-accesses/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[]});return c.then(r=>{this.dispatch(Tt(r))}).catch(r=>{throw this.dispatch(Tt(a)),r}),[n,c]}async remove(e){const{store:i}=this.client,a=En(e)(i.getState());this.dispatch(vn(e));try{await this.enqueueRequest({description:"Delete project access",method:l.DELETE,url:`/project-accesses/${e}/`,blockers:[e],blocks:[]})}catch(n){throw this.dispatch(_n(a)),n}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get project accesses",method:l.GET,url:"/project-accesses/",queryParams:{project__organization:e},blockers:[],blocks:[]},i);return this.dispatch(ym(a)),a}}class fF extends He{constructor(){super(...arguments);S(this,"name","Project Attachment");S(this,"url","/project-attachments");S(this,"addAttachments",Fm);S(this,"updateAttachments",_m);S(this,"removeAttachments",jn);S(this,"removeAttachment",Rm);S(this,"setAttachment",Pm);S(this,"selectAttachment",Mm)}buildOfflineAttachment(i){return b({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,project:i.modelUuid})}buildAttachmentPayload(i){return{...i,project:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.projectUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const n=await this.enqueueRequest({immediate:!0,description:"Get project attachments",method:l.GET,url:`${this.url}/`,queryParams:{project__organization:i},blockers:[],blocks:[]},a);return this.dispatch(bm(n)),n}}class yF extends R{async saveExisting(e){if(!e.uuid)throw new Error("You can only use this method to save existing project files. The one provided has no uuid.");const i={...e};delete i.file;const a=this.enqueueRequest({method:l.PATCH,url:`/project-files/${e.uuid}/`,payload:i,blockers:[e.uuid],blocks:[e.uuid]});return a.then(n=>{this.dispatch(zn(n))}),a}saveActive(){const{store:e}=this.client,i=e.getState(),a=i.projectFileReducer.activeProjectFileId;if(!a)throw new Error("No active project file");const n=i.projectFileReducer.instances[a];if(!n)throw new Error("No active project file");if(!n.bounds&&!n.canvas_bounds)throw new Error("Project file must either have bounds or canvas_bounds set");let c;if(typeof n.file=="string"&&!n.file.startsWith("blob:")){const m={...n};delete m.file,c={method:l.PATCH,url:`/project-files/${a}/`,payload:m,blockers:[a],blocks:[a]}}else c=new Promise((m,o)=>{this.client.files.uploadFileToS3(n.file_sha1).then(([h])=>{m({method:l.POST,url:"/project-files/",payload:{...n,...h},blockers:[a],blocks:[a]})}).catch(o)});const u=Promise.resolve(c).then(m=>this.enqueueRequest(m));return u.then(m=>{this.dispatch(zn(m))}),this.dispatch(Bm),this.dispatch(km(null)),this.dispatch(Cm(!1)),[n,u]}delete(e){return this.dispatch(Um(e)),this.enqueueRequest({method:l.DELETE,url:`/project-files/${e}`,blockers:[e],blocks:[]})}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get project files",method:l.GET,url:"/project-files/",queryParams:{limit:E,paginate:!0,project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get project files",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(qm(n)),n}}class SF extends R{async add(e){const i=await this.enqueueRequest({description:"Create project",method:l.POST,url:"/projects/",payload:v(e),blockers:[],blocks:[]});return this.dispatch(Dn(i)),i}async update(e){if(!e.bounds&&!e.canvas_bounds)throw new Error("Project must either have bounds or canvas_bounds set");return this.dispatch(Wm(e)),await this.enqueueRequest({description:"Update project",method:l.PATCH,url:`/projects/${e.uuid}/`,payload:{name:e.name,bounds:e.bounds},blockers:[e.uuid],blocks:[e.uuid]})}async delete(e){const{store:i}=this.client,a=i.getState(),n=Zm(e)(a);if(!n)throw new Error("Expected project to exist");const c=$m(a).filter(m=>m.project===e);this.dispatch(Dm(c.map(({uuid:m})=>m)));const r=Em(n.uuid)(a);this.dispatch(jn(r.map(({uuid:m})=>m)));const u=Tm(e)(a);this.dispatch(wn(u.map(({uuid:m})=>m))),this.dispatch(Cn(n.uuid));try{await this.enqueueRequest({description:"Delete project",method:l.DELETE,url:`/projects/${e}/`,blockers:[e],blocks:[]}),this.dispatch(Cn(n.uuid))}catch(m){throw this.dispatch(Dn(n)),this.dispatch(Rn(Object.values(u))),this.dispatch(zm(c)),this.dispatch(Om(r)),m}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch projects",method:l.GET,url:"/projects/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(Hm(a)),a}}class IF extends R{add(e){var c;const{store:i}=this.client,a=b({...e,created_by:(c=i.getState().userReducer.currentUser)==null?void 0:c.id});this.dispatch(xm(a));const n=this.enqueueRequest({description:"Create team membership",method:l.POST,url:"/team-memberships/",payload:v(a),blockers:[e.team],blocks:[a.uuid]});return n.then(r=>{this.dispatch($n(r))}).catch(()=>{this.dispatch(Ln(a.uuid))}),[a,n]}bulkAdd(e){var r;const{store:i}=this.client,a=(r=i.getState().userReducer.currentUser)==null?void 0:r.id,n=e.map(u=>b({...u,created_by:a}));this.dispatch(ep(n));const c=this.enqueueRequest({description:"Create team memberships",method:l.POST,url:"/team-memberships/bulk/",payload:{team_memberships:n.map(u=>v(u))},blockers:n.map(u=>u.team),blocks:n.map(u=>u.uuid)});return c.then(u=>{this.dispatch(tp(u))}).catch(()=>{this.dispatch(sp(n.map(u=>u.uuid)))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=np(e)(a);if(!n)throw new Error(`Expected team membership with uuid ${e} to exist`);this.dispatch(Ln(e));try{return await this.enqueueRequest({description:"Delete team membership",method:l.DELETE,url:`/team-memberships/${e}/`,blockers:[e],blocks:[e]})}catch(c){throw this.dispatch($n(n)),c}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch team memberships",method:l.GET,url:"/team-memberships/",queryParams:{team__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Qm(a)),a}}class TF extends R{add(e){var c;const{store:i}=this.client,a=b({...e,submitted_at:new Date().toISOString(),created_by:(c=i.getState().userReducer.currentUser)==null?void 0:c.id});this.dispatch(dp(a));const n=this.enqueueRequest({description:"Create team",method:l.POST,url:"/teams/",payload:v(a),blockers:[],blocks:[a.uuid]});return n.then(r=>{this.dispatch(gt(r))}).catch(()=>{this.dispatch(Wn(a.uuid))}),[a,n]}update(e){const{store:i}=this.client,a=Kn(e.uuid)(i.getState());if(!a)throw new Error(`Expected team with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(up(n));const c=this.enqueueRequest({description:"Update team",method:l.PATCH,url:`/teams/${e.uuid}/`,payload:v(e),blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(gt(r))}).catch(()=>{this.dispatch(gt(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Kn(e)(a);if(!n)throw new Error(`Expected team with uuid ${e} to exist`);this.dispatch(Wn(e));try{return await this.enqueueRequest({description:"Delete team",method:l.DELETE,url:`/teams/${e}/`,blockers:[e],blocks:[e]})}catch(c){throw this.dispatch(gt(n)),c}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch teams",method:l.GET,url:"/teams/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(rp(a)),a}}class gF extends R{async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch organization users",method:l.GET,url:`/organizations/${e}/users/`,blockers:[],blocks:[]},i);return this.dispatch(Wh(a)),a}}class bF{constructor(e){S(this,"store");this.store=e}async enqueueRequest(e,i,a,n){return this._enqueueRequest(e,i,a,n).then(c=>{if(c instanceof D)throw c;return c})}_enqueueRequest(e,i,a,n){const c=new dc,r={...e,BASE_URL:i,serviceName:a};if(e.immediate){const u={...r,uuid:e.uuid??Je.v4()},m={payload:u,type:"",meta:{offline:{effect:{timestamp:new Date().toISOString(),request:u,BASE_URL:i,serviceName:a}}}};Xn(m,this,n).then(o=>{c.resolve(o.body)}).catch(o=>{Qn(o,m),o instanceof Error?c.reject(o):c.reject(new Error((o??xe).toString()))})}else{const u=this.store.dispatch(hm(r)),m=h=>{if(h)c.resolve(h.body);else{const p=new D({message:"Could not get a response from the server.",response:h,discard:!0});c.reject(p)}},o=h=>{h instanceof D?h.options.discard=!0:(console.error("Received an unexpected error while processing a request:",h,`
|
|
15
|
-
Converting error to APIError and discarding.`),h=new D({message:"An error occurred while processing the request.",innerError:h,discard:!0})),c.reject(h)};u.then(m,o)}return c}}class et{constructor(){S(this,"graph");S(this,"requestAttemptCounter");this.graph=new Dp.DepGraph,this.requestAttemptCounter={}}static _fromOutbox(e){const i=new et;for(let a=0;a<e.length;a++){const n=e[a];if(!n){console.error("Outbox item was undefined");continue}i.sneakRequest(n);for(let c=0;c<a;c++){const r=e[c];if(!r){console.error("Previous outbox item was undefined");continue}r.payload.uuid!==n.payload.uuid&&r.payload.blocks.some(u=>n.payload.blockers.includes(u))&&et._addDependency(n.payload.uuid,r.payload.uuid,i.graph)}}return i}_addDependency(e,i){et._addDependency(e,i,this.graph)}static _addDependency(e,i,a){if(e===i)throw new Error(`Tried to add dependency from node to itself: ${e}`);if(!a.hasNode(e))throw new Error(`Tried to add dependency from non-existent node: ${e} (to node: ${i})`);if(!a.hasNode(i))throw new Error(`Tried to add dependency to non-existent node: ${i} (from node: ${e})`);a.addDependency(e,i)}addRequest(e){if(this.graph.addNode(e.payload.uuid,e),!(e.payload.blockers.length===0||this.graph.size()===1))for(const i of this.graph.overallOrder()){if(i===e.payload.uuid)continue;const a=this.graph.getNodeData(i);e.payload.blockers.some(n=>a.payload.blocks.includes(n))&&this._addDependency(e.payload.uuid,i)}}insertRequest(e){this.graph.addNode(e.payload.uuid,e);for(const i of this.graph.overallOrder()){if(i===e.payload.uuid)continue;this.graph.getNodeData(i).payload.blockers.some(n=>e.payload.blocks.includes(n))&&this._addDependency(i,e.payload.uuid)}}sneakRequest(e){this.graph.addNode(e.payload.uuid,e)}_getNextNode(){const e=this.graph.overallOrder(!0);let i=1/0,a;for(const n of e){const c=this.requestAttemptCounter[n]||0;c<i&&(i=c,a=n)}return a}peek(){const e=this._getNextNode();if(e)return this.graph.getNodeData(e)}remove(e){this.graph.removeNode(e),delete this.requestAttemptCounter[e]}pop(){const e=this.peek();return e&&this.graph.removeNode(e.payload.uuid),e}getQueue(){const e=this.graph.overallOrder().map(a=>this.graph.getNodeData(a)),i=this._getNextNode();if(i){const a=this.graph.getNodeData(i),n=e.findIndex(c=>c.payload.uuid===a.payload.uuid);n!==-1&&(e.splice(n,1),e.unshift(a))}return e}getReady(){let e=this.graph.overallOrder(!0).map(i=>this.graph.getNodeData(i));return e=e.sort((i,a)=>i.meta.offline.effect.timestamp.localeCompare(a.meta.offline.effect.timestamp)),e=e.sort((i,a)=>{const n=this.requestAttemptCounter[i.payload.uuid]||0,c=this.requestAttemptCounter[a.payload.uuid]||0;return n-c}),e}registerRetry(e){this.requestAttemptCounter[e]=(this.requestAttemptCounter[e]||0)+1}}const FF=(t,e)=>{const i=new e(t);return Gg(i),Bg(t),i};var vp=(t=>(t[t.USER_REGISTRATION=0]="USER_REGISTRATION",t[t.APPLICATION_INVITE=2]="APPLICATION_INVITE",t[t.PROJECT_INVITE=4]="PROJECT_INVITE",t[t.ORGANIZATION_INVITE=6]="ORGANIZATION_INVITE",t[t.ADD_EMAIL_DOMAIN=8]="ADD_EMAIL_DOMAIN",t[t.RESET_PASSWORD=10]="RESET_PASSWORD",t))(vp||{});s.APIError=D,s.AgentService=db,s.AssetAttachmentService=lb,s.AssetProcedureAttachmentService=hb,s.AssetProcedureFieldValuesAttachmentService=Ab,s.AssetProcedureFieldValuesService=fb,s.AssetProcedureFieldsAttachmentService=mb,s.AssetProcedureFieldsService=pb,s.AssetProcedureInstanceService=yb,s.AssetProcedureService=Sb,s.AssetProcedureStepFieldValuesAttachmentService=gb,s.AssetProcedureStepFieldValuesService=bb,s.AssetProcedureStepFieldsAttachmentService=Ib,s.AssetProcedureStepFieldsService=Tb,s.AssetProcedureStepService=Fb,s.AssetService=Pb,s.AssetStageCompletionService=Ob,s.AssetStageService=_b,s.AssetTypeAttachmentService=Rb,s.AssetTypeFieldValuesAttachmentService=Mb,s.AssetTypeFieldValuesService=Eb,s.AssetTypeFieldsAttachmentService=vb,s.AssetTypeFieldsService=wb,s.AssetTypeIdentifierService=Vb,s.AssetTypeIdentifierValueService=jb,s.AssetTypeService=qb,s.AttachmentModel=cc,s.BaseApiService=R,s.BaseSDK=bF,s.COMMON_AUTO_FIELDS=mc,s.CategoryService=zb,s.DEFAULT_ISSUE_PRIORITY=kp,s.DEFAULT_ISSUE_STATUS=Cp,s.DEFAULT_PAGINATION_PAGE_SIZE=E,s.DeferredPromise=dc,s.DocumentAttachmentService=Ub,s.DocumentService=Db,s.EMPTY_ARRAY=ic,s.EMPTY_OBJECT=ac,s.EmailDomainsService=Cb,s.EmailVerificationService=kb,s.FileService=Gb,s.FormIdentifierService=$b,s.FormIdentifierValueService=Lb,s.FormRevisionAttachmentService=Nb,s.FormRevisionService=Hb,s.FormService=Wb,s.FormSubmissionAttachmentService=Yb,s.FormSubmissionService=Kb,s.GeoImageService=Zb,s.HttpMethod=l,s.IssueAssociationService=Jb,s.IssueAttachmentService=Xb,s.IssueCommentAttachmentService=Qb,s.IssueCommentService=xb,s.IssuePriority=es,s.IssueService=eF,s.IssueStatus=ts,s.IssueTypeAttachmentService=tF,s.IssueTypeFieldValuesAttachmentService=aF,s.IssueTypeFieldValuesService=nF,s.IssueTypeFieldsAttachmentService=sF,s.IssueTypeFieldsService=iF,s.IssueTypeIdentifierService=cF,s.IssueTypeIdentifierValueService=rF,s.IssueTypeService=dF,s.IssueUpdateChange=V,s.IssueUpdateService=uF,s.JWTService=hF,s.OUTBOX_RETRY_DELAY=rc,s.OrganizationAccessLevel=nc,s.OrganizationAccessService=mF,s.OrganizationService=pF,s.OutboxCoordinator=et,s.PAGINATION_MAX_PAGE_SIZE=ub,s.PAGINATION_PAGE_SIZE_QUERY_PARAM=ob,s.ProjectAccessService=AF,s.ProjectAttachmentService=fF,s.ProjectFileService=yF,s.ProjectService=SF,s.RESET_ORGANIZATION_STATE=O,s.RESET_PROJECT_STATE=M,s.RESET_STATE=g,s.SelectorBuilder=kg,s.TeamMembershipService=IF,s.TeamService=TF,s.UNKNOWN_ERROR_MESSAGE=xe,s.UserService=gF,s.VERSION_REDUCER_KEY=tt,s.VerificationCodeType=vp,s._setLatestRetryTime=pm,s.addAsset=Xs,s.addAssetAttachment=mA,s.addAssetAttachments=os,s.addAssetProcedure=Ms,s.addAssetProcedureAttachment=fA,s.addAssetProcedureAttachments=jc,s.addAssetProcedureFieldValues=Is,s.addAssetProcedureFieldValuesAttachment=zA,s.addAssetProcedureFieldValuesAttachments=Ot,s.addAssetProcedureFieldValuesMany=hr,s.addAssetProcedureFields=Qc,s.addAssetProcedureFieldsAttachment=TA,s.addAssetProcedureFieldsAttachments=Nc,s.addAssetProcedureFieldsMany=RA,s.addAssetProcedureInstance=Ps,s.addAssetProcedureInstances=Ir,s.addAssetProcedureStep=Ys,s.addAssetProcedureStepFieldValues=Ls,s.addAssetProcedureStepFieldValuesAttachment=Tf,s.addAssetProcedureStepFieldValuesAttachments=Rt,s.addAssetProcedureStepFieldValuesMany=Yr,s.addAssetProcedureStepFields=Us,s.addAssetProcedureStepFieldsAttachment=af,s.addAssetProcedureStepFieldsAttachments=wr,s.addAssetProcedureStepFieldsMany=lf,s.addAssetProcedureSteps=Vf,s.addAssetProcedures=JA,s.addAssetStage=oi,s.addAssetStageCompletion=ai,s.addAssetStageCompletions=ni,s.addAssetStages=Wf,s.addAssetType=zi,s.addAssetTypeAttachment=Qf,s.addAssetTypeAttachments=pi,s.addAssetTypeFieldValues=gi,s.addAssetTypeFieldValuesAttachment=fy,s.addAssetTypeFieldValuesAttachments=Ut,s.addAssetTypeFieldValuesMany=eu,s.addAssetTypeFields=Bd,s.addAssetTypeFieldsAttachment=ty,s.addAssetTypeFieldsAttachments=Vd,s.addAssetTypeFieldsMany=dy,s.addAssetTypeIdentifier=_i,s.addAssetTypeIdentifierValue=Mi,s.addAssetTypeIdentifierValues=Vy,s.addAssetTypeIdentifiers=_y,s.addAssetTypes=Gy,s.addAssets=Vt,s.addCategories=Jy,s.addCategory=Bi,s.addConversation=Sc,s.addConversations=cA,s.addDocumentAttachment=iS,s.addDocumentAttachments=wu,s.addDocuments=Bu,s.addEmailDomain=Hu,s.addEmailDomains=oS,s.addForm=la,s.addFormIdentifier=Ji,s.addFormIdentifierValue=ea,s.addFormIdentifierValues=PS,s.addFormIdentifiers=SS,s.addFormRevision=ca,s.addFormRevisionAttachment=ES,s.addFormRevisionAttachments=mo,s.addFormRevisions=To,s.addFormSubmission=fa,s.addFormSubmissionAttachment=ZS,s.addFormSubmissionAttachments=Bt,s.addFormSubmissions=Lt,s.addForms=$S,s.addGeoImage=Ko,s.addGeoImages=Zo,s.addIssue=Ga,s.addIssueAssociation=Oa,s.addIssueAssociations=_a,s.addIssueAttachment=dI,s.addIssueAttachments=Ea,s.addIssueComment=Ua,s.addIssueCommentAttachment=lI,s.addIssueCommentAttachments=Il,s.addIssueComments=fI,s.addIssueType=Eh,s.addIssueTypeAttachment=_I,s.addIssueTypeAttachments=kl,s.addIssueTypeFieldValues=Ja,s.addIssueTypeFieldValuesAttachment=QI,s.addIssueTypeFieldValuesAttachments=Yt,s.addIssueTypeFieldValuesMany=DI,s.addIssueTypeFields=dh,s.addIssueTypeFieldsAttachment=MI,s.addIssueTypeFieldsAttachments=Jl,s.addIssueTypeFieldsMany=LI,s.addIssueTypeIdentifier=nn,s.addIssueTypeIdentifierValue=un,s.addIssueTypeIdentifierValues=oT,s.addIssueTypeIdentifiers=aT,s.addIssueTypes=yT,s.addIssueUpdate=Dh,s.addIssueUpdates=Ch,s.addIssues=ql,s.addOrganization=cm,s.addOrganizationAccess=em,s.addOrganizationAccesses=DT,s.addOrganizations=WT,s.addProject=Dn,s.addProjectAccess=_n,s.addProjectAccesses=Rn,s.addProjectAttachment=ng,s.addProjectAttachments=Fm,s.addProjectFile=ug,s.addProjectFiles=zm,s.addProjects=yg,s.addTeam=dp,s.addTeamMembership=xm,s.addTeamMemberships=ep,s.addTeams=wg,s.addUser=Yh,s.addUsers=MT,s.agentsReducer=gc,s.agentsSlice=cs,s.areArraysEqual=$p,s.assetAttachmentReducer=Mc,s.assetAttachmentSlice=ds,s.assetProcedureAttachmentReducer=Cc,s.assetProcedureAttachmentSlice=hs,s.assetProcedureFieldValuesAttachmentReducer=ur,s.assetProcedureFieldValuesAttachmentSlice=fs,s.assetProcedureFieldValuesReducer=Ar,s.assetProcedureFieldValuesSlice=Ss,s.assetProcedureFieldsAttachmentReducer=Zc,s.assetProcedureFieldsAttachmentSlice=ms,s.assetProcedureFieldsReducer=sr,s.assetProcedureFieldsSlice=ps,s.assetProcedureInstanceReducer=gr,s.assetProcedureInstanceSlice=Fs,s.assetProcedureReducer=Or,s.assetProcedureSlice=ws,s.assetProcedureStepFieldValuesAttachmentReducer=Nr,s.assetProcedureStepFieldValuesAttachmentSlice=Bs,s.assetProcedureStepFieldValuesReducer=Xr,s.assetProcedureStepFieldValuesSlice=$s,s.assetProcedureStepFieldsAttachmentReducer=qr,s.assetProcedureStepFieldsAttachmentSlice=qs,s.assetProcedureStepFieldsReducer=Dr,s.assetProcedureStepFieldsSlice=zs,s.assetProcedureStepReducer=td,s.assetProcedureStepSlice=Ws,s.assetReducer=rd,s.assetSlice=Js,s.assetStageCompletionReducer=hd,s.assetStageCompletionSlice=ii,s.assetStageReducer=Sd,s.assetStageSlice=ui,s.assetTypeAttachmentReducer=wd,s.assetTypeAttachmentSlice=mi,s.assetTypeFieldValuesAttachmentReducer=Xd,s.assetTypeFieldValuesAttachmentSlice=Si,s.assetTypeFieldValuesReducer=au,s.assetTypeFieldValuesSlice=Ti,s.assetTypeFieldsAttachmentReducer=Dd,s.assetTypeFieldsAttachmentSlice=fi,s.assetTypeFieldsReducer=Nd,s.assetTypeFieldsSlice=yi,s.assetTypeIdentifierReducer=uu,s.assetTypeIdentifierSlice=Oi,s.assetTypeIdentifierValueReducer=mu,s.assetTypeIdentifierValueSlice=wi,s.assetTypeReducer=yu,s.assetTypeSlice=qi,s.authReducer=Tu,s.authSlice=Ct,s.baseReducer=Ug,s.baseReducers=Zn,s.blobToBase64=Xp,s.categoryReducer=_u,s.categorySlice=ki,s.clearTokens=Yy,s.constructUploadedFilePayloads=Jp,s.createModelAdapter=P,s.createOfflineAction=om,s.createPayload=v,s.createSelectionAdapter=Bp,s.deleteAsset=Qs,s.deleteAssetAttachment=Oc,s.deleteAssetAttachments=ls,s.deleteAssetProcedure=Es,s.deleteAssetProcedureAttachment=Uc,s.deleteAssetProcedureAttachments=Dc,s.deleteAssetProcedureFieldValues=Ts,s.deleteAssetProcedureFieldValuesAttachment=kA,s.deleteAssetProcedureFieldValuesAttachments=_t,s.deleteAssetProcedureFieldValuesMany=pr,s.deleteAssetProcedureFields=er,s.deleteAssetProcedureFieldsAttachment=PA,s.deleteAssetProcedureFieldsAttachments=Wc,s.deleteAssetProcedureFieldsMany=EA,s.deleteAssetProcedureInstance=Os,s.deleteAssetProcedureInstances=Tr,s.deleteAssetProcedureStep=Ks,s.deleteAssetProcedureStepFieldValues=Ns,s.deleteAssetProcedureStepFieldValuesAttachment=Pf,s.deleteAssetProcedureStepFieldValuesAttachments=vt,s.deleteAssetProcedureStepFieldValuesMany=Zr,s.deleteAssetProcedureStepFields=Ds,s.deleteAssetProcedureStepFieldsAttachment=df,s.deleteAssetProcedureStepFieldsAttachments=Er,s.deleteAssetProcedureStepFieldsMany=Af,s.deleteAssetProcedureSteps=qf,s.deleteAssetProcedures=QA,s.deleteAssetStage=li,s.deleteAssetStageCompletion=ci,s.deleteAssetStageCompletions=ri,s.deleteAssetStages=Kf,s.deleteAssetType=Ui,s.deleteAssetTypeAttachment=Pd,s.deleteAssetTypeAttachments=Ai,s.deleteAssetTypeFieldValues=bi,s.deleteAssetTypeFieldValuesAttachment=Ty,s.deleteAssetTypeFieldValuesAttachments=Dt,s.deleteAssetTypeFieldValuesMany=su,s.deleteAssetTypeFields=$d,s.deleteAssetTypeFieldsAttachment=ny,s.deleteAssetTypeFieldsAttachments=qd,s.deleteAssetTypeFieldsMany=hy,s.deleteAssetTypeIdentifier=Ri,s.deleteAssetTypeIdentifierValue=Ei,s.deleteAssetTypeIdentifierValues=Uy,s.deleteAssetTypeIdentifiers=My,s.deleteAssetTypes=Ly,s.deleteAssets=xs,s.deleteCategories=eS,s.deleteCategory=Pu,s.deleteConversation=uA,s.deleteConversations=oA,s.deleteDocumentAttachment=Vu,s.deleteDocumentAttachments=ju,s.deleteEmailDomain=Wu,s.deleteEmailDomains=AS,s.deleteForm=ha,s.deleteFormIdentifier=Xi,s.deleteFormIdentifierValue=ta,s.deleteFormIdentifierValues=vS,s.deleteFormIdentifiers=bS,s.deleteFormRevision=ra,s.deleteFormRevisionAttachment=zS,s.deleteFormRevisionAttachments=Ao,s.deleteFormRevisions=bo,s.deleteFormSubmission=ya,s.deleteFormSubmissionAttachment=xS,s.deleteFormSubmissionAttachments=Gt,s.deleteFormSubmissions=Nt,s.deleteForms=YS,s.deleteGeoImage=ba,s.deleteGeoImages=Xo,s.deleteIssue=$a,s.deleteIssueAssociation=Ra,s.deleteIssueAssociations=va,s.deleteIssueAttachment=hl,s.deleteIssueAttachments=Va,s.deleteIssueComment=Ca,s.deleteIssueCommentAttachment=bl,s.deleteIssueCommentAttachments=Fl,s.deleteIssueComments=II,s.deleteIssueType=TT,s.deleteIssueTypeAttachment=$l,s.deleteIssueTypeAttachments=Ll,s.deleteIssueTypeFieldValues=Xa,s.deleteIssueTypeFieldValuesAttachment=sT,s.deleteIssueTypeFieldValuesAttachments=Kt,s.deleteIssueTypeFieldValuesMany=GI,s.deleteIssueTypeFields=oh,s.deleteIssueTypeFieldsAttachment=qI,s.deleteIssueTypeFieldsAttachments=Ql,s.deleteIssueTypeFieldsMany=YI,s.deleteIssueTypeIdentifier=cn,s.deleteIssueTypeIdentifierValue=on,s.deleteIssueTypeIdentifierValues=pT,s.deleteIssueTypeIdentifiers=dT,s.deleteIssueTypes=gT,s.deleteIssueUpdate=kh,s.deleteIssueUpdates=Bh,s.deleteIssues=zl,s.deleteOrganization=KT,s.deleteOrganizationAccess=tm,s.deleteOrganizationAccesses=GT,s.deleteOrganizations=ZT,s.deleteProject=Cn,s.deleteProjectAccess=vn,s.deleteProjectAccesses=wn,s.deleteProjectAttachment=Rm,s.deleteProjectAttachments=jn,s.deleteProjectFile=Um,s.deleteProjectFiles=Dm,s.deleteProjects=Ig,s.deleteTeam=Wn,s.deleteTeamMembership=Ln,s.deleteTeamMemberships=sp,s.deleteTeams=Vg,s.deleteUser=Kh,s.deleteUsers=jT,s.dequeue=Pp,s.discard=Qn,s.documentAttachmentReducer=Du,s.documentAttachmentSlice=Li,s.documentSlice=Ni,s.documentsReducer=$u,s.downloadFile=Qp,s.downloadInMemoryFile=Zp,s.emailDomainsReducer=Zu,s.emailDomainsSlice=Yi,s.emailRegex=nA,s.enqueue=Fp,s.enqueueRequest=hm,s.fallbackToEmptyArray=I,s.fallbackToEmptyObject=Pt,s.fileReducer=eo,s.fileSlice=Ki,s.fileToBlob=lc,s.formIdentifierReducer=no,s.formIdentifierSlice=Zi,s.formIdentifierValueReducer=oo,s.formIdentifierValueSlice=xi,s.formReducer=Ro,s.formRevisionAttachmentReducer=yo,s.formRevisionAttachmentSlice=aa,s.formRevisionReducer=Po,s.formRevisionsSlice=na,s.formSlice=oa,s.formSubmissionAttachmentReducer=Do,s.formSubmissionAttachmentSlice=ma,s.formSubmissionReducer=No,s.formSubmissionSlice=Aa,s.geoImageReducer=el,s.geoImageSlice=ga,s.getFileIdentifier=Kp,s.getFileS3Key=ns,s.getLocalDateString=uc,s.getLocalRelativeDateString=Wp,s.getOutboxCoordinator=Ye,s.getRenamedFile=oc,s.hashFile=Xe,s.initSDK=FF,s.initializeAssetAttachments=us,s.initializeAssetProcedureAttachments=Vc,s.initializeAssetProcedureFieldValues=lr,s.initializeAssetProcedureFieldValuesAttachments=ar,s.initializeAssetProcedureFields=Xc,s.initializeAssetProcedureFieldsAttachments=Lc,s.initializeAssetProcedureInstances=Sr,s.initializeAssetProcedureStepFieldValues=Wr,s.initializeAssetProcedureStepFieldValuesAttachments=kr,s.initializeAssetProcedureStepFields=Ur,s.initializeAssetProcedureStepFieldsAttachments=vr,s.initializeAssetProcedureSteps=xr,s.initializeAssetProcedures=Pr,s.initializeAssetStageCompletions=ud,s.initializeAssetStages=fd,s.initializeAssetTypeAttachments=gd,s.initializeAssetTypeFieldValues=xd,s.initializeAssetTypeFieldValuesAttachments=Wd,s.initializeAssetTypeFields=kd,s.initializeAssetTypeFieldsAttachments=Ed,s.initializeAssetTypeIdentifierValues=lu,s.initializeAssetTypeIdentifiers=cu,s.initializeAssetTypes=Au,s.initializeAssets=ad,s.initializeCategories=bu,s.initializeConversations=yc,s.initializeDocumentAttachments=vu,s.initializeEmailDomains=Nu,s.initializeFormIdentifierValues=ro,s.initializeFormIdentifiers=so,s.initializeFormRevisionAttachments=ho,s.initializeFormRevisions=Io,s.initializeFormSubmissionAttachments=Vo,s.initializeFormSubmissions=ko,s.initializeForms=_o,s.initializeGeoImages=Wo,s.initializeIssueAssociations=sl,s.initializeIssueAttachments=Ma,s.initializeIssueCommentAttachments=qa,s.initializeIssueComments=AI,s.initializeIssueTypeAttachments=Ya,s.initializeIssueTypeFieldValues=ih,s.initializeIssueTypeFieldValuesAttachments=ph,s.initializeIssueTypeFields=rh,s.initializeIssueTypeFieldsAttachments=Zl,s.initializeIssueTypeIdentifierValues=_h,s.initializeIssueTypeIdentifiers=gh,s.initializeIssueTypes=Mh,s.initializeIssueUpdates=Uh,s.initializeIssues=jl,s.initializeOrganizationAccesses=xh,s.initializeOrganizations=nm,s.initializeProjectAccesses=ym,s.initializeProjectAttachments=bm,s.initializeProjectFiles=qm,s.initializeProjects=Hm,s.initializeTeamMemberships=Qm,s.initializeTeams=rp,s.initializeUsers=Wh,s.isToday=Hp,s.issueAssociationReducer=dl,s.issueAssociationSlice=Pa,s.issueAttachmentReducer=yl,s.issueAttachmentSlice=wa,s.issueCommentAttachmentReducer=Rl,s.issueCommentAttachmentSlice=ja,s.issueCommentReducer=El,s.issueCommentSlice=za,s.issueReducer=Dl,s.issueSlice=Ba,s.issueTypeAttachmentReducer=Yl,s.issueTypeAttachmentSlice=Wa,s.issueTypeFieldValuesAttachmentReducer=Ih,s.issueTypeFieldValuesAttachmentSlice=tn,s.issueTypeFieldValuesReducer=nh,s.issueTypeFieldValuesSlice=Za,s.issueTypeFieldsAttachmentReducer=th,s.issueTypeFieldsAttachmentSlice=Ka,s.issueTypeFieldsReducer=hh,s.issueTypeFieldsSlice=en,s.issueTypeIdentifierReducer=Ph,s.issueTypeIdentifierSlice=an,s.issueTypeIdentifierValueReducer=vh,s.issueTypeIdentifierValueSlice=dn,s.issueTypeReducer=qh,s.issueTypeSlice=mn,s.issueUpdateReducer=Nh,s.issueUpdateSlice=yn,s.logOnlyOnce=xp,s.markAsDeleted=mm,s.markForDeletion=eg,s.memoize=is,s.offline=b,s.onlyUniqueHashes=aA,s.onlyUniqueOfflineIds=Ac,s.organizationAccessReducer=sm,s.organizationAccessSlice=Tn,s.organizationReducer=um,s.organizationSlice=Fn,s.outboxReducer=Am,s.outboxSlice=Pn,s.overmapEnhancer=Jg,s.overmapReducer=Dg,s.overmapReducers=pp,s.performRequest=Xn,s.projectAccessReducer=Im,s.projectAccessSlice=On,s.projectAttachmentReducer=Vm,s.projectAttachmentSlice=Vn,s.projectFileReducer=Lm,s.projectFileSlice=qn,s.projectReducer=Ym,s.projectSlice=Un,s.rehydratedReducer=Jm,s.rehydratedSlice=Bn,s.removeDocuments=Hi,s.removeIssueType=pn,s.resetProjectFileObjectUrls=lg,s.restructureCreateSelectorWithArgs=y,s.saveActiveProjectFileBounds=Bm,s.selectAccessToken=Ky,s.selectAccessesByUserOfProject=ig,s.selectAccessibleProjects=Tg,s.selectActiveOrganizationAccess=$T,s.selectActiveProjectFileId=mg,s.selectAllDocumentAttachments=zu,s.selectAllProjectAttachments=wm,s.selectAssetAttachmentById=vc,s.selectAssetAttachmentMapping=_c,s.selectAssetAttachments=Rc,s.selectAssetById=si,s.selectAssetProcedureAttachmentById=Gc,s.selectAssetProcedureAttachmentMapping=kc,s.selectAssetProcedureAttachments=Bc,s.selectAssetProcedureById=js,s.selectAssetProcedureFieldValues=gs,s.selectAssetProcedureFieldValuesAttachmentById=BA,s.selectAssetProcedureFieldValuesAttachments=cr,s.selectAssetProcedureFieldValuesAttachmentsByIds=rr,s.selectAssetProcedureFieldValuesAttachmentsMapping=ys,s.selectAssetProcedureFieldValuesById=bs,s.selectAssetProcedureFieldValuesMapping=fr,s.selectAssetProcedureFieldValuesOfAsset=LA,s.selectAssetProcedureFields=As,s.selectAssetProcedureFieldsAttachmentById=_A,s.selectAssetProcedureFieldsAttachments=Kc,s.selectAssetProcedureFieldsAttachmentsMapping=Yc,s.selectAssetProcedureFieldsById=qA,s.selectAssetProcedureFieldsMapping=tr,s.selectAssetProcedureFieldsOfAssetProcedure=VA,s.selectAssetProcedureInstanceById=vs,s.selectAssetProcedureInstances=Rs,s.selectAssetProcedureInstancesByIds=ZA,s.selectAssetProcedureInstancesMapping=_s,s.selectAssetProcedureInstancesOfAssetProcedure=br,s.selectAssetProcedureInstancesOfAssetType=KA,s.selectAssetProcedureStepById=Zs,s.selectAssetProcedureStepFieldValues=wt,s.selectAssetProcedureStepFieldValuesAttachmentById=Of,s.selectAssetProcedureStepFieldValuesAttachments=Gr,s.selectAssetProcedureStepFieldValuesAttachmentsByIds=$r,s.selectAssetProcedureStepFieldValuesAttachmentsMapping=Gs,s.selectAssetProcedureStepFieldValuesById=Hs,s.selectAssetProcedureStepFieldValuesMapping=Jr,s.selectAssetProcedureStepFieldValuesOfAsset=vf,s.selectAssetProcedureStepFieldValuesOfAssetProcedureInstance=wf,s.selectAssetProcedureStepFieldValuesOfAssetProcedureStep=Mf,s.selectAssetProcedureStepFields=ks,s.selectAssetProcedureStepFieldsAttachmentById=of,s.selectAssetProcedureStepFieldsAttachments=jr,s.selectAssetProcedureStepFieldsAttachmentsMapping=Vr,s.selectAssetProcedureStepFieldsById=If,s.selectAssetProcedureStepFieldsMapping=Cs,s.selectAssetProcedureStepFieldsOfAssetProcedureStep=ff,s.selectAssetProcedureStepMapping=Et,s.selectAssetProcedureSteps=sd,s.selectAssetProcedureStepsByIds=Df,s.selectAssetProcedureStepsMappingOfAssetProcedure=zf,s.selectAssetProcedureStepsOfAssetProcedure=Uf,s.selectAssetProcedures=_r,s.selectAssetProceduresByIds=tf,s.selectAssetProceduresMapping=Vs,s.selectAssetProceduresOfOrganization=sf,s.selectAssetStageById=hi,s.selectAssetStageCompletionById=md,s.selectAssetStageCompletionMapping=di,s.selectAssetStageCompletions=Nf,s.selectAssetStageCompletionsByIds=pd,s.selectAssetStages=Id,s.selectAssetStagesByIds=Xf,s.selectAssetStagesMappingOfAssetProcedure=Zf,s.selectAssetStagesOfAssetProcedure=Jf,s.selectAssetTypeAttachmentById=Rd,s.selectAssetTypeAttachmentMapping=Od,s.selectAssetTypeAttachments=_d,s.selectAssetTypeById=Ci,s.selectAssetTypeFieldValues=Fi,s.selectAssetTypeFieldValuesAttachmentById=gy,s.selectAssetTypeFieldValuesAttachments=Kd,s.selectAssetTypeFieldValuesAttachmentsByIds=Zd,s.selectAssetTypeFieldValuesAttachmentsMapping=Ii,s.selectAssetTypeFieldValuesById=Pi,s.selectAssetTypeFieldValuesMapping=iu,s.selectAssetTypeFieldValuesOfAsset=Py,s.selectAssetTypeFields=zt,s.selectAssetTypeFieldsAttachmentById=ry,s.selectAssetTypeFieldsAttachments=Ud,s.selectAssetTypeFieldsAttachmentsMapping=zd,s.selectAssetTypeFieldsById=Ay,s.selectAssetTypeFieldsMapping=Ld,s.selectAssetTypeFieldsOfAssetType=my,s.selectAssetTypeIdentifierById=vi,s.selectAssetTypeIdentifierMapping=ru,s.selectAssetTypeIdentifierValueById=ji,s.selectAssetTypeIdentifierValueMapping=hu,s.selectAssetTypeIdentifierValues=Vi,s.selectAssetTypeIdentifierValuesOfAsset=Dy,s.selectAssetTypeIdentifierValuesOfIdentifier=Cy,s.selectAssetTypeIdentifiers=du,s.selectAssetTypeIdentifiersOfAssetType=Ey,s.selectAssetTypeValuesOfAssetType=Oy,s.selectAssetTypes=fu,s.selectAssetTypesByIds=Ny,s.selectAssetTypesMapping=Di,s.selectAssetTypesOfOrganization=Hy,s.selectAssets=nd,s.selectAssetsByIds=cd,s.selectAssetsMapping=ei,s.selectAssetsOfAssetType=ti,s.selectAttachmentsOfAsset=wc,s.selectAttachmentsOfAssetProcedure=IA,s.selectAttachmentsOfAssetProcedureFieldValues=dr,s.selectAttachmentsOfAssetProcedureFields=OA,s.selectAttachmentsOfAssetProcedureStepFieldValues=Lr,s.selectAttachmentsOfAssetProcedureStepFields=uf,s.selectAttachmentsOfAssetType=vd,s.selectAttachmentsOfAssetTypeFieldValues=Jd,s.selectAttachmentsOfAssetTypeFields=cy,s.selectAttachmentsOfDocument=cS,s.selectAttachmentsOfFormRevision=US,s.selectAttachmentsOfFormSubmission=Uo,s.selectAttachmentsOfIssue=Al,s.selectAttachmentsOfIssueComment=pI,s.selectAttachmentsOfIssueType=wI,s.selectAttachmentsOfIssueTypeFieldValues=Sh,s.selectAttachmentsOfIssueTypeFields=zI,s.selectAttachmentsOfProject=Em,s.selectCategories=Ou,s.selectCategoriesByIds=tS,s.selectCategoriesOfProject=sS,s.selectCategoryById=$i,s.selectCategoryMapping=Gi,s.selectCommentsOfIssue=TI,s.selectConversation=hA,s.selectConversationMapping=rs,s.selectConversations=lA,s.selectCurrentUser=Jh,s.selectDeletedRequests=QT,s.selectDocumentAttachmentById=Uu,s.selectDocumentAttachmentMapping=qu,s.selectDocumentById=Gu,s.selectDocuments=Wi,s.selectDocumentsByIds=rS,s.selectDocumentsMapping=kt,s.selectEmailDomains=Ku,s.selectEmailDomainsAsMapping=Yu,s.selectEmailDomainsOfOrganization=fS,s.selectFieldValuesOfAssetProcedureInstance=NA,s.selectFormById=Mo,s.selectFormIdentifierById=Qi,s.selectFormIdentifierMapping=io,s.selectFormIdentifierValueById=ia,s.selectFormIdentifierValueMapping=uo,s.selectFormIdentifierValues=sa,s.selectFormIdentifierValuesOfFormSubmission=wS,s.selectFormIdentifierValuesOfIdentifier=MS,s.selectFormIdentifiers=ao,s.selectFormIdentifiersOfForm=FS,s.selectFormMapping=vo,s.selectFormRevisionAttachmentsMapping=fo,s.selectFormRevisionById=BS,s.selectFormRevisionMapping=da,s.selectFormRevisions=ua,s.selectFormRevisionsOfForm=Fo,s.selectFormSubmissionAttachemntsByIds=zo,s.selectFormSubmissionAttachments=pa,s.selectFormSubmissionAttachmentsMapping=qo,s.selectFormSubmissionById=Ta,s.selectFormSubmissions=Ia,s.selectFormSubmissionsMapping=Sa,s.selectFormSubmissionsOfAsset=Lo,s.selectFormSubmissionsOfForm=Go,s.selectFormSubmissionsOfIssue=$o,s.selectForms=wo,s.selectFormsOfOrganization=KS,s.selectGeoImageById=Fa,s.selectGeoImageMapping=Qo,s.selectGeoImages=xo,s.selectGeoImagesOfProject=iI,s.selectIsImportingProjectFile=pg,s.selectIsLoggedIn=Zy,s.selectIssueAssociationById=al,s.selectIssueAssociationMapping=At,s.selectIssueAssociations=rI,s.selectIssueAssociationsOfAsset=rl,s.selectIssueAssociationsOfIssue=cl,s.selectIssueAssociationsToIssue=nl,s.selectIssueAttachmentById=fl,s.selectIssueAttachmentMapping=ml,s.selectIssueAttachments=pl,s.selectIssueById=Ha,s.selectIssueCommentAttachmentById=_l,s.selectIssueCommentAttachmentMapping=Pl,s.selectIssueCommentAttachments=Ol,s.selectIssueCommentById=ka,s.selectIssueCommentMapping=Ml,s.selectIssueMapping=La,s.selectIssueTypeAttachmentById=Wl,s.selectIssueTypeAttachmentMapping=Nl,s.selectIssueTypeAttachments=Hl,s.selectIssueTypeById=fn,s.selectIssueTypeFieldValues=Qa,s.selectIssueTypeFieldValuesAttachmentById=iT,s.selectIssueTypeFieldValuesAttachments=sn,s.selectIssueTypeFieldValuesAttachmentsByIds=yh,s.selectIssueTypeFieldValuesAttachmentsMapping=fh,s.selectIssueTypeFieldValuesById=xa,s.selectIssueTypeFieldValuesMapping=ah,s.selectIssueTypeFieldValuesOfIssue=$I,s.selectIssueTypeFields=Wt,s.selectIssueTypeFieldsAttachmentById=UI,s.selectIssueTypeFieldsAttachments=eh,s.selectIssueTypeFieldsAttachmentsMapping=xl,s.selectIssueTypeFieldsById=XI,s.selectIssueTypeFieldsMapping=lh,s.selectIssueTypeFieldsOfIssueType=KI,s.selectIssueTypeIdentifierById=rn,s.selectIssueTypeIdentifierMapping=bh,s.selectIssueTypeIdentifierValueById=hn,s.selectIssueTypeIdentifierValueMapping=Rh,s.selectIssueTypeIdentifierValues=ln,s.selectIssueTypeIdentifierValuesOfIdentifier=fT,s.selectIssueTypeIdentifierValuesOfIssue=AT,s.selectIssueTypeIdentifiers=Fh,s.selectIssueTypeIdentifiersOfIssueType=uT,s.selectIssueTypeMapping=An,s.selectIssueTypeValuesOfIssueType=JI,s.selectIssueTypes=jh,s.selectIssueTypesByIds=bT,s.selectIssueTypesOfOrganization=FT,s.selectIssueUpdateMapping=Gh,s.selectIssueUpdates=$h,s.selectIssueUpdatesOfIssue=Lh,s.selectIssues=Na,s.selectIssuesByIds=PI,s.selectIssuesOfIssueType=Ul,s.selectIssuesOfProject=OI,s.selectLatestAssetProcedureFieldsOfAssetProcedure=jA,s.selectLatestAssetProcedureStepFieldsOfAssetProcedureStep=yf,s.selectLatestAssetTypeFieldsOfAssetType=py,s.selectLatestFieldsByAssetProcedureStep=Sf,s.selectLatestFormRevisionOfForm=GS,s.selectLatestIssueTypeFieldsOfIssueType=ZI,s.selectLatestRetryTime=xT,s.selectMembershipsByUserOfTeam=Rg,s.selectNumberOfAssetsOfAssetType=Gf,s.selectOrganizationAccessById=bn,s.selectOrganizationAccessMapping=gn,s.selectOrganizationAccessUserMapping=im,s.selectOrganizationById=XT,s.selectOrganizationDocuments=uS,s.selectOrganizations=JT,s.selectOrganizationsMapping=dm,s.selectProjectAccessById=En,s.selectProjectAccessMapping=Mn,s.selectProjectAccesses=Xt,s.selectProjectAccessesOfProject=Tm,s.selectProjectAttachmentById=Mm,s.selectProjectAttachmentMapping=vm,s.selectProjectById=Zm,s.selectProjectDocuments=dS,s.selectProjectFileById=hg,s.selectProjectFileMapping=Gm,s.selectProjectFiles=$m,s.selectProjectMapping=Km,s.selectProjects=kn,s.selectProjectsOfOrganization=gg,s.selectRehydrated=Pg,s.selectStageMapping=qt,s.selectTeamById=Kn,s.selectTeamMembershipById=np,s.selectTeamMemberships=Nn,s.selectTeamMembershipsMapping=ap,s.selectTeams=op,s.selectTeamsByIds=jg,s.selectTeamsMapping=Yn,s.selectTeamsOfOrganization=qg,s.selectUploadUrl=xu,s.selectUserById=Xh,s.selectUsers=In,s.selectUsersByIds=UT,s.selectUsersMapping=Zt,s.selectUsersOfOrganization=LT,s.selectUsersOfProject=ag,s.selectUsersOfTeam=vg,s.setActiveProjectFileId=km,s.setAsset=kf,s.setAssetAttachment=Fc,s.setAssetAttachments=pA,s.setAssetProcedure=xA,s.setAssetProcedureAttachment=qc,s.setAssetProcedureAttachments=yA,s.setAssetProcedureFieldValues=GA,s.setAssetProcedureFieldValuesAttachment=UA,s.setAssetProcedureFieldValuesAttachments=DA,s.setAssetProcedureFieldValuesMany=$A,s.setAssetProcedureFields=vA,s.setAssetProcedureFieldsAttachment=gA,s.setAssetProcedureFieldsAttachments=bA,s.setAssetProcedureFieldsMany=wA,s.setAssetProcedureInstance=WA,s.setAssetProcedureInstances=YA,s.setAssetProcedureStep=ed,s.setAssetProcedureStepFieldValues=_f,s.setAssetProcedureStepFieldValuesAttachment=gf,s.setAssetProcedureStepFieldValuesAttachments=bf,s.setAssetProcedureStepFieldValuesMany=Rf,s.setAssetProcedureStepFields=hf,s.setAssetProcedureStepFieldsAttachment=nf,s.setAssetProcedureStepFieldsAttachments=cf,s.setAssetProcedureStepFieldsMany=mf,s.setAssetProcedureSteps=Ef,s.setAssetProcedures=ef,s.setAssetStage=yd,s.setAssetStageCompletion=$f,s.setAssetStageCompletions=Lf,s.setAssetStages=Hf,s.setAssetType=ky,s.setAssetTypeAttachment=bd,s.setAssetTypeAttachments=xf,s.setAssetTypeFieldValues=by,s.setAssetTypeFieldValuesAttachment=yy,s.setAssetTypeFieldValuesAttachments=Sy,s.setAssetTypeFieldValuesMany=Fy,s.setAssetTypeFields=uy,s.setAssetTypeFieldsAttachment=sy,s.setAssetTypeFieldsAttachments=iy,s.setAssetTypeFieldsMany=oy,s.setAssetTypeIdentifier=Ry,s.setAssetTypeIdentifierValue=jy,s.setAssetTypeIdentifierValues=qy,s.setAssetTypeIdentifiers=vy,s.setAssetTypes=By,s.setAssets=Bf,s.setCategories=Qy,s.setCategory=Xy,s.setConversation=Ic,s.setConversations=rA,s.setCurrentUser=qT,s.setDocumentAttachment=Mu,s.setDocumentAttachments=aS,s.setDocuments=ku,s.setEmailDomain=lS,s.setEmailDomains=hS,s.setForm=LS,s.setFormIdentifier=IS,s.setFormIdentifierValue=OS,s.setFormIdentifierValues=_S,s.setFormIdentifiers=TS,s.setFormRevision=go,s.setFormRevisionAttachment=VS,s.setFormRevisionAttachments=jS,s.setFormRevisions=DS,s.setFormSubmission=$t,s.setFormSubmissionAttachment=JS,s.setFormSubmissionAttachments=XS,s.setFormSubmissions=eI,s.setForms=NS,s.setGeoImage=pt,s.setGeoImages=Yo,s.setIsImportingProjectFile=Cm,s.setIssue=gI,s.setIssueAssociation=nI,s.setIssueAssociations=aI,s.setIssueAttachment=ol,s.setIssueAttachments=uI,s.setIssueComment=Da,s.setIssueCommentAttachment=Tl,s.setIssueCommentAttachments=hI,s.setIssueComments=wl,s.setIssueType=It,s.setIssueTypeAttachment=Bl,s.setIssueTypeAttachments=RI,s.setIssueTypeFieldValues=CI,s.setIssueTypeFieldValuesAttachment=xI,s.setIssueTypeFieldValuesAttachments=eT,s.setIssueTypeFieldValuesMany=kI,s.setIssueTypeFields=NI,s.setIssueTypeFieldsAttachment=EI,s.setIssueTypeFieldsAttachments=VI,s.setIssueTypeFieldsMany=HI,s.setIssueTypeIdentifier=nT,s.setIssueTypeIdentifierValue=lT,s.setIssueTypeIdentifierValues=hT,s.setIssueTypeIdentifiers=cT,s.setIssueTypes=ST,s.setIssueUpdate=PT,s.setIssueUpdates=OT,s.setIssues=bI,s.setLoggedIn=Iu,s.setOrganization=HT,s.setOrganizationAccess=CT,s.setOrganizationAccesses=kT,s.setOrganizations=NT,s.setProfilePicture=zT,s.setProject=fg,s.setProjectAccess=tg,s.setProjectAccesses=sg,s.setProjectAttachment=Pm,s.setProjectAttachments=Om,s.setProjectFile=rg,s.setProjectFiles=dg,s.setProjects=Ag,s.setRehydrated=Fg,s.setTeam=gt,s.setTeamMembership=$n,s.setTeamMemberships=tp,s.setTeams=Mg,s.setTokens=Wy,s.setUploadUrl=Qu,s.setUser=wT,s.setUsers=vT,s.shallowEqual=Gp,s.slugify=sA,s.spacesToDashesLower=tA,s.teamMembershipReducer=ip,s.teamMembershipSlice=Gn,s.teamReducer=lp,s.teamSlice=Hn,s.toFileNameSafeString=eA,s.toOfflineIdRecord=pc,s.truncate=iA,s.updateAsset=rt,s.updateAssetAttachment=AA,s.updateAssetAttachments=Pc,s.updateAssetProcedure=at,s.updateAssetProcedureAttachment=SA,s.updateAssetProcedureAttachments=zc,s.updateAssetProcedureFieldValues=st,s.updateAssetProcedureFieldValuesAttachment=CA,s.updateAssetProcedureFieldValuesAttachments=nr,s.updateAssetProcedureFieldValuesMany=mr,s.updateAssetProcedureFields=xc,s.updateAssetProcedureFieldsAttachment=FA,s.updateAssetProcedureFieldsAttachments=Hc,s.updateAssetProcedureFieldsMany=MA,s.updateAssetProcedureInstance=it,s.updateAssetProcedureInstances=HA,s.updateAssetProcedureStep=Mt,s.updateAssetProcedureStepFieldValues=ct,s.updateAssetProcedureStepFieldValuesAttachment=Ff,s.updateAssetProcedureStepFieldValuesAttachments=Br,s.updateAssetProcedureStepFieldValuesMany=Kr,s.updateAssetProcedureStepFields=nt,s.updateAssetProcedureStepFieldsAttachment=rf,s.updateAssetProcedureStepFieldsAttachments=Mr,s.updateAssetProcedureStepFieldsMany=pf,s.updateAssetProcedureSteps=jf,s.updateAssetProcedures=XA,s.updateAssetStage=jt,s.updateAssetStageCompletion=od,s.updateAssetStageCompletions=ld,s.updateAssetStages=Yf,s.updateAssetType=lt,s.updateAssetTypeAttachment=ey,s.updateAssetTypeAttachments=Fd,s.updateAssetTypeFieldValues=dt,s.updateAssetTypeFieldValuesAttachment=Iy,s.updateAssetTypeFieldValuesAttachments=Yd,s.updateAssetTypeFieldValuesMany=tu,s.updateAssetTypeFields=Gd,s.updateAssetTypeFieldsAttachment=ay,s.updateAssetTypeFieldsAttachments=jd,s.updateAssetTypeFieldsMany=ly,s.updateAssetTypeIdentifier=ut,s.updateAssetTypeIdentifierValue=ot,s.updateAssetTypeIdentifierValues=zy,s.updateAssetTypeIdentifiers=wy,s.updateAssetTypes=$y,s.updateAssets=Cf,s.updateCategories=xy,s.updateCategory=Fu,s.updateConversation=Tc,s.updateConversations=dA,s.updateDocumentAttachment=nS,s.updateDocumentAttachments=Eu,s.updateDocuments=Qe,s.updateEmailDomain=mS,s.updateEmailDomains=pS,s.updateForm=HS,s.updateFormIdentifier=ht,s.updateFormIdentifierValue=mt,s.updateFormIdentifierValues=RS,s.updateFormIdentifiers=gS,s.updateFormRevision=CS,s.updateFormRevisionAttachment=qS,s.updateFormRevisionAttachments=po,s.updateFormRevisions=kS,s.updateFormSubmission=Bo,s.updateFormSubmissionAttachment=QS,s.updateFormSubmissionAttachments=jo,s.updateFormSubmissions=tI,s.updateForms=WS,s.updateGeoImage=Jo,s.updateGeoImages=sI,s.updateIssue=Ht,s.updateIssueAssociation=il,s.updateIssueAssociations=cI,s.updateIssueAttachment=oI,s.updateIssueAttachments=ll,s.updateIssueComment=yI,s.updateIssueCommentAttachment=mI,s.updateIssueCommentAttachments=gl,s.updateIssueComments=SI,s.updateIssueType=Vh,s.updateIssueTypeAttachment=vI,s.updateIssueTypeAttachments=Gl,s.updateIssueTypeFieldValues=ft,s.updateIssueTypeFieldValuesAttachment=tT,s.updateIssueTypeFieldValuesAttachments=Ah,s.updateIssueTypeFieldValuesMany=BI,s.updateIssueTypeFields=uh,s.updateIssueTypeFieldsAttachment=jI,s.updateIssueTypeFieldsAttachments=Xl,s.updateIssueTypeFieldsMany=WI,s.updateIssueTypeIdentifier=yt,s.updateIssueTypeIdentifierValue=St,s.updateIssueTypeIdentifierValues=mT,s.updateIssueTypeIdentifiers=rT,s.updateIssueTypes=IT,s.updateIssueUpdate=_T,s.updateIssueUpdates=RT,s.updateIssues=FI,s.updateOrganization=rm,s.updateOrganizationAccess=Jt,s.updateOrganizationAccesses=BT,s.updateOrganizations=YT,s.updateProject=Wm,s.updateProjectAccess=Tt,s.updateProjectAccesses=Sm,s.updateProjectAttachment=cg,s.updateProjectAttachments=_m,s.updateProjectFile=zn,s.updateProjectFiles=og,s.updateProjects=Sg,s.updateTeam=up,s.updateTeamMembership=Og,s.updateTeamMemberships=_g,s.updateTeams=Eg,s.updateUser=VT,s.updateUsers=ET,s.useSelectorBuilder=Cg,s.userReducer=Zh,s.userSlice=Sn,s.versioningReducer=mp,s.versioningSlice=hp,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
|
|
14
|
+
external URLs and therefore not prepended with VITE_API_URL.`;throw new Error(f)}const p=o.type.split("/")[1];if(!p)throw new Error("File has no extension");const A=n??h+"."+p;if(o=uc(o,A),!o.name)throw new Error("Failed to set file's name");await this.addCache(o,h),Xt[c]=new Promise(f=>{f(o)})}return o}}class Cb extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(Zi(c));const r=this.enqueueRequest({description:"Create form identifier",method:l.POST,url:"/form-identifiers/",payload:v(c),blockers:[c.form],blocks:[c.uuid]});return r.then(m=>{this.dispatch(pt(m))}).catch(()=>{this.dispatch(Ji(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=Xi(e.uuid)(i.getState());if(!a)throw new Error(`Expected form identifier with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(pt(n));const c=this.enqueueRequest({description:"Update form identifier",method:l.PATCH,url:`/form-identifiers/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(pt(r))}).catch(()=>{this.dispatch(pt(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Xi(e)(a);if(!n)throw new Error(`Expected form identifier with uuid ${e} to exist`);this.dispatch(Ji(e));try{return await this.enqueueRequest({description:"Delete form identifier",method:l.DELETE,url:`/form-identifiers/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(Zi(n)),c}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get form identifiers",method:l.GET,url:"/form-identifiers/",queryParams:{form__organization:e},blockers:[],blocks:[]},i);return this.dispatch(to(a)),a}}class kb extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(xi(c));const r=this.enqueueRequest({description:"Create form identifier value",method:l.POST,url:"/form-identifier-values/",payload:v(c),blockers:[e.form_submission,e.form_identifier],blocks:[c.uuid]});return r.then(m=>{this.dispatch(At(m))}).catch(()=>{this.dispatch(ea(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=sa(e.uuid)(i.getState());if(!a)throw new Error(`Expected form identifier value with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(At(n));const c=this.enqueueRequest({description:"Update form identifier value",method:l.PATCH,url:`/form-identifier-values/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(At(r))}).catch(()=>{this.dispatch(At(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=sa(e)(a);if(!n)throw new Error(`Expected form identifier value with uuid ${e} to exist`);this.dispatch(ea(e));try{return await this.enqueueRequest({description:"Delete form identifier value",method:l.DELETE,url:`/form-identifier-values/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(xi(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get form identifier values",method:l.GET,url:"/form-identifier-values/",queryParams:{limit:V,paginate:!0,form_submission__form_revision__form__organization:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get form identifier values",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(co(n)),n}}class Bb extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const o of e){const{revisionUuid:h,fieldIdentifier:p,file:A}=o,f=await this.getFilePayload(A);f.sha1 in n||(n[f.sha1]=f);const T=b({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:f.sha1,created_by:a,form_revision:h,submitted_at:i,field_identifier:p});c.push(T);const F={uuid:T.uuid,file_name:A.name,field_identifier:p,file_extension:f.extension,file_sha1:f.sha1,form_revision:h};r.push(F)}this.dispatch(ho(c));const u=this.enqueueRequest({description:"Attach files to form revision",method:l.POST,url:"/form-revision-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(o=>o.form_revision),blocks:c.map(o=>o.uuid)});return u.then(o=>{this.processPresignedUrls(o.presigned_urls),this.dispatch(mo(o.attachments))}).catch(()=>{this.dispatch(po(c.map(o=>o.uuid)))}),[c,u.then(({attachments:o})=>o)]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch organization form revision attachments",method:l.GET,url:"/form-revision-attachments/",queryParams:{form_revision__form__organization:e},blockers:[e],blocks:[]},i);return this.dispatch(lo(a)),a}}class $b extends j{add(e){var u;const{store:i}=this.client,n=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,c=b({...e,created_by:n,submitted_at:new Date().toISOString()});this.dispatch(na(c));const r=this.enqueueRequest({description:"Create form revision",method:l.POST,url:"/form-revisions/",payload:v(c),blockers:[e.form],blocks:[c.uuid]});return r.then(m=>{this.dispatch(To(m))}).catch(()=>{this.dispatch(ca(c.uuid))}),[c,r]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get organization form revisions",method:l.GET,url:"/form-revisions/",queryParams:{form__organization:e},blockers:[e],blocks:[]},i);return this.dispatch(So(a)),a}}class Gb extends j{add(e,i){var o;const{store:a}=this.client,n=new Date().toISOString(),c=(o=a.getState().userReducer.currentUser)==null?void 0:o.id,r=b({...e,submitted_at:n,created_by:c}),u=b({...i,form:r.uuid,submitted_at:n,created_by:c});this.dispatch(oa(r)),this.dispatch(na(u));const m=this.enqueueRequest({description:"Create form",method:l.POST,url:"/forms/",payload:{...v(r),initial_revision:{uuid:u.uuid,submitted_at:u.submitted_at,title:u.title,description:u.description,fields:u.fields}},blockers:[],blocks:[r.uuid,u.uuid]});return m.catch(h=>{throw this.dispatch(la(r.uuid)),this.dispatch(ca(u.uuid)),h}),[r,u,m]}async delete(e){const{store:i}=this.client,a=i.getState(),n=wo(e)(a);if(!n)throw new Error("Expected form to exist");const c=Go(e)(a);c.length>0&&this.dispatch($o(c.map(({uuid:u})=>u)));const r=bo(e)(a);r.length>0&&this.dispatch(go(r.map(({uuid:u})=>u))),this.dispatch(la(e));try{return await this.enqueueRequest({description:"Delete form",method:l.DELETE,url:`/forms/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(oa(n)),r.length>0&&this.dispatch(Io(r)),c.length>0&&this.dispatch(ko(c)),u}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch organization forms",method:l.GET,url:"/forms/",queryParams:{organization:e},blockers:[e],blocks:[]},i);return this.dispatch(Oo(a)),a}}class Lb extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const o of e){const{submissionUuid:h,fieldIdentifier:p,file:A}=o,f=await this.getFilePayload(A);f.sha1 in n||(n[f.sha1]=f);const T=b({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:f.sha1,created_by:a,form_submission:h,submitted_at:i,field_identifier:p});c.push(T);const F={uuid:T.uuid,file_name:A.name,file_sha1:f.sha1,file_extension:f.extension,field_identifier:p,form_submission:h};r.push(F)}this.dispatch($t(c));const u=this.enqueueRequest({description:"Attach files to form submission",method:l.POST,url:"/form-submission-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(o=>o.form_submission),blocks:c.map(o=>o.uuid)});return u.then(o=>{this.processPresignedUrls(o.presigned_urls),this.dispatch(Vo(o.attachments))}).catch(o=>{throw this.dispatch(Gt(c.map(h=>h.uuid))),o}),[c,u.then(({attachments:o})=>o)]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),n=qo(e)(a);this.dispatch(Gt(e));try{await this.enqueueRequest({description:"Delete form submission attachments",method:l.DELETE,url:"/form-submission-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch($t(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get form submission attachments",method:l.GET,url:"/form-submission-attachments/",queryParams:{limit:He,paginate:!0,form_submission__form_revision__form__organization:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get form submission attachments",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Eo(n)),n}}class Nb extends j{add(e){var r;const{store:i}=this.client,a=i.getState(),n=b({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),c=this.enqueueRequest({description:"Add form submission",method:l.POST,url:"/form-submissions/",payload:v(n),blockers:[e.form_revision],blocks:[n.uuid]});return this.dispatch(Aa(n)),c.then(u=>(this.dispatch(Lt(u)),u)).catch(()=>{this.dispatch(fa(n.uuid))}),[n,c]}update(e){const{store:i}=this.client,a=i.getState(),n=Sa(e.uuid)(a);if(!n)throw new Error(`Expected submission with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(Bo(c));const r=this.enqueueRequest({description:"Delete user form submissions",method:l.PATCH,url:`/form-submissions/${c.uuid}/`,payload:e,blockers:[c.uuid],blocks:[c.uuid]});return r.then(u=>{this.dispatch(Lt(u))}).catch(()=>{this.dispatch(Lt(n))}),[c,r]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Sa(e)(a);if(!n)throw new Error(`Expected submission with uuid ${e} to exist`);const c=zo(e)(a);this.dispatch(fa(e)),this.dispatch(Gt(c.map(r=>r.uuid)));try{return await this.enqueueRequest({description:"Delete user form submissions",method:l.DELETE,url:`/form-submissions/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(Aa(n)),this.dispatch($t(c)),r}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Fetch form submissions",method:l.GET,url:"/form-submissions/",queryParams:{limit:V,paginate:!0,form_revision__form_organization:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Fetch form submissions",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Co(n)),n}}class Hb extends j{async add(e){var p;const{store:i}=this.client,{file:a,...n}=e,c=new Date().toISOString(),r=(p=i.getState().userReducer.currentUser)==null?void 0:p.id,u=n.project,m=await this.getFilePayload(a),o=b({...n,file_name:a.name,file_sha1:m.sha1,file:URL.createObjectURL(a),submitted_at:c,created_by:r});this.dispatch(Ko(o));const h=this.enqueueRequest({description:"Add geo image",method:l.POST,url:"/geo-images/",payload:{uuid:o.uuid,submitted_at:c,title:o.title,description:o.description,geo_marker:o.geo_marker,canvas_marker:o.canvas_marker,sha1:o.file_sha1,project:o.project,file_name:o.file_name,direction:o.direction,original_date:o.original_date,file:m},blocks:[u],blockers:[u]});return h.then(A=>{this.processPresignedUrls(A.presigned_urls),this.dispatch(ft(A.geo_image))}).catch(()=>{this.dispatch(Ta(o.uuid))}),[o,h.then(A=>A.geo_image)]}async bulkAdd(e,i){var p;const{store:a}=this.client,n=new Date().toISOString(),c=(p=a.getState().userReducer.currentUser)==null?void 0:p.id,r=[],u=[],m=[],o={};for(const A of e){const{file:f,...T}=A,F=await this.getFilePayload(f);F.sha1 in o||(o[F.sha1]=F);const _=b({...T,file_name:f.name,file_sha1:F.sha1,file:URL.createObjectURL(f),submitted_at:n,created_by:c,project:i});r.push(_),u.push(_.uuid),m.push({uuid:_.uuid,sha1:_.file_sha1,file_name:_.file_name,title:_.title,description:_.description,geo_marker:_.geo_marker,canvas_marker:_.canvas_marker,direction:_.direction,original_date:_.original_date})}this.dispatch(Yo(r));const h=this.enqueueRequest({description:"Bulk add geo images",method:l.POST,url:"/geo-images/bulk/",payload:{submitted_at:n,project:i,geo_images:m,files:Object.values(o)},blocks:[i],blockers:u});return h.then(A=>{this.processPresignedUrls(A.presigned_urls),this.dispatch(Wo(A.geo_images))}).catch(()=>{this.dispatch(Jo(u))}),[r,h.then(A=>A.geo_images)]}update(e){const{store:i}=this.client,a=i.getState(),n=ga(e.uuid)(a);if(!n)throw new Error(`Map image with uuid ${e.uuid} does not exist in the store`);const c={...n,...e};this.dispatch(Zo(c));const r=this.enqueueRequest({description:"Update geo image",method:l.PATCH,url:`/geo-images/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return r.then(u=>{this.dispatch(ft(u))}).catch(()=>{this.dispatch(ft(n))}),[c,r]}async delete(e){const{store:i}=this.client,a=i.getState(),n=ga(e)(a);if(!n)throw new Error(`Map image with uuid ${e} does not exist in the store`);this.dispatch(Ta(e));const c=this.enqueueRequest({description:"Delete geo image",method:l.DELETE,url:`/geo-images/${e}/`,blocks:[e],blockers:[e]});return c.catch(()=>{this.dispatch(ft(n))}),c}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get geo images",method:l.GET,url:"/geo-images/",queryParams:{project:e},blocks:[e],blockers:[]},i);return this.dispatch(Ho(a)),a}}class Wb extends R{add(e){var u;const{store:i}=this.client,a=new Date().toISOString(),n=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,c=b({...e,submitted_at:a,created_by:n});this.dispatch(Fa(c));const r=this.enqueueRequest({description:"Add issue association",method:l.POST,url:"/issue-associations/",payload:v(c),blockers:[e.associated_issue,...e.issue?[e.issue]:[],...e.asset?[e.asset]:[]],blocks:[c.uuid]});return r.then(m=>{this.dispatch(sl(m))}).catch(()=>{this.dispatch(Oa(c.uuid))}),[c,r]}async delete(e){const{store:i}=this.client,a=il(e)(i.getState());if(!a)throw new Error(`Issue association with uuid ${e} not found in store.`);this.dispatch(Oa(e));const n=this.enqueueRequest({description:"Delete issue association",method:l.DELETE,url:`/issue-associations/${e}/`,blockers:[e],blocks:[]});return n.catch(()=>{this.dispatch(Fa(a))}),n}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Fetch issue associations",method:l.GET,url:"/issue-associations/",queryParams:{limit:V,paginate:!0,associated_issue__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Fetch issue associations",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(tl(n)),n}}class Kb extends We{constructor(){super(...arguments);S(this,"name","Issue Attachment");S(this,"url","/issue-attachments");S(this,"initializeAttachments",va);S(this,"addAttachments",wa);S(this,"updateAttachments",ol);S(this,"removeAttachments",Ma);S(this,"removeAttachment",ll);S(this,"setAttachment",ul);S(this,"selectAttachment",Al)}buildOfflineAttachment(i){return b({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,issue:i.modelUuid})}buildAttachmentPayload(i){return{...i,issue:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.issueUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const c=(await this.performPagination({immediate:!0,description:"Get issue attachments",method:l.GET,url:`${this.url}/`,queryParams:{limit:He,paginate:!0,issue__project:i},blocks:[],blockers:[]},r=>({immediate:!0,description:"Get issue attachments",method:l.GET,url:r,blockers:[],blocks:[]}),a)).flat();return this.dispatch(va(c)),c}}class Yb extends We{constructor(){super(...arguments);S(this,"name","Issue Comment Attachment");S(this,"url","/issue-comment-attachments");S(this,"initializeAttachments",Va);S(this,"addAttachments",Sl);S(this,"updateAttachments",Tl);S(this,"removeAttachments",bl);S(this,"removeAttachment",gl);S(this,"setAttachment",Il);S(this,"selectAttachment",Ol)}buildOfflineAttachment(i){return b({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,issue_comment:i.modelUuid})}buildAttachmentPayload(i){return{...i,issue_comment:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.issueCommentUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const c=(await this.performPagination({immediate:!0,description:"Get issue comment attachments",method:l.GET,url:`${this.url}/`,queryParams:{limit:He,paginate:!0,issue_comment__issue__project:i},blocks:[],blockers:[]},r=>({immediate:!0,description:"Get issue comment attachments",method:l.GET,url:r,blockers:[],blocks:[]}),a)).flat();return this.dispatch(Va(c)),c}}class Zb extends R{add(e){var c;const{store:i}=this.client,a=b({...e,author:(c=i.getState().userReducer.currentUser)==null?void 0:c.id,submitted_at:new Date().toISOString()});this.dispatch(qa(a));const n=this.enqueueRequest({description:"Add issue comment",method:l.POST,url:"/issue-comments/",payload:v(a),blockers:[e.issue],blocks:[a.uuid]});return n.catch(()=>{this.dispatch(Ua(a.uuid))}),[a,n]}update(e){const{store:i}=this.client,a=Da(e.uuid)(i.getState());if(!a)throw new Error(`Comment with uuid ${e.uuid} not found in store`);const n={...a,...e};this.dispatch(za(n));const c=this.enqueueRequest({description:"Edit issue comment",method:l.PATCH,url:`/issue-comments/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.catch(()=>{this.dispatch(za(a))}),[n,c]}remove(e){const{store:i}=this.client,a=Da(e)(i.getState());if(!a)throw new Error(`Comment with uuid ${e} not found in store`);this.dispatch(Ua(e));const n=this.enqueueRequest({description:"Delete comment",method:l.DELETE,url:`/issue-comments/${e}/`,blockers:[e],blocks:[]});return n.catch(()=>{this.dispatch(qa(a))}),n}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get comments",method:l.GET,url:"/issue-comments/",queryParams:{issue__project:e},blockers:[],blocks:[]},i);return this.dispatch(vl(a)),a}}class Jb extends R{add(e){var m;const{store:i}=this.client,a=i.getState(),n=new Date().toISOString(),c=(m=a.userReducer.currentUser)==null?void 0:m.id,r=b({...e,submitted_at:n,created_by:c});this.dispatch(ka(r));const u=this.enqueueRequest({description:"Create issue",method:l.POST,url:"/issues/",payload:v(r),blockers:[r.project,r.issue_type,...r.category?[r.category]:[]],blocks:[r.uuid]});return u.then(o=>{this.dispatch(Nt(o))}).catch(o=>{throw this.dispatch(Ba(r.uuid)),o}),[r,u]}update(e){var m;const i=this.client.store.getState(),a=La(e.uuid)(i);if(!a)throw new Error(`Attempting to update an issue with uuid ${e.uuid} that doesn't exist in the store`);const n={...a,...e};this.dispatch(Nt(n));const c={};for(const o of[E.TITLE,E.DESCRIPTION,E.STATUS,E.CATEGORY,E.PRIORITY,E.ASSIGNED_TO,E.DUE_DATE])if(o in e&&e[o]!==a[o])switch(o){case E.PRIORITY:case E.STATUS:{const h=e[o];c[o]=h!==void 0?Number(h):null;break}case E.DUE_DATE:case E.DESCRIPTION:case E.TITLE:c[o]=e[o]??null;break;case E.CATEGORY:{let h=null;const p=e[o];if(p&&(h=i.categoryReducer.instances[p]??null,!h))throw new Error(`Trying to update issue category to ${p} which does not exist in store`);c[o]=h?{name:h.name,color:h.color,uuid:h.uuid}:null;break}case E.ASSIGNED_TO:{let h=null;const p=e[o];if(p&&(h=i.userReducer.instances[p]??null,!h))throw new Error(`Trying to update issue assigned_to to ${p} which does not exist in store`);c[o]=h?{full_name:h.username,id:h.id}:null;break}}const r=b({created_by:(m=i.userReducer.currentUser)==null?void 0:m.id,submitted_at:new Date().toISOString(),issue:a.uuid,changes:c});this.dispatch(Uh(r));const u=this.enqueueRequest({description:"Edit issue",method:l.PATCH,url:`/issues/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.catch(()=>{this.dispatch(Nt(a)),this.dispatch(Ch(r.uuid))}),[n,u]}async remove(e){const{store:i}=this.client,a=i.getState(),n=La(e)(a);if(!n)throw new Error(`No issue with uuid ${e} found in the store`);const c=pl(e)(a),r=Gh(e)(a),u={};for(const o of al(e)(a))u[o.uuid]=o;for(const o of nl(e)(a))u[o.uuid]=o;const m=Object.values(u);this.dispatch(Ba(e)),c.length>0&&this.dispatch(Ma(c.map(({uuid:o})=>o))),r.length>0&&this.dispatch(kh(r.map(({uuid:o})=>o))),m.length>0&&this.dispatch(_a(m.map(({uuid:o})=>o)));try{return await this.enqueueRequest({description:"Delete issue",method:l.DELETE,url:`/issues/${e}/`,blockers:[e],blocks:[]})}catch(o){throw this.dispatch(ka(n)),this.dispatch(wa(c)),this.dispatch(Dh(r)),this.dispatch(Pa(m)),o}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get issues",method:l.GET,url:"/issues/",queryParams:{limit:V,paginate:!0,project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get issues",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Vl(n)),n}}class Xb extends We{constructor(){super(...arguments);S(this,"name","Issue Type Attachment");S(this,"url","/issue-type-attachments");S(this,"initializeAttachments",Ha);S(this,"addAttachments",Cl);S(this,"updateAttachments",Bl);S(this,"removeAttachments",Gl);S(this,"removeAttachment",$l);S(this,"setAttachment",kl);S(this,"selectAttachment",Hl)}buildOfflineAttachment(i){return b({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,issue_type:i.modelUuid})}buildAttachmentPayload(i){return{...i,issue_type:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.issueTypeUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const n=await this.enqueueRequest({immediate:!0,description:"Get issue type attachments",method:l.GET,url:`${this.url}/`,queryParams:{issue_type__organization:i},blocks:[],blockers:[]},a);return this.dispatch(Ha(n)),n}}class Qb extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const o of e){const{fieldsRevisionUuid:h,fieldIdentifier:p,file:A}=o,f=await this.getFilePayload(A);f.sha1 in n||(n[f.sha1]=f);const T=b({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:f.sha1,created_by:a,fields_revision:h,submitted_at:i,field_identifier:p});c.push(T);const F={uuid:T.uuid,file_name:A.name,file_extension:f.extension,field_identifier:p,file_sha1:f.sha1,fields_revision:h};r.push(F)}this.dispatch(Zl(c));const u=this.enqueueRequest({description:"Add issue type fields attachments",method:l.POST,url:"/issue-type-fields-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(o=>o.fields_revision),blocks:c.map(o=>o.uuid)});return u.then(o=>{this.processPresignedUrls(o.presigned_urls),this.dispatch(Jl(o.attachments))}).catch(()=>{this.dispatch(Xl(c.map(o=>o.uuid)))}),[c,u.then(({attachments:o})=>o)]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"get issue type fields attachments",method:l.GET,url:"/issue-type-fields-attachments/",queryParams:{fields_revision__issue_type__organization:e},blockers:[e],blocks:[]},i);return this.dispatch(Yl(a)),a}}class xb extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(rh(c));const r=this.enqueueRequest({description:"Add Issue Type Fields",method:l.POST,url:"/issue-type-fields/",payload:v(c),blockers:[c.issue_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(dh(m))}).catch(m=>{throw this.dispatch(uh(c.uuid)),m}),[c,r]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get Issue Type Fields",method:l.GET,url:"/issue-type-fields/",queryParams:{issue_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(ch(a)),a}}class eF extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const o of e){const{fieldValuesUuid:h,fieldIdentifier:p,file:A}=o,f=await this.getFilePayload(A);f.sha1 in n||(n[f.sha1]=f);const T=b({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:f.sha1,created_by:a,field_values:h,submitted_at:i,field_identifier:p});c.push(T);const F={uuid:T.uuid,file_name:A.name,file_sha1:f.sha1,file_extension:f.extension,field_identifier:p,field_values:h};r.push(F)}this.dispatch(Wt(c));const u=this.enqueueRequest({description:"Add issue type field values attachments",method:l.POST,url:"/issue-type-field-values-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(o=>o.field_values),blocks:c.map(o=>o.uuid)});return u.then(({presigned_urls:o,attachments:h})=>{this.processPresignedUrls(o),this.dispatch(ph(h))}).catch(o=>{throw this.dispatch(Kt(c.map(h=>h.uuid))),o}),[c,u.then(({attachments:o})=>o)]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),n=fh(e)(a);this.dispatch(Kt(e));try{await this.enqueueRequest({description:"Delete issue type field values attachments",method:l.DELETE,url:"/issue-type-field-values-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(Wt(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get issue type field values attachments",method:l.GET,url:"/issue-type-field-values-attachments/",queryParams:{limit:He,paginate:!0,field_values__issue__project:e,latest:!0},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get issue type field values attachments",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(mh(n)),n}}class tF extends R{add(e){var r;const{store:i}=this.client,a=i.getState(),n=b({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),c=this.enqueueRequest({description:"Add issue type field values",method:l.POST,url:"/issue-type-field-values/",payload:v(n),blockers:[e.issue,e.fields_revision],blocks:[n.uuid]});return this.dispatch(Ya(n)),c.then(u=>(this.dispatch(St(u)),u)).catch(()=>{this.dispatch(Za(n.uuid))}),[n,c]}update(e){const{store:i}=this.client,a=i.getState(),n=Xa(e.uuid)(a);if(!n)throw new Error(`Expected IssueTypeFieldValues with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(St(c));const r=this.enqueueRequest({description:"Update issue type field values",method:l.PATCH,url:`/issue-type-field-values/${e.uuid}/`,payload:e,blockers:[c.uuid,c.fields_revision,c.issue],blocks:[c.uuid]});return r.then(u=>{this.dispatch(St(u))}).catch(()=>{this.dispatch(St(n))}),[c,r]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Xa(e)(a);if(!n)throw new Error(`Expected submission with uuid ${e} to exist`);const c=yh(e)(a);this.dispatch(Za(e)),this.dispatch(Kt(c.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete issue type field values",method:l.DELETE,url:`/issue-type-field-values/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(Ya(n)),this.dispatch(Wt(c)),r}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get issue type field values",method:l.GET,url:"/issue-type-field-values/",queryParams:{limit:V,paginate:!0,issue__project:e,latest:!0},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get issue type field values",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(sh(n)),n}}class sF extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(sn(c));const r=this.enqueueRequest({description:"Create issue type identifier",method:l.POST,url:"/issue-type-identifiers/",payload:v(c),blockers:[c.issue_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(It(m))}).catch(()=>{this.dispatch(an(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=nn(e.uuid)(i.getState());if(!a)throw new Error(`Expected issue type identifier with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(It(n));const c=this.enqueueRequest({description:"Update issue type identifier",method:l.PATCH,url:`/issue-type-identifiers/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(It(r))}).catch(()=>{this.dispatch(It(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=nn(e)(a);if(!n)throw new Error(`Expected issue type identifier with uuid ${e} to exist`);this.dispatch(an(e));try{return await this.enqueueRequest({description:"Delete issue type identifier",method:l.DELETE,url:`/issue-type-identifiers/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(sn(n)),c}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get issue type identifiers",method:l.GET,url:"/issue-type-identifiers/",queryParams:{issue_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Th(a)),a}}class iF extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(rn(c));const r=this.enqueueRequest({description:"Create issue type identifier value",method:l.POST,url:"/issue-type-identifier-values/",payload:v(c),blockers:[e.issue,e.issue_type_identifier],blocks:[c.uuid]});return r.then(m=>{this.dispatch(Tt(m))}).catch(()=>{this.dispatch(dn(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=on(e.uuid)(i.getState());if(!a)throw new Error(`Expected issue type identifier value with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(Tt(n));const c=this.enqueueRequest({description:"Update issue type identifier value",method:l.PATCH,url:`/issue-type-identifier-values/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(Tt(r))}).catch(()=>{this.dispatch(Tt(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=on(e)(a);if(!n)throw new Error(`Expected issue type identifier value with uuid ${e} to exist`);this.dispatch(dn(e));try{return await this.enqueueRequest({description:"Delete issue type identifier value",method:l.DELETE,url:`/issue-type-identifier-values/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(rn(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get issue type identifier values",method:l.GET,url:"/issue-type-identifier-values/",queryParams:{limit:V,paginate:!0,issue__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get issue type identifier values",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Oh(n)),n}}class aF extends R{add(e){var r;const{store:i}=this.client,a=i.getState(),n=b({...e,submitted_at:new Date().toISOString(),created_by:(r=a.userReducer.currentUser)==null?void 0:r.id});this.dispatch(Mh(n));const c=this.enqueueRequest({method:l.POST,url:"/issue-types/",payload:v(n),blockers:[],blocks:[n.uuid]});return c.then(u=>{this.dispatch(gt(u))}).catch(()=>{this.dispatch(hn(n.uuid))}),[n,c]}update(e){const{store:i}=this.client,a=i.getState(),n=pn(e.uuid)(a);if(!n)throw new Error(`IssueType with uuid ${e.uuid} does not exist in the store.`);const c={...n,...e};this.dispatch(Eh(c));const r=this.enqueueRequest({method:l.PATCH,url:`/issue-types/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(gt(u))}).catch(()=>{this.dispatch(gt(n))}),[c,r]}delete(e){const{store:i}=this.client,a=i.getState(),n=pn(e)(a);if(!n)throw new Error(`IssueType with uuid ${e} does not exist in the store.`);const c=zl(e)(a);this.dispatch(hn(e)),this.dispatch(ql(c.map(u=>u.uuid)));const r=this.enqueueRequest({method:l.DELETE,url:`/issue-types/${e}/`,blockers:[e],blocks:[]});return r.catch(()=>{this.dispatch(gt(n)),this.dispatch(jl(c))}),r}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,method:l.GET,url:"/issue-types/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(wh(a)),a}}class nF extends R{async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get issue updates",method:l.GET,url:"/issue-updates/",queryParams:{limit:V,paginate:!0,issue__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get issue updates",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(zh(n)),n}}const cF=1800;function rF(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 dF extends nb{constructor(){super(...arguments);S(this,"_getRenewedTokens",async i=>{const a=this.enqueueRequest({description:"Get renewed tokens",method:l.POST,url:this.refreshTokensUrl,payload:{refresh:i},isAuthNeeded:!1,blockers:[],blocks:[],checkAuth:!1,immediate:!0});let n;try{n=await a}catch(c){console.error("Could not renew tokens; clearing auth",c),this.clearAuth();return}if(!n.access)throw new Error("Missing access token");return{accessToken:n.access,refreshToken:n.refresh??this.getRefreshToken()}})}clearAuth(){console.debug(this.constructor.name,"clearing auth;"),this.dispatch(Su(!1)),this.clearTokens(),this.dispatch(g()),this.dispatch(g())}async renewTokens(){const i=this.getRefreshToken();if(!i)throw new Error("No refresh token found");console.debug(this.constructor.name,"renewing tokens");try{const a=await this._getRenewedTokens(i);if(!a)return;console.log("Got renewed tokens"),this.setTokens(a)}catch(a){throw console.error("Could not renew tokens; clearing auth",a),this.clearAuth(),a}}tokenIsExpiringSoon(){const i=this.getAccessToken();if(!i)return!1;const a=Date.now()/1e3;let n;try{n=$p(i).exp??a}catch{n=a}return n-a<cF}getAuthHeader(){return`Bearer ${this.getAccessToken()}`}async prepareAuth(){if(this.tokenIsExpiringSoon()){console.debug(this.constructor.name,"preparing auth");try{await this.renewTokens()}catch(i){return i instanceof D&&this.clearAuth(),i instanceof Error?Promise.reject(i):Promise.reject(new Error((i??et).toString()))}}}async handleUnauthorized(i,a){const n=this.client.store.getState();if(i.url.endsWith("/token/refresh/"))throw n.authReducer.isLoggedIn&&console.warn("No signed-in user to sign out."),this.clearAuth(),new D({message:"You have been signed out due to inactivity.",response:a,discard:!0});if(n.authReducer.isLoggedIn)await this.renewTokens();else throw console.debug("Forbidden; user is not logged in."),new D({message:"Incorrect username or password.",response:a,discard:!0})}async initAuth(i){const a=Xe.v4();return console.debug(this.constructor.name,"Initiating auth"),this.enqueueRequest({uuid:a,description:"Get token pair",method:l.POST,url:this.initTokensUrl,payload:i,isAuthNeeded:!1,checkAuth:!1,immediate:!0,blockers:[],blocks:[]}).then(n=>{this.setTokens(rF(n))})}}class uF extends R{update(e){const{store:i}=this.client,a=Tn(e.uuid)(i.getState()),n={...a,...e};this.dispatch(Zt(n));const c=this.enqueueRequest({description:"Edit organization access",method:l.PATCH,url:`/organization-accesses/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(Zt(r))}).catch(r=>{throw this.dispatch(Zt(a)),r}),[n,c]}async remove(e){const{store:i}=this.client,a=i.getState(),n=Tn(e)(a),c=Jh(n.user)(a);this.dispatch(em(n.uuid)),this.dispatch(Kh(n.user));try{await this.enqueueRequest({description:"Remove organization access",method:l.DELETE,url:`/organization-accesses/${n.uuid}/`,blockers:[n.uuid],blocks:[]})}catch(r){throw this.dispatch(xh(n)),this.dispatch(Wh(c)),r}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get organization accesses",method:l.GET,url:"/organization-accesses/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(Qh(a)),a}}class oF extends R{async add(e){const i=await this.enqueueRequest({description:"Create organization",method:l.POST,url:"/organizations/",payload:e,blockers:[],blocks:[]});return this.dispatch(nm(i)),i}async update(e){const i=await this.enqueueRequest({description:"Edit organization",method:l.PATCH,url:`/organizations/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return this.dispatch(cm(i)),i}async invite(e,i){return this.enqueueRequest({description:"Invite user to organization",method:l.POST,url:`/organizations/${e}/invite/${i}/`,blockers:[],blocks:[]})}async refreshStore(e){const i=await this.enqueueRequest({immediate:!0,description:"Fetch organizations",method:l.GET,url:"/organizations/",blockers:[],blocks:[]},e);return this.dispatch(am(i)),i}}class lF extends R{add(e){var c;const{store:i}=this.client,a=b({...e,created_by:(c=i.getState().userReducer.currentUser)==null?void 0:c.id});this.dispatch(Pn(a));const n=this.enqueueRequest({description:"Add project access",method:l.POST,url:"/project-accesses/",payload:v(a),blockers:[a.organization_access,a.project],blocks:[a.uuid]});return n.then(r=>{this.dispatch(bt(r))}).catch(r=>{throw this.dispatch(_n(a.uuid)),r}),[a,n]}bulkAdd(e){var r;const{store:i}=this.client,a=(r=i.getState().userReducer.currentUser)==null?void 0:r.id,n=e.map(u=>b({...u,created_by:a}));this.dispatch(On(n));const c=this.enqueueRequest({description:"Add project accesses",method:l.POST,url:"/project-accesses/bulk/",payload:{project_accesses:n.map(u=>v(u))},blockers:n.flatMap(u=>[u.project,u.organization_access]),blocks:n.map(u=>u.uuid)});return c.then(u=>{this.dispatch(ym(u))}).catch(u=>{throw this.dispatch(Rn(n.map(m=>m.uuid))),u}),[n,c]}update(e){const{store:i}=this.client,a=wn(e.uuid)(i.getState()),n={...a,...e};this.dispatch(bt(n));const c=this.enqueueRequest({description:"Edit project access",method:l.PATCH,url:`/project-accesses/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[]});return c.then(r=>{this.dispatch(bt(r))}).catch(r=>{throw this.dispatch(bt(a)),r}),[n,c]}async remove(e){const{store:i}=this.client,a=wn(e)(i.getState());this.dispatch(_n(e));try{await this.enqueueRequest({description:"Delete project access",method:l.DELETE,url:`/project-accesses/${e}/`,blockers:[e],blocks:[]})}catch(n){throw this.dispatch(Pn(a)),n}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get project accesses",method:l.GET,url:"/project-accesses/",queryParams:{project__organization:e},blockers:[],blocks:[]},i);return this.dispatch(fm(a)),a}}class hF extends We{constructor(){super(...arguments);S(this,"name","Project Attachment");S(this,"url","/project-attachments");S(this,"addAttachments",bm);S(this,"updateAttachments",Om);S(this,"removeAttachments",En);S(this,"removeAttachment",_m);S(this,"setAttachment",Fm);S(this,"selectAttachment",wm)}buildOfflineAttachment(i){return b({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,project:i.modelUuid})}buildAttachmentPayload(i){return{...i,project:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.projectUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const n=await this.enqueueRequest({immediate:!0,description:"Get project attachments",method:l.GET,url:`${this.url}/`,queryParams:{project__organization:i},blockers:[],blocks:[]},a);return this.dispatch(gm(n)),n}}class mF extends R{async saveExisting(e){if(!e.uuid)throw new Error("You can only use this method to save existing project files. The one provided has no uuid.");const i={...e};delete i.file;const a=this.enqueueRequest({method:l.PATCH,url:`/project-files/${e.uuid}/`,payload:i,blockers:[e.uuid],blocks:[e.uuid]});return a.then(n=>{this.dispatch(jn(n))}),a}saveActive(){const{store:e}=this.client,i=e.getState(),a=i.projectFileReducer.activeProjectFileId;if(!a)throw new Error("No active project file");const n=i.projectFileReducer.instances[a];if(!n)throw new Error("No active project file");if(!n.bounds&&!n.canvas_bounds)throw new Error("Project file must either have bounds or canvas_bounds set");let c;if(typeof n.file=="string"&&!n.file.startsWith("blob:")){const m={...n};delete m.file,c={method:l.PATCH,url:`/project-files/${a}/`,payload:m,blockers:[a],blocks:[a]}}else c=new Promise((m,o)=>{this.client.files.uploadFileToS3(n.file_sha1).then(([h])=>{m({method:l.POST,url:"/project-files/",payload:{...n,...h},blockers:[a],blocks:[a]})}).catch(o)});const u=Promise.resolve(c).then(m=>this.enqueueRequest(m));return u.then(m=>{this.dispatch(jn(m))}),this.dispatch(km),this.dispatch(Cm(null)),this.dispatch(Dm(!1)),[n,u]}delete(e){return this.dispatch(zm(e)),this.enqueueRequest({method:l.DELETE,url:`/project-files/${e}`,blockers:[e],blocks:[]})}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get project files",method:l.GET,url:"/project-files/",queryParams:{limit:V,paginate:!0,project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get project files",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(jm(n)),n}}class pF extends R{async add(e){const i=await this.enqueueRequest({description:"Create project",method:l.POST,url:"/projects/",payload:v(e),blockers:[],blocks:[]});return this.dispatch(zn(i)),i}async update(e){if(!e.bounds&&!e.canvas_bounds)throw new Error("Project must either have bounds or canvas_bounds set");return this.dispatch(Hm(e)),await this.enqueueRequest({description:"Update project",method:l.PATCH,url:`/projects/${e.uuid}/`,payload:{name:e.name,bounds:e.bounds},blockers:[e.uuid],blocks:[e.uuid]})}async delete(e){const{store:i}=this.client,a=i.getState(),n=Ym(e)(a);if(!n)throw new Error("Expected project to exist");const c=$m(a).filter(m=>m.project===e);this.dispatch(Um(c.map(({uuid:m})=>m)));const r=Mm(n.uuid)(a);this.dispatch(En(r.map(({uuid:m})=>m)));const u=Im(e)(a);this.dispatch(Rn(u.map(({uuid:m})=>m))),this.dispatch(Un(n.uuid));try{await this.enqueueRequest({description:"Delete project",method:l.DELETE,url:`/projects/${e}/`,blockers:[e],blocks:[]}),this.dispatch(Un(n.uuid))}catch(m){throw this.dispatch(zn(n)),this.dispatch(On(Object.values(u))),this.dispatch(qm(c)),this.dispatch(Pm(r)),m}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch projects",method:l.GET,url:"/projects/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(Nm(a)),a}}class AF extends R{add(e){var c;const{store:i}=this.client,a=b({...e,created_by:(c=i.getState().userReducer.currentUser)==null?void 0:c.id});this.dispatch(Qm(a));const n=this.enqueueRequest({description:"Create team membership",method:l.POST,url:"/team-memberships/",payload:v(a),blockers:[e.team],blocks:[a.uuid]});return n.then(r=>{this.dispatch(Bn(r))}).catch(()=>{this.dispatch($n(a.uuid))}),[a,n]}bulkAdd(e){var r;const{store:i}=this.client,a=(r=i.getState().userReducer.currentUser)==null?void 0:r.id,n=e.map(u=>b({...u,created_by:a}));this.dispatch(xm(n));const c=this.enqueueRequest({description:"Create team memberships",method:l.POST,url:"/team-memberships/bulk/",payload:{team_memberships:n.map(u=>v(u))},blockers:n.map(u=>u.team),blocks:n.map(u=>u.uuid)});return c.then(u=>{this.dispatch(ep(u))}).catch(()=>{this.dispatch(tp(n.map(u=>u.uuid)))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=ap(e)(a);if(!n)throw new Error(`Expected team membership with uuid ${e} to exist`);this.dispatch($n(e));try{return await this.enqueueRequest({description:"Delete team membership",method:l.DELETE,url:`/team-memberships/${e}/`,blockers:[e],blocks:[e]})}catch(c){throw this.dispatch(Bn(n)),c}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch team memberships",method:l.GET,url:"/team-memberships/",queryParams:{team__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Xm(a)),a}}class fF extends R{add(e){var c;const{store:i}=this.client,a=b({...e,submitted_at:new Date().toISOString(),created_by:(c=i.getState().userReducer.currentUser)==null?void 0:c.id});this.dispatch(rp(a));const n=this.enqueueRequest({description:"Create team",method:l.POST,url:"/teams/",payload:v(a),blockers:[],blocks:[a.uuid]});return n.then(r=>{this.dispatch(Ft(r))}).catch(()=>{this.dispatch(Nn(a.uuid))}),[a,n]}update(e){const{store:i}=this.client,a=Wn(e.uuid)(i.getState());if(!a)throw new Error(`Expected team with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(dp(n));const c=this.enqueueRequest({description:"Update team",method:l.PATCH,url:`/teams/${e.uuid}/`,payload:v(e),blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(Ft(r))}).catch(()=>{this.dispatch(Ft(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Wn(e)(a);if(!n)throw new Error(`Expected team with uuid ${e} to exist`);this.dispatch(Nn(e));try{return await this.enqueueRequest({description:"Delete team",method:l.DELETE,url:`/teams/${e}/`,blockers:[e],blocks:[e]})}catch(c){throw this.dispatch(Ft(n)),c}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch teams",method:l.GET,url:"/teams/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(cp(a)),a}}class yF extends R{async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch organization users",method:l.GET,url:`/organizations/${e}/users/`,blockers:[],blocks:[]},i);return this.dispatch(Hh(a)),a}}class SF{constructor(e){S(this,"store");this.store=e}async enqueueRequest(e,i,a,n){return this._enqueueRequest(e,i,a,n).then(c=>{if(c instanceof D)throw c;return c})}_enqueueRequest(e,i,a,n){const c=new rc,r={...e,BASE_URL:i,serviceName:a};if(e.immediate){const u={...r,uuid:e.uuid??Xe.v4()},m={payload:u,type:"",meta:{offline:{effect:{timestamp:new Date().toISOString(),request:u,BASE_URL:i,serviceName:a}}}};Yn(m,this,n).then(o=>{c.resolve(o.body)}).catch(o=>{Zn(o,m),o instanceof Error?c.reject(o):c.reject(new Error((o??et).toString()))})}else{const u=this.store.dispatch(lm(r)),m=h=>{if(h)c.resolve(h.body);else{const p=new D({message:"Could not get a response from the server.",response:h,discard:!0});c.reject(p)}},o=h=>{h instanceof D?h.options.discard=!0:(console.error("Received an unexpected error while processing a request:",h,`
|
|
15
|
+
Converting error to APIError and discarding.`),h=new D({message:"An error occurred while processing the request.",innerError:h,discard:!0})),c.reject(h)};u.then(m,o)}return c}}class tt{constructor(){S(this,"graph");S(this,"requestAttemptCounter");this.graph=new Gp.DepGraph,this.requestAttemptCounter={}}static _fromOutbox(e){const i=new tt;for(let a=0;a<e.length;a++){const n=e[a];if(!n){console.error("Outbox item was undefined");continue}i.sneakRequest(n);for(let c=0;c<a;c++){const r=e[c];if(!r){console.error("Previous outbox item was undefined");continue}r.payload.uuid!==n.payload.uuid&&r.payload.blocks.some(u=>n.payload.blockers.includes(u))&&tt._addDependency(n.payload.uuid,r.payload.uuid,i.graph)}}return i}_addDependency(e,i){tt._addDependency(e,i,this.graph)}static _addDependency(e,i,a){if(e===i)throw new Error(`Tried to add dependency from node to itself: ${e}`);if(!a.hasNode(e))throw new Error(`Tried to add dependency from non-existent node: ${e} (to node: ${i})`);if(!a.hasNode(i))throw new Error(`Tried to add dependency to non-existent node: ${i} (from node: ${e})`);a.addDependency(e,i)}addRequest(e){if(this.graph.addNode(e.payload.uuid,e),!(e.payload.blockers.length===0||this.graph.size()===1))for(const i of this.graph.overallOrder()){if(i===e.payload.uuid)continue;const a=this.graph.getNodeData(i);e.payload.blockers.some(n=>a.payload.blocks.includes(n))&&this._addDependency(e.payload.uuid,i)}}insertRequest(e){this.graph.addNode(e.payload.uuid,e);for(const i of this.graph.overallOrder()){if(i===e.payload.uuid)continue;this.graph.getNodeData(i).payload.blockers.some(n=>e.payload.blocks.includes(n))&&this._addDependency(i,e.payload.uuid)}}sneakRequest(e){this.graph.addNode(e.payload.uuid,e)}_getNextNode(){const e=this.graph.overallOrder(!0);let i=1/0,a;for(const n of e){const c=this.requestAttemptCounter[n]||0;c<i&&(i=c,a=n)}return a}peek(){const e=this._getNextNode();if(e)return this.graph.getNodeData(e)}remove(e){this.graph.removeNode(e),delete this.requestAttemptCounter[e]}pop(){const e=this.peek();return e&&this.graph.removeNode(e.payload.uuid),e}getQueue(){const e=this.graph.overallOrder().map(a=>this.graph.getNodeData(a)),i=this._getNextNode();if(i){const a=this.graph.getNodeData(i),n=e.findIndex(c=>c.payload.uuid===a.payload.uuid);n!==-1&&(e.splice(n,1),e.unshift(a))}return e}getReady(){let e=this.graph.overallOrder(!0).map(i=>this.graph.getNodeData(i));return e=e.sort((i,a)=>i.meta.offline.effect.timestamp.localeCompare(a.meta.offline.effect.timestamp)),e=e.sort((i,a)=>{const n=this.requestAttemptCounter[i.payload.uuid]||0,c=this.requestAttemptCounter[a.payload.uuid]||0;return n-c}),e}registerRetry(e){this.requestAttemptCounter[e]=(this.requestAttemptCounter[e]||0)+1}}let Pp;function Op(t){Pp=t}function st(){return Pp}let _p;function Rp(t){_p=t}function vp(){return _p}let xn=null;function Ze(){const t=st();if(!t)return console.warn("Client store not set; cannot get outbox coordinator yet."),null;if(xn)return xn;const e=t.getState().offline.outbox,i=tt._fromOutbox(e);return xn=i,i}const IF=(t,e)=>{const i=new e(t);return Rp(i),Op(t),i};class TF{constructor(e){S(this,"_all");S(this,"_previous");this._all=[e],this._previous=e,this.then=this.then.bind(this),this.compile=this.compile.bind(this)}then(e){return this._previous&&(this._previous.next=e),this._all.push(e),this._previous=e,{then:this.then,compile:this.compile}}compile(){return this._all}}class ec{constructor(){S(this,"next");this.next=null}then(e){return new TF(this).then(e)}async run(e){if(this.next)return this.next.run(e);{if(console.debug("Middleware finished. Performing request:",e),!st())throw new Error("Client store not set");const a=vp();if(!a)throw new Error("Client SDK not set");return Yn(e,a)}}}class wp extends ec{async run(e){return super.run(e)}}class Mp extends ec{async run(e){return super.run(e)}}const Ep=new wp().then(new Mp).compile();function Vp(t){var e;return(e=Ep[0])==null?void 0:e.run(t)}var jp=(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))(jp||{});s.ALL_MIDDLEWARE=Ep,s.APIError=D,s.ATTACHMENT_PAGINATION_PAGE_SIZE=He,s.AgentService=cb,s.AssetAttachmentService=rb,s.AssetProcedureAttachmentService=db,s.AssetProcedureFieldValuesAttachmentService=lb,s.AssetProcedureFieldValuesService=hb,s.AssetProcedureFieldsAttachmentService=ub,s.AssetProcedureFieldsService=ob,s.AssetProcedureInstanceService=mb,s.AssetProcedureService=pb,s.AssetProcedureStepFieldValuesAttachmentService=yb,s.AssetProcedureStepFieldValuesService=Sb,s.AssetProcedureStepFieldsAttachmentService=Ab,s.AssetProcedureStepFieldsService=fb,s.AssetProcedureStepService=Ib,s.AssetService=Tb,s.AssetStageCompletionService=gb,s.AssetStageService=bb,s.AssetTypeAttachmentService=Fb,s.AssetTypeFieldValuesAttachmentService=_b,s.AssetTypeFieldValuesService=Rb,s.AssetTypeFieldsAttachmentService=Pb,s.AssetTypeFieldsService=Ob,s.AssetTypeIdentifierService=vb,s.AssetTypeIdentifierValueService=wb,s.AssetTypeService=Mb,s.AttachmentModel=nc,s.BaseApiService=R,s.BaseSDK=SF,s.COMMON_AUTO_FIELDS=hc,s.CategoryService=Eb,s.DEFAULT_ISSUE_PRIORITY=Np,s.DEFAULT_ISSUE_STATUS=Lp,s.DEFAULT_PAGINATION_PAGE_SIZE=V,s.DeferredPromise=rc,s.DocumentAttachmentService=Vb,s.DocumentService=jb,s.EMPTY_ARRAY=sc,s.EMPTY_OBJECT=ic,s.EmailDomainsService=qb,s.EmailVerificationService=zb,s.FileService=Db,s.FormIdentifierService=Cb,s.FormIdentifierValueService=kb,s.FormRevisionAttachmentService=Bb,s.FormRevisionService=$b,s.FormService=Gb,s.FormSubmissionAttachmentService=Lb,s.FormSubmissionService=Nb,s.GeoImageService=Hb,s.HttpMethod=l,s.IssueAssociationService=Wb,s.IssueAttachmentService=Kb,s.IssueCommentAttachmentService=Yb,s.IssueCommentService=Zb,s.IssuePriority=xt,s.IssueService=Jb,s.IssueStatus=es,s.IssueTypeAttachmentService=Xb,s.IssueTypeFieldValuesAttachmentService=eF,s.IssueTypeFieldValuesService=tF,s.IssueTypeFieldsAttachmentService=Qb,s.IssueTypeFieldsService=xb,s.IssueTypeIdentifierService=sF,s.IssueTypeIdentifierValueService=iF,s.IssueTypeService=aF,s.IssueUpdateChange=E,s.IssueUpdateService=nF,s.JWTService=dF,s.OUTBOX_RETRY_DELAY=cc,s.OfflineAnalyticsMiddleware=wp,s.OfflineMiddleware=ec,s.OrganizationAccessLevel=ac,s.OrganizationAccessService=uF,s.OrganizationService=oF,s.OutboxCoordinator=tt,s.ProjectAccessService=lF,s.ProjectAttachmentService=hF,s.ProjectFileService=mF,s.ProjectService=pF,s.RESET_ORGANIZATION_STATE=O,s.RESET_PROJECT_STATE=M,s.RESET_STATE=g,s.RateLimitingMiddleware=Mp,s.SelectorBuilder=Hg,s.TeamMembershipService=AF,s.TeamService=fF,s.UNKNOWN_ERROR_MESSAGE=et,s.UserService=yF,s.VERSION_REDUCER_KEY=it,s.VerificationCodeType=jp,s._setLatestRetryTime=mm,s.addAsset=Js,s.addAssetAttachment=SA,s.addAssetAttachments=us,s.addAssetProcedure=ws,s.addAssetProcedureAttachment=gA,s.addAssetProcedureAttachments=Vc,s.addAssetProcedureFieldValues=Ss,s.addAssetProcedureFieldValuesAttachment=BA,s.addAssetProcedureFieldValuesAttachments=_t,s.addAssetProcedureFieldValuesMany=lr,s.addAssetProcedureFields=Xc,s.addAssetProcedureFieldsAttachment=OA,s.addAssetProcedureFieldsAttachments=Lc,s.addAssetProcedureFieldsMany=VA,s.addAssetProcedureInstance=Fs,s.addAssetProcedureInstances=Sr,s.addAssetProcedureStep=Ws,s.addAssetProcedureStepFieldValues=Gs,s.addAssetProcedureStepFieldValuesAttachment=Of,s.addAssetProcedureStepFieldValuesAttachments=vt,s.addAssetProcedureStepFieldValuesMany=Wr,s.addAssetProcedureStepFields=zs,s.addAssetProcedureStepFieldsAttachment=uf,s.addAssetProcedureStepFieldsAttachments=vr,s.addAssetProcedureStepFieldsMany=ff,s.addAssetProcedureSteps=Df,s.addAssetProcedures=tf,s.addAssetStage=ui,s.addAssetStageCompletion=ii,s.addAssetStageCompletions=ai,s.addAssetStages=Xf,s.addAssetType=qi,s.addAssetTypeAttachment=iy,s.addAssetTypeAttachments=mi,s.addAssetTypeFieldValues=Ti,s.addAssetTypeFieldValuesAttachment=gy,s.addAssetTypeFieldValuesAttachments=Dt,s.addAssetTypeFieldValuesMany=xd,s.addAssetTypeFields=kd,s.addAssetTypeFieldsAttachment=cy,s.addAssetTypeFieldsAttachments=Ed,s.addAssetTypeFieldsMany=my,s.addAssetTypeIdentifier=Oi,s.addAssetTypeIdentifierValue=wi,s.addAssetTypeIdentifierValues=Dy,s.addAssetTypeIdentifiers=Ey,s.addAssetTypes=Wy,s.addAssets=jt,s.addCategories=tS,s.addCategory=ki,s.addConversation=yc,s.addConversations=lA,s.addDocumentAttachment=dS,s.addDocumentAttachments=vu,s.addDocuments=ku,s.addEmailDomain=Nu,s.addEmailDomains=AS,s.addForm=oa,s.addFormIdentifier=Zi,s.addFormIdentifierValue=xi,s.addFormIdentifierValues=wS,s.addFormIdentifiers=FS,s.addFormRevision=na,s.addFormRevisionAttachment=US,s.addFormRevisionAttachments=ho,s.addFormRevisions=Io,s.addFormSubmission=Aa,s.addFormSubmissionAttachment=eI,s.addFormSubmissionAttachments=$t,s.addFormSubmissions=ko,s.addForms=KS,s.addGeoImage=Ko,s.addGeoImages=Yo,s.addIssue=ka,s.addIssueAssociation=Fa,s.addIssueAssociations=Pa,s.addIssueAttachment=pI,s.addIssueAttachments=wa,s.addIssueComment=qa,s.addIssueCommentAttachment=yI,s.addIssueCommentAttachments=Sl,s.addIssueComments=bI,s.addIssueType=Mh,s.addIssueTypeAttachment=VI,s.addIssueTypeAttachments=Cl,s.addIssueTypeFieldValues=Ya,s.addIssueTypeFieldValuesAttachment=aT,s.addIssueTypeFieldValuesAttachments=Wt,s.addIssueTypeFieldValuesMany=LI,s.addIssueTypeFields=rh,s.addIssueTypeFieldsAttachment=UI,s.addIssueTypeFieldsAttachments=Zl,s.addIssueTypeFieldsMany=ZI,s.addIssueTypeIdentifier=sn,s.addIssueTypeIdentifierValue=rn,s.addIssueTypeIdentifierValues=fT,s.addIssueTypeIdentifiers=oT,s.addIssueTypes=FT,s.addIssueUpdate=Uh,s.addIssueUpdates=Dh,s.addIssues=jl,s.addOrganization=nm,s.addOrganizationAccess=xh,s.addOrganizationAccesses=LT,s.addOrganizations=QT,s.addProject=zn,s.addProjectAccess=Pn,s.addProjectAccesses=On,s.addProjectAttachment=lg,s.addProjectAttachments=bm,s.addProjectFile=Ag,s.addProjectFiles=qm,s.addProjects=Fg,s.addTeam=rp,s.addTeamMembership=Qm,s.addTeamMemberships=xm,s.addTeams=zg,s.addUser=Wh,s.addUsers=UT,s.agentsReducer=Tc,s.agentsSlice=ns,s.areArraysEqual=Kp,s.assetAttachmentReducer=wc,s.assetAttachmentSlice=rs,s.assetProcedureAttachmentReducer=Dc,s.assetProcedureAttachmentSlice=ls,s.assetProcedureFieldValuesAttachmentReducer=dr,s.assetProcedureFieldValuesAttachmentSlice=As,s.assetProcedureFieldValuesReducer=pr,s.assetProcedureFieldValuesSlice=ys,s.assetProcedureFieldsAttachmentReducer=Yc,s.assetProcedureFieldsAttachmentSlice=hs,s.assetProcedureFieldsReducer=tr,s.assetProcedureFieldsSlice=ms,s.assetProcedureInstanceReducer=Tr,s.assetProcedureInstanceSlice=bs,s.assetProcedureReducer=Pr,s.assetProcedureSlice=vs,s.assetProcedureStepFieldValuesAttachmentReducer=Lr,s.assetProcedureStepFieldValuesAttachmentSlice=ks,s.assetProcedureStepFieldValuesReducer=Jr,s.assetProcedureStepFieldValuesSlice=$s,s.assetProcedureStepFieldsAttachmentReducer=jr,s.assetProcedureStepFieldsAttachmentSlice=js,s.assetProcedureStepFieldsReducer=Ur,s.assetProcedureStepFieldsSlice=qs,s.assetProcedureStepReducer=ed,s.assetProcedureStepSlice=Hs,s.assetReducer=cd,s.assetSlice=Zs,s.assetStageCompletionReducer=ld,s.assetStageCompletionSlice=si,s.assetStageReducer=yd,s.assetStageSlice=di,s.assetTypeAttachmentReducer=vd,s.assetTypeAttachmentSlice=hi,s.assetTypeFieldValuesAttachmentReducer=Jd,s.assetTypeFieldValuesAttachmentSlice=yi,s.assetTypeFieldValuesReducer=iu,s.assetTypeFieldValuesSlice=Ii,s.assetTypeFieldsAttachmentReducer=Ud,s.assetTypeFieldsAttachmentSlice=Ai,s.assetTypeFieldsReducer=Ld,s.assetTypeFieldsSlice=fi,s.assetTypeIdentifierReducer=du,s.assetTypeIdentifierSlice=Pi,s.assetTypeIdentifierValueReducer=hu,s.assetTypeIdentifierValueSlice=vi,s.assetTypeReducer=fu,s.assetTypeSlice=ji,s.authReducer=Iu,s.authSlice=kt,s.baseReducer=Gg,s.baseReducers=Kn,s.blobToBase64=sA,s.categoryReducer=Ou,s.categorySlice=Ci,s.clearTokens=Qy,s.constructUploadedFilePayloads=tA,s.createModelAdapter=P,s.createOfflineAction=um,s.createPayload=v,s.createSelectionAdapter=Hp,s.deleteAsset=Xs,s.deleteAssetAttachment=Pc,s.deleteAssetAttachments=os,s.deleteAssetProcedure=Ms,s.deleteAssetProcedureAttachment=zc,s.deleteAssetProcedureAttachments=Uc,s.deleteAssetProcedureFieldValues=Is,s.deleteAssetProcedureFieldValuesAttachment=NA,s.deleteAssetProcedureFieldValuesAttachments=Rt,s.deleteAssetProcedureFieldValuesMany=mr,s.deleteAssetProcedureFields=xc,s.deleteAssetProcedureFieldsAttachment=wA,s.deleteAssetProcedureFieldsAttachments=Hc,s.deleteAssetProcedureFieldsMany=UA,s.deleteAssetProcedureInstance=Ps,s.deleteAssetProcedureInstances=Ir,s.deleteAssetProcedureStep=Ks,s.deleteAssetProcedureStepFieldValues=Ls,s.deleteAssetProcedureStepFieldValuesAttachment=wf,s.deleteAssetProcedureStepFieldValuesAttachments=wt,s.deleteAssetProcedureStepFieldValuesMany=Yr,s.deleteAssetProcedureStepFields=Us,s.deleteAssetProcedureStepFieldsAttachment=mf,s.deleteAssetProcedureStepFieldsAttachments=Mr,s.deleteAssetProcedureStepFieldsMany=Tf,s.deleteAssetProcedureSteps=kf,s.deleteAssetProcedures=af,s.deleteAssetStage=oi,s.deleteAssetStageCompletion=ni,s.deleteAssetStageCompletions=ci,s.deleteAssetStages=xf,s.deleteAssetType=zi,s.deleteAssetTypeAttachment=Fd,s.deleteAssetTypeAttachments=pi,s.deleteAssetTypeFieldValues=gi,s.deleteAssetTypeFieldValuesAttachment=Oy,s.deleteAssetTypeFieldValuesAttachments=Ct,s.deleteAssetTypeFieldValuesMany=tu,s.deleteAssetTypeFields=$d,s.deleteAssetTypeFieldsAttachment=oy,s.deleteAssetTypeFieldsAttachments=jd,s.deleteAssetTypeFieldsMany=yy,s.deleteAssetTypeIdentifier=_i,s.deleteAssetTypeIdentifierValue=Mi,s.deleteAssetTypeIdentifierValues=$y,s.deleteAssetTypeIdentifiers=zy,s.deleteAssetTypes=Yy,s.deleteAssets=Qs,s.deleteCategories=nS,s.deleteCategory=Fu,s.deleteConversation=pA,s.deleteConversations=AA,s.deleteDocumentAttachment=Eu,s.deleteDocumentAttachments=Vu,s.deleteEmailDomain=Hu,s.deleteEmailDomains=TS,s.deleteForm=la,s.deleteFormIdentifier=Ji,s.deleteFormIdentifierValue=ea,s.deleteFormIdentifierValues=jS,s.deleteFormIdentifiers=RS,s.deleteFormRevision=ca,s.deleteFormRevisionAttachment=BS,s.deleteFormRevisionAttachments=po,s.deleteFormRevisions=go,s.deleteFormSubmission=fa,s.deleteFormSubmissionAttachment=aI,s.deleteFormSubmissionAttachments=Gt,s.deleteFormSubmissions=$o,s.deleteForms=QS,s.deleteGeoImage=Ta,s.deleteGeoImages=Jo,s.deleteIssue=Ba,s.deleteIssueAssociation=Oa,s.deleteIssueAssociations=_a,s.deleteIssueAttachment=ll,s.deleteIssueAttachments=Ma,s.deleteIssueComment=Ua,s.deleteIssueCommentAttachment=gl,s.deleteIssueCommentAttachments=bl,s.deleteIssueComments=OI,s.deleteIssueType=_T,s.deleteIssueTypeAttachment=$l,s.deleteIssueTypeAttachments=Gl,s.deleteIssueTypeFieldValues=Za,s.deleteIssueTypeFieldValuesAttachment=dT,s.deleteIssueTypeFieldValuesAttachments=Kt,s.deleteIssueTypeFieldValuesMany=KI,s.deleteIssueTypeFields=uh,s.deleteIssueTypeFieldsAttachment=BI,s.deleteIssueTypeFieldsAttachments=Xl,s.deleteIssueTypeFieldsMany=xI,s.deleteIssueTypeIdentifier=an,s.deleteIssueTypeIdentifierValue=dn,s.deleteIssueTypeIdentifierValues=TT,s.deleteIssueTypeIdentifiers=pT,s.deleteIssueTypes=RT,s.deleteIssueUpdate=Ch,s.deleteIssueUpdates=kh,s.deleteIssues=ql,s.deleteOrganization=eg,s.deleteOrganizationAccess=em,s.deleteOrganizationAccesses=KT,s.deleteOrganizations=tg,s.deleteProject=Un,s.deleteProjectAccess=_n,s.deleteProjectAccesses=Rn,s.deleteProjectAttachment=_m,s.deleteProjectAttachments=En,s.deleteProjectFile=zm,s.deleteProjectFiles=Um,s.deleteProjects=Og,s.deleteTeam=Nn,s.deleteTeamMembership=$n,s.deleteTeamMemberships=tp,s.deleteTeams=Cg,s.deleteUser=Kh,s.deleteUsers=kT,s.dequeue=gp,s.discard=Zn,s.documentAttachmentReducer=Uu,s.documentAttachmentSlice=Gi,s.documentSlice=Li,s.documentsReducer=$u,s.downloadFile=iA,s.downloadInMemoryFile=eA,s.emailDomainsReducer=Yu,s.emailDomainsSlice=Wi,s.emailRegex=oA,s.enqueue=Tp,s.enqueueRequest=lm,s.fallbackToEmptyArray=I,s.fallbackToEmptyObject=Ot,s.fileReducer=xu,s.fileSlice=Ki,s.fileToBlob=oc,s.formIdentifierReducer=ao,s.formIdentifierSlice=Yi,s.formIdentifierValueReducer=uo,s.formIdentifierValueSlice=Qi,s.formReducer=_o,s.formRevisionAttachmentReducer=fo,s.formRevisionAttachmentSlice=ia,s.formRevisionReducer=Fo,s.formRevisionsSlice=aa,s.formSlice=ua,s.formSubmissionAttachmentReducer=Uo,s.formSubmissionAttachmentSlice=ha,s.formSubmissionReducer=Lo,s.formSubmissionSlice=pa,s.geoImageReducer=xo,s.geoImageSlice=Ia,s.getClientSDK=vp,s.getClientStore=st,s.getFileIdentifier=xp,s.getFileS3Key=as,s.getLocalDateString=dc,s.getLocalRelativeDateString=Xp,s.getOutboxCoordinator=Ze,s.getRenamedFile=uc,s.hashFile=Qe,s.initSDK=IF,s.initializeAssetAttachments=ds,s.initializeAssetProcedureAttachments=Ec,s.initializeAssetProcedureFieldValues=or,s.initializeAssetProcedureFieldValuesAttachments=ir,s.initializeAssetProcedureFields=Jc,s.initializeAssetProcedureFieldsAttachments=Gc,s.initializeAssetProcedureInstances=yr,s.initializeAssetProcedureStepFieldValues=Hr,s.initializeAssetProcedureStepFieldValuesAttachments=Cr,s.initializeAssetProcedureStepFields=zr,s.initializeAssetProcedureStepFieldsAttachments=Rr,s.initializeAssetProcedureSteps=Qr,s.initializeAssetProcedures=Fr,s.initializeAssetStageCompletions=dd,s.initializeAssetStages=Ad,s.initializeAssetTypeAttachments=Td,s.initializeAssetTypeFieldValues=Qd,s.initializeAssetTypeFieldValuesAttachments=Hd,s.initializeAssetTypeFields=Cd,s.initializeAssetTypeFieldsAttachments=Md,s.initializeAssetTypeIdentifierValues=ou,s.initializeAssetTypeIdentifiers=nu,s.initializeAssetTypes=pu,s.initializeAssets=id,s.initializeCategories=gu,s.initializeConversations=fc,s.initializeDocumentAttachments=Ru,s.initializeEmailDomains=Lu,s.initializeFormIdentifierValues=co,s.initializeFormIdentifiers=to,s.initializeFormRevisionAttachments=lo,s.initializeFormRevisions=So,s.initializeFormSubmissionAttachments=Eo,s.initializeFormSubmissions=Co,s.initializeForms=Oo,s.initializeGeoImages=Ho,s.initializeIssueAssociations=tl,s.initializeIssueAttachments=va,s.initializeIssueCommentAttachments=Va,s.initializeIssueComments=gI,s.initializeIssueTypeAttachments=Ha,s.initializeIssueTypeFieldValues=sh,s.initializeIssueTypeFieldValuesAttachments=mh,s.initializeIssueTypeFields=ch,s.initializeIssueTypeFieldsAttachments=Yl,s.initializeIssueTypeIdentifierValues=Oh,s.initializeIssueTypeIdentifiers=Th,s.initializeIssueTypes=wh,s.initializeIssueUpdates=zh,s.initializeIssues=Vl,s.initializeOrganizationAccesses=Qh,s.initializeOrganizations=am,s.initializeProjectAccesses=fm,s.initializeProjectAttachments=gm,s.initializeProjectFiles=jm,s.initializeProjects=Nm,s.initializeTeamMemberships=Xm,s.initializeTeams=cp,s.initializeUsers=Hh,s.isToday=Jp,s.issueAssociationReducer=rl,s.issueAssociationSlice=ba,s.issueAttachmentReducer=fl,s.issueAttachmentSlice=Ra,s.issueCommentAttachmentReducer=_l,s.issueCommentAttachmentSlice=Ea,s.issueCommentReducer=Ml,s.issueCommentSlice=ja,s.issueReducer=Ul,s.issueSlice=Ca,s.issueTypeAttachmentReducer=Wl,s.issueTypeAttachmentSlice=Na,s.issueTypeFieldValuesAttachmentReducer=Sh,s.issueTypeFieldValuesAttachmentSlice=xa,s.issueTypeFieldValuesReducer=ah,s.issueTypeFieldValuesSlice=Ka,s.issueTypeFieldsAttachmentReducer=eh,s.issueTypeFieldsAttachmentSlice=Wa,s.issueTypeFieldsReducer=lh,s.issueTypeFieldsSlice=Qa,s.issueTypeIdentifierReducer=Fh,s.issueTypeIdentifierSlice=tn,s.issueTypeIdentifierValueReducer=Rh,s.issueTypeIdentifierValueSlice=cn,s.issueTypeReducer=jh,s.issueTypeSlice=ln,s.issueUpdateReducer=Lh,s.issueUpdateSlice=An,s.logOnlyOnce=aA,s.markAsDeleted=hm,s.markForDeletion=cg,s.memoize=ss,s.offline=b,s.onlyUniqueHashes=uA,s.onlyUniqueOfflineIds=pc,s.organizationAccessReducer=tm,s.organizationAccessSlice=Sn,s.organizationReducer=dm,s.organizationSlice=gn,s.outboxReducer=pm,s.outboxSlice=bn,s.overmapEnhancer=xg,s.overmapReducer=Lg,s.overmapReducers=mp,s.performRequest=Yn,s.projectAccessReducer=Sm,s.projectAccessSlice=Fn,s.projectAttachmentReducer=Em,s.projectAttachmentSlice=Mn,s.projectFileReducer=Gm,s.projectFileSlice=Vn,s.projectReducer=Wm,s.projectSlice=qn,s.rehydratedReducer=Zm,s.rehydratedSlice=Cn,s.removeDocuments=Ni,s.removeIssueType=hn,s.resetProjectFileObjectUrls=yg,s.restructureCreateSelectorWithArgs=y,s.runMiddleware=Vp,s.saveActiveProjectFileBounds=km,s.selectAccessToken=xy,s.selectAccessesByUserOfProject=ug,s.selectAccessibleProjects=_g,s.selectActiveOrganizationAccess=YT,s.selectActiveProjectFileId=Ig,s.selectAllDocumentAttachments=qu,s.selectAllProjectAttachments=vm,s.selectAssetAttachmentById=Rc,s.selectAssetAttachmentMapping=Oc,s.selectAssetAttachments=_c,s.selectAssetById=ti,s.selectAssetProcedureAttachmentById=Bc,s.selectAssetProcedureAttachmentMapping=Cc,s.selectAssetProcedureAttachments=kc,s.selectAssetProcedureById=Vs,s.selectAssetProcedureFieldValues=Ts,s.selectAssetProcedureFieldValuesAttachmentById=HA,s.selectAssetProcedureFieldValuesAttachments=nr,s.selectAssetProcedureFieldValuesAttachmentsByIds=cr,s.selectAssetProcedureFieldValuesAttachmentsMapping=fs,s.selectAssetProcedureFieldValuesById=gs,s.selectAssetProcedureFieldValuesMapping=Ar,s.selectAssetProcedureFieldValuesOfAsset=YA,s.selectAssetProcedureFields=ps,s.selectAssetProcedureFieldsAttachmentById=EA,s.selectAssetProcedureFieldsAttachments=Kc,s.selectAssetProcedureFieldsAttachmentsMapping=Wc,s.selectAssetProcedureFieldsById=kA,s.selectAssetProcedureFieldsMapping=er,s.selectAssetProcedureFieldsOfAssetProcedure=DA,s.selectAssetProcedureInstanceById=Rs,s.selectAssetProcedureInstances=_s,s.selectAssetProcedureInstancesByIds=ef,s.selectAssetProcedureInstancesMapping=Os,s.selectAssetProcedureInstancesOfAssetProcedure=gr,s.selectAssetProcedureInstancesOfAssetType=xA,s.selectAssetProcedureStepById=Ys,s.selectAssetProcedureStepFieldValues=Mt,s.selectAssetProcedureStepFieldValuesAttachmentById=Mf,s.selectAssetProcedureStepFieldValuesAttachments=Br,s.selectAssetProcedureStepFieldValuesAttachmentsByIds=$r,s.selectAssetProcedureStepFieldValuesAttachmentsMapping=Bs,s.selectAssetProcedureStepFieldValuesById=Ns,s.selectAssetProcedureStepFieldValuesMapping=Zr,s.selectAssetProcedureStepFieldValuesOfAsset=jf,s.selectAssetProcedureStepFieldValuesOfAssetProcedureInstance=qf,s.selectAssetProcedureStepFieldValuesOfAssetProcedureStep=zf,s.selectAssetProcedureStepFields=Cs,s.selectAssetProcedureStepFieldsAttachmentById=Af,s.selectAssetProcedureStepFieldsAttachments=Vr,s.selectAssetProcedureStepFieldsAttachmentsMapping=Er,s.selectAssetProcedureStepFieldsById=Pf,s.selectAssetProcedureStepFieldsMapping=Ds,s.selectAssetProcedureStepFieldsOfAssetProcedureStep=gf,s.selectAssetProcedureStepMapping=Vt,s.selectAssetProcedureSteps=td,s.selectAssetProcedureStepsByIds=Gf,s.selectAssetProcedureStepsMappingOfAssetProcedure=Bf,s.selectAssetProcedureStepsOfAssetProcedure=$f,s.selectAssetProcedures=Or,s.selectAssetProceduresByIds=rf,s.selectAssetProceduresMapping=Es,s.selectAssetProceduresOfOrganization=df,s.selectAssetStageById=li,s.selectAssetStageCompletionById=hd,s.selectAssetStageCompletionMapping=ri,s.selectAssetStageCompletions=Zf,s.selectAssetStageCompletionsByIds=md,s.selectAssetStages=Sd,s.selectAssetStagesByIds=sy,s.selectAssetStagesMappingOfAssetProcedure=ey,s.selectAssetStagesOfAssetProcedure=ty,s.selectAssetTypeAttachmentById=_d,s.selectAssetTypeAttachmentMapping=Pd,s.selectAssetTypeAttachments=Od,s.selectAssetTypeById=Di,s.selectAssetTypeFieldValues=bi,s.selectAssetTypeFieldValuesAttachmentById=_y,s.selectAssetTypeFieldValuesAttachments=Kd,s.selectAssetTypeFieldValuesAttachmentsByIds=Yd,s.selectAssetTypeFieldValuesAttachmentsMapping=Si,s.selectAssetTypeFieldValuesById=Fi,s.selectAssetTypeFieldValuesMapping=su,s.selectAssetTypeFieldValuesOfAsset=wy,s.selectAssetTypeFields=Ut,s.selectAssetTypeFieldsAttachmentById=hy,s.selectAssetTypeFieldsAttachments=zd,s.selectAssetTypeFieldsAttachmentsMapping=qd,s.selectAssetTypeFieldsById=Ty,s.selectAssetTypeFieldsMapping=Gd,s.selectAssetTypeFieldsOfAssetType=Sy,s.selectAssetTypeIdentifierById=Ri,s.selectAssetTypeIdentifierMapping=cu,s.selectAssetTypeIdentifierValueById=Vi,s.selectAssetTypeIdentifierValueMapping=lu,s.selectAssetTypeIdentifierValues=Ei,s.selectAssetTypeIdentifierValuesOfAsset=Gy,s.selectAssetTypeIdentifierValuesOfIdentifier=Ly,s.selectAssetTypeIdentifiers=ru,s.selectAssetTypeIdentifiersOfAssetType=Uy,s.selectAssetTypeValuesOfAssetType=My,s.selectAssetTypes=Au,s.selectAssetTypesByIds=Zy,s.selectAssetTypesMapping=Ui,s.selectAssetTypesOfOrganization=Jy,s.selectAssets=ad,s.selectAssetsByIds=nd,s.selectAssetsMapping=xs,s.selectAssetsOfAssetType=ei,s.selectAttachmentsOfAsset=vc,s.selectAttachmentsOfAssetProcedure=PA,s.selectAttachmentsOfAssetProcedureFieldValues=rr,s.selectAttachmentsOfAssetProcedureFields=MA,s.selectAttachmentsOfAssetProcedureStepFieldValues=Gr,s.selectAttachmentsOfAssetProcedureStepFields=pf,s.selectAttachmentsOfAssetType=Rd,s.selectAttachmentsOfAssetTypeFieldValues=Zd,s.selectAttachmentsOfAssetTypeFields=ly,s.selectAttachmentsOfDocument=lS,s.selectAttachmentsOfFormRevision=$S,s.selectAttachmentsOfFormSubmission=zo,s.selectAttachmentsOfIssue=pl,s.selectAttachmentsOfIssueComment=TI,s.selectAttachmentsOfIssueType=zI,s.selectAttachmentsOfIssueTypeFieldValues=yh,s.selectAttachmentsOfIssueTypeFields=$I,s.selectAttachmentsOfProject=Mm,s.selectCategories=Pu,s.selectCategoriesByIds=cS,s.selectCategoriesOfProject=rS,s.selectCategoryById=$i,s.selectCategoryMapping=Bi,s.selectCommentsOfIssue=_I,s.selectConversation=yA,s.selectConversationMapping=cs,s.selectConversations=fA,s.selectCurrentUser=Zh,s.selectDeletedRequests=ag,s.selectDocumentAttachmentById=zu,s.selectDocumentAttachmentMapping=ju,s.selectDocumentById=Bu,s.selectDocuments=Hi,s.selectDocumentsByIds=hS,s.selectDocumentsMapping=Bt,s.selectEmailDomains=Ku,s.selectEmailDomainsAsMapping=Wu,s.selectEmailDomainsOfOrganization=gS,s.selectFieldValuesOfAssetProcedureInstance=ZA,s.selectFormById=wo,s.selectFormIdentifierById=Xi,s.selectFormIdentifierMapping=so,s.selectFormIdentifierValueById=sa,s.selectFormIdentifierValueMapping=ro,s.selectFormIdentifierValues=ta,s.selectFormIdentifierValuesOfFormSubmission=qS,s.selectFormIdentifierValuesOfIdentifier=zS,s.selectFormIdentifiers=io,s.selectFormIdentifiersOfForm=vS,s.selectFormMapping=Ro,s.selectFormRevisionAttachmentsMapping=Ao,s.selectFormRevisionById=HS,s.selectFormRevisionMapping=ra,s.selectFormRevisions=da,s.selectFormRevisionsOfForm=bo,s.selectFormSubmissionAttachemntsByIds=qo,s.selectFormSubmissionAttachments=ma,s.selectFormSubmissionAttachmentsMapping=jo,s.selectFormSubmissionById=Sa,s.selectFormSubmissions=rI,s.selectFormSubmissionsMapping=ya,s.selectFormSubmissionsOfForm=Go,s.selectForms=vo,s.selectFormsOfOrganization=xS,s.selectGeoImageById=ga,s.selectGeoImageMapping=Xo,s.selectGeoImages=Qo,s.selectGeoImagesOfProject=uI,s.selectIsImportingProjectFile=Tg,s.selectIsLoggedIn=eS,s.selectIssueAssociationById=il,s.selectIssueAssociationMapping=yt,s.selectIssueAssociations=mI,s.selectIssueAssociationsOfAsset=cl,s.selectIssueAssociationsOfIssue=nl,s.selectIssueAssociationsToIssue=al,s.selectIssueAttachmentById=Al,s.selectIssueAttachmentMapping=hl,s.selectIssueAttachments=ml,s.selectIssueById=La,s.selectIssueCommentAttachmentById=Ol,s.selectIssueCommentAttachmentMapping=Fl,s.selectIssueCommentAttachments=Pl,s.selectIssueCommentById=Da,s.selectIssueCommentMapping=wl,s.selectIssueMapping=$a,s.selectIssueTypeAttachmentById=Hl,s.selectIssueTypeAttachmentMapping=Ll,s.selectIssueTypeAttachments=Nl,s.selectIssueTypeById=pn,s.selectIssueTypeFieldValues=Ja,s.selectIssueTypeFieldValuesAttachmentById=uT,s.selectIssueTypeFieldValuesAttachments=en,s.selectIssueTypeFieldValuesAttachmentsByIds=fh,s.selectIssueTypeFieldValuesAttachmentsMapping=Ah,s.selectIssueTypeFieldValuesById=Xa,s.selectIssueTypeFieldValuesMapping=ih,s.selectIssueTypeFieldValuesOfIssue=YI,s.selectIssueTypeFields=Ht,s.selectIssueTypeFieldsAttachmentById=GI,s.selectIssueTypeFieldsAttachments=xl,s.selectIssueTypeFieldsAttachmentsMapping=Ql,s.selectIssueTypeFieldsById=iT,s.selectIssueTypeFieldsMapping=oh,s.selectIssueTypeFieldsOfIssueType=eT,s.selectIssueTypeIdentifierById=nn,s.selectIssueTypeIdentifierMapping=gh,s.selectIssueTypeIdentifierValueById=on,s.selectIssueTypeIdentifierValueMapping=_h,s.selectIssueTypeIdentifierValues=un,s.selectIssueTypeIdentifierValuesOfIdentifier=bT,s.selectIssueTypeIdentifierValuesOfIssue=gT,s.selectIssueTypeIdentifiers=bh,s.selectIssueTypeIdentifiersOfIssueType=AT,s.selectIssueTypeMapping=mn,s.selectIssueTypeValuesOfIssueType=sT,s.selectIssueTypes=Vh,s.selectIssueTypesByIds=vT,s.selectIssueTypesOfOrganization=wT,s.selectIssueUpdateMapping=Bh,s.selectIssueUpdates=$h,s.selectIssueUpdatesOfIssue=Gh,s.selectIssues=Ga,s.selectIssuesByIds=MI,s.selectIssuesOfIssueType=zl,s.selectIssuesOfProject=EI,s.selectLatestAssetProcedureFieldsOfAssetProcedure=CA,s.selectLatestAssetProcedureStepFieldsOfAssetProcedureStep=bf,s.selectLatestAssetTypeFieldsOfAssetType=Iy,s.selectLatestFieldsByAssetProcedureStep=Ff,s.selectLatestFormRevisionOfForm=WS,s.selectLatestIssueTypeFieldsOfIssueType=tT,s.selectLatestRetryTime=ng,s.selectMembershipsByUserOfTeam=jg,s.selectNumberOfAssetsOfAssetType=Wf,s.selectOrganizationAccessById=Tn,s.selectOrganizationAccessMapping=In,s.selectOrganizationAccessUserMapping=sm,s.selectOrganizationById=ig,s.selectOrganizationDocuments=pS,s.selectOrganizations=sg,s.selectOrganizationsMapping=rm,s.selectProjectAccessById=wn,s.selectProjectAccessMapping=vn,s.selectProjectAccesses=Jt,s.selectProjectAccessesOfProject=Im,s.selectProjectAttachmentById=wm,s.selectProjectAttachmentMapping=Rm,s.selectProjectById=Ym,s.selectProjectDocuments=mS,s.selectProjectFileById=Sg,s.selectProjectFileMapping=Bm,s.selectProjectFiles=$m,s.selectProjectMapping=Km,s.selectProjects=Dn,s.selectProjectsOfOrganization=Rg,s.selectRehydrated=Mg,s.selectStageMapping=zt,s.selectTeamById=Wn,s.selectTeamMembershipById=ap,s.selectTeamMemberships=Gn,s.selectTeamMembershipsMapping=ip,s.selectTeams=up,s.selectTeamsByIds=kg,s.selectTeamsMapping=Hn,s.selectTeamsOfOrganization=Bg,s.selectUploadUrl=Qu,s.selectUserById=Jh,s.selectUsers=yn,s.selectUsersByIds=GT,s.selectUsersMapping=Yt,s.selectUsersOfOrganization=ZT,s.selectUsersOfProject=og,s.selectUsersOfTeam=qg,s.setActiveProjectFileId=Cm,s.setAsset=Nf,s.setAssetAttachment=bc,s.setAssetAttachments=IA,s.setAssetProcedure=nf,s.setAssetProcedureAttachment=jc,s.setAssetProcedureAttachments=bA,s.setAssetProcedureFieldValues=WA,s.setAssetProcedureFieldValuesAttachment=$A,s.setAssetProcedureFieldValuesAttachments=GA,s.setAssetProcedureFieldValuesMany=KA,s.setAssetProcedureFields=jA,s.setAssetProcedureFieldsAttachment=_A,s.setAssetProcedureFieldsAttachments=RA,s.setAssetProcedureFieldsMany=qA,s.setAssetProcedureInstance=XA,s.setAssetProcedureInstances=QA,s.setAssetProcedureStep=xr,s.setAssetProcedureStepFieldValues=Ef,s.setAssetProcedureStepFieldValuesAttachment=_f,s.setAssetProcedureStepFieldValuesAttachments=Rf,s.setAssetProcedureStepFieldValuesMany=Vf,s.setAssetProcedureStepFields=yf,s.setAssetProcedureStepFieldsAttachment=of,s.setAssetProcedureStepFieldsAttachments=lf,s.setAssetProcedureStepFieldsMany=Sf,s.setAssetProcedureSteps=Uf,s.setAssetProcedures=cf,s.setAssetStage=fd,s.setAssetStageCompletion=Kf,s.setAssetStageCompletions=Yf,s.setAssetStages=Jf,s.setAssetType=Ny,s.setAssetTypeAttachment=gd,s.setAssetTypeAttachments=ay,s.setAssetTypeFieldValues=Ry,s.setAssetTypeFieldValuesAttachment=by,s.setAssetTypeFieldValuesAttachments=Fy,s.setAssetTypeFieldValuesMany=vy,s.setAssetTypeFields=py,s.setAssetTypeFieldsAttachment=ry,s.setAssetTypeFieldsAttachments=dy,s.setAssetTypeFieldsMany=Ay,s.setAssetTypeIdentifier=Vy,s.setAssetTypeIdentifierValue=Cy,s.setAssetTypeIdentifierValues=ky,s.setAssetTypeIdentifiers=jy,s.setAssetTypes=Hy,s.setAssets=Hf,s.setCategories=iS,s.setCategory=sS,s.setClientSDK=Rp,s.setClientStore=Op,s.setConversation=Sc,s.setConversations=hA,s.setCurrentUser=BT,s.setDocumentAttachment=wu,s.setDocumentAttachments=uS,s.setDocuments=Cu,s.setEmailDomain=fS,s.setEmailDomains=yS,s.setForm=YS,s.setFormIdentifier=PS,s.setFormIdentifierValue=MS,s.setFormIdentifierValues=ES,s.setFormIdentifiers=OS,s.setFormRevision=To,s.setFormRevisionAttachment=DS,s.setFormRevisionAttachments=CS,s.setFormRevisions=GS,s.setFormSubmission=Lt,s.setFormSubmissionAttachment=tI,s.setFormSubmissionAttachments=sI,s.setFormSubmissions=nI,s.setForms=ZS,s.setGeoImage=ft,s.setGeoImages=Wo,s.setIsImportingProjectFile=Dm,s.setIssue=RI,s.setIssueAssociation=lI,s.setIssueAssociations=oI,s.setIssueAttachment=ul,s.setIssueAttachments=AI,s.setIssueComment=za,s.setIssueCommentAttachment=Il,s.setIssueCommentAttachments=SI,s.setIssueComments=vl,s.setIssueType=gt,s.setIssueTypeAttachment=kl,s.setIssueTypeAttachments=jI,s.setIssueTypeFieldValues=NI,s.setIssueTypeFieldValuesAttachment=nT,s.setIssueTypeFieldValuesAttachments=cT,s.setIssueTypeFieldValuesMany=HI,s.setIssueTypeFields=JI,s.setIssueTypeFieldsAttachment=DI,s.setIssueTypeFieldsAttachments=CI,s.setIssueTypeFieldsMany=XI,s.setIssueTypeIdentifier=lT,s.setIssueTypeIdentifierValue=yT,s.setIssueTypeIdentifierValues=ST,s.setIssueTypeIdentifiers=hT,s.setIssueTypes=PT,s.setIssueUpdate=MT,s.setIssueUpdates=ET,s.setIssues=vI,s.setLoggedIn=Su,s.setOrganization=XT,s.setOrganizationAccess=NT,s.setOrganizationAccesses=HT,s.setOrganizations=JT,s.setProfilePicture=$T,s.setProject=bg,s.setProjectAccess=rg,s.setProjectAccesses=dg,s.setProjectAttachment=Fm,s.setProjectAttachments=Pm,s.setProjectFile=mg,s.setProjectFiles=pg,s.setProjects=gg,s.setRehydrated=wg,s.setTeam=Ft,s.setTeamMembership=Bn,s.setTeamMemberships=ep,s.setTeams=Ug,s.setTokens=Xy,s.setUploadUrl=Xu,s.setUser=zT,s.setUsers=qT,s.shallowEqual=Wp,s.slugify=rA,s.spacesToDashesLower=cA,s.teamMembershipReducer=sp,s.teamMembershipSlice=kn,s.teamReducer=op,s.teamSlice=Ln,s.toFileNameSafeString=nA,s.toOfflineIdRecord=mc,s.truncate=dA,s.updateAsset=ut,s.updateAssetAttachment=TA,s.updateAssetAttachments=Fc,s.updateAssetProcedure=ct,s.updateAssetProcedureAttachment=FA,s.updateAssetProcedureAttachments=qc,s.updateAssetProcedureFieldValues=at,s.updateAssetProcedureFieldValuesAttachment=LA,s.updateAssetProcedureFieldValuesAttachments=ar,s.updateAssetProcedureFieldValuesMany=hr,s.updateAssetProcedureFields=Qc,s.updateAssetProcedureFieldsAttachment=vA,s.updateAssetProcedureFieldsAttachments=Nc,s.updateAssetProcedureFieldsMany=zA,s.updateAssetProcedureInstance=nt,s.updateAssetProcedureInstances=JA,s.updateAssetProcedureStep=Et,s.updateAssetProcedureStepFieldValues=dt,s.updateAssetProcedureStepFieldValuesAttachment=vf,s.updateAssetProcedureStepFieldValuesAttachments=kr,s.updateAssetProcedureStepFieldValuesMany=Kr,s.updateAssetProcedureStepFields=rt,s.updateAssetProcedureStepFieldsAttachment=hf,s.updateAssetProcedureStepFieldsAttachments=wr,s.updateAssetProcedureStepFieldsMany=If,s.updateAssetProcedureSteps=Cf,s.updateAssetProcedures=sf,s.updateAssetStage=qt,s.updateAssetStageCompletion=ud,s.updateAssetStageCompletions=od,s.updateAssetStages=Qf,s.updateAssetType=mt,s.updateAssetTypeAttachment=ny,s.updateAssetTypeAttachments=bd,s.updateAssetTypeFieldValues=ot,s.updateAssetTypeFieldValuesAttachment=Py,s.updateAssetTypeFieldValuesAttachments=Wd,s.updateAssetTypeFieldValuesMany=eu,s.updateAssetTypeFields=Bd,s.updateAssetTypeFieldsAttachment=uy,s.updateAssetTypeFieldsAttachments=Vd,s.updateAssetTypeFieldsMany=fy,s.updateAssetTypeIdentifier=lt,s.updateAssetTypeIdentifierValue=ht,s.updateAssetTypeIdentifierValues=By,s.updateAssetTypeIdentifiers=qy,s.updateAssetTypes=Ky,s.updateAssets=Lf,s.updateCategories=aS,s.updateCategory=bu,s.updateConversation=Ic,s.updateConversations=mA,s.updateDocumentAttachment=oS,s.updateDocumentAttachments=Mu,s.updateDocuments=xe,s.updateEmailDomain=SS,s.updateEmailDomains=IS,s.updateForm=JS,s.updateFormIdentifier=pt,s.updateFormIdentifierValue=At,s.updateFormIdentifierValues=VS,s.updateFormIdentifiers=_S,s.updateFormRevision=LS,s.updateFormRevisionAttachment=kS,s.updateFormRevisionAttachments=mo,s.updateFormRevisions=NS,s.updateFormSubmission=Bo,s.updateFormSubmissionAttachment=iI,s.updateFormSubmissionAttachments=Vo,s.updateFormSubmissions=cI,s.updateForms=XS,s.updateGeoImage=Zo,s.updateGeoImages=dI,s.updateIssue=Nt,s.updateIssueAssociation=sl,s.updateIssueAssociations=hI,s.updateIssueAttachment=fI,s.updateIssueAttachments=ol,s.updateIssueComment=FI,s.updateIssueCommentAttachment=II,s.updateIssueCommentAttachments=Tl,s.updateIssueComments=PI,s.updateIssueType=Eh,s.updateIssueTypeAttachment=qI,s.updateIssueTypeAttachments=Bl,s.updateIssueTypeFieldValues=St,s.updateIssueTypeFieldValuesAttachment=rT,s.updateIssueTypeFieldValuesAttachments=ph,s.updateIssueTypeFieldValuesMany=WI,s.updateIssueTypeFields=dh,s.updateIssueTypeFieldsAttachment=kI,s.updateIssueTypeFieldsAttachments=Jl,s.updateIssueTypeFieldsMany=QI,s.updateIssueTypeIdentifier=It,s.updateIssueTypeIdentifierValue=Tt,s.updateIssueTypeIdentifierValues=IT,s.updateIssueTypeIdentifiers=mT,s.updateIssueTypes=OT,s.updateIssueUpdate=VT,s.updateIssueUpdates=jT,s.updateIssues=wI,s.updateOrganization=cm,s.updateOrganizationAccess=Zt,s.updateOrganizationAccesses=WT,s.updateOrganizations=xT,s.updateProject=Hm,s.updateProjectAccess=bt,s.updateProjectAccesses=ym,s.updateProjectAttachment=hg,s.updateProjectAttachments=Om,s.updateProjectFile=jn,s.updateProjectFiles=fg,s.updateProjects=Pg,s.updateTeam=dp,s.updateTeamMembership=Eg,s.updateTeamMemberships=Vg,s.updateTeams=Dg,s.updateUser=CT,s.updateUsers=DT,s.useSelectorBuilder=Ng,s.userReducer=Yh,s.userSlice=fn,s.versioningReducer=hp,s.versioningSlice=lp,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
|