@overmap-ai/core 1.0.78-improvements.1 → 1.0.78-model-service.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/constants/defaults.d.ts +1 -2
- package/dist/enums/access.d.ts +0 -5
- package/dist/enums/asset.d.ts +8 -0
- package/dist/enums/index.d.ts +1 -1
- package/dist/enums/issue.d.ts +7 -5
- package/dist/overmap-core.js +9261 -6472
- package/dist/overmap-core.umd.cjs +10 -10
- package/dist/sdk/base.d.ts +6 -2
- package/dist/sdk/constants.d.ts +5 -0
- package/dist/sdk/errors.d.ts +5 -0
- package/dist/sdk/index.d.ts +5 -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/performRequest.d.ts +6 -0
- package/dist/sdk/services/AgentService.d.ts +2 -2
- package/dist/sdk/services/AssetAttachmentService.d.ts +26 -28
- package/dist/sdk/services/AssetProcedureService.d.ts +22 -5
- package/dist/sdk/services/AssetProcedureStepFieldValuesAttachmentService.d.ts +21 -4
- package/dist/sdk/services/AssetProcedureStepFieldValuesService.d.ts +23 -6
- package/dist/sdk/services/AssetProcedureStepFieldsAttachmentService.d.ts +21 -4
- package/dist/sdk/services/AssetProcedureStepFieldsService.d.ts +22 -5
- package/dist/sdk/services/AssetProcedureStepService.d.ts +25 -9
- package/dist/sdk/services/AssetProcedureTypeAttachmentService.d.ts +39 -0
- package/dist/sdk/services/AssetProcedureTypeFieldValuesAttachmentService.d.ts +33 -0
- package/dist/sdk/services/AssetProcedureTypeFieldValuesService.d.ts +39 -0
- package/dist/sdk/services/AssetProcedureTypeFieldsAttachmentService.d.ts +30 -0
- package/dist/sdk/services/AssetProcedureTypeFieldsService.d.ts +26 -0
- package/dist/sdk/services/AssetProcedureTypeService.d.ts +28 -0
- package/dist/sdk/services/AssetService.d.ts +24 -7
- package/dist/sdk/services/AssetStageCompletionService.d.ts +22 -5
- package/dist/sdk/services/AssetStageService.d.ts +25 -9
- package/dist/sdk/services/AssetTypeAttachmentService.d.ts +26 -27
- package/dist/sdk/services/AssetTypeFieldValuesAttachmentService.d.ts +21 -4
- package/dist/sdk/services/AssetTypeFieldValuesService.d.ts +21 -4
- package/dist/sdk/services/AssetTypeFieldsAttachmentService.d.ts +22 -5
- package/dist/sdk/services/AssetTypeFieldsService.d.ts +21 -4
- package/dist/sdk/services/AssetTypeIdentifierService.d.ts +28 -0
- package/dist/sdk/services/AssetTypeIdentifierValueService.d.ts +28 -0
- package/dist/sdk/services/AssetTypeService.d.ts +22 -5
- package/dist/sdk/services/AssetTypeStatusService.d.ts +28 -0
- package/dist/sdk/services/BaseModelApiService.d.ts +27 -0
- package/dist/sdk/services/BaseOfflineAttachmentModelService.d.ts +23 -0
- package/dist/sdk/services/BaseOfflineModelApiService.d.ts +27 -0
- package/dist/sdk/services/BaseService.d.ts +5 -2
- package/dist/sdk/services/CategoryService.d.ts +22 -5
- package/dist/sdk/services/DocumentAttachmentService.d.ts +26 -27
- package/dist/sdk/services/DocumentService.d.ts +23 -7
- package/dist/sdk/services/EmailDomainsService.d.ts +21 -4
- package/dist/sdk/services/FileService.d.ts +5 -1
- package/dist/sdk/services/FormIdentifierService.d.ts +28 -0
- package/dist/sdk/services/FormIdentifierValueService.d.ts +28 -0
- package/dist/sdk/services/FormRevisionAttachmentService.d.ts +21 -4
- package/dist/sdk/services/FormRevisionService.d.ts +21 -4
- package/dist/sdk/services/FormService.d.ts +21 -4
- package/dist/sdk/services/FormSubmissionAttachmentService.d.ts +22 -5
- package/dist/sdk/services/FormSubmissionService.d.ts +22 -5
- package/dist/sdk/services/GeoImageService.d.ts +23 -6
- package/dist/sdk/services/IssueAssociationService.d.ts +22 -5
- package/dist/sdk/services/IssueAttachmentService.d.ts +26 -28
- package/dist/sdk/services/IssueCommentAttachmentService.d.ts +26 -28
- package/dist/sdk/services/IssueCommentService.d.ts +22 -5
- package/dist/sdk/services/IssueService.d.ts +22 -5
- package/dist/sdk/services/IssueTypeAttachmentService.d.ts +26 -28
- package/dist/sdk/services/IssueTypeFieldValuesAttachmentService.d.ts +21 -4
- package/dist/sdk/services/IssueTypeFieldValuesService.d.ts +22 -5
- package/dist/sdk/services/IssueTypeFieldsAttachmentService.d.ts +21 -4
- package/dist/sdk/services/IssueTypeFieldsService.d.ts +22 -5
- package/dist/sdk/services/IssueTypeIdentifierService.d.ts +28 -0
- package/dist/sdk/services/IssueTypeIdentifierValueService.d.ts +28 -0
- package/dist/sdk/services/IssueTypeService.d.ts +22 -5
- package/dist/sdk/services/IssueTypeStatusService.d.ts +28 -0
- package/dist/sdk/services/IssueUpdateService.d.ts +22 -5
- package/dist/sdk/services/JWTAuthService.d.ts +1 -1
- package/dist/sdk/services/OrganizationAccessService.d.ts +25 -7
- package/dist/sdk/services/OrganizationService.d.ts +24 -7
- package/dist/sdk/services/ProjectAccessService.d.ts +26 -6
- package/dist/sdk/services/ProjectAttachmentService.d.ts +26 -27
- package/dist/sdk/services/ProjectFileService.d.ts +21 -7
- package/dist/sdk/services/ProjectService.d.ts +23 -12
- package/dist/sdk/services/TeamMembershipService.d.ts +28 -0
- package/dist/sdk/services/TeamService.d.ts +22 -8
- package/dist/sdk/services/UserService.d.ts +22 -5
- package/dist/sdk/services/index.d.ts +18 -7
- package/dist/sdk/typings.d.ts +21 -55
- package/dist/store/adapters/modelAdapter.d.ts +13 -14
- package/dist/store/adapters/typings.d.ts +19 -0
- package/dist/store/constants.d.ts +3 -1
- package/dist/store/index.d.ts +1 -0
- package/dist/store/reducers.d.ts +45 -21
- package/dist/store/selectors/SelectorBuilder.d.ts +24 -0
- package/dist/store/selectors/hooks.d.ts +13 -0
- package/dist/store/selectors/index.d.ts +2 -0
- package/dist/store/slices/agentsSlice.d.ts +11 -18
- package/dist/store/slices/assetAttachmentSlice.d.ts +13 -39
- package/dist/store/slices/assetProcedureSlice.d.ts +29 -47
- package/dist/store/slices/assetProcedureStepFieldValuesAttachmentSlice.d.ts +25 -44
- package/dist/store/slices/assetProcedureStepFieldValuesSlice.d.ts +28 -46
- package/dist/store/slices/assetProcedureStepFieldsAttachmentSlice.d.ts +28 -46
- package/dist/store/slices/assetProcedureStepFieldsSlice.d.ts +41 -51
- package/dist/store/slices/assetProcedureStepSlice.d.ts +29 -47
- package/dist/store/slices/assetProcedureTypeAttachmentSlice.d.ts +22 -0
- package/dist/store/slices/assetProcedureTypeFieldValuesAttachmentSlice.d.ts +112 -0
- package/dist/store/slices/assetProcedureTypeFieldValuesSlice.d.ts +113 -0
- package/dist/store/slices/assetProcedureTypeFieldsAttachmentSlice.d.ts +112 -0
- package/dist/store/slices/assetProcedureTypeFieldsSlice.d.ts +23 -0
- package/dist/store/slices/assetProcedureTypeSlice.d.ts +22 -0
- package/dist/store/slices/assetSlice.d.ts +25 -44
- package/dist/store/slices/assetStageCompletionSlice.d.ts +26 -37
- package/dist/store/slices/assetStageSlice.d.ts +28 -47
- package/dist/store/slices/assetTypeAttachmentSlice.d.ts +12 -38
- package/dist/store/slices/assetTypeFieldValuesAttachmentSlice.d.ts +25 -44
- package/dist/store/slices/assetTypeFieldValuesSlice.d.ts +26 -44
- package/dist/store/slices/assetTypeFieldsAttachmentSlice.d.ts +26 -44
- package/dist/store/slices/assetTypeFieldsSlice.d.ts +26 -44
- package/dist/store/slices/assetTypeIdentifierSlice.d.ts +22 -0
- package/dist/store/slices/assetTypeIdentifierValueSlice.d.ts +23 -0
- package/dist/store/slices/assetTypeSlice.d.ts +12 -38
- package/dist/store/slices/assetTypeStatusSlice.d.ts +112 -0
- package/dist/store/slices/categorySlice.d.ts +28 -27
- package/dist/store/slices/documentAttachmentSlice.d.ts +13 -39
- package/dist/store/slices/documentSlice.d.ts +15 -108
- package/dist/store/slices/emailDomainsSlice.d.ts +33 -26
- package/dist/store/slices/formIdentifierSlice.d.ts +22 -0
- package/dist/store/slices/formIdentifierValueSlice.d.ts +23 -0
- package/dist/store/slices/formRevisionAttachmentSlice.d.ts +103 -37
- package/dist/store/slices/formRevisionSlice.d.ts +27 -33
- package/dist/store/slices/formSlice.d.ts +29 -34
- package/dist/store/slices/formSubmissionAttachmentSlice.d.ts +14 -38
- package/dist/store/slices/formSubmissionSlice.d.ts +11 -39
- package/dist/store/slices/geoImageSlice.d.ts +28 -46
- package/dist/store/slices/index.d.ts +15 -7
- package/dist/store/slices/issueAssociationSlice.d.ts +30 -48
- package/dist/store/slices/issueAttachmentSlice.d.ts +13 -39
- package/dist/store/slices/issueCommentAttachmentSlice.d.ts +13 -39
- package/dist/store/slices/issueCommentSlice.d.ts +13 -27
- package/dist/store/slices/issueSlice.d.ts +17 -29
- package/dist/store/slices/issueTypeAttachmentSlice.d.ts +11 -37
- package/dist/store/slices/issueTypeFieldValuesAttachmentSlice.d.ts +25 -44
- package/dist/store/slices/issueTypeFieldValuesSlice.d.ts +26 -44
- package/dist/store/slices/issueTypeFieldsAttachmentSlice.d.ts +26 -44
- package/dist/store/slices/issueTypeFieldsSlice.d.ts +26 -44
- package/dist/store/slices/issueTypeIdentifierSlice.d.ts +22 -0
- package/dist/store/slices/issueTypeIdentifierValueSlice.d.ts +23 -0
- package/dist/store/slices/issueTypeSlice.d.ts +13 -26
- package/dist/store/slices/issueTypeStatusSlice.d.ts +112 -0
- package/dist/store/slices/issueUpdateSlice.d.ts +14 -26
- package/dist/store/slices/organizationAccessSlice.d.ts +18 -20
- package/dist/store/slices/organizationSlice.d.ts +27 -51
- package/dist/store/slices/outboxSlice.d.ts +6 -7
- package/dist/store/slices/projectAccessSlice.d.ts +18 -23
- package/dist/store/slices/projectAttachmentSlice.d.ts +12 -38
- package/dist/store/slices/projectFileSlice.d.ts +28 -47
- package/dist/store/slices/projectSlice.d.ts +30 -51
- package/dist/store/slices/teamMembershipSlice.d.ts +23 -0
- package/dist/store/slices/teamSlice.d.ts +13 -25
- package/dist/store/slices/userSlice.d.ts +102 -42
- package/dist/store/store.d.ts +4 -14
- package/dist/store/typings.d.ts +18 -1
- package/dist/typings/files.d.ts +15 -14
- package/dist/typings/index.d.ts +0 -3
- package/dist/typings/models/agents.d.ts +2 -1
- package/dist/typings/models/assets.d.ts +80 -51
- package/dist/typings/models/base.d.ts +19 -13
- package/dist/typings/models/categories.d.ts +5 -6
- package/dist/typings/models/documents.d.ts +9 -4
- package/dist/typings/models/emailDomain.d.ts +2 -1
- package/dist/typings/models/emailVerification.d.ts +7 -5
- package/dist/typings/models/fields.d.ts +7 -7
- package/dist/typings/models/forms.d.ts +16 -11
- package/dist/typings/models/geoImages.d.ts +8 -8
- package/dist/typings/models/index.d.ts +0 -3
- package/dist/typings/models/issues.d.ts +70 -35
- package/dist/typings/models/organizations.d.ts +4 -5
- package/dist/typings/models/projects.d.ts +11 -10
- package/dist/typings/models/teams.d.ts +8 -5
- package/dist/typings/models/users.d.ts +4 -2
- package/dist/utils/index.d.ts +2 -2
- package/dist/utils/models/assets.d.ts +5 -0
- package/dist/utils/models/documents.d.ts +4 -0
- package/dist/utils/models/index.d.ts +3 -0
- package/dist/utils/models/issues.d.ts +2 -0
- package/dist/utils/uuid.d.ts +5 -0
- package/package.json +35 -53
- package/dist/enums/licenses.d.ts +0 -14
- package/dist/sdk/services/AssetProcedureAttachmentService.d.ts +0 -40
- package/dist/sdk/services/AssetProcedureFieldValuesAttachmentService.d.ts +0 -16
- package/dist/sdk/services/AssetProcedureFieldValuesService.d.ts +0 -22
- package/dist/sdk/services/AssetProcedureFieldsAttachmentService.d.ts +0 -13
- package/dist/sdk/services/AssetProcedureFieldsService.d.ts +0 -9
- package/dist/sdk/services/AssetProcedureInstanceService.d.ts +0 -11
- package/dist/sdk/services/BaseAttachmentService.d.ts +0 -38
- package/dist/sdk/services/BaseUploadService.d.ts +0 -10
- package/dist/sdk/services/LicenseService.d.ts +0 -14
- package/dist/store/slices/assetProcedureAttachmentSlice.d.ts +0 -48
- package/dist/store/slices/assetProcedureFieldValuesAttachmentSlice.d.ts +0 -131
- package/dist/store/slices/assetProcedureFieldValuesSlice.d.ts +0 -131
- package/dist/store/slices/assetProcedureFieldsAttachmentSlice.d.ts +0 -130
- package/dist/store/slices/assetProcedureFieldsSlice.d.ts +0 -131
- package/dist/store/slices/assetProcedureInstanceSlice.d.ts +0 -132
- package/dist/store/slices/licenseSlice.d.ts +0 -25
- package/dist/typings/colors.d.ts +0 -8
- package/dist/typings/json.d.ts +0 -6
- package/dist/typings/memoization.d.ts +0 -1
- package/dist/typings/models/attachments.d.ts +0 -31
- package/dist/typings/models/issueTypes.d.ts +0 -7
- package/dist/typings/models/license.d.ts +0 -13
- package/dist/typings/models/store.d.ts +0 -0
- package/dist/typings/search.d.ts +0 -23
- package/dist/utils/coordinates.d.ts +0 -4
- package/dist/utils/offline.d.ts +0 -13
- /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(i,j){typeof exports=="object"&&typeof module<"u"?j(exports,require("@redux-offline/redux-offline/lib/types"),require("@reduxjs/toolkit"),require("superagent"),require("uuid"),require("file-saver"),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("@redux-offline/redux-offline/lib/constants"),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","@redux-offline/redux-offline","@redux-offline/redux-offline/lib/defaults","buffer","localforage","redux-persist-migrate","@overmap-ai/forms","idb","@redux-offline/redux-offline/lib/constants","jwt-decode","dependency-graph","@tiptap/core"],j):(i=typeof globalThis<"u"?globalThis:i||self,j(i["overmap-core"]={},null,i.toolkit,i.request,i.uuid,i.fileSaver,i.reduxOffline,i.offlineConfig,null,i.localforage,i.createMigration,null,i.idb,i.constants,i.jwtDecode,i.dependencyGraph))})(this,function(i,j,l,Ve,Ie,im,am,ic,Ib,cm,nm,Rb,rm,dm,um,om){"use strict";var Fb=Object.defineProperty;var Tb=(i,j,l)=>j in i?Fb(i,j,{enumerable:!0,configurable:!0,writable:!0,value:l}):i[j]=l;var f=(i,j,l)=>Tb(i,typeof j!="symbol"?j+"":j,l);var sm;const ac=Object.freeze([]),cc=Object.freeze({});var Bt=(t=>(t[t.GUEST=0]="GUEST",t[t.BASIC=2]="BASIC",t[t.ADMIN=4]="ADMIN",t))(Bt||{}),Gt=(t=>(t[t.GUEST=0]="GUEST",t[t.BASIC=2]="BASIC",t[t.ADMIN=4]="ADMIN",t))(Gt||{}),h=(t=>(t.GET="GET",t.POST="POST",t.PATCH="PATCH",t.PUT="PUT",t.DELETE="DELETE",t))(h||{}),nc=(t=>(t.Issue="issue",t.Asset="asset",t.AssetType="asset_type",t.Project="project",t.Document="document",t))(nc||{}),Lt=(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))(Lt||{}),Nt=(t=>(t[t.BACKLOG=0]="BACKLOG",t[t.SELECTED=2]="SELECTED",t[t.DONE=4]="DONE",t))(Nt||{}),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||{}),rc=(t=>(t.COMPLETED="checkout.completed",t.CLOSED="checkout.closed",t))(rc||{}),dc=(t=>(t[t.PRO=0]="PRO",t))(dc||{}),uc=(t=>(t[t.ACTIVE=0]="ACTIVE",t[t.PAUSED=2]="PAUSED",t[t.CANCELLED=4]="CANCELLED",t[t.INACTIVE=6]="INACTIVE",t[t.PAST_DUE=8]="PAST_DUE",t))(uc||{});const lm=Nt.BACKLOG,hm=Lt.MEDIUM,oc=6e4;function F(t){return{addOne:(p,A)=>{const y=t(A.payload);p.instances[y]=A.payload},addMany:(p,A)=>{for(const y of A.payload){const b=t(y);p.instances[b]=y}},setOne:(p,A)=>{const y=t(A.payload);p.instances[y]=A.payload},setMany:(p,A)=>{for(const y of A.payload){const b=t(y);p.instances[b]=y}},updateOne:(p,A)=>{const y=t(A.payload);p.instances[y]=A.payload},updateMany:(p,A)=>{for(const y of A.payload){const b=t(y);p.instances[b]=y}},deleteOne:(p,A)=>{delete p.instances[A.payload]},deleteMany:(p,A)=>{for(const y of A.payload)delete p.instances[y]},initialize:(p,A)=>{p.instances={};for(const y of A.payload){const b=t(y);p.instances[b]=y}},getInitialState:p=>({...p,instances:{}})}}function mm(){return{initializeSelection:(m,d)=>{m.selection=Array.from(new Set(d.payload))},selectOne:(m,d)=>{new Set(m.selection).has(d.payload)||m.selection.push(d.payload)},selectMany:(m,d)=>{const o=new Set(m.selection);for(const p of d.payload)o.has(p)||o.add(p);m.selection=Array.from(o)},unselectOne:(m,d)=>{const o=new Set(m.selection);o.has(d.payload)&&(o.delete(d.payload),m.selection=Array.from(o))},unselectMany:(m,d)=>{const o=new Set(m.selection);for(const p of d.payload)o.has(p)&&o.delete(p);m.selection=Array.from(o)},toggleOne:(m,d)=>{const o=new Set(m.selection);o.has(d.payload)?o.delete(d.payload):o.add(d.payload),m.selection=Array.from(o)},toggleMany:(m,d)=>{const o=new Set(m.selection);for(const p of d.payload)o.has(p)?o.delete(p):o.add(p);m.selection=Array.from(o)},getInitialState:m=>({...m,selection:[]})}}const Ne="versioning",lc="RESET";sm=Symbol.toStringTag;class hc{constructor(){f(this,sm,"Promise");f(this,"_promise");f(this,"_resolve");f(this,"_reject");f(this,"_state","pending");this._resolve=null,this._reject=null,this._promise=new Promise((e,s)=>{this._resolve=e,this._reject=s})}get state(){return this._state}then(e,s){return this._promise.then(e,s)}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")}}const pm=t=>({type:"Point",coordinates:t}),Am=t=>({type:"MultiPoint",coordinates:t}),ym=(t,e)=>t[0]===e[0]&&t[1]===e[1];let Ht=!1;["true","1"].includes("".toLowerCase())&&(Ht=!0);function fm(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;const s=Object.keys(t),a=Object.keys(e),c=s.length;if(c!==a.length)return!1;for(let n=0;n<c;n++){const r=s[n];if(!Object.prototype.hasOwnProperty.call(e,r)||t[r]!==e[r])return!1}return!0}function Wt(t){const e={};return function(){const s=Array.prototype.slice.call(arguments);return s in e?(Ht&&console.debug(`Memoization debug: Using memorized return value for ${t.toString()}(`,s,")"),e[s]):(Ht&&console.debug(`Memoization debug: Cache miss! Memoizing ${t.toString()}(`,s,")"),e[s]=t.apply(this,s))}}function Sm(t,e){if(t.length!==e.length)return!1;for(let s=0;s<t.length;s++)if(t[s]!==e[s])return!1;return!0}const g=t=>t.length===0?ac:t,Re=t=>Object.keys(t).length===0?cc:t,mc=Wt(t=>{if(!t)return"";const e=new Date(t),s=e.getFullYear()===Kt.getFullYear(),a={day:"numeric",month:"short"};return s||(a.year="numeric"),e.toLocaleDateString([],a)}),gm=new Intl.RelativeTimeFormat([],{style:"long",numeric:"auto"}),bm=1e3*86400,Kt=new Date,Pm=t=>new Date(t).toDateString()===Kt.toDateString(),Fm=Wt((t,e,s)=>{const a=Math.round((new Date(t).getTime()-Kt.getTime())/bm);return a<e||a>s?mc(t):gm.format(a,"days")});function Tm(t){return new Uint8Array(t).reduce((s,a)=>s+a.toString(16).padStart(2,"0"),"")}const Yt=async(t,e)=>{e||(e=await ke(t));let s=t.type;if(s.includes("/")&&(s=s.split("/")[1]),!s)throw new Error(`Could not extract file type from ${t.type}`);return`${e}.${s}`};function ke(t){return new Promise((e,s)=>{const a=new FileReader;a.onload=()=>{const c=a.result;if(!c){s(new Error("FileReader did not return a valid ArrayBuffer."));return}crypto.subtle.digest("SHA-1",c).then(n=>{const r=Tm(n);e(r)})},a.readAsArrayBuffer(t)})}function Im(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 pc(t,e){return new File([t],e,{type:t.type})}function Rm(t,e){const s=document.createElement("a");s.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(e)),s.setAttribute("download",t),s.style.display="none",document.body.appendChild(s),s.click(),document.body.removeChild(s)}const Om=async t=>{const e={};for(const s of t){const a=await ke(s);e[a]={sha1:a,extension:s.name.split(".").pop()||"",file_type:s.type,size:s.size}}return Object.values(e)},Ac=async t=>(await fetch(t)).blob(),_m=t=>new Promise((e,s)=>{const a=new FileReader;a.onloadend=()=>{var c;e(((c=a.result)==null?void 0:c.toString())||"")},a.readAsDataURL(t)});function vm(t){const e=new Blob([t]);im.saveAs(e,t.name)}const yc={};function wm(t,e,s,...a){const c=yc[t];let n=!1;c?c[e]||(c[e]=!0,n=!0):(yc[t]={[e]:!0},n=!0),n&&console[s](...a)}const fc=["created_at","updated_at","index","revision"];function I(t){return{...t,uuid:Ie.v4()}}function Sc(t){const e={};for(const s of t)e[s.uuid]=s;return e}function Em(t,e=void 0,s=255){let a=t.replace(/[^a-z0-9_\-.]/gi,"_").replace(/_{2,}/g,"_");if(!e){const n=t.split(".");n.length>1&&(e=n[n.length-1])}e&&!e.startsWith(".")&&(e="."+e);const c=e?e.length:0;return a.length+c>s&&(a=a.slice(0,s-c)+(e||"")),a}function qm(t){return t.toLowerCase().replace(" ","-")}function jm(t,e=!1){return t.normalize("NFKD").toLowerCase().replace(/[^\w\s-]/g,"").trim().replace(/[-\s]+/g,e?"_":"-")}function Mm(t,e){if(t.length<=e)return t;const s=t.slice(0,e-1);return s.slice(0,s.lastIndexOf(" "))+"…"}const S=t=>e=>s=>t(s,e);function gc(t,e,s){return s.findIndex(a=>a.uuid===t.uuid)===e}function Vm(t,e,s){return s.findIndex(a=>a.file_sha1===t.file_sha1)===e}const km=/^.+@.+\..+$/;function _(t){const e={...t};for(const s of[...fc,"created_by"])s in e&&delete e[s];return e}const He=F(t=>t.uuid),bc=He.getInitialState({}),Jt=l.createSlice({name:"agents",initialState:bc,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,bc)),reducers:{initializeConversations:He.initialize,addConversation:He.addOne,setConversation:He.setOne,updateConversation:He.updateOne}}),{initializeConversations:Pc,addConversation:Fc,setConversation:Tc,updateConversation:Ic}=Jt.actions,Xt=t=>t.agentsReducer.instances,zm=l.createSelector([Xt],t=>Object.values(t)),Cm=S(l.createSelector([Xt,(t,e)=>e],(t,e)=>t[e])),Rc=Jt.reducer,k=F(t=>t.uuid),Oc=k.getInitialState({}),Qt=l.createSlice({name:"assetAttachments",initialState:Oc,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,Oc)),reducers:{initializeAssetAttachments:k.initialize,addAssetAttachment:k.addOne,addAssetAttachments:k.addMany,setAssetAttachment:k.setOne,setAssetAttachments:k.setMany,updateAssetAttachment:k.updateOne,updateAssetAttachments:k.updateMany,deleteAssetAttachment:k.deleteOne,deleteAssetAttachments:k.deleteMany}}),{initializeAssetAttachments:Zt,addAssetAttachment:Dm,addAssetAttachments:xt,setAssetAttachment:_c,setAssetAttachments:Um,updateAssetAttachment:$m,updateAssetAttachments:vc,deleteAssetAttachment:wc,deleteAssetAttachments:es}=Qt.actions,Ec=t=>t.assetAttachmentReducer.instances,qc=l.createSelector([Ec],t=>Object.values(t)),jc=t=>e=>e.assetAttachmentReducer.instances[t],Mc=S(l.createSelector([qc,(t,e)=>e],(t,e)=>g(t.filter(({asset:s})=>e===s)))),Vc=Qt.reducer,z=F(t=>t.uuid),kc=z.getInitialState({}),ts=l.createSlice({name:"assetProcedureAttachments",initialState:kc,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,kc)),reducers:{initializeAssetProcedureAttachments:z.initialize,addAssetProcedureAttachment:z.addOne,addAssetProcedureAttachments:z.addMany,setAssetProcedureAttachment:z.setOne,setAssetProcedureAttachments:z.setMany,updateAssetProcedureAttachment:z.updateOne,updateAssetProcedureAttachments:z.updateMany,deleteAssetProcedureAttachment:z.deleteOne,deleteAssetProcedureAttachments:z.deleteMany}}),{initializeAssetProcedureAttachments:zc,addAssetProcedureAttachment:Bm,addAssetProcedureAttachments:Cc,setAssetProcedureAttachment:Dc,setAssetProcedureAttachments:Gm,updateAssetProcedureAttachment:Lm,updateAssetProcedureAttachments:Uc,deleteAssetProcedureAttachment:$c,deleteAssetProcedureAttachments:Bc}=ts.actions,Gc=t=>t.assetProcedureAttachmentReducer.instances,Lc=l.createSelector([Gc],t=>Object.values(t)),Nc=t=>e=>e.assetProcedureAttachmentReducer.instances[t],Nm=S(l.createSelector([Lc,(t,e)=>e],(t,e)=>g(t.filter(({asset_procedure:s})=>e===s)))),Hc=ts.reducer,C=F(t=>t.uuid),Wc=C.getInitialState({}),ss=l.createSlice({name:"assetProcedureFieldsAttachments",initialState:Wc,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,Wc)),reducers:{initializeAssetProcedureFieldsAttachments:C.initialize,addAssetProcedureFieldsAttachment:C.addOne,addAssetProcedureFieldsAttachments:C.addMany,setAssetProcedureFieldsAttachment:C.setOne,setAssetProcedureFieldsAttachments:C.setMany,updateAssetProcedureFieldsAttachment:C.updateOne,updateAssetProcedureFieldsAttachments:C.updateMany,deleteAssetProcedureFieldsAttachment:C.deleteOne,deleteAssetProcedureFieldsAttachments:C.deleteMany}}),{initializeAssetProcedureFieldsAttachments:Kc,addAssetProcedureFieldsAttachment:Hm,addAssetProcedureFieldsAttachments:Yc,setAssetProcedureFieldsAttachment:Wm,setAssetProcedureFieldsAttachments:Km,updateAssetProcedureFieldsAttachment:Ym,updateAssetProcedureFieldsAttachments:Jc,deleteAssetProcedureFieldsAttachment:Jm,deleteAssetProcedureFieldsAttachments:Xc}=ss.actions,Qc=t=>t.assetProcedureFieldsAttachmentReducer.instances,Zc=l.createSelector([Qc],t=>Object.values(t)),Xm=S(l.createSelector([Zc,(t,e)=>e],(t,e)=>g(t.filter(s=>s.fields_revision===e)))),Qm=t=>e=>e.assetProcedureFieldsAttachmentReducer.instances[t],xc=ss.reducer,D=F(t=>t.uuid),en=D.getInitialState({}),is=l.createSlice({name:"assetProcedureFields",initialState:en,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,en)),reducers:{initializeAssetProcedureFields:D.initialize,addAssetProcedureFields:D.addOne,addAssetProcedureFieldsMany:D.addMany,setAssetProcedureFields:D.setOne,setAssetProcedureFieldsMany:D.setMany,updateAssetProcedureFields:D.updateOne,updateAssetProcedureFieldsMany:D.updateMany,deleteAssetProcedureFields:D.deleteOne,deleteAssetProcedureFieldsMany:D.deleteMany}}),{initializeAssetProcedureFields:tn,addAssetProcedureFields:sn,addAssetProcedureFieldsMany:Zm,setAssetProcedureFields:xm,setAssetProcedureFieldsMany:ep,updateAssetProcedureFields:an,updateAssetProcedureFieldsMany:tp,deleteAssetProcedureFields:cn,deleteAssetProcedureFieldsMany:sp}=is.actions,nn=t=>t.assetProcedureFieldsReducer.instances,as=l.createSelector([nn],t=>Object.values(t)),ip=S(l.createSelector([as,(t,e)=>e],(t,e)=>g(t.filter(s=>s.asset_procedure===e)))),ap=S(l.createSelector([as,(t,e)=>e],(t,e)=>t.filter(s=>s.asset_procedure===e).sort((s,a)=>s.submitted_at>a.submitted_at?-1:1)[0])),cp=t=>e=>e.assetProcedureFieldsReducer.instances[t],rn=is.reducer,U=F(t=>t.uuid),dn=U.getInitialState({}),cs=l.createSlice({name:"assetProcedureFieldValuesAttachments",initialState:dn,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,dn)),reducers:{initializeAssetProcedureFieldValuesAttachments:U.initialize,addAssetProcedureFieldValuesAttachment:U.addOne,addAssetProcedureFieldValuesAttachments:U.addMany,setAssetProcedureFieldValuesAttachment:U.setOne,setAssetProcedureFieldValuesAttachments:U.setMany,updateAssetProcedureFieldValuesAttachment:U.updateOne,updateAssetProcedureFieldValuesAttachments:U.updateMany,deleteAssetProcedureFieldValuesAttachment:U.deleteOne,deleteAssetProcedureFieldValuesAttachments:U.deleteMany}}),{initializeAssetProcedureFieldValuesAttachments:un,addAssetProcedureFieldValuesAttachment:np,addAssetProcedureFieldValuesAttachments:dt,setAssetProcedureFieldValuesAttachment:rp,setAssetProcedureFieldValuesAttachments:dp,updateAssetProcedureFieldValuesAttachment:up,updateAssetProcedureFieldValuesAttachments:on,deleteAssetProcedureFieldValuesAttachment:op,deleteAssetProcedureFieldValuesAttachments:ut}=cs.actions,ns=t=>t.assetProcedureFieldValuesAttachmentReducer.instances,ln=l.createSelector([ns],t=>Object.values(t)),lp=t=>e=>e.assetProcedureFieldValuesAttachmentReducer.instances[t],hn=S(l.createSelector([ns,(t,e)=>e],(t,e)=>{const s=new Set(e);return g(Object.values(t).filter(a=>s.has(a.uuid)))})),mn=S(l.createSelector([ln,(t,e)=>e],(t,e)=>g(t.filter(s=>s.field_values===e)))),pn=cs.reducer,$=F(t=>t.uuid),An=$.getInitialState({}),rs=l.createSlice({name:"assetProcedureFieldValues",initialState:An,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,An)),reducers:{initializeAssetProcedureFieldValues:$.initialize,addAssetProcedureFieldValues:$.addOne,addAssetProcedureFieldValuesMany:$.addMany,setAssetProcedureFieldValues:$.setOne,setAssetProcedureFieldValuesMany:$.setMany,updateAssetProcedureFieldValues:$.updateOne,updateAssetProcedureFieldValuesMany:$.updateMany,deleteAssetProcedureFieldValues:$.deleteOne,deleteAssetProcedureFieldValuesMany:$.deleteMany}}),{initializeAssetProcedureFieldValues:yn,addAssetProcedureFieldValues:ds,addAssetProcedureFieldValuesMany:fn,setAssetProcedureFieldValues:hp,setAssetProcedureFieldValuesMany:mp,updateAssetProcedureFieldValues:We,updateAssetProcedureFieldValuesMany:Sn,deleteAssetProcedureFieldValues:us,deleteAssetProcedureFieldValuesMany:gn}=rs.actions,bn=t=>t.assetProcedureFieldValuesReducer.instances,os=l.createSelector([bn],t=>Object.values(t)),pp=S(l.createSelector([os,(t,e)=>e],(t,e)=>g(t.filter(s=>s.asset===e)))),Ap=S(l.createSelector([os,(t,e)=>e],(t,e)=>g(t.filter(s=>s.asset_procedure_instance===e)))),ls=t=>e=>e.assetProcedureFieldValuesReducer.instances[t],Pn=rs.reducer,B=F(t=>t.uuid),Fn=B.getInitialState({}),hs=l.createSlice({name:"assetProcedureInstances",initialState:Fn,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,Fn)),reducers:{initializeAssetProcedureInstances:B.initialize,addAssetProcedureInstance:B.addOne,addAssetProcedureInstances:B.addMany,setAssetProcedureInstance:B.setOne,setAssetProcedureInstances:B.setMany,updateAssetProcedureInstance:B.updateOne,updateAssetProcedureInstances:B.updateMany,deleteAssetProcedureInstance:B.deleteOne,deleteAssetProcedureInstances:B.deleteMany}}),{initializeAssetProcedureInstances:Tn,addAssetProcedureInstance:ms,addAssetProcedureInstances:In,updateAssetProcedureInstance:Ke,updateAssetProcedureInstances:yp,deleteAssetProcedureInstance:ps,deleteAssetProcedureInstances:Rn,setAssetProcedureInstance:fp,setAssetProcedureInstances:Sp}=hs.actions,As=t=>t.assetProcedureInstanceReducer.instances,ys=l.createSelector([As],t=>Object.values(t)),On=S(l.createSelector([ys,(t,e)=>e],(t,e)=>g(t.filter(s=>s.asset_procedure===e)))),gp=S(l.createSelector([ys,(t,e)=>e],(t,e)=>g(t.filter(s=>s.asset_type===e)))),fs=t=>e=>e.assetProcedureInstanceReducer.instances[t],bp=S(l.createSelector([As,(t,e)=>e],(t,e)=>{const s=[];for(const a of e){const c=t[a];c&&s.push(c)}return g(s)})),_n=hs.reducer,G=F(t=>t.uuid),vn=G.getInitialState({}),Ss=l.createSlice({name:"assetProcedures",initialState:vn,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,vn)),reducers:{initializeAssetProcedures:G.initialize,addAssetProcedure:G.addOne,addAssetProcedures:G.addMany,setAssetProcedure:G.setOne,setAssetProcedures:G.setMany,updateAssetProcedure:G.updateOne,updateAssetProcedures:G.updateMany,deleteAssetProcedure:G.deleteOne,deleteAssetProcedures:G.deleteMany}}),{initializeAssetProcedures:wn,addAssetProcedure:gs,addAssetProcedures:Pp,updateAssetProcedure:Ye,updateAssetProcedures:Fp,deleteAssetProcedure:bs,deleteAssetProcedures:Tp,setAssetProcedure:Ip,setAssetProcedures:Rp}=Ss.actions,Ps=t=>t.assetProcedureReducer.instances,En=l.createSelector([Ps],t=>Object.values(t)),Op=S(l.createSelector([En,(t,e)=>e],(t,e)=>g(t.filter(s=>s.organization===e)))),Fs=t=>e=>e.assetProcedureReducer.instances[t],_p=S(l.createSelector([Ps,(t,e)=>e],(t,e)=>{const s=[];for(const a of e){const c=t[a];c&&s.push(c)}return g(s)})),qn=Ss.reducer,L=F(t=>t.uuid),jn=L.getInitialState({}),Ts=l.createSlice({name:"assetProcedureStepFieldsAttachments",initialState:jn,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,jn)),reducers:{initializeAssetProcedureStepFieldsAttachments:L.initialize,addAssetProcedureStepFieldsAttachment:L.addOne,addAssetProcedureStepFieldsAttachments:L.addMany,setAssetProcedureStepFieldsAttachment:L.setOne,setAssetProcedureStepFieldsAttachments:L.setMany,updateAssetProcedureStepFieldsAttachment:L.updateOne,updateAssetProcedureStepFieldsAttachments:L.updateMany,deleteAssetProcedureStepFieldsAttachment:L.deleteOne,deleteAssetProcedureStepFieldsAttachments:L.deleteMany}}),{initializeAssetProcedureStepFieldsAttachments:Mn,addAssetProcedureStepFieldsAttachment:vp,addAssetProcedureStepFieldsAttachments:Vn,setAssetProcedureStepFieldsAttachment:wp,setAssetProcedureStepFieldsAttachments:Ep,updateAssetProcedureStepFieldsAttachment:qp,updateAssetProcedureStepFieldsAttachments:kn,deleteAssetProcedureStepFieldsAttachment:jp,deleteAssetProcedureStepFieldsAttachments:zn}=Ts.actions,Cn=t=>t.assetProcedureStepFieldsAttachmentReducer.instances,Dn=l.createSelector([Cn],t=>Object.values(t)),Mp=S(l.createSelector([Dn,(t,e)=>e],(t,e)=>g(t.filter(s=>s.fields_revision===e)))),Vp=t=>e=>e.assetProcedureStepFieldsAttachmentReducer.instances[t],Un=Ts.reducer,N=F(t=>t.uuid),$n=N.getInitialState({}),Is=l.createSlice({name:"assetProcedureStepFields",initialState:$n,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,$n)),reducers:{initializeAssetProcedureStepFields:N.initialize,addAssetProcedureStepFields:N.addOne,addAssetProcedureStepFieldsMany:N.addMany,setAssetProcedureStepFields:N.setOne,setAssetProcedureStepFieldsMany:N.setMany,updateAssetProcedureStepFields:N.updateOne,updateAssetProcedureStepFieldsMany:N.updateMany,deleteAssetProcedureStepFields:N.deleteOne,deleteAssetProcedureStepFieldsMany:N.deleteMany}}),{initializeAssetProcedureStepFields:Bn,addAssetProcedureStepFields:Rs,addAssetProcedureStepFieldsMany:kp,setAssetProcedureStepFields:zp,setAssetProcedureStepFieldsMany:Cp,updateAssetProcedureStepFields:Je,updateAssetProcedureStepFieldsMany:Dp,deleteAssetProcedureStepFields:Os,deleteAssetProcedureStepFieldsMany:Up}=Is.actions,_s=t=>t.assetProcedureStepFieldsReducer.instances,vs=l.createSelector([_s],t=>Object.values(t)),$p=S(l.createSelector([vs,(t,e)=>e],(t,e)=>g(t.filter(s=>s.asset_procedure_step===e)))),Bp=S(l.createSelector([vs,(t,e)=>e],(t,e)=>t.filter(s=>s.asset_procedure_step===e).sort((s,a)=>s.submitted_at>a.submitted_at?-1:1)[0])),Gp=l.createSelector([_s],t=>{const e={};for(const s of Object.values(t)){const a=e[s.asset_procedure_step];(!a||a.submitted_at<s.submitted_at)&&(e[s.asset_procedure_step]=s)}return e}),Lp=t=>e=>e.assetProcedureStepFieldsReducer.instances[t],Gn=Is.reducer,H=F(t=>t.uuid),Ln=H.getInitialState({}),ws=l.createSlice({name:"assetProcedureStepFieldValuesAttachments",initialState:Ln,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,Ln)),reducers:{initializeAssetProcedureStepFieldValuesAttachments:H.initialize,addAssetProcedureStepFieldValuesAttachment:H.addOne,addAssetProcedureStepFieldValuesAttachments:H.addMany,setAssetProcedureStepFieldValuesAttachment:H.setOne,setAssetProcedureStepFieldValuesAttachments:H.setMany,updateAssetProcedureStepFieldValuesAttachment:H.updateOne,updateAssetProcedureStepFieldValuesAttachments:H.updateMany,deleteAssetProcedureStepFieldValuesAttachment:H.deleteOne,deleteAssetProcedureStepFieldValuesAttachments:H.deleteMany}}),{initializeAssetProcedureStepFieldValuesAttachments:Nn,addAssetProcedureStepFieldValuesAttachment:Np,addAssetProcedureStepFieldValuesAttachments:ot,setAssetProcedureStepFieldValuesAttachment:Hp,setAssetProcedureStepFieldValuesAttachments:Wp,updateAssetProcedureStepFieldValuesAttachment:Kp,updateAssetProcedureStepFieldValuesAttachments:Hn,deleteAssetProcedureStepFieldValuesAttachment:Yp,deleteAssetProcedureStepFieldValuesAttachments:lt}=ws.actions,Es=t=>t.assetProcedureStepFieldValuesAttachmentReducer.instances,Wn=l.createSelector([Es],t=>Object.values(t)),Jp=t=>e=>e.assetProcedureStepFieldValuesAttachmentReducer.instances[t],Kn=S(l.createSelector([Es,(t,e)=>e],(t,e)=>{const s=new Set(e);return g(Object.values(t).filter(a=>s.has(a.uuid)))})),Yn=S(l.createSelector([Wn,(t,e)=>e],(t,e)=>g(t.filter(s=>s.field_values===e)))),Jn=ws.reducer,W=F(t=>t.uuid),Xn=W.getInitialState({}),qs=l.createSlice({name:"assetProcedureStepFieldValues",initialState:Xn,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,Xn)),reducers:{initializeAssetProcedureStepFieldValues:W.initialize,addAssetProcedureStepFieldValues:W.addOne,addAssetProcedureStepFieldValuesMany:W.addMany,setAssetProcedureStepFieldValues:W.setOne,setAssetProcedureStepFieldValuesMany:W.setMany,updateAssetProcedureStepFieldValues:W.updateOne,updateAssetProcedureStepFieldValuesMany:W.updateMany,deleteAssetProcedureStepFieldValues:W.deleteOne,deleteAssetProcedureStepFieldValuesMany:W.deleteMany}}),{initializeAssetProcedureStepFieldValues:Qn,addAssetProcedureStepFieldValues:js,addAssetProcedureStepFieldValuesMany:Zn,setAssetProcedureStepFieldValues:Xp,setAssetProcedureStepFieldValuesMany:Qp,updateAssetProcedureStepFieldValues:Xe,updateAssetProcedureStepFieldValuesMany:xn,deleteAssetProcedureStepFieldValues:Ms,deleteAssetProcedureStepFieldValuesMany:er}=qs.actions,tr=t=>t.assetProcedureStepFieldValuesReducer.instances,ht=l.createSelector([tr],t=>Object.values(t)),Zp=S(l.createSelector([ht,(t,e)=>e],(t,e)=>g(t.filter(s=>s.asset===e)))),xp=S(l.createSelector([ht,(t,e)=>e],(t,e)=>g(t.filter(s=>s.asset_procedure_instance===e)))),eA=S(l.createSelector([ht,(t,e)=>e],(t,e)=>g(t.filter(s=>s.asset_procedure_step===e)))),Vs=t=>e=>e.assetProcedureStepFieldValuesReducer.instances[t],sr=qs.reducer,K=F(t=>t.uuid),ir=K.getInitialState({}),ks=l.createSlice({name:"assetProcedureSteps",initialState:ir,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,ir)),reducers:{initializeAssetProcedureSteps:K.initialize,setAssetProcedureStep:K.setOne,setAssetProcedureSteps:K.setMany,addAssetProcedureStep:K.addOne,addAssetProcedureSteps:K.addMany,updateAssetProcedureStep:K.updateOne,updateAssetProcedureSteps:K.updateMany,deleteAssetProcedureStep:K.deleteOne,deleteAssetProcedureSteps:K.deleteMany}}),{initializeAssetProcedureSteps:ar,setAssetProcedureStep:cr,setAssetProcedureSteps:tA,addAssetProcedureStep:sA,addAssetProcedureSteps:zs,updateAssetProcedureStep:Cs,updateAssetProcedureSteps:mt,deleteAssetProcedureStep:iA,deleteAssetProcedureSteps:Ds}=ks.actions,nr=ks.reducer,pt=t=>t.assetProcedureStepReducer.instances,rr=t=>e=>e.assetProcedureStepReducer.instances[t],dr=l.createSelector([pt],t=>Object.values(t)),aA=S(l.createSelector([pt,(t,e)=>e],(t,e)=>{const s={};for(const[a,c]of Object.entries(t))c.asset_procedure===e&&(s[a]=c);return Re(s)})),cA=S(l.createSelector([dr,(t,e)=>e],(t,e)=>g(t.filter(s=>s.asset_procedure===e)))),Us=S(l.createSelector([pt,(t,e)=>e],(t,e)=>{const s=[];for(const a of e){const c=t[a];c?s.push(c):console.warn("selectAssetProcedureStepsByIds: No step exists with the id",a)}return g(s)})),Y=F(t=>t.uuid),ur=Y.getInitialState({}),$s=l.createSlice({name:"assets",initialState:ur,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,ur)),reducers:{initializeAssets:Y.initialize,addAsset:Y.addOne,addAssets:Y.addMany,setAsset:Y.setOne,setAssets:Y.setMany,updateAsset:Y.updateOne,updateAssets:Y.updateMany,deleteAsset:Y.deleteOne,deleteAssets:Y.deleteMany}}),{initializeAssets:or,addAsset:Bs,addAssets:At,updateAsset:Qe,updateAssets:nA,deleteAsset:Gs,deleteAssets:Ls,setAsset:rA,setAssets:dA}=$s.actions,Ns=t=>t.assetReducer.instances,lr=l.createSelector([Ns],t=>g(Object.values(t))),Hs=S(l.createSelector([lr,(t,e)=>e],(t,e)=>g(t.filter(s=>s.asset_type===e)))),Ws=t=>e=>e.assetReducer.instances[t],hr=S(l.createSelector([Ns,(t,e)=>e],(t,e)=>{const s=[];for(const a of e){const c=t[a];c&&s.push(c)}return g(s)})),uA=t=>e=>Hs(t)(e).length,mr=$s.reducer,Pe=F(t=>t.uuid),pr=Pe.getInitialState({}),Ks=l.createSlice({name:"assetStageCompletions",initialState:pr,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,pr)),reducers:{initializeAssetStageCompletions:Pe.initialize,addAssetStageCompletion:Pe.addOne,addAssetStageCompletions:Pe.addMany,updateAssetStageCompletion:Pe.updateOne,updateAssetStageCompletions:Pe.updateMany,deleteAssetStageCompletion:Pe.deleteOne,deleteAssetStageCompletions:Pe.deleteMany}}),{initializeAssetStageCompletions:Ar,addAssetStageCompletion:Ys,addAssetStageCompletions:Js,updateAssetStageCompletion:yr,updateAssetStageCompletions:fr,deleteAssetStageCompletion:Xs,deleteAssetStageCompletions:Qs}=Ks.actions,Sr=Ks.reducer,Zs=t=>t.assetStageCompletionReducer.instances,oA=l.createSelector([Zs],t=>Object.values(t)),gr=t=>e=>e.assetStageCompletionReducer.instances[t],br=S(l.createSelector([Zs,(t,e)=>e],(t,e)=>{const s=new Set(e);return g(Object.values(t).filter(a=>s.has(a.uuid)))})),J=F(t=>t.uuid),Pr=J.getInitialState({}),xs=l.createSlice({name:"assetStages",initialState:Pr,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,Pr)),reducers:{initializeAssetStages:J.initialize,setAssetStage:J.setOne,setAssetStages:J.setMany,addAssetStage:J.addOne,addAssetStages:J.addMany,updateAssetStage:J.updateOne,updateAssetStages:J.updateMany,deleteAssetStage:J.deleteOne,deleteAssetStages:J.deleteMany}}),{initializeAssetStages:Fr,setAssetStage:Tr,setAssetStages:lA,addAssetStage:hA,addAssetStages:ei,updateAssetStage:ti,updateAssetStages:yt,deleteAssetStage:mA,deleteAssetStages:si}=xs.actions,Ir=xs.reducer,ft=t=>t.assetStageReducer.instances,Rr=t=>e=>e.assetStageReducer.instances[t],Or=l.createSelector([ft],t=>Object.values(t)),pA=S(l.createSelector([ft,(t,e)=>e],(t,e)=>{const s={};for(const[a,c]of Object.entries(t))c.asset_procedure===e&&(s[a]=c);return Re(s)})),AA=S(l.createSelector([Or,(t,e)=>e],(t,e)=>g(t.filter(s=>s.asset_procedure===e)))),ii=S(l.createSelector([ft,(t,e)=>e],(t,e)=>{const s=[];for(const a of e){const c=t[a];c?s.push(c):console.warn("selectStagesFromStageIds: No stage exists with the id",a)}return g(s)})),X=F(t=>t.uuid),_r=X.getInitialState({}),ai=l.createSlice({name:"assetTypeAttachments",initialState:_r,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,_r)),reducers:{initializeAssetTypeAttachments:X.initialize,addAssetTypeAttachment:X.addOne,addAssetTypeAttachments:X.addMany,setAssetTypeAttachment:X.setOne,setAssetTypeAttachments:X.setMany,updateAssetTypeAttachment:X.updateOne,updateAssetTypeAttachments:X.updateMany,deleteAssetTypeAttachment:X.deleteOne,deleteAssetTypeAttachments:X.deleteMany}}),{initializeAssetTypeAttachments:vr,addAssetTypeAttachment:yA,addAssetTypeAttachments:ci,setAssetTypeAttachment:wr,setAssetTypeAttachments:fA,updateAssetTypeAttachment:SA,updateAssetTypeAttachments:Er,deleteAssetTypeAttachment:qr,deleteAssetTypeAttachments:ni}=ai.actions,jr=t=>t.assetTypeAttachmentReducer.instances,Mr=l.createSelector([jr],t=>Object.values(t)),Vr=t=>e=>e.assetTypeAttachmentReducer.instances[t],kr=S(l.createSelector([Mr,(t,e)=>e],(t,e)=>g(t.filter(({asset_type:s})=>e===s)))),zr=ai.reducer,Q=F(t=>t.uuid),Cr=Q.getInitialState({}),ri=l.createSlice({name:"assetTypeFieldsAttachments",initialState:Cr,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,Cr)),reducers:{initializeAssetTypeFieldsAttachments:Q.initialize,addAssetTypeFieldsAttachment:Q.addOne,addAssetTypeFieldsAttachments:Q.addMany,setAssetTypeFieldsAttachment:Q.setOne,setAssetTypeFieldsAttachments:Q.setMany,updateAssetTypeFieldsAttachment:Q.updateOne,updateAssetTypeFieldsAttachments:Q.updateMany,deleteAssetTypeFieldsAttachment:Q.deleteOne,deleteAssetTypeFieldsAttachments:Q.deleteMany}}),{initializeAssetTypeFieldsAttachments:Dr,addAssetTypeFieldsAttachment:gA,addAssetTypeFieldsAttachments:Ur,setAssetTypeFieldsAttachment:bA,setAssetTypeFieldsAttachments:PA,updateAssetTypeFieldsAttachment:FA,updateAssetTypeFieldsAttachments:$r,deleteAssetTypeFieldsAttachment:TA,deleteAssetTypeFieldsAttachments:Br}=ri.actions,Gr=t=>t.assetTypeFieldsAttachmentReducer.instances,Lr=l.createSelector([Gr],t=>Object.values(t)),IA=S(l.createSelector([Lr,(t,e)=>e],(t,e)=>g(t.filter(s=>s.fields_revision===e)))),RA=t=>e=>e.assetTypeFieldsAttachmentReducer.instances[t],Nr=ri.reducer,Z=F(t=>t.uuid),Hr=Z.getInitialState({}),di=l.createSlice({name:"assetTypeFields",initialState:Hr,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,Hr)),reducers:{initializeAssetTypeFields:Z.initialize,addAssetTypeFields:Z.addOne,addAssetTypeFieldsMany:Z.addMany,setAssetTypeFields:Z.setOne,setAssetTypeFieldsMany:Z.setMany,updateAssetTypeFields:Z.updateOne,updateAssetTypeFieldsMany:Z.updateMany,deleteAssetTypeFields:Z.deleteOne,deleteAssetTypeFieldsMany:Z.deleteMany}}),{initializeAssetTypeFields:Wr,addAssetTypeFields:Kr,addAssetTypeFieldsMany:OA,setAssetTypeFields:_A,setAssetTypeFieldsMany:vA,updateAssetTypeFields:Yr,updateAssetTypeFieldsMany:wA,deleteAssetTypeFields:Jr,deleteAssetTypeFieldsMany:EA}=di.actions,Xr=t=>t.assetTypeFieldsReducer.instances,St=l.createSelector([Xr],t=>Object.values(t)),qA=S(l.createSelector([St,(t,e)=>e],(t,e)=>g(t.filter(s=>s.asset_type===e)))),jA=S(l.createSelector([St,(t,e)=>e],(t,e)=>t.filter(s=>s.asset_type===e).sort((s,a)=>s.submitted_at>a.submitted_at?-1:1)[0])),MA=t=>e=>e.assetTypeFieldsReducer.instances[t],Qr=di.reducer,x=F(t=>t.uuid),Zr=x.getInitialState({}),ui=l.createSlice({name:"assetTypeFieldValuesAttachments",initialState:Zr,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,Zr)),reducers:{initializeAssetTypeFieldValuesAttachments:x.initialize,addAssetTypeFieldValuesAttachment:x.addOne,addAssetTypeFieldValuesAttachments:x.addMany,setAssetTypeFieldValuesAttachment:x.setOne,setAssetTypeFieldValuesAttachments:x.setMany,updateAssetTypeFieldValuesAttachment:x.updateOne,updateAssetTypeFieldValuesAttachments:x.updateMany,deleteAssetTypeFieldValuesAttachment:x.deleteOne,deleteAssetTypeFieldValuesAttachments:x.deleteMany}}),{initializeAssetTypeFieldValuesAttachments:xr,addAssetTypeFieldValuesAttachment:VA,addAssetTypeFieldValuesAttachments:gt,setAssetTypeFieldValuesAttachment:kA,setAssetTypeFieldValuesAttachments:zA,updateAssetTypeFieldValuesAttachment:CA,updateAssetTypeFieldValuesAttachments:ed,deleteAssetTypeFieldValuesAttachment:DA,deleteAssetTypeFieldValuesAttachments:bt}=ui.actions,oi=t=>t.assetTypeFieldValuesAttachmentReducer.instances,td=l.createSelector([oi],t=>Object.values(t)),UA=t=>e=>e.assetTypeFieldValuesAttachmentReducer.instances[t],sd=S(l.createSelector([oi,(t,e)=>e],(t,e)=>{const s=new Set(e);return g(Object.values(t).filter(a=>s.has(a.uuid)))})),id=S(l.createSelector([td,(t,e)=>e],(t,e)=>g(t.filter(s=>s.field_values===e)))),ad=ui.reducer,ee=F(t=>t.uuid),cd=ee.getInitialState({}),li=l.createSlice({name:"assetTypeFieldValues",initialState:cd,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,cd)),reducers:{initializeAssetTypeFieldValues:ee.initialize,addAssetTypeFieldValues:ee.addOne,addAssetTypeFieldValuesMany:ee.addMany,setAssetTypeFieldValues:ee.setOne,setAssetTypeFieldValuesMany:ee.setMany,updateAssetTypeFieldValues:ee.updateOne,updateAssetTypeFieldValuesMany:ee.updateMany,deleteAssetTypeFieldValues:ee.deleteOne,deleteAssetTypeFieldValuesMany:ee.deleteMany}}),{initializeAssetTypeFieldValues:nd,addAssetTypeFieldValues:hi,addAssetTypeFieldValuesMany:rd,setAssetTypeFieldValues:$A,setAssetTypeFieldValuesMany:BA,updateAssetTypeFieldValues:Ze,updateAssetTypeFieldValuesMany:dd,deleteAssetTypeFieldValues:mi,deleteAssetTypeFieldValuesMany:ud}=li.actions,od=t=>t.assetTypeFieldValuesReducer.instances,pi=l.createSelector([od],t=>Object.values(t)),GA=S(l.createSelector([pi,(t,e)=>e],(t,e)=>g(t.filter(s=>s.asset===e)))),LA=S(l.createSelector([St,pi,(t,e)=>e],(t,e,s)=>{const a=new Set(t.filter(c=>c.asset_type===s).map(c=>c.uuid));return g(e.filter(c=>a.has(c.fields_revision)))})),Ai=t=>e=>e.assetTypeFieldValuesReducer.instances[t],ld=li.reducer,te=F(t=>t.uuid),hd=te.getInitialState({}),yi=l.createSlice({name:"assetTypes",initialState:hd,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,hd)),reducers:{initializeAssetTypes:te.initialize,setAssetType:te.setOne,setAssetTypes:te.setMany,addAssetType:te.addOne,addAssetTypes:te.addMany,updateAssetType:te.updateOne,updateAssetTypes:te.updateMany,deleteAssetType:te.deleteOne,deleteAssetTypes:te.deleteMany}}),{initializeAssetTypes:md,setAssetType:NA,setAssetTypes:HA,addAssetType:fi,addAssetTypes:WA,updateAssetType:xe,updateAssetTypes:KA,deleteAssetType:Si,deleteAssetTypes:YA}=yi.actions,gi=t=>t.assetTypeReducer.instances,JA=l.createSelector([gi],t=>Object.values(t)),bi=t=>e=>e.assetTypeReducer.instances[t],XA=S(l.createSelector([gi,(t,e)=>e],(t,e)=>{const s=[];for(const a of e){const c=t[a];c?s.push(c):console.warn("selectAssetTypesByIds: No assetType exists with the id",a)}return g(s)})),pd=yi.reducer,Ad={accessToken:"",refreshToken:"",isLoggedIn:!1},Pt=l.createSlice({name:"auth",initialState:Ad,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,Ad)),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||Pt.caseReducers.clearTokens(t),t.isLoggedIn=e.payload}}}),{setTokens:QA,clearTokens:ZA,setLoggedIn:yd}=Pt.actions,xA=t=>t.authReducer.accessToken,ey=t=>t.authReducer.isLoggedIn,fd=Pt.reducer,et=F(t=>t.uuid),Sd=et.getInitialState({}),Pi=l.createSlice({name:"categories",initialState:Sd,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,Sd)),reducers:{initializeCategories:et.initialize,addCategory:et.addOne,updateCategory:et.updateOne,deleteCategory:et.deleteOne}}),{initializeCategories:gd,addCategory:Fi,updateCategory:bd,deleteCategory:Pd}=Pi.actions,Ti=t=>t.categoryReducer.instances,ty=l.createSelector([Ti],t=>Object.values(t)),Ii=t=>e=>e.categoryReducer.instances[t],sy=S(l.createSelector([Ti,(t,e)=>e],(t,e)=>{const s=[];for(const a of e){const c=t[a];c?s.push(c):console.warn("selectCategoryByIds: No category exists with the id",a)}return g(s)})),iy=t=>e=>Object.values(e.issueReducer.instances).filter(s=>s.category===t).length,Fd=Pi.reducer,se=F(t=>t.uuid),Td=se.getInitialState({}),Ri=l.createSlice({name:"documentAttachments",initialState:Td,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,Td)),reducers:{initializeDocumentAttachments:se.initialize,addDocumentAttachment:se.addOne,addDocumentAttachments:se.addMany,setDocumentAttachment:se.setOne,setDocumentAttachments:se.setMany,updateDocumentAttachment:se.updateOne,updateDocumentAttachments:se.updateMany,deleteDocumentAttachment:se.deleteOne,deleteDocumentAttachments:se.deleteMany}}),{initializeDocumentAttachments:Id,addDocumentAttachment:ay,addDocumentAttachments:Rd,setDocumentAttachment:Od,setDocumentAttachments:cy,updateDocumentAttachment:ny,updateDocumentAttachments:_d,deleteDocumentAttachment:vd,deleteDocumentAttachments:wd}=Ri.actions,Ed=t=>t.documentAttachmentReducer.instances,qd=l.createSelector([Ed],t=>Object.values(t)),jd=t=>e=>e.documentAttachmentReducer.instances[t],ry=S(l.createSelector([qd,(t,e)=>e],(t,e)=>g(t.filter(({document:s})=>e===s)))),Md=Ri.reducer,Vd={documents:{}},Oi=l.createSlice({name:"documents",initialState:Vd,extraReducers:t=>t.addCase("RESET",e=>{Object.assign(e,Vd)}),reducers:{setDocuments:(t,e)=>{if(e.payload.filter(gc).length!==e.payload.length)throw new Error("Tried to use setIssues reducer with duplicate ID's");t.documents=Sc(e.payload)},addDocuments:(t,e)=>{for(const s of e.payload)if(s.uuid in t.documents)throw new Error(`attempting to add a document with uuid ${s.uuid} which already exists in state.documents.`);for(const s of e.payload){if(s.parent_document&&t.documents[s.parent_document]){const a=t.documents[s.parent_document];t.documents[s.parent_document]={...a,children_documents:[...a.children_documents,s.uuid]}}t.documents[s.uuid]=s}},updateDocuments:(t,e)=>{for(const s of e.payload)if(!(s.uuid in t.documents))throw new Error(`attempting to update a document with uuid ${s.uuid} which doesn't exists in state.documents.`);for(const s of e.payload){const a=t.documents[s.uuid];if(s.organization!==void 0&&s.organization!==a.organization)throw new Error("organization cannot be updated");if(s.project!==void 0&&s.project!==a.project)throw new Error("project cannot be updated");t.documents[s.uuid]={...a,...s}}},moveDocument:(t,e)=>{const{documentId:s,targetDocumentId:a,position:c}=e.payload;if(!(s in t.documents))throw new Error(`attempting to move a document with uuid ${s} which doesn't exist in state.documents`);const n=t.documents[s];if(n.parent_document&&t.documents[n.parent_document]){const{children_documents:r}=t.documents[n.parent_document];t.documents[n.parent_document].children_documents.splice(r.indexOf(n.uuid),1)}if(a){const r=t.documents[a],u=r!=null&&r.parent_document?t.documents[r.parent_document]:null;switch(c){case"left":if(!u)throw new Error("attempting to move a document to the left of a document with no parent_document");t.documents[r.parent_document].children_documents.splice(u.children_documents.indexOf(r.uuid),0,n.uuid),t.documents[s].parent_document=u.uuid;break;case"right":if(!u)throw new Error("attempting to move a document to the left of a document with no parent_document");t.documents[r.parent_document].children_documents.splice(u.children_documents.indexOf(r.uuid)+1,0,n.uuid),t.documents[s].parent_document=u.uuid;break;case"left-child":if(!r)throw new Error("attempting to move a document to the left-child of a document that doesn't exist");t.documents[a].children_documents.unshift(n.uuid),t.documents[s].parent_document=r.uuid;break;case"right-child":if(!r)throw new Error("attempting to move a document to the left-child of a document that doesn't exist");t.documents[a].children_documents.push(n.uuid),t.documents[s].parent_document=r.uuid}}else t.documents[s].parent_document=null},removeDocuments:(t,e)=>{for(const s of e.payload)if(!(s in t.documents))throw new Error(`attempting to delete a document with uuid ${s} which doesn't exists in state.documents.`);for(const s of e.payload){const a=t.documents[s];if(a.parent_document&&t.documents[a.parent_document]){const c=t.documents[a.parent_document];t.documents[a.parent_document]={...c,children_documents:c.children_documents.filter(n=>n!==a.uuid)}}delete t.documents[s]}}}}),{setDocuments:kd,addDocuments:zd,updateDocuments:Fe,moveDocument:Cd,removeDocuments:_i}=Oi.actions,ze=t=>t.documentsReducer.documents,Dd=l.createSelector([ze],t=>Object.values(t)),Ud=t=>e=>e.documentsReducer.documents[t],dy=S(l.createSelector([ze,(t,e)=>e],(t,e)=>{const s=[];for(const a of e){const c=t[a];c?s.push(c):console.warn("selectDocumentByIds: No document exists with the id",a)}return g(s)})),uy=S(l.createSelector([ze,(t,e)=>e],(t,e)=>{const s=[],a=t[e];if(!a||!a.parent_document)return s;let c=t[a.parent_document];for(;c;)s.push(c.uuid),c=t[c.parent_document??""];return g(s)})),oy=l.createSelector([Dd],t=>g(t.filter(e=>!e.parent_document))),$d=Oi.reducer,Ft=F(t=>t.uuid),ly=Ft.getInitialState({}),vi=l.createSlice({name:"emailDomains",initialState:ly,reducers:{initializeEmailDomains:Ft.initialize,addEmailDomain:Ft.addOne,deleteEmailDomain:Ft.deleteOne}}),{initializeEmailDomains:Bd,addEmailDomain:Gd,deleteEmailDomain:Ld}=vi.actions,Nd=t=>t.emailDomainsReducer.instances,Hd=l.createSelector([Nd],t=>Object.values(t)),hy=S(l.createSelector([Hd,(t,e)=>e],(t,e)=>g(t.filter(s=>s.organization===e)))),Wd=vi.reducer,Kd={s3Urls:{}},Yd=1e3*60*60,my=Yd*24*7,wi=l.createSlice({name:"file",initialState:Kd,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,Kd)),reducers:{setUploadUrl:(t,e)=>{const{url:s,fields:a,sha1:c}=e.payload,n=new Date,r=new Date(n.getTime()+my);t.s3Urls[c]={url:s,fields:a,exp:r.getTime()}}}}),{setUploadUrl:Jd}=wi.actions,Xd=t=>e=>{const s=e.fileReducer.s3Urls[t];if(!s)return;const a=new Date().getTime();if(!((s.exp??a)-a<Yd))return s},Qd=wi.reducer,ie=F(t=>t.uuid),Zd=ie.getInitialState({}),Ei=l.createSlice({name:"formRevisionAttachments",initialState:Zd,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,Zd)),reducers:{initializeFormRevisionAttachments:ie.initialize,addFormRevisionAttachment:ie.addOne,addFormRevisionAttachments:ie.addMany,setFormRevisionAttachment:ie.setOne,setFormRevisionAttachments:ie.setMany,updateFormRevisionAttachment:ie.updateOne,updateFormRevisionAttachments:ie.updateMany,deleteFormRevisionAttachment:ie.deleteOne,deleteFormRevisionAttachments:ie.deleteMany}}),{initializeFormRevisionAttachments:xd,addFormRevisionAttachment:py,addFormRevisionAttachments:eu,setFormRevisionAttachment:Ay,setFormRevisionAttachments:yy,updateFormRevisionAttachment:fy,updateFormRevisionAttachments:tu,deleteFormRevisionAttachment:Sy,deleteFormRevisionAttachments:su}=Ei.actions,iu=t=>t.formRevisionAttachmentReducer.instances,gy=S(l.createSelector([iu,(t,e)=>e],(t,e)=>g(Object.values(t).filter(s=>s.form_revision===e)))),au=Ei.reducer,by=(t,e)=>{const s=t.revision,a=e.revision;return s===void 0&&a===void 0?t.submitted_at<e.submitted_at?-1:1:s===void 0?1:a===void 0||s<a?-1:1},Oe=F(t=>t.uuid),cu=Oe.getInitialState({}),qi=l.createSlice({name:"formRevisions",initialState:cu,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,cu)),reducers:{initializeFormRevisions:Oe.initialize,setFormRevision:Oe.setOne,addFormRevision:Oe.addOne,addFormRevisions:Oe.addMany,deleteFormRevision:Oe.deleteOne,deleteFormRevisions:Oe.deleteMany}}),{setFormRevision:nu,initializeFormRevisions:ru,addFormRevision:ji,addFormRevisions:du,deleteFormRevision:Mi,deleteFormRevisions:uu}=qi.actions,Tt=t=>t.formRevisionReducer.instances,ou=l.createSelector([Tt],t=>Object.values(t)),Py=t=>e=>e.formRevisionReducer.instances[t],Fy=S(l.createSelector([Tt,(t,e)=>e],(t,e)=>{const s=Object.values(t).filter(n=>n.form===e);if(s.length===0)return;const c=s.sort(by)[s.length-1];return t[c.uuid]})),lu=S(l.createSelector([ou,(t,e)=>e],(t,e)=>g(t.filter(s=>s.form===e)))),hu=qi.reducer,_e=F(t=>t.uuid),mu=_e.getInitialState({}),Vi=l.createSlice({name:"forms",initialState:mu,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,mu)),reducers:{initializeForms:_e.initialize,setForm:_e.setOne,addForm:_e.addOne,addForms:_e.addMany,updateForm:_e.updateOne,deleteForm:_e.deleteOne}}),{initializeForms:pu,setForm:Ty,addForm:ki,addForms:Iy,updateForm:Ry,deleteForm:zi}=Vi.actions,Au=Vi.reducer,yu=t=>t.formReducer.instances,Oy=l.createSelector([yu],t=>Object.values(t)),fu=t=>e=>e.formReducer.instances[t],ae=F(t=>t.uuid),Su=ae.getInitialState({}),Ci=l.createSlice({name:"formSubmissionAttachments",initialState:Su,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,Su)),reducers:{initializeFormSubmissionAttachments:ae.initialize,addFormSubmissionAttachment:ae.addOne,addFormSubmissionAttachments:ae.addMany,setFormSubmissionAttachment:ae.setOne,setFormSubmissionAttachments:ae.setMany,updateFormSubmissionAttachment:ae.updateOne,updateFormSubmissionAttachments:ae.updateMany,deleteFormSubmissionAttachment:ae.deleteOne,deleteFormSubmissionAttachments:ae.deleteMany}}),{initializeFormSubmissionAttachments:gu,addFormSubmissionAttachment:_y,addFormSubmissionAttachments:It,setFormSubmissionAttachment:vy,setFormSubmissionAttachments:wy,updateFormSubmissionAttachment:Ey,updateFormSubmissionAttachments:bu,deleteFormSubmissionAttachment:qy,deleteFormSubmissionAttachments:Rt}=Ci.actions,Di=t=>t.formSubmissionAttachmentReducer.instances,Pu=S(l.createSelector([Di,(t,e)=>e],(t,e)=>{const s=new Set(e);return g(Object.values(t).filter(a=>s.has(a.uuid)))})),Fu=S(l.createSelector([Di,(t,e)=>e],(t,e)=>g(Object.values(t).filter(s=>s.form_submission===e)))),Tu=Ci.reducer,ce=F(t=>t.uuid),Iu=ce.getInitialState({}),Ui=l.createSlice({name:"formSubmissions",initialState:Iu,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,Iu)),reducers:{initializeFormSubmissions:ce.initialize,setFormSubmission:ce.setOne,setFormSubmissions:ce.setMany,addFormSubmission:ce.addOne,addFormSubmissions:ce.addMany,updateFormSubmission:ce.updateOne,updateFormSubmissions:ce.updateMany,deleteFormSubmission:ce.deleteOne,deleteFormSubmissions:ce.deleteMany}}),{initializeFormSubmissions:Ru,setFormSubmission:Ot,setFormSubmissions:jy,addFormSubmission:$i,addFormSubmissions:_t,updateFormSubmission:Ou,updateFormSubmissions:My,deleteFormSubmission:Bi,deleteFormSubmissions:vt}=Ui.actions,Gi=t=>t.formSubmissionReducer.instances,Li=l.createSelector([Gi],t=>Object.values(t)),Ni=t=>e=>e.formSubmissionReducer.instances[t],_u=S(l.createSelector([Gi,Tt,(t,e)=>e],(t,e,s)=>{const a=new Set;for(const c of Object.values(e))c.form===s&&a.add(c.uuid);return Object.values(t).filter(c=>a.has(c.form_revision))})),vu=S(l.createSelector([Li,(t,e)=>e],(t,e)=>Object.values(t).filter(s=>s.issue===e))),wu=S(l.createSelector([Li,(t,e)=>e],(t,e)=>t.filter(s=>s.asset===e))),Eu=Ui.reducer,ne=F(t=>t.uuid),qu=ne.getInitialState({}),Hi=l.createSlice({name:"geoImages",initialState:qu,extraReducers:t=>{t.addCase("RESET",e=>{Object.assign(e,qu)})},reducers:{initializeGeoImages:ne.initialize,setGeoImage:ne.setOne,setGeoImages:ne.setMany,addGeoImage:ne.addOne,addGeoImages:ne.addMany,updateGeoImage:ne.updateOne,updateGeoImages:ne.updateMany,deleteGeoImage:ne.deleteOne,deleteGeoImages:ne.deleteMany}}),{initializeGeoImages:ju,setGeoImage:tt,setGeoImages:Mu,addGeoImage:Vu,addGeoImages:ku,updateGeoImage:zu,updateGeoImages:Vy,deleteGeoImage:Wi,deleteGeoImages:Cu}=Hi.actions,Du=t=>t.geoImageReducer.instances,Uu=l.createSelector([Du],t=>Object.values(t)),Ki=t=>e=>e.geoImageReducer.instances[t],ky=S(l.createSelector([Uu,(t,e)=>e],(t,e)=>g(t.filter(s=>s.project===e)))),$u=Hi.reducer,re=F(t=>t.uuid),Bu=re.getInitialState({}),Yi=l.createSlice({name:"issueAssociations",initialState:Bu,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,Bu)),reducers:{initializeIssueAssociations:re.initialize,addIssueAssociation:re.addOne,addIssueAssociations:re.addMany,setIssueAssociation:re.setOne,setIssueAssociations:re.setMany,updateIssueAssociation:re.updateOne,updateIssueAssociations:re.updateMany,deleteIssueAssociation:re.deleteOne,deleteIssueAssociations:re.deleteMany}}),{initializeIssueAssociations:Gu,setIssueAssociations:zy,setIssueAssociation:Cy,updateIssueAssociation:Lu,updateIssueAssociations:Dy,addIssueAssociation:Ji,addIssueAssociations:Xi,deleteIssueAssociation:Qi,deleteIssueAssociations:Zi}=Yi.actions,st=t=>t.issueAssociationReducer.instances,Uy=l.createSelector([st],t=>Object.values(t)),Nu=t=>e=>e.issueAssociationReducer.instances[t],Hu=S(l.createSelector([st,(t,e)=>e],(t,e)=>g(Object.values(t).filter(s=>s.associated_issue===e)))),Wu=S(l.createSelector([st,(t,e)=>e],(t,e)=>g(Object.values(t).filter(s=>s.issue===e)))),Ku=S(l.createSelector([st,(t,e)=>e],(t,e)=>g(Object.values(t).filter(s=>s.asset===e)))),Yu=Yi.reducer,de=F(t=>t.uuid),Ju=de.getInitialState({}),xi=l.createSlice({name:"issueAttachments",initialState:Ju,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,Ju)),reducers:{initializeIssueAttachments:de.initialize,addIssueAttachment:de.addOne,addIssueAttachments:de.addMany,setIssueAttachment:de.setOne,setIssueAttachments:de.setMany,updateIssueAttachment:de.updateOne,updateIssueAttachments:de.updateMany,deleteIssueAttachment:de.deleteOne,deleteIssueAttachments:de.deleteMany}}),{initializeIssueAttachments:ea,addIssueAttachment:$y,addIssueAttachments:ta,setIssueAttachment:Xu,setIssueAttachments:By,updateIssueAttachment:Gy,updateIssueAttachments:Qu,deleteIssueAttachment:Zu,deleteIssueAttachments:sa}=xi.actions,xu=t=>t.issueAttachmentReducer.instances,eo=l.createSelector([xu],t=>Object.values(t)),to=S(l.createSelector([eo,(t,e)=>e],(t,e)=>g(t.filter(({issue:s})=>e===s)))),so=t=>e=>e.issueAttachmentReducer.instances[t],io=xi.reducer,ue=F(t=>t.uuid),ao=ue.getInitialState({}),ia=l.createSlice({name:"issueCommentAttachments",initialState:ao,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,ao)),reducers:{initializeIssueCommentAttachments:ue.initialize,addIssueCommentAttachment:ue.addOne,addIssueCommentAttachments:ue.addMany,setIssueCommentAttachment:ue.setOne,setIssueCommentAttachments:ue.setMany,updateIssueCommentAttachment:ue.updateOne,updateIssueCommentAttachments:ue.updateMany,deleteIssueCommentAttachment:ue.deleteOne,deleteIssueCommentAttachments:ue.deleteMany}}),{initializeIssueCommentAttachments:aa,addIssueCommentAttachment:Ly,addIssueCommentAttachments:co,setIssueCommentAttachment:no,setIssueCommentAttachments:Ny,updateIssueCommentAttachment:Hy,updateIssueCommentAttachments:ro,deleteIssueCommentAttachment:uo,deleteIssueCommentAttachments:oo}=ia.actions,lo=t=>t.issueCommentAttachmentReducer.instances,ho=l.createSelector([lo],t=>Object.values(t)),mo=t=>e=>e.issueCommentAttachmentReducer.instances[t],Wy=S(l.createSelector([ho,(t,e)=>e],(t,e)=>g(t.filter(({issue_comment:s})=>e===s)))),po=ia.reducer,ve=F(t=>t.uuid),Ao=ve.getInitialState({}),ca=l.createSlice({name:"issueComments",initialState:Ao,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,Ao)),reducers:{addIssueComment:ve.addOne,addIssueComments:ve.addMany,setIssueComment:ve.setOne,setIssueComments:ve.setMany,deleteIssueComment:ve.deleteOne,deleteIssueComments:ve.deleteMany}}),{setIssueComments:yo,setIssueComment:na,addIssueComment:ra,addIssueComments:Ky,deleteIssueComment:da,deleteIssueComments:Yy}=ca.actions,fo=t=>t.issueCommentReducer.instances,ua=t=>e=>e.issueCommentReducer.instances[t],Jy=S(l.createSelector([fo,(t,e)=>e],(t,e)=>g(Object.values(t).filter(s=>s.issue===e)))),So=ca.reducer,we=F(t=>t.uuid),go=we.getInitialState({}),oa=l.createSlice({name:"issues",initialState:go,extraReducers:t=>t.addCase("RESET",e=>{Object.assign(e,go)}),reducers:{initializeIssues:we.initialize,addIssue:we.addOne,addIssues:we.addMany,updateIssue:we.updateOne,deleteIssue:we.deleteOne,deleteIssues:we.deleteMany}}),{initializeIssues:bo,addIssue:la,addIssues:Po,updateIssue:wt,deleteIssue:ha,deleteIssues:Fo}=oa.actions,To=t=>t.issueReducer.instances,ma=t=>e=>e.issueReducer.instances[t],Xy=S(l.createSelector([To,(t,e)=>e],(t,e)=>{const s=[];for(const a of e){const c=t[a];c?s.push(c):console.warn("selectIssuesByIds: No issue exists with the id",a)}return g(s)})),Io=oa.reducer,oe=F(t=>t.uuid),Ro=oe.getInitialState({}),pa=l.createSlice({name:"issueTypeAttachments",initialState:Ro,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,Ro)),reducers:{initializeIssueTypeAttachments:oe.initialize,addIssueTypeAttachment:oe.addOne,addIssueTypeAttachments:oe.addMany,setIssueTypeAttachment:oe.setOne,setIssueTypeAttachments:oe.setMany,updateIssueTypeAttachment:oe.updateOne,updateIssueTypeAttachments:oe.updateMany,deleteIssueTypeAttachment:oe.deleteOne,deleteIssueTypeAttachments:oe.deleteMany}}),{initializeIssueTypeAttachments:Aa,addIssueTypeAttachment:Qy,addIssueTypeAttachments:Oo,setIssueTypeAttachment:_o,setIssueTypeAttachments:Zy,updateIssueTypeAttachment:xy,updateIssueTypeAttachments:vo,deleteIssueTypeAttachment:wo,deleteIssueTypeAttachments:Eo}=pa.actions,qo=t=>t.issueTypeAttachmentReducer.instances,jo=l.createSelector([qo],t=>Object.values(t)),Mo=t=>e=>e.issueTypeAttachmentReducer.instances[t],ef=S(l.createSelector([jo,(t,e)=>e],(t,e)=>g(t.filter(({issue_type:s})=>e===s)))),Vo=pa.reducer,le=F(t=>t.uuid),ko=le.getInitialState({}),ya=l.createSlice({name:"issueTypeFieldsAttachments",initialState:ko,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,ko)),reducers:{initializeIssueTypeFieldsAttachments:le.initialize,addIssueTypeFieldsAttachment:le.addOne,addIssueTypeFieldsAttachments:le.addMany,setIssueTypeFieldsAttachment:le.setOne,setIssueTypeFieldsAttachments:le.setMany,updateIssueTypeFieldsAttachment:le.updateOne,updateIssueTypeFieldsAttachments:le.updateMany,deleteIssueTypeFieldsAttachment:le.deleteOne,deleteIssueTypeFieldsAttachments:le.deleteMany}}),{initializeIssueTypeFieldsAttachments:zo,addIssueTypeFieldsAttachment:tf,addIssueTypeFieldsAttachments:Co,setIssueTypeFieldsAttachment:sf,setIssueTypeFieldsAttachments:af,updateIssueTypeFieldsAttachment:cf,updateIssueTypeFieldsAttachments:Do,deleteIssueTypeFieldsAttachment:nf,deleteIssueTypeFieldsAttachments:Uo}=ya.actions,$o=t=>t.issueTypeFieldsAttachmentReducer.instances,Bo=l.createSelector([$o],t=>Object.values(t)),rf=S(l.createSelector([Bo,(t,e)=>e],(t,e)=>g(t.filter(s=>s.fields_revision===e)))),df=t=>e=>e.issueTypeFieldsAttachmentReducer.instances[t],Go=ya.reducer,he=F(t=>t.uuid),Lo=he.getInitialState({}),fa=l.createSlice({name:"issueTypeFieldValues",initialState:Lo,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,Lo)),reducers:{initializeIssueTypeFieldValues:he.initialize,addIssueTypeFieldValues:he.addOne,addIssueTypeFieldValuesMany:he.addMany,setIssueTypeFieldValues:he.setOne,setIssueTypeFieldValuesMany:he.setMany,updateIssueTypeFieldValues:he.updateOne,updateIssueTypeFieldValuesMany:he.updateMany,deleteIssueTypeFieldValues:he.deleteOne,deleteIssueTypeFieldValuesMany:he.deleteMany}}),{initializeIssueTypeFieldValues:No,addIssueTypeFieldValues:Sa,addIssueTypeFieldValuesMany:uf,setIssueTypeFieldValues:of,setIssueTypeFieldValuesMany:lf,updateIssueTypeFieldValues:it,updateIssueTypeFieldValuesMany:hf,deleteIssueTypeFieldValues:ga,deleteIssueTypeFieldValuesMany:mf}=fa.actions,Ho=t=>t.issueTypeFieldValuesReducer.instances,ba=l.createSelector([Ho],t=>Object.values(t)),pf=S(l.createSelector([ba,(t,e)=>e],(t,e)=>g(t.filter(s=>s.issue===e)))),Pa=t=>e=>e.issueTypeFieldValuesReducer.instances[t],Wo=fa.reducer,me=F(t=>t.uuid),Ko=me.getInitialState({}),Fa=l.createSlice({name:"issueTypeFields",initialState:Ko,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,Ko)),reducers:{initializeIssueTypeFields:me.initialize,addIssueTypeFields:me.addOne,addIssueTypeFieldsMany:me.addMany,setIssueTypeFields:me.setOne,setIssueTypeFieldsMany:me.setMany,updateIssueTypeFields:me.updateOne,updateIssueTypeFieldsMany:me.updateMany,deleteIssueTypeFields:me.deleteOne,deleteIssueTypeFieldsMany:me.deleteMany}}),{initializeIssueTypeFields:Yo,addIssueTypeFields:Jo,addIssueTypeFieldsMany:Af,setIssueTypeFields:yf,setIssueTypeFieldsMany:ff,updateIssueTypeFields:Xo,updateIssueTypeFieldsMany:Sf,deleteIssueTypeFields:Qo,deleteIssueTypeFieldsMany:gf}=Fa.actions,Zo=t=>t.issueTypeFieldsReducer.instances,Et=l.createSelector([Zo],t=>Object.values(t)),bf=S(l.createSelector([Et,(t,e)=>e],(t,e)=>g(t.filter(s=>s.issue_type===e)))),Pf=S(l.createSelector([Et,(t,e)=>e],(t,e)=>t.filter(s=>s.issue_type===e).sort((s,a)=>s.submitted_at>a.submitted_at?-1:1)[0])),Ff=S(l.createSelector([Et,ba,(t,e)=>e],(t,e,s)=>{const a=new Set(t.filter(c=>c.issue_type===s).map(c=>c.uuid));return g(e.filter(c=>a.has(c.fields_revision)))})),Tf=t=>e=>e.issueTypeFieldsReducer.instances[t],xo=Fa.reducer,pe=F(t=>t.uuid),el=pe.getInitialState({}),Ta=l.createSlice({name:"issueTypeFieldValuesAttachments",initialState:el,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,el)),reducers:{initializeIssueTypeFieldValuesAttachments:pe.initialize,addIssueTypeFieldValuesAttachment:pe.addOne,addIssueTypeFieldValuesAttachments:pe.addMany,setIssueTypeFieldValuesAttachment:pe.setOne,setIssueTypeFieldValuesAttachments:pe.setMany,updateIssueTypeFieldValuesAttachment:pe.updateOne,updateIssueTypeFieldValuesAttachments:pe.updateMany,deleteIssueTypeFieldValuesAttachment:pe.deleteOne,deleteIssueTypeFieldValuesAttachments:pe.deleteMany}}),{initializeIssueTypeFieldValuesAttachments:tl,addIssueTypeFieldValuesAttachment:If,addIssueTypeFieldValuesAttachments:qt,setIssueTypeFieldValuesAttachment:Rf,setIssueTypeFieldValuesAttachments:Of,updateIssueTypeFieldValuesAttachment:_f,updateIssueTypeFieldValuesAttachments:sl,deleteIssueTypeFieldValuesAttachment:vf,deleteIssueTypeFieldValuesAttachments:jt}=Ta.actions,Ia=t=>t.issueTypeFieldValuesAttachmentReducer.instances,il=l.createSelector([Ia],t=>Object.values(t)),wf=t=>e=>e.issueTypeFieldValuesAttachmentReducer.instances[t],al=S(l.createSelector([Ia,(t,e)=>e],(t,e)=>{const s=new Set(e);return g(Object.values(t).filter(a=>s.has(a.uuid)))})),cl=S(l.createSelector([il,(t,e)=>e],(t,e)=>g(t.filter(s=>s.field_values===e)))),nl=Ta.reducer,Ce=F(t=>t.uuid),rl=Ce.getInitialState({}),Ra=l.createSlice({name:"issueTypes",initialState:rl,extraReducers:t=>t.addCase("RESET",e=>{Object.assign(e,rl)}),reducers:{initializeIssueTypes:Ce.initialize,setIssueType:Ce.setOne,addIssueType:Ce.addOne,updateIssueType:Ce.updateOne,removeIssueType:Ce.deleteOne}}),{initializeIssueTypes:dl,setIssueType:at,addIssueType:ul,updateIssueType:ol,removeIssueType:Oa}=Ra.actions,ll=t=>t.issueTypeReducer.instances,hl=l.createSelector(ll,t=>Object.values(t)),_a=t=>e=>e.issueTypeReducer.instances[t],Ef=t=>e=>{const s=[];for(const a of t){const c=e.issueTypeReducer.instances[a];c?s.push(c):console.warn("selectIssueTypesByIds: No issue type exists with the id",a)}return s},qf=S(l.createSelector([hl,(t,e)=>e],(t,e)=>g(t.filter(s=>s.organization===e)))),va=S(l.createSelector([t=>t.issueReducer.instances,(t,e)=>e],(t,e)=>g(Object.values(t).filter(s=>s.issue_type===e)))),jf=t=>e=>va(t)(e).length,ml=Ra.reducer,Ee=F(t=>t.uuid),pl=Ee.getInitialState({}),wa=l.createSlice({name:"issueUpdates",initialState:pl,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,pl)),reducers:{initializeIssueUpdates:Ee.setMany,setIssueUpdate:Ee.setOne,addIssueUpdate:Ee.addOne,addIssueUpdates:Ee.addMany,deleteIssueUpdate:Ee.deleteOne,deleteIssueUpdates:Ee.deleteMany}}),{initializeIssueUpdates:Al,setIssueUpdate:Mf,addIssueUpdate:yl,addIssueUpdates:fl,deleteIssueUpdate:Sl,deleteIssueUpdates:gl}=wa.actions,bl=t=>t.issueUpdateReducer.instances,Pl=S(l.createSelector([bl,(t,e)=>e],(t,e)=>g(Object.values(t).filter(s=>s.issue===e)))),Fl=wa.reducer,Mt=F(t=>t.uuid),Tl=Mt.getInitialState({}),Ea=l.createSlice({name:"license",initialState:Tl,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,Tl)),reducers:{initializeLicences:Mt.initialize,addLicenses:Mt.addMany,updateLicense:Mt.updateOne}}),{initializeLicences:Il,addLicenses:Vf,updateLicense:be}=Ea.actions,Vt=t=>t.licenseReducer.instances,kf=t=>e=>e.licenseReducer.instances[t],Rl=t=>e=>Object.values(e.licenseReducer.instances).find(s=>s.project===t),zf=l.createSelector([Vt],t=>g(Object.values(t).filter(e=>e.is_active))),Cf=l.createSelector([Vt],t=>Re(Object.values(t).filter(e=>e.project).reduce((e,s)=>({...e,[s.project]:s}),{}))),Ol=Ea.reducer,V=F(t=>t.id),_l=V.getInitialState({currentUser:null}),qa=l.createSlice({name:"users",initialState:_l,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,_l)),reducers:{initializeUsers:V.initialize,setUsers:V.setMany,setUser:V.setOne,addUsers:V.addMany,addUser:V.addOne,updateUsers:V.updateMany,updateUser:V.updateOne,deleteUser:V.deleteOne,deleteUsers:V.deleteMany,removeUser:V.deleteOne,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 s=t.instances[t.currentUser.id];if(!s)throw new Error("Unable to find current user in users slice");s.profile.file=e.payload.file??null,s.profile.file_sha1=e.payload.file_sha1??null}}}),{initializeUsers:vl,setUsers:Df,setUser:Uf,addUsers:$f,addUser:Bf,updateUsers:Gf,updateUser:Lf,deleteUser:Nf,deleteUsers:Hf,removeUser:wl,setCurrentUser:Wf,setProfilePicture:Kf}=qa.actions,El=qa.reducer,kt=t=>t.userReducer.currentUser,zt=t=>t.userReducer.instances,Yf=t=>e=>e.userReducer.instances[t],Jf=S(l.createSelector([zt,(t,e)=>e],(t,e)=>{const s=[];for(const a of e){const c=t[a];c?s.push(c):console.warn("selectUsersByIds: No user exists with the uuid",a)}return g(s)})),Ct=F(t=>t.uuid),ql=Ct.getInitialState({}),ja=l.createSlice({name:"organizationAccess",initialState:ql,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,ql)),reducers:{initializeOrganizationAccesses:Ct.initialize,updateOrganizationAccess:Ct.updateOne,deleteOrganizationAccess:Ct.deleteOne}}),{initializeOrganizationAccesses:jl,updateOrganizationAccess:Ml,deleteOrganizationAccess:Vl}=ja.actions,Ma=t=>t.organizationAccessReducer.instances,Xf=t=>e=>e.organizationAccessReducer.instances[t],Qf=l.createSelector([kt,Ma],(t,e)=>Object.values(e).find(a=>a.user===(t==null?void 0:t.id))??null),Zf=t=>e=>Object.values(e.organizationAccessReducer.instances).find(s=>s.user===t.id),kl=t=>{const e={};for(const s of Object.values(t.organizationAccessReducer.instances))e[s.user]=s;return Re(e)},zl=ja.reducer,ct=F(t=>t.uuid),Cl=ct.getInitialState({}),Va=l.createSlice({name:"projectAccess",initialState:Cl,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,Cl)),reducers:{initializeProjectAccesses:ct.initialize,updateProjectAccess:ct.updateOne,deleteProjectAccess:ct.deleteOne,deleteProjectAccesses:ct.deleteMany}}),{initializeProjectAccesses:ka,updateProjectAccess:Dl,deleteProjectAccess:Ul,deleteProjectAccesses:$l}=Va.actions,za=t=>t.projectAccessReducer.instances,Bl=l.createSelector(za,t=>Object.values(t)),xf=t=>e=>e.projectAccessReducer.instances[t],eS=t=>e=>Object.values(e.projectAccessReducer.instances).find(s=>s.user===t.id),Gl=t=>{const e={};for(const s of Object.values(t.projectAccessReducer.instances))e[s.user]=s;return Re(e)},Ll=Va.reducer,Ae=F(t=>t.uuid),Nl=Ae.getInitialState({}),Ca=l.createSlice({name:"projects",initialState:Nl,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,Nl)),reducers:{initializeProjects:Ae.initialize,setProjects:Ae.setMany,setProject:Ae.setOne,addProjects:Ae.addMany,addProject:Ae.addOne,updateProjects:Ae.updateMany,updateProject:Ae.updateOne,deleteProject:Ae.deleteOne,deleteProjects:Ae.deleteMany,acceptProjectInvite:(t,e)=>{if(e.payload in t.instances)t.instances[e.payload].invited=!1;else throw new Error("Accept project invite: user is not in this project")}}}),{initializeProjects:tS,setProjects:Hl,setProject:sS,addProjects:iS,addProject:aS,updateProjects:cS,updateProject:Wl,deleteProject:Kl,deleteProjects:nS,acceptProjectInvite:Yl}=Ca.actions,Jl=Ca.reducer,Dt=t=>t.projectReducer.instances,rS=l.createSelector([Dt],t=>g(Object.values(t))),dS=t=>e=>e.projectReducer.instances[t],Xl=l.createSelector([za],t=>Object.values(t).map(e=>e.user)),Ql=l.createSelector([Xl,zt],(t,e)=>t.reduce((s,a)=>({...s,[a]:e[a]}),{})),uS=l.createSelector([kt,Ql,Gl],(t,e,s)=>g(Object.values(e).sort((a,c)=>{if(a.id===(t==null?void 0:t.id))return-1;if(c.id===(t==null?void 0:t.id))return 1;const n=s[a.id],r=s[c.id];return(n==null?void 0:n.access_level)===(r==null?void 0:r.access_level)?a.username.localeCompare(c.username):(n==null?void 0:n.access_level)===Bt.ADMIN?-1:1}))),ye=F(t=>t.uuid),Zl=ye.getInitialState({}),Da=l.createSlice({name:"organizations",initialState:Zl,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,Zl)),reducers:{initializeOrganizations:ye.initialize,setOrganizations:ye.setMany,setOrganization:ye.setOne,addOrganizations:ye.addMany,addOrganization:ye.addOne,updateOrganizations:ye.updateMany,updateOrganization:ye.updateOne,deleteOrganization:ye.deleteOne,deleteOrganizations:ye.deleteMany}}),{initializeOrganizations:oS,setOrganizations:xl,setOrganization:lS,addOrganizations:hS,addOrganization:mS,updateOrganizations:pS,updateOrganization:AS,deleteOrganization:yS,deleteOrganizations:fS}=Da.actions,eh=t=>t.organizationReducer.instances,th=l.createSelector([eh],t=>Object.values(t)),SS=t=>e=>e.organizationReducer.instances[t],gS=l.createSelector([th],t=>g(Object.values(t).filter(e=>e.has_access))),sh=l.createSelector([Ma],t=>Object.values(t).map(e=>e.user)),bS=S(l.createSelector([Dt,(t,e)=>e],(t,e)=>g(Object.values(t).filter(s=>s.organization_owner===e)))),PS=S(l.createSelector([Vt,(t,e)=>e],(t,e)=>g(Object.values(t).filter(s=>s.organization_owner===e)))),ih=l.createSelector([sh,zt],(t,e)=>Re(t.reduce((s,a)=>({...s,[a]:e[a]}),{}))),FS=l.createSelector([kt,ih,kl],(t,e,s)=>g(Object.values(e).sort((a,c)=>{if(a.id===(t==null?void 0:t.id))return-1;if(c.id===(t==null?void 0:t.id))return 1;const n=s[a.id],r=s[c.id];return(n==null?void 0:n.access_level)===(r==null?void 0:r.access_level)?a.username.localeCompare(c.username):(n==null?void 0:n.access_level)===Gt.ADMIN?-1:1}))),ah=Da.reducer,ch=(t,e,s)=>{const a=t.uuid?t:{...t,uuid:Ie.v4()};return{payload:a,type:"",meta:{offline:{effect:{timestamp:new Date().toISOString(),request:a,BASE_URL:e,serviceName:s}}}}},nh={deletedRequests:[],latestRetryTime:0},Ua=l.createSlice({name:"outbox",initialState:nh,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,nh)),reducers:{enqueueRequest:{reducer:(t,e)=>t,prepare:t=>{console.debug("Preparing to enqueue request",t);const{BASE_URL:e,serviceName:s,...a}=t;return ch(a,e,s)}},markForDeletion(t,e){t.deletedRequests.push(e.payload)},markAsDeleted(t,e){const s=t.deletedRequests.indexOf(e.payload);s!==-1&&t.deletedRequests.splice(s,1)},_setLatestRetryTime:(t,e)=>{t.latestRetryTime=e.payload}}}),TS=t=>t.outboxReducer.deletedRequests,IS=t=>t.outboxReducer.latestRetryTime,{enqueueRequest:rh,markForDeletion:RS,markAsDeleted:dh,_setLatestRetryTime:uh}=Ua.actions,oh=Ua.reducer,fe=F(t=>t.uuid),lh=fe.getInitialState({}),$a=l.createSlice({name:"projectAttachments",initialState:lh,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,lh)),reducers:{initializeProjectAttachments:fe.initialize,addProjectAttachment:fe.addOne,addProjectAttachments:fe.addMany,setProjectAttachment:fe.setOne,setProjectAttachments:fe.setMany,updateProjectAttachment:fe.updateOne,updateProjectAttachments:fe.updateMany,deleteProjectAttachment:fe.deleteOne,deleteProjectAttachments:fe.deleteMany}}),{initializeProjectAttachments:hh,addProjectAttachment:OS,addProjectAttachments:mh,setProjectAttachment:ph,setProjectAttachments:Ah,updateProjectAttachment:_S,updateProjectAttachments:yh,deleteProjectAttachment:fh,deleteProjectAttachments:Ba}=$a.actions,Sh=t=>t.projectAttachmentReducer.instances,gh=l.createSelector([Sh],t=>Object.values(t)),bh=t=>e=>e.projectAttachmentReducer.instances[t],Ph=S(l.createSelector([gh,(t,e)=>e],(t,e)=>g(t.filter(({project:s})=>e===s)))),Fh=$a.reducer,Se=F(t=>t.uuid),Th=Se.getInitialState({activeProjectFileId:null,isImportingProjectFile:!1}),Ga=l.createSlice({name:"projectFiles",initialState:Th,extraReducers:t=>t.addCase("RESET",e=>Object.assign(e,Th)),reducers:{initializeProjectFiles:Se.initialize,setProjectFile:Se.setOne,setProjectFiles:Se.setMany,addProjectFile:Se.addOne,addProjectFiles:Se.addMany,updateProjectFile:Se.updateOne,updateProjectFiles:Se.updateMany,deleteProjectFile:Se.deleteOne,deleteProjectFiles:Se.deleteMany,setIsImportingProjectFile:(t,e)=>{t.isImportingProjectFile=e.payload},saveActiveProjectFileBounds:(t,e)=>{const s=t.activeProjectFileId;if(!s)throw new Error("Tried to save bounds for active project file, but no active project file was set.");if(!t.instances[s])throw new Error(`Tried to save bounds for active project file, but project file with ID ${s}
|
|
2
|
-
doesn't exist.`);t.instances[
|
|
3
|
-
Action:`,
|
|
4
|
-
Retries:`,
|
|
5
|
-
Action:`,
|
|
6
|
-
`):
|
|
7
|
-
`):`${
|
|
8
|
-
`)}catch(c){console.error("Failed to extract error message from response body",c)}}else typeof t.body=="string"&&(s=t.body);else t!=null&&t.text?s=t.text:e instanceof Error&&(s=e.message);return!s||s.length>og?Be:s}class M extends Error{constructor(s){super(Be);f(this,"status");f(this,"response");f(this,"message");f(this,"options");const{response:a,innerError:c}=s;this.message=s.message??lg(a,c)??Be,this.status=(a==null?void 0:a.status)??0,this.response=a,s.discard=s.discard??!1,this.options=s}}class hg extends Hh{constructor(e){super(e)}}class R extends Hh{constructor(s,a){super(s);f(this,"auth");this.auth=a}}class mg extends R{async startConversation(e,s){return this.enqueueRequest({description:"Start agent conversation",method:h.POST,url:"/agents/prompt/",payload:{prompt:e,active_project:s},blockers:["prompt"],blocks:["prompt"]}).then(a=>(this.dispatch(Fc(a)),a))}async continueConversation(e,s,a){return this.enqueueRequest({description:"Prompt agent",method:h.POST,url:"/agents/prompt/",payload:{prompt:e,active_project:a},blockers:["prompt"],blocks:["prompt"],queryParams:{conversation_id:s}}).then(c=>{this.dispatch(Ic(c))})}async fetchDetails(e){return this.enqueueRequest({description:"Get agent conversation",method:h.GET,url:`/agents/conversations/${e}/`,blockers:["conversation"],blocks:["conversation"]}).then(s=>{this.dispatch(Tc(s))})}async rate(e,s){return this.enqueueRequest({description:"Rate agent response",method:h.PUT,url:`/agents/responses/${e}/rate/`,payload:{rating:s},blockers:["rate"],blocks:["rate"]})}async refreshStore(e){const s=await this.enqueueRequest({description:"Get agent conversation history",method:h.GET,url:`/projects/${e}/agent-conversations/`,blockers:["agent-conversations"],blocks:["agent-conversations"]});this.dispatch(Pc(s))}}class w extends R{getNumberOfAttachmentsWithSha1(e){const{issueAttachmentReducer:s,assetAttachmentReducer:a,assetTypeAttachmentReducer:c,documentAttachmentReducer:n,projectAttachmentReducer:r,formRevisionAttachmentReducer:u,formSubmissionAttachmentReducer:m,geoImageReducer:d,assetTypeFieldsAttachmentReducer:o,assetTypeFieldValuesAttachmentReducer:p,issueTypeFieldsAttachmentReducer:A,issueTypeFieldValuesAttachmentReducer:y}=this.client.store.getState();return[].concat(Object.values(s.instances),Object.values(a.instances),Object.values(c.instances),Object.values(n.instances),Object.values(r.instances),Object.values(u.instances),Object.values(m.instances),Object.values(d.instances),Object.values(o.instances),Object.values(p.instances),Object.values(A.instances),Object.values(y.instances)).filter(P=>P.file_sha1===e).length}processPresignedUrls(e){const s={};for(const[a,c]of Object.entries(e))s[a]=this.enqueueRequest({url:c.url,description:"Upload file to S3",method:h.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:a,blockers:[`s3-${c.fields.key}`],blocks:[a],s3url:c});return s}async getFilePayload(e){const s=await ke(e),a={sha1:s,file_type:e.type,extension:e.name.split(".").pop(),size:e.size};return await this.client.files.addCache(e,s),a}}class Te extends w{async _bulkAdd(e){var d;const{store:s}=this.client,a=(d=s.getState().userReducer.currentUser)==null?void 0:d.id,c=new Date().toISOString(),n=[],r=[],u={};for(const o of e){const{modelUuid:p,file:A}=o,y=await this.getFilePayload(A);y.sha1 in u||(u[y.sha1]=y);const b=this.buildOfflineAttachment({file:A,file_sha1:y.sha1,submitted_at:c,created_by:a,description:"",modelUuid:p});n.push(b),r.push(this.buildAttachmentPayload({uuid:b.uuid,file_name:b.file_name,file_sha1:b.file_sha1,file_extension:y.extension,description:b.description,modelUuid:p}))}this.dispatch(this.addAttachments(n));const m=this.enqueueRequest({description:`Add ${this.name}`,method:h.POST,url:`${this.url}/bulk/`,payload:{submitted_at:c,attachments:r,files:Object.values(u)},blocks:n.map(o=>o.uuid),blockers:n.map(o=>o.file_sha1)});return m.then(({attachments:o,presigned_urls:p})=>{this.dispatch(this.updateAttachments(o)),this.processPresignedUrls(p)}).catch(()=>{this.dispatch(this.removeAttachments(n.map(o=>o.uuid)))}),[n,m.then(({attachments:o})=>o)]}async _delete(e){const{store:s}=this.client,a=this.selectAttachment(e)(s.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 c=this.enqueueRequest({description:`Delete ${this.name}`,method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return c.then(()=>{this.getNumberOfAttachmentsWithSha1(a.file_sha1)===0&&this.client.files.removeCache(a.file_sha1)}).catch(()=>{this.dispatch(this.setAttachment(a))}),c}}class pg extends Te{constructor(){super(...arguments);f(this,"name","Asset Attachment");f(this,"url","/asset-attachments");f(this,"initializeAttachments",Zt);f(this,"addAttachments",xt);f(this,"updateAttachments",vc);f(this,"removeAttachments",es);f(this,"removeAttachment",wc);f(this,"setAttachment",_c);f(this,"selectAttachment",jc)}buildOfflineAttachment(s){return I({file:URL.createObjectURL(s.file),file_sha1:s.file_sha1,created_by:s.created_by,file_name:s.file.name,file_type:s.file.type,submitted_at:s.submitted_at,description:s.description,asset:s.modelUuid})}buildAttachmentPayload(s){return{...s,asset:s.modelUuid}}async bulkAdd(s){return this._bulkAdd(s.map(a=>({modelUuid:a.assetUuid,file:a.file})))}async delete(s){return this._delete(s)}async refreshStore(s){const a=await this.enqueueRequest({description:"Get asset attachments",method:h.GET,url:`${this.url}/`,queryParams:{project:s},blocks:[],blockers:[]});this.dispatch(Zt(a))}}class Ag extends Te{constructor(){super(...arguments);f(this,"name","Asset Procedure Attachment");f(this,"url","/asset-procedure-attachments");f(this,"addAttachments",Cc);f(this,"updateAttachments",Uc);f(this,"removeAttachments",Bc);f(this,"removeAttachment",$c);f(this,"setAttachment",Dc);f(this,"selectAttachment",Nc)}buildOfflineAttachment(s){return I({file:URL.createObjectURL(s.file),file_sha1:s.file_sha1,created_by:s.created_by,file_name:s.file.name,file_type:s.file.type,submitted_at:s.submitted_at,description:s.description,asset_procedure:s.modelUuid})}buildAttachmentPayload(s){return{...s,asset_procedure:s.modelUuid}}async bulkAdd(s){return this._bulkAdd(s.map(a=>({modelUuid:a.assetProcedureUuid,file:a.file})))}async delete(s){return this._delete(s)}async refreshStore(s){const a=await this.enqueueRequest({description:"Get asset procedure attachments",method:h.GET,url:`${this.url}/`,queryParams:{organization:s},blocks:[],blockers:[]});this.dispatch(zc(a))}}class yg extends w{async bulkAdd(e){var m;const s=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,c={},n=[],r=[];for(const d of e){const{fieldsRevisionUuid:o,fieldIdentifier:p,file:A}=d,y=await this.getFilePayload(A);y.sha1 in c||(c[y.sha1]=y);const b=I({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:y.sha1,created_by:a,fields_revision:o,submitted_at:s,field_identifier:p});n.push(b);const P={uuid:b.uuid,file_name:A.name,field_identifier:p,file_extension:y.extension,file_sha1:y.sha1,fields_revision:o};r.push(P)}this.dispatch(Yc(n));const u=this.enqueueRequest({description:"Add asset procedure fields attachments",method:h.POST,url:"/asset-procedure-fields-attachments/bulk/",payload:{submitted_at:s,attachments:r,files:Object.values(c)},blockers:n.map(d=>d.fields_revision),blocks:n.map(d=>d.uuid)});return u.then(d=>{this.processPresignedUrls(d.presigned_urls),this.dispatch(Jc(d.attachments))}).catch(()=>{this.dispatch(Xc(n.map(d=>d.uuid)))}),[n,u.then(({attachments:d})=>d)]}async refreshStore(e){const s=await this.enqueueRequest({description:"Get asset procedure fields attachments",method:h.GET,url:"/asset-procedure-fields-attachments/",queryParams:{organization:e},blockers:[],blocks:[]});this.dispatch(Kc(s))}}class fg extends R{add(e){var u;const{store:s}=this.client,a=(u=s.getState().userReducer.currentUser)==null?void 0:u.id,c=new Date().toISOString(),n=I({...e,created_by:a,submitted_at:c});this.dispatch(sn(n));const r=this.enqueueRequest({description:"Add Asset Procedure Fields",method:h.POST,url:"/asset-procedure-fields/",payload:n,blockers:[n.asset_procedure],blocks:[n.uuid]});return r.then(m=>{this.dispatch(an(m))}).catch(m=>{throw this.dispatch(cn(n.uuid)),m}),[n,r]}async refreshStore(e){const s=await this.enqueueRequest({description:"Get Asset Procedure Fields",method:h.GET,url:"/asset-procedure-fields/",queryParams:{organization:e},blockers:[],blocks:[]});this.dispatch(tn(s))}}function je(t,e){const s=[];let a=0;const c=t.length;for(;a<c;)s.push(t.slice(a,a+=e));return s}class Sg extends w{async bulkAdd(e,s){var d;const a=new Date().toISOString(),c=(d=this.client.store.getState().userReducer.currentUser)==null?void 0:d.id,n=je(e,s??e.length),r=[],u=[];for(const o of n){const p={},A=[];for(const y of o){const{fieldValuesUuid:b,fieldIdentifier:P,file:T}=y,O=await this.getFilePayload(T);O.sha1 in p||(p[O.sha1]=O);const E=I({file:URL.createObjectURL(T),file_type:T.type,file_name:T.name,file_sha1:O.sha1,created_by:c,field_values:b,submitted_at:a,field_identifier:P});r.push(E);const Le={uuid:E.uuid,file_name:T.name,file_sha1:O.sha1,file_extension:O.extension,field_identifier:P,field_values:b};A.push(Le)}u.push({submitted_at:a,attachments:A,files:Object.values(p)})}this.dispatch(dt(r));const m=u.map(o=>this.enqueueRequest({description:"Add asset procedure field values attachments",method:h.POST,url:"/asset-procedure-field-values-attachments/bulk/",payload:o,blockers:o.attachments.map(p=>p.field_values),blocks:o.attachments.map(p=>p.uuid)}));return Promise.all(m).then(o=>{for(const A of o)this.processPresignedUrls(A.presigned_urls);const p=o.flatMap(A=>A.attachments);this.dispatch(on(p))}).catch(o=>{throw this.dispatch(ut(r.map(p=>p.uuid))),o}),[r,m.map(o=>o.then(({attachments:p})=>p))]}async bulkDelete(e){const{store:s}=this.client,a=s.getState(),c=hn(e)(a);this.dispatch(ut(e));try{await this.enqueueRequest({description:"Delete asset procedure field values attachments",method:h.DELETE,url:"/asset-procedure-field-values-attachments/bulk/",payload:{attachment_ids:e},blockers:e,blocks:[]})}catch(n){throw this.dispatch(dt(c)),n}}async refreshStore(e){const s=await this.enqueueRequest({description:"Get asset procedure field values attachments",method:h.GET,url:"/asset-procedure-field-values-attachments/",queryParams:{project:e},blockers:[],blocks:[]});this.dispatch(un(s))}}class gg extends R{add(e){var r;const{store:s}=this.client,a=s.getState(),c=I({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),n=this.enqueueRequest({description:"Add asset procedure field values",method:h.POST,url:"/asset-procedure-field-values/",payload:_(c),blockers:[e.asset,e.fields_revision,e.asset_procedure_instance],blocks:[c.uuid]});return this.dispatch(ds(c)),n.then(u=>(this.dispatch(We(u)),u)).catch(()=>{this.dispatch(us(c.uuid))}),[c,n]}bulkAdd(e,s){var m;const a=new Date().toISOString(),c=[],n=je(e.payloads,s??e.payloads.length),r=[];for(const d of n){const o=[];for(const p of d){const A=I({...p,values:p.values,created_by:(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,submitted_at:a});c.push(A),o.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:o})}this.dispatch(fn(c));const u=[];for(const d of r){const o=d.field_values.map(P=>P.asset),p=d.field_values.map(P=>P.fields_revision),A=d.field_values.map(P=>P.asset_procedure_instance),y=d.field_values.map(P=>P.uuid),b=this.enqueueRequest({description:"Bulk add asset procedure field values",method:h.POST,url:"/asset-procedure-field-values/bulk/",payload:d,blockers:[...o,...p,...A],blocks:y});u.push(b)}return Promise.all(u).then(d=>{this.dispatch(Sn(d.flat()))}).catch(()=>{this.dispatch(gn(c.map(d=>d.uuid)))}),[c,u]}update(e){const{store:s}=this.client,a=s.getState(),c=ls(e.uuid)(a);if(!c)throw new Error(`Expected AssetProcedureFieldValues with uuid ${e.uuid} to exist`);const n={...c,...e};this.dispatch(We(n));const r=this.enqueueRequest({description:"Update asset procedure field values",method:h.PATCH,url:`/asset-procedure-field-values/${e.uuid}/`,payload:e,blockers:[n.fields_revision,n.asset,n.asset_procedure_instance],blocks:[n.uuid]});return r.then(u=>{this.dispatch(We(u))}).catch(()=>{this.dispatch(We(c))}),[n,r]}async delete(e){const{store:s}=this.client,a=s.getState(),c=ls(e)(a);if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const n=mn(e)(a);this.dispatch(us(e)),this.dispatch(ut(n.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete asset procedure field values",method:h.DELETE,url:`/asset-procedure-field-values/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(ds(c)),this.dispatch(dt(n)),r}}async refreshStore(e){const s=await this.enqueueRequest({description:"Get asset procedure field values",method:h.GET,url:"/asset-procedure-field-values/",queryParams:{project:e},blockers:[],blocks:[]});this.dispatch(yn(s))}}class bg extends R{add(e){var u;const{store:s}=this.client,a=(u=s.getState().userReducer.currentUser)==null?void 0:u.id,c=new Date().toISOString(),n=I({...e,created_by:a,submitted_at:c});this.dispatch(ms(n));const r=this.enqueueRequest({description:"Create asset procedure instance",method:h.POST,url:"/asset-procedure-instances/",payload:_(n),blockers:[e.asset_procedure,e.asset_type],blocks:[n.uuid]});return r.then(m=>{this.dispatch(Ke(m))}).catch(()=>{this.dispatch(ps(n.uuid))}),[n,r]}update(e){const{store:s}=this.client,a=fs(e.uuid)(s.getState());if(!a)throw new Error(`Expected asset procedure instance with uuid ${e.uuid} to exist`);const c={...a,...e};this.dispatch(Ke(c));const n=this.enqueueRequest({description:"Update asset procedure instance",method:h.PATCH,url:`/asset-procedure-instances/${e.uuid}/`,payload:e,blockers:[a.uuid],blocks:[a.uuid]});return n.then(r=>{this.dispatch(Ke(r))}).catch(()=>{this.dispatch(Ke(a))}),[c,n]}async remove(e){const{store:s}=this.client,a=s.getState(),c=fs(e)(a);if(!c)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:h.DELETE,url:`/asset-procedure-instances/${e}/`,blockers:[e],blocks:[]}).catch(n=>{throw this.dispatch(ms(c)),n})}async refreshStore(e){const s=await this.enqueueRequest({description:"Get asset procedure instances",method:h.GET,url:"/asset-procedure-instances/",queryParams:{project:e},blockers:[],blocks:[]});this.dispatch(Tn(s))}}class Pg extends R{add(e){var u;const{store:s}=this.client,a=(u=s.getState().userReducer.currentUser)==null?void 0:u.id,c=new Date().toISOString(),n=I({...e,created_by:a,submitted_at:c});this.dispatch(gs(n));const r=this.enqueueRequest({description:"Create asset procedure",method:h.POST,url:"/asset-procedures/",payload:_(n),blockers:[],blocks:[n.uuid]});return r.then(m=>{this.dispatch(Ye(m))}).catch(()=>{this.dispatch(bs(n.uuid))}),[n,r]}update(e){const{store:s}=this.client,a=Fs(e.uuid)(s.getState());if(!a)throw new Error(`Expected asset procedure with uuid ${e.uuid} to exist`);const c={...a,...e};this.dispatch(Ye(c));const n=this.enqueueRequest({description:"Update asset procedure",method:h.PATCH,url:`/asset-procedures/${e.uuid}/`,payload:e,blockers:[a.uuid],blocks:[a.uuid]});return n.then(r=>{this.dispatch(Ye(r))}).catch(()=>{this.dispatch(Ye(a))}),[c,n]}async remove(e){const{store:s}=this.client,a=s.getState(),c=Fs(e)(a);if(!c)throw new Error(`Expected asset procedure with uuid ${e} to exist`);const n=On(e)(a);return this.dispatch(bs(e)),this.dispatch(Rn(n.map(r=>r.uuid))),this.enqueueRequest({description:"Delete asset procedure",method:h.DELETE,url:`/asset-procedures/${e}/`,blockers:[e],blocks:[]}).catch(r=>{throw this.dispatch(gs(c)),this.dispatch(In(n)),r})}async refreshStore(e){const s=await this.enqueueRequest({description:"Get asset procedures",method:h.GET,url:"/asset-procedures/",queryParams:{organization:e},blockers:[],blocks:[]});this.dispatch(wn(s))}}class Fg extends w{async bulkAdd(e){var m;const s=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,c={},n=[],r=[];for(const d of e){const{fieldsRevisionUuid:o,fieldIdentifier:p,file:A}=d,y=await this.getFilePayload(A);y.sha1 in c||(c[y.sha1]=y);const b=I({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:y.sha1,created_by:a,fields_revision:o,submitted_at:s,field_identifier:p});n.push(b);const P={uuid:b.uuid,file_name:A.name,field_identifier:p,file_extension:y.extension,file_sha1:y.sha1,fields_revision:o};r.push(P)}this.dispatch(Vn(n));const u=this.enqueueRequest({description:"Add asset procedure step fields attachments",method:h.POST,url:"/asset-procedure-step-fields-attachments/bulk/",payload:{submitted_at:s,attachments:r,files:Object.values(c)},blockers:n.map(d=>d.fields_revision),blocks:n.map(d=>d.uuid)});return u.then(d=>{this.processPresignedUrls(d.presigned_urls),this.dispatch(kn(d.attachments))}).catch(()=>{this.dispatch(zn(n.map(d=>d.uuid)))}),[n,u.then(({attachments:d})=>d)]}async refreshStore(e){const s=await this.enqueueRequest({description:"Get asset procedure step fields attachments",method:h.GET,url:"/asset-procedure-step-fields-attachments/",queryParams:{organization:e},blockers:[],blocks:[]});this.dispatch(Mn(s))}}class Tg extends R{add(e){var u;const{store:s}=this.client,a=(u=s.getState().userReducer.currentUser)==null?void 0:u.id,c=new Date().toISOString(),n=I({...e,created_by:a,submitted_at:c});this.dispatch(Rs(n));const r=this.enqueueRequest({description:"Add Asset Procedure Step Fields",method:h.POST,url:"/asset-procedure-step-fields/",payload:n,blockers:[n.asset_procedure_step],blocks:[n.uuid]});return r.then(m=>{this.dispatch(Je(m))}).catch(m=>{throw this.dispatch(Os(n.uuid)),m}),[n,r]}update(e){const{store:s}=this.client,a=s.getState().assetProcedureStepFieldsReducer.instances[e.uuid];if(!a)throw new Error(`AssetProcedureStepFields with uuid ${e.uuid} not found`);const c={...a,...e};this.dispatch(Je(c));const n=this.enqueueRequest({description:"Update Asset Procedure Step Fields",method:h.PATCH,url:`/asset-procedure-step-fields/${a.uuid}/`,payload:e,blockers:[a.uuid],blocks:[a.uuid]});return n.then(r=>{this.dispatch(Je(r))}).catch(r=>{throw this.dispatch(Je(a)),r}),[c,n]}delete(e){const{store:s}=this.client,a=s.getState().assetProcedureStepFieldsReducer.instances[e];if(!a)throw new Error(`AssetProcedureStepFields with uuid ${e} not found`);this.dispatch(Os(e));const c=this.enqueueRequest({description:"Delete Asset Procedure Step Fields",method:h.DELETE,url:`/asset-procedure-step-fields/${e}/`,blockers:[e],blocks:[e]});return c.catch(n=>{throw this.dispatch(Rs(a)),n}),c}async refreshStore(e){const s=await this.enqueueRequest({description:"Get Asset Procedure Step Fields",method:h.GET,url:"/asset-procedure-step-fields/",queryParams:{organization:e},blockers:[],blocks:[]});this.dispatch(Bn(s))}}class Ig extends w{async bulkAdd(e,s){var d;const a=new Date().toISOString(),c=(d=this.client.store.getState().userReducer.currentUser)==null?void 0:d.id,n=je(e,s??e.length),r=[],u=[];for(const o of n){const p={},A=[];for(const y of o){const{fieldValuesUuid:b,fieldIdentifier:P,file:T}=y,O=await this.getFilePayload(T);O.sha1 in p||(p[O.sha1]=O);const E=I({file:URL.createObjectURL(T),file_type:T.type,file_name:T.name,file_sha1:O.sha1,created_by:c,field_values:b,submitted_at:a,field_identifier:P});r.push(E);const Le={uuid:E.uuid,file_name:T.name,file_sha1:O.sha1,file_extension:O.extension,field_identifier:P,field_values:b};A.push(Le)}u.push({submitted_at:a,attachments:A,files:Object.values(p)})}this.dispatch(ot(r));const m=u.map(o=>this.enqueueRequest({description:"Add asset procedure step field values attachments",method:h.POST,url:"/asset-procedure-step-field-values-attachments/bulk/",payload:o,blockers:o.attachments.map(p=>p.field_values),blocks:o.attachments.map(p=>p.uuid)}));return Promise.all(m).then(o=>{for(const A of o)this.processPresignedUrls(A.presigned_urls);const p=o.flatMap(A=>A.attachments);this.dispatch(Hn(p))}).catch(o=>{throw this.dispatch(lt(r.map(p=>p.uuid))),o}),[r,m.map(o=>o.then(({attachments:p})=>p))]}async bulkDelete(e){const{store:s}=this.client,a=s.getState(),c=Kn(e)(a);this.dispatch(lt(e));try{await this.enqueueRequest({description:"Delete asset procedure step field values attachments",method:h.DELETE,url:"/asset-procedure-step-field-values-attachments/bulk/",payload:{attachment_ids:e},blockers:e,blocks:[]})}catch(n){throw this.dispatch(ot(c)),n}}async refreshStore(e){const s=await this.enqueueRequest({description:"Get asset procedure step field values attachments",method:h.GET,url:"/asset-procedure-step-field-values-attachments/",queryParams:{project:e},blockers:[],blocks:[]});this.dispatch(Nn(s))}}class Rg extends R{add(e){var r;const{store:s}=this.client,a=s.getState(),c=I({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),n=this.enqueueRequest({description:"Add asset procedure step field values",method:h.POST,url:"/asset-procedure-step-field-values/",payload:_(c),blockers:[e.asset,e.fields_revision,e.asset_procedure_instance],blocks:[c.uuid]});return this.dispatch(js(c)),n.then(u=>(this.dispatch(Xe(u)),u)).catch(()=>{this.dispatch(Ms(c.uuid))}),[c,n]}bulkAdd(e,s){var m;const a=new Date().toISOString(),c=[],n=je(e.payloads,s??e.payloads.length),r=[];for(const d of n){const o=[];for(const p of d){const A=I({...p,values:p.values,created_by:(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,submitted_at:a});c.push(A),o.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:o})}this.dispatch(Zn(c));const u=[];for(const d of r){const o=d.field_values.map(P=>P.asset),p=d.field_values.map(P=>P.fields_revision),A=d.field_values.map(P=>P.asset_procedure_instance),y=d.field_values.map(P=>P.uuid),b=this.enqueueRequest({description:"Bulk add asset procedure step field values",method:h.POST,url:"/asset-procedure-step-field-values/bulk/",payload:d,blockers:[...o,...p,...A],blocks:y});u.push(b)}return Promise.all(u).then(d=>{this.dispatch(xn(d.flat()))}).catch(()=>{this.dispatch(er(c.map(d=>d.uuid)))}),[c,u]}update(e){const{store:s}=this.client,a=s.getState(),c=Vs(e.uuid)(a);if(!c)throw new Error(`Expected AssetProcedureStepFieldValues with uuid ${e.uuid} to exist`);const n={...c,...e};this.dispatch(Xe(n));const r=this.enqueueRequest({description:"Update asset procedure step field values",method:h.PATCH,url:`/asset-procedure-step-field-values/${e.uuid}/`,payload:e,blockers:[n.fields_revision,n.asset,n.asset_procedure_instance],blocks:[n.uuid]});return r.then(u=>{this.dispatch(Xe(u))}).catch(()=>{this.dispatch(Xe(c))}),[n,r]}async delete(e){const{store:s}=this.client,a=s.getState(),c=Vs(e)(a);if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const n=Yn(e)(a);this.dispatch(Ms(e)),this.dispatch(lt(n.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete asset procedure step field values",method:h.DELETE,url:`/asset-procedure-step-field-values/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(js(c)),this.dispatch(ot(n)),r}}async refreshStore(e){const s=await this.enqueueRequest({description:"Get asset procedure step field values",method:h.GET,url:"/asset-procedure-step-field-values/",queryParams:{project:e},blockers:[],blocks:[]});this.dispatch(Qn(s))}}class Og extends R{bulkAdd(e,s){var m;const a=new Date().toISOString(),c=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n=e.map(d=>I(d)),r=n.map(d=>({...d,asset_procedure:s,created_by:c,submitted_at:a}));this.dispatch(zs(r));const u=this.enqueueRequest({description:"Add asset procedure steps",method:h.POST,url:"/asset-procedure-steps/bulk/",payload:{submitted_at:a,asset_procedure:s,steps:n},blockers:[s],blocks:n.map(({uuid:d})=>d)});return u.then(d=>{this.dispatch(mt(d))}).catch(()=>{this.dispatch(Ds(r.map(({uuid:d})=>d)))}),[r,u]}async bulkUpdate(e,s){const c=this.client.store.getState(),n=Us(e.map(({uuid:r})=>r))(c);return this.dispatch(mt(e)),this.enqueueRequest({description:"Edit asset procedure steps",method:h.PATCH,url:`/asset-procedures/${s}/bulk-update-steps/`,payload:{steps:e},blockers:[s],blocks:e.map(({uuid:r})=>r)}).catch(r=>{throw this.dispatch(mt(n)),r})}async bulkDelete(e){const{store:s}=this.client,a=Us(e)(s.getState());this.dispatch(Ds(e));const c=this.enqueueRequest({description:"Delete asset procedure steps",method:h.DELETE,url:"/asset-procedure-steps/bulk/",payload:{step_ids:e},blockers:e,blocks:[]});return c.catch(()=>{this.dispatch(zs(a))}),c}update(e){const{store:s}=this.client,a=rr(e.uuid)(s.getState());if(!a)throw new Error(`No asset procedure step with uuid ${e.uuid} found in the store`);const c={...a,...e};this.dispatch(Cs(c));const n=this.enqueueRequest({description:"Update asset procedure step",method:h.PATCH,url:`/asset-procedure-steps/${a.uuid}/`,payload:{name:e.name,description:e.description,priority:e.order,color:e.color},blockers:[a.uuid],blocks:[a.uuid]});return n.then(r=>{this.dispatch(Cs(r))}).catch(()=>{this.dispatch(cr(a))}),[c,n]}async refreshStore(e){const s=await this.enqueueRequest({description:"Get asset procedure steps",method:h.GET,url:"/asset-procedure-steps/",queryParams:{organization:e},blockers:[],blocks:[]});this.dispatch(ar(s))}}class _g extends R{add(e){var u;const{store:s}=this.client;if(!e.canvas_marker&&!e.geo_marker)throw new Error("Asset must have either a canvas_marker or geo_marker");const a=(u=s.getState().userReducer.currentUser)==null?void 0:u.id,c=new Date().toISOString(),n=I({...e,created_by:a,submitted_at:c});this.dispatch(Bs(n));const r=this.enqueueRequest({description:"Create asset",method:h.POST,url:"/assets/",payload:_(n),blockers:[n.asset_type],blocks:[n.uuid]});return r.then(m=>{this.dispatch(Qe(m))}).catch(()=>{this.dispatch(Gs(n.uuid))}),[n,r]}update(e){const{store:s}=this.client,a=Ws(e.uuid)(s.getState());if(!a)throw new Error(`No asset with uuid ${e.uuid} found in the store`);const c={...a,...e};if(!c.canvas_marker&&!c.geo_marker)throw new Error("Asset must have either a canvas_marker or geo_marker");this.dispatch(Qe(c));const n=this.enqueueRequest({description:"Edit asset",method:h.PATCH,url:`/assets/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return n.then(r=>{this.dispatch(Qe(r))}).catch(()=>{this.dispatch(Qe(a))}),[c,n]}async delete(e){const{store:s}=this.client,a=s.getState(),c=Ws(e)(a);if(!c)throw new Error(`No asset with uuid ${e} found in the store`);const n=Mc(e)(a),r=wu(e)(a),u=Ku(e)(a);if(this.dispatch(Gs(e)),n.length>0){const m=n.map(({uuid:d})=>d);this.dispatch(es(m))}if(r.length>0){const m=r.map(({uuid:d})=>d);this.dispatch(vt(m))}if(u.length>0){const m=u.map(({uuid:d})=>d);this.dispatch(Zi(m))}return this.enqueueRequest({description:"Delete asset",method:h.DELETE,url:`/assets/${e}/`,blockers:[e],blocks:[]}).catch(m=>{throw this.dispatch(Bs(c)),this.dispatch(xt(n)),this.dispatch(_t(r)),this.dispatch(Xi(u)),m})}bulkAdd(e,s,a,c){const n=new Date().toISOString(),r=Ie.v4(),u=je(e,c).map(o=>{const p=o.map(A=>I(A));return{batchId:Ie.v4(),payload:{transaction_id:r,submitted_at:n,asset_type:s,project:a,assets:p}}}),m=[];let d=null;for(const o of u){const{batchId:p,payload:A}=o,y=A.assets.map(O=>O.uuid),b=[s];d&&b.push(d);const P=y;P.push(p);const T=this.enqueueRequest({description:"Batch create assets",method:h.POST,url:"/assets/bulk/",payload:A,blockers:b,blocks:P});d=o.batchId,m.push(T)}return Promise.all(m).then(o=>{const p=o.flat();this.dispatch(At(p))}),m}async bulkDelete(e){const{store:s}=this.client,a=s.getState(),c=hr(e)(a);this.dispatch(Ls(e));try{await this.enqueueRequest({description:"Bulk delete assets",method:h.DELETE,url:"/assets/bulk/",payload:{asset_ids:e},blockers:e,blocks:[]})}catch(n){throw this.dispatch(At(c)),n}}async refreshStore(e){const s=await this.enqueueRequest({description:"Get assets",method:h.GET,url:"/assets/",queryParams:{project:e},blockers:[],blocks:[]});this.dispatch(or(s))}}class vg extends R{add(e){var u;const{store:s}=this.client,a=(u=s.getState().userReducer.currentUser)==null?void 0:u.id,c=new Date().toISOString(),n=I({...e,created_by:a,submitted_at:c});this.dispatch(Ys(n));const r=this.enqueueRequest({description:"Add asset stage completion",method:h.POST,url:"/asset-stage-completions/",payload:_(n),blockers:[e.asset,e.stage],blocks:[n.uuid]});return r.then(m=>{this.dispatch(yr(m))}).catch(()=>{this.dispatch(Xs(n.uuid))}),[n,r]}delete(e){const{store:s}=this.client,a=gr(e)(s.getState());if(!a)throw new Error(`Expected asset stage completion with uuid ${e} to exist`);this.dispatch(Xs(e));const c=this.enqueueRequest({description:"Delete asset stage completion",method:h.DELETE,url:`/asset-stage-completions/${e}/`,blockers:[e],blocks:[]});return c.catch(()=>{this.dispatch(Ys(a))}),c}bulkAdd(e){var d;const{store:s}=this.client,a=new Date().toISOString(),c=(d=s.getState().userReducer.currentUser)==null?void 0:d.id,n=e.map(o=>I(o)),r=n.map(o=>({...o,created_by:c,submitted_at:a})),u=r.map(({uuid:o})=>o);this.dispatch(Js(r));const m=this.enqueueRequest({description:"Bulk create asset stage completions",method:h.POST,url:"/asset-stage-completions/bulk/",payload:{submitted_at:a,completions:n},blockers:[...e.map(o=>o.asset_procedure_instance),...e.map(o=>o.stage),...e.map(o=>o.asset)],blocks:u});return m.then(o=>{this.dispatch(fr(o))}).catch(()=>{this.dispatch(Qs(u))}),[r,m]}bulkDelete(e){const{store:s}=this.client,a=br(e)(s.getState());this.dispatch(Qs(e));const c=this.enqueueRequest({description:"Deleting asset stage completions",method:h.DELETE,url:"/asset-stage-completions/bulk/",payload:{completion_ids:e},blockers:e,blocks:[]});return c.catch(()=>{this.dispatch(Js(a))}),c}async refreshStore(e){const s=await this.enqueueRequest({description:"Get asset stage completions",method:h.GET,url:"/asset-stage-completions/",queryParams:{project:e},blockers:[],blocks:[]});this.dispatch(Ar(s))}}class wg extends R{bulkAdd(e,s){var m;const a=new Date().toISOString(),c=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n=e.map(d=>I(d)),r=n.map(d=>({...d,asset_procedure:s,created_by:c,submitted_at:a}));this.dispatch(ei(r));const u=this.enqueueRequest({description:"Add asset stages",method:h.POST,url:"/asset-stages/bulk/",payload:{submitted_at:a,asset_procedure:s,stages:n},blockers:[s],blocks:n.map(({uuid:d})=>d)});return u.then(d=>{this.dispatch(yt(d))}).catch(()=>{this.dispatch(si(r.map(({uuid:d})=>d)))}),[r,u]}async bulkUpdate(e,s){const c=this.client.store.getState(),n=ii(e.map(({uuid:r})=>r))(c);return this.dispatch(yt(e)),this.enqueueRequest({description:"Edit asset stages",method:h.PATCH,url:`/asset-procedures/${s}/bulk-update-stages/`,payload:{stages:e},blockers:[s],blocks:e.map(({uuid:r})=>r)}).catch(r=>{throw this.dispatch(yt(n)),r})}async bulkDelete(e){const{store:s}=this.client,a=ii(e)(s.getState());this.dispatch(si(e));const c=this.enqueueRequest({description:"Delete asset stages",method:h.DELETE,url:"/asset-stages/bulk/",payload:{stage_ids:e},blockers:e,blocks:[]});return c.catch(()=>{this.dispatch(ei(a))}),c}update(e){const{store:s}=this.client,a=Rr(e.uuid)(s.getState());if(!a)throw new Error(`No asset stage with uuid ${e.uuid} found in the store`);const c={...a,...e};this.dispatch(ti(c));const n=this.enqueueRequest({description:"Update asset stage",method:h.PATCH,url:`/asset-stages/${a.uuid}/`,payload:{name:e.name,description:e.description,priority:e.priority,color:e.color},blockers:[a.uuid],blocks:[a.uuid]});return n.then(r=>{this.dispatch(ti(r))}).catch(()=>{this.dispatch(Tr(a))}),[c,n]}async refreshStore(e){const s=await this.enqueueRequest({description:"Get asset stages",method:h.GET,url:"/asset-stages/",queryParams:{organization:e},blockers:[],blocks:[]});this.dispatch(Fr(s))}}class Eg extends Te{constructor(){super(...arguments);f(this,"name","Asset Type Attachment");f(this,"url","/asset-type-attachments");f(this,"addAttachments",ci);f(this,"updateAttachments",Er);f(this,"removeAttachments",ni);f(this,"removeAttachment",qr);f(this,"setAttachment",wr);f(this,"selectAttachment",Vr)}buildOfflineAttachment(s){return I({file:URL.createObjectURL(s.file),file_sha1:s.file_sha1,created_by:s.created_by,file_name:s.file.name,file_type:s.file.type,submitted_at:s.submitted_at,description:s.description,asset_type:s.modelUuid})}buildAttachmentPayload(s){return{...s,asset_type:s.modelUuid}}async bulkAdd(s){return this._bulkAdd(s.map(a=>({modelUuid:a.assetTypeUuid,file:a.file})))}async delete(s){return this._delete(s)}async refreshStore(s){const a=await this.enqueueRequest({description:"Get asset type attachments",method:h.GET,url:`${this.url}/`,queryParams:{organization:s},blocks:[],blockers:[]});this.dispatch(vr(a))}}class qg extends w{async bulkAdd(e){var m;const s=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,c={},n=[],r=[];for(const d of e){const{fieldsRevisionUuid:o,fieldIdentifier:p,file:A}=d,y=await this.getFilePayload(A);y.sha1 in c||(c[y.sha1]=y);const b=I({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:y.sha1,created_by:a,fields_revision:o,submitted_at:s,field_identifier:p});n.push(b);const P={uuid:b.uuid,file_name:A.name,field_identifier:p,file_extension:y.extension,file_sha1:y.sha1,fields_revision:o};r.push(P)}this.dispatch(Ur(n));const u=this.enqueueRequest({description:"Add asset type fields attachments",method:h.POST,url:"/asset-type-fields-attachments/bulk/",payload:{submitted_at:s,attachments:r,files:Object.values(c)},blockers:n.map(d=>d.fields_revision),blocks:n.map(d=>d.uuid)});return u.then(d=>{this.processPresignedUrls(d.presigned_urls),this.dispatch($r(d.attachments))}).catch(()=>{this.dispatch(Br(n.map(d=>d.uuid)))}),[n,u.then(({attachments:d})=>d)]}async refreshStore(e){const s=await this.enqueueRequest({description:"Get asset type fields attachments",method:h.GET,url:"/asset-type-fields-attachments/",queryParams:{organization:e},blockers:[e],blocks:[]});this.dispatch(Dr(s))}}class jg extends R{add(e){var u;const{store:s}=this.client,a=(u=s.getState().userReducer.currentUser)==null?void 0:u.id,c=new Date().toISOString(),n=I({...e,created_by:a,submitted_at:c});this.dispatch(Kr(n));const r=this.enqueueRequest({description:"Add Asset Type Fields",method:h.POST,url:"/asset-type-fields/",payload:n,blockers:[n.asset_type],blocks:[n.uuid]});return r.then(m=>{this.dispatch(Yr(m))}).catch(m=>{throw this.dispatch(Jr(n.uuid)),m}),[n,r]}async refreshStore(e){const s=await this.enqueueRequest({description:"Get Asset Type Fields",method:h.GET,url:"/asset-type-fields/",queryParams:{organization:e},blockers:[],blocks:[]});this.dispatch(Wr(s))}}class Mg extends w{async bulkAdd(e,s){var d;const a=new Date().toISOString(),c=(d=this.client.store.getState().userReducer.currentUser)==null?void 0:d.id,n=je(e,s??e.length),r=[],u=[];for(const o of n){const p={},A=[];for(const y of o){const{fieldValuesUuid:b,fieldIdentifier:P,file:T}=y,O=await this.getFilePayload(T);O.sha1 in p||(p[O.sha1]=O);const E=I({file:URL.createObjectURL(T),file_type:T.type,file_name:T.name,file_sha1:O.sha1,created_by:c,field_values:b,submitted_at:a,field_identifier:P});r.push(E);const Le={uuid:E.uuid,file_name:T.name,file_sha1:O.sha1,file_extension:O.extension,field_identifier:P,field_values:b};A.push(Le)}u.push({submitted_at:a,attachments:A,files:Object.values(p)})}this.dispatch(gt(r));const m=u.map(o=>this.enqueueRequest({description:"Add asset type field values attachments",method:h.POST,url:"/asset-type-field-values-attachments/bulk/",payload:o,blockers:o.attachments.map(p=>p.field_values),blocks:o.attachments.map(p=>p.uuid)}));return Promise.all(m).then(o=>{for(const A of o)this.processPresignedUrls(A.presigned_urls);const p=o.flatMap(A=>A.attachments);this.dispatch(ed(p))}).catch(o=>{throw this.dispatch(bt(r.map(p=>p.uuid))),o}),[r,m.map(o=>o.then(({attachments:p})=>p))]}async bulkDelete(e){const{store:s}=this.client,a=s.getState(),c=sd(e)(a);this.dispatch(bt(e));try{await this.enqueueRequest({description:"Delete asset type field values attachments",method:h.DELETE,url:"/asset-type-field-values-attachments/bulk/",payload:{attachment_ids:e},blockers:e,blocks:[]})}catch(n){throw this.dispatch(gt(c)),n}}async refreshStore(e){const s=await this.enqueueRequest({description:"Get asset type field values attachments",method:h.GET,url:"/asset-type-field-values-attachments/",queryParams:{project:e},blockers:[],blocks:[]});this.dispatch(xr(s))}}class Vg extends R{add(e){var r;const{store:s}=this.client,a=s.getState(),c=I({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),n=this.enqueueRequest({description:"Add asset type field values",method:h.POST,url:"/asset-type-field-values/",payload:_(c),blockers:[e.asset,e.fields_revision],blocks:[c.uuid]});return this.dispatch(hi(c)),n.then(u=>(this.dispatch(Ze(u)),u)).catch(()=>{this.dispatch(mi(c.uuid))}),[c,n]}bulkAdd(e,s){var m;const a=new Date().toISOString(),c=[],n=je(e.payloads,s??e.payloads.length),r=[];for(const d of n){const o=[];for(const p of d){const A=I({...p,values:p.values,created_by:(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,submitted_at:a});c.push(A),o.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:o})}this.dispatch(rd(c));const u=[];for(const d of r){const o=d.field_values.map(b=>b.asset),p=d.field_values.map(b=>b.fields_revision),A=d.field_values.map(b=>b.uuid),y=this.enqueueRequest({description:"Bulk add asset type field values",method:h.POST,url:"/asset-type-field-values/bulk/",payload:d,blockers:[...o,...p],blocks:A});u.push(y)}return Promise.all(u).then(d=>{this.dispatch(dd(d.flat()))}).catch(()=>{this.dispatch(ud(c.map(d=>d.uuid)))}),[c,u]}update(e){const{store:s}=this.client,a=s.getState(),c=Ai(e.uuid)(a);if(!c)throw new Error(`Expected AssetTypeFieldValues with uuid ${e.uuid} to exist`);const n={...c,...e};this.dispatch(Ze(n));const r=this.enqueueRequest({description:"Delete asset type field values",method:h.PATCH,url:`/asset-type-field-values/${e.uuid}/`,payload:e,blockers:[n.uuid,n.fields_revision,n.asset],blocks:[n.uuid]});return r.then(u=>{this.dispatch(Ze(u))}).catch(()=>{this.dispatch(Ze(c))}),[n,r]}async delete(e){const{store:s}=this.client,a=s.getState(),c=Ai(e)(a);if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const n=id(e)(a);this.dispatch(mi(e)),this.dispatch(bt(n.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete asset type field values",method:h.DELETE,url:`/asset-type-field-values/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(hi(c)),this.dispatch(gt(n)),r}}async refreshStore(e){const s=await this.enqueueRequest({description:"Get asset type field values",method:h.GET,url:"/asset-type-field-values/",queryParams:{project:e},blockers:[],blocks:[]});this.dispatch(nd(s))}}class kg extends R{add(e){var u;const{store:s}=this.client,a=(u=s.getState().userReducer.currentUser)==null?void 0:u.id,c=new Date().toISOString(),n=I({...e,created_by:a,submitted_at:c});this.dispatch(fi(n));const r=this.enqueueRequest({description:"Create asset type",method:h.POST,url:"/asset-types/",payload:_(n),blockers:[],blocks:[n.uuid]});return r.then(m=>{this.dispatch(xe(m))}).catch(()=>{this.dispatch(Si(n.uuid))}),[n,r]}update(e){const{store:s}=this.client,a=bi(e.uuid)(s.getState());if(!a)throw new Error(`Expected asset type with uuid ${e.uuid} to exist`);const c={...a,...e};this.dispatch(xe(c));const n=this.enqueueRequest({description:"Update asset type",method:h.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 n.then(r=>{this.dispatch(xe(r))}).catch(()=>{this.dispatch(xe(a))}),[c,n]}async delete(e){const{store:s}=this.client,a=s.getState(),c=bi(e)(a);if(!c)throw new Error(`Expected asset type with uuid ${e} to exist`);const n=Hs(e)(a),r=kr(e)(a);return this.dispatch(Si(e)),this.dispatch(Ls(n.map(u=>u.uuid))),this.dispatch(ni(r.map(({uuid:u})=>u))),this.enqueueRequest({description:"Delete asset type",method:h.DELETE,url:`/asset-types/${e}/`,blockers:[e],blocks:[]}).catch(u=>{throw this.dispatch(fi(c)),this.dispatch(At(n)),this.dispatch(ci(r)),u})}async refreshStore(e){const s=await this.enqueueRequest({description:"Get asset types",method:h.GET,url:"/asset-types/",queryParams:{organization:e},blockers:[],blocks:[]});this.dispatch(md(s))}}class zg extends R{add(e){var u;const{store:s}=this.client,a=(u=s.getState().userReducer.currentUser)==null?void 0:u.id,c=new Date().toISOString(),n=I({...e,created_by:a,submitted_at:c});this.dispatch(Fi(n));const r=this.enqueueRequest({description:"Create Category",method:h.POST,url:"/categories/",payload:_(n),blockers:[e.project],blocks:[n.uuid]});return[n,r]}update(e){const s=this.client.store.getState(),a=Ii(e.uuid)(s);if(!a)throw new Error(`Expected an existing category with uuid ${e.uuid}`);const c={...a,...e};this.dispatch(bd(c));const n=this.enqueueRequest({description:"Edit Category",method:h.PATCH,url:`/categories/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return[c,n]}remove(e){const{store:s}=this.client,a=Ii(e)(s.getState());if(!a)throw new Error(`No category with uuid ${e} found in the store`);this.dispatch(Pd(e));const c=this.enqueueRequest({description:"Delete Category",method:h.DELETE,url:`/categories/${a.uuid}/`,blockers:[a.uuid],blocks:[]});return c.catch(()=>{this.dispatch(Fi(a))}),c}async refreshStore(e){const s=await this.enqueueRequest({description:"Get categories",method:h.GET,url:"/categories/",queryParams:{project:e},blocks:[],blockers:[]});this.dispatch(gd(s))}}class Cg extends Te{constructor(){super(...arguments);f(this,"name","Document Attachment");f(this,"url","/document-attachments");f(this,"addAttachments",Rd);f(this,"updateAttachments",_d);f(this,"removeAttachments",wd);f(this,"removeAttachment",vd);f(this,"setAttachment",Od);f(this,"selectAttachment",jd)}buildOfflineAttachment(s){return I({file:URL.createObjectURL(s.file),file_sha1:s.file_sha1,created_by:s.created_by,file_name:s.file.name,file_type:s.file.type,submitted_at:s.submitted_at,description:s.description,document:s.modelUuid})}buildAttachmentPayload(s){return{...s,document:s.modelUuid}}async bulkAdd(s){var p;const{store:a}=this.client,c=(p=a.getState().userReducer.currentUser)==null?void 0:p.id,n=new Date().toISOString(),r=[],u=[],m={},d={};for(const A of s){const{documentUuid:y,file:b}=A,P=await this.getFilePayload(b);P.sha1 in m||(m[P.sha1]=P,d[P.sha1]=[]);const T=this.buildOfflineAttachment({file:b,file_sha1:P.sha1,submitted_at:n,created_by:c,description:"",modelUuid:y});r.push(T),u.push({uuid:T.uuid,file_name:T.file_name,file_sha1:T.file_sha1,file_extension:P.extension,description:T.description,document:y}),d[P.sha1].push(T.uuid)}this.dispatch(this.addAttachments(r));const o=this.enqueueRequest({description:"Attach files to document",method:h.POST,url:"/document-attachments/bulk/",payload:{submitted_at:n,attachments:u,files:Object.values(m)},blocks:r.map(A=>A.uuid),blockers:r.map(A=>A.file_sha1)});return o.then(({attachments:A,presigned_urls:y})=>{this.dispatch(this.updateAttachments(A));const b=this.processPresignedUrls(y);for(const[P,T]of Object.entries(b))T.then(()=>{const O=d[P];for(const E of O)this.makeReadable(E)})}).catch(()=>{this.dispatch(this.removeAttachments(r.map(A=>A.uuid)))}),[r,o.then(({attachments:A})=>A)]}async delete(s){return this._delete(s)}makeReadable(s){this.enqueueRequest({description:"Add attachment to AI assistant",method:h.PATCH,url:`/document-attachments/${s}/`,payload:{readable_to_assistant:!0},blockers:["index-document-attachment",s],blocks:["index-document-attachment"]})}async refreshStore(s,a){const c=await this.enqueueRequest({description:"Get document attachments",method:h.GET,url:`/projects/${s}/document-attachments/`,blocks:[],blockers:[]});this.dispatch(Id(c));const n=await this.enqueueRequest({description:"Get document attachments",method:h.GET,url:`/organizations/${a}/document-attachments/`,blocks:[],blockers:[]});this.dispatch(this.addAttachments(n))}}class Dg extends R{add(e){var u;const{store:s}=this.client,a=(u=s.getState().userReducer.currentUser)==null?void 0:u.id,c=new Date().toISOString(),n=I({...e,created_by:a,submitted_at:c});this.dispatch(zd([n]));const r=this.enqueueRequest({description:"Create Document",method:h.POST,url:"/documents/",payload:_(n),queryParams:{parent_document:n.parent_document??void 0},blockers:n.parent_document?[n.parent_document]:[],blocks:[n.uuid]});return r.catch(()=>{this.dispatch(_i([n.uuid]))}),[n,r]}update(e){const{store:s}=this.client,a=s.getState().documentsReducer.documents[e.uuid];if(!a)throw new Error(`attempting to update a document with uuid ${e.uuid} that does not exist in store.documents`);const c={...a,...e};this.dispatch(Fe([c]));const n=this.enqueueRequest({description:"Update Document",method:h.PATCH,url:`/documents/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return n.catch(()=>{Fe([a])}),[c,n]}move(e,s,a){const{store:c}=this.client,n=ze(c.getState()),r=[],u=n[e];if(!u)throw new Error(`attempting to move a document with uuid ${e} that does not exist in store.documents`);if(r.push(u),u.parent_document&&r.push(n[u.parent_document]),s){const d=n[s];if(!d)throw new Error(`attempting to move a document to target with uuid ${s} that does not exist in store.documents`);r.push(d),d.parent_document&&r.push(n[d.parent_document])}this.dispatch(Cd({documentId:e,targetDocumentId:s,position:a}));const m=this.enqueueRequest({description:"Move Document",method:h.PATCH,url:`/documents/${e}/move/`,queryParams:{target:s??void 0,position:a},blockers:[e],blocks:[]});return m.then(d=>{this.dispatch(Fe(d))}).catch(()=>{this.dispatch(Fe(r))}),m}delete(e){const{store:s}=this.client,a=ze(s.getState()),c=Ud(e)(s.getState());if(!c)throw new Error(`attempting to delete a document with uuid ${e} that does not exist in store.documents`);const n=c.parent_document?a[c.parent_document]:void 0;this.dispatch(_i([e]));const r=this.enqueueRequest({description:"Delete Document",method:h.DELETE,url:`/documents/${e}/`,blockers:[e],blocks:[]});return r.then(u=>{this.dispatch(Fe(u))}).catch(()=>{this.dispatch(Fe([c])),n&&this.dispatch(Fe([n]))}),r}async refreshStore(e,s){const a=this.enqueueRequest({description:"Get project documents",method:h.GET,url:`/projects/${e}/documents/`,blockers:[],blocks:[]}),c=this.enqueueRequest({description:"Get organization documents",method:h.GET,url:`/organizations/${s}/documents/`,blockers:[],blocks:[]});this.dispatch(kd([...await a,...await c]))}}class Ug extends R{async add(e,s){return this.enqueueRequest({description:"Add email domain to organization",method:h.POST,url:"/organization-email-domains/",payload:{email:s,organization:e},blockers:[e,"create-org"],blocks:[]})}async remove(e){return this.dispatch(Ld(e.uuid)),this.enqueueRequest({description:"Remove email domain from organization",method:h.DELETE,url:`/organization-email-domains/${e.uuid}/`,blockers:[e.domain],blocks:[]}).catch(s=>{throw this.dispatch(Gd(e)),s})}async refreshStore(e){const s=await this.enqueueRequest({description:"Fetch email domains for organization",method:h.GET,url:"/organization-email-domains/",queryParams:{organization:e},blockers:[e],blocks:[]});this.dispatch(Bd(s))}}class $g extends R{async getVerificationCode(e){return this.enqueueRequest({description:"Get verification code",method:h.GET,url:`/verification/email-verification/${e}/`,isAuthNeeded:!1,blockers:[],blocks:[]})}validateVerificationCode(e,s=void 0){return this.enqueueRequest({description:"Validate verification code",method:h.POST,url:`/verification/email-verification/${e}/`,isAuthNeeded:!1,payload:s,blockers:[],blocks:[]})}}const Ut={},ec=new Set;let $t=0,tc=0,sc=0;const Bg=20;class Gg extends R{constructor(){super(...arguments);f(this,"host");f(this,"_dbPromise",rm.openDB("fileCache",1,{upgrade(s){s.createObjectStore("files")}}))}async renewUploadUrl(s){const a=await this.fetchCache(s);if(!a)throw new Error(`File with sha1 ${s} not found in cache`);const c=await Yt(a,s),n=await this.enqueueRequest({description:"Get S3 URL",method:h.GET,url:"/authentication/files/presigned-upload-url/",queryParams:{sha1:await ke(a),file_type:a.type,extension:a.name.split(".").pop(),size:a.size.toString()},blockers:[],blocks:[`s3-${c}`]});return"url"in n&&this.dispatch(Jd({sha1:s,...n})),n}async addCache(s,a){if(ec.has(a))return;if(!s.type){const r=s.name.split("."),u=r[r.length-1];s=new File([s],s.name,{type:u})}if(!s.name||!s.size||!s.type)throw new Error("Cannot add files to cache that do not have a name, size and type.");const c=await this._dbPromise;!!await c.get("files",a)?(console.error("File already cached (this is unexpected at this point):",s.name,a),$t++):(await c.put("files",s,a),tc++),ec.add(a),sc++,sc%Bg===0&&console.debug(`File cache summary: ${$t} hits and ${tc} misses, ${$t/($t+tc)*100}% hit rate over ${sc} calls to addCache.`)}async removeCache(s){await(await this._dbPromise).delete("files",s),ec.delete(s)}async fetchCache(s){return(await this._dbPromise).get("files",s)}async getOrRenewUploadUrl(s){const a=this.client.store.getState();return Xd(s)(a)??await this.renewUploadUrl(s)}async uploadFileToS3(s){const a=await this.fetchCache(s);if(!a)throw new Error(`File with sha1 ${s} not found in cache`);const c=await Yt(a,s),n={file_name:a.name,file_sha1:s,file:c},r=await this.getOrRenewUploadUrl(s);if("warning"in r){if(r.warning==="already_uploaded")return[n,Promise.resolve(void 0).then()];throw new Error(r.warning)}const u=r.url,m=this.enqueueRequest({url:u,description:"Upload file",method:h.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:s,blockers:[`s3-${c}`],blocks:[s],s3url:r});return[n,m]}async fetchFileFromUrl(s,a,c){const n=s.split("?")[0]??s,r=await this.fetchCache(a);if(r){if(!r.name)throw new Error("Cached file unexpectedly has no name.");return r}if(s.startsWith("blob:")){const o=await Ac(s),p=new File([o],c??a,{type:o.type});return await this.addCache(p,a),p}let u=Ut[n],m=!0;u?m=!1:(u=new Promise(o=>{this.enqueueRequest({description:"Download file",method:h.GET,url:s,isExternalUrl:!0,isResponseBlob:!0,isAuthNeeded:!1,blockers:[a],blocks:[a]}).then(p=>{const A=new File([p],c??a,{type:p.type});o(A)})}),Ut[n]=u);let d;try{d=await u}catch(o){throw m&&o instanceof M&&delete Ut[n],o}if(m){const o=await ke(d);if(o!==a){const y=`The hash of the file returned from the server (${o}) does not match the
|
|
1
|
+
(function(i,$){typeof exports=="object"&&typeof module<"u"?$(exports,require("@redux-offline/redux-offline/lib/types"),require("@reduxjs/toolkit"),require("superagent"),require("uuid"),require("file-saver"),require("fast-tree-builder"),require("ts-tree-lib"),require("react"),require("@redux-offline/redux-offline"),require("@redux-offline/redux-offline/lib/defaults"),require("localforage"),require("redux-persist-migrate"),require("buffer"),require("@overmap-ai/forms"),require("idb"),require("jwt-decode"),require("dependency-graph"),require("@tiptap/core")):typeof define=="function"&&define.amd?define(["exports","@redux-offline/redux-offline/lib/types","@reduxjs/toolkit","superagent","uuid","file-saver","fast-tree-builder","ts-tree-lib","react","@redux-offline/redux-offline","@redux-offline/redux-offline/lib/defaults","localforage","redux-persist-migrate","buffer","@overmap-ai/forms","idb","jwt-decode","dependency-graph","@tiptap/core"],$):(i=typeof globalThis<"u"?globalThis:i||self,$(i["overmap-core"]={},null,i.toolkit,i.request,i.uuid,i.fileSaver,i.buildTree,i.tsTreeLib,i.react,i.reduxOffline,i.offlineConfig,i.localforage,i.createMigration,null,null,i.idb,i.jwtDecode,i.dependencyGraph))})(this,function(i,$,u,Qe,xe,OO,qa,ot,FO,PO,$a,gO,bO,Tb,Ib,_O,MO,RO){"use strict";var fb=Object.defineProperty;var Sb=(i,$,u)=>$ in i?fb(i,$,{enumerable:!0,configurable:!0,writable:!0,value:u}):i[$]=u;var h=(i,$,u)=>Sb(i,typeof $!="symbol"?$+"":$,u);var TO;const Da=Object.freeze([]),Ua=Object.freeze({});var Ca=(t=>(t[t.GUEST=0]="GUEST",t[t.BASIC=2]="BASIC",t[t.ADMIN=4]="ADMIN",t))(Ca||{}),y=(t=>(t.GET="GET",t.POST="POST",t.PATCH="PATCH",t.PUT="PUT",t.DELETE="DELETE",t))(y||{}),La=(t=>(t[t.PLANNED=0]="PLANNED",t[t.ACTIVE=1]="ACTIVE",t[t.MAINTENANCE=2]="MAINTENANCE",t[t.INACTIVE=3]="INACTIVE",t[t.RETIRED=4]="RETIRED",t[t.DISPOSED=5]="DISPOSED",t))(La||{}),Ga=(t=>(t.Issue="issue",t.Asset="asset",t.AssetType="asset_type",t.Project="project",t.Document="document",t))(Ga||{}),$t=(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))($t||{}),B=(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))(B||{}),ka=(t=>(t[t.BACKLOG=0]="BACKLOG",t[t.PLANNED=1]="PLANNED",t[t.IN_PROGRESS=2]="IN_PROGRESS",t[t.COMPLETED=3]="COMPLETED",t[t.CANCELLED=4]="CANCELLED",t))(ka||{});const wO=$t.MEDIUM,Na=6e4;function P(t){return{addOne:(l,p)=>{const A=t(p.payload);l.instances[A]=p.payload},addMany:(l,p)=>{for(const A of p.payload){const T=t(A);l.instances[T]=A}},setOne:(l,p)=>{const A=t(p.payload);l.instances[A]=p.payload},setMany:(l,p)=>{for(const A of p.payload){const T=t(A);l.instances[T]=A}},updateOne:(l,p)=>{const A=t(p.payload);l.instances[A]=p.payload},updateMany:(l,p)=>{for(const A of p.payload){const T=t(A);l.instances[T]=A}},deleteOne:(l,p)=>{delete l.instances[p.payload]},deleteMany:(l,p)=>{for(const A of p.payload)delete l.instances[A]},initialize:(l,p)=>{l.instances={};const A=new Set;for(const T of p.payload){const I=t(T);A.add(I),l.instances[I]=T}A.size!==p.payload.length&&console.warn("duplicate ids detected when initializing model instances.")}}}function vO(){return{initializeSelection:(o,m)=>{o.selection=Array.from(new Set(m.payload))},selectOne:(o,m)=>{new Set(o.selection).has(m.payload)||o.selection.push(m.payload)},selectMany:(o,m)=>{const l=new Set(o.selection);for(const p of m.payload)l.has(p)||l.add(p);o.selection=Array.from(l)},unselectOne:(o,m)=>{const l=new Set(o.selection);l.has(m.payload)&&(l.delete(m.payload),o.selection=Array.from(l))},unselectMany:(o,m)=>{const l=new Set(o.selection);for(const p of m.payload)l.has(p)&&l.delete(p);o.selection=Array.from(l)},toggleOne:(o,m)=>{const l=new Set(o.selection);l.has(m.payload)?l.delete(m.payload):l.add(m.payload),o.selection=Array.from(l)},toggleMany:(o,m)=>{const l=new Set(o.selection);for(const p of m.payload)l.has(p)?l.delete(p):l.add(p);o.selection=Array.from(l)},getInitialState:o=>({...o,selection:[]})}}const nt="versioning",O=u.createAction("RESET"),E=u.createAction("RESET_PROJECT_STATE"),b=u.createAction("RESET_ORGANIZATION_STATE");TO=Symbol.toStringTag;class Dt{constructor(){h(this,TO,"Promise");h(this,"_promise");h(this,"_resolve");h(this,"_reject");h(this,"_state","pending");this._resolve=null,this._reject=null,this._promise=new Promise((s,e)=>{this._resolve=s,this._reject=e})}get state(){return this._state}then(s,e){return this._promise.then(s,e)}catch(s){return this._promise.catch(s)}resolve(s){if(!this._resolve)throw new Error("No resolve callback");this._resolve(s),this._state="fulfilled"}reject(s){if(!this._reject)throw s;this._reject(s),this._state="rejected"}finally(s){throw new Error("`finally` not implemented")}}let Ut=!1;["true","1"].includes("".toLowerCase())&&(Ut=!0);function EO(t,s){if(t===s)return!0;if(typeof t!=typeof s)return!1;const e=Object.keys(t),a=Object.keys(s),n=e.length;if(n!==a.length)return!1;for(let c=0;c<n;c++){const d=e[c];if(!Object.prototype.hasOwnProperty.call(s,d)||t[d]!==s[d])return!1}return!0}function Ct(t){const s={};return function(){const e=Array.prototype.slice.call(arguments);return e in s?(Ut&&console.debug(`Memoization debug: Using memorized return value for ${t.toString()}(`,e,")"),s[e]):(Ut&&console.debug(`Memoization debug: Cache miss! Memoizing ${t.toString()}(`,e,")"),s[e]=t.apply(this,e))}}function VO(t,s){if(t.length!==s.length)return!1;for(let e=0;e<t.length;e++)if(t[e]!==s[e])return!1;return!0}const S=t=>t.length===0?Da:t,ht=t=>Object.keys(t).length===0?Ua:t,Ha=Ct(t=>{if(!t)return"";const s=new Date(t),e=s.getFullYear()===Lt.getFullYear(),a={day:"numeric",month:"short"};return e||(a.year="numeric"),s.toLocaleDateString([],a)}),zO=new Intl.RelativeTimeFormat([],{style:"long",numeric:"auto"}),BO=1e3*86400,Lt=new Date,jO=t=>new Date(t).toDateString()===Lt.toDateString(),qO=Ct((t,s,e)=>{const a=Math.round((new Date(t).getTime()-Lt.getTime())/BO);return a<s||a>e?Ha(t):zO.format(a,"days")});function $O(t){return new Uint8Array(t).reduce((e,a)=>e+a.toString(16).padStart(2,"0"),"")}const Gt=async(t,s)=>{s||(s=await et(t));let e=t.type;if(e.includes("/")&&(e=e.split("/")[1]),!e)throw new Error(`Could not extract file type from ${t.type}`);return`${s}.${e}`};function et(t){return new Promise((s,e)=>{const a=new FileReader;a.onload=()=>{const n=a.result;if(!n){e(new Error("FileReader did not return a valid ArrayBuffer."));return}crypto.subtle.digest("SHA-1",n).then(c=>{const d=$O(c);s(d)})},a.readAsArrayBuffer(t)})}function DO(t){if(!t.name||!t.type||!t.size){const s="File has no name, type, and/or size";throw new Error(s)}return`${t.name}&${t.type}${t.size}`}function Wa(t,s){return new File([t],s,{type:t.type})}function UO(t,s){const e=document.createElement("a");e.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(s)),e.setAttribute("download",t),e.style.display="none",document.body.appendChild(e),e.click(),document.body.removeChild(e)}const CO=async t=>{const s={};for(const e of t){const a=await et(e);s[a]={sha1:a,extension:e.name.split(".").pop()||"",file_type:e.type,size:e.size}}return Object.values(s)},Ka=async t=>(await fetch(t)).blob(),LO=t=>new Promise((s,e)=>{const a=new FileReader;a.onloadend=()=>{var n;s(((n=a.result)==null?void 0:n.toString())||"")},a.readAsDataURL(t)});function GO(t){const s=new Blob([t]);OO.saveAs(s,t.name)}const Ya={};function kO(t,s,e,...a){const n=Ya[t];let c=!1;n?n[s]||(n[s]=!0,c=!0):(Ya[t]={[s]:!0},c=!0),c&&console[e](...a)}const Za=["created_at","updated_at","index","revision"];function F(t){return{...t,uuid:xe.v4()}}function NO(t){const s={};for(const e of t)s[e.uuid]=e;return s}function Ja(t){return t.map(({uuid:s})=>s)}function HO(t,s=void 0,e=255){let a=t.replace(/[^a-z0-9_\-.]/gi,"_").replace(/_{2,}/g,"_");if(!s){const c=t.split(".");c.length>1&&(s=c[c.length-1])}s&&!s.startsWith(".")&&(s="."+s);const n=s?s.length:0;return a.length+n>e&&(a=a.slice(0,e-n)+(s||"")),a}function WO(t){return t.toLowerCase().replace(" ","-")}function KO(t,s=!1){return t.normalize("NFKD").toLowerCase().replace(/[^\w\s-]/g,"").trim().replace(/[-\s]+/g,s?"_":"-")}function YO(t,s){if(t.length<=s)return t;const e=t.slice(0,s-1);return e.slice(0,e.lastIndexOf(" "))+"…"}const f=t=>s=>e=>t(e,s);function ZO(t,s,e){return e.findIndex(a=>a.uuid===t.uuid)===s}function JO(t,s,e){return e.findIndex(a=>a.file_sha1===t.file_sha1)===s}const XO=/^.+@.+\..+$/;function R(t){const s={...t};for(const e of[...Za,"created_by"])e in s&&delete s[e];return s}const Xa=t=>{const s=t.toSorted((e,a)=>e.order-a.order);return qa(s,{id:e=>e.uuid,parentId:e=>e.parent,includeEmptyChildrenArray:!0,valueKey:!1})},QO=t=>{const{roots:s}=Xa(t);return s.map(e=>new ot.Tree(e))},Qa=(t,s)=>{const{nodes:e}=Xa(s),a=e.get(t);if(!a)throw new Error(`Node with uuid ${t} does not exist in asset procedure step tree.`);return new ot.Tree(a)},xa=(t,s)=>t.type!==s.type?t.type-s.type:t.order-s.order,en=(t,s)=>t.type!==s.type?t.type-s.type:t.order-s.order,tn=t=>qa(t,{id:s=>s.uuid,parentId:s=>s.parent_document,includeEmptyChildrenArray:!0,valueKey:!1}),xO=t=>{const{roots:s}=tn(t);return s.map(e=>new ot.Tree(e))},eF=(t,s)=>{const{nodes:e}=tn(s),a=e.get(t);if(!a)throw new Error(`Node with uuid ${t} does not exist in document tree.`);return new ot.Tree(a)},U=P(t=>t.uuid),sn={instances:{}},kt=u.createSlice({name:"agents",initialState:sn,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,sn)),reducers:{initializeConversations:U.initialize,addConversation:U.addOne,addConversations:U.addMany,setConversation:U.setOne,setConversations:U.setMany,updateConversation:U.updateOne,updateConversations:U.updateMany,deleteConversation:U.deleteOne,deleteConversations:U.deleteMany}}),{initializeConversations:an,addConversation:nn,addConversations:tF,setConversation:cn,setConversations:sF,updateConversation:dn,updateConversations:iF,deleteConversation:aF,deleteConversations:nF}=kt.actions,Nt=t=>t.agentsReducer.instances,cF=u.createSelector([Nt],t=>Object.values(t)),dF=f(u.createSelector([Nt,(t,s)=>s],(t,s)=>t[s])),rn=kt.reducer,C=P(t=>t.uuid),un={instances:{}},Ht=u.createSlice({name:"assetAttachments",initialState:un,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,un)),reducers:{initializeAssetAttachments:C.initialize,addAssetAttachment:C.addOne,addAssetAttachments:C.addMany,setAssetAttachment:C.setOne,setAssetAttachments:C.setMany,updateAssetAttachment:C.updateOne,updateAssetAttachments:C.updateMany,deleteAssetAttachment:C.deleteOne,deleteAssetAttachments:C.deleteMany}}),{initializeAssetAttachments:ln,addAssetAttachment:on,addAssetAttachments:Wt,setAssetAttachment:hn,setAssetAttachments:mn,updateAssetAttachment:yn,updateAssetAttachments:pn,deleteAssetAttachment:An,deleteAssetAttachments:Kt}=Ht.actions,fn=t=>t.assetAttachmentReducer.instances,Yt=u.createSelector([fn],t=>Object.values(t)),Sn=t=>s=>s.assetAttachmentReducer.instances[t],Tn=f(u.createSelector([Yt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),In=f(u.createSelector([Yt,(t,s)=>s],(t,s)=>S(t.filter(({asset:e})=>s===e)))),On=Ht.reducer,L=P(({uuid:t})=>t),Fn={instances:{}},Zt=u.createSlice({name:"assetProcedureTypeAttachments",initialState:Fn,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,Fn)),reducers:{initializeAssetProcedureTypeAttachments:L.initialize,addAssetProcedureTypeAttachment:L.addOne,addAssetProcedureTypeAttachments:L.addMany,setAssetProcedureTypeAttachment:L.setOne,setAssetProcedureTypeAttachments:L.setMany,updateAssetProcedureTypeAttachment:L.updateOne,updateAssetProcedureTypeAttachments:L.updateMany,deleteAssetProcedureTypeAttachment:L.deleteOne,deleteAssetProcedureTypeAttachments:L.deleteMany}}),{initializeAssetProcedureTypeAttachments:Pn,addAssetProcedureTypeAttachment:gn,addAssetProcedureTypeAttachments:bn,setAssetProcedureTypeAttachment:_n,setAssetProcedureTypeAttachments:Mn,updateAssetProcedureTypeAttachment:Rn,updateAssetProcedureTypeAttachments:wn,deleteAssetProcedureTypeAttachment:vn,deleteAssetProcedureTypeAttachments:En}=Zt.actions,Vn=Zt.reducer,zn=t=>t.assetProcedureTypeAttachmentReducer.instances,Jt=u.createSelector([zn],t=>Object.values(t)),Bn=t=>s=>s.assetProcedureTypeAttachmentReducer.instances[t],jn=f(u.createSelector([Jt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),rF=f(u.createSelector([Jt,(t,s)=>s],(t,s)=>S(t.filter(({asset_procedure_type:e})=>s===e)))),G=P(({uuid:t})=>t),qn={instances:{}},Xt=u.createSlice({name:"assetProcedureTypeFieldsAttachments",initialState:qn,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,qn)),reducers:{initializeAssetProcedureTypeFieldsAttachments:G.initialize,addAssetProcedureTypeFieldsAttachment:G.addOne,addAssetProcedureTypeFieldsAttachments:G.addMany,setAssetProcedureTypeFieldsAttachment:G.setOne,setAssetProcedureTypeFieldsAttachments:G.setMany,updateAssetProcedureTypeFieldsAttachment:G.updateOne,updateAssetProcedureTypeFieldsAttachments:G.updateMany,deleteAssetProcedureTypeFieldsAttachment:G.deleteOne,deleteAssetProcedureTypeFieldsAttachments:G.deleteMany}}),{initializeAssetProcedureTypeFieldsAttachments:$n,addAssetProcedureTypeFieldsAttachment:Dn,addAssetProcedureTypeFieldsAttachments:Un,setAssetProcedureTypeFieldsAttachment:Cn,setAssetProcedureTypeFieldsAttachments:Ln,updateAssetProcedureTypeFieldsAttachment:Gn,updateAssetProcedureTypeFieldsAttachments:kn,deleteAssetProcedureTypeFieldsAttachment:Nn,deleteAssetProcedureTypeFieldsAttachments:Hn}=Xt.actions,Wn=Xt.reducer,Kn=t=>t.assetProcedureTypeFieldsAttachmentReducer.instances,Qt=u.createSelector([Kn],t=>Object.values(t)),uF=f(u.createSelector([Qt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.fields_revision===s)))),Yn=t=>s=>s.assetProcedureTypeFieldsAttachmentReducer.instances[t],Zn=f(u.createSelector([Qt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),k=P(({uuid:t})=>t),Jn={instances:{}},xt=u.createSlice({name:"assetProcedureTypeFields",initialState:Jn,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,Jn)),reducers:{initializeAssetProcedureTypeFields:k.initialize,addAssetProcedureTypeFields:k.addOne,addAssetProcedureTypeFieldsMany:k.addMany,setAssetProcedureTypeFields:k.setOne,setAssetProcedureTypeFieldsMany:k.setMany,updateAssetProcedureTypeFields:k.updateOne,updateAssetProcedureTypeFieldsMany:k.updateMany,deleteAssetProcedureTypeFields:k.deleteOne,deleteAssetProcedureTypeFieldsMany:k.deleteMany}}),{initializeAssetProcedureTypeFields:Xn,addAssetProcedureTypeFields:Qn,addAssetProcedureTypeFieldsMany:xn,setAssetProcedureTypeFields:ec,setAssetProcedureTypeFieldsMany:tc,updateAssetProcedureTypeFields:sc,updateAssetProcedureTypeFieldsMany:ic,deleteAssetProcedureTypeFields:ac,deleteAssetProcedureTypeFieldsMany:nc}=xt.actions,cc=xt.reducer,dc=t=>t.assetProcedureTypeFieldsReducer.instances,mt=u.createSelector([dc],t=>Object.values(t)),lF=f(u.createSelector([mt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_procedure_type===s)))),oF=f(u.createSelector([mt,(t,s)=>s],(t,s)=>t.filter(e=>e.asset_procedure_type===s).sort((e,a)=>e.submitted_at>a.submitted_at?-1:1)[0])),rc=t=>s=>s.assetProcedureTypeFieldsReducer.instances[t],uc=f(u.createSelector([mt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),N=P(({uuid:t})=>t),lc={instances:{}},es=u.createSlice({name:"assetProcedureTypeFieldValuesAttachments",initialState:lc,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,lc)),reducers:{initializeAssetProcedureTypeFieldValuesAttachments:N.initialize,addAssetProcedureTypeFieldValuesAttachment:N.addOne,addAssetProcedureTypeFieldValuesAttachments:N.addMany,setAssetProcedureTypeFieldValuesAttachment:N.setOne,setAssetProcedureTypeFieldValuesAttachments:N.setMany,updateAssetProcedureTypeFieldValuesAttachment:N.updateOne,updateAssetProcedureTypeFieldValuesAttachments:N.updateMany,deleteAssetProcedureTypeFieldValuesAttachment:N.deleteOne,deleteAssetProcedureTypeFieldValuesAttachments:N.deleteMany}}),{initializeAssetProcedureTypeFieldValuesAttachments:oc,addAssetProcedureTypeFieldValuesAttachment:hc,addAssetProcedureTypeFieldValuesAttachments:ts,setAssetProcedureTypeFieldValuesAttachment:mc,setAssetProcedureTypeFieldValuesAttachments:yc,updateAssetProcedureTypeFieldValuesAttachment:pc,updateAssetProcedureTypeFieldValuesAttachments:Ac,deleteAssetProcedureTypeFieldValuesAttachment:fc,deleteAssetProcedureTypeFieldValuesAttachments:ss}=es.actions,Sc=es.reducer,Tc=t=>t.assetProcedureTypeFieldValuesAttachmentReducer.instances,is=u.createSelector([Tc],t=>Object.values(t)),Ic=t=>s=>s.assetProcedureTypeFieldValuesAttachmentReducer.instances[t],Oc=f(u.createSelector([is,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),Fc=f(u.createSelector([is,(t,s)=>s],(t,s)=>S(t.filter(e=>e.field_values===s)))),H=P(({uuid:t})=>t),Pc={instances:{}},as=u.createSlice({name:"assetProcedureTypeFieldValues",initialState:Pc,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,Pc)),reducers:{initializeAssetProcedureTypeFieldValues:H.initialize,addAssetProcedureTypeFieldValues:H.addOne,addAssetProcedureTypeFieldValuesMany:H.addMany,setAssetProcedureTypeFieldValues:H.setOne,setAssetProcedureTypeFieldValuesMany:H.setMany,updateAssetProcedureTypeFieldValues:H.updateOne,updateAssetProcedureTypeFieldValuesMany:H.updateMany,deleteAssetProcedureTypeFieldValues:H.deleteOne,deleteAssetProcedureTypeFieldValuesMany:H.deleteMany}}),{initializeAssetProcedureTypeFieldValues:gc,addAssetProcedureTypeFieldValues:bc,addAssetProcedureTypeFieldValuesMany:_c,setAssetProcedureTypeFieldValues:Mc,setAssetProcedureTypeFieldValuesMany:Rc,updateAssetProcedureTypeFieldValues:wc,updateAssetProcedureTypeFieldValuesMany:vc,deleteAssetProcedureTypeFieldValues:Ec,deleteAssetProcedureTypeFieldValuesMany:Vc}=as.actions,zc=as.reducer,Bc=t=>t.assetProcedureTypeFieldValuesReducer.instances,yt=u.createSelector([Bc],t=>Object.values(t)),hF=f(u.createSelector([yt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset===s)))),mF=f(u.createSelector([yt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_procedure===s)))),jc=t=>s=>s.assetProcedureTypeFieldValuesReducer.instances[t],qc=f(u.createSelector([yt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),W=P(({uuid:t})=>t),$c={instances:{}},ns=u.createSlice({name:"assetProcedures",initialState:$c,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,$c)),reducers:{initializeAssetProcedures:W.initialize,addAssetProcedure:W.addOne,addAssetProcedures:W.addMany,setAssetProcedure:W.setOne,setAssetProcedures:W.setMany,updateAssetProcedure:W.updateOne,updateAssetProcedures:W.updateMany,deleteAssetProcedure:W.deleteOne,deleteAssetProcedures:W.deleteMany}}),{initializeAssetProcedures:Dc,addAssetProcedure:Uc,addAssetProcedures:cs,updateAssetProcedure:Cc,updateAssetProcedures:Lc,deleteAssetProcedure:Gc,deleteAssetProcedures:ds,setAssetProcedure:kc,setAssetProcedures:Nc}=ns.actions,Hc=ns.reducer,Wc=t=>t.assetProcedureReducer.instances,pt=u.createSelector([Wc],t=>Object.values(t)),Kc=f(u.createSelector([pt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_procedure_type===s)))),yF=f(u.createSelector([pt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_type===s)))),Yc=t=>s=>s.assetProcedureReducer.instances[t],Zc=f(u.createSelector([pt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),K=P(t=>t.uuid),Jc={instances:{}},rs=u.createSlice({name:"assetProcedureTypes",initialState:Jc,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,Jc)),reducers:{initializeAssetProcedureTypes:K.initialize,addAssetProcedureType:K.addOne,addAssetProcedureTypes:K.addMany,setAssetProcedureType:K.setOne,setAssetProcedureTypes:K.setMany,updateAssetProcedureType:K.updateOne,updateAssetProcedureTypes:K.updateMany,deleteAssetProcedureType:K.deleteOne,deleteAssetProcedureTypes:K.deleteMany}}),{initializeAssetProcedureTypes:Xc,addAssetProcedureType:Qc,addAssetProcedureTypes:xc,updateAssetProcedureType:ed,updateAssetProcedureTypes:td,deleteAssetProcedureType:sd,deleteAssetProcedureTypes:id,setAssetProcedureType:ad,setAssetProcedureTypes:nd}=rs.actions,cd=rs.reducer,dd=t=>t.assetProcedureTypeReducer.instances,us=u.createSelector([dd],t=>Object.values(t)),rd=t=>s=>s.assetProcedureTypeReducer.instances[t],ud=f(u.createSelector([us,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),pF=f(u.createSelector([us,(t,s)=>s],(t,s)=>S(t.filter(e=>e.organization===s)))),Y=P(t=>t.uuid),ld={instances:{}},ls=u.createSlice({name:"assetProcedureStepFieldsAttachments",initialState:ld,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,ld)),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:od,addAssetProcedureStepFieldsAttachment:hd,addAssetProcedureStepFieldsAttachments:md,setAssetProcedureStepFieldsAttachment:yd,setAssetProcedureStepFieldsAttachments:pd,updateAssetProcedureStepFieldsAttachment:Ad,updateAssetProcedureStepFieldsAttachments:fd,deleteAssetProcedureStepFieldsAttachment:Sd,deleteAssetProcedureStepFieldsAttachments:Td}=ls.actions,Id=t=>t.assetProcedureStepFieldsAttachmentReducer.instances,os=u.createSelector([Id],t=>Object.values(t)),AF=f(u.createSelector([os,(t,s)=>s],(t,s)=>S(t.filter(e=>e.fields_revision===s)))),Od=t=>s=>s.assetProcedureStepFieldsAttachmentReducer.instances[t],Fd=f(u.createSelector([os,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),Pd=ls.reducer,Z=P(t=>t.uuid),gd={instances:{}},hs=u.createSlice({name:"assetProcedureStepFields",initialState:gd,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,gd)),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:bd,addAssetProcedureStepFields:_d,addAssetProcedureStepFieldsMany:Md,setAssetProcedureStepFields:Rd,setAssetProcedureStepFieldsMany:wd,updateAssetProcedureStepFields:vd,updateAssetProcedureStepFieldsMany:Ed,deleteAssetProcedureStepFields:Vd,deleteAssetProcedureStepFieldsMany:zd}=hs.actions,ms=t=>t.assetProcedureStepFieldsReducer.instances,At=u.createSelector([ms],t=>Object.values(t)),fF=f(u.createSelector([At,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_procedure_step===s)))),SF=f(u.createSelector([At,(t,s)=>s],(t,s)=>t.filter(e=>e.asset_procedure_step===s).sort((e,a)=>e.submitted_at>a.submitted_at?-1:1)[0])),TF=u.createSelector([ms],t=>{const s={};for(const e of Object.values(t)){const a=s[e.asset_procedure_step];(!a||a.submitted_at<e.submitted_at)&&(s[e.asset_procedure_step]=e)}return s}),Bd=t=>s=>s.assetProcedureStepFieldsReducer.instances[t],jd=f(u.createSelector([At,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),qd=hs.reducer,J=P(t=>t.uuid),$d={instances:{}},ys=u.createSlice({name:"assetProcedureStepFieldValuesAttachments",initialState:$d,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,$d)),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:Dd,addAssetProcedureStepFieldValuesAttachment:Ud,addAssetProcedureStepFieldValuesAttachments:ps,setAssetProcedureStepFieldValuesAttachment:Cd,setAssetProcedureStepFieldValuesAttachments:Ld,updateAssetProcedureStepFieldValuesAttachment:Gd,updateAssetProcedureStepFieldValuesAttachments:kd,deleteAssetProcedureStepFieldValuesAttachment:Nd,deleteAssetProcedureStepFieldValuesAttachments:As}=ys.actions,Hd=t=>t.assetProcedureStepFieldValuesAttachmentReducer.instances,fs=u.createSelector([Hd],t=>Object.values(t)),Wd=t=>s=>s.assetProcedureStepFieldValuesAttachmentReducer.instances[t],Kd=f(u.createSelector([fs,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),Yd=f(u.createSelector([fs,(t,s)=>s],(t,s)=>S(t.filter(e=>e.field_values===s)))),Zd=ys.reducer,X=P(t=>t.uuid),Jd={instances:{}},Ss=u.createSlice({name:"assetProcedureStepFieldValues",initialState:Jd,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,Jd)),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:Xd,addAssetProcedureStepFieldValues:Qd,addAssetProcedureStepFieldValuesMany:xd,setAssetProcedureStepFieldValues:er,setAssetProcedureStepFieldValuesMany:tr,updateAssetProcedureStepFieldValues:sr,updateAssetProcedureStepFieldValuesMany:ir,deleteAssetProcedureStepFieldValues:ar,deleteAssetProcedureStepFieldValuesMany:nr}=Ss.actions,cr=t=>t.assetProcedureStepFieldValuesReducer.instances,ct=u.createSelector([cr],t=>Object.values(t)),IF=f(u.createSelector([ct,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset===s)))),OF=f(u.createSelector([ct,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_procedure===s)))),FF=f(u.createSelector([ct,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_procedure_step===s)))),dr=t=>s=>s.assetProcedureStepFieldValuesReducer.instances[t],rr=f(u.createSelector([ct,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),ur=Ss.reducer,Q=P(t=>t.uuid),lr={instances:{}},Ts=u.createSlice({name:"assetProcedureSteps",initialState:lr,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,lr)),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:or,setAssetProcedureStep:hr,setAssetProcedureSteps:mr,addAssetProcedureStep:yr,addAssetProcedureSteps:pr,updateAssetProcedureStep:Ar,updateAssetProcedureSteps:fr,deleteAssetProcedureStep:Sr,deleteAssetProcedureSteps:Tr}=Ts.actions,Ir=Ts.reducer,ft=t=>t.assetProcedureStepReducer.instances,Or=t=>s=>s.assetProcedureStepReducer.instances[t],Is=u.createSelector([ft],t=>Object.values(t)),PF=f(u.createSelector([ft,(t,s)=>s],(t,s)=>{const e={};for(const[a,n]of Object.entries(t))n.asset_procedure_type===s&&(e[a]=n);return ht(e)})),gF=f(u.createSelector([Is,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_procedure_type===s)))),Fr=f(u.createSelector([Is,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),Pr=f(u.createSelector([ft,(t,s)=>s],(t,s)=>{if(!t[s])return S([]);const n=Qa(s,Object.values(t)).all().map(({model:c})=>c);return S(n)})),x=P(t=>t.uuid),gr={instances:{}},Os=u.createSlice({name:"assets",initialState:gr,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,gr)),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:br,addAsset:_r,addAssets:Fs,updateAsset:Mr,updateAssets:Rr,deleteAsset:wr,deleteAssets:Ps,setAsset:vr,setAssets:Er}=Os.actions,Vr=t=>t.assetReducer.instances,gs=u.createSelector([Vr],t=>S(Object.values(t))),bs=f(u.createSelector([gs,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_type===s)))),zr=t=>s=>s.assetReducer.instances[t],Br=f(u.createSelector([gs,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),bF=t=>s=>bs(t)(s).length,jr=Os.reducer,ee=P(t=>t.uuid),qr={instances:{}},_s=u.createSlice({name:"assetStageCompletions",initialState:qr,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,qr)),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:$r,addAssetStageCompletion:Dr,addAssetStageCompletions:Ur,setAssetStageCompletion:Cr,setAssetStageCompletions:Lr,updateAssetStageCompletion:Gr,updateAssetStageCompletions:kr,deleteAssetStageCompletion:Nr,deleteAssetStageCompletions:Hr}=_s.actions,Wr=_s.reducer,Kr=t=>t.assetStageCompletionReducer.instances,Yr=u.createSelector([Kr],t=>Object.values(t)),Zr=t=>s=>s.assetStageCompletionReducer.instances[t],Jr=f(u.createSelector([Yr,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),te=P(t=>t.uuid),Xr={instances:{}},Ms=u.createSlice({name:"assetStages",initialState:Xr,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,Xr)),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:Qr,setAssetStage:xr,setAssetStages:eu,addAssetStage:tu,addAssetStages:su,updateAssetStage:iu,updateAssetStages:au,deleteAssetStage:nu,deleteAssetStages:cu}=Ms.actions,du=Ms.reducer,Rs=t=>t.assetStageReducer.instances,ru=t=>s=>s.assetStageReducer.instances[t],ws=u.createSelector([Rs],t=>Object.values(t)),_F=f(u.createSelector([Rs,(t,s)=>s],(t,s)=>{const e={};for(const[a,n]of Object.entries(t))n.asset_procedure_type===s&&(e[a]=n);return ht(e)})),MF=f(u.createSelector([ws,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_procedure_type===s)))),uu=f(u.createSelector([ws,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),se=P(t=>t.uuid),lu={instances:{}},vs=u.createSlice({name:"assetTypeAttachments",initialState:lu,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,lu)),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:ou,addAssetTypeAttachment:hu,addAssetTypeAttachments:Es,setAssetTypeAttachment:mu,setAssetTypeAttachments:yu,updateAssetTypeAttachment:pu,updateAssetTypeAttachments:Au,deleteAssetTypeAttachment:fu,deleteAssetTypeAttachments:Vs}=vs.actions,Su=t=>t.assetTypeAttachmentReducer.instances,zs=u.createSelector([Su],t=>Object.values(t)),Tu=t=>s=>s.assetTypeAttachmentReducer.instances[t],Iu=f(u.createSelector([zs,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),Ou=f(u.createSelector([zs,(t,s)=>s],(t,s)=>S(t.filter(({asset_type:e})=>s===e)))),Fu=vs.reducer,ie=P(t=>t.uuid),Pu={instances:{}},Bs=u.createSlice({name:"assetTypeFieldsAttachments",initialState:Pu,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,Pu)),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:gu,addAssetTypeFieldsAttachment:bu,addAssetTypeFieldsAttachments:_u,setAssetTypeFieldsAttachment:Mu,setAssetTypeFieldsAttachments:Ru,updateAssetTypeFieldsAttachment:wu,updateAssetTypeFieldsAttachments:vu,deleteAssetTypeFieldsAttachment:Eu,deleteAssetTypeFieldsAttachments:Vu}=Bs.actions,zu=t=>t.assetTypeFieldsAttachmentReducer.instances,js=u.createSelector([zu],t=>Object.values(t)),RF=f(u.createSelector([js,(t,s)=>s],(t,s)=>S(t.filter(e=>e.fields_revision===s)))),Bu=t=>s=>s.assetTypeFieldsAttachmentReducer.instances[t],ju=f(u.createSelector([js,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),qu=Bs.reducer,ae=P(t=>t.uuid),$u={instances:{}},qs=u.createSlice({name:"assetTypeFields",initialState:$u,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,$u)),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:Du,addAssetTypeFields:Uu,addAssetTypeFieldsMany:Cu,setAssetTypeFields:Lu,setAssetTypeFieldsMany:Gu,updateAssetTypeFields:ku,updateAssetTypeFieldsMany:Nu,deleteAssetTypeFields:Hu,deleteAssetTypeFieldsMany:Wu}=qs.actions,Ku=t=>t.assetTypeFieldsReducer.instances,dt=u.createSelector([Ku],t=>Object.values(t)),wF=f(u.createSelector([dt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_type===s)))),vF=f(u.createSelector([dt,(t,s)=>s],(t,s)=>t.filter(e=>e.asset_type===s).sort((e,a)=>e.submitted_at>a.submitted_at?-1:1)[0])),Yu=t=>s=>s.assetTypeFieldsReducer.instances[t],Zu=f(u.createSelector([dt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),Ju=qs.reducer,ne=P(t=>t.uuid),Xu={instances:{}},$s=u.createSlice({name:"assetTypeFieldValuesAttachments",initialState:Xu,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,Xu)),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:Qu,addAssetTypeFieldValuesAttachment:xu,addAssetTypeFieldValuesAttachments:Ds,setAssetTypeFieldValuesAttachment:el,setAssetTypeFieldValuesAttachments:tl,updateAssetTypeFieldValuesAttachment:sl,updateAssetTypeFieldValuesAttachments:il,deleteAssetTypeFieldValuesAttachment:al,deleteAssetTypeFieldValuesAttachments:Us}=$s.actions,nl=t=>t.assetTypeFieldValuesAttachmentReducer.instances,Cs=u.createSelector([nl],t=>Object.values(t)),cl=t=>s=>s.assetTypeFieldValuesAttachmentReducer.instances[t],dl=f(u.createSelector([Cs,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),rl=f(u.createSelector([Cs,(t,s)=>s],(t,s)=>S(t.filter(e=>e.field_values===s)))),ul=$s.reducer,ce=P(t=>t.uuid),ll={instances:{}},Ls=u.createSlice({name:"assetTypeFieldValues",initialState:ll,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,ll)),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:ol,addAssetTypeFieldValues:hl,addAssetTypeFieldValuesMany:ml,setAssetTypeFieldValues:yl,setAssetTypeFieldValuesMany:pl,updateAssetTypeFieldValues:Al,updateAssetTypeFieldValuesMany:fl,deleteAssetTypeFieldValues:Sl,deleteAssetTypeFieldValuesMany:Tl}=Ls.actions,Il=t=>t.assetTypeFieldValuesReducer.instances,St=u.createSelector([Il],t=>Object.values(t)),EF=f(u.createSelector([St,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset===s)))),VF=f(u.createSelector([dt,St,(t,s)=>s],(t,s,e)=>{const a=new Set(t.filter(n=>n.asset_type===e).map(n=>n.uuid));return S(s.filter(n=>a.has(n.fields_revision)))})),Ol=t=>s=>s.assetTypeFieldValuesReducer.instances[t],Fl=f(u.createSelector([St,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),Pl=Ls.reducer,de=P(t=>t.uuid),gl={instances:{}},Gs=u.createSlice({name:"assetTypeIdentifiers",initialState:gl,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,gl)),reducers:{initializeAssetTypeIdentifiers:de.initialize,addAssetTypeIdentifier:de.addOne,addAssetTypeIdentifiers:de.addMany,setAssetTypeIdentifier:de.setOne,setAssetTypeIdentifiers:de.setMany,updateAssetTypeIdentifier:de.updateOne,updateAssetTypeIdentifiers:de.updateMany,deleteAssetTypeIdentifier:de.deleteOne,deleteAssetTypeIdentifiers:de.deleteMany}}),{initializeAssetTypeIdentifiers:bl,addAssetTypeIdentifier:_l,addAssetTypeIdentifiers:Ml,setAssetTypeIdentifier:Rl,setAssetTypeIdentifiers:wl,updateAssetTypeIdentifier:vl,updateAssetTypeIdentifiers:El,deleteAssetTypeIdentifier:Vl,deleteAssetTypeIdentifiers:zl}=Gs.actions,Bl=t=>t.assetTypeIdentifierReducer.instances,ks=u.createSelector([Bl],t=>Object.values(t)),jl=t=>s=>s.assetTypeIdentifierReducer.instances[t],ql=f(u.createSelector([ks,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),zF=f(u.createSelector([ks,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_type===s)))),$l=Gs.reducer,re=P(t=>t.uuid),Dl={instances:{}},Ns=u.createSlice({name:"assetTypeIdentifierValues",initialState:Dl,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,Dl)),reducers:{initializeAssetTypeIdentifierValues:re.initialize,addAssetTypeIdentifierValue:re.addOne,addAssetTypeIdentifierValues:re.addMany,setAssetTypeIdentifierValue:re.setOne,setAssetTypeIdentifierValues:re.setMany,updateAssetTypeIdentifierValue:re.updateOne,updateAssetTypeIdentifierValues:re.updateMany,deleteAssetTypeIdentifierValue:re.deleteOne,deleteAssetTypeIdentifierValues:re.deleteMany}}),{initializeAssetTypeIdentifierValues:Ul,addAssetTypeIdentifierValue:Cl,addAssetTypeIdentifierValues:Ll,setAssetTypeIdentifierValue:Gl,setAssetTypeIdentifierValues:kl,updateAssetTypeIdentifierValue:Nl,updateAssetTypeIdentifierValues:Hl,deleteAssetTypeIdentifierValue:Wl,deleteAssetTypeIdentifierValues:Kl}=Ns.actions,Yl=t=>t.assetTypeIdentifierValueReducer.instances,Tt=u.createSelector([Yl],t=>Object.values(t)),Zl=t=>s=>s.assetTypeIdentifierValueReducer.instances[t],Jl=f(u.createSelector([Tt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),BF=f(u.createSelector([Tt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset===s)))),jF=f(u.createSelector([Tt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_type_identifier===s)))),Xl=Ns.reducer,ue=P(t=>t.uuid),Ql={instances:{}},Hs=u.createSlice({name:"assetTypes",initialState:Ql,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,Ql)),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:xl,setAssetType:eo,setAssetTypes:to,addAssetType:so,addAssetTypes:io,updateAssetType:ao,updateAssetTypes:no,deleteAssetType:co,deleteAssetTypes:ro}=Hs.actions,uo=t=>t.assetTypeReducer.instances,Ws=u.createSelector([uo],t=>Object.values(t)),lo=t=>s=>s.assetTypeReducer.instances[t],oo=f(u.createSelector([Ws,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),qF=f(u.createSelector([Ws,(t,s)=>s],(t,s)=>S(t.filter(e=>e.organization===s)))),ho=Hs.reducer,le=P(t=>t.uuid),mo={instances:{}},Ks=u.createSlice({name:"assetTypeStatuses",initialState:mo,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,mo)),reducers:{initializeAssetTypeStatuses:le.initialize,addAssetTypeStatus:le.addOne,addAssetTypeStatuses:le.addMany,setAssetTypeStatus:le.setOne,setAssetTypeStatuses:le.setMany,updateAssetTypeStatus:le.updateOne,updateAssetTypeStatuses:le.updateMany,deleteAssetTypeStatus:le.deleteOne,deleteAssetTypeStatuses:le.deleteMany}}),{initializeAssetTypeStatuses:yo,addAssetTypeStatus:po,addAssetTypeStatuses:Ao,setAssetTypeStatus:fo,setAssetTypeStatuses:So,updateAssetTypeStatus:To,updateAssetTypeStatuses:Io,deleteAssetTypeStatus:Oo,deleteAssetTypeStatuses:Fo}=Ks.actions,Po=t=>t.assetTypeStatusReducer.instances,Ys=u.createSelector([Po],t=>S(Object.values(t).toSorted(xa))),go=t=>s=>s.assetTypeStatusReducer.instances[t],bo=f(u.createSelector([Ys,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),$F=f(u.createSelector([Ys,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_type===s)))),_o=Ks.reducer,Mo={accessToken:"",refreshToken:"",isLoggedIn:!1},It=u.createSlice({name:"auth",initialState:Mo,extraReducers:t=>t.addCase(O,s=>Object.assign(s,Mo)),reducers:{setTokens:(t,s)=>{t.accessToken=s.payload.accessToken,t.refreshToken=s.payload.refreshToken},clearTokens:t=>{t.accessToken="",t.refreshToken=""},setLoggedIn:(t,s)=>{s.payload||It.caseReducers.clearTokens(t),t.isLoggedIn=s.payload}}}),{setTokens:DF,clearTokens:UF,setLoggedIn:Ro}=It.actions,CF=t=>t.authReducer.accessToken,LF=t=>t.authReducer.isLoggedIn,wo=It.reducer,oe=P(t=>t.uuid),vo={instances:{}},Zs=u.createSlice({name:"categories",initialState:vo,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,vo)),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:Eo,addCategory:Vo,addCategories:zo,setCategory:Bo,setCategories:jo,updateCategory:qo,updateCategories:$o,deleteCategory:Do,deleteCategories:Uo}=Zs.actions,Co=t=>t.categoryReducer.instances,Js=u.createSelector([Co],t=>Object.values(t)),Xs=t=>s=>s.categoryReducer.instances[t],Lo=f(u.createSelector([Js,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),GF=f(u.createSelector([Js,(t,s)=>s],(t,s)=>S(t.filter(e=>e.project===s)))),Go=Zs.reducer,he=P(t=>t.uuid),ko={instances:{}},Qs=u.createSlice({name:"documentAttachments",initialState:ko,extraReducers:t=>t.addCase(O,s=>Object.assign(s,ko)),reducers:{initializeDocumentAttachments:he.initialize,addDocumentAttachment:he.addOne,addDocumentAttachments:he.addMany,setDocumentAttachment:he.setOne,setDocumentAttachments:he.setMany,updateDocumentAttachment:he.updateOne,updateDocumentAttachments:he.updateMany,deleteDocumentAttachment:he.deleteOne,deleteDocumentAttachments:he.deleteMany}}),{initializeDocumentAttachments:No,addDocumentAttachment:Ho,addDocumentAttachments:Wo,setDocumentAttachment:Ko,setDocumentAttachments:Yo,updateDocumentAttachment:Zo,updateDocumentAttachments:Jo,deleteDocumentAttachment:Xo,deleteDocumentAttachments:Qo}=Qs.actions,xo=t=>t.documentAttachmentReducer.instances,xs=u.createSelector([xo],t=>Object.values(t)),eh=t=>s=>s.documentAttachmentReducer.instances[t],th=f(u.createSelector([xs,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),kF=f(u.createSelector([xs,(t,s)=>s],(t,s)=>S(t.filter(({document:e})=>s===e)))),sh=Qs.reducer,me=P(({uuid:t})=>t),ih={instances:{}},ei=u.createSlice({name:"documents",initialState:ih,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>{Object.assign(s,ih)}),reducers:{initializeDocuments:me.initialize,addDocument:me.addOne,addDocuments:me.addMany,setDocument:me.setOne,setDocuments:me.setMany,updateDocument:me.updateOne,updateDocuments:me.updateMany,deleteDocument:me.deleteOne,deleteDocuments:me.deleteMany}}),{initializeDocuments:ah,addDocument:nh,addDocuments:ch,setDocument:dh,setDocuments:rh,updateDocument:uh,updateDocuments:lh,deleteDocument:oh,deleteDocuments:hh}=ei.actions,mh=t=>t.documentsReducer.instances,Ot=u.createSelector([mh],t=>Object.values(t)),yh=t=>s=>s.documentsReducer.instances[t],ph=f(u.createSelector([Ot,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),NF=f(u.createSelector([Ot,(t,s)=>s],(t,s)=>t.filter(e=>e.project===s))),HF=f(u.createSelector([Ot,(t,s)=>s],(t,s)=>t.filter(e=>e.organization===s))),Ah=ei.reducer,ye=P(t=>t.uuid),fh={instances:{}},ti=u.createSlice({name:"emailDomains",initialState:fh,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,fh)),reducers:{initializeEmailDomains:ye.initialize,addEmailDomain:ye.addOne,addEmailDomains:ye.addMany,setEmailDomain:ye.setOne,setEmailDomains:ye.setMany,updateEmailDomain:ye.updateOne,updateEmailDomains:ye.updateMany,deleteEmailDomain:ye.deleteOne,deleteEmailDomains:ye.deleteMany}}),{initializeEmailDomains:Sh,addEmailDomain:Th,addEmailDomains:Ih,setEmailDomain:Oh,setEmailDomains:Fh,updateEmailDomain:Ph,updateEmailDomains:gh,deleteEmailDomain:bh,deleteEmailDomains:_h}=ti.actions,Mh=t=>t.emailDomainsReducer.instances,si=u.createSelector([Mh],t=>Object.values(t)),Rh=t=>s=>s.emailDomainsReducer.instances[t],wh=f(u.createSelector([si,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),WF=f(u.createSelector([si,(t,s)=>s],(t,s)=>S(t.filter(e=>e.organization===s)))),vh=ti.reducer,Eh={s3Urls:{}},Vh=1e3*60*60,KF=Vh*24*7,ii=u.createSlice({name:"file",initialState:Eh,extraReducers:t=>t.addCase(O,s=>Object.assign(s,Eh)),reducers:{setUploadUrl:(t,s)=>{const{url:e,fields:a,sha1:n}=s.payload,c=new Date,d=new Date(c.getTime()+KF);t.s3Urls[n]={url:e,fields:a,exp:d.getTime()}}}}),{setUploadUrl:zh}=ii.actions,Bh=t=>s=>{const e=s.fileReducer.s3Urls[t];if(!e)return;const a=new Date().getTime();if(!((e.exp??a)-a<Vh))return e},jh=ii.reducer,pe=P(t=>t.uuid),qh={instances:{}},ai=u.createSlice({name:"formIdentifiers",initialState:qh,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,qh)),reducers:{initializeFormIdentifiers:pe.initialize,addFormIdentifier:pe.addOne,addFormIdentifiers:pe.addMany,setFormIdentifier:pe.setOne,setFormIdentifiers:pe.setMany,updateFormIdentifier:pe.updateOne,updateFormIdentifiers:pe.updateMany,deleteFormIdentifier:pe.deleteOne,deleteFormIdentifiers:pe.deleteMany}}),{initializeFormIdentifiers:$h,addFormIdentifier:Dh,addFormIdentifiers:Uh,setFormIdentifier:Ch,setFormIdentifiers:Lh,updateFormIdentifier:Gh,updateFormIdentifiers:kh,deleteFormIdentifier:Nh,deleteFormIdentifiers:Hh}=ai.actions,Wh=t=>t.formIdentifierReducer.instances,ni=u.createSelector([Wh],t=>Object.values(t)),Kh=t=>s=>s.formIdentifierReducer.instances[t],Yh=f(u.createSelector([ni,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),YF=f(u.createSelector([ni,(t,s)=>s],(t,s)=>S(t.filter(e=>e.form===s)))),Zh=ai.reducer,Ae=P(t=>t.uuid),Jh={instances:{}},ci=u.createSlice({name:"formIdentifierValues",initialState:Jh,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,Jh)),reducers:{initializeFormIdentifierValues:Ae.initialize,addFormIdentifierValue:Ae.addOne,addFormIdentifierValues:Ae.addMany,setFormIdentifierValue:Ae.setOne,setFormIdentifierValues:Ae.setMany,updateFormIdentifierValue:Ae.updateOne,updateFormIdentifierValues:Ae.updateMany,deleteFormIdentifierValue:Ae.deleteOne,deleteFormIdentifierValues:Ae.deleteMany}}),{initializeFormIdentifierValues:Xh,addFormIdentifierValue:Qh,addFormIdentifierValues:xh,setFormIdentifierValue:em,setFormIdentifierValues:tm,updateFormIdentifierValue:sm,updateFormIdentifierValues:im,deleteFormIdentifierValue:am,deleteFormIdentifierValues:nm}=ci.actions,cm=t=>t.formIdentifierValueReducer.instances,Ft=u.createSelector([cm],t=>Object.values(t)),dm=t=>s=>s.formIdentifierValueReducer.instances[t],rm=f(u.createSelector([Ft,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),ZF=f(u.createSelector([Ft,(t,s)=>s],(t,s)=>S(t.filter(e=>e.form_submission===s)))),JF=f(u.createSelector([Ft,(t,s)=>s],(t,s)=>S(t.filter(e=>e.form_identifier===s)))),um=ci.reducer,fe=P(t=>t.uuid),lm={instances:{}},di=u.createSlice({name:"formRevisionAttachments",initialState:lm,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,lm)),reducers:{initializeFormRevisionAttachments:fe.initialize,addFormRevisionAttachment:fe.addOne,addFormRevisionAttachments:fe.addMany,setFormRevisionAttachment:fe.setOne,setFormRevisionAttachments:fe.setMany,updateFormRevisionAttachment:fe.updateOne,updateFormRevisionAttachments:fe.updateMany,deleteFormRevisionAttachment:fe.deleteOne,deleteFormRevisionAttachments:fe.deleteMany}}),{initializeFormRevisionAttachments:om,addFormRevisionAttachment:hm,addFormRevisionAttachments:mm,setFormRevisionAttachment:ym,setFormRevisionAttachments:pm,updateFormRevisionAttachment:Am,updateFormRevisionAttachments:fm,deleteFormRevisionAttachment:Sm,deleteFormRevisionAttachments:Tm}=di.actions,Pt=t=>t.formRevisionAttachmentReducer.instances,Im=u.createSelector([Pt],t=>Object.values(t)),Om=f(u.createSelector([Pt,(t,s)=>s],(t,s)=>t[s])),Fm=f(u.createSelector([Im,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),XF=f(u.createSelector([Pt,(t,s)=>s],(t,s)=>S(Object.values(t).filter(e=>e.form_revision===s)))),Pm=di.reducer,Se=P(t=>t.uuid),gm={instances:{}},ri=u.createSlice({name:"formRevisions",initialState:gm,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,gm)),reducers:{initializeFormRevisions:Se.initialize,addFormRevision:Se.addOne,addFormRevisions:Se.addMany,setFormRevision:Se.setOne,setFormRevisions:Se.setMany,updateFormRevision:Se.updateOne,updateFormRevisions:Se.updateMany,deleteFormRevision:Se.deleteOne,deleteFormRevisions:Se.deleteMany}}),{initializeFormRevisions:bm,addFormRevision:ui,addFormRevisions:li,setFormRevision:_m,setFormRevisions:Mm,updateFormRevision:Rm,updateFormRevisions:wm,deleteFormRevision:oi,deleteFormRevisions:hi}=ri.actions,mi=t=>t.formRevisionReducer.instances,gt=u.createSelector([mi],t=>Object.values(t)),vm=t=>s=>s.formRevisionReducer.instances[t],Em=f(u.createSelector([gt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),QF=f(u.createSelector([gt,(t,s)=>s],(t,s)=>t.filter(e=>e.form===s).sort((e,a)=>e.submitted_at>a.submitted_at?-1:1)[0])),Vm=f(u.createSelector([gt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.form===s)))),zm=ri.reducer,Te=P(t=>t.uuid),Bm={instances:{}},yi=u.createSlice({name:"forms",initialState:Bm,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,Bm)),reducers:{initializeForms:Te.initialize,addForm:Te.addOne,addForms:Te.addMany,setForm:Te.setOne,setForms:Te.setMany,updateForm:Te.updateOne,updateForms:Te.updateMany,deleteForm:Te.deleteOne,deleteForms:Te.deleteMany}}),{initializeForms:jm,addForm:qm,addForms:$m,setForm:Dm,setForms:Um,updateForm:Cm,updateForms:Lm,deleteForm:Gm,deleteForms:km}=yi.actions,Nm=yi.reducer,Hm=t=>t.formReducer.instances,pi=u.createSelector([Hm],t=>Object.values(t)),Wm=t=>s=>s.formReducer.instances[t],Km=f(u.createSelector([pi,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),xF=f(u.createSelector([pi,(t,s)=>s],(t,s)=>S(t.filter(e=>e.organization===s)))),Ie=P(t=>t.uuid),Ym={instances:{}},Ai=u.createSlice({name:"formSubmissionAttachments",initialState:Ym,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,Ym)),reducers:{initializeFormSubmissionAttachments:Ie.initialize,addFormSubmissionAttachment:Ie.addOne,addFormSubmissionAttachments:Ie.addMany,setFormSubmissionAttachment:Ie.setOne,setFormSubmissionAttachments:Ie.setMany,updateFormSubmissionAttachment:Ie.updateOne,updateFormSubmissionAttachments:Ie.updateMany,deleteFormSubmissionAttachment:Ie.deleteOne,deleteFormSubmissionAttachments:Ie.deleteMany}}),{initializeFormSubmissionAttachments:Zm,addFormSubmissionAttachment:Jm,addFormSubmissionAttachments:fi,setFormSubmissionAttachment:Xm,setFormSubmissionAttachments:Qm,updateFormSubmissionAttachment:xm,updateFormSubmissionAttachments:ey,deleteFormSubmissionAttachment:ty,deleteFormSubmissionAttachments:Si}=Ai.actions,Ti=t=>t.formSubmissionAttachmentReducer.instances,Ii=u.createSelector([Ti],t=>Object.values(t)),sy=f(u.createSelector([Ti,(t,s)=>s],(t,s)=>t[s])),Oi=f(u.createSelector([Ii,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(a=>e.has(a.uuid)))})),iy=Oi,ay=f(u.createSelector([Ii,(t,s)=>s],(t,s)=>S(t.filter(e=>e.form_submission===s)))),ny=Ai.reducer,Oe=P(t=>t.uuid),cy={instances:{}},Fi=u.createSlice({name:"formSubmissions",initialState:cy,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,cy)),reducers:{initializeFormSubmissions:Oe.initialize,setFormSubmission:Oe.setOne,setFormSubmissions:Oe.setMany,addFormSubmission:Oe.addOne,addFormSubmissions:Oe.addMany,updateFormSubmission:Oe.updateOne,updateFormSubmissions:Oe.updateMany,deleteFormSubmission:Oe.deleteOne,deleteFormSubmissions:Oe.deleteMany}}),{initializeFormSubmissions:dy,setFormSubmission:ry,setFormSubmissions:uy,addFormSubmission:ly,addFormSubmissions:Pi,updateFormSubmission:oy,updateFormSubmissions:hy,deleteFormSubmission:my,deleteFormSubmissions:gi}=Fi.actions,bi=t=>t.formSubmissionReducer.instances,yy=u.createSelector([bi],t=>Object.values(t)),py=t=>s=>s.formSubmissionReducer.instances[t],Ay=f(u.createSelector([yy,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),fy=f(u.createSelector([bi,mi,(t,s)=>s],(t,s,e)=>{const a=new Set;for(const n of Object.values(s))n.form===e&&a.add(n.uuid);return Object.values(t).filter(n=>a.has(n.form_revision))})),Sy=Fi.reducer,Fe=P(t=>t.uuid),Ty={instances:{}},_i=u.createSlice({name:"geoImages",initialState:Ty,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,Ty)),reducers:{initializeGeoImages:Fe.initialize,setGeoImage:Fe.setOne,setGeoImages:Fe.setMany,addGeoImage:Fe.addOne,addGeoImages:Fe.addMany,updateGeoImage:Fe.updateOne,updateGeoImages:Fe.updateMany,deleteGeoImage:Fe.deleteOne,deleteGeoImages:Fe.deleteMany}}),{initializeGeoImages:Iy,setGeoImage:Oy,setGeoImages:Fy,addGeoImage:Py,addGeoImages:gy,updateGeoImage:by,updateGeoImages:_y,deleteGeoImage:My,deleteGeoImages:Ry}=_i.actions,wy=t=>t.geoImageReducer.instances,Mi=u.createSelector([wy],t=>Object.values(t)),vy=t=>s=>s.geoImageReducer.instances[t],Ey=f(u.createSelector([Mi,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),eP=f(u.createSelector([Mi,(t,s)=>s],(t,s)=>S(t.filter(e=>e.project===s)))),Vy=_i.reducer,Pe=P(t=>t.uuid),zy={instances:{}},Ri=u.createSlice({name:"issueAssociations",initialState:zy,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,zy)),reducers:{initializeIssueAssociations:Pe.initialize,addIssueAssociation:Pe.addOne,addIssueAssociations:Pe.addMany,setIssueAssociation:Pe.setOne,setIssueAssociations:Pe.setMany,updateIssueAssociation:Pe.updateOne,updateIssueAssociations:Pe.updateMany,deleteIssueAssociation:Pe.deleteOne,deleteIssueAssociations:Pe.deleteMany}}),{initializeIssueAssociations:By,setIssueAssociations:jy,setIssueAssociation:qy,updateIssueAssociation:$y,updateIssueAssociations:Dy,addIssueAssociation:Uy,addIssueAssociations:bt,deleteIssueAssociation:Cy,deleteIssueAssociations:_t}=Ri.actions,rt=t=>t.issueAssociationReducer.instances,Ly=u.createSelector([rt],t=>Object.values(t)),Gy=t=>s=>s.issueAssociationReducer.instances[t],ky=f(u.createSelector([Ly,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),Ny=f(u.createSelector([rt,(t,s)=>s],(t,s)=>S(Object.values(t).filter(e=>e.associated_issue===s)))),Hy=f(u.createSelector([rt,(t,s)=>s],(t,s)=>S(Object.values(t).filter(e=>e.issue===s)))),Wy=f(u.createSelector([rt,(t,s)=>s],(t,s)=>S(Object.values(t).filter(e=>e.asset===s)))),Ky=Ri.reducer,ge=P(t=>t.uuid),Yy={instances:{}},wi=u.createSlice({name:"issueAttachments",initialState:Yy,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,Yy)),reducers:{initializeIssueAttachments:ge.initialize,addIssueAttachment:ge.addOne,addIssueAttachments:ge.addMany,setIssueAttachment:ge.setOne,setIssueAttachments:ge.setMany,updateIssueAttachment:ge.updateOne,updateIssueAttachments:ge.updateMany,deleteIssueAttachment:ge.deleteOne,deleteIssueAttachments:ge.deleteMany}}),{initializeIssueAttachments:Zy,addIssueAttachment:Jy,addIssueAttachments:vi,setIssueAttachment:Xy,setIssueAttachments:Qy,updateIssueAttachment:xy,updateIssueAttachments:ep,deleteIssueAttachment:tp,deleteIssueAttachments:Ei}=wi.actions,sp=t=>t.issueAttachmentReducer.instances,Vi=u.createSelector([sp],t=>Object.values(t)),ip=f(u.createSelector([Vi,(t,s)=>s],(t,s)=>S(t.filter(({issue:e})=>s===e)))),ap=t=>s=>s.issueAttachmentReducer.instances[t],np=f(u.createSelector([Vi,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),cp=wi.reducer,be=P(t=>t.uuid),dp={instances:{}},zi=u.createSlice({name:"issueCommentAttachments",initialState:dp,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,dp)),reducers:{initializeIssueCommentAttachments:be.initialize,addIssueCommentAttachment:be.addOne,addIssueCommentAttachments:be.addMany,setIssueCommentAttachment:be.setOne,setIssueCommentAttachments:be.setMany,updateIssueCommentAttachment:be.updateOne,updateIssueCommentAttachments:be.updateMany,deleteIssueCommentAttachment:be.deleteOne,deleteIssueCommentAttachments:be.deleteMany}}),{initializeIssueCommentAttachments:rp,addIssueCommentAttachment:up,addIssueCommentAttachments:lp,setIssueCommentAttachment:op,setIssueCommentAttachments:hp,updateIssueCommentAttachment:mp,updateIssueCommentAttachments:yp,deleteIssueCommentAttachment:pp,deleteIssueCommentAttachments:Ap}=zi.actions,fp=t=>t.issueCommentAttachmentReducer.instances,Bi=u.createSelector([fp],t=>Object.values(t)),Sp=t=>s=>s.issueCommentAttachmentReducer.instances[t],Tp=f(u.createSelector([Bi,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),tP=f(u.createSelector([Bi,(t,s)=>s],(t,s)=>S(t.filter(({issue_comment:e})=>s===e)))),Ip=zi.reducer,_e=P(t=>t.uuid),Op={instances:{}},ji=u.createSlice({name:"issueComments",initialState:Op,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,Op)),reducers:{initializeIssueComments:_e.initialize,addIssueComment:_e.addOne,addIssueComments:_e.addMany,setIssueComment:_e.setOne,setIssueComments:_e.setMany,updateIssueComment:_e.updateOne,updateIssueComments:_e.updateMany,deleteIssueComment:_e.deleteOne,deleteIssueComments:_e.deleteMany}}),{initializeIssueComments:Fp,addIssueComment:Pp,addIssueComments:gp,setIssueComment:bp,setIssueComments:_p,updateIssueComment:Mp,updateIssueComments:Rp,deleteIssueComment:wp,deleteIssueComments:vp}=ji.actions,qi=t=>t.issueCommentReducer.instances,Ep=t=>s=>s.issueCommentReducer.instances[t],Vp=f(u.createSelector([qi,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(Object.values(t).filter(({uuid:a})=>e.has(a)))})),sP=f(u.createSelector([qi,(t,s)=>s],(t,s)=>S(Object.values(t).filter(e=>e.issue===s)))),zp=ji.reducer,Me=P(t=>t.uuid),Bp={instances:{}},$i=u.createSlice({name:"issues",initialState:Bp,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,Bp)),reducers:{initializeIssues:Me.initialize,addIssue:Me.addOne,addIssues:Me.addMany,setIssue:Me.setOne,setIssues:Me.setMany,updateIssue:Me.updateOne,updateIssues:Me.updateMany,deleteIssue:Me.deleteOne,deleteIssues:Me.deleteMany}}),{initializeIssues:jp,addIssue:qp,addIssues:Di,setIssue:$p,setIssues:Dp,updateIssue:Up,updateIssues:Cp,deleteIssue:Lp,deleteIssues:Ui}=$i.actions,Gp=t=>t.issueReducer.instances,Mt=u.createSelector([Gp],t=>Object.values(t)),kp=t=>s=>s.issueReducer.instances[t],Np=f(u.createSelector([Mt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),iP=f(u.createSelector([Mt,(t,s)=>s],(t,s)=>t.filter(e=>e.project===s))),Hp=f(u.createSelector([Mt,(t,s)=>s],(t,s)=>t.filter(e=>e.issue_type===s))),Wp=$i.reducer,Re=P(t=>t.uuid),Kp={instances:{}},Ci=u.createSlice({name:"issueTypeAttachments",initialState:Kp,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,Kp)),reducers:{initializeIssueTypeAttachments:Re.initialize,addIssueTypeAttachment:Re.addOne,addIssueTypeAttachments:Re.addMany,setIssueTypeAttachment:Re.setOne,setIssueTypeAttachments:Re.setMany,updateIssueTypeAttachment:Re.updateOne,updateIssueTypeAttachments:Re.updateMany,deleteIssueTypeAttachment:Re.deleteOne,deleteIssueTypeAttachments:Re.deleteMany}}),{initializeIssueTypeAttachments:Yp,addIssueTypeAttachment:Zp,addIssueTypeAttachments:Jp,setIssueTypeAttachment:Xp,setIssueTypeAttachments:Qp,updateIssueTypeAttachment:xp,updateIssueTypeAttachments:eA,deleteIssueTypeAttachment:tA,deleteIssueTypeAttachments:sA}=Ci.actions,iA=t=>t.issueTypeAttachmentReducer.instances,Li=u.createSelector([iA],t=>Object.values(t)),aA=t=>s=>s.issueTypeAttachmentReducer.instances[t],nA=f(u.createSelector([Li,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),aP=f(u.createSelector([Li,(t,s)=>s],(t,s)=>S(t.filter(({issue_type:e})=>s===e)))),cA=Ci.reducer,we=P(t=>t.uuid),dA={instances:{}},Gi=u.createSlice({name:"issueTypeFieldsAttachments",initialState:dA,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,dA)),reducers:{initializeIssueTypeFieldsAttachments:we.initialize,addIssueTypeFieldsAttachment:we.addOne,addIssueTypeFieldsAttachments:we.addMany,setIssueTypeFieldsAttachment:we.setOne,setIssueTypeFieldsAttachments:we.setMany,updateIssueTypeFieldsAttachment:we.updateOne,updateIssueTypeFieldsAttachments:we.updateMany,deleteIssueTypeFieldsAttachment:we.deleteOne,deleteIssueTypeFieldsAttachments:we.deleteMany}}),{initializeIssueTypeFieldsAttachments:rA,addIssueTypeFieldsAttachment:uA,addIssueTypeFieldsAttachments:lA,setIssueTypeFieldsAttachment:oA,setIssueTypeFieldsAttachments:hA,updateIssueTypeFieldsAttachment:mA,updateIssueTypeFieldsAttachments:yA,deleteIssueTypeFieldsAttachment:pA,deleteIssueTypeFieldsAttachments:AA}=Gi.actions,fA=t=>t.issueTypeFieldsAttachmentReducer.instances,ki=u.createSelector([fA],t=>Object.values(t)),nP=f(u.createSelector([ki,(t,s)=>s],(t,s)=>S(t.filter(e=>e.fields_revision===s)))),SA=t=>s=>s.issueTypeFieldsAttachmentReducer.instances[t],TA=f(u.createSelector([ki,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),IA=Gi.reducer,ve=P(t=>t.uuid),OA={instances:{}},Ni=u.createSlice({name:"issueTypeFieldValues",initialState:OA,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,OA)),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:FA,addIssueTypeFieldValues:PA,addIssueTypeFieldValuesMany:gA,setIssueTypeFieldValues:bA,setIssueTypeFieldValuesMany:_A,updateIssueTypeFieldValues:MA,updateIssueTypeFieldValuesMany:RA,deleteIssueTypeFieldValues:wA,deleteIssueTypeFieldValuesMany:vA}=Ni.actions,EA=t=>t.issueTypeFieldValuesReducer.instances,Rt=u.createSelector([EA],t=>Object.values(t)),cP=f(u.createSelector([Rt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.issue===s)))),VA=t=>s=>s.issueTypeFieldValuesReducer.instances[t],zA=f(u.createSelector([Rt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),BA=Ni.reducer,Ee=P(t=>t.uuid),jA={instances:{}},Hi=u.createSlice({name:"issueTypeFields",initialState:jA,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,jA)),reducers:{initializeIssueTypeFields:Ee.initialize,addIssueTypeFields:Ee.addOne,addIssueTypeFieldsMany:Ee.addMany,setIssueTypeFields:Ee.setOne,setIssueTypeFieldsMany:Ee.setMany,updateIssueTypeFields:Ee.updateOne,updateIssueTypeFieldsMany:Ee.updateMany,deleteIssueTypeFields:Ee.deleteOne,deleteIssueTypeFieldsMany:Ee.deleteMany}}),{initializeIssueTypeFields:qA,addIssueTypeFields:$A,addIssueTypeFieldsMany:DA,setIssueTypeFields:UA,setIssueTypeFieldsMany:CA,updateIssueTypeFields:LA,updateIssueTypeFieldsMany:GA,deleteIssueTypeFields:kA,deleteIssueTypeFieldsMany:NA}=Hi.actions,HA=t=>t.issueTypeFieldsReducer.instances,ut=u.createSelector([HA],t=>Object.values(t)),dP=f(u.createSelector([ut,(t,s)=>s],(t,s)=>S(t.filter(e=>e.issue_type===s)))),rP=f(u.createSelector([ut,(t,s)=>s],(t,s)=>t.filter(e=>e.issue_type===s).sort((e,a)=>e.submitted_at>a.submitted_at?-1:1)[0])),uP=f(u.createSelector([ut,Rt,(t,s)=>s],(t,s,e)=>{const a=new Set(t.filter(n=>n.issue_type===e).map(n=>n.uuid));return S(s.filter(n=>a.has(n.fields_revision)))})),WA=t=>s=>s.issueTypeFieldsReducer.instances[t],KA=f(u.createSelector([ut,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),YA=Hi.reducer,Ve=P(t=>t.uuid),ZA={instances:{}},Wi=u.createSlice({name:"issueTypeFieldValuesAttachments",initialState:ZA,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,ZA)),reducers:{initializeIssueTypeFieldValuesAttachments:Ve.initialize,addIssueTypeFieldValuesAttachment:Ve.addOne,addIssueTypeFieldValuesAttachments:Ve.addMany,setIssueTypeFieldValuesAttachment:Ve.setOne,setIssueTypeFieldValuesAttachments:Ve.setMany,updateIssueTypeFieldValuesAttachment:Ve.updateOne,updateIssueTypeFieldValuesAttachments:Ve.updateMany,deleteIssueTypeFieldValuesAttachment:Ve.deleteOne,deleteIssueTypeFieldValuesAttachments:Ve.deleteMany}}),{initializeIssueTypeFieldValuesAttachments:JA,addIssueTypeFieldValuesAttachment:XA,addIssueTypeFieldValuesAttachments:Ki,setIssueTypeFieldValuesAttachment:QA,setIssueTypeFieldValuesAttachments:xA,updateIssueTypeFieldValuesAttachment:ef,updateIssueTypeFieldValuesAttachments:tf,deleteIssueTypeFieldValuesAttachment:sf,deleteIssueTypeFieldValuesAttachments:Yi}=Wi.actions,af=t=>t.issueTypeFieldValuesAttachmentReducer.instances,Zi=u.createSelector([af],t=>Object.values(t)),nf=t=>s=>s.issueTypeFieldValuesAttachmentReducer.instances[t],cf=f(u.createSelector([Zi,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),df=f(u.createSelector([Zi,(t,s)=>s],(t,s)=>S(t.filter(e=>e.field_values===s)))),rf=Wi.reducer,ze=P(t=>t.uuid),uf={instances:{}},Ji=u.createSlice({name:"issueTypeIdentifiers",initialState:uf,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,uf)),reducers:{initializeIssueTypeIdentifiers:ze.initialize,addIssueTypeIdentifier:ze.addOne,addIssueTypeIdentifiers:ze.addMany,setIssueTypeIdentifier:ze.setOne,setIssueTypeIdentifiers:ze.setMany,updateIssueTypeIdentifier:ze.updateOne,updateIssueTypeIdentifiers:ze.updateMany,deleteIssueTypeIdentifier:ze.deleteOne,deleteIssueTypeIdentifiers:ze.deleteMany}}),{initializeIssueTypeIdentifiers:lf,addIssueTypeIdentifier:of,addIssueTypeIdentifiers:hf,setIssueTypeIdentifier:mf,setIssueTypeIdentifiers:yf,updateIssueTypeIdentifier:pf,updateIssueTypeIdentifiers:Af,deleteIssueTypeIdentifier:ff,deleteIssueTypeIdentifiers:Sf}=Ji.actions,Tf=t=>t.issueTypeIdentifierReducer.instances,Xi=u.createSelector([Tf],t=>Object.values(t)),If=t=>s=>s.issueTypeIdentifierReducer.instances[t],Of=f(u.createSelector([Xi,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),lP=f(u.createSelector([Xi,(t,s)=>s],(t,s)=>S(t.filter(e=>e.issue_type===s)))),Ff=Ji.reducer,Be=P(t=>t.uuid),Pf={instances:{}},Qi=u.createSlice({name:"issueTypeIdentifierValues",initialState:Pf,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,Pf)),reducers:{initializeIssueTypeIdentifierValues:Be.initialize,addIssueTypeIdentifierValue:Be.addOne,addIssueTypeIdentifierValues:Be.addMany,setIssueTypeIdentifierValue:Be.setOne,setIssueTypeIdentifierValues:Be.setMany,updateIssueTypeIdentifierValue:Be.updateOne,updateIssueTypeIdentifierValues:Be.updateMany,deleteIssueTypeIdentifierValue:Be.deleteOne,deleteIssueTypeIdentifierValues:Be.deleteMany}}),{initializeIssueTypeIdentifierValues:gf,addIssueTypeIdentifierValue:bf,addIssueTypeIdentifierValues:_f,setIssueTypeIdentifierValue:Mf,setIssueTypeIdentifierValues:Rf,updateIssueTypeIdentifierValue:wf,updateIssueTypeIdentifierValues:vf,deleteIssueTypeIdentifierValue:Ef,deleteIssueTypeIdentifierValues:Vf}=Qi.actions,zf=t=>t.issueTypeIdentifierValueReducer.instances,wt=u.createSelector([zf],t=>Object.values(t)),Bf=t=>s=>s.issueTypeIdentifierValueReducer.instances[t],jf=f(u.createSelector([wt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),oP=f(u.createSelector([wt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.issue===s)))),hP=f(u.createSelector([wt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.issue_type_identifier===s)))),qf=Qi.reducer,je=P(t=>t.uuid),$f={instances:{}},xi=u.createSlice({name:"issueTypes",initialState:$f,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,$f)),reducers:{initializeIssueTypes:je.initialize,addIssueType:je.addOne,addIssueTypes:je.addMany,setIssueType:je.setOne,setIssueTypes:je.setMany,updateIssueType:je.updateOne,updateIssueTypes:je.updateMany,deleteIssueType:je.deleteOne,deleteIssueTypes:je.deleteMany}}),{initializeIssueTypes:Df,addIssueType:Uf,addIssueTypes:Cf,setIssueType:Lf,setIssueTypes:Gf,updateIssueType:kf,updateIssueTypes:Nf,deleteIssueType:Hf,deleteIssueTypes:Wf}=xi.actions,Kf=t=>t.issueTypeReducer.instances,ea=u.createSelector(Kf,t=>Object.values(t)),Yf=t=>s=>s.issueTypeReducer.instances[t],Zf=f(u.createSelector([ea,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),mP=f(u.createSelector([ea,(t,s)=>s],(t,s)=>S(t.filter(e=>e.organization===s)))),Jf=xi.reducer,qe=P(t=>t.uuid),Xf={instances:{}},ta=u.createSlice({name:"issueTypeStatuses",initialState:Xf,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,Xf)),reducers:{initializeIssueTypeStatuses:qe.initialize,addIssueTypeStatus:qe.addOne,addIssueTypeStatuses:qe.addMany,setIssueTypeStatus:qe.setOne,setIssueTypeStatuses:qe.setMany,updateIssueTypeStatus:qe.updateOne,updateIssueTypeStatuses:qe.updateMany,deleteIssueTypeStatus:qe.deleteOne,deleteIssueTypeStatuses:qe.deleteMany}}),{initializeIssueTypeStatuses:Qf,addIssueTypeStatus:xf,addIssueTypeStatuses:eS,setIssueTypeStatus:tS,setIssueTypeStatuses:sS,updateIssueTypeStatus:iS,updateIssueTypeStatuses:aS,deleteIssueTypeStatus:nS,deleteIssueTypeStatuses:cS}=ta.actions,dS=t=>t.issueTypeStatusReducer.instances,sa=u.createSelector([dS],t=>S(Object.values(t).toSorted(en))),ia=t=>s=>s.issueTypeStatusReducer.instances[t],rS=f(u.createSelector([sa,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),yP=f(u.createSelector([sa,(t,s)=>s],(t,s)=>S(t.filter(e=>e.issue_type===s)))),uS=ta.reducer,$e=P(t=>t.uuid),lS={instances:{}},aa=u.createSlice({name:"issueUpdates",initialState:lS,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,lS)),reducers:{initializeIssueUpdates:$e.initialize,addIssueUpdate:$e.addOne,addIssueUpdates:$e.addMany,setIssueUpdate:$e.setOne,setIssueUpdates:$e.setMany,updateIssueUpdate:$e.updateOne,updateIssueUpdates:$e.updateMany,deleteIssueUpdate:$e.deleteOne,deleteIssueUpdates:$e.deleteMany}}),{initializeIssueUpdates:oS,addIssueUpdate:na,addIssueUpdates:ca,setIssueUpdate:hS,setIssueUpdates:mS,updateIssueUpdate:yS,updateIssueUpdates:pS,deleteIssueUpdate:da,deleteIssueUpdates:ra}=aa.actions,ua=t=>t.issueUpdateReducer.instances,la=u.createSelector([ua],t=>Object.values(t)),AS=f(u.createSelector([ua,(t,s)=>s],(t,s)=>t[s])),fS=f(u.createSelector([la,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),SS=f(u.createSelector([la,(t,s)=>s],(t,s)=>S(t.filter(e=>e.issue===s)))),TS=aa.reducer,De=P(t=>t.id),IS={instances:{},currentUser:null},oa=u.createSlice({name:"users",initialState:IS,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,IS)),reducers:{initializeUsers:De.initialize,setUsers:De.setMany,setUser:De.setOne,addUsers:De.addMany,addUser:De.addOne,updateUsers:De.updateMany,updateUser:De.updateOne,deleteUser:De.deleteOne,deleteUsers:De.deleteMany,setCurrentUser:(t,s)=>{t.currentUser=s.payload},setProfilePicture:(t,s)=>{if(!t.currentUser)return;t.currentUser.profile.file=s.payload.file??null,t.currentUser.profile.file_sha1=s.payload.file_sha1??null;const e=t.instances[t.currentUser.id];if(!e)throw new Error("Unable to find current user in users slice");e.profile.file=s.payload.file??null,e.profile.file_sha1=s.payload.file_sha1??null}}}),{initializeUsers:OS,setUsers:FS,setUser:PS,addUsers:gS,addUser:ha,updateUsers:bS,updateUser:_S,deleteUser:ma,deleteUsers:MS,setCurrentUser:pP,setProfilePicture:AP}=oa.actions,RS=oa.reducer,wS=t=>t.userReducer.currentUser,ya=t=>t.userReducer.instances,vt=u.createSelector([ya],t=>Object.values(t)),Et=t=>s=>s.userReducer.instances[t],vS=f(u.createSelector([vt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({id:a})=>e.has(a)))})),Ue=P(t=>t.uuid),ES={instances:{}},pa=u.createSlice({name:"organizationAccess",initialState:ES,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,ES)),reducers:{initializeOrganizationAccesses:Ue.initialize,addOrganizationAccess:Ue.addOne,addOrganizationAccesses:Ue.addMany,setOrganizationAccess:Ue.setOne,setOrganizationAccesses:Ue.setMany,updateOrganizationAccess:Ue.updateOne,updateOrganizationAccesses:Ue.updateMany,deleteOrganizationAccess:Ue.deleteOne,deleteOrganizationAccesses:Ue.deleteMany}}),{initializeOrganizationAccesses:VS,addOrganizationAccess:zS,addOrganizationAccesses:BS,setOrganizationAccess:jS,setOrganizationAccesses:qS,updateOrganizationAccess:$S,updateOrganizationAccesses:DS,deleteOrganizationAccess:US,deleteOrganizationAccesses:CS}=pa.actions,LS=pa.reducer,Vt=t=>t.organizationAccessReducer.instances,GS=t=>s=>s.organizationAccessReducer.instances[t],kS=f(u.createSelector([Vt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(Object.values(t).filter(({uuid:a})=>e.has(a)))})),fP=u.createSelector([wS,Vt],(t,s)=>Object.values(s).find(a=>a.user===(t==null?void 0:t.id))??null),NS=u.createSelector([Vt],t=>{const s={};for(const e of Object.values(t))s[e.user]=e;return ht(s)}),SP=f(u.createSelector([ya,NS,(t,s)=>s],(t,s,e)=>S(Object.values(t).filter(a=>{const n=s[a.id];return!!n&&n.organization===e})))),Ce=P(t=>t.uuid),HS={instances:{}},Aa=u.createSlice({name:"organizations",initialState:HS,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,HS)),reducers:{initializeOrganizations:Ce.initialize,setOrganizations:Ce.setMany,setOrganization:Ce.setOne,addOrganizations:Ce.addMany,addOrganization:Ce.addOne,updateOrganizations:Ce.updateMany,updateOrganization:Ce.updateOne,deleteOrganization:Ce.deleteOne,deleteOrganizations:Ce.deleteMany}}),{initializeOrganizations:WS,setOrganizations:KS,setOrganization:YS,addOrganizations:ZS,addOrganization:JS,updateOrganizations:XS,updateOrganization:QS,deleteOrganization:xS,deleteOrganizations:eT}=Aa.actions,tT=t=>t.organizationReducer.instances,sT=u.createSelector([tT],t=>Object.values(t)),iT=t=>s=>s.organizationReducer.instances[t],aT=f(u.createSelector([sT,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),nT=Aa.reducer,cT=(t,s,e)=>{const a=t.uuid?t:{...t,uuid:xe.v4()};return{payload:a,type:"",meta:{offline:{effect:{timestamp:new Date().toISOString(),request:a,BASE_URL:s,serviceName:e}}}}},dT={deletedRequests:[],latestRetryTime:0},fa=u.createSlice({name:"outbox",initialState:dT,extraReducers:t=>t.addCase(O,s=>Object.assign(s,dT)),reducers:{enqueueRequest:{reducer:(t,s)=>t,prepare:t=>{console.debug("Preparing to enqueue request",t);const{BASE_URL:s,serviceName:e,...a}=t;return cT(a,s,e)}},markForDeletion(t,s){t.deletedRequests.push(s.payload)},markAsDeleted(t,s){const e=t.deletedRequests.indexOf(s.payload);e!==-1&&t.deletedRequests.splice(e,1)},_setLatestRetryTime:(t,s)=>{t.latestRetryTime=s.payload}}}),TP=t=>t.outboxReducer.deletedRequests,IP=t=>t.outboxReducer.latestRetryTime,{enqueueRequest:rT,markForDeletion:OP,markAsDeleted:uT,_setLatestRetryTime:lT}=fa.actions,oT=fa.reducer,Le=P(t=>t.uuid),hT={instances:{}},Sa=u.createSlice({name:"projectAccess",initialState:hT,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,hT)),reducers:{initializeProjectAccesses:Le.initialize,addProjectAccess:Le.addOne,addProjectAccesses:Le.addMany,setProjectAccess:Le.setOne,setProjectAccesses:Le.setMany,updateProjectAccess:Le.updateOne,updateProjectAccesses:Le.updateMany,deleteProjectAccess:Le.deleteOne,deleteProjectAccesses:Le.deleteMany}}),{initializeProjectAccesses:mT,addProjectAccess:yT,addProjectAccesses:pT,setProjectAccess:AT,setProjectAccesses:fT,updateProjectAccess:ST,updateProjectAccesses:TT,deleteProjectAccess:IT,deleteProjectAccesses:OT}=Sa.actions,FT=Sa.reducer,Ta=t=>t.projectAccessReducer.instances,lt=u.createSelector(Ta,t=>Object.values(t)),PT=t=>s=>s.projectAccessReducer.instances[t],gT=f(u.createSelector([lt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),FP=f(u.createSelector([Ta,(t,s)=>s],(t,s)=>S(Object.values(t).filter(e=>e.project===s)))),PP=f(u.createSelector([lt,(t,s)=>s],(t,s)=>{const e={};for(const a of t.filter(n=>n.project===s))e[a.user]=a;return e})),gP=f(u.createSelector([vt,lt,(t,s)=>s],(t,s,e)=>{const a=new Set(s.filter(n=>n.project===e).map(n=>n.user));return S(t.filter(n=>a.has(n.id)))})),Ge=P(t=>t.uuid),bT={instances:{}},Ia=u.createSlice({name:"projectAttachments",initialState:bT,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,bT)),reducers:{initializeProjectAttachments:Ge.initialize,addProjectAttachment:Ge.addOne,addProjectAttachments:Ge.addMany,setProjectAttachment:Ge.setOne,setProjectAttachments:Ge.setMany,updateProjectAttachment:Ge.updateOne,updateProjectAttachments:Ge.updateMany,deleteProjectAttachment:Ge.deleteOne,deleteProjectAttachments:Ge.deleteMany}}),{initializeProjectAttachments:_T,addProjectAttachment:MT,addProjectAttachments:RT,setProjectAttachment:wT,setProjectAttachments:vT,updateProjectAttachment:ET,updateProjectAttachments:VT,deleteProjectAttachment:zT,deleteProjectAttachments:BT}=Ia.actions,jT=t=>t.projectAttachmentReducer.instances,Oa=u.createSelector([jT],t=>Object.values(t)),qT=t=>s=>s.projectAttachmentReducer.instances[t],$T=f(u.createSelector([Oa,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),bP=f(u.createSelector([Oa,(t,s)=>s],(t,s)=>S(t.filter(({project:e})=>s===e)))),DT=Ia.reducer,ke=P(t=>t.uuid),UT={instances:{},activeProjectFileId:null,isImportingProjectFile:!1},Fa=u.createSlice({name:"projectFiles",initialState:UT,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,UT)),reducers:{initializeProjectFiles:ke.initialize,setProjectFile:ke.setOne,setProjectFiles:ke.setMany,addProjectFile:ke.addOne,addProjectFiles:ke.addMany,updateProjectFile:ke.updateOne,updateProjectFiles:ke.updateMany,deleteProjectFile:ke.deleteOne,deleteProjectFiles:ke.deleteMany,setIsImportingProjectFile:(t,s)=>{t.isImportingProjectFile=s.payload},saveActiveProjectFileBounds:(t,s)=>{const e=t.activeProjectFileId;if(!e)throw new Error("Tried to save bounds for active project file, but no active project file was set.");if(!t.instances[e])throw new Error(`Tried to save bounds for active project file, but project file with ID ${e}
|
|
2
|
+
doesn't exist.`);t.instances[e].bounds=s.payload},setActiveProjectFileId:(t,s)=>{t.activeProjectFileId=s.payload}}}),{initializeProjectFiles:CT,setProjectFile:LT,setProjectFiles:GT,addProjectFile:kT,addProjectFiles:NT,updateProjectFile:HT,updateProjectFiles:WT,deleteProjectFile:KT,deleteProjectFiles:YT,setIsImportingProjectFile:ZT,setActiveProjectFileId:JT,saveActiveProjectFileBounds:XT}=Fa.actions,QT=t=>t.projectFileReducer.instances,xT=u.createSelector([QT],t=>S(Object.values(t).sort((s,e)=>s.z_index-e.z_index))),eI=t=>s=>s.projectFileReducer.instances[t],tI=f(u.createSelector([xT,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),_P=t=>t.projectFileReducer.activeProjectFileId,MP=t=>t.projectFileReducer.isImportingProjectFile,sI=Fa.reducer,Ne=P(t=>t.uuid),iI={instances:{}},Pa=u.createSlice({name:"projects",initialState:iI,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,iI)),reducers:{initializeProjects:Ne.initialize,setProjects:Ne.setMany,setProject:Ne.setOne,addProjects:Ne.addMany,addProject:Ne.addOne,updateProjects:Ne.updateMany,updateProject:Ne.updateOne,deleteProject:Ne.deleteOne,deleteProjects:Ne.deleteMany}}),{initializeProjects:aI,setProjects:nI,setProject:cI,addProjects:dI,addProject:rI,updateProjects:uI,updateProject:lI,deleteProject:oI,deleteProjects:hI}=Pa.actions,mI=Pa.reducer,yI=t=>t.projectReducer.instances,zt=u.createSelector([yI],t=>S(Object.values(t))),pI=t=>s=>s.projectReducer.instances[t],AI=f(u.createSelector([zt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),RP=f(u.createSelector([zt,lt,(t,s)=>s],(t,s,e)=>{const a=new Set(s.filter(n=>n.user===e).map(n=>n.project));return S(t.filter(n=>a.has(n.uuid)))})),wP=f(u.createSelector([zt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.organization===s)))),vP={isRehydrated:!1},ga=u.createSlice({name:"rehydrated",initialState:vP,reducers:{setRehydrated:(t,s)=>{t.isRehydrated=s.payload}}}),{setRehydrated:EP}=ga.actions,VP=t=>t.rehydratedReducer.isRehydrated,fI=ga.reducer,He=P(t=>t.uuid),SI={instances:{}},ba=u.createSlice({name:"teamMemberships",initialState:SI,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,SI)),reducers:{initializeTeamMemberships:He.initialize,addTeamMembership:He.addOne,addTeamMemberships:He.addMany,setTeamMembership:He.setOne,setTeamMemberships:He.setMany,updateTeamMembership:He.updateOne,updateTeamMemberships:He.updateMany,deleteTeamMembership:He.deleteOne,deleteTeamMemberships:He.deleteMany}}),{initializeTeamMemberships:TI,addTeamMembership:II,addTeamMemberships:OI,setTeamMembership:FI,setTeamMemberships:PI,updateTeamMembership:gI,updateTeamMemberships:bI,deleteTeamMembership:_I,deleteTeamMemberships:MI}=ba.actions,RI=ba.reducer,wI=t=>t.teamMembershipReducer.instances,Bt=u.createSelector([wI],t=>Object.values(t)),vI=t=>s=>s.teamMembershipReducer.instances[t],EI=f(u.createSelector([Bt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),zP=f(u.createSelector([Bt,(t,s)=>s],(t,s)=>{const e={};for(const a of t.filter(n=>n.team===s))e[a.user]=a;return e})),BP=f(u.createSelector([vt,Bt,(t,s)=>s],(t,s,e)=>{const a=new Set(s.filter(n=>n.team===e).map(n=>n.user));return S(t.filter(n=>a.has(n.id)))})),We=P(t=>t.uuid),VI={instances:{}},_a=u.createSlice({name:"teams",initialState:VI,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,VI)),reducers:{initializeTeams:We.initialize,addTeam:We.addOne,addTeams:We.addMany,setTeam:We.setOne,setTeams:We.setMany,updateTeam:We.updateOne,updateTeams:We.updateMany,deleteTeam:We.deleteOne,deleteTeams:We.deleteMany}}),{initializeTeams:zI,addTeam:BI,addTeams:jI,setTeam:qI,setTeams:$I,updateTeam:DI,updateTeams:UI,deleteTeam:CI,deleteTeams:LI}=_a.actions,GI=t=>t.teamReducer.instances,Ma=u.createSelector([GI],t=>Object.values(t)),kI=t=>s=>s.teamReducer.instances[t],NI=f(u.createSelector([Ma,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),jP=f(u.createSelector([Ma,(t,s)=>s],(t,s)=>S(t.filter(e=>e.organization===s)))),HI=_a.reducer,qP={version:0},WI=u.createSlice({name:"versioning",initialState:qP,reducers:{}}),KI=WI.reducer,Ra={outboxReducer:oT,fileReducer:jh,authReducer:wo},$P=u.combineReducers(Ra),YI={...Ra,[nt]:KI,categoryReducer:Go,assetReducer:jr,assetAttachmentReducer:On,assetStageCompletionReducer:Wr,assetStageReducer:du,assetTypeReducer:ho,assetTypeAttachmentReducer:Fu,issueReducer:Wp,issueAttachmentReducer:cp,issueTypeReducer:Jf,issueTypeAttachmentReducer:cA,organizationReducer:nT,projectReducer:mI,projectAttachmentReducer:DT,projectAccessReducer:FT,organizationAccessReducer:LS,projectFileReducer:sI,rehydratedReducer:fI,formReducer:Nm,formRevisionReducer:zm,formRevisionAttachmentReducer:Pm,formSubmissionAttachmentReducer:ny,formSubmissionReducer:Sy,formIdentifierReducer:Zh,formIdentifierValueReducer:um,userReducer:RS,emailDomainsReducer:vh,documentsReducer:Ah,documentAttachmentReducer:sh,teamReducer:HI,agentsReducer:rn,issueCommentReducer:zp,issueCommentAttachmentReducer:Ip,issueUpdateReducer:TS,geoImageReducer:Vy,issueAssociationReducer:Ky,issueTypeFieldsReducer:YA,issueTypeFieldValuesReducer:BA,issueTypeFieldsAttachmentReducer:IA,issueTypeFieldValuesAttachmentReducer:rf,issueTypeIdentifierReducer:Ff,issueTypeIdentifierValueReducer:qf,issueTypeStatusReducer:uS,assetTypeFieldsReducer:Ju,assetTypeFieldValuesReducer:Pl,assetTypeFieldsAttachmentReducer:qu,assetTypeFieldValuesAttachmentReducer:ul,assetTypeIdentifierReducer:$l,assetTypeIdentifierValueReducer:Xl,assetTypeStatusReducer:_o,assetProcedureTypeReducer:cd,assetProcedureReducer:Hc,assetProcedureTypeFieldsReducer:cc,assetProcedureTypeFieldValuesReducer:zc,assetProcedureTypeFieldsAttachmentReducer:Wn,assetProcedureTypeFieldValuesAttachmentReducer:Sc,assetProcedureTypeAttachmentReducer:Vn,assetProcedureStepFieldsAttachmentReducer:Pd,assetProcedureStepFieldsReducer:qd,assetProcedureStepFieldValuesAttachmentReducer:Zd,assetProcedureStepFieldValuesReducer:ur,assetProcedureStepReducer:Ir,teamMembershipReducer:RI},DP=u.combineReducers(YI);function UP(t,s){return FO.useMemo(t,s)}class CP{constructor(s){h(this,"operations",[]);h(this,"getData");this.getData=s}performOperations(s){let e=s;for(const a of this.operations)e=a(e);return e}filter(s,e){return this.operations.push(a=>a.filter(n=>n[s]===e)),this}exclude(s,e){return this.operations.push(a=>a.filter(n=>n[s]!==e)),this}orderBy(s){return this.operations.push(e=>[...e].sort((a,n)=>a[s]<=n[s]?1:-1)),this}reverse(){return this.operations.push(s=>[...s].reverse()),this}all(){return this.operations.push(s=>s),this}get(s,e){return u.createSelector([this.getData],a=>this.performOperations(a).find(n=>n[s]===e))}count(){return u.createSelector([this.getData],s=>this.performOperations(s).length)}first(){return u.createSelector([this.getData],s=>this.performOperations(s)[0])}last(){return u.createSelector([this.getData],s=>{const e=this.performOperations(s);return e[e.length-1]})}exists(){return u.createSelector([this.getData],s=>this.performOperations(s).length>0)}toSelector(){return u.createSelector([this.getData],s=>S(this.performOperations(s)))}}const ZI=1e4,JI=200,wa=[400,409,403,404,405,500],XI={};class QI{constructor(s){h(this,"client");h(this,"pageSize",ZI);XI[this.constructor.name]=this,this.client=s}async performRequest(s,e){return this.client.performRequest(this.host,s,this,e)}async enqueueRequest(s){return this.client.enqueueRequest(s,this.host,this.constructor.name)}async performPagination(s,e){return this.client.performPagination(this.host,s,this.pageSize,this,e)}dispatch(s){this.client.store.dispatch(s)}}const xI=()=>sO.length-1,eO=t=>(t[nt]={version:xI()},t),tO=()=>eO({}),LP=t=>(t.outboxReducer&&(t.outboxReducer.deletedRequests=[]),t),GP=t=>s=>{var e;return s===void 0&&(s={}),((e=s[nt])==null?void 0:e.version)===xI()?s:t(s)},sO=[eO,tO,tO,LP],kP=Object.fromEntries(sO.map((t,s)=>[s,GP(t)])),NP=t=>{if(t)throw t;const s=at();s?s.dispatch({type:"rehydrated/setRehydrated",payload:!0}):console.error("Client store not set")},iO=(t,s,e)=>{const a=Xe();return a?(a.addRequest(s),a.getQueue()):(console.warn("Outbox coordinator not set; cannot enqueue request yet."),[])},aO=(t,s,e)=>{const a=Xe();if(!a)return console.warn("Outbox coordinator not set; cannot dequeue request yet."),[];const c=s.meta.offlineAction.payload.uuid;return a.remove(c),a.getQueue()};async function HP(t,s){if(!s.payload)throw new Error("Received empty payload");return fO(s)}const WP={...$a,effect:HP,discard:cO,returnPromises:!0,persistCallback:NP,retry:JP,persistOptions:{storage:gO},queue:{...$a.queue,enqueue:iO,dequeue:aO,peek:(...t)=>ZP(...t)}},KP=bO(kP,nt),YP=u.compose(PO.offline(WP),KP);async function nO(t,s,e){if(s.store.getState().outboxReducer.deletedRequests.includes(t.payload.uuid))throw new Error("Request was marked for deletion");const n=XI[t.meta.offline.effect.serviceName];if(!n)throw new Error(`Service ${t.meta.offline.effect.serviceName} not found`);return za(t.meta.offline.effect.BASE_URL,t.meta.offline.effect.request,s,n,e)}function cO(t,s,e=0){var m;if(console.debug("Considering discarding request due to error:",t,`(${typeof t})`,`
|
|
3
|
+
Action:`,s,`
|
|
4
|
+
Retries:`,e),!(t instanceof Error))throw console.error("ENCOUNTERED NON-ERROR ERROR:",t,"(throwing immediately, which may lead to unexpected behavior)"),t;const a=at(),c=a.getState().outboxReducer.deletedRequests,d=s.payload.uuid;function r(){a.dispatch(uT(d));const l=Xe();if(!l)throw new Error("Outbox coordinator not set");l.remove(s.payload.uuid);const p=s.meta.offline.rollback;throw p&&(console.warn("Rolling back request due to SDK error:",s),a.dispatch(p)),t}if(t instanceof q&&t.options.discard&&(console.debug("Discarding request due to explicit discard:",s),r()),c.includes(d)&&(console.debug("Discarding request due to deletion:",s),r()),t instanceof q){const l=t.status||((m=t.response)==null?void 0:m.status);if(l||console.warn("Error has no status code:",t),l!==void 0&&wa.includes(l)){console.warn("Discarding request due to error:",t,`
|
|
5
|
+
Action:`,s);const p=Xe();if(!p)throw new Error("Outbox coordinator not set");p.remove(s.payload.uuid),t.options.discard=!0,r()}}console.debug("Registering a retry for request:",s.payload.uuid);const o=Xe();if(!o)throw new Error("Outbox coordinator not set");return o.registerRetry(s.payload.uuid),!1}function ZP(t,s,e){var a;return(a=Xe())==null?void 0:a.peek()}function JP(t,s){return at().dispatch(lT(new Date().getTime())),Na}const tt="An unknown error occurred",XP=500,dO=["non_field_errors","detail"];function QP(t,s){let e;if(t!=null&&t.body)if(typeof t.body=="object"){const a=t.body;if(typeof a.error=="string")e=a.error;else if(typeof a.message=="string")e=a.message;else try{e=Object.entries(a).map(([n,c])=>typeof c=="string"?dO.includes(n)?c:`${n}: ${c}`:Array.isArray(c)?dO.includes(n)?c.join(`
|
|
6
|
+
`):c.map(d=>`${n}: ${d}`).join(`
|
|
7
|
+
`):`${n}: ${JSON.stringify(c)}`).join(`
|
|
8
|
+
`)}catch(n){console.error("Failed to extract error message from response body",n)}}else typeof t.body=="string"&&(e=t.body);else t!=null&&t.text?e=t.text:s instanceof Error&&(e=s.message);return!e||e.length>XP?tt:e}class q extends Error{constructor(e){super(tt);h(this,"status");h(this,"response");h(this,"message");h(this,"options");const{response:a,innerError:n}=e;this.message=e.message??QP(a,n)??tt,this.status=(a==null?void 0:a.status)??0,this.response=a,e.discard=e.discard??!1,this.options=e}}function rO(t){function s(e){return typeof e=="object"&&e!==null&&["ok","redirect","clientError","serverError","error"].every(n=>n in e)}if(s(t))return t;if(typeof t=="object"&&t!==null){const e=t;if(s(e.response))return e.response;if(e.response&&s(e.response.response))return e.response.response}}class xP extends QI{constructor(s){super(s)}}class Ze extends QI{constructor(e,a){super(e);h(this,"auth");this.auth=a}}class eg extends Ze{async startConversation(s,e){return this.enqueueRequest({description:"Start agent conversation",method:y.POST,url:"/agents/prompt/",payload:{prompt:s,active_project:e},blockers:["prompt"],blocks:["prompt"]}).then(a=>(this.dispatch(nn(a)),a))}async continueConversation(s,e,a){return this.enqueueRequest({description:"Prompt agent",method:y.POST,url:"/agents/prompt/",payload:{prompt:s,active_project:a},blockers:["prompt"],blocks:["prompt"],queryParams:{conversation_id:e}}).then(n=>{this.dispatch(dn(n))})}async fetchDetails(s){return this.enqueueRequest({description:"Get agent conversation",method:y.GET,url:`/agents/conversations/${s}/`,blockers:["conversation"],blocks:["conversation"]}).then(e=>{this.dispatch(cn(e))})}async rate(s,e){return this.enqueueRequest({description:"Rate agent response",method:y.PUT,url:`/agents/responses/${s}/rate/`,payload:{rating:e},blockers:["rate"],blocks:["rate"]})}async refreshStore(s,e){const a=await this.performRequest({method:y.GET,url:"/agents/conversations/",queryParams:{project:s}},e);return this.dispatch(an(a)),a}}class w extends Ze{async get(s,e){return this.performRequest({url:`${this.url}/${s}/`,method:y.GET},e)}async list(s,e){return this.performRequest({url:`${this.url}/`,method:y.GET,...s},e)}async listPaginated(s,e){return this.performPagination({url:`${this.url}/`,method:y.GET,...s},e)}}class z extends w{constructor(){super(...arguments);h(this,"pageSize",JI)}async _bulkAdd(e){var T;const{store:a}=this.client,{addMany:n,updateMany:c,deleteMany:d}=this.actions,r=((T=a.getState().userReducer.currentUser)==null?void 0:T.id)??null,o=new Date().toISOString(),m=[],l=[],p={};for(const I of e){const{modelUuid:_,file:M}=I,g=await this.client.files.getFilePayload(M);g.sha1 in p||(p[g.sha1]=g);const v=this.buildModel({file:M,file_sha1:g.sha1,submitted_at:o,created_by:r,modelUuid:_});m.push(v),l.push(this.buildPayload(v,g))}this.dispatch(n(m));const A=this.enqueueRequest({description:`Add ${this.name}`,method:y.POST,url:`${this.url}/bulk/`,payload:{submitted_at:o,attachments:l,files:Object.values(p)},blocks:m.map(I=>this.getId(I)),blockers:m.map(I=>I.file_sha1)});return A.then(({attachments:I,presigned_urls:_})=>{this.dispatch(c(I)),this.client.files.processPresignedUrls(_)}).catch(()=>{this.dispatch(d(m.map(I=>this.getId(I))))}),[m,A.then(({attachments:I})=>I)]}async _delete(e){const{store:a}=this.client,{addOne:n,deleteOne:c}=this.actions,{selectById:d}=this.selectors,r=d(e)(a.getState());if(!r)throw new Error(`Attempting to delete attachment with uuid ${e} that does not exist in the store`);this.dispatch(c(this.getId(r)));const o=this.enqueueRequest({description:`Delete ${this.name}`,method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return o.then(()=>{this.client.files.removeCache(r.file_sha1)}).catch(()=>{this.dispatch(n(r))}),o}}class tg extends z{constructor(){super(...arguments);h(this,"name","Asset attachment");h(this,"url","/asset-attachments");h(this,"actions",{addOne:on,addMany:Wt,setOne:hn,setMany:mn,updateOne:yn,updateMany:pn,deleteOne:An,deleteMany:Kt,initialize:ln});h(this,"selectors",{selectById:Sn,selectByIds:Tn})}getId(e){return e.uuid}buildModel(e){return F({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,asset:e.modelUuid})}buildPayload(e,a){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:a.extension,asset:e.asset}}async bulkAdd(e){return this._bulkAdd(e.map(a=>({modelUuid:a.assetUuid,file:a.file})))}async delete(e){return this._delete(e)}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{asset__project:e}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class sg extends z{constructor(){super(...arguments);h(this,"name","Asset Procedure Attachment");h(this,"url","/asset-procedure-type-attachments");h(this,"actions",{addOne:gn,addMany:bn,setOne:_n,setMany:Mn,updateOne:Rn,updateMany:wn,deleteOne:vn,deleteMany:En,initialize:Pn});h(this,"selectors",{selectById:Bn,selectByIds:jn})}getId(e){return e.uuid}buildModel(e){return F({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,asset_procedure_type:e.modelUuid})}buildPayload(e,a){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:a.extension,asset_procedure_type:e.asset_procedure_type}}async bulkAdd(e){return this._bulkAdd(e.map(a=>({modelUuid:a.assetProcedureTypeUuid,file:a.file})))}async delete(e){return this._delete(e)}async refreshStore(e,a){const{initialize:n}=this.actions,c=await this.list({queryParams:{asset_procedure_type__organization:e}},a);return this.dispatch(n(c)),c}}class ig extends z{constructor(){super(...arguments);h(this,"name","Asset Procedure Type Fields Attachment");h(this,"url","/asset-procedure-type-fields-attachments");h(this,"actions",{addOne:Dn,addMany:Un,setOne:Cn,setMany:Ln,updateOne:Gn,updateMany:kn,deleteOne:Nn,deleteMany:Hn,initialize:$n});h(this,"selectors",{selectById:Yn,selectByIds:Zn})}async bulkAdd(e){var m;const a=new Date().toISOString(),n=((m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id)??null,c={},d=[],r=[];for(const l of e){const{fieldsRevisionUuid:p,fieldIdentifier:A,file:T}=l,I=await this.client.files.getFilePayload(T);I.sha1 in c||(c[I.sha1]=I);const _=F({file:URL.createObjectURL(T),file_type:T.type,file_name:T.name,file_sha1:I.sha1,created_by:n,fields_revision:p,submitted_at:a,field_identifier:A});d.push(_);const M={uuid:_.uuid,file_name:T.name,field_identifier:A,file_extension:I.extension,file_sha1:I.sha1,fields_revision:p};r.push(M)}this.dispatch(this.actions.addMany(d));const o=this.enqueueRequest({description:"Add asset procedure type fields attachments",method:y.POST,url:`${this.url}/bulk/`,payload:{submitted_at:a,attachments:r,files:Object.values(c)},blockers:d.map(l=>l.fields_revision),blocks:d.map(l=>l.uuid)});return o.then(l=>{this.client.files.processPresignedUrls(l.presigned_urls),this.dispatch(this.actions.setMany(l.attachments))}).catch(()=>{this.dispatch(this.actions.deleteMany(d.map(l=>l.uuid)))}),[d,o.then(({attachments:l})=>l)]}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{fields_revision__asset_procedure_type__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class ag extends w{constructor(){super(...arguments);h(this,"name","Asset Procedure Type Fields");h(this,"url","/asset-procedure-type-fields");h(this,"actions",{addOne:Qn,addMany:xn,setOne:ec,setMany:tc,updateOne:sc,updateMany:ic,deleteOne:ac,deleteMany:nc,initialize:Xn});h(this,"selectors",{selectById:rc,selectByIds:uc})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Add Asset Procedure Type Fields",method:y.POST,url:`${this.url}/`,payload:R(d),blockers:[d.asset_procedure_type],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(m=>{throw this.dispatch(this.actions.deleteOne(d.uuid)),m}),[d,r]}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{asset_procedure_type__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}function Je(t,s){const e=[];let a=0;const n=t.length;for(;a<n;)e.push(t.slice(a,a+=s));return e}class ng extends z{constructor(){super(...arguments);h(this,"name","Asset Procedure Type Field Values Attachment");h(this,"url","/asset-procedure-type-field-values-attachments");h(this,"actions",{addOne:hc,addMany:ts,setOne:mc,setMany:yc,updateOne:pc,updateMany:Ac,deleteOne:fc,deleteMany:ss,initialize:oc});h(this,"selectors",{selectById:Ic,selectByIds:Oc})}async bulkAdd(e,a){var l;const n=new Date().toISOString(),c=((l=this.client.store.getState().userReducer.currentUser)==null?void 0:l.id)??null,d=Je(e,a??e.length),r=[],o=[];for(const p of d){const A={},T=[];for(const I of p){const{fieldValuesUuid:_,fieldIdentifier:M,file:g}=I,v=await this.client.files.getFilePayload(g);v.sha1 in A||(A[v.sha1]=v);const V=F({file:URL.createObjectURL(g),file_type:g.type,file_name:g.name,file_sha1:v.sha1,created_by:c,field_values:_,submitted_at:n,field_identifier:M});r.push(V);const Ke={uuid:V.uuid,file_name:g.name,file_sha1:v.sha1,file_extension:v.extension,field_identifier:M,field_values:_};T.push(Ke)}o.push({submitted_at:n,attachments:T,files:Object.values(A)})}this.dispatch(this.actions.addMany(r));const m=o.map(p=>this.enqueueRequest({description:"Add asset procedure type field values attachments",method:y.POST,url:`${this.url}/bulk/`,payload:p,blockers:p.attachments.map(A=>A.field_values),blocks:p.attachments.map(A=>A.uuid)}));return Promise.all(m).then(p=>{for(const T of p)this.client.files.processPresignedUrls(T.presigned_urls);const A=p.flatMap(T=>T.attachments);this.dispatch(this.actions.setMany(A))}).catch(p=>{throw this.dispatch(this.actions.deleteMany(r.map(A=>A.uuid))),p}),[r,m.map(p=>p.then(({attachments:A})=>A))]}async bulkDelete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectByIds(e)(n);this.dispatch(this.actions.deleteMany(e));try{await this.enqueueRequest({description:"Delete asset procedure type field values attachments",method:y.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(this.actions.addMany(c)),d}}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{field_values__asset_procedure__project:e,latest:!0}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class cg extends w{constructor(){super(...arguments);h(this,"name","Asset Procedure Type Field Values");h(this,"url","/asset-procedure-type-field-values");h(this,"actions",{addOne:bc,addMany:_c,setOne:Mc,setMany:Rc,updateOne:wc,updateMany:vc,deleteOne:Ec,deleteMany:Vc,initialize:gc});h(this,"selectors",{selectById:jc,selectByIds:qc})}add(e){var m;const{store:a}=this.client,c=((m=a.getState().userReducer.currentUser)==null?void 0:m.id)??null,d=new Date().toISOString(),r=F({...e,created_by:c,submitted_at:d}),o=this.enqueueRequest({description:"Add asset procedure type field values",method:y.POST,url:`${this.url}/`,payload:R(r),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[r.uuid]});return this.dispatch(this.actions.addOne(r)),o.then(l=>(this.dispatch(this.actions.setOne(l)),l)).catch(()=>{this.dispatch(this.actions.deleteOne(r.uuid))}),[r,o]}bulkAdd(e,a){var l;const n=new Date().toISOString(),c=((l=this.client.store.getState().userReducer.currentUser)==null?void 0:l.id)??null,d=[],r=Je(e.payloads,a??e.payloads.length),o=[];for(const p of r){const A=[];for(const T of p){const I=F({...T,values:T.values,created_by:c,submitted_at:n});d.push(I),A.push({uuid:I.uuid,asset:T.asset,fields_revision:T.fields_revision,asset_procedure:T.asset_procedure,published_at:T.published_at,values:I.values})}o.push({submitted_at:n,values:e.values,field_values:A})}this.dispatch(this.actions.addMany(d));const m=[];for(const p of o){const A=p.field_values.map(g=>g.asset),T=p.field_values.map(g=>g.fields_revision),I=p.field_values.map(g=>g.asset_procedure),_=p.field_values.map(g=>g.uuid),M=this.enqueueRequest({description:"Bulk add asset procedure type field values",method:y.POST,url:`${this.url}/bulk/`,payload:p,blockers:[...A,...T,...I],blocks:_});m.push(M)}return Promise.all(m).then(p=>{this.dispatch(this.actions.setMany(p.flat()))}).catch(()=>{this.dispatch(this.actions.deleteMany(d.map(p=>p.uuid)))}),[d,m]}update(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e.uuid)(n);if(!c)throw new Error(`Expected AssetProcedureTypeFieldValues with uuid ${e.uuid} to exist`);const d={...c,...e};this.dispatch(this.actions.setOne(d));const r=this.enqueueRequest({description:"Update asset procedure type field values",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[d.fields_revision,d.asset,d.asset_procedure],blocks:[d.uuid]});return r.then(o=>{this.dispatch(this.actions.setOne(o))}).catch(()=>{this.dispatch(this.actions.setOne(c))}),[d,r]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const d=Fc(e)(n);this.dispatch(this.actions.deleteOne(e)),this.dispatch(ss(d.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete asset procedure type field values",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(this.actions.addOne(c)),this.dispatch(ts(d)),r}}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{asset_procedure__project:e,latest:!0}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class dg extends w{constructor(){super(...arguments);h(this,"name","Asset Procedure");h(this,"url","/asset-procedures");h(this,"actions",{addOne:Uc,addMany:cs,setOne:kc,setMany:Nc,updateOne:Cc,updateMany:Lc,deleteOne:Gc,deleteMany:ds,initialize:Dc});h(this,"selectors",{selectById:Yc,selectByIds:Zc})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Create asset procedure",method:y.POST,url:`${this.url}/`,payload:R(d),blockers:[e.asset_procedure_type,e.asset_type],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(()=>{this.dispatch(this.actions.deleteOne(d.uuid))}),[d,r]}update(e){const{store:a}=this.client,n=this.selectors.selectById(e.uuid)(a.getState());if(!n)throw new Error(`Expected asset procedure with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Update asset procedure",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[n.uuid],blocks:[n.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.setOne(n))}),[c,d]}async remove(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected asset procedure with uuid ${e} to exist`);return this.dispatch(this.actions.deleteOne(e)),this.enqueueRequest({description:"Delete asset procedure",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]}).catch(d=>{throw this.dispatch(this.actions.addOne(c)),d})}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{project:e}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class rg extends w{constructor(){super(...arguments);h(this,"name","Asset Procedure Type");h(this,"url","/asset-procedure-types");h(this,"actions",{addOne:Qc,addMany:xc,setOne:ad,setMany:nd,updateOne:ed,updateMany:td,deleteOne:sd,deleteMany:id,initialize:Xc});h(this,"selectors",{selectById:rd,selectByIds:ud})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Create asset procedure type",method:y.POST,url:`${this.url}/`,payload:R(d),blockers:[],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(()=>{this.dispatch(this.actions.deleteOne(d.uuid))}),[d,r]}update(e){const{store:a}=this.client,n=this.selectors.selectById(e.uuid)(a.getState());if(!n)throw new Error(`Expected asset procedure type with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Update asset procedure type",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[n.uuid],blocks:[n.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.setOne(n))}),[c,d]}async remove(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected asset procedure type with uuid ${e} to exist`);const d=Kc(e)(n);return this.dispatch(this.actions.deleteOne(e)),this.dispatch(ds(d.map(({uuid:r})=>r))),this.enqueueRequest({description:"Delete asset procedure type",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]}).catch(r=>{throw this.dispatch(this.actions.addOne(c)),this.dispatch(cs(d)),r})}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class ug extends z{constructor(){super(...arguments);h(this,"name","Asset Procedure Step Fields Attachment");h(this,"url","/asset-procedure-step-fields-attachments");h(this,"actions",{addOne:hd,addMany:md,setOne:yd,setMany:pd,updateOne:Ad,updateMany:fd,deleteOne:Sd,deleteMany:Td,initialize:od});h(this,"selectors",{selectById:Od,selectByIds:Fd})}async bulkAdd(e){var m;const a=new Date().toISOString(),n=((m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id)??null,c={},d=[],r=[];for(const l of e){const{fieldsRevisionUuid:p,fieldIdentifier:A,file:T}=l,I=await this.client.files.getFilePayload(T);I.sha1 in c||(c[I.sha1]=I);const _=F({file:URL.createObjectURL(T),file_type:T.type,file_name:T.name,file_sha1:I.sha1,created_by:n,fields_revision:p,submitted_at:a,field_identifier:A});d.push(_);const M={uuid:_.uuid,file_name:T.name,field_identifier:A,file_extension:I.extension,file_sha1:I.sha1,fields_revision:p};r.push(M)}this.dispatch(this.actions.addMany(d));const o=this.enqueueRequest({description:"Add asset procedure step fields attachments",method:y.POST,url:`${this.url}/bulk/`,payload:{submitted_at:a,attachments:r,files:Object.values(c)},blockers:d.map(l=>l.fields_revision),blocks:d.map(l=>l.uuid)});return o.then(l=>{this.client.files.processPresignedUrls(l.presigned_urls),this.dispatch(this.actions.setMany(l.attachments))}).catch(()=>{this.dispatch(this.actions.deleteMany(d.map(l=>l.uuid)))}),[d,o.then(({attachments:l})=>l)]}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{fields_revision__asset_procedure_step__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class lg extends w{constructor(){super(...arguments);h(this,"name","Asset Procedure Step Fields");h(this,"url","/asset-procedure-step-fields");h(this,"actions",{addOne:_d,addMany:Md,setOne:Rd,setMany:wd,updateOne:vd,updateMany:Ed,deleteOne:Vd,deleteMany:zd,initialize:bd});h(this,"selectors",{selectById:Bd,selectByIds:jd})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Add Asset Procedure Step Fields",method:y.POST,url:`${this.url}/`,payload:R(d),blockers:[d.asset_procedure_step],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(m=>{throw this.dispatch(this.actions.deleteOne(d.uuid)),m}),[d,r]}update(e){const{store:a}=this.client,n=a.getState().assetProcedureStepFieldsReducer.instances[e.uuid];if(!n)throw new Error(`AssetProcedureStepFields with uuid ${e.uuid} not found`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Update Asset Procedure Step Fields",method:y.PATCH,url:`${this.url}/${n.uuid}/`,payload:e,blockers:[n.uuid],blocks:[n.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(r=>{throw this.dispatch(this.actions.setOne(n)),r}),[c,d]}delete(e){const{store:a}=this.client,n=a.getState().assetProcedureStepFieldsReducer.instances[e];if(!n)throw new Error(`AssetProcedureStepFields with uuid ${e} not found`);this.dispatch(this.actions.deleteOne(e));const c=this.enqueueRequest({description:"Delete Asset Procedure Step Fields",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]});return c.catch(d=>{throw this.dispatch(this.actions.addOne(n)),d}),c}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{asset_procedure_step__asset_procedure_type__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class og extends z{constructor(){super(...arguments);h(this,"name","Asset Procedure Step Field Values Attachment");h(this,"url","/asset-procedure-step-field-values-attachments");h(this,"actions",{addOne:Ud,addMany:ps,setOne:Cd,setMany:Ld,updateOne:Gd,updateMany:kd,deleteOne:Nd,deleteMany:As,initialize:Dd});h(this,"selectors",{selectById:Wd,selectByIds:Kd})}async bulkAdd(e,a){var l;const n=new Date().toISOString(),c=((l=this.client.store.getState().userReducer.currentUser)==null?void 0:l.id)??null,d=Je(e,a??e.length),r=[],o=[];for(const p of d){const A={},T=[];for(const I of p){const{fieldValuesUuid:_,fieldIdentifier:M,file:g}=I,v=await this.client.files.getFilePayload(g);v.sha1 in A||(A[v.sha1]=v);const V=F({file:URL.createObjectURL(g),file_type:g.type,file_name:g.name,file_sha1:v.sha1,created_by:c,field_values:_,submitted_at:n,field_identifier:M});r.push(V);const Ke={uuid:V.uuid,file_name:g.name,file_sha1:v.sha1,file_extension:v.extension,field_identifier:M,field_values:_};T.push(Ke)}o.push({submitted_at:n,attachments:T,files:Object.values(A)})}this.dispatch(this.actions.addMany(r));const m=o.map(p=>this.enqueueRequest({description:"Add asset procedure step field values attachments",method:y.POST,url:`${this.url}/bulk/`,payload:p,blockers:p.attachments.map(A=>A.field_values),blocks:p.attachments.map(A=>A.uuid)}));return Promise.all(m).then(p=>{for(const T of p)this.client.files.processPresignedUrls(T.presigned_urls);const A=p.flatMap(T=>T.attachments);this.dispatch(this.actions.setMany(A))}).catch(p=>{throw this.dispatch(this.actions.deleteMany(r.map(A=>A.uuid))),p}),[r,m.map(p=>p.then(({attachments:A})=>A))]}async bulkDelete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectByIds(e)(n);this.dispatch(this.actions.deleteMany(e));try{await this.enqueueRequest({description:"Delete asset procedure step field values attachments",method:y.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(this.actions.addMany(c)),d}}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{field_values__asset_procedure__project:e,latest:!0}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class hg extends w{constructor(){super(...arguments);h(this,"name","Asset Procedure Step Field Values");h(this,"url","/asset-procedure-step-field-values");h(this,"actions",{addOne:Qd,addMany:xd,setOne:er,setMany:tr,updateOne:sr,updateMany:ir,deleteOne:ar,deleteMany:nr,initialize:Xd});h(this,"selectors",{selectById:dr,selectByIds:rr})}add(e){var m;const{store:a}=this.client,c=((m=a.getState().userReducer.currentUser)==null?void 0:m.id)??null,d=new Date().toISOString(),r=F({...e,created_by:c,submitted_at:d}),o=this.enqueueRequest({description:"Add asset procedure step field values",method:y.POST,url:`${this.url}/`,payload:R(r),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[r.uuid]});return this.dispatch(this.actions.addOne(r)),o.then(l=>(this.dispatch(this.actions.setOne(l)),l)).catch(()=>{this.dispatch(this.actions.deleteOne(r.uuid))}),[r,o]}bulkAdd(e,a){var l;const n=new Date().toISOString(),c=((l=this.client.store.getState().userReducer.currentUser)==null?void 0:l.id)??null,d=[],r=Je(e.payloads,a??e.payloads.length),o=[];for(const p of r){const A=[];for(const T of p){const I=F({...T,values:T.values,created_by:c,submitted_at:n});d.push(I),A.push({uuid:I.uuid,asset:T.asset,fields_revision:T.fields_revision,asset_procedure:T.asset_procedure,asset_procedure_step:T.asset_procedure_step,published_at:T.published_at,values:I.values})}o.push({submitted_at:n,values:e.values,field_values:A})}this.dispatch(this.actions.addMany(d));const m=[];for(const p of o){const A=p.field_values.map(g=>g.asset),T=p.field_values.map(g=>g.fields_revision),I=p.field_values.map(g=>g.asset_procedure),_=p.field_values.map(g=>g.uuid),M=this.enqueueRequest({description:"Bulk add asset procedure step field values",method:y.POST,url:`${this.url}/bulk/`,payload:p,blockers:[...A,...T,...I],blocks:_});m.push(M)}return Promise.all(m).then(p=>{this.dispatch(this.actions.setMany(p.flat()))}).catch(()=>{this.dispatch(this.actions.deleteMany(d.map(p=>p.uuid)))}),[d,m]}update(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e.uuid)(n);if(!c)throw new Error(`Expected AssetProcedureStepFieldValues with uuid ${e.uuid} to exist`);const d={...c,...e};this.dispatch(this.actions.setOne(d));const r=this.enqueueRequest({description:"Update asset procedure step field values",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[d.fields_revision,d.asset,d.asset_procedure],blocks:[d.uuid]});return r.then(o=>{this.dispatch(this.actions.setOne(o))}).catch(()=>{this.dispatch(this.actions.setOne(c))}),[d,r]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const d=Yd(e)(n);this.dispatch(this.actions.deleteOne(e)),this.dispatch(As(d.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete asset procedure step field values",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(this.actions.addOne(c)),this.dispatch(ps(d)),r}}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{asset_procedure__project:e,latest:!0}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class mg extends w{constructor(){super(...arguments);h(this,"name","Asset Procedure Step");h(this,"url","/asset-procedure-steps");h(this,"actions",{addOne:yr,addMany:pr,setOne:hr,setMany:mr,updateOne:Ar,updateMany:fr,deleteOne:Sr,deleteMany:Tr,initialize:or});h(this,"selectors",{selectById:Or,selectByIds:Fr})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Create asset procedure step",method:y.POST,url:`${this.url}/`,payload:R(d),blockers:[d.asset_procedure_type],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(()=>{this.dispatch(this.actions.deleteOne(d.uuid))}),[d,r]}update(e){const{store:a}=this.client,n=this.selectors.selectById(e.uuid)(a.getState());if(!n)throw new Error(`No asset procedure step with uuid ${e.uuid} found in the store`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Update asset procedure step",method:y.PATCH,url:`${this.url}/${n.uuid}/`,payload:{name:e.name,description:e.description,priority:e.order,color:e.color},blockers:[n.uuid],blocks:[n.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.setOne(n))}),[c,d]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`No asset procedure step with uuid ${e} found in the store`);const d=Pr(e)(n);return this.dispatch(this.actions.deleteMany([e,...Ja(d)])),this.enqueueRequest({description:"Delete asset stage",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]}).catch(r=>{throw this.dispatch(this.actions.addMany([c,...d])),r})}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{asset_procedure_type__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class yg extends w{constructor(){super(...arguments);h(this,"url","/assets");h(this,"name","Asset");h(this,"actions",{addOne:_r,addMany:Fs,setOne:vr,setMany:Er,updateOne:Mr,updateMany:Rr,deleteOne:wr,deleteMany:Ps,initialize:br});h(this,"selectors",{selectById:zr,selectByIds:Br})}add(e){var p;const{store:a}=this.client,{addOne:n,updateOne:c,deleteOne:d}=this.actions,r=((p=a.getState().userReducer.currentUser)==null?void 0:p.id)??null,o=new Date().toISOString(),m=F({...e,created_by:r,submitted_at:o});this.dispatch(n(m));const l=this.enqueueRequest({description:`Create ${this.name}`,method:y.POST,url:`${this.url}/`,payload:R(m),blockers:[m.asset_type],blocks:[m.uuid]});return l.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(m.uuid))}),[m,l]}update(e){const{store:a}=this.client,{updateOne:n}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(a.getState());if(!d)throw new Error(`No asset with uuid ${e.uuid} found in the store`);const r={...d,...e};this.dispatch(n(r));const o=this.enqueueRequest({description:`Edit ${this.name}`,method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return o.then(m=>{this.dispatch(n(m))}).catch(()=>{this.dispatch(n(d))}),[r,o]}async delete(e){const{store:a}=this.client,{addOne:n,deleteOne:c}=this.actions,{selectById:d}=this.selectors,r=a.getState(),o=d(e)(r);if(!o)throw new Error(`No asset with uuid ${e} found in the store`);const m=In(e)(r),l=Wy(e)(r);if(this.dispatch(c(e)),m.length>0){const p=m.map(({uuid:A})=>A);this.dispatch(Kt(p))}if(l.length>0){const p=l.map(({uuid:A})=>A);this.dispatch(_t(p))}return this.enqueueRequest({description:`Delete ${this.name}`,method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]}).catch(p=>{throw this.dispatch(n(o)),this.dispatch(Wt(m)),this.dispatch(bt(l)),p})}bulkAdd(e,a){const{addMany:n}=this.actions,c=new Date().toISOString(),d=xe.v4(),r=Je(e,a).map(l=>{const p=l.map(A=>F(A));return{batchId:xe.v4(),payload:{transaction_id:d,submitted_at:c,assets:p}}}),o=[];let m=null;for(const l of r){const{batchId:p,payload:A}=l,T=A.assets.map(({uuid:V})=>V),I=A.assets.map(({asset_type:V})=>V),_=A.assets.map(({project:V})=>V),M=I.concat(_);m&&M.push(m);const g=T;g.push(p);const v=this.enqueueRequest({description:`Bulk create ${this.name}s`,method:y.POST,url:`${this.url}/bulk/`,payload:A,blockers:M,blocks:g});m=l.batchId,o.push(v)}return Promise.all(o).then(l=>{const p=l.flat();this.dispatch(n(p))}),o}async bulkDelete(e){const{store:a}=this.client,{addMany:n,deleteMany:c}=this.actions,{selectByIds:d}=this.selectors,r=a.getState(),o=d(e)(r);this.dispatch(c(e));try{await this.enqueueRequest({description:`Bulk delete ${this.name}s`,method:y.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(m){throw this.dispatch(n(o)),m}}async refreshStore(e,a){const{initialize:n}=this.actions,d=(await this.listPaginated({queryParams:{project:e}},a)).flat();return this.dispatch(n(d)),d}}class pg extends w{constructor(){super(...arguments);h(this,"name","Asset Stage Completion");h(this,"url","/asset-stage-completions");h(this,"actions",{addOne:Dr,addMany:Ur,setOne:Cr,setMany:Lr,updateOne:Gr,updateMany:kr,deleteOne:Nr,deleteMany:Hr,initialize:$r});h(this,"selectors",{selectById:Zr,selectByIds:Jr})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Add asset stage completion",method:y.POST,url:`${this.url}/`,payload:R(d),blockers:[e.asset,e.asset_stage],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(()=>{this.dispatch(this.actions.deleteOne(d.uuid))}),[d,r]}delete(e){const{store:a}=this.client,n=this.selectors.selectById(e)(a.getState());if(!n)throw new Error(`Expected asset stage completion with uuid ${e} to exist`);this.dispatch(this.actions.deleteOne(e));const c=this.enqueueRequest({description:"Delete asset stage completion",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return c.catch(()=>{this.dispatch(this.actions.addOne(n))}),c}bulkAdd(e){var l;const{store:a}=this.client,n=new Date().toISOString(),c=((l=a.getState().userReducer.currentUser)==null?void 0:l.id)??null,d=e.map(p=>F(p)),r=d.map(p=>({...p,created_by:c,submitted_at:n})),o=r.map(({uuid:p})=>p);this.dispatch(this.actions.addMany(r));const m=this.enqueueRequest({description:"Bulk create asset stage completions",method:y.POST,url:`${this.url}/bulk/`,payload:{submitted_at:n,completions:d},blockers:[...e.map(p=>p.asset_procedure),...e.map(p=>p.asset_stage),...e.map(p=>p.asset)],blocks:o});return m.then(p=>{this.dispatch(this.actions.setMany(p))}).catch(()=>{this.dispatch(this.actions.deleteMany(o))}),[r,m]}bulkDelete(e){const{store:a}=this.client,n=this.selectors.selectByIds(e)(a.getState());this.dispatch(this.actions.deleteMany(e));const c=this.enqueueRequest({description:"Deleting asset stage completions",method:y.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]});return c.catch(()=>{this.dispatch(this.actions.addMany(n))}),c}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{asset_procedure__project:e}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class Ag extends w{constructor(){super(...arguments);h(this,"name","Asset Stage");h(this,"url","/asset-stages");h(this,"actions",{addOne:tu,addMany:su,setOne:xr,setMany:eu,updateOne:iu,updateMany:au,deleteOne:nu,deleteMany:cu,initialize:Qr});h(this,"selectors",{selectById:ru,selectByIds:uu})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Create asset",method:y.POST,url:`${this.url}/`,payload:R(d),blockers:[d.asset_procedure_type],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(()=>{this.dispatch(this.actions.deleteOne(d.uuid))}),[d,r]}update(e){const{store:a}=this.client,n=this.selectors.selectById(e.uuid)(a.getState());if(!n)throw new Error(`No asset stage with uuid ${e.uuid} found in the store`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Update asset stage",method:y.PATCH,url:`${this.url}/${n.uuid}/`,payload:e,blockers:[n.uuid],blocks:[n.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.setOne(n))}),[c,d]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`No asset stage with uuid ${e} found in the store`);return this.dispatch(this.actions.deleteOne(e)),this.enqueueRequest({description:"Delete asset stage",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]}).catch(d=>{throw this.dispatch(this.actions.addOne(c)),d})}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{asset_procedure_type__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class fg extends z{constructor(){super(...arguments);h(this,"name","Asset Type Attachment");h(this,"url","/asset-type-attachments");h(this,"actions",{addOne:hu,addMany:Es,setOne:mu,setMany:yu,updateOne:pu,updateMany:Au,deleteOne:fu,deleteMany:Vs,initialize:ou});h(this,"selectors",{selectById:Tu,selectByIds:Iu})}getId(e){return e.uuid}buildModel(e){return F({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,asset_type:e.modelUuid})}buildPayload(e,a){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:a.extension,asset_type:e.asset_type}}async bulkAdd(e){return this._bulkAdd(e.map(a=>({modelUuid:a.assetTypeUuid,file:a.file})))}async delete(e){return this._delete(e)}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{asset_type__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class Sg extends z{constructor(){super(...arguments);h(this,"name","Asset Type Fields Attachment");h(this,"url","/asset-type-fields-attachments");h(this,"actions",{addOne:bu,addMany:_u,setOne:Mu,setMany:Ru,updateOne:wu,updateMany:vu,deleteOne:Eu,deleteMany:Vu,initialize:gu});h(this,"selectors",{selectById:Bu,selectByIds:ju})}async bulkAdd(e){var m;const a=new Date().toISOString(),n=((m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id)??null,c={},d=[],r=[];for(const l of e){const{fieldsRevisionUuid:p,fieldIdentifier:A,file:T}=l,I=await this.client.files.getFilePayload(T);I.sha1 in c||(c[I.sha1]=I);const _=F({file:URL.createObjectURL(T),file_type:T.type,file_name:T.name,file_sha1:I.sha1,created_by:n,fields_revision:p,submitted_at:a,field_identifier:A});d.push(_);const M={uuid:_.uuid,file_name:T.name,field_identifier:A,file_extension:I.extension,file_sha1:I.sha1,fields_revision:p};r.push(M)}this.dispatch(this.actions.addMany(d));const o=this.enqueueRequest({description:"Add asset type fields attachments",method:y.POST,url:`${this.url}/bulk/`,payload:{submitted_at:a,attachments:r,files:Object.values(c)},blockers:d.map(l=>l.fields_revision),blocks:d.map(l=>l.uuid)});return o.then(l=>{this.client.files.processPresignedUrls(l.presigned_urls),this.dispatch(this.actions.setMany(l.attachments))}).catch(()=>{this.dispatch(this.actions.deleteMany(d.map(l=>l.uuid)))}),[d,o.then(({attachments:l})=>l)]}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{fields_revision__asset_type__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class Tg extends w{constructor(){super(...arguments);h(this,"name","Asset Type Fields");h(this,"url","/asset-type-fields");h(this,"actions",{addOne:Uu,addMany:Cu,setOne:Lu,setMany:Gu,updateOne:ku,updateMany:Nu,deleteOne:Hu,deleteMany:Wu,initialize:Du});h(this,"selectors",{selectById:Yu,selectByIds:Zu})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Add Asset Type Fields",method:y.POST,url:`${this.url}/`,payload:R(d),blockers:[d.asset_type],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(m=>{throw this.dispatch(this.actions.deleteOne(d.uuid)),m}),[d,r]}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{asset_type__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class Ig extends z{constructor(){super(...arguments);h(this,"name","Asset Type Field Values Attachment");h(this,"url","/asset-type-field-values-attachments");h(this,"actions",{addOne:xu,addMany:Ds,setOne:el,setMany:tl,updateOne:sl,updateMany:il,deleteOne:al,deleteMany:Us,initialize:Qu});h(this,"selectors",{selectById:cl,selectByIds:dl})}async bulkAdd(e,a){var l;const n=new Date().toISOString(),c=((l=this.client.store.getState().userReducer.currentUser)==null?void 0:l.id)??null,d=Je(e,a??e.length),r=[],o=[];for(const p of d){const A={},T=[];for(const I of p){const{fieldValuesUuid:_,fieldIdentifier:M,file:g}=I,v=await this.client.files.getFilePayload(g);v.sha1 in A||(A[v.sha1]=v);const V=F({file:URL.createObjectURL(g),file_type:g.type,file_name:g.name,file_sha1:v.sha1,created_by:c,field_values:_,submitted_at:n,field_identifier:M});r.push(V);const Ke={uuid:V.uuid,file_name:g.name,file_sha1:v.sha1,file_extension:v.extension,field_identifier:M,field_values:_};T.push(Ke)}o.push({submitted_at:n,attachments:T,files:Object.values(A)})}this.dispatch(this.actions.addMany(r));const m=o.map(p=>this.enqueueRequest({description:"Add asset type field values attachments",method:y.POST,url:`${this.url}/bulk/`,payload:p,blockers:p.attachments.map(A=>A.field_values),blocks:p.attachments.map(A=>A.uuid)}));return Promise.all(m).then(p=>{for(const T of p)this.client.files.processPresignedUrls(T.presigned_urls);const A=p.flatMap(T=>T.attachments);this.dispatch(this.actions.setMany(A))}).catch(p=>{throw this.dispatch(this.actions.deleteMany(r.map(A=>A.uuid))),p}),[r,m.map(p=>p.then(({attachments:A})=>A))]}async bulkDelete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectByIds(e)(n);this.dispatch(this.actions.deleteMany(e));try{await this.enqueueRequest({description:"Delete asset type field values attachments",method:y.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(this.actions.addMany(c)),d}}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{field_values__asset__project:e,latest:!0}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class Og extends w{constructor(){super(...arguments);h(this,"name","Asset Type Field Values");h(this,"url","/asset-type-field-values");h(this,"actions",{addOne:hl,addMany:ml,setOne:yl,setMany:pl,updateOne:Al,updateMany:fl,deleteOne:Sl,deleteMany:Tl,initialize:ol});h(this,"selectors",{selectById:Ol,selectByIds:Fl})}add(e){var m;const{store:a}=this.client,c=((m=a.getState().userReducer.currentUser)==null?void 0:m.id)??null,d=new Date().toISOString(),r=F({...e,created_by:c,submitted_at:d}),o=this.enqueueRequest({description:"Add asset type field values",method:y.POST,url:`${this.url}/`,payload:R(r),blockers:[e.asset,e.fields_revision],blocks:[r.uuid]});return this.dispatch(this.actions.addOne(r)),o.then(l=>(this.dispatch(this.actions.setOne(l)),l)).catch(()=>{this.dispatch(this.actions.deleteOne(r.uuid))}),[r,o]}bulkAdd(e,a){var m;const n=new Date().toISOString(),c=[],d=Je(e.payloads,a??e.payloads.length),r=[];for(const l of d){const p=[];for(const A of l){const T=F({...A,values:A.values,created_by:((m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id)??null,submitted_at:n});c.push(T),p.push({uuid:T.uuid,asset:A.asset,fields_revision:A.fields_revision,published_at:A.published_at,values:T.values})}r.push({submitted_at:n,values:e.values,field_values:p})}this.dispatch(this.actions.addMany(c));const o=[];for(const l of r){const p=l.field_values.map(_=>_.asset),A=l.field_values.map(_=>_.fields_revision),T=l.field_values.map(_=>_.uuid),I=this.enqueueRequest({description:"Bulk add asset type field values",method:y.POST,url:`${this.url}/bulk/`,payload:l,blockers:[...p,...A],blocks:T});o.push(I)}return Promise.all(o).then(l=>{this.dispatch(this.actions.setMany(l.flat()))}).catch(()=>{this.dispatch(this.actions.deleteMany(c.map(l=>l.uuid)))}),[c,o]}update(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e.uuid)(n);if(!c)throw new Error(`Expected AssetTypeFieldValues with uuid ${e.uuid} to exist`);const d={...c,...e};this.dispatch(this.actions.setOne(d));const r=this.enqueueRequest({description:"Delete asset type field values",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[d.uuid,d.fields_revision,d.asset],blocks:[d.uuid]});return r.then(o=>{this.dispatch(this.actions.setOne(o))}).catch(()=>{this.dispatch(this.actions.setOne(c))}),[d,r]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const d=rl(e)(n);this.dispatch(this.actions.deleteOne(e)),this.dispatch(Us(d.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete asset type field values",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(this.actions.addOne(c)),this.dispatch(Ds(d)),r}}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{asset__project:e,latest:!0}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class Fg extends w{constructor(){super(...arguments);h(this,"name","Asset Type Identifier");h(this,"url","/asset-type-identifiers");h(this,"actions",{addOne:_l,addMany:Ml,setOne:Rl,setMany:wl,updateOne:vl,updateMany:El,deleteOne:Vl,deleteMany:zl,initialize:bl});h(this,"selectors",{selectById:jl,selectByIds:ql})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Create asset type identifier",method:y.POST,url:`${this.url}/`,payload:R(d),blockers:[d.asset_type],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(()=>{this.dispatch(this.actions.deleteOne(d.uuid))}),[d,r]}update(e){const{store:a}=this.client,n=this.selectors.selectById(e.uuid)(a.getState());if(!n)throw new Error(`Expected asset type identifier with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Update asset type identifier",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.setOne(n))}),[c,d]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected asset type identifier with uuid ${e} to exist`);this.dispatch(this.actions.deleteOne(e));try{return await this.enqueueRequest({description:"Delete asset type identifier",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(this.actions.addOne(c)),d}}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{asset_type__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class Pg extends w{constructor(){super(...arguments);h(this,"name","Asset Type Identifier Value");h(this,"url","/asset-type-identifier-values");h(this,"actions",{addOne:Cl,addMany:Ll,setOne:Gl,setMany:kl,updateOne:Nl,updateMany:Hl,deleteOne:Wl,deleteMany:Kl,initialize:Ul});h(this,"selectors",{selectById:Zl,selectByIds:Jl})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Create asset type identifier value",method:y.POST,url:`${this.url}/`,payload:R(d),blockers:[e.asset,e.asset_type_identifier],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(()=>{this.dispatch(this.actions.deleteOne(d.uuid))}),[d,r]}update(e){const{store:a}=this.client,n=this.selectors.selectById(e.uuid)(a.getState());if(!n)throw new Error(`Expected asset type identifier value with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Update asset type identifier value",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.setOne(n))}),[c,d]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected asset type identifier value with uuid ${e} to exist`);this.dispatch(this.actions.deleteOne(e));try{return await this.enqueueRequest({description:"Delete asset type identifier value",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(this.actions.addOne(c)),d}}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{asset__project:e}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class gg extends w{constructor(){super(...arguments);h(this,"name","Asset Type");h(this,"url","/asset-types");h(this,"actions",{addOne:so,addMany:io,setOne:eo,setMany:to,updateOne:ao,updateMany:no,deleteOne:co,deleteMany:ro,initialize:xl});h(this,"selectors",{selectById:lo,selectByIds:oo})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Create asset type",method:y.POST,url:`${this.url}/`,payload:R(d),blockers:[],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(()=>{this.dispatch(this.actions.deleteOne(d.uuid))}),[d,r]}update(e){const{store:a}=this.client,n=this.selectors.selectById(e.uuid)(a.getState());if(!n)throw new Error(`Expected asset type with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Update asset type",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[n.uuid],blocks:[n.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.setOne(n))}),[c,d]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected asset type with uuid ${e} to exist`);const d=bs(e)(n),r=Ou(e)(n);return this.dispatch(this.actions.deleteOne(e)),this.dispatch(Ps(d.map(o=>o.uuid))),this.dispatch(Vs(r.map(({uuid:o})=>o))),this.enqueueRequest({description:"Delete asset type",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]}).catch(o=>{throw this.dispatch(this.actions.addOne(c)),this.dispatch(Fs(d)),this.dispatch(Es(r)),o})}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class bg extends w{constructor(){super(...arguments);h(this,"name","Asset Type Status");h(this,"url","/asset-type-statuses");h(this,"actions",{addOne:po,addMany:Ao,setOne:fo,setMany:So,updateOne:To,updateMany:Io,deleteOne:Oo,deleteMany:Fo,initialize:yo});h(this,"selectors",{selectById:go,selectByIds:bo})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Create Asset Type Status",method:y.POST,url:`${this.url}/`,payload:R(d),blockers:[e.asset_type],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(()=>{this.dispatch(this.actions.deleteOne(d.uuid))}),[d,r]}update(e){const a=this.client.store.getState(),n=this.selectors.selectById(e.uuid)(a);if(!n)throw new Error(`Expected an existing asset type status with uuid ${e.uuid}`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Edit Asset Type Status",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.setOne(n))}),[c,d]}delete(e){const{store:a}=this.client,n=this.selectors.selectById(e)(a.getState());if(!n)throw new Error(`No asset type status with uuid ${e} found in the store`);this.dispatch(this.actions.deleteOne(e));const c=this.enqueueRequest({description:"Delete Asset Type Status",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return c.catch(()=>{this.dispatch(this.actions.addOne(n))}),c}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{asset_type__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class _g extends w{constructor(){super(...arguments);h(this,"name","Category");h(this,"url","/categories");h(this,"actions",{addOne:Vo,addMany:zo,setOne:Bo,setMany:jo,updateOne:qo,updateMany:$o,deleteOne:Do,deleteMany:Uo,initialize:Eo});h(this,"selectors",{selectById:Xs,selectByIds:Lo})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Create Category",method:y.POST,url:`${this.url}/`,payload:R(d),blockers:[e.project],blocks:[d.uuid]});return[d,r]}update(e){const a=this.client.store.getState(),n=this.selectors.selectById(e.uuid)(a);if(!n)throw new Error(`Expected an existing category with uuid ${e.uuid}`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Edit Category",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return[c,d]}remove(e){const{store:a}=this.client,n=this.selectors.selectById(e)(a.getState());if(!n)throw new Error(`No category with uuid ${e} found in the store`);this.dispatch(this.actions.deleteOne(e));const c=this.enqueueRequest({description:"Delete Category",method:y.DELETE,url:`${this.url}/${n.uuid}/`,blockers:[n.uuid],blocks:[]});return c.catch(()=>{this.dispatch(this.actions.addOne(n))}),c}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{project__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class Mg extends z{constructor(){super(...arguments);h(this,"name","Document Attachment");h(this,"url","/document-attachments");h(this,"actions",{addOne:Ho,addMany:Wo,setOne:Ko,setMany:Yo,updateOne:Zo,updateMany:Jo,deleteOne:Xo,deleteMany:Qo,initialize:No});h(this,"selectors",{selectById:eh,selectByIds:th})}getId(e){return e.uuid}buildModel(e){return F({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,document:e.modelUuid})}buildPayload(e,a){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:a.extension,document:e.document}}async bulkAdd(e){var I;const{store:a}=this.client,{addMany:n,updateMany:c,deleteMany:d}=this.actions,r=((I=a.getState().userReducer.currentUser)==null?void 0:I.id)??null,o=new Date().toISOString(),m=[],l=[],p={},A={};for(const _ of e){const{documentUuid:M,file:g}=_,v=await this.client.files.getFilePayload(g);v.sha1 in p||(p[v.sha1]=v,A[v.sha1]=[]);const V=this.buildModel({file:g,file_sha1:v.sha1,submitted_at:o,created_by:r,modelUuid:M});m.push(V),l.push(this.buildPayload(V,v)),A[v.sha1].push(V.uuid)}this.dispatch(n(m));const T=this.enqueueRequest({description:"Attach files to document",method:y.POST,url:`${this.url}/bulk/`,payload:{submitted_at:o,attachments:l,files:Object.values(p)},blocks:m.map(_=>_.uuid),blockers:m.map(_=>_.file_sha1)});return T.then(({attachments:_,presigned_urls:M})=>{this.dispatch(c(_));const g=this.client.files.processPresignedUrls(M);for(const[v,V]of Object.entries(g))V.then(()=>{const Ke=A[v];for(const D of Ke)this.makeReadable(D)})}).catch(()=>{this.dispatch(d(m.map(_=>_.uuid)))}),[m,T.then(({attachments:_})=>_)]}async delete(e){return this._delete(e)}makeReadable(e){this.enqueueRequest({description:"Add attachment to AI assistant",method:y.PATCH,url:`${this.url}/${e}/`,payload:{readable_to_assistant:!0},blockers:["index-document-attachment",e],blocks:["index-document-attachment"]})}async refreshStore(e,a){const n=this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{document__project__organization:e}},a),c=this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{document__organization:e}},a),r=(await Promise.all([n,c])).flat();return this.dispatch(this.actions.initialize(r)),r}}class Rg extends w{constructor(){super(...arguments);h(this,"name","Document");h(this,"url","/documents");h(this,"actions",{addOne:nh,addMany:ch,setOne:dh,setMany:rh,updateOne:uh,updateMany:lh,deleteOne:oh,deleteMany:hh,initialize:ah});h(this,"selectors",{selectById:yh,selectByIds:ph})}add(e){var p;const{store:a}=this.client,{addOne:n,deleteOne:c,updateOne:d}=this.actions,r=((p=a.getState().userReducer.currentUser)==null?void 0:p.id)??null,o=new Date().toISOString(),m=F({...e,created_by:r,submitted_at:o});this.dispatch(n(m));const l=this.enqueueRequest({description:"Create Document",method:y.POST,url:`${this.url}/`,payload:R(m),blockers:m.parent_document?[m.parent_document]:[],blocks:[m.uuid]});return l.then(A=>{this.dispatch(d(A))}).catch(()=>{this.dispatch(c(m.uuid))}),[m,l]}update(e){const{store:a}=this.client,{updateOne:n}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(a.getState());if(!d)throw new Error(`attempting to update a document with uuid ${e.uuid} that does not exist in store.documents`);const r={...d,...e};this.dispatch(n(r));const o=this.enqueueRequest({description:"Update Document",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return o.then(m=>{this.dispatch(n(m))}).catch(()=>{this.dispatch(n(d))}),[r,o]}delete(e){const{store:a}=this.client,{deleteOne:n,addOne:c}=this.actions,{selectById:d}=this.selectors,r=d(e)(a.getState());if(!r)throw new Error(`attempting to delete a document with uuid ${e} that does not exist in store.documents`);this.dispatch(n(e));const o=this.enqueueRequest({description:"Delete Document",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return o.catch(()=>{this.dispatch(c(r))}),o}async refreshStore(e,a){const n=this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{project__organization:e}},a),c=this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{organization:e}},a),r=(await Promise.all([n,c])).flat();return this.dispatch(this.actions.initialize(r)),r}}class st extends Ze{async get(s,e){return this.performRequest({url:`/${this.url}${s}`,method:y.GET},e)}async list(s,e){return this.performRequest({url:`/${this.url}`,method:y.GET,...s},e)}async listPaginated(s,e){return this.performPagination({url:`/${this.url}`,method:y.GET,...s},e)}}class wg extends st{constructor(){super(...arguments);h(this,"name","Email Domains");h(this,"url","/organization-email-domains");h(this,"actions",{addOne:Th,addMany:Ih,setOne:Oh,setMany:Fh,updateOne:Ph,updateMany:gh,deleteOne:bh,deleteMany:_h,initialize:Sh});h(this,"selectors",{selectById:Rh,selectByIds:wh})}async add(e,a){return this.enqueueRequest({description:"Add email domain to organization",method:y.POST,url:`${this.url}/`,payload:{email:a,organization:e},blockers:[e,"create-org"],blocks:[]})}async remove(e){return this.dispatch(this.actions.deleteOne(e.uuid)),this.enqueueRequest({description:"Remove email domain from organization",method:y.DELETE,url:`${this.url}/${e.uuid}/`,blockers:[e.domain],blocks:[]}).catch(a=>{throw this.dispatch(this.actions.addOne(e)),a})}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class vg extends Ze{async getVerificationCode(s){return this.enqueueRequest({description:"Get verification code",method:y.GET,url:`/verification/email-verification/${s}/`,isAuthNeeded:!1,blockers:[],blocks:[]})}validateVerificationCode(s,e=void 0){return this.enqueueRequest({description:"Validate verification code",method:y.POST,url:`/verification/email-verification/${s}/`,isAuthNeeded:!1,payload:e,blockers:[],blocks:[]})}}const jt={},va=new Set;let qt=0,Ea=0,Va=0;const Eg=20;class Vg extends Ze{constructor(){super(...arguments);h(this,"host");h(this,"_dbPromise",_O.openDB("fileCache",1,{upgrade(e){e.createObjectStore("files")}}))}async renewUploadUrl(e){const a=await this.fetchCache(e);if(!a)throw new Error(`File with sha1 ${e} not found in cache`);const n=await Gt(a,e),c=await this.enqueueRequest({description:"Get S3 URL",method:y.GET,url:"/authentication/files/presigned-upload-url/",queryParams:{sha1:await et(a),file_type:a.type,extension:a.name.split(".").pop(),size:a.size.toString()},blockers:[],blocks:[`s3-${n}`]});return"url"in c&&this.dispatch(zh({sha1:e,...c})),c}async addCache(e,a){if(va.has(a))return;if(!e.type){const d=e.name.split("."),r=d[d.length-1];e=new File([e],e.name,{type:r})}if(!e.name||!e.size||!e.type)throw new Error("Cannot add files to cache that do not have a name, size and type.");const n=await this._dbPromise;!!await n.get("files",a)?(console.error("File already cached (this is unexpected at this point):",e.name,a),qt++):(await n.put("files",e,a),Ea++),va.add(a),Va++,Va%Eg===0&&console.debug(`File cache summary: ${qt} hits and ${Ea} misses, ${qt/(qt+Ea)*100}% hit rate over ${Va} calls to addCache.`)}async removeCache(e){await(await this._dbPromise).delete("files",e),va.delete(e)}async fetchCache(e){return(await this._dbPromise).get("files",e)}async getOrRenewUploadUrl(e){const a=this.client.store.getState();return Bh(e)(a)??await this.renewUploadUrl(e)}async uploadFileToS3(e){const a=await this.fetchCache(e);if(!a)throw new Error(`File with sha1 ${e} not found in cache`);const n=await Gt(a,e),c={file_name:a.name,file_sha1:e,file:n},d=await this.getOrRenewUploadUrl(e);if("warning"in d){if(d.warning==="already_uploaded")return[c,Promise.resolve(void 0)];throw new Error(d.warning)}const r=d.url,o=this.enqueueRequest({url:r,description:"Upload file",method:y.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:e,blockers:[`s3-${n}`],blocks:[e],s3url:d});return[c,o]}async fetchFileFromUrl(e,a,n){const c=e.split("?")[0]??e,d=await this.fetchCache(a);if(d){if(!d.name)throw new Error("Cached file unexpectedly has no name.");return d}if(e.startsWith("blob:")){const l=await Ka(e),p=new File([l],n??a,{type:l.type});return await this.addCache(p,a),p}let r=jt[c],o=!0;r?o=!1:(r=new Promise(l=>{this.enqueueRequest({description:"Download file",method:y.GET,url:e,isExternalUrl:!0,isResponseBlob:!0,isAuthNeeded:!1,blockers:[a],blocks:[a]}).then(p=>{const A=new File([p],n??a,{type:p.type});l(A)})}),jt[c]=r);let m;try{m=await r}catch(l){throw o&&l instanceof q&&delete jt[c],l}if(o){const l=await et(m);if(l!==a){const T=`The hash of the file returned from the server (${l}) 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(y)}const p=d.type.split("/")[1];if(!p)throw new Error("File has no extension");const A=c??o+"."+p;if(d=pc(d,A),!d.name)throw new Error("Failed to set file's name");await this.addCache(d,o),Ut[n]=new Promise(y=>{y(d)})}return d}}class Lg extends w{async bulkAdd(e){var m;const s=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,c={},n=[],r=[];for(const d of e){const{revisionUuid:o,fieldIdentifier:p,file:A}=d,y=await this.getFilePayload(A);y.sha1 in c||(c[y.sha1]=y);const b=I({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:y.sha1,created_by:a,form_revision:o,submitted_at:s,field_identifier:p});n.push(b);const P={uuid:b.uuid,file_name:A.name,field_identifier:p,file_extension:y.extension,file_sha1:y.sha1,form_revision:o};r.push(P)}this.dispatch(eu(n));const u=this.enqueueRequest({description:"Attach files to form revision",method:h.POST,url:"/form-revision-attachments/bulk/",payload:{submitted_at:s,attachments:r,files:Object.values(c)},blockers:n.map(d=>d.form_revision),blocks:n.map(d=>d.uuid)});return u.then(d=>{this.processPresignedUrls(d.presigned_urls),this.dispatch(tu(d.attachments))}).catch(()=>{this.dispatch(su(n.map(d=>d.uuid)))}),[n,u.then(({attachments:d})=>d)]}async refreshStore(e){const s=await this.enqueueRequest({description:"Fetch organization form revision attachments",method:h.GET,url:"/form-revision-attachments/",queryParams:{organization:e},blockers:[e],blocks:[]});this.dispatch(xd(s))}}class Ng extends w{add(e){var u;const{store:s}=this.client,c=(u=s.getState().userReducer.currentUser)==null?void 0:u.id,n=I({...e,created_by:c,submitted_at:new Date().toISOString()});this.dispatch(ji(n));const r=this.enqueueRequest({description:"Create form revision",method:h.POST,url:"/form-revisions/",payload:_(n),blockers:[e.form],blocks:[n.uuid]});return r.then(m=>{this.dispatch(nu(m))}).catch(()=>{this.dispatch(Mi(n.uuid))}),[n,r]}async refreshStore(e){const s=await this.enqueueRequest({description:"Get organization form revisions",method:h.GET,url:"/form-revisions/",queryParams:{organization:e},blockers:[e],blocks:[]});this.dispatch(ru(s))}}class Hg extends w{add(e,s){var d;const{store:a}=this.client,c=new Date().toISOString(),n=(d=a.getState().userReducer.currentUser)==null?void 0:d.id,r=I({...e,submitted_at:c,created_by:n}),u=I({...s,form:r.uuid,submitted_at:c,created_by:n});this.dispatch(ki(r)),this.dispatch(ji(u));const m=this.enqueueRequest({description:"Create form",method:h.POST,url:"/forms/",payload:{..._(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(o=>{throw this.dispatch(zi(r.uuid)),this.dispatch(Mi(u.uuid)),o}),[r,u,m]}async delete(e){const{store:s}=this.client,a=s.getState(),c=fu(e)(a);if(!c)throw new Error("Expected form to exist");const n=_u(e)(a);n.length>0&&this.dispatch(vt(n.map(({uuid:u})=>u)));const r=lu(e)(a);r.length>0&&this.dispatch(uu(r.map(({uuid:u})=>u))),this.dispatch(zi(e));try{return await this.enqueueRequest({description:"Delete form",method:h.DELETE,url:`/forms/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(ki(c)),r.length>0&&this.dispatch(du(r)),n.length>0&&this.dispatch(_t(n)),u}}async refreshStore(e){const s=await this.enqueueRequest({description:"Fetch organization forms",method:h.GET,url:"/forms/",queryParams:{organization:e},blockers:[e],blocks:[]});this.dispatch(pu(s))}}class Wg extends w{async bulkAdd(e){var m;const s=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,c={},n=[],r=[];for(const d of e){const{submissionUuid:o,fieldIdentifier:p,file:A}=d,y=await this.getFilePayload(A);y.sha1 in c||(c[y.sha1]=y);const b=I({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:y.sha1,created_by:a,form_submission:o,submitted_at:s,field_identifier:p});n.push(b);const P={uuid:b.uuid,file_name:A.name,file_sha1:y.sha1,file_extension:y.extension,field_identifier:p,form_submission:o};r.push(P)}this.dispatch(It(n));const u=this.enqueueRequest({description:"Attach files to form submission",method:h.POST,url:"/form-submission-attachments/bulk/",payload:{submitted_at:s,attachments:r,files:Object.values(c)},blockers:n.map(d=>d.form_submission),blocks:n.map(d=>d.uuid)});return u.then(d=>{this.processPresignedUrls(d.presigned_urls),this.dispatch(bu(d.attachments))}).catch(d=>{throw this.dispatch(Rt(n.map(o=>o.uuid))),d}),[n,u.then(({attachments:d})=>d)]}async bulkDelete(e){const{store:s}=this.client,a=s.getState(),c=Pu(e)(a);this.dispatch(Rt(e));try{await this.enqueueRequest({description:"Delete form submission attachments",method:h.DELETE,url:"/form-submission-attachments/bulk/",payload:{attachment_ids:e},blockers:e,blocks:[]})}catch(n){throw this.dispatch(It(c)),n}}async refreshStore(e){const s=await this.enqueueRequest({description:"Get form submission attachments",method:h.GET,url:"/form-submission-attachments/",queryParams:{project:e},blockers:[],blocks:[]});this.dispatch(gu(s))}}class Kg extends w{add(e){var r;const{store:s}=this.client,a=s.getState(),c=I({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),n=this.enqueueRequest({description:"Add form submission",method:h.POST,url:"/form-submissions/",payload:_(c),blockers:["add-form-entry",e.form_revision,...e.issue?[e.issue]:[],...e.asset?[e.asset]:[]],blocks:[c.uuid]});return this.dispatch($i(c)),n.then(u=>(this.dispatch(Ot(u)),u)).catch(()=>{this.dispatch(Bi(c.uuid))}),[c,n]}update(e){const{store:s}=this.client,a=s.getState(),c=Ni(e.uuid)(a);if(!c)throw new Error(`Expected submission with uuid ${e.uuid} to exist`);const n={...c,...e};this.dispatch(Ou(n));const r=this.enqueueRequest({description:"Delete user form submissions",method:h.PATCH,url:`/form-submissions/${n.uuid}/`,payload:e,blockers:[n.uuid],blocks:[n.uuid]});return r.then(u=>{this.dispatch(Ot(u))}).catch(()=>{this.dispatch(Ot(c))}),[n,r]}async delete(e){const{store:s}=this.client,a=s.getState(),c=Ni(e)(a);if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const n=Fu(e)(a);this.dispatch(Bi(e)),this.dispatch(Rt(n.map(r=>r.uuid)));try{return await this.enqueueRequest({description:"Delete user form submissions",method:h.DELETE,url:`/form-submissions/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch($i(c)),this.dispatch(It(n)),r}}async refreshStore(e){const s=await this.enqueueRequest({description:"Fetch form submissions",method:h.GET,url:"/form-submissions/",queryParams:{project:e},blockers:[],blocks:[]});this.dispatch(Ru(s))}}class Yg extends w{async add(e){var p;const{store:s}=this.client,{file:a,...c}=e,n=new Date().toISOString(),r=(p=s.getState().userReducer.currentUser)==null?void 0:p.id,u=c.project,m=await this.getFilePayload(a),d=I({...c,file_name:a.name,file_sha1:m.sha1,file:URL.createObjectURL(a),submitted_at:n,created_by:r});this.dispatch(Vu(d));const o=this.enqueueRequest({description:"Add geo image",method:h.POST,url:"/geo-images/",payload:{uuid:d.uuid,submitted_at:n,title:d.title,description:d.description,geo_marker:d.geo_marker,canvas_marker:d.canvas_marker,sha1:d.file_sha1,project:d.project,file_name:d.file_name,direction:d.direction,original_date:d.original_date,file:m},blocks:[u],blockers:[u]});return o.then(A=>{this.processPresignedUrls(A.presigned_urls),this.dispatch(tt(A.geo_image))}).catch(()=>{this.dispatch(Wi(d.uuid))}),[d,o.then(A=>A.geo_image)]}async bulkAdd(e,s){var p;const{store:a}=this.client,c=new Date().toISOString(),n=(p=a.getState().userReducer.currentUser)==null?void 0:p.id,r=[],u=[],m=[],d={};for(const A of e){const{file:y,...b}=A,P=await this.getFilePayload(y);P.sha1 in d||(d[P.sha1]=P);const T=I({...b,file_name:y.name,file_sha1:P.sha1,file:URL.createObjectURL(y),submitted_at:c,created_by:n,project:s});r.push(T),u.push(T.uuid),m.push({uuid:T.uuid,sha1:T.file_sha1,file_name:T.file_name,title:T.title,description:T.description,geo_marker:T.geo_marker,canvas_marker:T.canvas_marker,direction:T.direction,original_date:T.original_date})}this.dispatch(ku(r));const o=this.enqueueRequest({description:"Bulk add geo images",method:h.POST,url:"/geo-images/bulk/",payload:{submitted_at:c,project:s,geo_images:m,files:Object.values(d)},blocks:[s],blockers:u});return o.then(A=>{this.processPresignedUrls(A.presigned_urls),this.dispatch(Mu(A.geo_images))}).catch(()=>{this.dispatch(Cu(u))}),[r,o.then(A=>A.geo_images)]}update(e){const{store:s}=this.client,a=s.getState(),c=Ki(e.uuid)(a);if(!c)throw new Error(`Map image with uuid ${e.uuid} does not exist in the store`);const n={...c,...e};this.dispatch(zu(n));const r=this.enqueueRequest({description:"Update geo image",method:h.PATCH,url:`/geo-images/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return r.then(u=>{this.dispatch(tt(u))}).catch(()=>{this.dispatch(tt(c))}),[n,r]}async delete(e){const{store:s}=this.client,a=s.getState(),c=Ki(e)(a);if(!c)throw new Error(`Map image with uuid ${e} does not exist in the store`);this.dispatch(Wi(e));const n=this.enqueueRequest({description:"Delete geo image",method:h.DELETE,url:`/geo-images/${e}/`,blocks:[e],blockers:[e]});return n.catch(()=>{this.dispatch(tt(c))}),n}async refreshStore(e){const s=await this.enqueueRequest({description:"Get geo images",method:h.GET,url:"/geo-images/",queryParams:{project:e},blocks:[e],blockers:[]});this.dispatch(ju(s))}}class Jg extends R{add(e){var u;const{store:s}=this.client,a=new Date().toISOString(),c=(u=s.getState().userReducer.currentUser)==null?void 0:u.id,n=I({...e,submitted_at:a,created_by:c});this.dispatch(Ji(n));const r=this.enqueueRequest({description:"Add issue association",method:h.POST,url:"/issue-associations/",payload:_(n),blockers:[e.associated_issue,...e.issue?[e.issue]:[],...e.asset?[e.asset]:[]],blocks:[n.uuid]});return r.then(m=>{this.dispatch(Lu(m))}).catch(()=>{this.dispatch(Qi(n.uuid))}),[n,r]}async delete(e){const{store:s}=this.client,a=Nu(e)(s.getState());if(!a)throw new Error(`Issue association with uuid ${e} not found in store.`);this.dispatch(Qi(e));const c=this.enqueueRequest({description:"Delete issue association",method:h.DELETE,url:`/issue-associations/${e}/`,blockers:[e],blocks:[]});return c.catch(()=>{this.dispatch(Ji(a))}),c}async refreshStore(e){const s=await this.enqueueRequest({description:"Fetch issue associations",method:h.GET,url:"/issue-associations/",queryParams:{project:e},blockers:[],blocks:[]});this.dispatch(Gu(s))}}class Xg extends Te{constructor(){super(...arguments);f(this,"name","Issue Attachment");f(this,"url","/issue-attachments");f(this,"initializeAttachments",ea);f(this,"addAttachments",ta);f(this,"updateAttachments",Qu);f(this,"removeAttachments",sa);f(this,"removeAttachment",Zu);f(this,"setAttachment",Xu);f(this,"selectAttachment",so)}buildOfflineAttachment(s){return I({file:URL.createObjectURL(s.file),file_sha1:s.file_sha1,created_by:s.created_by,file_name:s.file.name,file_type:s.file.type,submitted_at:s.submitted_at,description:s.description,issue:s.modelUuid})}buildAttachmentPayload(s){return{...s,issue:s.modelUuid}}async bulkAdd(s){return this._bulkAdd(s.map(a=>({modelUuid:a.issueUuid,file:a.file})))}async delete(s){return this._delete(s)}async refreshStore(s){const a=await this.enqueueRequest({description:"Get issue attachments",method:h.GET,url:`${this.url}/`,queryParams:{project:s},blocks:[],blockers:[]});this.dispatch(ea(a))}}class Qg extends Te{constructor(){super(...arguments);f(this,"name","Issue Comment Attachment");f(this,"url","/issue-comment-attachments");f(this,"initializeAttachments",aa);f(this,"addAttachments",co);f(this,"updateAttachments",ro);f(this,"removeAttachments",oo);f(this,"removeAttachment",uo);f(this,"setAttachment",no);f(this,"selectAttachment",mo)}buildOfflineAttachment(s){return I({file:URL.createObjectURL(s.file),file_sha1:s.file_sha1,created_by:s.created_by,file_name:s.file.name,file_type:s.file.type,submitted_at:s.submitted_at,description:s.description,issue_comment:s.modelUuid})}buildAttachmentPayload(s){return{...s,issue_comment:s.modelUuid}}async bulkAdd(s){return this._bulkAdd(s.map(a=>({modelUuid:a.issueCommentUuid,file:a.file})))}async delete(s){return this._delete(s)}async refreshStore(s){const a=await this.enqueueRequest({description:"Get issue comment attachments",method:h.GET,url:`${this.url}/`,queryParams:{project:s},blocks:[],blockers:[]});this.dispatch(aa(a))}}class Zg extends R{add(e){var n;const{store:s}=this.client,a=I({...e,author:(n=s.getState().userReducer.currentUser)==null?void 0:n.id,submitted_at:new Date().toISOString()});this.dispatch(ra(a));const c=this.enqueueRequest({description:"Add issue comment",method:h.POST,url:"/issue-comments/",payload:_(a),blockers:[e.issue],blocks:[a.uuid]});return c.catch(()=>{this.dispatch(da(a.uuid))}),[a,c]}update(e){const{store:s}=this.client,a=ua(e.uuid)(s.getState());if(!a)throw new Error(`Comment with uuid ${e.uuid} not found in store`);const c={...a,...e};this.dispatch(na(c));const n=this.enqueueRequest({description:"Edit issue comment",method:h.PATCH,url:`/issue-comments/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return n.catch(()=>{this.dispatch(na(a))}),[c,n]}remove(e){const{store:s}=this.client,a=ua(e)(s.getState());if(!a)throw new Error(`Comment with uuid ${e} not found in store`);this.dispatch(da(e));const c=this.enqueueRequest({description:"Delete comment",method:h.DELETE,url:`/issue-comments/${e}/`,blockers:[e],blocks:[]});return c.catch(()=>{this.dispatch(ra(a))}),c}async refreshStore(e){const s=await this.enqueueRequest({description:"Get comments",method:h.GET,url:"/issue-comments/",queryParams:{project:e},blockers:[],blocks:[]});this.dispatch(yo(s))}}class xg extends R{add(e){var m;const{store:s}=this.client,a=s.getState(),c=new Date().toISOString(),n=(m=a.userReducer.currentUser)==null?void 0:m.id,r=I({...e,submitted_at:c,created_by:n});this.dispatch(la(r));const u=this.enqueueRequest({description:"Create issue",method:h.POST,url:"/issues/",payload:_(r),blockers:["add-issue",r.project,r.issue_type,...r.category?[r.category]:[]],blocks:[r.uuid]});return u.then(d=>{this.dispatch(wt(d))}).catch(d=>{throw this.dispatch(ha(r.uuid)),d}),[r,u]}update(e){var m;const s=this.client.store.getState(),a=ma(e.uuid)(s);if(!a)throw new Error(`Attempting to update an issue with uuid ${e.uuid} that doesn't exist in the store`);const c={...a,...e};this.dispatch(wt(c));const n={};for(const d of[v.TITLE,v.DESCRIPTION,v.STATUS,v.CATEGORY,v.PRIORITY,v.ASSIGNED_TO,v.DUE_DATE])if(d in e&&e[d]!==a[d])switch(d){case v.PRIORITY:case v.STATUS:{const o=e[d];n[d]=o!==void 0?Number(o):null;break}case v.DUE_DATE:case v.DESCRIPTION:case v.TITLE:n[d]=e[d]??null;break;case v.CATEGORY:{let o=null;const p=e[d];if(p&&(o=s.categoryReducer.instances[p]??null,!o))throw new Error(`Trying to update issue category to ${p} which does not exist in store`);n[d]=o?{name:o.name,color:o.color,uuid:o.uuid}:null;break}case v.ASSIGNED_TO:{let o=null;const p=e[d];if(p&&(o=s.userReducer.instances[p]??null,!o))throw new Error(`Trying to update issue assigned_to to ${p} which does not exist in store`);n[d]=o?{full_name:o.username,id:o.id}:null;break}}const r=I({created_by:(m=s.userReducer.currentUser)==null?void 0:m.id,submitted_at:new Date().toISOString(),issue:a.uuid,changes:n});this.dispatch(yl(r));const u=this.enqueueRequest({description:"Edit issue",method:h.PATCH,url:`/issues/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.catch(()=>{this.dispatch(wt(a)),this.dispatch(Sl(r.uuid))}),[c,u]}async remove(e){const{store:s}=this.client,a=s.getState(),c=ma(e)(a);if(!c)throw new Error(`No issue with uuid ${e} found in the store`);const n=to(e)(a),r=Pl(e)(a),u=vu(e)(a),m={};for(const o of Hu(e)(a))m[o.uuid]=o;for(const o of Wu(e)(a))m[o.uuid]=o;const d=Object.values(m);this.dispatch(ha(e)),n.length>0&&this.dispatch(sa(n.map(({uuid:o})=>o))),r.length>0&&this.dispatch(gl(r.map(({uuid:o})=>o))),u.length>0&&this.dispatch(vt(u.map(({uuid:o})=>o))),d.length>0&&this.dispatch(Zi(d.map(({uuid:o})=>o)));try{return await this.enqueueRequest({description:"Delete issue",method:h.DELETE,url:`/issues/${e}/`,blockers:[e],blocks:[]})}catch(o){throw this.dispatch(la(c)),this.dispatch(ta(n)),this.dispatch(fl(r)),this.dispatch(_t(u)),this.dispatch(Xi(d)),o}}async refreshStore(e){const s=await this.enqueueRequest({description:"Get issues",method:h.GET,url:"/issues/",queryParams:{project:e},blockers:[],blocks:[]});this.dispatch(bo(s))}}class eb extends Te{constructor(){super(...arguments);f(this,"name","Issue Type Attachment");f(this,"url","/issue-type-attachments");f(this,"initializeAttachments",Aa);f(this,"addAttachments",Oo);f(this,"updateAttachments",vo);f(this,"removeAttachments",Eo);f(this,"removeAttachment",wo);f(this,"setAttachment",_o);f(this,"selectAttachment",Mo)}buildOfflineAttachment(s){return I({file:URL.createObjectURL(s.file),file_sha1:s.file_sha1,created_by:s.created_by,file_name:s.file.name,file_type:s.file.type,submitted_at:s.submitted_at,description:s.description,issue_type:s.modelUuid})}buildAttachmentPayload(s){return{...s,issue_type:s.modelUuid}}async bulkAdd(s){return this._bulkAdd(s.map(a=>({modelUuid:a.issueTypeUuid,file:a.file})))}async delete(s){return this._delete(s)}async refreshStore(s){const a=await this.enqueueRequest({description:"Get issue type attachments",method:h.GET,url:`${this.url}/`,queryParams:{organization:s},blocks:[],blockers:[]});this.dispatch(Aa(a))}}class tb extends w{async bulkAdd(e){var m;const s=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,c={},n=[],r=[];for(const d of e){const{fieldsRevisionUuid:o,fieldIdentifier:p,file:A}=d,y=await this.getFilePayload(A);y.sha1 in c||(c[y.sha1]=y);const b=I({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:y.sha1,created_by:a,fields_revision:o,submitted_at:s,field_identifier:p});n.push(b);const P={uuid:b.uuid,file_name:A.name,file_extension:y.extension,field_identifier:p,file_sha1:y.sha1,fields_revision:o};r.push(P)}this.dispatch(Co(n));const u=this.enqueueRequest({description:"Add issue type fields attachments",method:h.POST,url:"/issue-type-fields-attachments/bulk/",payload:{submitted_at:s,attachments:r,files:Object.values(c)},blockers:n.map(d=>d.fields_revision),blocks:n.map(d=>d.uuid)});return u.then(d=>{this.processPresignedUrls(d.presigned_urls),this.dispatch(Do(d.attachments))}).catch(()=>{this.dispatch(Uo(n.map(d=>d.uuid)))}),[n,u.then(({attachments:d})=>d)]}async refreshStore(e){const s=await this.enqueueRequest({description:"get issue type fields attachments",method:h.GET,url:"/issue-type-fields-attachments/",queryParams:{organization:e},blockers:[e],blocks:[]});this.dispatch(zo(s))}}class sb extends R{add(e){var u;const{store:s}=this.client,a=(u=s.getState().userReducer.currentUser)==null?void 0:u.id,c=new Date().toISOString(),n=I({...e,created_by:a,submitted_at:c});this.dispatch(Jo(n));const r=this.enqueueRequest({description:"Add Issue Type Fields",method:h.POST,url:"/issue-type-fields/",payload:_(n),blockers:[n.issue_type],blocks:[n.uuid]});return r.then(m=>{this.dispatch(Xo(m))}).catch(m=>{throw this.dispatch(Qo(n.uuid)),m}),[n,r]}async refreshStore(e){const s=await this.enqueueRequest({description:"Get Issue Type Fields",method:h.GET,url:"/issue-type-fields/",queryParams:{organization:e},blockers:[],blocks:[]});this.dispatch(Yo(s))}}class ib extends w{async bulkAdd(e){var m;const s=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,c={},n=[],r=[];for(const d of e){const{fieldValuesUuid:o,fieldIdentifier:p,file:A}=d,y=await this.getFilePayload(A);y.sha1 in c||(c[y.sha1]=y);const b=I({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:y.sha1,created_by:a,field_values:o,submitted_at:s,field_identifier:p});n.push(b);const P={uuid:b.uuid,file_name:A.name,file_sha1:y.sha1,file_extension:y.extension,field_identifier:p,field_values:o};r.push(P)}this.dispatch(qt(n));const u=this.enqueueRequest({description:"Add issue type field values attachments",method:h.POST,url:"/issue-type-field-values-attachments/bulk/",payload:{submitted_at:s,attachments:r,files:Object.values(c)},blockers:n.map(d=>d.field_values),blocks:n.map(d=>d.uuid)});return u.then(({presigned_urls:d,attachments:o})=>{this.processPresignedUrls(d),this.dispatch(sl(o))}).catch(d=>{throw this.dispatch(jt(n.map(o=>o.uuid))),d}),[n,u.then(({attachments:d})=>d)]}async bulkDelete(e){const{store:s}=this.client,a=s.getState(),c=al(e)(a);this.dispatch(jt(e));try{await this.enqueueRequest({description:"Delete issue type field values attachments",method:h.DELETE,url:"/issue-type-field-values-attachments/bulk/",payload:{attachment_ids:e},blockers:e,blocks:[]})}catch(n){throw this.dispatch(qt(c)),n}}async refreshStore(e){const s=await this.enqueueRequest({description:"Get issue type field values attachments",method:h.GET,url:"/issue-type-field-values-attachments/",queryParams:{project:e},blockers:[],blocks:[]});this.dispatch(tl(s))}}class ab extends R{add(e){var r;const{store:s}=this.client,a=s.getState(),c=I({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),n=this.enqueueRequest({description:"Add issue type field values",method:h.POST,url:"/issue-type-field-values/",payload:_(c),blockers:[e.issue,e.fields_revision],blocks:[c.uuid]});return this.dispatch(Sa(c)),n.then(u=>(this.dispatch(it(u)),u)).catch(()=>{this.dispatch(ga(c.uuid))}),[c,n]}update(e){const{store:s}=this.client,a=s.getState(),c=Pa(e.uuid)(a);if(!c)throw new Error(`Expected IssueTypeFieldValues with uuid ${e.uuid} to exist`);const n={...c,...e};this.dispatch(it(n));const r=this.enqueueRequest({description:"Update issue type field values",method:h.PATCH,url:`/issue-type-field-values/${e.uuid}/`,payload:e,blockers:[n.uuid,n.fields_revision,n.issue],blocks:[n.uuid]});return r.then(u=>{this.dispatch(it(u))}).catch(()=>{this.dispatch(it(c))}),[n,r]}async delete(e){const{store:s}=this.client,a=s.getState(),c=Pa(e)(a);if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const n=cl(e)(a);this.dispatch(ga(e)),this.dispatch(jt(n.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete issue type field values",method:h.DELETE,url:`/issue-type-field-values/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(Sa(c)),this.dispatch(qt(n)),r}}async refreshStore(e){const s=await this.enqueueRequest({description:"Get issue type field values",method:h.GET,url:"/issue-type-field-values/",queryParams:{project:e},blockers:[],blocks:[]});this.dispatch(No(s))}}class cb extends R{add(e){var r;const{store:s}=this.client,a=s.getState(),c=I({...e,submitted_at:new Date().toISOString(),created_by:(r=a.userReducer.currentUser)==null?void 0:r.id});this.dispatch(ul(c));const n=this.enqueueRequest({method:h.POST,url:"/issue-types/",payload:_(c),blockers:[],blocks:[c.uuid]});return n.then(u=>{this.dispatch(at(u))}).catch(()=>{this.dispatch(Oa(c.uuid))}),[c,n]}update(e){const{store:s}=this.client,a=s.getState(),c=_a(e.uuid)(a);if(!c)throw new Error(`IssueType with uuid ${e.uuid} does not exist in the store.`);const n={...c,...e};this.dispatch(ol(n));const r=this.enqueueRequest({method:h.PATCH,url:`/issue-types/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(at(u))}).catch(()=>{this.dispatch(at(c))}),[n,r]}delete(e){const{store:s}=this.client,a=s.getState(),c=_a(e)(a);if(!c)throw new Error(`IssueType with uuid ${e} does not exist in the store.`);const n=va(e)(a);this.dispatch(Oa(e)),this.dispatch(Fo(n.map(u=>u.uuid)));const r=this.enqueueRequest({method:h.DELETE,url:`/issue-types/${e}/`,blockers:[e],blocks:[]});return r.catch(()=>{this.dispatch(at(c)),this.dispatch(Po(n))}),r}async refreshStore(e){const s=await this.enqueueRequest({method:h.GET,url:"/issue-types/",queryParams:{organization:e},blockers:[],blocks:[]});this.dispatch(dl(s))}}class nb extends R{async refreshStore(e){const s=await this.enqueueRequest({description:"Get issue updates",method:h.GET,url:"/issue-updates/",queryParams:{project:e},blockers:[],blocks:[]});this.dispatch(Al(s))}}const rb=1800;function db(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 ub extends hg{constructor(){super(...arguments);f(this,"_getRenewedTokens",async s=>{const a=this.enqueueRequest({description:"Get renewed tokens",method:h.POST,url:this.refreshTokensUrl,payload:{refresh:s},isAuthNeeded:!1,blockers:[],blocks:[],checkAuth:!1,immediate:!0});let c;try{c=await a}catch(n){console.error("Could not renew tokens; clearing auth",n),this.clearAuth();return}if(!c.access)throw new Error("Missing access token");return{accessToken:c.access,refreshToken:c.refresh??this.getRefreshToken()}})}clearAuth(){console.debug(this.constructor.name,"clearing auth;"),this.dispatch(yd(!1)),this.clearTokens(),this.dispatch({type:dm.RESET_STATE}),this.dispatch({type:lc})}async renewTokens(){const s=this.getRefreshToken();if(!s)throw new Error("No refresh token found");console.debug(this.constructor.name,"renewing tokens");try{const a=await this._getRenewedTokens(s);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 s=this.getAccessToken();if(!s)return!1;const a=Date.now()/1e3;let c;try{c=um(s).exp??a}catch{c=a}return c-a<rb}getAuthHeader(){return`Bearer ${this.getAccessToken()}`}async prepareAuth(){if(this.tokenIsExpiringSoon()){console.debug(this.constructor.name,"preparing auth");try{await this.renewTokens()}catch(s){return s instanceof M&&this.clearAuth(),s instanceof Error?Promise.reject(s):Promise.reject(new Error((s??Be).toString()))}}}async handleUnauthorized(s,a){const c=this.client.store.getState();if(s.url.endsWith("/token/refresh/"))throw c.authReducer.isLoggedIn&&console.warn("No signed-in user to sign out."),this.clearAuth(),new M({message:"You have been signed out due to inactivity.",response:a,discard:!0});if(c.authReducer.isLoggedIn)await this.renewTokens();else throw console.debug("Forbidden; user is not logged in."),new M({message:"Incorrect username or password.",response:a,discard:!0})}async initAuth(s){const a=Ie.v4();return console.debug(this.constructor.name,"Initiating auth"),this.enqueueRequest({uuid:a,description:"Get token pair",method:h.POST,url:this.initTokensUrl,payload:s,isAuthNeeded:!1,checkAuth:!1,immediate:!0,blockers:[],blocks:[]}).then(c=>{this.setTokens(db(c))})}}class ob extends R{async getLicense(e){const s=await this.enqueueRequest({description:"Get license",method:h.GET,url:`/billing/${e.uuid}/`,isAuthNeeded:!0,blockers:[e.organization_owner],blocks:[]});return this.dispatch(be(s)),s}async pauseLicense(e){const s=await this.enqueueRequest({description:"Pause license",method:h.DELETE,url:`/billing/${e.uuid}/suspend/`,isAuthNeeded:!0,blockers:[e.organization_owner],blocks:[]});return this.dispatch(be(s)),s}async resumeLicense(e){const s=await this.enqueueRequest({description:"Resume license",method:h.PATCH,url:`/billing/${e.uuid}/suspend/`,isAuthNeeded:!0,blockers:[e.organization_owner],blocks:[]});return this.dispatch(be(s)),s}async cancelLicense(e){const s=await this.enqueueRequest({description:"Cancel license",method:h.DELETE,url:`/billing/${e.uuid}/`,isAuthNeeded:!0,blockers:[e.organization_owner],blocks:[]});return this.dispatch(be(s)),s}async attachLicenseToProject(e,s){const a=await this.enqueueRequest({description:"Attach license",method:h.PATCH,url:`/billing/${e.uuid}/project/`,isAuthNeeded:!0,payload:{project:s.uuid},blockers:[e.organization_owner,s.uuid],blocks:["add-issue","add-form-entry","change-access-level","add-workspace"]});return this.dispatch(be(a)),a}async detachLicenseFromProject(e){const s=await this.enqueueRequest({description:"Detach license",method:h.DELETE,url:`/billing/${e.uuid}/project/`,isAuthNeeded:!0,blockers:[e.organization_owner],blocks:["add-issue","add-form-entry","change-access-level","add-workspace"]});return this.dispatch(be(s)),s}async getLatestTransaction(e){return await this.enqueueRequest({description:"Get latest transaction",method:h.GET,url:`/billing/${e.uuid}/transaction/`,isAuthNeeded:!0,blockers:[e.uuid],blocks:[e.uuid]})}async refreshStore(e,s){const a={},c=await this.enqueueRequest({description:"Get licenses",method:h.GET,url:`/organizations/${s}/licenses/`,isAuthNeeded:!0,blockers:[s],blocks:["add-issue","add-form-entry","change-access-level","add-workspace"]});for(const r of c)a[r.uuid]=r;const n=await this.enqueueRequest({description:"Get licenses",method:h.GET,url:`/projects/${e}/licenses/`,isAuthNeeded:!0,blockers:[e],blocks:["add-issue","add-form-entry","change-access-level","add-workspace"]});for(const r of n)a[r.uuid]=r;this.dispatch(Il(Object.values(a)))}}class lb extends R{async update(e){const s=this.enqueueRequest({description:"Edit organization access",method:h.PATCH,url:`/organization-accesses/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return s.then(()=>{this.dispatch(Ml(e))}),s}async remove(e){return this.dispatch(Vl(e.uuid)),this.dispatch(wl(e.user)),this.enqueueRequest({description:"Remove organization access",method:h.DELETE,url:`/organization-accesses/${e.uuid}/`,blockers:[e.uuid],blocks:[]})}async refreshStore(e){const s=await this.enqueueRequest({description:"Get organization accesses",method:h.GET,url:"/organization-accesses/",queryParams:{organization:e},blockers:[],blocks:[]});this.dispatch(jl(s))}}class hb extends R{create(e){return this.enqueueRequest({description:"Create organization",method:h.POST,url:"/organizations/",payload:{name:e},blockers:[],blocks:[`add-org-${e}`,"create-org"]})}async update(e){return this.enqueueRequest({description:"Edit organization",method:h.PATCH,url:`/organizations/${e.uuid}/`,payload:e,blockers:[`add-org-${e.name}`,e.uuid],blocks:[e.uuid]})}async invite(e,s){return this.enqueueRequest({description:"Invite user to organization",method:h.POST,url:`/organizations/${e}/invite/${s}/`,blockers:[],blocks:[]})}async refreshStore(e,s){const a={},c=await this.enqueueRequest({description:"Get organizations",method:h.GET,url:`/projects/${e}/organizations/`,blockers:[],blocks:[]});for(const r of c)a[r.uuid]=r;const n=await this.enqueueRequest({description:"Get organization",method:h.GET,url:`/organizations/${s}/`,blockers:[],blocks:[]});a[n.uuid]=n,this.dispatch(xl(Object.values(a)))}}class mb extends R{async update(e){return this.dispatch(Dl(e)),this.enqueueRequest({description:"Edit project access",method:h.PATCH,url:`/project-accesses/${e.uuid}/`,payload:e,blockers:[e.uuid,"change-access-level"],blocks:[e.uuid]})}async remove(e){return this.dispatch(Ul(e)),this.enqueueRequest({description:"Delete project access",method:h.DELETE,url:`/project-accesses/${e}/`,blockers:[e],blocks:[]})}async refreshStore(e){const s=await this.enqueueRequest({description:"Get project accesses",method:h.GET,url:"/project-accesses/",queryParams:{project:e},blockers:[],blocks:[]});this.dispatch(ka(s))}}class pb extends Te{constructor(){super(...arguments);f(this,"name","Project Attachment");f(this,"url","/project-attachments");f(this,"addAttachments",mh);f(this,"updateAttachments",yh);f(this,"removeAttachments",Ba);f(this,"removeAttachment",fh);f(this,"setAttachment",ph);f(this,"selectAttachment",bh)}buildOfflineAttachment(s){return I({file:URL.createObjectURL(s.file),file_sha1:s.file_sha1,created_by:s.created_by,file_name:s.file.name,file_type:s.file.type,submitted_at:s.submitted_at,description:s.description,project:s.modelUuid})}buildAttachmentPayload(s){return{...s,project:s.modelUuid}}async bulkAdd(s){return this._bulkAdd(s.map(a=>({modelUuid:a.projectUuid,file:a.file})))}async delete(s){return this._delete(s)}async refreshStore(s){const a=await this.enqueueRequest({description:"Get project attachments",method:h.GET,url:`${this.url}/`,queryParams:{project:s},blockers:[],blocks:[]});this.dispatch(hh(a))}}class Ab 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 s={...e};delete s.file;const a=this.enqueueRequest({method:h.PATCH,url:`/projects/files/${e.uuid}/`,payload:s,blockers:[e.uuid],blocks:[e.uuid]});return a.then(c=>{this.dispatch(La(c))}),a}saveActive(){const{store:e}=this.client,s=e.getState(),a=s.projectFileReducer.activeProjectFileId;if(!a)throw new Error("No active project file");const c=s.projectFileReducer.instances[a];if(!c)throw new Error("No active project file");if(!c.bounds&&!c.canvas_bounds)throw new Error("Project file must either have bounds or canvas_bounds set");let n;if(typeof c.file=="string"&&!c.file.startsWith("blob:")){const m={...c};delete m.file,n={method:h.PATCH,url:`/projects/files/${a}/`,payload:m,blockers:[a],blocks:[a]}}else n=new Promise((m,d)=>{this.client.files.uploadFileToS3(c.file_sha1).then(([o])=>{m({method:h.POST,url:`/projects/${c.project}/files/`,payload:{...c,...o},blockers:[a],blocks:[a]})}).catch(d)});const u=Promise.resolve(n).then(m=>this.enqueueRequest(m));return u.then(m=>{this.dispatch(La(m))}),this.dispatch(Eh),this.dispatch(wh(null)),this.dispatch(vh(!1)),[c,u]}delete(e){return this.dispatch(Oh(e)),this.enqueueRequest({method:h.DELETE,url:`/projects/files/${e}`,blockers:[e],blocks:[]})}async refreshStore(e){const s=await this.enqueueRequest({description:"Get project files",method:h.GET,url:`/projects/${e}/files/`,blockers:[],blocks:[]});this.dispatch(Ih(s))}}class yb extends R{async add(e){if(!e.bounds&&!e.canvas_bounds)throw new Error("Project must either have bounds or canvas_bounds set");return await this.enqueueRequest({description:"Create project",method:h.POST,url:"/projects/",payload:{name:e.name,bounds:e.bounds,organization_owner:e.organization_owner},blockers:[],blocks:[]})}async update(e){if(!e.bounds&&!e.canvas_bounds)throw new Error("Project must either have bounds or canvas_bounds set");return this.dispatch(Wl(e)),await this.enqueueRequest({description:"Update project",method:h.PATCH,url:`/projects/${e.uuid}/`,payload:{name:e.name,bounds:e.bounds},blockers:[e.uuid],blocks:[e.uuid]})}async delete(e){const{store:s}=this.client,a=s.getState(),c=Dt(a),n=c[e];if(!n)throw new Error("Expected project to exist");const r=jh(a).filter(o=>o.project===e);this.dispatch(_h(r.map(({uuid:o})=>o)));const u=Ph(n.uuid)(a);this.dispatch(Ba(u.map(({uuid:o})=>o)));const m=Bl(a);this.dispatch($l(m.map(({uuid:o})=>o))),this.dispatch({type:"rehydrated/setRehydrated",payload:!1}),this.dispatch(Kl(n.uuid));const d=Rl(n.uuid)(a);d&&this.dispatch(be({...d,project:null}));try{await this.enqueueRequest({description:"Delete project",method:h.DELETE,url:`/projects/${e}/`,blockers:[e],blocks:[]}),this.dispatch({type:"rehydrated/setRehydrated",payload:!0})}catch(o){throw this.dispatch(Hl(Object.values(c))),this.dispatch(ka(Object.values(m))),this.dispatch(Rh(r)),this.dispatch(Ah(u)),this.dispatch({type:"rehydrated/setRehydrated",payload:!0}),d&&this.dispatch(be({...d,project:n.uuid})),o}}invite(e,s){const a=Ie.v4();return this.enqueueRequest({description:"Invite user to project",method:h.POST,url:`/projects/${e}/invite/${s}/`,payload:{uuid:a},blockers:[],blocks:[a]})}joinProject(e,s,a){return this.enqueueRequest({description:"Join project",method:h.GET,url:`/projects/${e}/join-project/${s}/${a}/`,isAuthNeeded:!1,blockers:[],blocks:[]})}async acceptInvite(e){return this.enqueueRequest({description:"Accept project invite",method:h.PATCH,url:`/projects/${e}/accept-invite/`,blockers:[e],blocks:[e]}).then(()=>{this.dispatch(Yl(e))})}}class fb extends R{add(e){const s=I({...e,submitted_at:new Date().toISOString()});this.dispatch(Ch(s));const a=this.enqueueRequest({description:"Create team",method:h.POST,url:"/teams/",payload:s,blockers:[],blocks:[s.uuid]});return a.then(c=>{this.dispatch(Ue(c))}).catch(()=>{this.dispatch(Ka(s.uuid))}),[s,a]}update(e){const{store:s}=this.client,a=$e(e.uuid)(s.getState());if(!a)throw new Error(`Expected team with uuid ${e.uuid} to exist`);const c={...a,...e};this.dispatch(Wa(c));const n=this.enqueueRequest({description:"Update team",method:h.PATCH,url:`/teams/${e.uuid}/`,payload:_(e),blockers:[e.uuid],blocks:[e.uuid]});return n.then(r=>{this.dispatch(Ue(r))}).catch(()=>{this.dispatch(Ue(a))}),[c,n]}async delete(e){const{store:s}=this.client,a=s.getState(),c=$e(e)(a);if(!c)throw new Error(`Expected team with uuid ${e} to exist`);this.dispatch(Ka(e));try{return await this.enqueueRequest({description:"Delete team",method:h.DELETE,url:`/teams/${e}/`,blockers:[e],blocks:[e]})}catch(n){throw this.dispatch(Ue(c)),n}}async setMembers(e,s){const{store:a}=this.client,c=$e(e)(a.getState());if(!c)throw new Error(`Expected team with uuid ${e} to exist`);if(s.length!==new Set(s).size)throw new Error("Duplicate members found in the list");this.dispatch(Wa({...c,members:s}));const n=this.enqueueRequest({description:"Set team members",method:h.PUT,url:`/teams/${e}/set-members/`,payload:{users:s},blockers:[e],blocks:[e]});return n.catch(()=>{this.dispatch(Ue(c))}),n}async addMembers(e,s){const{store:a}=this.client,c=$e(e)(a.getState());if(!c)throw new Error(`Expected team with uuid ${e} to exist`);const n=[...c.members,...s];return this.setMembers(e,n)}async removeMembers(e,s){const{store:a}=this.client,c=$e(e)(a.getState());if(!c)throw new Error(`Expected team with uuid ${e} to exist`);const n=c.members.filter(r=>!s.includes(r));return this.setMembers(e,n)}async refreshStore(e){const s=await this.enqueueRequest({description:"Fetch teams",method:h.GET,url:"/teams/",queryParams:{organization:e},blockers:[],blocks:[]});this.dispatch(zh(s))}}class Sb extends R{async refreshStore(e,s){const a={},c=await this.enqueueRequest({description:"Fetch organization users",method:h.GET,url:`/organizations/${s}/users/`,blockers:[],blocks:[]});for(const r of c)a[r.id]=r;const n=await this.enqueueRequest({description:"Fetch project users",method:h.GET,url:`/projects/${e}/users/`,blockers:[],blocks:[]});for(const r of n)a[r.id]=r;this.dispatch(vl(Object.values(a)))}}class gb{constructor(e){f(this,"store");this.store=e}async enqueueRequest(e,s,a){return this._enqueueRequest(e,s,a).then(c=>{if(c instanceof M)throw c;return c})}_enqueueRequest(e,s,a){const c=new hc,n={...e,BASE_URL:s,serviceName:a};if(e.immediate){const r={...n,uuid:e.uuid??Ie.v4()},u={payload:r,type:"",meta:{offline:{effect:{timestamp:new Date().toISOString(),request:r,BASE_URL:s,serviceName:a}}}};Za(u,this).then(m=>{c.resolve(m.body)}).catch(m=>{xa(m,u),m instanceof Error?c.reject(m):c.reject(new Error((m??Be).toString()))})}else{const r=this.store.dispatch(rh(n)),u=d=>{if(d)c.resolve(d.body);else{const o=new M({message:"Could not get a response from the server.",response:d,discard:!0});c.reject(o)}},m=d=>{d instanceof M?d.options.discard=!0:(console.error("Received an unexpected error while processing a request:",d,`
|
|
15
|
-
Converting error to APIError and discarding.`),d=new M({message:"An error occurred while processing the request.",innerError:d,discard:!0})),c.reject(d)};r.then(u,m)}return c}}class Ge{constructor(){f(this,"graph");f(this,"requestAttemptCounter");this.graph=new om.DepGraph,this.requestAttemptCounter={}}static _fromOutbox(e){const s=new Ge;for(let a=0;a<e.length;a++){const c=e[a];if(!c){console.error("Outbox item was undefined");continue}s.sneakRequest(c);for(let n=0;n<a;n++){const r=e[n];if(!r){console.error("Previous outbox item was undefined");continue}r.payload.uuid!==c.payload.uuid&&r.payload.blocks.some(u=>c.payload.blockers.includes(u))&&Ge._addDependency(c.payload.uuid,r.payload.uuid,s.graph)}}return s}_addDependency(e,s){Ge._addDependency(e,s,this.graph)}static _addDependency(e,s,a){if(e===s)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: ${s})`);if(!a.hasNode(s))throw new Error(`Tried to add dependency to non-existent node: ${s} (from node: ${e})`);a.addDependency(e,s)}addRequest(e){if(this.graph.addNode(e.payload.uuid,e),!(e.payload.blockers.length===0||this.graph.size()===1))for(const s of this.graph.overallOrder()){if(s===e.payload.uuid)continue;const a=this.graph.getNodeData(s);e.payload.blockers.some(c=>a.payload.blocks.includes(c))&&this._addDependency(e.payload.uuid,s)}}insertRequest(e){this.graph.addNode(e.payload.uuid,e);for(const s of this.graph.overallOrder()){if(s===e.payload.uuid)continue;this.graph.getNodeData(s).payload.blockers.some(c=>e.payload.blocks.includes(c))&&this._addDependency(s,e.payload.uuid)}}sneakRequest(e){this.graph.addNode(e.payload.uuid,e)}_getNextNode(){const e=this.graph.overallOrder(!0);let s=1/0,a;for(const c of e){const n=this.requestAttemptCounter[c]||0;n<s&&(s=n,a=c)}return a}peek(){const e=this._getNextNode();if(e)return this.graph.getNodeData(e)}remove(e){this.graph.removeNode(e),delete this.requestAttemptCounter[e]}pop(){const e=this.peek();return e&&this.graph.removeNode(e.payload.uuid),e}getQueue(){const e=this.graph.overallOrder().map(a=>this.graph.getNodeData(a)),s=this._getNextNode();if(s){const a=this.graph.getNodeData(s),c=e.findIndex(n=>n.payload.uuid===a.payload.uuid);c!==-1&&(e.splice(c,1),e.unshift(a))}return e}getReady(){let e=this.graph.overallOrder(!0).map(s=>this.graph.getNodeData(s));return e=e.sort((s,a)=>s.meta.offline.effect.timestamp.localeCompare(a.meta.offline.effect.timestamp)),e=e.sort((s,a)=>{const c=this.requestAttemptCounter[s.payload.uuid]||0,n=this.requestAttemptCounter[a.payload.uuid]||0;return c-n}),e}registerRetry(e){this.requestAttemptCounter[e]=(this.requestAttemptCounter[e]||0)+1}}const bb=(t,e)=>{const s=new e(t);return WS(s),HS(t),s};var tm=(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))(tm||{});i.APIError=M,i.AgentService=mg,i.AssetAttachmentService=pg,i.AssetProcedureAttachmentService=Ag,i.AssetProcedureFieldValuesAttachmentService=Sg,i.AssetProcedureFieldValuesService=gg,i.AssetProcedureFieldsAttachmentService=yg,i.AssetProcedureFieldsService=fg,i.AssetProcedureInstanceService=bg,i.AssetProcedureService=Pg,i.AssetProcedureStepFieldValuesAttachmentService=Ig,i.AssetProcedureStepFieldValuesService=Rg,i.AssetProcedureStepFieldsAttachmentService=Fg,i.AssetProcedureStepFieldsService=Tg,i.AssetProcedureStepService=Og,i.AssetService=_g,i.AssetStageCompletionService=vg,i.AssetStageService=wg,i.AssetTypeAttachmentService=Eg,i.AssetTypeFieldValuesAttachmentService=Mg,i.AssetTypeFieldValuesService=Vg,i.AssetTypeFieldsAttachmentService=qg,i.AssetTypeFieldsService=jg,i.AssetTypeService=kg,i.AttachmentModel=nc,i.BaseApiService=R,i.BaseSDK=gb,i.COMMON_AUTO_FIELDS=fc,i.CategoryService=zg,i.DEFAULT_ISSUE_PRIORITY=hm,i.DEFAULT_ISSUE_STATUS=lm,i.DeferredPromise=hc,i.DocumentAttachmentService=Cg,i.DocumentService=Dg,i.EMPTY_ARRAY=ac,i.EMPTY_OBJECT=cc,i.EmailDomainsService=Ug,i.EmailVerificationService=$g,i.FileService=Gg,i.FormRevisionAttachmentService=Lg,i.FormRevisionService=Ng,i.FormService=Hg,i.FormSubmissionAttachmentService=Wg,i.FormSubmissionService=Kg,i.GeoImageService=Yg,i.HttpMethod=h,i.IssueAssociationService=Jg,i.IssueAttachmentService=Xg,i.IssueCommentAttachmentService=Qg,i.IssueCommentService=Zg,i.IssuePriority=Lt,i.IssueService=xg,i.IssueStatus=Nt,i.IssueTypeAttachmentService=eb,i.IssueTypeFieldValuesAttachmentService=ib,i.IssueTypeFieldValuesService=ab,i.IssueTypeFieldsAttachmentService=tb,i.IssueTypeFieldsService=sb,i.IssueTypeService=cb,i.IssueUpdateChange=v,i.IssueUpdateService=nb,i.JWTService=ub,i.LicenseLevel=dc,i.LicenseService=ob,i.LicenseStatus=uc,i.OUTBOX_RETRY_DELAY=oc,i.OrganizationAccessLevel=Gt,i.OrganizationAccessService=lb,i.OrganizationService=hb,i.OutboxCoordinator=Ge,i.PaddleCheckoutEvent=rc,i.ProjectAccessLevel=Bt,i.ProjectAccessService=mb,i.ProjectAttachmentService=pb,i.ProjectFileService=Ab,i.ProjectService=yb,i.TeamService=fb,i.UNKNOWN_ERROR_MESSAGE=Be,i.UserService=Sb,i.VERSION_REDUCER_KEY=Ne,i.VerificationCodeType=tm,i._setLatestRetryTime=uh,i.acceptProjectInvite=Yl,i.addAsset=Bs,i.addAssetAttachment=Dm,i.addAssetAttachments=xt,i.addAssetProcedure=gs,i.addAssetProcedureAttachment=Bm,i.addAssetProcedureAttachments=Cc,i.addAssetProcedureFieldValues=ds,i.addAssetProcedureFieldValuesAttachment=np,i.addAssetProcedureFieldValuesAttachments=dt,i.addAssetProcedureFieldValuesMany=fn,i.addAssetProcedureFields=sn,i.addAssetProcedureFieldsAttachment=Hm,i.addAssetProcedureFieldsAttachments=Yc,i.addAssetProcedureFieldsMany=Zm,i.addAssetProcedureInstance=ms,i.addAssetProcedureInstances=In,i.addAssetProcedureStep=sA,i.addAssetProcedureStepFieldValues=js,i.addAssetProcedureStepFieldValuesAttachment=Np,i.addAssetProcedureStepFieldValuesAttachments=ot,i.addAssetProcedureStepFieldValuesMany=Zn,i.addAssetProcedureStepFields=Rs,i.addAssetProcedureStepFieldsAttachment=vp,i.addAssetProcedureStepFieldsAttachments=Vn,i.addAssetProcedureStepFieldsMany=kp,i.addAssetProcedureSteps=zs,i.addAssetProcedures=Pp,i.addAssetStage=hA,i.addAssetStageCompletion=Ys,i.addAssetStageCompletions=Js,i.addAssetStages=ei,i.addAssetType=fi,i.addAssetTypeAttachment=yA,i.addAssetTypeAttachments=ci,i.addAssetTypeFieldValues=hi,i.addAssetTypeFieldValuesAttachment=VA,i.addAssetTypeFieldValuesAttachments=gt,i.addAssetTypeFieldValuesMany=rd,i.addAssetTypeFields=Kr,i.addAssetTypeFieldsAttachment=gA,i.addAssetTypeFieldsAttachments=Ur,i.addAssetTypeFieldsMany=OA,i.addAssetTypes=WA,i.addAssets=At,i.addCategory=Fi,i.addConversation=Fc,i.addDocumentAttachment=ay,i.addDocumentAttachments=Rd,i.addDocuments=zd,i.addEmailDomain=Gd,i.addForm=ki,i.addFormRevision=ji,i.addFormRevisionAttachment=py,i.addFormRevisionAttachments=eu,i.addFormRevisions=du,i.addFormSubmission=$i,i.addFormSubmissionAttachment=_y,i.addFormSubmissionAttachments=It,i.addFormSubmissions=_t,i.addForms=Iy,i.addGeoImage=Vu,i.addGeoImages=ku,i.addIssue=la,i.addIssueAssociation=Ji,i.addIssueAssociations=Xi,i.addIssueAttachment=$y,i.addIssueAttachments=ta,i.addIssueComment=ra,i.addIssueCommentAttachment=Ly,i.addIssueCommentAttachments=co,i.addIssueComments=Ky,i.addIssueType=ul,i.addIssueTypeAttachment=Qy,i.addIssueTypeAttachments=Oo,i.addIssueTypeFieldValues=Sa,i.addIssueTypeFieldValuesAttachment=If,i.addIssueTypeFieldValuesAttachments=qt,i.addIssueTypeFieldValuesMany=uf,i.addIssueTypeFields=Jo,i.addIssueTypeFieldsAttachment=tf,i.addIssueTypeFieldsAttachments=Co,i.addIssueTypeFieldsMany=Af,i.addIssueUpdate=yl,i.addIssueUpdates=fl,i.addIssues=Po,i.addLicenses=Vf,i.addOrganization=mS,i.addOrganizations=hS,i.addProject=aS,i.addProjectAttachment=OS,i.addProjectAttachments=mh,i.addProjectFile=ES,i.addProjectFiles=Rh,i.addProjects=iS,i.addTeam=Ch,i.addUser=Bf,i.addUsers=$f,i.agentsReducer=Rc,i.agentsSlice=Jt,i.areArraysEqual=Sm,i.assetAttachmentReducer=Vc,i.assetAttachmentSlice=Qt,i.assetProcedureAttachmentReducer=Hc,i.assetProcedureAttachmentSlice=ts,i.assetProcedureFieldValuesAttachmentReducer=pn,i.assetProcedureFieldValuesAttachmentSlice=cs,i.assetProcedureFieldValuesReducer=Pn,i.assetProcedureFieldValuesSlice=rs,i.assetProcedureFieldsAttachmentReducer=xc,i.assetProcedureFieldsAttachmentSlice=ss,i.assetProcedureFieldsReducer=rn,i.assetProcedureFieldsSlice=is,i.assetProcedureInstanceReducer=_n,i.assetProcedureInstanceSlice=hs,i.assetProcedureReducer=qn,i.assetProcedureSlice=Ss,i.assetProcedureStepFieldValuesAttachmentReducer=Jn,i.assetProcedureStepFieldValuesAttachmentSlice=ws,i.assetProcedureStepFieldValuesReducer=sr,i.assetProcedureStepFieldValuesSlice=qs,i.assetProcedureStepFieldsAttachmentReducer=Un,i.assetProcedureStepFieldsAttachmentSlice=Ts,i.assetProcedureStepFieldsReducer=Gn,i.assetProcedureStepFieldsSlice=Is,i.assetProcedureStepReducer=nr,i.assetProcedureStepSlice=ks,i.assetReducer=mr,i.assetSlice=$s,i.assetStageCompletionReducer=Sr,i.assetStageCompletionSlice=Ks,i.assetStageReducer=Ir,i.assetStageSlice=xs,i.assetTypeAttachmentReducer=zr,i.assetTypeAttachmentSlice=ai,i.assetTypeFieldValuesAttachmentReducer=ad,i.assetTypeFieldValuesAttachmentSlice=ui,i.assetTypeFieldValuesReducer=ld,i.assetTypeFieldValuesSlice=li,i.assetTypeFieldsAttachmentReducer=Nr,i.assetTypeFieldsAttachmentSlice=ri,i.assetTypeFieldsReducer=Qr,i.assetTypeFieldsSlice=di,i.assetTypeReducer=pd,i.assetTypeSlice=yi,i.authReducer=fd,i.authSlice=Pt,i.baseReducer=LS,i.baseReducers=Xa,i.blobToBase64=_m,i.categoryReducer=Fd,i.categorySlice=Pi,i.clearTokens=ZA,i.constructUploadedFilePayloads=Om,i.coordinatesAreEqual=ym,i.createModelAdapter=F,i.createMultiPointGeometry=Am,i.createOfflineAction=ch,i.createPayload=_,i.createPointGeometry=pm,i.createSelectionAdapter=mm,i.deleteAsset=Gs,i.deleteAssetAttachment=wc,i.deleteAssetAttachments=es,i.deleteAssetProcedure=bs,i.deleteAssetProcedureAttachment=$c,i.deleteAssetProcedureAttachments=Bc,i.deleteAssetProcedureFieldValues=us,i.deleteAssetProcedureFieldValuesAttachment=op,i.deleteAssetProcedureFieldValuesAttachments=ut,i.deleteAssetProcedureFieldValuesMany=gn,i.deleteAssetProcedureFields=cn,i.deleteAssetProcedureFieldsAttachment=Jm,i.deleteAssetProcedureFieldsAttachments=Xc,i.deleteAssetProcedureFieldsMany=sp,i.deleteAssetProcedureInstance=ps,i.deleteAssetProcedureInstances=Rn,i.deleteAssetProcedureStep=iA,i.deleteAssetProcedureStepFieldValues=Ms,i.deleteAssetProcedureStepFieldValuesAttachment=Yp,i.deleteAssetProcedureStepFieldValuesAttachments=lt,i.deleteAssetProcedureStepFieldValuesMany=er,i.deleteAssetProcedureStepFields=Os,i.deleteAssetProcedureStepFieldsAttachment=jp,i.deleteAssetProcedureStepFieldsAttachments=zn,i.deleteAssetProcedureStepFieldsMany=Up,i.deleteAssetProcedureSteps=Ds,i.deleteAssetProcedures=Tp,i.deleteAssetStage=mA,i.deleteAssetStageCompletion=Xs,i.deleteAssetStageCompletions=Qs,i.deleteAssetStages=si,i.deleteAssetType=Si,i.deleteAssetTypeAttachment=qr,i.deleteAssetTypeAttachments=ni,i.deleteAssetTypeFieldValues=mi,i.deleteAssetTypeFieldValuesAttachment=DA,i.deleteAssetTypeFieldValuesAttachments=bt,i.deleteAssetTypeFieldValuesMany=ud,i.deleteAssetTypeFields=Jr,i.deleteAssetTypeFieldsAttachment=TA,i.deleteAssetTypeFieldsAttachments=Br,i.deleteAssetTypeFieldsMany=EA,i.deleteAssetTypes=YA,i.deleteAssets=Ls,i.deleteCategory=Pd,i.deleteDocumentAttachment=vd,i.deleteDocumentAttachments=wd,i.deleteEmailDomain=Ld,i.deleteForm=zi,i.deleteFormRevision=Mi,i.deleteFormRevisionAttachment=Sy,i.deleteFormRevisionAttachments=su,i.deleteFormRevisions=uu,i.deleteFormSubmission=Bi,i.deleteFormSubmissionAttachment=qy,i.deleteFormSubmissionAttachments=Rt,i.deleteFormSubmissions=vt,i.deleteGeoImage=Wi,i.deleteGeoImages=Cu,i.deleteIssue=ha,i.deleteIssueAssociation=Qi,i.deleteIssueAssociations=Zi,i.deleteIssueAttachment=Zu,i.deleteIssueAttachments=sa,i.deleteIssueComment=da,i.deleteIssueCommentAttachment=uo,i.deleteIssueCommentAttachments=oo,i.deleteIssueComments=Yy,i.deleteIssueTypeAttachment=wo,i.deleteIssueTypeAttachments=Eo,i.deleteIssueTypeFieldValues=ga,i.deleteIssueTypeFieldValuesAttachment=vf,i.deleteIssueTypeFieldValuesAttachments=jt,i.deleteIssueTypeFieldValuesMany=mf,i.deleteIssueTypeFields=Qo,i.deleteIssueTypeFieldsAttachment=nf,i.deleteIssueTypeFieldsAttachments=Uo,i.deleteIssueTypeFieldsMany=gf,i.deleteIssueUpdate=Sl,i.deleteIssueUpdates=gl,i.deleteIssues=Fo,i.deleteOrganization=yS,i.deleteOrganizationAccess=Vl,i.deleteOrganizations=fS,i.deleteProject=Kl,i.deleteProjectAccess=Ul,i.deleteProjectAccesses=$l,i.deleteProjectAttachment=fh,i.deleteProjectAttachments=Ba,i.deleteProjectFile=Oh,i.deleteProjectFiles=_h,i.deleteProjects=nS,i.deleteTeam=Ka,i.deleteUser=Nf,i.deleteUsers=Hf,i.dequeue=Qh,i.discard=xa,i.documentAttachmentReducer=Md,i.documentAttachmentSlice=Ri,i.documentSlice=Oi,i.documentsReducer=$d,i.downloadFile=vm,i.downloadInMemoryFile=Rm,i.emailDomainsReducer=Wd,i.emailDomainsSlice=vi,i.emailRegex=km,i.enqueue=Xh,i.enqueueRequest=rh,i.fallbackToEmptyArray=g,i.fallbackToEmptyObject=Re,i.fileReducer=Qd,i.fileSlice=wi,i.fileToBlob=Ac,i.formReducer=Au,i.formRevisionAttachmentReducer=au,i.formRevisionAttachmentSlice=Ei,i.formRevisionReducer=hu,i.formRevisionsSlice=qi,i.formSlice=Vi,i.formSubmissionAttachmentReducer=Tu,i.formSubmissionAttachmentSlice=Ci,i.formSubmissionReducer=Eu,i.formSubmissionSlice=Ui,i.geoImageReducer=$u,i.geoImageSlice=Hi,i.getFileIdentifier=Im,i.getFileS3Key=Yt,i.getLocalDateString=mc,i.getLocalRelativeDateString=Fm,i.getOutboxCoordinator=qe,i.getRenamedFile=pc,i.hashFile=ke,i.initSDK=bb,i.initializeAssetAttachments=Zt,i.initializeAssetProcedureAttachments=zc,i.initializeAssetProcedureFieldValues=yn,i.initializeAssetProcedureFieldValuesAttachments=un,i.initializeAssetProcedureFields=tn,i.initializeAssetProcedureFieldsAttachments=Kc,i.initializeAssetProcedureInstances=Tn,i.initializeAssetProcedureStepFieldValues=Qn,i.initializeAssetProcedureStepFieldValuesAttachments=Nn,i.initializeAssetProcedureStepFields=Bn,i.initializeAssetProcedureStepFieldsAttachments=Mn,i.initializeAssetProcedureSteps=ar,i.initializeAssetProcedures=wn,i.initializeAssetStageCompletions=Ar,i.initializeAssetStages=Fr,i.initializeAssetTypeAttachments=vr,i.initializeAssetTypeFieldValues=nd,i.initializeAssetTypeFieldValuesAttachments=xr,i.initializeAssetTypeFields=Wr,i.initializeAssetTypeFieldsAttachments=Dr,i.initializeAssetTypes=md,i.initializeAssets=or,i.initializeCategories=gd,i.initializeConversations=Pc,i.initializeDocumentAttachments=Id,i.initializeEmailDomains=Bd,i.initializeFormRevisionAttachments=xd,i.initializeFormRevisions=ru,i.initializeFormSubmissionAttachments=gu,i.initializeFormSubmissions=Ru,i.initializeForms=pu,i.initializeGeoImages=ju,i.initializeIssueAssociations=Gu,i.initializeIssueAttachments=ea,i.initializeIssueCommentAttachments=aa,i.initializeIssueTypeAttachments=Aa,i.initializeIssueTypeFieldValues=No,i.initializeIssueTypeFieldValuesAttachments=tl,i.initializeIssueTypeFields=Yo,i.initializeIssueTypeFieldsAttachments=zo,i.initializeIssueTypes=dl,i.initializeIssueUpdates=Al,i.initializeIssues=bo,i.initializeLicences=Il,i.initializeOrganizationAccesses=jl,i.initializeOrganizations=oS,i.initializeProjectAccesses=ka,i.initializeProjectAttachments=hh,i.initializeProjectFiles=Ih,i.initializeProjects=tS,i.initializeTeams=zh,i.initializeUsers=vl,i.isToday=Pm,i.issueAssociationReducer=Yu,i.issueAssociationSlice=Yi,i.issueAttachmentReducer=io,i.issueAttachmentSlice=xi,i.issueCommentAttachmentReducer=po,i.issueCommentAttachmentSlice=ia,i.issueCommentReducer=So,i.issueCommentSlice=ca,i.issueReducer=Io,i.issueSlice=oa,i.issueTypeAttachmentReducer=Vo,i.issueTypeAttachmentSlice=pa,i.issueTypeFieldValuesAttachmentReducer=nl,i.issueTypeFieldValuesAttachmentSlice=Ta,i.issueTypeFieldValuesReducer=Wo,i.issueTypeFieldValuesSlice=fa,i.issueTypeFieldsAttachmentReducer=Go,i.issueTypeFieldsAttachmentSlice=ya,i.issueTypeFieldsReducer=xo,i.issueTypeFieldsSlice=Fa,i.issueTypeReducer=ml,i.issueTypeSlice=Ra,i.issueUpdateReducer=Fl,i.issueUpdateSlice=wa,i.licenseReducer=Ol,i.licenseSlice=Ea,i.logOnlyOnce=wm,i.markAsDeleted=dh,i.markForDeletion=RS,i.memoize=Wt,i.moveDocument=Cd,i.offline=I,i.onlyUniqueHashes=Vm,i.onlyUniqueOfflineIds=gc,i.organizationAccessReducer=zl,i.organizationAccessSlice=ja,i.organizationReducer=ah,i.organizationSlice=Da,i.outboxReducer=oh,i.outboxSlice=Ua,i.overmapEnhancer=tg,i.overmapReducer=NS,i.overmapReducers=Bh,i.performRequest=Za,i.projectAccessReducer=Ll,i.projectAccessSlice=Va,i.projectAttachmentReducer=Fh,i.projectAttachmentSlice=$a,i.projectFileReducer=Mh,i.projectFileSlice=Ga,i.projectReducer=Jl,i.projectSlice=Ca,i.rehydratedReducer=Vh,i.rehydratedSlice=Na,i.removeDocuments=_i,i.removeIssueType=Oa,i.removeUser=wl,i.resetProjectFileObjectUrls=jS,i.resetStore=lc,i.restructureCreateSelectorWithArgs=S,i.saveActiveProjectFileBounds=Eh,i.selectAccessToken=xA,i.selectActiveOrganizationAccess=Qf,i.selectActiveProjectFileId=VS,i.selectActiveStatusLicenses=zf,i.selectAllDocumentAttachments=qd,i.selectAllProjectAttachments=gh,i.selectAncestorIdsOfDocument=uy,i.selectAssetAttachmentById=jc,i.selectAssetAttachmentMapping=Ec,i.selectAssetAttachments=qc,i.selectAssetById=Ws,i.selectAssetProcedureAttachmentById=Nc,i.selectAssetProcedureAttachmentMapping=Gc,i.selectAssetProcedureAttachments=Lc,i.selectAssetProcedureById=Fs,i.selectAssetProcedureFieldValues=os,i.selectAssetProcedureFieldValuesAttachmentById=lp,i.selectAssetProcedureFieldValuesAttachments=ln,i.selectAssetProcedureFieldValuesAttachmentsByIds=hn,i.selectAssetProcedureFieldValuesAttachmentsMapping=ns,i.selectAssetProcedureFieldValuesById=ls,i.selectAssetProcedureFieldValuesMapping=bn,i.selectAssetProcedureFieldValuesOfAsset=pp,i.selectAssetProcedureFields=as,i.selectAssetProcedureFieldsAttachmentById=Qm,i.selectAssetProcedureFieldsAttachments=Zc,i.selectAssetProcedureFieldsAttachmentsMapping=Qc,i.selectAssetProcedureFieldsById=cp,i.selectAssetProcedureFieldsMapping=nn,i.selectAssetProcedureFieldsOfAssetProcedure=ip,i.selectAssetProcedureInstanceById=fs,i.selectAssetProcedureInstances=ys,i.selectAssetProcedureInstancesByIds=bp,i.selectAssetProcedureInstancesMapping=As,i.selectAssetProcedureInstancesOfAssetProcedure=On,i.selectAssetProcedureInstancesOfAssetType=gp,i.selectAssetProcedureStepById=rr,i.selectAssetProcedureStepFieldValues=ht,i.selectAssetProcedureStepFieldValuesAttachmentById=Jp,i.selectAssetProcedureStepFieldValuesAttachments=Wn,i.selectAssetProcedureStepFieldValuesAttachmentsByIds=Kn,i.selectAssetProcedureStepFieldValuesAttachmentsMapping=Es,i.selectAssetProcedureStepFieldValuesById=Vs,i.selectAssetProcedureStepFieldValuesMapping=tr,i.selectAssetProcedureStepFieldValuesOfAsset=Zp,i.selectAssetProcedureStepFieldValuesOfAssetProcedureInstance=xp,i.selectAssetProcedureStepFieldValuesOfAssetProcedureStep=eA,i.selectAssetProcedureStepFields=vs,i.selectAssetProcedureStepFieldsAttachmentById=Vp,i.selectAssetProcedureStepFieldsAttachments=Dn,i.selectAssetProcedureStepFieldsAttachmentsMapping=Cn,i.selectAssetProcedureStepFieldsById=Lp,i.selectAssetProcedureStepFieldsMapping=_s,i.selectAssetProcedureStepFieldsOfAssetProcedureStep=$p,i.selectAssetProcedureStepMapping=pt,i.selectAssetProcedureSteps=dr,i.selectAssetProcedureStepsByIds=Us,i.selectAssetProcedureStepsMappingOfAssetProcedure=aA,i.selectAssetProcedureStepsOfAssetProcedure=cA,i.selectAssetProcedures=En,i.selectAssetProceduresByIds=_p,i.selectAssetProceduresMapping=Ps,i.selectAssetProceduresOfOrganization=Op,i.selectAssetStageById=Rr,i.selectAssetStageCompletionById=gr,i.selectAssetStageCompletionMapping=Zs,i.selectAssetStageCompletions=oA,i.selectAssetStageCompletionsByIds=br,i.selectAssetStages=Or,i.selectAssetStagesByIds=ii,i.selectAssetStagesMappingOfAssetProcedure=pA,i.selectAssetStagesOfAssetProcedure=AA,i.selectAssetTypeAttachmentById=Vr,i.selectAssetTypeAttachmentMapping=jr,i.selectAssetTypeAttachments=Mr,i.selectAssetTypeById=bi,i.selectAssetTypeFieldValues=pi,i.selectAssetTypeFieldValuesAttachmentById=UA,i.selectAssetTypeFieldValuesAttachments=td,i.selectAssetTypeFieldValuesAttachmentsByIds=sd,i.selectAssetTypeFieldValuesAttachmentsMapping=oi,i.selectAssetTypeFieldValuesById=Ai,i.selectAssetTypeFieldValuesMapping=od,i.selectAssetTypeFieldValuesOfAsset=GA,i.selectAssetTypeFields=St,i.selectAssetTypeFieldsAttachmentById=RA,i.selectAssetTypeFieldsAttachments=Lr,i.selectAssetTypeFieldsAttachmentsMapping=Gr,i.selectAssetTypeFieldsById=MA,i.selectAssetTypeFieldsMapping=Xr,i.selectAssetTypeFieldsOfAssetType=qA,i.selectAssetTypeValuesOfAssetType=LA,i.selectAssetTypes=JA,i.selectAssetTypesByIds=XA,i.selectAssetTypesMapping=gi,i.selectAssets=lr,i.selectAssetsByIds=hr,i.selectAssetsMapping=Ns,i.selectAssetsOfAssetType=Hs,i.selectAttachmentsOfAsset=Mc,i.selectAttachmentsOfAssetProcedure=Nm,i.selectAttachmentsOfAssetProcedureFieldValues=mn,i.selectAttachmentsOfAssetProcedureFields=Xm,i.selectAttachmentsOfAssetProcedureStepFieldValues=Yn,i.selectAttachmentsOfAssetProcedureStepFields=Mp,i.selectAttachmentsOfAssetType=kr,i.selectAttachmentsOfAssetTypeFieldValues=id,i.selectAttachmentsOfAssetTypeFields=IA,i.selectAttachmentsOfDocument=ry,i.selectAttachmentsOfFormRevision=gy,i.selectAttachmentsOfFormSubmission=Fu,i.selectAttachmentsOfIssue=to,i.selectAttachmentsOfIssueComment=Wy,i.selectAttachmentsOfIssueType=ef,i.selectAttachmentsOfIssueTypeFieldValues=cl,i.selectAttachmentsOfIssueTypeFields=rf,i.selectAttachmentsOfProject=Ph,i.selectCategories=ty,i.selectCategoriesByIds=sy,i.selectCategoryById=Ii,i.selectCategoryMapping=Ti,i.selectCommentsOfIssue=Jy,i.selectConversation=Cm,i.selectConversationMapping=Xt,i.selectConversations=zm,i.selectCurrentUser=kt,i.selectDeletedRequests=TS,i.selectDocumentAttachmentById=jd,i.selectDocumentAttachmentMapping=Ed,i.selectDocumentById=Ud,i.selectDocuments=Dd,i.selectDocumentsByIds=dy,i.selectDocumentsMapping=ze,i.selectEmailDomains=Hd,i.selectEmailDomainsAsMapping=Nd,i.selectEmailDomainsOfOrganization=hy,i.selectFieldValuesOfAssetProcedureInstance=Ap,i.selectFormById=fu,i.selectFormMapping=yu,i.selectFormRevisionAttachmentsMapping=iu,i.selectFormRevisionById=Py,i.selectFormRevisionMapping=Tt,i.selectFormRevisions=ou,i.selectFormRevisionsOfForm=lu,i.selectFormSubmissionAttachemntsByIds=Pu,i.selectFormSubmissionAttachmentsMapping=Di,i.selectFormSubmissionById=Ni,i.selectFormSubmissions=Li,i.selectFormSubmissionsMapping=Gi,i.selectFormSubmissionsOfAsset=wu,i.selectFormSubmissionsOfForm=_u,i.selectFormSubmissionsOfIssue=vu,i.selectForms=Oy,i.selectGeoImageById=Ki,i.selectGeoImageMapping=Du,i.selectGeoImages=Uu,i.selectGeoImagesOfProject=ky,i.selectIsImportingProjectFile=kS,i.selectIsLoggedIn=ey,i.selectIssueAssociationById=Nu,i.selectIssueAssociationMapping=st,i.selectIssueAssociations=Uy,i.selectIssueAssociationsOfAsset=Ku,i.selectIssueAssociationsOfIssue=Wu,i.selectIssueAssociationsToIssue=Hu,i.selectIssueAttachmentById=so,i.selectIssueAttachmentMapping=xu,i.selectIssueAttachments=eo,i.selectIssueById=ma,i.selectIssueCommentAttachmentById=mo,i.selectIssueCommentAttachmentMapping=lo,i.selectIssueCommentAttachments=ho,i.selectIssueCommentById=ua,i.selectIssueCommentMapping=fo,i.selectIssueCountOfCategory=iy,i.selectIssueMapping=To,i.selectIssueTypeAttachmentById=Mo,i.selectIssueTypeAttachmentMapping=qo,i.selectIssueTypeAttachments=jo,i.selectIssueTypeById=_a,i.selectIssueTypeFieldValues=ba,i.selectIssueTypeFieldValuesAttachmentById=wf,i.selectIssueTypeFieldValuesAttachments=il,i.selectIssueTypeFieldValuesAttachmentsByIds=al,i.selectIssueTypeFieldValuesAttachmentsMapping=Ia,i.selectIssueTypeFieldValuesById=Pa,i.selectIssueTypeFieldValuesMapping=Ho,i.selectIssueTypeFieldValuesOfIssue=pf,i.selectIssueTypeFields=Et,i.selectIssueTypeFieldsAttachmentById=df,i.selectIssueTypeFieldsAttachments=Bo,i.selectIssueTypeFieldsAttachmentsMapping=$o,i.selectIssueTypeFieldsById=Tf,i.selectIssueTypeFieldsMapping=Zo,i.selectIssueTypeFieldsOfIssueType=bf,i.selectIssueTypeMapping=ll,i.selectIssueTypeValuesOfIssueType=Ff,i.selectIssueTypes=hl,i.selectIssueTypesByIds=Ef,i.selectIssueTypesOfOrganization=qf,i.selectIssueUpdateMapping=bl,i.selectIssueUpdatesOfIssue=Pl,i.selectIssuesByIds=Xy,i.selectIssuesOfIssueType=va,i.selectIssuesOfIssueTypeCount=jf,i.selectLatestAssetProcedureFieldsOfAssetProcedure=ap,i.selectLatestAssetProcedureStepFieldsOfAssetProcedureStep=Bp,i.selectLatestAssetTypeFieldsOfAssetType=jA,i.selectLatestFieldsByAssetProcedureStep=Gp,i.selectLatestFormRevisionOfForm=Fy,i.selectLatestIssueTypeFieldsOfIssueType=Pf,i.selectLatestRetryTime=IS,i.selectLicense=kf,i.selectLicenseForProject=Rl,i.selectLicenses=Vt,i.selectLicensesForProjectsMapping=Cf,i.selectLicensesOfOrganization=PS,i.selectNumberOfAssetsOfAssetType=uA,i.selectOrganizationAccessById=Xf,i.selectOrganizationAccessForUser=Zf,i.selectOrganizationAccessUserMapping=kl,i.selectOrganizationAccesses=Ma,i.selectOrganizationById=SS,i.selectOrganizationUsersAsMapping=ih,i.selectOrganizationUsersIds=sh,i.selectOrganizations=th,i.selectOrganizationsMapping=eh,i.selectOrganizationsWithAccess=gS,i.selectProjectAccessById=xf,i.selectProjectAccessForUser=eS,i.selectProjectAccessMapping=za,i.selectProjectAccessUserMapping=Gl,i.selectProjectAccesses=Bl,i.selectProjectAttachmentById=bh,i.selectProjectAttachmentMapping=Sh,i.selectProjectById=dS,i.selectProjectFileById=MS,i.selectProjectFileMapping=qh,i.selectProjectFiles=jh,i.selectProjectMapping=Dt,i.selectProjectUsersAsMapping=Ql,i.selectProjectUsersIds=Xl,i.selectProjects=rS,i.selectProjectsOfOrganization=bS,i.selectRehydrated=DS,i.selectRootDocuments=oy,i.selectSortedOrganizationUsers=FS,i.selectSortedProjectUsers=uS,i.selectStageMapping=ft,i.selectTeamById=$e,i.selectTeams=Ja,i.selectTeamsByIds=US,i.selectTeamsMapping=Ya,i.selectTeamsOfOrganization=$S,i.selectTeamsOfUser=BS,i.selectUploadUrl=Xd,i.selectUserById=Yf,i.selectUsersByIds=Jf,i.selectUsersMapping=zt,i.setActiveProjectFileId=wh,i.setAsset=rA,i.setAssetAttachment=_c,i.setAssetAttachments=Um,i.setAssetProcedure=Ip,i.setAssetProcedureAttachment=Dc,i.setAssetProcedureAttachments=Gm,i.setAssetProcedureFieldValues=hp,i.setAssetProcedureFieldValuesAttachment=rp,i.setAssetProcedureFieldValuesAttachments=dp,i.setAssetProcedureFieldValuesMany=mp,i.setAssetProcedureFields=xm,i.setAssetProcedureFieldsAttachment=Wm,i.setAssetProcedureFieldsAttachments=Km,i.setAssetProcedureFieldsMany=ep,i.setAssetProcedureInstance=fp,i.setAssetProcedureInstances=Sp,i.setAssetProcedureStep=cr,i.setAssetProcedureStepFieldValues=Xp,i.setAssetProcedureStepFieldValuesAttachment=Hp,i.setAssetProcedureStepFieldValuesAttachments=Wp,i.setAssetProcedureStepFieldValuesMany=Qp,i.setAssetProcedureStepFields=zp,i.setAssetProcedureStepFieldsAttachment=wp,i.setAssetProcedureStepFieldsAttachments=Ep,i.setAssetProcedureStepFieldsMany=Cp,i.setAssetProcedureSteps=tA,i.setAssetProcedures=Rp,i.setAssetStage=Tr,i.setAssetStages=lA,i.setAssetType=NA,i.setAssetTypeAttachment=wr,i.setAssetTypeAttachments=fA,i.setAssetTypeFieldValues=$A,i.setAssetTypeFieldValuesAttachment=kA,i.setAssetTypeFieldValuesAttachments=zA,i.setAssetTypeFieldValuesMany=BA,i.setAssetTypeFields=_A,i.setAssetTypeFieldsAttachment=bA,i.setAssetTypeFieldsAttachments=PA,i.setAssetTypeFieldsMany=vA,i.setAssetTypes=HA,i.setAssets=dA,i.setConversation=Tc,i.setCurrentUser=Wf,i.setDocumentAttachment=Od,i.setDocumentAttachments=cy,i.setDocuments=kd,i.setForm=Ty,i.setFormRevision=nu,i.setFormRevisionAttachment=Ay,i.setFormRevisionAttachments=yy,i.setFormSubmission=Ot,i.setFormSubmissionAttachment=vy,i.setFormSubmissionAttachments=wy,i.setFormSubmissions=jy,i.setGeoImage=tt,i.setGeoImages=Mu,i.setIsImportingProjectFile=vh,i.setIssueAssociation=Cy,i.setIssueAssociations=zy,i.setIssueAttachment=Xu,i.setIssueAttachments=By,i.setIssueComment=na,i.setIssueCommentAttachment=no,i.setIssueCommentAttachments=Ny,i.setIssueComments=yo,i.setIssueType=at,i.setIssueTypeAttachment=_o,i.setIssueTypeAttachments=Zy,i.setIssueTypeFieldValues=of,i.setIssueTypeFieldValuesAttachment=Rf,i.setIssueTypeFieldValuesAttachments=Of,i.setIssueTypeFieldValuesMany=lf,i.setIssueTypeFields=yf,i.setIssueTypeFieldsAttachment=sf,i.setIssueTypeFieldsAttachments=af,i.setIssueTypeFieldsMany=ff,i.setIssueUpdate=Mf,i.setLoggedIn=yd,i.setOrganization=lS,i.setOrganizations=xl,i.setProfilePicture=Kf,i.setProject=sS,i.setProjectAttachment=ph,i.setProjectAttachments=Ah,i.setProjectFile=vS,i.setProjectFiles=wS,i.setProjects=Hl,i.setRehydrated=CS,i.setTeam=Ue,i.setTokens=QA,i.setUploadUrl=Jd,i.setUser=Uf,i.setUsers=Df,i.shallowEqual=fm,i.slugify=jm,i.spacesToDashesLower=qm,i.teamReducer=Dh,i.teamSlice=Ha,i.toFileNameSafeString=Em,i.toOfflineIdRecord=Sc,i.truncate=Mm,i.updateAsset=Qe,i.updateAssetAttachment=$m,i.updateAssetAttachments=vc,i.updateAssetProcedure=Ye,i.updateAssetProcedureAttachment=Lm,i.updateAssetProcedureAttachments=Uc,i.updateAssetProcedureFieldValues=We,i.updateAssetProcedureFieldValuesAttachment=up,i.updateAssetProcedureFieldValuesAttachments=on,i.updateAssetProcedureFieldValuesMany=Sn,i.updateAssetProcedureFields=an,i.updateAssetProcedureFieldsAttachment=Ym,i.updateAssetProcedureFieldsAttachments=Jc,i.updateAssetProcedureFieldsMany=tp,i.updateAssetProcedureInstance=Ke,i.updateAssetProcedureInstances=yp,i.updateAssetProcedureStep=Cs,i.updateAssetProcedureStepFieldValues=Xe,i.updateAssetProcedureStepFieldValuesAttachment=Kp,i.updateAssetProcedureStepFieldValuesAttachments=Hn,i.updateAssetProcedureStepFieldValuesMany=xn,i.updateAssetProcedureStepFields=Je,i.updateAssetProcedureStepFieldsAttachment=qp,i.updateAssetProcedureStepFieldsAttachments=kn,i.updateAssetProcedureStepFieldsMany=Dp,i.updateAssetProcedureSteps=mt,i.updateAssetProcedures=Fp,i.updateAssetStage=ti,i.updateAssetStageCompletion=yr,i.updateAssetStageCompletions=fr,i.updateAssetStages=yt,i.updateAssetType=xe,i.updateAssetTypeAttachment=SA,i.updateAssetTypeAttachments=Er,i.updateAssetTypeFieldValues=Ze,i.updateAssetTypeFieldValuesAttachment=CA,i.updateAssetTypeFieldValuesAttachments=ed,i.updateAssetTypeFieldValuesMany=dd,i.updateAssetTypeFields=Yr,i.updateAssetTypeFieldsAttachment=FA,i.updateAssetTypeFieldsAttachments=$r,i.updateAssetTypeFieldsMany=wA,i.updateAssetTypes=KA,i.updateAssets=nA,i.updateCategory=bd,i.updateConversation=Ic,i.updateDocumentAttachment=ny,i.updateDocumentAttachments=_d,i.updateDocuments=Fe,i.updateForm=Ry,i.updateFormRevisionAttachment=fy,i.updateFormRevisionAttachments=tu,i.updateFormSubmission=Ou,i.updateFormSubmissionAttachment=Ey,i.updateFormSubmissionAttachments=bu,i.updateFormSubmissions=My,i.updateGeoImage=zu,i.updateGeoImages=Vy,i.updateIssue=wt,i.updateIssueAssociation=Lu,i.updateIssueAssociations=Dy,i.updateIssueAttachment=Gy,i.updateIssueAttachments=Qu,i.updateIssueCommentAttachment=Hy,i.updateIssueCommentAttachments=ro,i.updateIssueType=ol,i.updateIssueTypeAttachment=xy,i.updateIssueTypeAttachments=vo,i.updateIssueTypeFieldValues=it,i.updateIssueTypeFieldValuesAttachment=_f,i.updateIssueTypeFieldValuesAttachments=sl,i.updateIssueTypeFieldValuesMany=hf,i.updateIssueTypeFields=Xo,i.updateIssueTypeFieldsAttachment=cf,i.updateIssueTypeFieldsAttachments=Do,i.updateIssueTypeFieldsMany=Sf,i.updateLicense=be,i.updateOrganization=AS,i.updateOrganizationAccess=Ml,i.updateOrganizations=pS,i.updateProject=Wl,i.updateProjectAccess=Dl,i.updateProjectAttachment=_S,i.updateProjectAttachments=yh,i.updateProjectFile=La,i.updateProjectFiles=qS,i.updateProjects=cS,i.updateTeam=Wa,i.updateUser=Lf,i.updateUsers=Gf,i.userReducer=El,i.userSlice=qa,i.versioningReducer=$h,i.versioningSlice=Uh,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
|
|
14
|
+
external URLs and therefore not prepended with VITE_API_URL.`;throw new Error(T)}const p=m.type.split("/")[1];if(!p)throw new Error("File has no extension");const A=n??l+"."+p;if(m=Wa(m,A),!m.name)throw new Error("Failed to set file's name");await this.addCache(m,l),jt[c]=new Promise(T=>{T(m)})}return m}processPresignedUrls(e){const a={};for(const[n,c]of Object.entries(e))a[n]=this.enqueueRequest({url:c.url,description:"Upload file to S3",method:y.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:n,blockers:[`s3-${c.fields.key}`],blocks:[n],s3url:c});return a}async getFilePayload(e){const a=await et(e),n={sha1:a,file_type:e.type,extension:e.name.split(".").pop(),size:e.size};return await this.client.files.addCache(e,a),n}}class zg extends w{constructor(){super(...arguments);h(this,"name","Form Identifier");h(this,"url","/form-identifiers");h(this,"actions",{addOne:Dh,addMany:Uh,setOne:Ch,setMany:Lh,updateOne:Gh,updateMany:kh,deleteOne:Nh,deleteMany:Hh,initialize:$h});h(this,"selectors",{selectById:Kh,selectByIds:Yh})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Create form identifier",method:y.POST,url:`${this.url}/`,payload:R(d),blockers:[d.form],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(()=>{this.dispatch(this.actions.deleteOne(d.uuid))}),[d,r]}update(e){const{store:a}=this.client,n=this.selectors.selectById(e.uuid)(a.getState());if(!n)throw new Error(`Expected form identifier with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Update form identifier",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.setOne(n))}),[c,d]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected form identifier with uuid ${e} to exist`);this.dispatch(this.actions.deleteOne(e));try{return await this.enqueueRequest({description:"Delete form identifier",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(this.actions.addOne(c)),d}}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{form__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class Bg extends w{constructor(){super(...arguments);h(this,"name","Form Identifier Value");h(this,"url","/form-identifier-values");h(this,"actions",{addOne:Qh,addMany:xh,setOne:em,setMany:tm,updateOne:sm,updateMany:im,deleteOne:am,deleteMany:nm,initialize:Xh});h(this,"selectors",{selectById:dm,selectByIds:rm})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Create form identifier value",method:y.POST,url:`${this.url}/`,payload:R(d),blockers:[e.form_submission,e.form_identifier],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(()=>{this.dispatch(this.actions.deleteOne(d.uuid))}),[d,r]}update(e){const{store:a}=this.client,n=this.selectors.selectById(e.uuid)(a.getState());if(!n)throw new Error(`Expected form identifier value with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Update form identifier value",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.setOne(n))}),[c,d]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected form identifier value with uuid ${e} to exist`);this.dispatch(this.actions.deleteOne(e));try{return await this.enqueueRequest({description:"Delete form identifier value",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(this.actions.addOne(c)),d}}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{form_submission__form_revision__form__organization:e}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class jg extends z{constructor(){super(...arguments);h(this,"name","Form Revision Attachment");h(this,"url","/form-revision-attachments");h(this,"actions",{addOne:hm,addMany:mm,setOne:ym,setMany:pm,updateOne:Am,updateMany:fm,deleteOne:Sm,deleteMany:Tm,initialize:om});h(this,"selectors",{selectById:Om,selectByIds:Fm})}async bulkAdd(e){var m;const a=new Date().toISOString(),n=((m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id)??null,c={},d=[],r=[];for(const l of e){const{revisionUuid:p,fieldIdentifier:A,file:T}=l,I=await this.client.files.getFilePayload(T);I.sha1 in c||(c[I.sha1]=I);const _=F({file:URL.createObjectURL(T),file_type:T.type,file_name:T.name,file_sha1:I.sha1,created_by:n,form_revision:p,submitted_at:a,field_identifier:A});d.push(_);const M={uuid:_.uuid,file_name:T.name,field_identifier:A,file_extension:I.extension,file_sha1:I.sha1,form_revision:p};r.push(M)}this.dispatch(this.actions.addMany(d));const o=this.enqueueRequest({description:"Attach files to form revision",method:y.POST,url:`${this.url}/bulk/`,payload:{submitted_at:a,attachments:r,files:Object.values(c)},blockers:d.map(l=>l.form_revision),blocks:d.map(l=>l.uuid)});return o.then(l=>{this.client.files.processPresignedUrls(l.presigned_urls),this.dispatch(this.actions.setMany(l.attachments))}).catch(()=>{this.dispatch(this.actions.deleteMany(d.map(l=>l.uuid)))}),[d,o.then(({attachments:l})=>l)]}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{form_revision__form__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class qg extends w{constructor(){super(...arguments);h(this,"name","Form Revision");h(this,"url","/form-revisions");h(this,"actions",{addOne:ui,addMany:li,setOne:_m,setMany:Mm,updateOne:Rm,updateMany:wm,deleteOne:oi,deleteMany:hi,initialize:bm});h(this,"selectors",{selectById:vm,selectByIds:Em})}add(e){var m;const{store:a}=this.client,c=((m=a.getState().userReducer.currentUser)==null?void 0:m.id)??null,d=new Date().toISOString(),r=F({...e,created_by:c,submitted_at:d});this.dispatch(this.actions.addOne(r));const o=this.enqueueRequest({description:"Create form revision",method:y.POST,url:`${this.url}/`,payload:R(r),blockers:[e.form],blocks:[r.uuid]});return o.then(l=>{this.dispatch(this.actions.setOne(l))}).catch(()=>{this.dispatch(this.actions.deleteOne(r.uuid))}),[r,o]}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{form__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class $g extends w{constructor(){super(...arguments);h(this,"name","Form");h(this,"url","/forms");h(this,"actions",{addOne:qm,addMany:$m,setOne:Dm,setMany:Um,updateOne:Cm,updateMany:Lm,deleteOne:Gm,deleteMany:km,initialize:jm});h(this,"selectors",{selectById:Wm,selectByIds:Km})}add(e,a){var l;const{store:n}=this.client,c=new Date().toISOString(),d=((l=n.getState().userReducer.currentUser)==null?void 0:l.id)??null,r=F({...e,submitted_at:c,created_by:d}),o=F({...a,form:r.uuid,submitted_at:c,created_by:d});this.dispatch(this.actions.addOne(r)),this.dispatch(ui(o));const m=this.enqueueRequest({description:"Create form",method:y.POST,url:`${this.url}/`,payload:{...R(r),initial_revision:{uuid:o.uuid,submitted_at:o.submitted_at,title:o.title,description:o.description,fields:o.fields}},blockers:[],blocks:[r.uuid,o.uuid]});return m.catch(p=>{throw this.dispatch(this.actions.deleteOne(r.uuid)),this.dispatch(oi(o.uuid)),p}),[r,o,m]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error("Expected form to exist");const d=fy(e)(n);d.length>0&&this.dispatch(gi(d.map(({uuid:o})=>o)));const r=Vm(e)(n);r.length>0&&this.dispatch(hi(r.map(({uuid:o})=>o))),this.dispatch(this.actions.deleteOne(e));try{return await this.enqueueRequest({description:"Delete form",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(o){throw this.dispatch(this.actions.addOne(c)),r.length>0&&this.dispatch(li(r)),d.length>0&&this.dispatch(Pi(d)),o}}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class Dg extends z{constructor(){super(...arguments);h(this,"name","Form Submission Attachment");h(this,"url","/form-submission-attachments");h(this,"actions",{addOne:Jm,addMany:fi,setOne:Xm,setMany:Qm,updateOne:xm,updateMany:ey,deleteOne:ty,deleteMany:Si,initialize:Zm});h(this,"selectors",{selectById:sy,selectByIds:iy})}async bulkAdd(e){var m;const a=new Date().toISOString(),n=((m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id)??null,c={},d=[],r=[];for(const l of e){const{submissionUuid:p,fieldIdentifier:A,file:T}=l,I=await this.client.files.getFilePayload(T);I.sha1 in c||(c[I.sha1]=I);const _=F({file:URL.createObjectURL(T),file_type:T.type,file_name:T.name,file_sha1:I.sha1,created_by:n,form_submission:p,submitted_at:a,field_identifier:A});d.push(_);const M={uuid:_.uuid,file_name:T.name,file_sha1:I.sha1,file_extension:I.extension,field_identifier:A,form_submission:p};r.push(M)}this.dispatch(this.actions.addMany(d));const o=this.enqueueRequest({description:"Attach files to form submission",method:y.POST,url:`${this.url}/bulk/`,payload:{submitted_at:a,attachments:r,files:Object.values(c)},blockers:d.map(l=>l.form_submission),blocks:d.map(l=>l.uuid)});return o.then(l=>{this.client.files.processPresignedUrls(l.presigned_urls),this.dispatch(this.actions.setMany(l.attachments))}).catch(l=>{throw this.dispatch(this.actions.deleteMany(d.map(p=>p.uuid))),l}),[d,o.then(({attachments:l})=>l)]}async bulkDelete(e){const{store:a}=this.client,n=a.getState(),c=Oi(e)(n);this.dispatch(this.actions.deleteMany(e));try{await this.enqueueRequest({description:"Delete form submission attachments",method:y.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(this.actions.addMany(c)),d}}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{form_submission__form_revision__form__organization:e}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class Ug extends w{constructor(){super(...arguments);h(this,"name","Form Submission");h(this,"url","/form-submissions");h(this,"actions",{addOne:ly,addMany:Pi,setOne:ry,setMany:uy,updateOne:oy,updateMany:hy,deleteOne:my,deleteMany:gi,initialize:dy});h(this,"selectors",{selectById:py,selectByIds:Ay})}add(e){var m;const{store:a}=this.client,c=((m=a.getState().userReducer.currentUser)==null?void 0:m.id)??null,d=new Date().toISOString(),r=F({...e,created_by:c,submitted_at:d}),o=this.enqueueRequest({description:"Add form submission",method:y.POST,url:`${this.url}/`,payload:R(r),blockers:[e.form_revision],blocks:[r.uuid]});return this.dispatch(this.actions.addOne(r)),o.then(l=>(this.dispatch(this.actions.setOne(l)),l)).catch(()=>{this.dispatch(this.actions.deleteOne(r.uuid))}),[r,o]}update(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e.uuid)(n);if(!c)throw new Error(`Expected submission with uuid ${e.uuid} to exist`);const d={...c,...e};this.dispatch(this.actions.setOne(d));const r=this.enqueueRequest({description:"Delete user form submissions",method:y.PATCH,url:`${this.url}/${d.uuid}/`,payload:e,blockers:[d.uuid],blocks:[d.uuid]});return r.then(o=>{this.dispatch(this.actions.setOne(o))}).catch(()=>{this.dispatch(this.actions.setOne(c))}),[d,r]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const d=ay(e)(n);this.dispatch(this.actions.deleteOne(e)),this.dispatch(Si(d.map(r=>r.uuid)));try{return await this.enqueueRequest({description:"Delete user form submissions",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(this.actions.addOne(c)),this.dispatch(fi(d)),r}}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{limit:this.pageSize,paginate:!0,form_revision__form_organization:e}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class Cg extends w{constructor(){super(...arguments);h(this,"name","Geo Image");h(this,"url","/geo-images");h(this,"actions",{addOne:Py,addMany:gy,setOne:Oy,setMany:Fy,updateOne:by,updateMany:_y,deleteOne:My,deleteMany:Ry,initialize:Iy});h(this,"selectors",{selectById:vy,selectByIds:Ey})}async add(e){var A;const{store:a}=this.client,{file:n,...c}=e,d=new Date().toISOString(),r=((A=a.getState().userReducer.currentUser)==null?void 0:A.id)??null,o=c.project,m=await this.client.files.getFilePayload(n),l=F({...c,file_name:n.name,file_sha1:m.sha1,file_type:n.type,file:URL.createObjectURL(n),submitted_at:d,created_by:r});this.dispatch(this.actions.addOne(l));const p=this.enqueueRequest({description:"Add geo image",method:y.POST,url:`${this.url}/`,payload:{uuid:l.uuid,submitted_at:d,title:l.title,description:l.description,geo_marker:l.geo_marker,canvas_marker:l.canvas_marker,sha1:l.file_sha1,project:l.project,file_name:l.file_name,direction:l.direction,original_date:l.original_date,file:m},blocks:[o],blockers:[o]});return p.then(T=>{this.client.files.processPresignedUrls(T.presigned_urls),this.dispatch(this.actions.setOne(T.geo_image))}).catch(()=>{this.dispatch(this.actions.deleteOne(l.uuid))}),[l,p.then(T=>T.geo_image)]}async bulkAdd(e,a){var A;const{store:n}=this.client,c=new Date().toISOString(),d=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,r=[],o=[],m=[],l={};for(const T of e){const{file:I,..._}=T,M=await this.client.files.getFilePayload(I);M.sha1 in l||(l[M.sha1]=M);const g=F({..._,file_name:I.name,file_sha1:M.sha1,file_type:I.type,file:URL.createObjectURL(I),submitted_at:c,created_by:d,project:a});r.push(g),o.push(g.uuid),m.push({uuid:g.uuid,sha1:g.file_sha1,file_name:g.file_name,title:g.title,description:g.description,geo_marker:g.geo_marker,canvas_marker:g.canvas_marker,direction:g.direction,original_date:g.original_date})}this.dispatch(this.actions.addMany(r));const p=this.enqueueRequest({description:"Bulk add geo images",method:y.POST,url:`${this.url}/bulk/`,payload:{submitted_at:c,project:a,geo_images:m,files:Object.values(l)},blocks:[a],blockers:o});return p.then(T=>{this.client.files.processPresignedUrls(T.presigned_urls),this.dispatch(this.actions.setMany(T.geo_images))}).catch(()=>{this.dispatch(this.actions.deleteMany(o))}),[r,p.then(T=>T.geo_images)]}update(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e.uuid)(n);if(!c)throw new Error(`Map image with uuid ${e.uuid} does not exist in the store`);const d={...c,...e};this.dispatch(this.actions.setOne(d));const r=this.enqueueRequest({description:"Update geo image",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return r.then(o=>{this.dispatch(this.actions.setOne(o))}).catch(()=>{this.dispatch(this.actions.setOne(c))}),[d,r]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Map image with uuid ${e} does not exist in the store`);this.dispatch(this.actions.deleteOne(e));const d=this.enqueueRequest({description:"Delete geo image",method:y.DELETE,url:`${this.url}/${e}/`,blocks:[e],blockers:[e]});return d.catch(()=>{this.dispatch(this.actions.setOne(c))}),d}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{project:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class Lg extends w{constructor(){super(...arguments);h(this,"name","Issue Association");h(this,"url","/issue-associations");h(this,"actions",{addOne:Uy,addMany:bt,setOne:qy,setMany:jy,updateOne:$y,updateMany:Dy,deleteOne:Cy,deleteMany:_t,initialize:By});h(this,"selectors",{selectById:Gy,selectByIds:ky})}add(e){var o;const{store:a}=this.client,n=new Date().toISOString(),c=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,d=F({...e,submitted_at:n,created_by:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Add issue association",method:y.POST,url:`${this.url}/`,payload:R(d),blockers:[e.associated_issue,...e.issue?[e.issue]:[],...e.asset?[e.asset]:[]],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(()=>{this.dispatch(this.actions.deleteOne(d.uuid))}),[d,r]}async delete(e){const{store:a}=this.client,n=this.selectors.selectById(e)(a.getState());if(!n)throw new Error(`Issue association with uuid ${e} not found in store.`);this.dispatch(this.actions.deleteOne(e));const c=this.enqueueRequest({description:"Delete issue association",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return c.catch(()=>{this.dispatch(this.actions.addOne(n))}),c}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{associated_issue__project:e}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class Gg extends z{constructor(){super(...arguments);h(this,"name","Issue Attachment");h(this,"url","/issue-attachments");h(this,"actions",{addOne:Jy,addMany:vi,setOne:Xy,setMany:Qy,updateOne:xy,updateMany:ep,deleteOne:tp,deleteMany:Ei,initialize:Zy});h(this,"selectors",{selectById:ap,selectByIds:np})}getId(e){return e.uuid}buildModel(e){return F({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,issue:e.modelUuid})}buildPayload(e,a){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:a.extension,issue:e.issue}}async bulkAdd(e){return this._bulkAdd(e.map(a=>({modelUuid:a.issueUuid,file:a.file})))}async delete(e){return this._delete(e)}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{issue__project:e}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class kg extends z{constructor(){super(...arguments);h(this,"name","Issue Comment Attachment");h(this,"url","/issue-comment-attachments");h(this,"actions",{addOne:up,addMany:lp,setOne:op,setMany:hp,updateOne:mp,updateMany:yp,deleteOne:pp,deleteMany:Ap,initialize:rp});h(this,"selectors",{selectById:Sp,selectByIds:Tp})}getId(e){return e.uuid}buildModel(e){return F({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,issue_comment:e.modelUuid})}buildPayload(e,a){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:a.extension,issue_comment:e.issue_comment}}async bulkAdd(e){return this._bulkAdd(e.map(a=>({modelUuid:a.issueCommentUuid,file:a.file})))}async delete(e){return this._delete(e)}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{issue_comment__issue__project:e}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class Ng extends w{constructor(){super(...arguments);h(this,"name","Issue Comment");h(this,"url","/issue-comments");h(this,"actions",{addOne:Pp,addMany:gp,setOne:bp,setMany:_p,updateOne:Mp,updateMany:Rp,deleteOne:wp,deleteMany:vp,initialize:Fp});h(this,"selectors",{selectById:Ep,selectByIds:Vp})}add(e){const{store:a}=this.client,n=F({...e,author:a.getState().userReducer.currentUser.id,submitted_at:new Date().toISOString()});this.dispatch(this.actions.addOne(n));const c=this.enqueueRequest({description:"Add issue comment",method:y.POST,url:`${this.url}/`,payload:R(n),blockers:[e.issue],blocks:[n.uuid]});return c.catch(()=>{this.dispatch(this.actions.deleteOne(n.uuid))}),[n,c]}update(e){const{store:a}=this.client,n=this.selectors.selectById(e.uuid)(a.getState());if(!n)throw new Error(`Comment with uuid ${e.uuid} not found in store`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Edit issue comment",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.catch(()=>{this.dispatch(this.actions.setOne(n))}),[c,d]}remove(e){const{store:a}=this.client,n=this.selectors.selectById(e)(a.getState());if(!n)throw new Error(`Comment with uuid ${e} not found in store`);this.dispatch(this.actions.deleteOne(e));const c=this.enqueueRequest({description:"Delete comment",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return c.catch(()=>{this.dispatch(this.actions.addOne(n))}),c}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{issue__project:e}},a);return this.dispatch(this.actions.setMany(n)),n}}class Hg extends w{constructor(){super(...arguments);h(this,"name","Issue");h(this,"url","/issues");h(this,"actions",{addOne:qp,addMany:Di,setOne:$p,setMany:Dp,updateOne:Up,updateMany:Cp,deleteOne:Lp,deleteMany:Ui,initialize:jp});h(this,"selectors",{selectById:kp,selectByIds:Np})}add(e){var m;const{store:a}=this.client,n=a.getState(),c=new Date().toISOString(),d=((m=n.userReducer.currentUser)==null?void 0:m.id)??null,r=F({...e,submitted_at:c,created_by:d});this.dispatch(this.actions.addOne(r));const o=this.enqueueRequest({description:"Create issue",method:y.POST,url:`${this.url}/`,payload:R(r),blockers:[r.project,r.issue_type,...r.category?[r.category]:[]],blocks:[r.uuid]});return o.then(l=>{this.dispatch(this.actions.setOne(l))}).catch(l=>{throw this.dispatch(this.actions.deleteOne(r.uuid)),l}),[r,o]}update(e){var m;const a=this.client.store.getState(),n=this.selectors.selectById(e.uuid)(a);if(!n)throw new Error(`Attempting to update an issue with uuid ${e.uuid} that doesn't exist in the store`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d={};for(const l of[B.TITLE,B.DESCRIPTION,B.STATUS,B.CATEGORY,B.PRIORITY,B.ASSIGNED_TO,B.DUE_DATE])if(l in e&&e[l]!==n[l])switch(l){case B.PRIORITY:d[l]=e[l];break;case B.DUE_DATE:d[l]=e[l];break;case B.DESCRIPTION:d[l]=e[l];break;case B.TITLE:d[l]=e[l];break;case B.STATUS:{const p=e[l],A=ia(p)(a);if(!A)throw new Error(`Trying to update issue type status with ${p} which does not exist in store`);d[l]={name:A.name,color:A.color,uuid:A.uuid};break}case B.CATEGORY:{const p=e[l];if(p===null)d[l]=null;else{const A=Xs(p)(a);if(!A)throw new Error(`Trying to update category with ${p} which does not exist in store.`);d[l]={name:A.name,color:A.color,uuid:A.uuid}}break}case B.ASSIGNED_TO:{const p=e[l];if(p===null)d[l]=null;else{const A=Et(p)(a);if(!A)throw new Error(`Trying to update assigned to with ${p} which does not exist in store.`);d[l]={full_name:A.username,id:A.id}}break}}const r=F({created_by:((m=a.userReducer.currentUser)==null?void 0:m.id)??null,submitted_at:new Date().toISOString(),issue:n.uuid,changes:d});this.dispatch(na(r));const o=this.enqueueRequest({description:"Edit issue",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return o.catch(()=>{this.dispatch(this.actions.setOne(n)),this.dispatch(da(r.uuid))}),[c,o]}async remove(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`No issue with uuid ${e} found in the store`);const d=ip(e)(n),r=SS(e)(n),o={};for(const l of Ny(e)(n))o[l.uuid]=l;for(const l of Hy(e)(n))o[l.uuid]=l;const m=Object.values(o);this.dispatch(this.actions.deleteOne(e)),d.length>0&&this.dispatch(Ei(d.map(({uuid:l})=>l))),r.length>0&&this.dispatch(ra(r.map(({uuid:l})=>l))),m.length>0&&this.dispatch(_t(m.map(({uuid:l})=>l)));try{return await this.enqueueRequest({description:"Delete issue",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(l){throw this.dispatch(this.actions.addOne(c)),this.dispatch(vi(d)),this.dispatch(ca(r)),this.dispatch(bt(m)),l}}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{project:e}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class Wg extends z{constructor(){super(...arguments);h(this,"name","Issue Type Attachment");h(this,"url","/issue-type-attachments");h(this,"actions",{addOne:Zp,addMany:Jp,setOne:Xp,setMany:Qp,updateOne:xp,updateMany:eA,deleteOne:tA,deleteMany:sA,initialize:Yp});h(this,"selectors",{selectById:aA,selectByIds:nA})}getId(e){return e.uuid}buildModel(e){return F({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,issue_type:e.modelUuid})}buildPayload(e,a){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:a.extension,issue_type:e.issue_type}}async bulkAdd(e){return this._bulkAdd(e.map(a=>({modelUuid:a.issueTypeUuid,file:a.file})))}async delete(e){return this._delete(e)}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{issue_type__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class Kg extends z{constructor(){super(...arguments);h(this,"name","Issue Type Fields Attachment");h(this,"url","/issue-type-fields-attachments");h(this,"actions",{addOne:uA,addMany:lA,setOne:oA,setMany:hA,updateOne:mA,updateMany:yA,deleteOne:pA,deleteMany:AA,initialize:rA});h(this,"selectors",{selectById:SA,selectByIds:TA})}async bulkAdd(e){var m;const a=new Date().toISOString(),n=((m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id)??null,c={},d=[],r=[];for(const l of e){const{fieldsRevisionUuid:p,fieldIdentifier:A,file:T}=l,I=await this.client.files.getFilePayload(T);I.sha1 in c||(c[I.sha1]=I);const _=F({file:URL.createObjectURL(T),file_type:T.type,file_name:T.name,file_sha1:I.sha1,created_by:n,fields_revision:p,submitted_at:a,field_identifier:A});d.push(_);const M={uuid:_.uuid,file_name:T.name,file_extension:I.extension,field_identifier:A,file_sha1:I.sha1,fields_revision:p};r.push(M)}this.dispatch(this.actions.addMany(d));const o=this.enqueueRequest({description:"Add issue type fields attachments",method:y.POST,url:`${this.url}/bulk/`,payload:{submitted_at:a,attachments:r,files:Object.values(c)},blockers:d.map(l=>l.fields_revision),blocks:d.map(l=>l.uuid)});return o.then(l=>{this.client.files.processPresignedUrls(l.presigned_urls),this.dispatch(this.actions.setMany(l.attachments))}).catch(()=>{this.dispatch(this.actions.deleteMany(d.map(l=>l.uuid)))}),[d,o.then(({attachments:l})=>l)]}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{fields_revision__issue_type__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class Yg extends w{constructor(){super(...arguments);h(this,"name","Issue Type Fields");h(this,"url","/issue-type-fields");h(this,"actions",{addOne:$A,addMany:DA,setOne:UA,setMany:CA,updateOne:LA,updateMany:GA,deleteOne:kA,deleteMany:NA,initialize:qA});h(this,"selectors",{selectById:WA,selectByIds:KA})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Add Issue Type Fields",method:y.POST,url:`${this.url}/`,payload:R(d),blockers:[d.issue_type],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(m=>{throw this.dispatch(this.actions.deleteOne(d.uuid)),m}),[d,r]}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{issue_type__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class Zg extends z{constructor(){super(...arguments);h(this,"name","Issue Type Field Values Attachment");h(this,"url","/issue-type-field-values-attachments");h(this,"actions",{addOne:XA,addMany:Ki,setOne:QA,setMany:xA,updateOne:ef,updateMany:tf,deleteOne:sf,deleteMany:Yi,initialize:JA});h(this,"selectors",{selectById:nf,selectByIds:cf})}async bulkAdd(e){var m;const a=new Date().toISOString(),n=((m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id)??null,c={},d=[],r=[];for(const l of e){const{fieldValuesUuid:p,fieldIdentifier:A,file:T}=l,I=await this.client.files.getFilePayload(T);I.sha1 in c||(c[I.sha1]=I);const _=F({file:URL.createObjectURL(T),file_type:T.type,file_name:T.name,file_sha1:I.sha1,created_by:n,field_values:p,submitted_at:a,field_identifier:A});d.push(_);const M={uuid:_.uuid,file_name:T.name,file_sha1:I.sha1,file_extension:I.extension,field_identifier:A,field_values:p};r.push(M)}this.dispatch(this.actions.addMany(d));const o=this.enqueueRequest({description:"Add issue type field values attachments",method:y.POST,url:`${this.url}/bulk/`,payload:{submitted_at:a,attachments:r,files:Object.values(c)},blockers:d.map(l=>l.field_values),blocks:d.map(l=>l.uuid)});return o.then(({presigned_urls:l,attachments:p})=>{this.client.files.processPresignedUrls(l),this.dispatch(this.actions.setMany(p))}).catch(l=>{throw this.dispatch(this.actions.deleteMany(d.map(p=>p.uuid))),l}),[d,o.then(({attachments:l})=>l)]}async bulkDelete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectByIds(e)(n);this.dispatch(this.actions.deleteMany(e));try{await this.enqueueRequest({description:"Delete issue type field values attachments",method:y.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(this.actions.addMany(c)),d}}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{field_values__issue__project:e,latest:!0}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class Jg extends w{constructor(){super(...arguments);h(this,"name","Issue Type Field Values");h(this,"url","/issue-type-field-values");h(this,"actions",{addOne:PA,addMany:gA,setOne:bA,setMany:_A,updateOne:MA,updateMany:RA,deleteOne:wA,deleteMany:vA,initialize:FA});h(this,"selectors",{selectById:VA,selectByIds:zA})}add(e){var m;const{store:a}=this.client,c=((m=a.getState().userReducer.currentUser)==null?void 0:m.id)??null,d=new Date().toISOString(),r=F({...e,created_by:c,submitted_at:d}),o=this.enqueueRequest({description:"Add issue type field values",method:y.POST,url:`${this.url}/`,payload:R(r),blockers:[e.issue,e.fields_revision],blocks:[r.uuid]});return this.dispatch(this.actions.addOne(r)),o.then(l=>(this.dispatch(this.actions.setOne(l)),l)).catch(()=>{this.dispatch(this.actions.deleteOne(r.uuid))}),[r,o]}update(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e.uuid)(n);if(!c)throw new Error(`Expected IssueTypeFieldValues with uuid ${e.uuid} to exist`);const d={...c,...e};this.dispatch(this.actions.setOne(d));const r=this.enqueueRequest({description:"Update issue type field values",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[d.uuid,d.fields_revision,d.issue],blocks:[d.uuid]});return r.then(o=>{this.dispatch(this.actions.setOne(o))}).catch(()=>{this.dispatch(this.actions.setOne(c))}),[d,r]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const d=df(e)(n);this.dispatch(this.actions.deleteOne(e)),this.dispatch(Yi(d.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete issue type field values",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(this.actions.addOne(c)),this.dispatch(Ki(d)),r}}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{issue__project:e,latest:!0}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class Xg extends w{constructor(){super(...arguments);h(this,"name","Issue Type Identifier");h(this,"url","/issue-type-identifiers");h(this,"actions",{addOne:of,addMany:hf,setOne:mf,setMany:yf,updateOne:pf,updateMany:Af,deleteOne:ff,deleteMany:Sf,initialize:lf});h(this,"selectors",{selectById:If,selectByIds:Of})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Create issue type identifier",method:y.POST,url:`${this.url}/`,payload:R(d),blockers:[d.issue_type],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(()=>{this.dispatch(this.actions.deleteOne(d.uuid))}),[d,r]}update(e){const{store:a}=this.client,n=this.selectors.selectById(e.uuid)(a.getState());if(!n)throw new Error(`Expected issue type identifier with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Update issue type identifier",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.setOne(n))}),[c,d]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected issue type identifier with uuid ${e} to exist`);this.dispatch(this.actions.deleteOne(e));try{return await this.enqueueRequest({description:"Delete issue type identifier",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(this.actions.addOne(c)),d}}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{issue_type__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class Qg extends w{constructor(){super(...arguments);h(this,"name","Issue Type Identifier Value");h(this,"url","/issue-type-identifier-values");h(this,"actions",{addOne:bf,addMany:_f,setOne:Mf,setMany:Rf,updateOne:wf,updateMany:vf,deleteOne:Ef,deleteMany:Vf,initialize:gf});h(this,"selectors",{selectById:Bf,selectByIds:jf})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Create issue type identifier value",method:y.POST,url:`${this.url}/`,payload:R(d),blockers:[e.issue,e.issue_type_identifier],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(()=>{this.dispatch(this.actions.deleteOne(d.uuid))}),[d,r]}update(e){const{store:a}=this.client,n=this.selectors.selectById(e.uuid)(a.getState());if(!n)throw new Error(`Expected issue type identifier value with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Update issue type identifier value",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.setOne(n))}),[c,d]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected issue type identifier value with uuid ${e} to exist`);this.dispatch(this.actions.deleteOne(e));try{return await this.enqueueRequest({description:"Delete issue type identifier value",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(this.actions.addOne(c)),d}}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{issue__project:e}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class xg extends w{constructor(){super(...arguments);h(this,"name","Issue Type");h(this,"url","/issue-types");h(this,"actions",{addOne:Uf,addMany:Cf,setOne:Lf,setMany:Gf,updateOne:kf,updateMany:Nf,deleteOne:Hf,deleteMany:Wf,initialize:Df});h(this,"selectors",{selectById:Yf,selectByIds:Zf})}add(e){var m;const{store:a}=this.client,c=((m=a.getState().userReducer.currentUser)==null?void 0:m.id)??null,d=new Date().toISOString(),r=F({...e,submitted_at:d,created_by:c});this.dispatch(this.actions.addOne(r));const o=this.enqueueRequest({method:y.POST,url:`${this.url}/`,payload:R(r),blockers:[],blocks:[r.uuid]});return o.then(l=>{this.dispatch(this.actions.setOne(l))}).catch(()=>{this.dispatch(this.actions.deleteOne(r.uuid))}),[r,o]}update(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e.uuid)(n);if(!c)throw new Error(`IssueType with uuid ${e.uuid} does not exist in the store.`);const d={...c,...e};this.dispatch(this.actions.setOne(d));const r=this.enqueueRequest({method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(o=>{this.dispatch(this.actions.setOne(o))}).catch(()=>{this.dispatch(this.actions.setOne(c))}),[d,r]}delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`IssueType with uuid ${e} does not exist in the store.`);const d=Hp(e)(n);this.dispatch(this.actions.deleteOne(e)),this.dispatch(Ui(d.map(o=>o.uuid)));const r=this.enqueueRequest({method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return r.catch(()=>{this.dispatch(this.actions.setOne(c)),this.dispatch(Di(d))}),r}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class eb extends w{constructor(){super(...arguments);h(this,"name","Issue Type Status");h(this,"url","/issue-type-statuses");h(this,"actions",{addOne:xf,addMany:eS,setOne:tS,setMany:sS,updateOne:iS,updateMany:aS,deleteOne:nS,deleteMany:cS,initialize:Qf});h(this,"selectors",{selectById:ia,selectByIds:rS})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Create Issue Type Status",method:y.POST,url:`${this.url}/`,payload:R(d),blockers:[e.issue_type],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(()=>{this.dispatch(this.actions.deleteOne(d.uuid))}),[d,r]}update(e){const a=this.client.store.getState(),n=this.selectors.selectById(e.uuid)(a);if(!n)throw new Error(`Expected an existing issue type status with uuid ${e.uuid}`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Edit Issue Type Status",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.setOne(n))}),[c,d]}delete(e){const{store:a}=this.client,n=this.selectors.selectById(e)(a.getState());if(!n)throw new Error(`No issue type status with uuid ${e} found in the store`);this.dispatch(this.actions.deleteOne(e));const c=this.enqueueRequest({description:"Delete Issue Type Status",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return c.catch(()=>{this.dispatch(this.actions.addOne(n))}),c}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{issue_type__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class tb extends w{constructor(){super(...arguments);h(this,"name","Issue Update");h(this,"url","/issue-updates");h(this,"actions",{addOne:na,addMany:ca,setOne:hS,setMany:mS,updateOne:yS,updateMany:pS,deleteOne:da,deleteMany:ra,initialize:oS});h(this,"selectors",{selectById:AS,selectByIds:fS})}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{issue__project:e}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}const sb=1800;function ib(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 ab extends xP{constructor(){super(...arguments);h(this,"_getRenewedTokens",async e=>{const a=this.performRequest({method:y.POST,url:this.refreshTokensUrl,payload:{refresh:e},isAuthNeeded:!1,checkAuth:!1});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(Ro(!1)),this.clearTokens(),this.dispatch(O()),this.dispatch(O())}async renewTokens(){const e=this.getRefreshToken();if(!e)throw new Error("No refresh token found");console.debug(this.constructor.name,"renewing tokens");try{const a=await this._getRenewedTokens(e);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 e=this.getAccessToken();if(!e)return!1;const a=Date.now()/1e3;let n;try{n=MO(e).exp??a}catch{n=a}return n-a<sb}getAuthHeader(){return`Bearer ${this.getAccessToken()}`}async prepareAuth(){if(this.tokenIsExpiringSoon()){console.debug(this.constructor.name,"preparing auth");try{await this.renewTokens()}catch(e){return e instanceof q&&this.clearAuth(),e instanceof Error?Promise.reject(e):Promise.reject(new Error((e??tt).toString()))}}}async handleUnauthorized(e,a){const n=this.client.store.getState();if(e.url.endsWith("/token/refresh/"))throw n.authReducer.isLoggedIn&&console.warn("No signed-in user to sign out."),this.clearAuth(),new q({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 q({message:"Incorrect username or password.",response:a,discard:!0})}async initAuth(e){const a=xe.v4();return console.debug(this.constructor.name,"Initiating auth"),this.performRequest({uuid:a,method:y.POST,url:this.initTokensUrl,payload:e,isAuthNeeded:!1,checkAuth:!1}).then(n=>{this.setTokens(ib(n))})}}class nb extends st{constructor(){super(...arguments);h(this,"name","Organization Access");h(this,"url","/organization-accesses");h(this,"actions",{addOne:zS,addMany:BS,setOne:jS,setMany:qS,updateOne:$S,updateMany:DS,deleteOne:US,deleteMany:CS,initialize:VS});h(this,"selectors",{selectById:GS,selectByIds:kS})}update(e){const{store:a}=this.client,n=this.selectors.selectById(e.uuid)(a.getState()),c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Edit organization access",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(r=>{throw this.dispatch(this.actions.setOne(n)),r}),[c,d]}async remove(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n),d=Et(c.user)(n);this.dispatch(this.actions.deleteOne(c.uuid)),this.dispatch(ma(c.user));try{await this.enqueueRequest({description:"Remove organization access",method:y.DELETE,url:`${this.url}/${c.uuid}/`,blockers:[c.uuid],blocks:[]})}catch(r){throw this.dispatch(this.actions.addOne(c)),this.dispatch(ha(d)),r}}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class cb extends st{constructor(){super(...arguments);h(this,"name","Organization");h(this,"url","/organizations");h(this,"actions",{addOne:JS,addMany:ZS,setOne:YS,setMany:KS,updateOne:QS,updateMany:XS,deleteOne:xS,deleteMany:eT,initialize:WS});h(this,"selectors",{selectById:iT,selectByIds:aT})}async add(e){const a=await this.enqueueRequest({description:"Create organization",method:y.POST,url:`${this.url}/`,payload:e,blockers:[],blocks:[]});return this.dispatch(this.actions.addOne(a)),a}async update(e){const a=await this.enqueueRequest({description:"Edit organization",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return this.dispatch(this.actions.setOne(a)),a}async invite(e,a){return this.enqueueRequest({description:"Invite user to organization",method:y.POST,url:`${this.url}/${e}/invite/${a}/`,blockers:[],blocks:[]})}async refreshStore(e){const a=await this.performRequest({method:y.GET,url:`${this.url}/`},e);return this.dispatch(this.actions.initialize(a)),a}}class db extends w{constructor(){super(...arguments);h(this,"name","Project Access");h(this,"url","/project-accesses");h(this,"actions",{addOne:yT,addMany:pT,setOne:AT,setMany:fT,updateOne:ST,updateMany:TT,deleteOne:IT,deleteMany:OT,initialize:mT});h(this,"selectors",{selectById:PT,selectByIds:gT})}add(e){var d;const{store:a}=this.client,n=F({...e,created_by:((d=a.getState().userReducer.currentUser)==null?void 0:d.id)??null});this.dispatch(this.actions.addOne(n));const c=this.enqueueRequest({description:"Add project access",method:y.POST,url:`${this.url}/`,payload:R(n),blockers:[n.organization_access,n.project],blocks:[n.uuid]});return c.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(r=>{throw this.dispatch(this.actions.deleteOne(n.uuid)),r}),[n,c]}bulkAdd(e){var r;const{store:a}=this.client,n=((r=a.getState().userReducer.currentUser)==null?void 0:r.id)??null,c=e.map(o=>F({...o,created_by:n}));this.dispatch(this.actions.addMany(c));const d=this.enqueueRequest({description:"Add project accesses",method:y.POST,url:`${this.url}/bulk/`,payload:{project_accesses:c.map(o=>R(o))},blockers:c.flatMap(o=>[o.project,o.organization_access]),blocks:c.map(o=>o.uuid)});return d.then(o=>{this.dispatch(this.actions.setMany(o))}).catch(o=>{throw this.dispatch(this.actions.deleteMany(c.map(m=>m.uuid))),o}),[c,d]}update(e){const{store:a}=this.client,n=this.selectors.selectById(e.uuid)(a.getState()),c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Edit project access",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(r=>{throw this.dispatch(this.actions.setOne(n)),r}),[c,d]}async remove(e){const{store:a}=this.client,n=this.selectors.selectById(e)(a.getState());this.dispatch(this.actions.deleteOne(e));try{await this.enqueueRequest({description:"Delete project access",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(this.actions.addOne(n)),c}}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{project__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class rb extends z{constructor(){super(...arguments);h(this,"name","Project Attachment");h(this,"url","/project-attachments");h(this,"actions",{addOne:MT,addMany:RT,setOne:wT,setMany:vT,updateOne:ET,updateMany:VT,deleteOne:zT,deleteMany:BT,initialize:_T});h(this,"selectors",{selectById:qT,selectByIds:$T})}getId(e){return e.uuid}buildModel(e){return F({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,project:e.modelUuid})}buildPayload(e,a){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:a.extension,project:e.project}}async bulkAdd(e){return this._bulkAdd(e.map(a=>({modelUuid:a.projectUuid,file:a.file})))}async delete(e){return this._delete(e)}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{project__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class ub extends w{constructor(){super(...arguments);h(this,"name","Project File");h(this,"url","/project-files");h(this,"actions",{addOne:kT,addMany:NT,setOne:LT,setMany:GT,updateOne:HT,updateMany:WT,deleteOne:KT,deleteMany:YT,initialize:CT});h(this,"selectors",{selectById:eI,selectByIds:tI})}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 a={...e};delete a.file;const n=this.enqueueRequest({method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:a,blockers:[e.uuid],blocks:[e.uuid]});return n.then(c=>{this.dispatch(this.actions.setOne(c))}),n}saveActive(){const{store:e}=this.client,a=e.getState(),n=a.projectFileReducer.activeProjectFileId;if(!n)throw new Error("No active project file");const c=a.projectFileReducer.instances[n];if(!c)throw new Error("No active project file");if(!c.bounds&&!c.canvas_bounds)throw new Error("Project file must either have bounds or canvas_bounds set");let d;if(typeof c.file=="string"&&!c.file.startsWith("blob:")){const m={...c};delete m.file,d={method:y.PATCH,url:`${this.url}/${n}/`,payload:m,blockers:[n],blocks:[n]}}else d=new Promise((m,l)=>{this.client.files.uploadFileToS3(c.file_sha1).then(([p])=>{m({method:y.POST,url:`${this.url}/`,payload:{...c,...p},blockers:[n],blocks:[n]})}).catch(l)});const o=Promise.resolve(d).then(m=>this.enqueueRequest(m));return o.then(m=>{this.dispatch(this.actions.setOne(m))}),this.dispatch(XT),this.dispatch(JT(null)),this.dispatch(ZT(!1)),[c,o]}delete(e){return this.dispatch(this.actions.deleteOne(e)),this.enqueueRequest({method:y.DELETE,url:`${this.url}/${e}`,blockers:[e],blocks:[]})}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{project:e}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class lb extends st{constructor(){super(...arguments);h(this,"name","Project");h(this,"url","/projects");h(this,"actions",{addOne:rI,addMany:dI,setOne:cI,setMany:nI,updateOne:lI,updateMany:uI,deleteOne:oI,deleteMany:hI,initialize:aI});h(this,"selectors",{selectById:pI,selectByIds:AI})}async add(e){const{addOne:a}=this.actions,n=await this.performRequest({method:y.POST,url:`${this.url}/`,payload:R(e)});return this.dispatch(a(n)),n}async update(e){const{updateOne:a}=this.actions,n=await this.performRequest({method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:R(e)});return this.dispatch(a(n)),n}async delete(e){const{deleteOne:a}=this.actions,n=await this.enqueueRequest({description:"Delete project",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return this.dispatch(a(e)),n}async refreshStore(e,a){const{initialize:n}=this.actions,c=await this.list({queryParams:{organization:e}},a);return this.dispatch(n(c)),c}}class ob extends w{constructor(){super(...arguments);h(this,"name","Team Membership");h(this,"url","/team-memberships");h(this,"actions",{addOne:II,addMany:OI,setOne:FI,setMany:PI,updateOne:gI,updateMany:bI,deleteOne:_I,deleteMany:MI,initialize:TI});h(this,"selectors",{selectById:vI,selectByIds:EI})}add(e){var d;const{store:a}=this.client,n=F({...e,created_by:((d=a.getState().userReducer.currentUser)==null?void 0:d.id)??null});this.dispatch(this.actions.addOne(n));const c=this.enqueueRequest({description:"Create team membership",method:y.POST,url:`${this.url}/`,payload:R(n),blockers:[e.team],blocks:[n.uuid]});return c.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.deleteOne(n.uuid))}),[n,c]}bulkAdd(e){var r;const{store:a}=this.client,n=((r=a.getState().userReducer.currentUser)==null?void 0:r.id)??null,c=e.map(o=>F({...o,created_by:n}));this.dispatch(this.actions.addMany(c));const d=this.enqueueRequest({description:"Create team memberships",method:y.POST,url:`${this.url}/bulk/`,payload:{team_memberships:c.map(o=>R(o))},blockers:c.map(o=>o.team),blocks:c.map(o=>o.uuid)});return d.then(o=>{this.dispatch(this.actions.setMany(o))}).catch(()=>{this.dispatch(this.actions.deleteMany(c.map(o=>o.uuid)))}),[c,d]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected team membership with uuid ${e} to exist`);this.dispatch(this.actions.deleteOne(e));try{return await this.enqueueRequest({description:"Delete team membership",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(d){throw this.dispatch(this.actions.setOne(c)),d}}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{team__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class hb extends w{constructor(){super(...arguments);h(this,"name","Team");h(this,"url","/teams");h(this,"actions",{addOne:BI,addMany:jI,setOne:qI,setMany:$I,updateOne:DI,updateMany:UI,deleteOne:CI,deleteMany:LI,initialize:zI});h(this,"selectors",{selectById:kI,selectByIds:NI})}add(e){var d;const{store:a}=this.client,n=F({...e,submitted_at:new Date().toISOString(),created_by:((d=a.getState().userReducer.currentUser)==null?void 0:d.id)??null});this.dispatch(this.actions.addOne(n));const c=this.enqueueRequest({description:"Create team",method:y.POST,url:`${this.url}/`,payload:R(n),blockers:[],blocks:[n.uuid]});return c.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.deleteOne(n.uuid))}),[n,c]}update(e){const{store:a}=this.client,n=this.selectors.selectById(e.uuid)(a.getState());if(!n)throw new Error(`Expected team with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Update team",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:R(e),blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.setOne(n))}),[c,d]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected team with uuid ${e} to exist`);this.dispatch(this.actions.deleteOne(e));try{return await this.enqueueRequest({description:"Delete team",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(d){throw this.dispatch(this.actions.setOne(c)),d}}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class mb extends st{constructor(){super(...arguments);h(this,"name","User");h(this,"url","/user");h(this,"actions",{addOne:ha,addMany:gS,setOne:PS,setMany:FS,updateOne:_S,updateMany:bS,deleteOne:ma,deleteMany:MS,initialize:OS});h(this,"selectors",{selectById:Et,selectByIds:vS})}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`/organizations/${e}${this.url}s/`},a);return this.dispatch(this.actions.initialize(n)),n}}async function za(t,s,e,a,n){const c=a instanceof Ze;c&&s.checkAuth!==!1&&await a.auth.prepareAuth();const d={queryParams:"",isAuthNeeded:!0},{s3url:r,payload:o,headers:m,method:l,queryParams:p,attachmentHash:A,isExternalUrl:T,isAuthNeeded:I,isResponseBlob:_}={...d,...s};let M=s.url;const g=A?await e.files.fetchCache(A):void 0;if(A&&!g)throw new Error(`Cannot upload file ${A} because it's not cached.`);!T&&!M.startsWith("http")&&(!M.startsWith("/")&&!M.startsWith("blob:")&&(M="/"+M),M=t+M);const v=j=>{if(A){if(!r)throw new Error(`No S3 URL for file ${A}`);if("warning"in r)throw new Error(`S3 URL warning for file ${A}`);if(!g)throw new Error(`No file for file ${A}`);const Ye=r.fields["x-amz-checksum-sha1"];if(!Ye)throw new Error(`No checksum for file ${A}`);return j.set("x-amz-checksum-sha1",Ye).field({...o,...r.fields}).attach("file",g)}return j.send(o)},Ke={[y.GET]:()=>_?Qe.get(M.toString()).responseType("blob"):Qe.get(M.toString()),[y.POST]:()=>{const j=Qe.post(M.toString());return v(j)},[y.PATCH]:()=>{const j=Qe.patch(M.toString());return v(j)},[y.PUT]:()=>{const j=Qe.put(M.toString());return v(j)},[y.DELETE]:()=>{const j=Qe.delete(M.toString());return v(j)}}[l];let D=Ke();if(n==null||n.addEventListener("abort",()=>{console.debug("aborting request:",s),D.abort()}),I&&c){const j=a.auth.getAuthHeader();D=D.set("Authorization",j)}m&&(D=D.set(m));try{return await D.query(p)}catch(j){const Ye=rO(j),IO=Ye==null?void 0:Ye.status;if(c&&IO===401)return await a.auth.handleUnauthorized(D,Ye),D.query(p);throw new q({response:Ye,innerError:j,discard:wa.includes(IO)})}}class yb{constructor(s){h(this,"store");this.store=s}_performRequest(s,e,a,n){const c=new Dt,d={...e,uuid:e.uuid??xe.v4()};return za(s,d,this,a,n).then(r=>{c.resolve(r.body)}).catch(r=>{r instanceof Error?c.reject(r):c.reject(new Error((r??tt).toString()))}),c}async performRequest(s,e,a,n){return this._performRequest(s,e,a,n).then(c=>{if(c instanceof q)throw c;return c})}async enqueueRequest(s,e,a){return this._enqueueRequest(s,e,a).then(n=>{if(n instanceof q)throw n;return n})}_enqueueRequest(s,e,a){const n=new Dt,c={...s,BASE_URL:e,serviceName:a},d=this.store.dispatch(rT(c)),r=m=>{if(m)n.resolve(m.body);else{const l=new q({message:"Could not get a response from the server.",response:m,discard:!0});n.reject(l)}},o=m=>{m instanceof q?m.options.discard=!0:(console.error("Received an unexpected error while processing a request:",m,`
|
|
15
|
+
Converting error to APIError and discarding.`),m=new q({message:"An error occurred while processing the request.",innerError:m,discard:!0})),n.reject(m)};return d.then(r,o),n}async performPagination(s,e,a,n,c){const d={...e,queryParams:{...e.queryParams,paginate:!0,limit:a}},{method:r}=d,o=[];let m=await this.performRequest(s,d,n,c);for(o.push(m.results);m.next;)m=await this.performRequest(s,{url:m.next,method:r},n,c),o.push(m.results);return o}}class it{constructor(){h(this,"graph");h(this,"requestAttemptCounter");this.graph=new RO.DepGraph,this.requestAttemptCounter={}}static _fromOutbox(s){const e=new it;for(let a=0;a<s.length;a++){const n=s[a];if(!n){console.error("Outbox item was undefined");continue}e.sneakRequest(n);for(let c=0;c<a;c++){const d=s[c];if(!d){console.error("Previous outbox item was undefined");continue}d.payload.uuid!==n.payload.uuid&&d.payload.blocks.some(r=>n.payload.blockers.includes(r))&&it._addDependency(n.payload.uuid,d.payload.uuid,e.graph)}}return e}_addDependency(s,e){it._addDependency(s,e,this.graph)}static _addDependency(s,e,a){if(s===e)throw new Error(`Tried to add dependency from node to itself: ${s}`);if(!a.hasNode(s))throw new Error(`Tried to add dependency from non-existent node: ${s} (to node: ${e})`);if(!a.hasNode(e))throw new Error(`Tried to add dependency to non-existent node: ${e} (from node: ${s})`);a.addDependency(s,e)}addRequest(s){if(this.graph.addNode(s.payload.uuid,s),!(s.payload.blockers.length===0||this.graph.size()===1))for(const e of this.graph.overallOrder()){if(e===s.payload.uuid)continue;const a=this.graph.getNodeData(e);s.payload.blockers.some(n=>a.payload.blocks.includes(n))&&this._addDependency(s.payload.uuid,e)}}insertRequest(s){this.graph.addNode(s.payload.uuid,s);for(const e of this.graph.overallOrder()){if(e===s.payload.uuid)continue;this.graph.getNodeData(e).payload.blockers.some(n=>s.payload.blocks.includes(n))&&this._addDependency(e,s.payload.uuid)}}sneakRequest(s){this.graph.addNode(s.payload.uuid,s)}_getNextNode(){const s=this.graph.overallOrder(!0);let e=1/0,a;for(const n of s){const c=this.requestAttemptCounter[n]||0;c<e&&(e=c,a=n)}return a}peek(){const s=this._getNextNode();if(s)return this.graph.getNodeData(s)}remove(s){this.graph.removeNode(s),delete this.requestAttemptCounter[s]}pop(){const s=this.peek();return s&&this.graph.removeNode(s.payload.uuid),s}getQueue(){const s=this.graph.overallOrder().map(a=>this.graph.getNodeData(a)),e=this._getNextNode();if(e){const a=this.graph.getNodeData(e),n=s.findIndex(c=>c.payload.uuid===a.payload.uuid);n!==-1&&(s.splice(n,1),s.unshift(a))}return s}getReady(){let s=this.graph.overallOrder(!0).map(e=>this.graph.getNodeData(e));return s=s.sort((e,a)=>e.meta.offline.effect.timestamp.localeCompare(a.meta.offline.effect.timestamp)),s=s.sort((e,a)=>{const n=this.requestAttemptCounter[e.payload.uuid]||0,c=this.requestAttemptCounter[a.payload.uuid]||0;return n-c}),s}registerRetry(s){this.requestAttemptCounter[s]=(this.requestAttemptCounter[s]||0)+1}}let uO;function lO(t){uO=t}function at(){return uO}let oO;function hO(t){oO=t}function mO(){return oO}let Ba=null;function Xe(){const t=at();if(!t)return console.warn("Client store not set; cannot get outbox coordinator yet."),null;if(Ba)return Ba;const s=t.getState().offline.outbox,e=it._fromOutbox(s);return Ba=e,e}const pb=(t,s)=>{const e=new s(t);return hO(e),lO(t),e};class Ab{constructor(s){h(this,"_all");h(this,"_previous");this._all=[s],this._previous=s,this.then=this.then.bind(this),this.compile=this.compile.bind(this)}then(s){return this._previous&&(this._previous.next=s),this._all.push(s),this._previous=s,{then:this.then,compile:this.compile}}compile(){return this._all}}class ja{constructor(){h(this,"next");this.next=null}then(s){return new Ab(this).then(s)}async run(s){if(this.next)return this.next.run(s);{if(console.debug("Middleware finished. Performing request:",s),!at())throw new Error("Client store not set");const a=mO();if(!a)throw new Error("Client SDK not set");return nO(s,a)}}}class yO extends ja{async run(s){return super.run(s)}}class pO extends ja{async run(s){return super.run(s)}}const AO=new yO().then(new pO).compile();function fO(t){var s;return(s=AO[0])==null?void 0:s.run(t)}var SO=(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))(SO||{});i.ALL_MIDDLEWARE=AO,i.APIError=q,i.ATTACHMENT_MODEL_DEFAULT_PAGE_SIZE=JI,i.AgentService=eg,i.AssetAttachmentService=tg,i.AssetProcedureService=dg,i.AssetProcedureStepFieldValuesAttachmentService=og,i.AssetProcedureStepFieldValuesService=hg,i.AssetProcedureStepFieldsAttachmentService=ug,i.AssetProcedureStepFieldsService=lg,i.AssetProcedureStepService=mg,i.AssetProcedureTypeAttachmentService=sg,i.AssetProcedureTypeFieldValuesAttachmentService=ng,i.AssetProcedureTypeFieldValuesService=cg,i.AssetProcedureTypeFieldsAttachmentService=ig,i.AssetProcedureTypeFieldsService=ag,i.AssetProcedureTypeService=rg,i.AssetService=yg,i.AssetStageCompletionService=pg,i.AssetStageService=Ag,i.AssetStatusType=La,i.AssetTypeAttachmentService=fg,i.AssetTypeFieldValuesAttachmentService=Ig,i.AssetTypeFieldValuesService=Og,i.AssetTypeFieldsAttachmentService=Sg,i.AssetTypeFieldsService=Tg,i.AssetTypeIdentifierService=Fg,i.AssetTypeIdentifierValueService=Pg,i.AssetTypeService=gg,i.AssetTypeStatusService=bg,i.AttachmentModel=Ga,i.BaseApiService=Ze,i.BaseModelApiService=st,i.BaseOfflineAttachmentModelService=z,i.BaseOfflineModelApiService=w,i.BaseSDK=yb,i.COMMON_AUTO_FIELDS=Za,i.CategoryService=_g,i.DEFAULT_ISSUE_PRIORITY=wO,i.DEFAULT_PAGE_SIZE=ZI,i.DISCARD_HTTP_STATUSES=wa,i.DeferredPromise=Dt,i.DocumentAttachmentService=Mg,i.DocumentService=Rg,i.EMPTY_ARRAY=Da,i.EMPTY_OBJECT=Ua,i.EmailDomainsService=wg,i.EmailVerificationService=vg,i.FileService=Vg,i.FormIdentifierService=zg,i.FormIdentifierValueService=Bg,i.FormRevisionAttachmentService=jg,i.FormRevisionService=qg,i.FormService=$g,i.FormSubmissionAttachmentService=Dg,i.FormSubmissionService=Ug,i.GeoImageService=Cg,i.HttpMethod=y,i.IssueAssociationService=Lg,i.IssueAttachmentService=Gg,i.IssueCommentAttachmentService=kg,i.IssueCommentService=Ng,i.IssuePriority=$t,i.IssueService=Hg,i.IssueStatusType=ka,i.IssueTypeAttachmentService=Wg,i.IssueTypeFieldValuesAttachmentService=Zg,i.IssueTypeFieldValuesService=Jg,i.IssueTypeFieldsAttachmentService=Kg,i.IssueTypeFieldsService=Yg,i.IssueTypeIdentifierService=Xg,i.IssueTypeIdentifierValueService=Qg,i.IssueTypeService=xg,i.IssueTypeStatusService=eb,i.IssueUpdateChange=B,i.IssueUpdateService=tb,i.JWTService=ab,i.OUTBOX_RETRY_DELAY=Na,i.OfflineAnalyticsMiddleware=yO,i.OfflineMiddleware=ja,i.OrganizationAccessLevel=Ca,i.OrganizationAccessService=nb,i.OrganizationService=cb,i.OutboxCoordinator=it,i.ProjectAccessService=db,i.ProjectAttachmentService=rb,i.ProjectFileService=ub,i.ProjectService=lb,i.RESET_ORGANIZATION_STATE=b,i.RESET_PROJECT_STATE=E,i.RESET_STATE=O,i.RateLimitingMiddleware=pO,i.SelectorBuilder=CP,i.TeamMembershipService=ob,i.TeamService=hb,i.UNKNOWN_ERROR_MESSAGE=tt,i.UserService=mb,i.VERSION_REDUCER_KEY=nt,i.VerificationCodeType=SO,i._setLatestRetryTime=lT,i.addAsset=_r,i.addAssetAttachment=on,i.addAssetAttachments=Wt,i.addAssetProcedure=Uc,i.addAssetProcedureStep=yr,i.addAssetProcedureStepFieldValues=Qd,i.addAssetProcedureStepFieldValuesAttachment=Ud,i.addAssetProcedureStepFieldValuesAttachments=ps,i.addAssetProcedureStepFieldValuesMany=xd,i.addAssetProcedureStepFields=_d,i.addAssetProcedureStepFieldsAttachment=hd,i.addAssetProcedureStepFieldsAttachments=md,i.addAssetProcedureStepFieldsMany=Md,i.addAssetProcedureSteps=pr,i.addAssetProcedureType=Qc,i.addAssetProcedureTypeAttachment=gn,i.addAssetProcedureTypeAttachments=bn,i.addAssetProcedureTypeFieldValues=bc,i.addAssetProcedureTypeFieldValuesAttachment=hc,i.addAssetProcedureTypeFieldValuesAttachments=ts,i.addAssetProcedureTypeFieldValuesMany=_c,i.addAssetProcedureTypeFields=Qn,i.addAssetProcedureTypeFieldsAttachment=Dn,i.addAssetProcedureTypeFieldsAttachments=Un,i.addAssetProcedureTypeFieldsMany=xn,i.addAssetProcedureTypes=xc,i.addAssetProcedures=cs,i.addAssetStage=tu,i.addAssetStageCompletion=Dr,i.addAssetStageCompletions=Ur,i.addAssetStages=su,i.addAssetType=so,i.addAssetTypeAttachment=hu,i.addAssetTypeAttachments=Es,i.addAssetTypeFieldValues=hl,i.addAssetTypeFieldValuesAttachment=xu,i.addAssetTypeFieldValuesAttachments=Ds,i.addAssetTypeFieldValuesMany=ml,i.addAssetTypeFields=Uu,i.addAssetTypeFieldsAttachment=bu,i.addAssetTypeFieldsAttachments=_u,i.addAssetTypeFieldsMany=Cu,i.addAssetTypeIdentifier=_l,i.addAssetTypeIdentifierValue=Cl,i.addAssetTypeIdentifierValues=Ll,i.addAssetTypeIdentifiers=Ml,i.addAssetTypeStatus=po,i.addAssetTypeStatuses=Ao,i.addAssetTypes=io,i.addAssets=Fs,i.addCategories=zo,i.addCategory=Vo,i.addConversation=nn,i.addConversations=tF,i.addDocument=nh,i.addDocumentAttachment=Ho,i.addDocumentAttachments=Wo,i.addDocuments=ch,i.addEmailDomain=Th,i.addEmailDomains=Ih,i.addForm=qm,i.addFormIdentifier=Dh,i.addFormIdentifierValue=Qh,i.addFormIdentifierValues=xh,i.addFormIdentifiers=Uh,i.addFormRevision=ui,i.addFormRevisionAttachment=hm,i.addFormRevisionAttachments=mm,i.addFormRevisions=li,i.addFormSubmission=ly,i.addFormSubmissionAttachment=Jm,i.addFormSubmissionAttachments=fi,i.addFormSubmissions=Pi,i.addForms=$m,i.addGeoImage=Py,i.addGeoImages=gy,i.addIssue=qp,i.addIssueAssociation=Uy,i.addIssueAssociations=bt,i.addIssueAttachment=Jy,i.addIssueAttachments=vi,i.addIssueComment=Pp,i.addIssueCommentAttachment=up,i.addIssueCommentAttachments=lp,i.addIssueComments=gp,i.addIssueType=Uf,i.addIssueTypeAttachment=Zp,i.addIssueTypeAttachments=Jp,i.addIssueTypeFieldValues=PA,i.addIssueTypeFieldValuesAttachment=XA,i.addIssueTypeFieldValuesAttachments=Ki,i.addIssueTypeFieldValuesMany=gA,i.addIssueTypeFields=$A,i.addIssueTypeFieldsAttachment=uA,i.addIssueTypeFieldsAttachments=lA,i.addIssueTypeFieldsMany=DA,i.addIssueTypeIdentifier=of,i.addIssueTypeIdentifierValue=bf,i.addIssueTypeIdentifierValues=_f,i.addIssueTypeIdentifiers=hf,i.addIssueTypeStatus=xf,i.addIssueTypeStatuses=eS,i.addIssueTypes=Cf,i.addIssueUpdate=na,i.addIssueUpdates=ca,i.addIssues=Di,i.addOrganization=JS,i.addOrganizationAccess=zS,i.addOrganizationAccesses=BS,i.addOrganizations=ZS,i.addProject=rI,i.addProjectAccess=yT,i.addProjectAccesses=pT,i.addProjectAttachment=MT,i.addProjectAttachments=RT,i.addProjectFile=kT,i.addProjectFiles=NT,i.addProjects=dI,i.addTeam=BI,i.addTeamMembership=II,i.addTeamMemberships=OI,i.addTeams=jI,i.addUser=ha,i.addUsers=gS,i.agentsReducer=rn,i.agentsSlice=kt,i.areArraysEqual=VO,i.assetAttachmentReducer=On,i.assetAttachmentSlice=Ht,i.assetProcedureReducer=Hc,i.assetProcedureSlice=ns,i.assetProcedureStepFieldValuesAttachmentReducer=Zd,i.assetProcedureStepFieldValuesAttachmentSlice=ys,i.assetProcedureStepFieldValuesReducer=ur,i.assetProcedureStepFieldValuesSlice=Ss,i.assetProcedureStepFieldsAttachmentReducer=Pd,i.assetProcedureStepFieldsAttachmentSlice=ls,i.assetProcedureStepFieldsReducer=qd,i.assetProcedureStepFieldsSlice=hs,i.assetProcedureStepReducer=Ir,i.assetProcedureStepSlice=Ts,i.assetProcedureTypeAttachmentReducer=Vn,i.assetProcedureTypeAttachmentSlice=Zt,i.assetProcedureTypeFieldValuesAttachmentReducer=Sc,i.assetProcedureTypeFieldValuesAttachmentSlice=es,i.assetProcedureTypeFieldValuesReducer=zc,i.assetProcedureTypeFieldValuesSlice=as,i.assetProcedureTypeFieldsAttachmentReducer=Wn,i.assetProcedureTypeFieldsAttachmentSlice=Xt,i.assetProcedureTypeFieldsReducer=cc,i.assetProcedureTypeFieldsSlice=xt,i.assetProcedureTypeReducer=cd,i.assetProcedureTypeSlice=rs,i.assetReducer=jr,i.assetSlice=Os,i.assetStageCompletionReducer=Wr,i.assetStageCompletionSlice=_s,i.assetStageReducer=du,i.assetStageSlice=Ms,i.assetTypeAttachmentReducer=Fu,i.assetTypeAttachmentSlice=vs,i.assetTypeFieldValuesAttachmentReducer=ul,i.assetTypeFieldValuesAttachmentSlice=$s,i.assetTypeFieldValuesReducer=Pl,i.assetTypeFieldValuesSlice=Ls,i.assetTypeFieldsAttachmentReducer=qu,i.assetTypeFieldsAttachmentSlice=Bs,i.assetTypeFieldsReducer=Ju,i.assetTypeFieldsSlice=qs,i.assetTypeIdentifierReducer=$l,i.assetTypeIdentifierSlice=Gs,i.assetTypeIdentifierValueReducer=Xl,i.assetTypeIdentifierValueSlice=Ns,i.assetTypeReducer=ho,i.assetTypeSlice=Hs,i.assetTypeStatusReducer=_o,i.assetTypeStatusSlice=Ks,i.assetTypeStatusSortFn=xa,i.authReducer=wo,i.authSlice=It,i.baseReducer=$P,i.baseReducers=Ra,i.blobToBase64=LO,i.categoryReducer=Go,i.categorySlice=Zs,i.clearTokens=UF,i.constructUploadedFilePayloads=CO,i.createModelAdapter=P,i.createOfflineAction=cT,i.createPayload=R,i.createSelectionAdapter=vO,i.deleteAsset=wr,i.deleteAssetAttachment=An,i.deleteAssetAttachments=Kt,i.deleteAssetProcedure=Gc,i.deleteAssetProcedureStep=Sr,i.deleteAssetProcedureStepFieldValues=ar,i.deleteAssetProcedureStepFieldValuesAttachment=Nd,i.deleteAssetProcedureStepFieldValuesAttachments=As,i.deleteAssetProcedureStepFieldValuesMany=nr,i.deleteAssetProcedureStepFields=Vd,i.deleteAssetProcedureStepFieldsAttachment=Sd,i.deleteAssetProcedureStepFieldsAttachments=Td,i.deleteAssetProcedureStepFieldsMany=zd,i.deleteAssetProcedureSteps=Tr,i.deleteAssetProcedureType=sd,i.deleteAssetProcedureTypeAttachment=vn,i.deleteAssetProcedureTypeAttachments=En,i.deleteAssetProcedureTypeFieldValues=Ec,i.deleteAssetProcedureTypeFieldValuesAttachment=fc,i.deleteAssetProcedureTypeFieldValuesAttachments=ss,i.deleteAssetProcedureTypeFieldValuesMany=Vc,i.deleteAssetProcedureTypeFields=ac,i.deleteAssetProcedureTypeFieldsAttachment=Nn,i.deleteAssetProcedureTypeFieldsAttachments=Hn,i.deleteAssetProcedureTypeFieldsMany=nc,i.deleteAssetProcedureTypes=id,i.deleteAssetProcedures=ds,i.deleteAssetStage=nu,i.deleteAssetStageCompletion=Nr,i.deleteAssetStageCompletions=Hr,i.deleteAssetStages=cu,i.deleteAssetType=co,i.deleteAssetTypeAttachment=fu,i.deleteAssetTypeAttachments=Vs,i.deleteAssetTypeFieldValues=Sl,i.deleteAssetTypeFieldValuesAttachment=al,i.deleteAssetTypeFieldValuesAttachments=Us,i.deleteAssetTypeFieldValuesMany=Tl,i.deleteAssetTypeFields=Hu,i.deleteAssetTypeFieldsAttachment=Eu,i.deleteAssetTypeFieldsAttachments=Vu,i.deleteAssetTypeFieldsMany=Wu,i.deleteAssetTypeIdentifier=Vl,i.deleteAssetTypeIdentifierValue=Wl,i.deleteAssetTypeIdentifierValues=Kl,i.deleteAssetTypeIdentifiers=zl,i.deleteAssetTypeStatus=Oo,i.deleteAssetTypeStatuses=Fo,i.deleteAssetTypes=ro,i.deleteAssets=Ps,i.deleteCategories=Uo,i.deleteCategory=Do,i.deleteConversation=aF,i.deleteConversations=nF,i.deleteDocument=oh,i.deleteDocumentAttachment=Xo,i.deleteDocumentAttachments=Qo,i.deleteDocuments=hh,i.deleteEmailDomain=bh,i.deleteEmailDomains=_h,i.deleteForm=Gm,i.deleteFormIdentifier=Nh,i.deleteFormIdentifierValue=am,i.deleteFormIdentifierValues=nm,i.deleteFormIdentifiers=Hh,i.deleteFormRevision=oi,i.deleteFormRevisionAttachment=Sm,i.deleteFormRevisionAttachments=Tm,i.deleteFormRevisions=hi,i.deleteFormSubmission=my,i.deleteFormSubmissionAttachment=ty,i.deleteFormSubmissionAttachments=Si,i.deleteFormSubmissions=gi,i.deleteForms=km,i.deleteGeoImage=My,i.deleteGeoImages=Ry,i.deleteIssue=Lp,i.deleteIssueAssociation=Cy,i.deleteIssueAssociations=_t,i.deleteIssueAttachment=tp,i.deleteIssueAttachments=Ei,i.deleteIssueComment=wp,i.deleteIssueCommentAttachment=pp,i.deleteIssueCommentAttachments=Ap,i.deleteIssueComments=vp,i.deleteIssueType=Hf,i.deleteIssueTypeAttachment=tA,i.deleteIssueTypeAttachments=sA,i.deleteIssueTypeFieldValues=wA,i.deleteIssueTypeFieldValuesAttachment=sf,i.deleteIssueTypeFieldValuesAttachments=Yi,i.deleteIssueTypeFieldValuesMany=vA,i.deleteIssueTypeFields=kA,i.deleteIssueTypeFieldsAttachment=pA,i.deleteIssueTypeFieldsAttachments=AA,i.deleteIssueTypeFieldsMany=NA,i.deleteIssueTypeIdentifier=ff,i.deleteIssueTypeIdentifierValue=Ef,i.deleteIssueTypeIdentifierValues=Vf,i.deleteIssueTypeIdentifiers=Sf,i.deleteIssueTypeStatus=nS,i.deleteIssueTypeStatuses=cS,i.deleteIssueTypes=Wf,i.deleteIssueUpdate=da,i.deleteIssueUpdates=ra,i.deleteIssues=Ui,i.deleteOrganization=xS,i.deleteOrganizationAccess=US,i.deleteOrganizationAccesses=CS,i.deleteOrganizations=eT,i.deleteProject=oI,i.deleteProjectAccess=IT,i.deleteProjectAccesses=OT,i.deleteProjectAttachment=zT,i.deleteProjectAttachments=BT,i.deleteProjectFile=KT,i.deleteProjectFiles=YT,i.deleteProjects=hI,i.deleteTeam=CI,i.deleteTeamMembership=_I,i.deleteTeamMemberships=MI,i.deleteTeams=LI,i.deleteUser=ma,i.deleteUsers=MS,i.dequeue=aO,i.discard=cO,i.documentAttachmentReducer=sh,i.documentAttachmentSlice=Qs,i.documentSlice=ei,i.documentsReducer=Ah,i.downloadFile=GO,i.downloadInMemoryFile=UO,i.emailDomainsReducer=vh,i.emailDomainsSlice=ti,i.emailRegex=XO,i.enqueue=iO,i.enqueueRequest=rT,i.extractResponseFromError=rO,i.fallbackToEmptyArray=S,i.fallbackToEmptyObject=ht,i.fileReducer=jh,i.fileSlice=ii,i.fileToBlob=Ka,i.formIdentifierReducer=Zh,i.formIdentifierSlice=ai,i.formIdentifierValueReducer=um,i.formIdentifierValueSlice=ci,i.formReducer=Nm,i.formRevisionAttachmentReducer=Pm,i.formRevisionAttachmentSlice=di,i.formRevisionReducer=zm,i.formRevisionsSlice=ri,i.formSlice=yi,i.formSubmissionAttachmentReducer=ny,i.formSubmissionAttachmentSlice=Ai,i.formSubmissionReducer=Sy,i.formSubmissionSlice=Fi,i.geoImageReducer=Vy,i.geoImageSlice=_i,i.getAssetProcedureStepSubTree=Qa,i.getAssetProcedureStepTrees=QO,i.getClientSDK=mO,i.getClientStore=at,i.getDocumentSubTree=eF,i.getDocumentTrees=xO,i.getFileIdentifier=DO,i.getFileS3Key=Gt,i.getLocalDateString=Ha,i.getLocalRelativeDateString=qO,i.getOutboxCoordinator=Xe,i.getRenamedFile=Wa,i.hashFile=et,i.initSDK=pb,i.initializeAssetAttachments=ln,i.initializeAssetProcedureStepFieldValues=Xd,i.initializeAssetProcedureStepFieldValuesAttachments=Dd,i.initializeAssetProcedureStepFields=bd,i.initializeAssetProcedureStepFieldsAttachments=od,i.initializeAssetProcedureSteps=or,i.initializeAssetProcedureTypeAttachments=Pn,i.initializeAssetProcedureTypeFieldValues=gc,i.initializeAssetProcedureTypeFieldValuesAttachments=oc,i.initializeAssetProcedureTypeFields=Xn,i.initializeAssetProcedureTypeFieldsAttachments=$n,i.initializeAssetProcedureTypes=Xc,i.initializeAssetProcedures=Dc,i.initializeAssetStageCompletions=$r,i.initializeAssetStages=Qr,i.initializeAssetTypeAttachments=ou,i.initializeAssetTypeFieldValues=ol,i.initializeAssetTypeFieldValuesAttachments=Qu,i.initializeAssetTypeFields=Du,i.initializeAssetTypeFieldsAttachments=gu,i.initializeAssetTypeIdentifierValues=Ul,i.initializeAssetTypeIdentifiers=bl,i.initializeAssetTypeStatuses=yo,i.initializeAssetTypes=xl,i.initializeAssets=br,i.initializeCategories=Eo,i.initializeConversations=an,i.initializeDocumentAttachments=No,i.initializeDocuments=ah,i.initializeEmailDomains=Sh,i.initializeFormIdentifierValues=Xh,i.initializeFormIdentifiers=$h,i.initializeFormRevisionAttachments=om,i.initializeFormRevisions=bm,i.initializeFormSubmissionAttachments=Zm,i.initializeFormSubmissions=dy,i.initializeForms=jm,i.initializeGeoImages=Iy,i.initializeIssueAssociations=By,i.initializeIssueAttachments=Zy,i.initializeIssueCommentAttachments=rp,i.initializeIssueComments=Fp,i.initializeIssueTypeAttachments=Yp,i.initializeIssueTypeFieldValues=FA,i.initializeIssueTypeFieldValuesAttachments=JA,i.initializeIssueTypeFields=qA,i.initializeIssueTypeFieldsAttachments=rA,i.initializeIssueTypeIdentifierValues=gf,i.initializeIssueTypeIdentifiers=lf,i.initializeIssueTypeStatuses=Qf,i.initializeIssueTypes=Df,i.initializeIssueUpdates=oS,i.initializeIssues=jp,i.initializeOrganizationAccesses=VS,i.initializeOrganizations=WS,i.initializeProjectAccesses=mT,i.initializeProjectAttachments=_T,i.initializeProjectFiles=CT,i.initializeProjects=aI,i.initializeTeamMemberships=TI,i.initializeTeams=zI,i.initializeUsers=OS,i.isToday=jO,i.issueAssociationReducer=Ky,i.issueAssociationSlice=Ri,i.issueAttachmentReducer=cp,i.issueAttachmentSlice=wi,i.issueCommentAttachmentReducer=Ip,i.issueCommentAttachmentSlice=zi,i.issueCommentReducer=zp,i.issueCommentSlice=ji,i.issueReducer=Wp,i.issueSlice=$i,i.issueTypeAttachmentReducer=cA,i.issueTypeAttachmentSlice=Ci,i.issueTypeFieldValuesAttachmentReducer=rf,i.issueTypeFieldValuesAttachmentSlice=Wi,i.issueTypeFieldValuesReducer=BA,i.issueTypeFieldValuesSlice=Ni,i.issueTypeFieldsAttachmentReducer=IA,i.issueTypeFieldsAttachmentSlice=Gi,i.issueTypeFieldsReducer=YA,i.issueTypeFieldsSlice=Hi,i.issueTypeIdentifierReducer=Ff,i.issueTypeIdentifierSlice=Ji,i.issueTypeIdentifierValueReducer=qf,i.issueTypeIdentifierValueSlice=Qi,i.issueTypeReducer=Jf,i.issueTypeSlice=xi,i.issueTypeStatusReducer=uS,i.issueTypeStatusSlice=ta,i.issueTypeStatusSortFn=en,i.issueUpdateReducer=TS,i.issueUpdateSlice=aa,i.logOnlyOnce=kO,i.markAsDeleted=uT,i.markForDeletion=OP,i.memoize=Ct,i.onlyUniqueHashes=JO,i.onlyUniqueOfflineIds=ZO,i.organizationAccessReducer=LS,i.organizationAccessSlice=pa,i.organizationReducer=nT,i.organizationSlice=Aa,i.outboxReducer=oT,i.outboxSlice=fa,i.overmapEnhancer=YP,i.overmapReducer=DP,i.overmapReducers=YI,i.performRequest=za,i.performRequestFromAction=nO,i.projectAccessReducer=FT,i.projectAccessSlice=Sa,i.projectAttachmentReducer=DT,i.projectAttachmentSlice=Ia,i.projectFileReducer=sI,i.projectFileSlice=Fa,i.projectReducer=mI,i.projectSlice=Pa,i.rehydratedReducer=fI,i.rehydratedSlice=ga,i.restructureCreateSelectorWithArgs=f,i.runMiddleware=fO,i.saveActiveProjectFileBounds=XT,i.selectAccessToken=CF,i.selectAccessesByUserOfProject=PP,i.selectAccessibleProjects=RP,i.selectActiveOrganizationAccess=fP,i.selectActiveProjectFileId=_P,i.selectAllDocumentAttachments=xs,i.selectAllProjectAttachments=Oa,i.selectAssetAttachmentById=Sn,i.selectAssetAttachmentMapping=fn,i.selectAssetAttachments=Yt,i.selectAssetAttachmentsByIds=Tn,i.selectAssetById=zr,i.selectAssetProcedureById=Yc,i.selectAssetProcedureStepById=Or,i.selectAssetProcedureStepFieldValues=ct,i.selectAssetProcedureStepFieldValuesAttachmentById=Wd,i.selectAssetProcedureStepFieldValuesAttachments=fs,i.selectAssetProcedureStepFieldValuesAttachmentsByIds=Kd,i.selectAssetProcedureStepFieldValuesAttachmentsMapping=Hd,i.selectAssetProcedureStepFieldValuesById=dr,i.selectAssetProcedureStepFieldValuesByIds=rr,i.selectAssetProcedureStepFieldValuesMapping=cr,i.selectAssetProcedureStepFieldValuesOfAsset=IF,i.selectAssetProcedureStepFieldValuesOfAssetProcedure=OF,i.selectAssetProcedureStepFieldValuesOfAssetProcedureStep=FF,i.selectAssetProcedureStepFields=At,i.selectAssetProcedureStepFieldsAttachmentById=Od,i.selectAssetProcedureStepFieldsAttachments=os,i.selectAssetProcedureStepFieldsAttachmentsByIds=Fd,i.selectAssetProcedureStepFieldsAttachmentsMapping=Id,i.selectAssetProcedureStepFieldsById=Bd,i.selectAssetProcedureStepFieldsByIds=jd,i.selectAssetProcedureStepFieldsMapping=ms,i.selectAssetProcedureStepFieldsOfAssetProcedureStep=fF,i.selectAssetProcedureStepMapping=ft,i.selectAssetProcedureSteps=Is,i.selectAssetProcedureStepsByIds=Fr,i.selectAssetProcedureStepsMappingOfAssetProcedureType=PF,i.selectAssetProcedureStepsOfAssetProcedureType=gF,i.selectAssetProcedureTypeAttachmentById=Bn,i.selectAssetProcedureTypeAttachmentMapping=zn,i.selectAssetProcedureTypeAttachments=Jt,i.selectAssetProcedureTypeAttachmentsByIds=jn,i.selectAssetProcedureTypeById=rd,i.selectAssetProcedureTypeFieldValues=yt,i.selectAssetProcedureTypeFieldValuesAttachmentById=Ic,i.selectAssetProcedureTypeFieldValuesAttachments=is,i.selectAssetProcedureTypeFieldValuesAttachmentsByIds=Oc,i.selectAssetProcedureTypeFieldValuesAttachmentsMapping=Tc,i.selectAssetProcedureTypeFieldValuesById=jc,i.selectAssetProcedureTypeFieldValuesByIds=qc,i.selectAssetProcedureTypeFieldValuesMapping=Bc,i.selectAssetProcedureTypeFieldValuesOfAsset=hF,i.selectAssetProcedureTypeFields=mt,i.selectAssetProcedureTypeFieldsAttachmentById=Yn,i.selectAssetProcedureTypeFieldsAttachments=Qt,i.selectAssetProcedureTypeFieldsAttachmentsByIds=Zn,i.selectAssetProcedureTypeFieldsAttachmentsMapping=Kn,i.selectAssetProcedureTypeFieldsById=rc,i.selectAssetProcedureTypeFieldsByIds=uc,i.selectAssetProcedureTypeFieldsMapping=dc,i.selectAssetProcedureTypeFieldsOfAssetProcedureType=lF,i.selectAssetProcedureTypes=us,i.selectAssetProcedureTypesByIds=ud,i.selectAssetProcedureTypesMapping=dd,i.selectAssetProcedureTypesOfOrganization=pF,i.selectAssetProcedures=pt,i.selectAssetProceduresByIds=Zc,i.selectAssetProceduresMapping=Wc,i.selectAssetProceduresOfAssetProcedureType=Kc,i.selectAssetProceduresOfAssetType=yF,i.selectAssetStageById=ru,i.selectAssetStageCompletionById=Zr,i.selectAssetStageCompletionMapping=Kr,i.selectAssetStageCompletions=Yr,i.selectAssetStageCompletionsByIds=Jr,i.selectAssetStages=ws,i.selectAssetStagesByIds=uu,i.selectAssetStagesMappingOfAssetProcedureType=_F,i.selectAssetStagesOfAssetProcedureType=MF,i.selectAssetTypeAttachmentById=Tu,i.selectAssetTypeAttachmentMapping=Su,i.selectAssetTypeAttachments=zs,i.selectAssetTypeAttachmentsByIds=Iu,i.selectAssetTypeById=lo,i.selectAssetTypeFieldValues=St,i.selectAssetTypeFieldValuesAttachmentById=cl,i.selectAssetTypeFieldValuesAttachments=Cs,i.selectAssetTypeFieldValuesAttachmentsByIds=dl,i.selectAssetTypeFieldValuesAttachmentsMapping=nl,i.selectAssetTypeFieldValuesById=Ol,i.selectAssetTypeFieldValuesByIds=Fl,i.selectAssetTypeFieldValuesMapping=Il,i.selectAssetTypeFieldValuesOfAsset=EF,i.selectAssetTypeFields=dt,i.selectAssetTypeFieldsAttachmentById=Bu,i.selectAssetTypeFieldsAttachments=js,i.selectAssetTypeFieldsAttachmentsByIds=ju,i.selectAssetTypeFieldsAttachmentsMapping=zu,i.selectAssetTypeFieldsById=Yu,i.selectAssetTypeFieldsByIds=Zu,i.selectAssetTypeFieldsMapping=Ku,i.selectAssetTypeFieldsOfAssetType=wF,i.selectAssetTypeIdentifierById=jl,i.selectAssetTypeIdentifierMapping=Bl,i.selectAssetTypeIdentifierValueById=Zl,i.selectAssetTypeIdentifierValueMapping=Yl,i.selectAssetTypeIdentifierValues=Tt,i.selectAssetTypeIdentifierValuesByIds=Jl,i.selectAssetTypeIdentifierValuesOfAsset=BF,i.selectAssetTypeIdentifierValuesOfIdentifier=jF,i.selectAssetTypeIdentifiers=ks,i.selectAssetTypeIdentifiersByIds=ql,i.selectAssetTypeIdentifiersOfAssetType=zF,i.selectAssetTypeStatusById=go,i.selectAssetTypeStatusMapping=Po,i.selectAssetTypeStatuses=Ys,i.selectAssetTypeStatusesByIds=bo,i.selectAssetTypeStatusesOfAssetType=$F,i.selectAssetTypeValuesOfAssetType=VF,i.selectAssetTypes=Ws,i.selectAssetTypesByIds=oo,i.selectAssetTypesMapping=uo,i.selectAssetTypesOfOrganization=qF,i.selectAssets=gs,i.selectAssetsByIds=Br,i.selectAssetsMapping=Vr,i.selectAssetsOfAssetType=bs,i.selectAttachmentsOfAsset=In,i.selectAttachmentsOfAssetProcedureStepFieldValues=Yd,i.selectAttachmentsOfAssetProcedureStepFields=AF,i.selectAttachmentsOfAssetProcedureType=rF,i.selectAttachmentsOfAssetProcedureTypeFieldValues=Fc,i.selectAttachmentsOfAssetProcedureTypeFields=uF,i.selectAttachmentsOfAssetType=Ou,i.selectAttachmentsOfAssetTypeFieldValues=rl,i.selectAttachmentsOfAssetTypeFields=RF,i.selectAttachmentsOfDocument=kF,i.selectAttachmentsOfFormRevision=XF,i.selectAttachmentsOfFormSubmission=ay,i.selectAttachmentsOfIssue=ip,i.selectAttachmentsOfIssueComment=tP,i.selectAttachmentsOfIssueType=aP,i.selectAttachmentsOfIssueTypeFieldValues=df,i.selectAttachmentsOfIssueTypeFields=nP,i.selectAttachmentsOfProject=bP,i.selectCategories=Js,i.selectCategoriesByIds=Lo,i.selectCategoriesOfProject=GF,i.selectCategoryById=Xs,i.selectCategoryMapping=Co,i.selectCommentsOfIssue=sP,i.selectConversation=dF,i.selectConversationMapping=Nt,i.selectConversations=cF,i.selectCurrentUser=wS,i.selectDeletedRequests=TP,i.selectDescendantsOfAssetProcedureStep=Pr,i.selectDocumentAttachmentById=eh,i.selectDocumentAttachmentMapping=xo,i.selectDocumentAttachmentsByIds=th,i.selectDocumentById=yh,i.selectDocuments=Ot,i.selectDocumentsByIds=ph,i.selectDocumentsMapping=mh,i.selectEmailDomainById=Rh,i.selectEmailDomains=si,i.selectEmailDomainsAsMapping=Mh,i.selectEmailDomainsByIds=wh,i.selectEmailDomainsOfOrganization=WF,i.selectFieldValuesOfAssetProcedure=mF,i.selectFormById=Wm,i.selectFormIdentifierById=Kh,i.selectFormIdentifierMapping=Wh,i.selectFormIdentifierValueById=dm,i.selectFormIdentifierValueMapping=cm,i.selectFormIdentifierValues=Ft,i.selectFormIdentifierValuesByIds=rm,i.selectFormIdentifierValuesOfFormSubmission=ZF,i.selectFormIdentifierValuesOfIdentifier=JF,i.selectFormIdentifiers=ni,i.selectFormIdentifiersByIds=Yh,i.selectFormIdentifiersOfForm=YF,i.selectFormMapping=Hm,i.selectFormRevisionAttachmentById=Om,i.selectFormRevisionAttachments=Im,i.selectFormRevisionAttachmentsByIds=Fm,i.selectFormRevisionAttachmentsMapping=Pt,i.selectFormRevisionById=vm,i.selectFormRevisionMapping=mi,i.selectFormRevisions=gt,i.selectFormRevisionsByIds=Em,i.selectFormRevisionsOfForm=Vm,i.selectFormSubmissionAttachemntsByIds=Oi,i.selectFormSubmissionAttachmentById=sy,i.selectFormSubmissionAttachments=Ii,i.selectFormSubmissionAttachmentsByIds=iy,i.selectFormSubmissionAttachmentsMapping=Ti,i.selectFormSubmissionById=py,i.selectFormSubmissions=yy,i.selectFormSubmissionsByIds=Ay,i.selectFormSubmissionsMapping=bi,i.selectFormSubmissionsOfForm=fy,i.selectForms=pi,i.selectFormsByIds=Km,i.selectFormsOfOrganization=xF,i.selectGeoImageById=vy,i.selectGeoImageMapping=wy,i.selectGeoImages=Mi,i.selectGeoImagesByIds=Ey,i.selectGeoImagesOfProject=eP,i.selectIsImportingProjectFile=MP,i.selectIsLoggedIn=LF,i.selectIssueAssociationById=Gy,i.selectIssueAssociationMapping=rt,i.selectIssueAssociations=Ly,i.selectIssueAssociationsByIds=ky,i.selectIssueAssociationsOfAsset=Wy,i.selectIssueAssociationsOfIssue=Hy,i.selectIssueAssociationsToIssue=Ny,i.selectIssueAttachmentById=ap,i.selectIssueAttachmentMapping=sp,i.selectIssueAttachments=Vi,i.selectIssueAttachmentsByIds=np,i.selectIssueById=kp,i.selectIssueCommentAttachmentById=Sp,i.selectIssueCommentAttachmentMapping=fp,i.selectIssueCommentAttachments=Bi,i.selectIssueCommentAttachmentsByIds=Tp,i.selectIssueCommentById=Ep,i.selectIssueCommentMapping=qi,i.selectIssueCommentsByIds=Vp,i.selectIssueMapping=Gp,i.selectIssueTypeAttachmentById=aA,i.selectIssueTypeAttachmentMapping=iA,i.selectIssueTypeAttachments=Li,i.selectIssueTypeAttachmentsByIds=nA,i.selectIssueTypeById=Yf,i.selectIssueTypeFieldValues=Rt,i.selectIssueTypeFieldValuesAttachmentById=nf,i.selectIssueTypeFieldValuesAttachments=Zi,i.selectIssueTypeFieldValuesAttachmentsByIds=cf,i.selectIssueTypeFieldValuesAttachmentsMapping=af,i.selectIssueTypeFieldValuesById=VA,i.selectIssueTypeFieldValuesByIds=zA,i.selectIssueTypeFieldValuesMapping=EA,i.selectIssueTypeFieldValuesOfIssue=cP,i.selectIssueTypeFields=ut,i.selectIssueTypeFieldsAttachmentById=SA,i.selectIssueTypeFieldsAttachments=ki,i.selectIssueTypeFieldsAttachmentsByIds=TA,i.selectIssueTypeFieldsAttachmentsMapping=fA,i.selectIssueTypeFieldsById=WA,i.selectIssueTypeFieldsByIds=KA,i.selectIssueTypeFieldsMapping=HA,i.selectIssueTypeFieldsOfIssueType=dP,i.selectIssueTypeIdentifierById=If,i.selectIssueTypeIdentifierMapping=Tf,i.selectIssueTypeIdentifierValueById=Bf,i.selectIssueTypeIdentifierValueMapping=zf,i.selectIssueTypeIdentifierValues=wt,i.selectIssueTypeIdentifierValuesByIds=jf,i.selectIssueTypeIdentifierValuesOfIdentifier=hP,i.selectIssueTypeIdentifierValuesOfIssue=oP,i.selectIssueTypeIdentifiers=Xi,i.selectIssueTypeIdentifiersByIds=Of,i.selectIssueTypeIdentifiersOfIssueType=lP,i.selectIssueTypeMapping=Kf,i.selectIssueTypeStatusById=ia,i.selectIssueTypeStatusMapping=dS,i.selectIssueTypeStatuses=sa,i.selectIssueTypeStatusesByIds=rS,i.selectIssueTypeStatusesOfIssueType=yP,i.selectIssueTypeValuesOfIssueType=uP,i.selectIssueTypes=ea,i.selectIssueTypesByIds=Zf,i.selectIssueTypesOfOrganization=mP,i.selectIssueUpdateById=AS,i.selectIssueUpdateMapping=ua,i.selectIssueUpdates=la,i.selectIssueUpdatesByIds=fS,i.selectIssueUpdatesOfIssue=SS,i.selectIssues=Mt,i.selectIssuesByIds=Np,i.selectIssuesOfIssueType=Hp,i.selectIssuesOfProject=iP,i.selectLatestAssetProcedureStepFieldsOfAssetProcedureStep=SF,i.selectLatestAssetProcedureTypeFieldsOfAssetProcedureType=oF,i.selectLatestAssetTypeFieldsOfAssetType=vF,i.selectLatestFieldsByAssetProcedureStep=TF,i.selectLatestFormRevisionOfForm=QF,i.selectLatestIssueTypeFieldsOfIssueType=rP,i.selectLatestRetryTime=IP,i.selectMembershipsByUserOfTeam=zP,i.selectNumberOfAssetsOfAssetType=bF,i.selectOrganizationAccessById=GS,i.selectOrganizationAccessMapping=Vt,i.selectOrganizationAccessUserMapping=NS,i.selectOrganizationAccessesByIds=kS,i.selectOrganizationById=iT,i.selectOrganizationDocuments=HF,i.selectOrganizations=sT,i.selectOrganizationsByIds=aT,i.selectOrganizationsMapping=tT,i.selectProjectAccessById=PT,i.selectProjectAccessMapping=Ta,i.selectProjectAccesses=lt,i.selectProjectAccessesByIds=gT,i.selectProjectAccessesOfProject=FP,i.selectProjectAttachmentById=qT,i.selectProjectAttachmentMapping=jT,i.selectProjectAttachmentsByIds=$T,i.selectProjectById=pI,i.selectProjectDocuments=NF,i.selectProjectFileById=eI,i.selectProjectFileMapping=QT,i.selectProjectFiles=xT,i.selectProjectFilesByIds=tI,i.selectProjectMapping=yI,i.selectProjects=zt,i.selectProjectsByIds=AI,i.selectProjectsOfOrganization=wP,i.selectRehydrated=VP,i.selectStageMapping=Rs,i.selectTeamById=kI,i.selectTeamMembershipById=vI,i.selectTeamMemberships=Bt,i.selectTeamMembershipsByIds=EI,i.selectTeamMembershipsMapping=wI,i.selectTeams=Ma,i.selectTeamsByIds=NI,i.selectTeamsMapping=GI,i.selectTeamsOfOrganization=jP,i.selectUploadUrl=Bh,i.selectUserById=Et,i.selectUsers=vt,i.selectUsersByIds=vS,i.selectUsersMapping=ya,i.selectUsersOfOrganization=SP,i.selectUsersOfProject=gP,i.selectUsersOfTeam=BP,i.setActiveProjectFileId=JT,i.setAsset=vr,i.setAssetAttachment=hn,i.setAssetAttachments=mn,i.setAssetProcedure=kc,i.setAssetProcedureStep=hr,i.setAssetProcedureStepFieldValues=er,i.setAssetProcedureStepFieldValuesAttachment=Cd,i.setAssetProcedureStepFieldValuesAttachments=Ld,i.setAssetProcedureStepFieldValuesMany=tr,i.setAssetProcedureStepFields=Rd,i.setAssetProcedureStepFieldsAttachment=yd,i.setAssetProcedureStepFieldsAttachments=pd,i.setAssetProcedureStepFieldsMany=wd,i.setAssetProcedureSteps=mr,i.setAssetProcedureType=ad,i.setAssetProcedureTypeAttachment=_n,i.setAssetProcedureTypeAttachments=Mn,i.setAssetProcedureTypeFieldValues=Mc,i.setAssetProcedureTypeFieldValuesAttachment=mc,i.setAssetProcedureTypeFieldValuesAttachments=yc,i.setAssetProcedureTypeFieldValuesMany=Rc,i.setAssetProcedureTypeFields=ec,i.setAssetProcedureTypeFieldsAttachment=Cn,i.setAssetProcedureTypeFieldsAttachments=Ln,i.setAssetProcedureTypeFieldsMany=tc,i.setAssetProcedureTypes=nd,i.setAssetProcedures=Nc,i.setAssetStage=xr,i.setAssetStageCompletion=Cr,i.setAssetStageCompletions=Lr,i.setAssetStages=eu,i.setAssetType=eo,i.setAssetTypeAttachment=mu,i.setAssetTypeAttachments=yu,i.setAssetTypeFieldValues=yl,i.setAssetTypeFieldValuesAttachment=el,i.setAssetTypeFieldValuesAttachments=tl,i.setAssetTypeFieldValuesMany=pl,i.setAssetTypeFields=Lu,i.setAssetTypeFieldsAttachment=Mu,i.setAssetTypeFieldsAttachments=Ru,i.setAssetTypeFieldsMany=Gu,i.setAssetTypeIdentifier=Rl,i.setAssetTypeIdentifierValue=Gl,i.setAssetTypeIdentifierValues=kl,i.setAssetTypeIdentifiers=wl,i.setAssetTypeStatus=fo,i.setAssetTypeStatuses=So,i.setAssetTypes=to,i.setAssets=Er,i.setCategories=jo,i.setCategory=Bo,i.setClientSDK=hO,i.setClientStore=lO,i.setConversation=cn,i.setConversations=sF,i.setCurrentUser=pP,i.setDocument=dh,i.setDocumentAttachment=Ko,i.setDocumentAttachments=Yo,i.setDocuments=rh,i.setEmailDomain=Oh,i.setEmailDomains=Fh,i.setForm=Dm,i.setFormIdentifier=Ch,i.setFormIdentifierValue=em,i.setFormIdentifierValues=tm,i.setFormIdentifiers=Lh,i.setFormRevision=_m,i.setFormRevisionAttachment=ym,i.setFormRevisionAttachments=pm,i.setFormRevisions=Mm,i.setFormSubmission=ry,i.setFormSubmissionAttachment=Xm,i.setFormSubmissionAttachments=Qm,i.setFormSubmissions=uy,i.setForms=Um,i.setGeoImage=Oy,i.setGeoImages=Fy,i.setIsImportingProjectFile=ZT,i.setIssue=$p,i.setIssueAssociation=qy,i.setIssueAssociations=jy,i.setIssueAttachment=Xy,i.setIssueAttachments=Qy,i.setIssueComment=bp,i.setIssueCommentAttachment=op,i.setIssueCommentAttachments=hp,i.setIssueComments=_p,i.setIssueType=Lf,i.setIssueTypeAttachment=Xp,i.setIssueTypeAttachments=Qp,i.setIssueTypeFieldValues=bA,i.setIssueTypeFieldValuesAttachment=QA,i.setIssueTypeFieldValuesAttachments=xA,i.setIssueTypeFieldValuesMany=_A,i.setIssueTypeFields=UA,i.setIssueTypeFieldsAttachment=oA,i.setIssueTypeFieldsAttachments=hA,i.setIssueTypeFieldsMany=CA,i.setIssueTypeIdentifier=mf,i.setIssueTypeIdentifierValue=Mf,i.setIssueTypeIdentifierValues=Rf,i.setIssueTypeIdentifiers=yf,i.setIssueTypeStatus=tS,i.setIssueTypeStatuses=sS,i.setIssueTypes=Gf,i.setIssueUpdate=hS,i.setIssueUpdates=mS,i.setIssues=Dp,i.setLoggedIn=Ro,i.setOrganization=YS,i.setOrganizationAccess=jS,i.setOrganizationAccesses=qS,i.setOrganizations=KS,i.setProfilePicture=AP,i.setProject=cI,i.setProjectAccess=AT,i.setProjectAccesses=fT,i.setProjectAttachment=wT,i.setProjectAttachments=vT,i.setProjectFile=LT,i.setProjectFiles=GT,i.setProjects=nI,i.setRehydrated=EP,i.setTeam=qI,i.setTeamMembership=FI,i.setTeamMemberships=PI,i.setTeams=$I,i.setTokens=DF,i.setUploadUrl=zh,i.setUser=PS,i.setUsers=FS,i.shallowEqual=EO,i.slugify=KO,i.spacesToDashesLower=WO,i.teamMembershipReducer=RI,i.teamMembershipSlice=ba,i.teamReducer=HI,i.teamSlice=_a,i.toFileNameSafeString=HO,i.toUuidArray=Ja,i.toUuidIdRecord=NO,i.truncate=YO,i.updateAsset=Mr,i.updateAssetAttachment=yn,i.updateAssetAttachments=pn,i.updateAssetProcedure=Cc,i.updateAssetProcedureStep=Ar,i.updateAssetProcedureStepFieldValues=sr,i.updateAssetProcedureStepFieldValuesAttachment=Gd,i.updateAssetProcedureStepFieldValuesAttachments=kd,i.updateAssetProcedureStepFieldValuesMany=ir,i.updateAssetProcedureStepFields=vd,i.updateAssetProcedureStepFieldsAttachment=Ad,i.updateAssetProcedureStepFieldsAttachments=fd,i.updateAssetProcedureStepFieldsMany=Ed,i.updateAssetProcedureSteps=fr,i.updateAssetProcedureType=ed,i.updateAssetProcedureTypeAttachment=Rn,i.updateAssetProcedureTypeAttachments=wn,i.updateAssetProcedureTypeFieldValues=wc,i.updateAssetProcedureTypeFieldValuesAttachment=pc,i.updateAssetProcedureTypeFieldValuesAttachments=Ac,i.updateAssetProcedureTypeFieldValuesMany=vc,i.updateAssetProcedureTypeFields=sc,i.updateAssetProcedureTypeFieldsAttachment=Gn,i.updateAssetProcedureTypeFieldsAttachments=kn,i.updateAssetProcedureTypeFieldsMany=ic,i.updateAssetProcedureTypes=td,i.updateAssetProcedures=Lc,i.updateAssetStage=iu,i.updateAssetStageCompletion=Gr,i.updateAssetStageCompletions=kr,i.updateAssetStages=au,i.updateAssetType=ao,i.updateAssetTypeAttachment=pu,i.updateAssetTypeAttachments=Au,i.updateAssetTypeFieldValues=Al,i.updateAssetTypeFieldValuesAttachment=sl,i.updateAssetTypeFieldValuesAttachments=il,i.updateAssetTypeFieldValuesMany=fl,i.updateAssetTypeFields=ku,i.updateAssetTypeFieldsAttachment=wu,i.updateAssetTypeFieldsAttachments=vu,i.updateAssetTypeFieldsMany=Nu,i.updateAssetTypeIdentifier=vl,i.updateAssetTypeIdentifierValue=Nl,i.updateAssetTypeIdentifierValues=Hl,i.updateAssetTypeIdentifiers=El,i.updateAssetTypeStatus=To,i.updateAssetTypeStatuses=Io,i.updateAssetTypes=no,i.updateAssets=Rr,i.updateCategories=$o,i.updateCategory=qo,i.updateConversation=dn,i.updateConversations=iF,i.updateDocument=uh,i.updateDocumentAttachment=Zo,i.updateDocumentAttachments=Jo,i.updateDocuments=lh,i.updateEmailDomain=Ph,i.updateEmailDomains=gh,i.updateForm=Cm,i.updateFormIdentifier=Gh,i.updateFormIdentifierValue=sm,i.updateFormIdentifierValues=im,i.updateFormIdentifiers=kh,i.updateFormRevision=Rm,i.updateFormRevisionAttachment=Am,i.updateFormRevisionAttachments=fm,i.updateFormRevisions=wm,i.updateFormSubmission=oy,i.updateFormSubmissionAttachment=xm,i.updateFormSubmissionAttachments=ey,i.updateFormSubmissions=hy,i.updateForms=Lm,i.updateGeoImage=by,i.updateGeoImages=_y,i.updateIssue=Up,i.updateIssueAssociation=$y,i.updateIssueAssociations=Dy,i.updateIssueAttachment=xy,i.updateIssueAttachments=ep,i.updateIssueComment=Mp,i.updateIssueCommentAttachment=mp,i.updateIssueCommentAttachments=yp,i.updateIssueComments=Rp,i.updateIssueType=kf,i.updateIssueTypeAttachment=xp,i.updateIssueTypeAttachments=eA,i.updateIssueTypeFieldValues=MA,i.updateIssueTypeFieldValuesAttachment=ef,i.updateIssueTypeFieldValuesAttachments=tf,i.updateIssueTypeFieldValuesMany=RA,i.updateIssueTypeFields=LA,i.updateIssueTypeFieldsAttachment=mA,i.updateIssueTypeFieldsAttachments=yA,i.updateIssueTypeFieldsMany=GA,i.updateIssueTypeIdentifier=pf,i.updateIssueTypeIdentifierValue=wf,i.updateIssueTypeIdentifierValues=vf,i.updateIssueTypeIdentifiers=Af,i.updateIssueTypeStatus=iS,i.updateIssueTypeStatuses=aS,i.updateIssueTypes=Nf,i.updateIssueUpdate=yS,i.updateIssueUpdates=pS,i.updateIssues=Cp,i.updateOrganization=QS,i.updateOrganizationAccess=$S,i.updateOrganizationAccesses=DS,i.updateOrganizations=XS,i.updateProject=lI,i.updateProjectAccess=ST,i.updateProjectAccesses=TT,i.updateProjectAttachment=ET,i.updateProjectAttachments=VT,i.updateProjectFile=HT,i.updateProjectFiles=WT,i.updateProjects=uI,i.updateTeam=DI,i.updateTeamMembership=gI,i.updateTeamMemberships=bI,i.updateTeams=UI,i.updateUser=_S,i.updateUsers=bS,i.useSelectorBuilder=UP,i.userReducer=RS,i.userSlice=oa,i.uuidObj=F,i.versioningReducer=KI,i.versioningSlice=WI,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
|