@overmap-ai/core 1.0.78-bulk-update.6 → 1.0.78-bulk-update.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/dist/overmap-core.js +5494 -5223
  2. package/dist/overmap-core.umd.cjs +7 -7
  3. package/dist/sdk/services/AssetAttachmentService.d.ts +1 -21
  4. package/dist/sdk/services/AssetProcedureService.d.ts +1 -111
  5. package/dist/sdk/services/AssetProcedureStepFieldValuesAttachmentService.d.ts +1 -111
  6. package/dist/sdk/services/AssetProcedureStepFieldValuesService.d.ts +1 -111
  7. package/dist/sdk/services/AssetProcedureStepFieldsAttachmentService.d.ts +1 -111
  8. package/dist/sdk/services/AssetProcedureStepFieldsService.d.ts +1 -111
  9. package/dist/sdk/services/AssetProcedureStepService.d.ts +1 -111
  10. package/dist/sdk/services/AssetProcedureTypeAttachmentService.d.ts +1 -21
  11. package/dist/sdk/services/AssetProcedureTypeFieldValuesAttachmentService.d.ts +1 -111
  12. package/dist/sdk/services/AssetProcedureTypeFieldValuesService.d.ts +1 -111
  13. package/dist/sdk/services/AssetProcedureTypeFieldsAttachmentService.d.ts +1 -111
  14. package/dist/sdk/services/AssetProcedureTypeFieldsService.d.ts +1 -21
  15. package/dist/sdk/services/AssetProcedureTypeService.d.ts +1 -21
  16. package/dist/sdk/services/AssetService.d.ts +1 -111
  17. package/dist/sdk/services/AssetStageCompletionService.d.ts +1 -111
  18. package/dist/sdk/services/AssetStageService.d.ts +1 -111
  19. package/dist/sdk/services/AssetTypeAttachmentService.d.ts +1 -21
  20. package/dist/sdk/services/AssetTypeFieldValuesAttachmentService.d.ts +1 -111
  21. package/dist/sdk/services/AssetTypeFieldValuesService.d.ts +1 -111
  22. package/dist/sdk/services/AssetTypeFieldsAttachmentService.d.ts +1 -111
  23. package/dist/sdk/services/AssetTypeFieldsService.d.ts +1 -111
  24. package/dist/sdk/services/AssetTypeIdentifierService.d.ts +1 -21
  25. package/dist/sdk/services/AssetTypeIdentifierValueService.d.ts +1 -21
  26. package/dist/sdk/services/AssetTypeService.d.ts +1 -21
  27. package/dist/sdk/services/AssetTypeStatusService.d.ts +1 -111
  28. package/dist/sdk/services/CategoryService.d.ts +1 -111
  29. package/dist/sdk/services/DocumentAttachmentService.d.ts +1 -21
  30. package/dist/sdk/services/DocumentService.d.ts +1 -21
  31. package/dist/sdk/services/EmailDomainsService.d.ts +1 -111
  32. package/dist/sdk/services/FormIdentifierService.d.ts +1 -21
  33. package/dist/sdk/services/FormIdentifierValueService.d.ts +1 -21
  34. package/dist/sdk/services/FormRevisionAttachmentService.d.ts +2 -132
  35. package/dist/sdk/services/FormRevisionService.d.ts +1 -111
  36. package/dist/sdk/services/FormService.d.ts +1 -111
  37. package/dist/sdk/services/FormSubmissionAttachmentService.d.ts +2 -42
  38. package/dist/sdk/services/FormSubmissionService.d.ts +1 -21
  39. package/dist/sdk/services/GeoImageService.d.ts +1 -111
  40. package/dist/sdk/services/IssueAssociationService.d.ts +1 -111
  41. package/dist/sdk/services/IssueAttachmentService.d.ts +1 -21
  42. package/dist/sdk/services/IssueCommentAttachmentService.d.ts +1 -21
  43. package/dist/sdk/services/IssueCommentService.d.ts +1 -21
  44. package/dist/sdk/services/IssueService.d.ts +1 -21
  45. package/dist/sdk/services/IssueTypeAttachmentService.d.ts +1 -21
  46. package/dist/sdk/services/IssueTypeFieldValuesAttachmentService.d.ts +1 -111
  47. package/dist/sdk/services/IssueTypeFieldValuesService.d.ts +1 -111
  48. package/dist/sdk/services/IssueTypeFieldsAttachmentService.d.ts +1 -111
  49. package/dist/sdk/services/IssueTypeFieldsService.d.ts +1 -111
  50. package/dist/sdk/services/IssueTypeIdentifierService.d.ts +1 -21
  51. package/dist/sdk/services/IssueTypeIdentifierValueService.d.ts +1 -21
  52. package/dist/sdk/services/IssueTypeService.d.ts +1 -21
  53. package/dist/sdk/services/IssueTypeStatusService.d.ts +1 -111
  54. package/dist/sdk/services/IssueUpdateService.d.ts +4 -44
  55. package/dist/sdk/services/OrganizationAccessService.d.ts +1 -21
  56. package/dist/sdk/services/OrganizationService.d.ts +1 -111
  57. package/dist/sdk/services/ProjectAccessService.d.ts +1 -21
  58. package/dist/sdk/services/ProjectAttachmentService.d.ts +1 -21
  59. package/dist/sdk/services/ProjectFileService.d.ts +1 -111
  60. package/dist/sdk/services/ProjectService.d.ts +1 -111
  61. package/dist/sdk/services/TeamMembershipService.d.ts +1 -21
  62. package/dist/sdk/services/TeamService.d.ts +1 -21
  63. package/dist/sdk/services/UserService.d.ts +1 -111
  64. package/dist/store/selectors/hooks.d.ts +1 -0
  65. package/dist/store/selectors/utils.d.ts +1 -0
  66. package/dist/store/slices/agentsSlice.d.ts +1 -21
  67. package/dist/store/slices/assetAttachmentSlice.d.ts +1 -21
  68. package/dist/store/slices/assetProcedureSlice.d.ts +1 -111
  69. package/dist/store/slices/assetProcedureStepFieldValuesAttachmentSlice.d.ts +1 -111
  70. package/dist/store/slices/assetProcedureStepFieldValuesSlice.d.ts +1 -111
  71. package/dist/store/slices/assetProcedureStepFieldsAttachmentSlice.d.ts +1 -111
  72. package/dist/store/slices/assetProcedureStepFieldsSlice.d.ts +1 -111
  73. package/dist/store/slices/assetProcedureStepSlice.d.ts +2 -132
  74. package/dist/store/slices/assetProcedureTypeAttachmentSlice.d.ts +4 -44
  75. package/dist/store/slices/assetProcedureTypeFieldValuesAttachmentSlice.d.ts +1 -111
  76. package/dist/store/slices/assetProcedureTypeFieldValuesSlice.d.ts +1 -111
  77. package/dist/store/slices/assetProcedureTypeFieldsAttachmentSlice.d.ts +1 -111
  78. package/dist/store/slices/assetProcedureTypeFieldsSlice.d.ts +1 -21
  79. package/dist/store/slices/assetProcedureTypeSlice.d.ts +1 -21
  80. package/dist/store/slices/assetSlice.d.ts +1 -111
  81. package/dist/store/slices/assetStageCompletionSlice.d.ts +1 -111
  82. package/dist/store/slices/assetStageSlice.d.ts +1 -111
  83. package/dist/store/slices/assetTypeAttachmentSlice.d.ts +1 -21
  84. package/dist/store/slices/assetTypeFieldValuesAttachmentSlice.d.ts +1 -111
  85. package/dist/store/slices/assetTypeFieldValuesSlice.d.ts +1 -111
  86. package/dist/store/slices/assetTypeFieldsAttachmentSlice.d.ts +1 -111
  87. package/dist/store/slices/assetTypeFieldsSlice.d.ts +1 -111
  88. package/dist/store/slices/assetTypeIdentifierSlice.d.ts +1 -21
  89. package/dist/store/slices/assetTypeIdentifierValueSlice.d.ts +1 -21
  90. package/dist/store/slices/assetTypeSlice.d.ts +1 -21
  91. package/dist/store/slices/assetTypeStatusSlice.d.ts +1 -111
  92. package/dist/store/slices/categorySlice.d.ts +1 -111
  93. package/dist/store/slices/documentAttachmentSlice.d.ts +1 -21
  94. package/dist/store/slices/documentSlice.d.ts +2 -42
  95. package/dist/store/slices/emailDomainsSlice.d.ts +3 -223
  96. package/dist/store/slices/formIdentifierSlice.d.ts +1 -21
  97. package/dist/store/slices/formIdentifierValueSlice.d.ts +1 -21
  98. package/dist/store/slices/formRevisionAttachmentSlice.d.ts +2 -132
  99. package/dist/store/slices/formRevisionSlice.d.ts +1 -111
  100. package/dist/store/slices/formSlice.d.ts +1 -111
  101. package/dist/store/slices/formSubmissionAttachmentSlice.d.ts +3 -63
  102. package/dist/store/slices/formSubmissionSlice.d.ts +1 -21
  103. package/dist/store/slices/geoImageSlice.d.ts +1 -111
  104. package/dist/store/slices/issueAssociationSlice.d.ts +1 -111
  105. package/dist/store/slices/issueAttachmentSlice.d.ts +1 -21
  106. package/dist/store/slices/issueCommentAttachmentSlice.d.ts +1 -21
  107. package/dist/store/slices/issueCommentSlice.d.ts +1 -21
  108. package/dist/store/slices/issueSlice.d.ts +1 -21
  109. package/dist/store/slices/issueTypeAttachmentSlice.d.ts +3 -43
  110. package/dist/store/slices/issueTypeFieldValuesAttachmentSlice.d.ts +1 -111
  111. package/dist/store/slices/issueTypeFieldValuesSlice.d.ts +1 -111
  112. package/dist/store/slices/issueTypeFieldsAttachmentSlice.d.ts +1 -111
  113. package/dist/store/slices/issueTypeFieldsSlice.d.ts +1 -111
  114. package/dist/store/slices/issueTypeIdentifierSlice.d.ts +1 -21
  115. package/dist/store/slices/issueTypeIdentifierValueSlice.d.ts +1 -21
  116. package/dist/store/slices/issueTypeSlice.d.ts +1 -21
  117. package/dist/store/slices/issueTypeStatusSlice.d.ts +1 -111
  118. package/dist/store/slices/issueUpdateSlice.d.ts +7 -67
  119. package/dist/store/slices/organizationAccessSlice.d.ts +1 -21
  120. package/dist/store/slices/organizationSlice.d.ts +1 -111
  121. package/dist/store/slices/projectAccessSlice.d.ts +1 -21
  122. package/dist/store/slices/projectAttachmentSlice.d.ts +3 -43
  123. package/dist/store/slices/projectFileSlice.d.ts +1 -111
  124. package/dist/store/slices/projectSlice.d.ts +1 -111
  125. package/dist/store/slices/teamMembershipSlice.d.ts +1 -21
  126. package/dist/store/slices/teamSlice.d.ts +1 -21
  127. package/dist/store/slices/userSlice.d.ts +1 -111
  128. package/dist/store/typings.d.ts +1 -1
  129. package/package.json +1 -1
@@ -1,15 +1,15 @@
1
- (function(i,k){typeof exports=="object"&&typeof module<"u"?k(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("react-fast-compare"),require("react-redux"),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","react-fast-compare","react-redux","@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"],k):(i=typeof globalThis<"u"?globalThis:i||self,k(i["overmap-core"]={},null,i.toolkit,i.request,i.uuid,i.fileSaver,i.buildTree,i.tsTreeLib,i.react,i.isEqual,i.reactRedux,i.reduxOffline,i.offlineConfig,i.localforage,i.createMigration,null,null,i.idb,i.jwtDecode,i.dependencyGraph))})(this,function(i,k,p,st,xe,MO,Nn,yt,RO,wO,EO,vO,Gn,VO,zO,bb,_b,BO,jO,qO){"use strict";var Fb=Object.defineProperty;var gb=(i,k,p)=>k in i?Fb(i,k,{enumerable:!0,configurable:!0,writable:!0,value:p}):i[k]=p;var m=(i,k,p)=>gb(i,typeof k!="symbol"?k+"":k,p);var bO;const Hn=Object.freeze([]),Kn=Object.freeze({});var Wn=(t=>(t[t.GUEST=0]="GUEST",t[t.BASIC=2]="BASIC",t[t.ADMIN=4]="ADMIN",t))(Wn||{}),h=(t=>(t.GET="GET",t.POST="POST",t.PATCH="PATCH",t.PUT="PUT",t.DELETE="DELETE",t))(h||{}),Yn=(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))(Yn||{}),Zn=(t=>(t.Issue="issue",t.Asset="asset",t.AssetType="asset_type",t.Project="project",t.Document="document",t))(Zn||{}),kt=(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))(kt||{}),$=(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))($||{}),Jn=(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))(Jn||{});const DO=kt.MEDIUM,Xn=6e4;function R(t){return{addOne:(o,y)=>{const A=t(y.payload);o.instances[A]=y.payload},addMany:(o,y)=>{for(const A of y.payload){const f=t(A);o.instances[f]=A}},setOne:(o,y)=>{const A=t(y.payload);o.instances[A]=y.payload},setMany:(o,y)=>{for(const A of y.payload){const f=t(A);o.instances[f]=A}},updateOne:(o,y)=>{const A=t(y.payload);o.instances[A]=y.payload},updateMany:(o,y)=>{for(const A of y.payload){const f=t(A);o.instances[f]=A}},deleteOne:(o,y)=>{delete o.instances[y.payload]},deleteMany:(o,y)=>{for(const A of y.payload)delete o.instances[A]},initialize:(o,y)=>{o.instances={};const A=new Set;for(const f of y.payload){const S=t(f);A.add(S),o.instances[S]=f}A.size!==y.payload.length&&console.warn("duplicate ids detected when initializing model instances.")}}}function CO(){return{initializeSelection:(u,d)=>{u.selection=Array.from(new Set(d.payload))},selectOne:(u,d)=>{new Set(u.selection).has(d.payload)||u.selection.push(d.payload)},selectMany:(u,d)=>{const o=new Set(u.selection);for(const y of d.payload)o.has(y)||o.add(y);u.selection=Array.from(o)},unselectOne:(u,d)=>{const o=new Set(u.selection);o.has(d.payload)&&(o.delete(d.payload),u.selection=Array.from(o))},unselectMany:(u,d)=>{const o=new Set(u.selection);for(const y of d.payload)o.has(y)&&o.delete(y);u.selection=Array.from(o)},toggleOne:(u,d)=>{const o=new Set(u.selection);o.has(d.payload)?o.delete(d.payload):o.add(d.payload),u.selection=Array.from(o)},toggleMany:(u,d)=>{const o=new Set(u.selection);for(const y of d.payload)o.has(y)?o.delete(y):o.add(y);u.selection=Array.from(o)},getInitialState:u=>({...u,selection:[]})}}const rt="versioning",_=p.createAction("RESET"),C=p.createAction("RESET_PROJECT_STATE"),w=p.createAction("RESET_ORGANIZATION_STATE"),N=R(t=>t.uuid),Qn={instances:{}},Lt=p.createSlice({name:"agents",initialState:Qn,extraReducers:t=>t.addMatcher(p.isAnyOf(_,C,w),s=>Object.assign(s,Qn)),reducers:{initializeConversations:N.initialize,addConversation:N.addOne,addConversations:N.addMany,setConversation:N.setOne,setConversations:N.setMany,updateConversation:N.updateOne,updateConversations:N.updateMany,deleteConversation:N.deleteOne,deleteConversations:N.deleteMany}}),{initializeConversations:xn,addConversation:ea,addConversations:$O,setConversation:ta,setConversations:UO,updateConversation:sa,updateConversations:kO,deleteConversation:LO,deleteConversations:NO}=Lt.actions,Nt=t=>t.agentsReducer.instances,GO=p.createSelector([Nt],t=>Object.values(t)),HO=p.createSelector([Nt,(t,s)=>s],(t,s)=>t[s]),ia=Lt.reducer;bO=Symbol.toStringTag;class Gt{constructor(){m(this,bO,"Promise");m(this,"_promise");m(this,"_resolve");m(this,"_reject");m(this,"_state","pending");this._resolve=null,this._reject=null,this._promise=new Promise((s,e)=>{this._resolve=s,this._reject=e})}get state(){return this._state}then(s,e){return this._promise.then(s,e)}catch(s){return this._promise.catch(s)}resolve(s){if(!this._resolve)throw new Error("No resolve callback");this._resolve(s),this._state="fulfilled"}reject(s){if(!this._reject)throw s;this._reject(s),this._state="rejected"}finally(s){throw new Error("`finally` not implemented")}}let Ht=!1;["true","1"].includes("".toLowerCase())&&(Ht=!0);function KO(t,s){if(t===s)return!0;if(typeof t!=typeof s)return!1;const e=Object.keys(t),n=Object.keys(s),a=e.length;if(a!==n.length)return!1;for(let c=0;c<a;c++){const r=e[c];if(!Object.prototype.hasOwnProperty.call(s,r)||t[r]!==s[r])return!1}return!0}function Kt(t){const s={};return function(){const e=Array.prototype.slice.call(arguments);return e in s?(Ht&&console.debug(`Memoization debug: Using memorized return value for ${t.toString()}(`,e,")"),s[e]):(Ht&&console.debug(`Memoization debug: Cache miss! Memoizing ${t.toString()}(`,e,")"),s[e]=t.apply(this,e))}}function WO(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 T=t=>t.length===0?Hn:t,pt=t=>Object.keys(t).length===0?Kn:t,na=Kt(t=>{if(!t)return"";const s=new Date(t),e=s.getFullYear()===Wt.getFullYear(),n={day:"numeric",month:"short"};return e||(n.year="numeric"),s.toLocaleDateString([],n)}),YO=new Intl.RelativeTimeFormat([],{style:"long",numeric:"auto"}),ZO=1e3*86400,Wt=new Date,JO=t=>new Date(t).toDateString()===Wt.toDateString(),XO=Kt((t,s,e)=>{const n=Math.round((new Date(t).getTime()-Wt.getTime())/ZO);return n<s||n>e?na(t):YO.format(n,"days")});function QO(t){return new Uint8Array(t).reduce((e,n)=>e+n.toString(16).padStart(2,"0"),"")}const Yt=async(t,s)=>{s||(s=await it(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 it(t){return new Promise((s,e)=>{const n=new FileReader;n.onload=()=>{const a=n.result;if(!a){e(new Error("FileReader did not return a valid ArrayBuffer."));return}crypto.subtle.digest("SHA-1",a).then(c=>{const r=QO(c);s(r)})},n.readAsArrayBuffer(t)})}function xO(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 aa(t,s){return new File([t],s,{type:t.type})}function eP(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 tP=async t=>{const s={};for(const e of t){const n=await it(e);s[n]={sha1:n,extension:e.name.split(".").pop()||"",file_type:e.type,size:e.size}}return Object.values(s)},ca=async t=>(await fetch(t)).blob(),sP=t=>new Promise((s,e)=>{const n=new FileReader;n.onloadend=()=>{var a;s(((a=n.result)==null?void 0:a.toString())||"")},n.readAsDataURL(t)});function iP(t){const s=new Blob([t]);MO.saveAs(s,t.name)}const da={};function nP(t,s,e,...n){const a=da[t];let c=!1;a?a[s]||(a[s]=!0,c=!0):(da[t]={[s]:!0},c=!0),c&&console[e](...n)}const ra=["created_at","updated_at","index","revision"];function M(t){return{...t,uuid:xe.v4()}}function aP(t){const s={};for(const e of t)s[e.uuid]=e;return s}function D(t){return t.map(({uuid:s})=>s)}function At(t,s){return t.localeCompare(s)}function Zt(t,s){return At(t.uuid,s.uuid)}function cP(t,s=void 0,e=255){let n=t.replace(/[^a-z0-9_\-.]/gi,"_").replace(/_{2,}/g,"_");if(!s){const c=t.split(".");c.length>1&&(s=c[c.length-1])}s&&!s.startsWith(".")&&(s="."+s);const a=s?s.length:0;return n.length+a>e&&(n=n.slice(0,e-a)+(s||"")),n}function dP(t){return t.toLowerCase().replace(" ","-")}function rP(t,s=!1){return t.normalize("NFKD").toLowerCase().replace(/[^\w\s-]/g,"").trim().replace(/[-\s]+/g,s?"_":"-")}function uP(t,s){if(t.length<=s)return t;const e=t.slice(0,s-1);return e.slice(0,e.lastIndexOf(" "))+"…"}const lP=/^.+@.+\..+$/;function V(t){const s={...t};for(const e of[...ra,"created_by"])e in s&&delete s[e];return s}const ua=t=>{const s=t.toSorted((e,n)=>e.order-n.order);return Nn(s,{id:e=>e.uuid,parentId:e=>e.parent,includeEmptyChildrenArray:!0,valueKey:!1})},oP=t=>{const{roots:s}=ua(t);return s.map(e=>new yt.Tree(e))},la=(t,s)=>{const{nodes:e}=ua(s),n=e.get(t);if(!n)throw new Error(`Node with uuid ${t} does not exist in asset procedure step tree.`);return new yt.Tree(n)},oa=(t,s)=>t.type!==s.type?t.type-s.type:t.order-s.order,ha=(t,s)=>t.type!==s.type?t.type-s.type:t.order-s.order,ma=t=>Nn(t,{id:s=>s.uuid,parentId:s=>s.parent_document,includeEmptyChildrenArray:!0,valueKey:!1}),hP=t=>{const{roots:s}=ma(t);return s.map(e=>new yt.Tree(e))},ya=(t,s)=>{const{nodes:e}=ma(s),n=e.get(t);if(!n)throw new Error(`Node with uuid ${t} does not exist in document tree.`);return new yt.Tree(n)};function mP(t,s){return RO.useMemo(t,s)}class yP{constructor(s){m(this,"operations",[]);m(this,"getData");this.getData=s}performOperations(s){let e=s;for(const n of this.operations)e=n(e);return e}filter(s,e){return this.operations.push(n=>n.filter(a=>a[s]===e)),this}exclude(s,e){return this.operations.push(n=>n.filter(a=>a[s]!==e)),this}orderBy(s){return this.operations.push(e=>[...e].sort((n,a)=>n[s]<=a[s]?1:-1)),this}reverse(){return this.operations.push(s=>[...s].reverse()),this}all(){return this.operations.push(s=>s),this}get(s,e){return p.createSelector([this.getData],n=>this.performOperations(n).find(a=>a[s]===e))}count(){return p.createSelector([this.getData],s=>this.performOperations(s).length)}first(){return p.createSelector([this.getData],s=>this.performOperations(s)[0])}last(){return p.createSelector([this.getData],s=>{const e=this.performOperations(s);return e[e.length-1]})}exists(){return p.createSelector([this.getData],s=>this.performOperations(s).length>0)}toSelector(){return p.createSelector([this.getData],s=>T(this.performOperations(s)))}}const I=p.createSelectorCreator({memoize:p.lruMemoize,memoizeOptions:{resultEqualityCheck:EO.shallowEqual}}),pP=p.createSelectorCreator({memoize:p.lruMemoize,memoizeOptions:{resultEqualityCheck:wO}}),G=R(t=>t.uuid),pa={instances:{}},Jt=p.createSlice({name:"assetAttachments",initialState:pa,extraReducers:t=>t.addMatcher(p.isAnyOf(_,C,w),s=>Object.assign(s,pa)),reducers:{initializeAssetAttachments:G.initialize,addAssetAttachment:G.addOne,addAssetAttachments:G.addMany,setAssetAttachment:G.setOne,setAssetAttachments:G.setMany,updateAssetAttachment:G.updateOne,updateAssetAttachments:G.updateMany,deleteAssetAttachment:G.deleteOne,deleteAssetAttachments:G.deleteMany}}),{initializeAssetAttachments:Aa,addAssetAttachment:fa,addAssetAttachments:Xt,setAssetAttachment:Ta,setAssetAttachments:Sa,updateAssetAttachment:Ia,updateAssetAttachments:Oa,deleteAssetAttachment:Pa,deleteAssetAttachments:Qt}=Jt.actions,Fa=t=>t.assetAttachmentReducer.instances,xt=p.createSelector([Fa],t=>Object.values(t)),ga=(t,s)=>t.assetAttachmentReducer.instances[s],ba=I([xt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),_a=I([xt,(t,s)=>s],(t,s)=>T(t.filter(({asset:e})=>s===e))),Ma=Jt.reducer,H=R(({uuid:t})=>t),Ra={instances:{}},es=p.createSlice({name:"assetProcedureTypeAttachments",initialState:Ra,extraReducers:t=>t.addMatcher(p.isAnyOf(_,w),s=>Object.assign(s,Ra)),reducers:{initializeAssetProcedureTypeAttachments:H.initialize,addAssetProcedureTypeAttachment:H.addOne,addAssetProcedureTypeAttachments:H.addMany,setAssetProcedureTypeAttachment:H.setOne,setAssetProcedureTypeAttachments:H.setMany,updateAssetProcedureTypeAttachment:H.updateOne,updateAssetProcedureTypeAttachments:H.updateMany,deleteAssetProcedureTypeAttachment:H.deleteOne,deleteAssetProcedureTypeAttachments:H.deleteMany}}),{initializeAssetProcedureTypeAttachments:wa,addAssetProcedureTypeAttachment:Ea,addAssetProcedureTypeAttachments:va,setAssetProcedureTypeAttachment:Va,setAssetProcedureTypeAttachments:za,updateAssetProcedureTypeAttachment:Ba,updateAssetProcedureTypeAttachments:ja,deleteAssetProcedureTypeAttachment:qa,deleteAssetProcedureTypeAttachments:Da}=es.actions,Ca=es.reducer,$a=t=>t.assetProcedureTypeAttachmentReducer.instances,ts=p.createSelector([$a],t=>Object.values(t)),Ua=(t,s)=>t.assetProcedureTypeAttachmentReducer.instances[s],ka=I([ts,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),AP=I([ts,(t,s)=>s],(t,s)=>T(t.filter(({asset_procedure_type:e})=>s===e))),K=R(({uuid:t})=>t),La={instances:{}},ss=p.createSlice({name:"assetProcedureTypeFieldsAttachments",initialState:La,extraReducers:t=>t.addMatcher(p.isAnyOf(_,w),s=>Object.assign(s,La)),reducers:{initializeAssetProcedureTypeFieldsAttachments:K.initialize,addAssetProcedureTypeFieldsAttachment:K.addOne,addAssetProcedureTypeFieldsAttachments:K.addMany,setAssetProcedureTypeFieldsAttachment:K.setOne,setAssetProcedureTypeFieldsAttachments:K.setMany,updateAssetProcedureTypeFieldsAttachment:K.updateOne,updateAssetProcedureTypeFieldsAttachments:K.updateMany,deleteAssetProcedureTypeFieldsAttachment:K.deleteOne,deleteAssetProcedureTypeFieldsAttachments:K.deleteMany}}),{initializeAssetProcedureTypeFieldsAttachments:Na,addAssetProcedureTypeFieldsAttachment:Ga,addAssetProcedureTypeFieldsAttachments:Ha,setAssetProcedureTypeFieldsAttachment:Ka,setAssetProcedureTypeFieldsAttachments:Wa,updateAssetProcedureTypeFieldsAttachment:Ya,updateAssetProcedureTypeFieldsAttachments:Za,deleteAssetProcedureTypeFieldsAttachment:Ja,deleteAssetProcedureTypeFieldsAttachments:Xa}=ss.actions,Qa=ss.reducer,xa=t=>t.assetProcedureTypeFieldsAttachmentReducer.instances,is=p.createSelector([xa],t=>Object.values(t)),fP=I([is,(t,s)=>s],(t,s)=>T(t.filter(e=>e.fields_revision===s))),ec=(t,s)=>t.assetProcedureTypeFieldsAttachmentReducer.instances[s],tc=I([is,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),W=R(({uuid:t})=>t),sc={instances:{}},ns=p.createSlice({name:"assetProcedureTypeFields",initialState:sc,extraReducers:t=>t.addMatcher(p.isAnyOf(_,w),s=>Object.assign(s,sc)),reducers:{initializeAssetProcedureTypeFields:W.initialize,addAssetProcedureTypeFields:W.addOne,addAssetProcedureTypeFieldsMany:W.addMany,setAssetProcedureTypeFields:W.setOne,setAssetProcedureTypeFieldsMany:W.setMany,updateAssetProcedureTypeFields:W.updateOne,updateAssetProcedureTypeFieldsMany:W.updateMany,deleteAssetProcedureTypeFields:W.deleteOne,deleteAssetProcedureTypeFieldsMany:W.deleteMany}}),{initializeAssetProcedureTypeFields:ic,addAssetProcedureTypeFields:nc,addAssetProcedureTypeFieldsMany:ac,setAssetProcedureTypeFields:cc,setAssetProcedureTypeFieldsMany:dc,updateAssetProcedureTypeFields:rc,updateAssetProcedureTypeFieldsMany:uc,deleteAssetProcedureTypeFields:lc,deleteAssetProcedureTypeFieldsMany:oc}=ns.actions,hc=ns.reducer,mc=t=>t.assetProcedureTypeFieldsReducer.instances,ft=p.createSelector([mc],t=>Object.values(t)),TP=I([ft,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_procedure_type===s))),SP=p.createSelector([ft,(t,s)=>s],(t,s)=>t.filter(e=>e.asset_procedure_type===s).sort((e,n)=>e.submitted_at>n.submitted_at?-1:1)[0]),yc=(t,s)=>t.assetProcedureTypeFieldsReducer.instances[s],pc=I([ft,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),Y=R(({uuid:t})=>t),Ac={instances:{}},as=p.createSlice({name:"assetProcedureTypeFieldValuesAttachments",initialState:Ac,extraReducers:t=>t.addMatcher(p.isAnyOf(_,C,w),s=>Object.assign(s,Ac)),reducers:{initializeAssetProcedureTypeFieldValuesAttachments:Y.initialize,addAssetProcedureTypeFieldValuesAttachment:Y.addOne,addAssetProcedureTypeFieldValuesAttachments:Y.addMany,setAssetProcedureTypeFieldValuesAttachment:Y.setOne,setAssetProcedureTypeFieldValuesAttachments:Y.setMany,updateAssetProcedureTypeFieldValuesAttachment:Y.updateOne,updateAssetProcedureTypeFieldValuesAttachments:Y.updateMany,deleteAssetProcedureTypeFieldValuesAttachment:Y.deleteOne,deleteAssetProcedureTypeFieldValuesAttachments:Y.deleteMany}}),{initializeAssetProcedureTypeFieldValuesAttachments:fc,addAssetProcedureTypeFieldValuesAttachment:Tc,addAssetProcedureTypeFieldValuesAttachments:cs,setAssetProcedureTypeFieldValuesAttachment:Sc,setAssetProcedureTypeFieldValuesAttachments:Ic,updateAssetProcedureTypeFieldValuesAttachment:Oc,updateAssetProcedureTypeFieldValuesAttachments:Pc,deleteAssetProcedureTypeFieldValuesAttachment:Fc,deleteAssetProcedureTypeFieldValuesAttachments:ds}=as.actions,gc=as.reducer,bc=t=>t.assetProcedureTypeFieldValuesAttachmentReducer.instances,rs=p.createSelector([bc],t=>Object.values(t)),_c=(t,s)=>t.assetProcedureTypeFieldValuesAttachmentReducer.instances[s],Mc=I([rs,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),Rc=I([rs,(t,s)=>s],(t,s)=>T(t.filter(e=>e.field_values===s))),Z=R(({uuid:t})=>t),wc={instances:{}},us=p.createSlice({name:"assetProcedureTypeFieldValues",initialState:wc,extraReducers:t=>t.addMatcher(p.isAnyOf(_,C,w),s=>Object.assign(s,wc)),reducers:{initializeAssetProcedureTypeFieldValues:Z.initialize,addAssetProcedureTypeFieldValues:Z.addOne,addAssetProcedureTypeFieldValuesMany:Z.addMany,setAssetProcedureTypeFieldValues:Z.setOne,setAssetProcedureTypeFieldValuesMany:Z.setMany,updateAssetProcedureTypeFieldValues:Z.updateOne,updateAssetProcedureTypeFieldValuesMany:Z.updateMany,deleteAssetProcedureTypeFieldValues:Z.deleteOne,deleteAssetProcedureTypeFieldValuesMany:Z.deleteMany}}),{initializeAssetProcedureTypeFieldValues:Ec,addAssetProcedureTypeFieldValues:vc,addAssetProcedureTypeFieldValuesMany:Vc,setAssetProcedureTypeFieldValues:zc,setAssetProcedureTypeFieldValuesMany:Bc,updateAssetProcedureTypeFieldValues:jc,updateAssetProcedureTypeFieldValuesMany:qc,deleteAssetProcedureTypeFieldValues:Dc,deleteAssetProcedureTypeFieldValuesMany:Cc}=us.actions,$c=us.reducer,Uc=t=>t.assetProcedureTypeFieldValuesReducer.instances,Tt=p.createSelector([Uc],t=>Object.values(t)),IP=I([Tt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset===s))),OP=I([Tt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_procedure===s))),kc=(t,s)=>t.assetProcedureTypeFieldValuesReducer.instances[s],Lc=I([Tt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),J=R(({uuid:t})=>t),Nc={instances:{}},ls=p.createSlice({name:"assetProcedures",initialState:Nc,extraReducers:t=>t.addMatcher(p.isAnyOf(_,C,w),s=>Object.assign(s,Nc)),reducers:{initializeAssetProcedures:J.initialize,addAssetProcedure:J.addOne,addAssetProcedures:J.addMany,setAssetProcedure:J.setOne,setAssetProcedures:J.setMany,updateAssetProcedure:J.updateOne,updateAssetProcedures:J.updateMany,deleteAssetProcedure:J.deleteOne,deleteAssetProcedures:J.deleteMany}}),{initializeAssetProcedures:Gc,addAssetProcedure:Hc,addAssetProcedures:os,updateAssetProcedure:Kc,updateAssetProcedures:Wc,deleteAssetProcedure:Yc,deleteAssetProcedures:hs,setAssetProcedure:Zc,setAssetProcedures:Jc}=ls.actions,Xc=ls.reducer,Qc=t=>t.assetProcedureReducer.instances,St=p.createSelector([Qc],t=>Object.values(t)),xc=I([St,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_procedure_type===s))),PP=I([St,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_type===s))),ed=(t,s)=>t.assetProcedureReducer.instances[s],td=I([St,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),X=R(t=>t.uuid),sd={instances:{}},ms=p.createSlice({name:"assetProcedureTypes",initialState:sd,extraReducers:t=>t.addMatcher(p.isAnyOf(_,w),s=>Object.assign(s,sd)),reducers:{initializeAssetProcedureTypes:X.initialize,addAssetProcedureType:X.addOne,addAssetProcedureTypes:X.addMany,setAssetProcedureType:X.setOne,setAssetProcedureTypes:X.setMany,updateAssetProcedureType:X.updateOne,updateAssetProcedureTypes:X.updateMany,deleteAssetProcedureType:X.deleteOne,deleteAssetProcedureTypes:X.deleteMany}}),{initializeAssetProcedureTypes:id,addAssetProcedureType:nd,addAssetProcedureTypes:ad,updateAssetProcedureType:cd,updateAssetProcedureTypes:dd,deleteAssetProcedureType:rd,deleteAssetProcedureTypes:ud,setAssetProcedureType:ld,setAssetProcedureTypes:od}=ms.actions,hd=ms.reducer,md=t=>t.assetProcedureTypeReducer.instances,ys=p.createSelector([md],t=>Object.values(t)),yd=(t,s)=>t.assetProcedureTypeReducer.instances[s],pd=I([ys,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),FP=I([ys,(t,s)=>s],(t,s)=>T(t.filter(e=>e.organization===s))),Q=R(t=>t.uuid),Ad={instances:{}},ps=p.createSlice({name:"assetProcedureStepFieldsAttachments",initialState:Ad,extraReducers:t=>t.addMatcher(p.isAnyOf(_,w),s=>Object.assign(s,Ad)),reducers:{initializeAssetProcedureStepFieldsAttachments:Q.initialize,addAssetProcedureStepFieldsAttachment:Q.addOne,addAssetProcedureStepFieldsAttachments:Q.addMany,setAssetProcedureStepFieldsAttachment:Q.setOne,setAssetProcedureStepFieldsAttachments:Q.setMany,updateAssetProcedureStepFieldsAttachment:Q.updateOne,updateAssetProcedureStepFieldsAttachments:Q.updateMany,deleteAssetProcedureStepFieldsAttachment:Q.deleteOne,deleteAssetProcedureStepFieldsAttachments:Q.deleteMany}}),{initializeAssetProcedureStepFieldsAttachments:fd,addAssetProcedureStepFieldsAttachment:Td,addAssetProcedureStepFieldsAttachments:Sd,setAssetProcedureStepFieldsAttachment:Id,setAssetProcedureStepFieldsAttachments:Od,updateAssetProcedureStepFieldsAttachment:Pd,updateAssetProcedureStepFieldsAttachments:Fd,deleteAssetProcedureStepFieldsAttachment:gd,deleteAssetProcedureStepFieldsAttachments:bd}=ps.actions,_d=t=>t.assetProcedureStepFieldsAttachmentReducer.instances,As=p.createSelector([_d],t=>Object.values(t)),gP=I([As,(t,s)=>s],(t,s)=>T(t.filter(e=>e.fields_revision===s))),Md=(t,s)=>t.assetProcedureStepFieldsAttachmentReducer.instances[s],Rd=I([As,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),wd=ps.reducer,x=R(t=>t.uuid),Ed={instances:{}},fs=p.createSlice({name:"assetProcedureStepFields",initialState:Ed,extraReducers:t=>t.addMatcher(p.isAnyOf(_,w),s=>Object.assign(s,Ed)),reducers:{initializeAssetProcedureStepFields:x.initialize,addAssetProcedureStepFields:x.addOne,addAssetProcedureStepFieldsMany:x.addMany,setAssetProcedureStepFields:x.setOne,setAssetProcedureStepFieldsMany:x.setMany,updateAssetProcedureStepFields:x.updateOne,updateAssetProcedureStepFieldsMany:x.updateMany,deleteAssetProcedureStepFields:x.deleteOne,deleteAssetProcedureStepFieldsMany:x.deleteMany}}),{initializeAssetProcedureStepFields:vd,addAssetProcedureStepFields:Vd,addAssetProcedureStepFieldsMany:zd,setAssetProcedureStepFields:Bd,setAssetProcedureStepFieldsMany:jd,updateAssetProcedureStepFields:qd,updateAssetProcedureStepFieldsMany:Dd,deleteAssetProcedureStepFields:Cd,deleteAssetProcedureStepFieldsMany:$d}=fs.actions,Ts=t=>t.assetProcedureStepFieldsReducer.instances,It=p.createSelector([Ts],t=>Object.values(t)),bP=I([It,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_procedure_step===s))),_P=p.createSelector([It,(t,s)=>s],(t,s)=>t.filter(e=>e.asset_procedure_step===s).sort((e,n)=>e.submitted_at>n.submitted_at?-1:1)[0]),MP=p.createSelector([Ts],t=>{const s={};for(const e of Object.values(t)){const n=s[e.asset_procedure_step];(!n||n.submitted_at<e.submitted_at)&&(s[e.asset_procedure_step]=e)}return s}),Ud=(t,s)=>t.assetProcedureStepFieldsReducer.instances[s],kd=I([It,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),Ld=fs.reducer,ee=R(t=>t.uuid),Nd={instances:{}},Ss=p.createSlice({name:"assetProcedureStepFieldValuesAttachments",initialState:Nd,extraReducers:t=>t.addMatcher(p.isAnyOf(_,C,w),s=>Object.assign(s,Nd)),reducers:{initializeAssetProcedureStepFieldValuesAttachments:ee.initialize,addAssetProcedureStepFieldValuesAttachment:ee.addOne,addAssetProcedureStepFieldValuesAttachments:ee.addMany,setAssetProcedureStepFieldValuesAttachment:ee.setOne,setAssetProcedureStepFieldValuesAttachments:ee.setMany,updateAssetProcedureStepFieldValuesAttachment:ee.updateOne,updateAssetProcedureStepFieldValuesAttachments:ee.updateMany,deleteAssetProcedureStepFieldValuesAttachment:ee.deleteOne,deleteAssetProcedureStepFieldValuesAttachments:ee.deleteMany}}),{initializeAssetProcedureStepFieldValuesAttachments:Gd,addAssetProcedureStepFieldValuesAttachment:Hd,addAssetProcedureStepFieldValuesAttachments:Is,setAssetProcedureStepFieldValuesAttachment:Kd,setAssetProcedureStepFieldValuesAttachments:Wd,updateAssetProcedureStepFieldValuesAttachment:Yd,updateAssetProcedureStepFieldValuesAttachments:Zd,deleteAssetProcedureStepFieldValuesAttachment:Jd,deleteAssetProcedureStepFieldValuesAttachments:Os}=Ss.actions,Xd=t=>t.assetProcedureStepFieldValuesAttachmentReducer.instances,Ps=p.createSelector([Xd],t=>Object.values(t)),Qd=(t,s)=>t.assetProcedureStepFieldValuesAttachmentReducer.instances[s],xd=I([Ps,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),er=I([Ps,(t,s)=>s],(t,s)=>T(t.filter(e=>e.field_values===s))),tr=Ss.reducer,te=R(t=>t.uuid),sr={instances:{}},Fs=p.createSlice({name:"assetProcedureStepFieldValues",initialState:sr,extraReducers:t=>t.addMatcher(p.isAnyOf(_,C,w),s=>Object.assign(s,sr)),reducers:{initializeAssetProcedureStepFieldValues:te.initialize,addAssetProcedureStepFieldValues:te.addOne,addAssetProcedureStepFieldValuesMany:te.addMany,setAssetProcedureStepFieldValues:te.setOne,setAssetProcedureStepFieldValuesMany:te.setMany,updateAssetProcedureStepFieldValues:te.updateOne,updateAssetProcedureStepFieldValuesMany:te.updateMany,deleteAssetProcedureStepFieldValues:te.deleteOne,deleteAssetProcedureStepFieldValuesMany:te.deleteMany}}),{initializeAssetProcedureStepFieldValues:ir,addAssetProcedureStepFieldValues:nr,addAssetProcedureStepFieldValuesMany:ar,setAssetProcedureStepFieldValues:cr,setAssetProcedureStepFieldValuesMany:dr,updateAssetProcedureStepFieldValues:rr,updateAssetProcedureStepFieldValuesMany:ur,deleteAssetProcedureStepFieldValues:lr,deleteAssetProcedureStepFieldValuesMany:or}=Fs.actions,hr=t=>t.assetProcedureStepFieldValuesReducer.instances,ut=p.createSelector([hr],t=>Object.values(t)),RP=I([ut,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset===s))),wP=I([ut,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_procedure===s))),EP=I([ut,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_procedure_step===s))),mr=(t,s)=>t.assetProcedureStepFieldValuesReducer.instances[s],yr=I([ut,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),pr=Fs.reducer,se=R(t=>t.uuid),Ar={instances:{}},gs=p.createSlice({name:"assetProcedureSteps",initialState:Ar,extraReducers:t=>t.addMatcher(p.isAnyOf(_,w),s=>Object.assign(s,Ar)),reducers:{initializeAssetProcedureSteps:se.initialize,setAssetProcedureStep:se.setOne,setAssetProcedureSteps:se.setMany,addAssetProcedureStep:se.addOne,addAssetProcedureSteps:se.addMany,updateAssetProcedureStep:se.updateOne,updateAssetProcedureSteps:se.updateMany,deleteAssetProcedureStep:se.deleteOne,deleteAssetProcedureSteps:se.deleteMany}}),{initializeAssetProcedureSteps:fr,setAssetProcedureStep:Tr,setAssetProcedureSteps:Sr,addAssetProcedureStep:Ir,addAssetProcedureSteps:Or,updateAssetProcedureStep:Pr,updateAssetProcedureSteps:Fr,deleteAssetProcedureStep:gr,deleteAssetProcedureSteps:br}=gs.actions,_r=gs.reducer,Ot=t=>t.assetProcedureStepReducer.instances,Mr=(t,s)=>t.assetProcedureStepReducer.instances[s],bs=p.createSelector([Ot],t=>Object.values(t)),vP=p.createSelector([Ot,(t,s)=>s],(t,s)=>{const e={};for(const[n,a]of Object.entries(t))a.asset_procedure_type===s&&(e[n]=a);return pt(e)}),VP=I([bs,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_procedure_type===s))),Rr=I([bs,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),wr=I([Ot,(t,s)=>s],(t,s)=>{if(!t[s])return T([]);const a=la(s,Object.values(t)).all().map(({model:c})=>c);return T(a)}),ie=R(t=>t.uuid),Er={instances:{}},_s=p.createSlice({name:"assets",initialState:Er,extraReducers:t=>t.addMatcher(p.isAnyOf(_,C,w),s=>Object.assign(s,Er)),reducers:{initializeAssets:ie.initialize,addAsset:ie.addOne,addAssets:ie.addMany,setAsset:ie.setOne,setAssets:ie.setMany,updateAsset:ie.updateOne,updateAssets:ie.updateMany,deleteAsset:ie.deleteOne,deleteAssets:ie.deleteMany}}),{initializeAssets:vr,addAsset:Vr,addAssets:Ms,updateAsset:zr,updateAssets:Br,deleteAsset:jr,deleteAssets:Rs,setAsset:qr,setAssets:Dr}=_s.actions,Cr=t=>t.assetReducer.instances,ws=p.createSelector([Cr],t=>T(Object.values(t))),Es=I([ws,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_type===s))),$r=(t,s)=>t.assetReducer.instances[s],Ur=I([ws,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),zP=(t,s)=>Es(t,s).length,kr=_s.reducer,ne=R(t=>t.uuid),Lr={instances:{}},vs=p.createSlice({name:"assetStageCompletions",initialState:Lr,extraReducers:t=>t.addMatcher(p.isAnyOf(_,C,w),s=>Object.assign(s,Lr)),reducers:{initializeAssetStageCompletions:ne.initialize,addAssetStageCompletion:ne.addOne,addAssetStageCompletions:ne.addMany,setAssetStageCompletion:ne.setOne,setAssetStageCompletions:ne.setMany,updateAssetStageCompletion:ne.updateOne,updateAssetStageCompletions:ne.updateMany,deleteAssetStageCompletion:ne.deleteOne,deleteAssetStageCompletions:ne.deleteMany}}),{initializeAssetStageCompletions:Nr,addAssetStageCompletion:Gr,addAssetStageCompletions:Hr,setAssetStageCompletion:Kr,setAssetStageCompletions:Wr,updateAssetStageCompletion:Yr,updateAssetStageCompletions:Zr,deleteAssetStageCompletion:Jr,deleteAssetStageCompletions:Xr}=vs.actions,Qr=vs.reducer,xr=t=>t.assetStageCompletionReducer.instances,eu=p.createSelector([xr],t=>Object.values(t)),tu=(t,s)=>t.assetStageCompletionReducer.instances[s],su=I([eu,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),ae=R(t=>t.uuid),iu={instances:{}},Vs=p.createSlice({name:"assetStages",initialState:iu,extraReducers:t=>t.addMatcher(p.isAnyOf(_,w),s=>Object.assign(s,iu)),reducers:{initializeAssetStages:ae.initialize,setAssetStage:ae.setOne,setAssetStages:ae.setMany,addAssetStage:ae.addOne,addAssetStages:ae.addMany,updateAssetStage:ae.updateOne,updateAssetStages:ae.updateMany,deleteAssetStage:ae.deleteOne,deleteAssetStages:ae.deleteMany}}),{initializeAssetStages:nu,setAssetStage:au,setAssetStages:cu,addAssetStage:du,addAssetStages:ru,updateAssetStage:uu,updateAssetStages:lu,deleteAssetStage:ou,deleteAssetStages:hu}=Vs.actions,mu=Vs.reducer,zs=t=>t.assetStageReducer.instances,yu=(t,s)=>t.assetStageReducer.instances[s],Bs=p.createSelector([zs],t=>Object.values(t)),BP=p.createSelector([zs,(t,s)=>s],(t,s)=>{const e={};for(const[n,a]of Object.entries(t))a.asset_procedure_type===s&&(e[n]=a);return pt(e)}),jP=I([Bs,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_procedure_type===s))),pu=I([Bs,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),ce=R(t=>t.uuid),Au={instances:{}},js=p.createSlice({name:"assetTypeAttachments",initialState:Au,extraReducers:t=>t.addMatcher(p.isAnyOf(_,w),s=>Object.assign(s,Au)),reducers:{initializeAssetTypeAttachments:ce.initialize,addAssetTypeAttachment:ce.addOne,addAssetTypeAttachments:ce.addMany,setAssetTypeAttachment:ce.setOne,setAssetTypeAttachments:ce.setMany,updateAssetTypeAttachment:ce.updateOne,updateAssetTypeAttachments:ce.updateMany,deleteAssetTypeAttachment:ce.deleteOne,deleteAssetTypeAttachments:ce.deleteMany}}),{initializeAssetTypeAttachments:fu,addAssetTypeAttachment:Tu,addAssetTypeAttachments:qs,setAssetTypeAttachment:Su,setAssetTypeAttachments:Iu,updateAssetTypeAttachment:Ou,updateAssetTypeAttachments:Pu,deleteAssetTypeAttachment:Fu,deleteAssetTypeAttachments:Ds}=js.actions,gu=t=>t.assetTypeAttachmentReducer.instances,Cs=p.createSelector([gu],t=>Object.values(t)),bu=(t,s)=>t.assetTypeAttachmentReducer.instances[s],_u=I([Cs,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),Mu=I([Cs,(t,s)=>s],(t,s)=>T(t.filter(({asset_type:e})=>s===e))),Ru=js.reducer,de=R(t=>t.uuid),wu={instances:{}},$s=p.createSlice({name:"assetTypeFieldsAttachments",initialState:wu,extraReducers:t=>t.addMatcher(p.isAnyOf(_,w),s=>Object.assign(s,wu)),reducers:{initializeAssetTypeFieldsAttachments:de.initialize,addAssetTypeFieldsAttachment:de.addOne,addAssetTypeFieldsAttachments:de.addMany,setAssetTypeFieldsAttachment:de.setOne,setAssetTypeFieldsAttachments:de.setMany,updateAssetTypeFieldsAttachment:de.updateOne,updateAssetTypeFieldsAttachments:de.updateMany,deleteAssetTypeFieldsAttachment:de.deleteOne,deleteAssetTypeFieldsAttachments:de.deleteMany}}),{initializeAssetTypeFieldsAttachments:Eu,addAssetTypeFieldsAttachment:vu,addAssetTypeFieldsAttachments:Vu,setAssetTypeFieldsAttachment:zu,setAssetTypeFieldsAttachments:Bu,updateAssetTypeFieldsAttachment:ju,updateAssetTypeFieldsAttachments:qu,deleteAssetTypeFieldsAttachment:Du,deleteAssetTypeFieldsAttachments:Cu}=$s.actions,$u=t=>t.assetTypeFieldsAttachmentReducer.instances,Us=p.createSelector([$u],t=>Object.values(t)),qP=I([Us,(t,s)=>s],(t,s)=>T(t.filter(e=>e.fields_revision===s))),Uu=(t,s)=>t.assetTypeFieldsAttachmentReducer.instances[s],ku=I([Us,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),Lu=$s.reducer,re=R(t=>t.uuid),Nu={instances:{}},ks=p.createSlice({name:"assetTypeFields",initialState:Nu,extraReducers:t=>t.addMatcher(p.isAnyOf(_,w),s=>Object.assign(s,Nu)),reducers:{initializeAssetTypeFields:re.initialize,addAssetTypeFields:re.addOne,addAssetTypeFieldsMany:re.addMany,setAssetTypeFields:re.setOne,setAssetTypeFieldsMany:re.setMany,updateAssetTypeFields:re.updateOne,updateAssetTypeFieldsMany:re.updateMany,deleteAssetTypeFields:re.deleteOne,deleteAssetTypeFieldsMany:re.deleteMany}}),{initializeAssetTypeFields:Gu,addAssetTypeFields:Hu,addAssetTypeFieldsMany:Ku,setAssetTypeFields:Wu,setAssetTypeFieldsMany:Yu,updateAssetTypeFields:Zu,updateAssetTypeFieldsMany:Ju,deleteAssetTypeFields:Xu,deleteAssetTypeFieldsMany:Qu}=ks.actions,xu=t=>t.assetTypeFieldsReducer.instances,lt=p.createSelector([xu],t=>Object.values(t)),DP=I([lt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_type===s))),CP=p.createSelector([lt,(t,s)=>s],(t,s)=>t.filter(e=>e.asset_type===s).sort((e,n)=>e.submitted_at>n.submitted_at?-1:1)[0]),el=(t,s)=>t.assetTypeFieldsReducer.instances[s],tl=I([lt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),sl=ks.reducer,ue=R(t=>t.uuid),il={instances:{}},Ls=p.createSlice({name:"assetTypeFieldValuesAttachments",initialState:il,extraReducers:t=>t.addMatcher(p.isAnyOf(_,C,w),s=>Object.assign(s,il)),reducers:{initializeAssetTypeFieldValuesAttachments:ue.initialize,addAssetTypeFieldValuesAttachment:ue.addOne,addAssetTypeFieldValuesAttachments:ue.addMany,setAssetTypeFieldValuesAttachment:ue.setOne,setAssetTypeFieldValuesAttachments:ue.setMany,updateAssetTypeFieldValuesAttachment:ue.updateOne,updateAssetTypeFieldValuesAttachments:ue.updateMany,deleteAssetTypeFieldValuesAttachment:ue.deleteOne,deleteAssetTypeFieldValuesAttachments:ue.deleteMany}}),{initializeAssetTypeFieldValuesAttachments:nl,addAssetTypeFieldValuesAttachment:al,addAssetTypeFieldValuesAttachments:Ns,setAssetTypeFieldValuesAttachment:cl,setAssetTypeFieldValuesAttachments:dl,updateAssetTypeFieldValuesAttachment:rl,updateAssetTypeFieldValuesAttachments:ul,deleteAssetTypeFieldValuesAttachment:ll,deleteAssetTypeFieldValuesAttachments:Gs}=Ls.actions,ol=t=>t.assetTypeFieldValuesAttachmentReducer.instances,Hs=p.createSelector([ol],t=>Object.values(t)),hl=(t,s)=>t.assetTypeFieldValuesAttachmentReducer.instances[s],ml=I([Hs,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),yl=I([Hs,(t,s)=>s],(t,s)=>T(t.filter(e=>e.field_values===s))),pl=Ls.reducer,le=R(t=>t.uuid),Al={instances:{}},Ks=p.createSlice({name:"assetTypeFieldValues",initialState:Al,extraReducers:t=>t.addMatcher(p.isAnyOf(_,C,w),s=>Object.assign(s,Al)),reducers:{initializeAssetTypeFieldValues:le.initialize,addAssetTypeFieldValues:le.addOne,addAssetTypeFieldValuesMany:le.addMany,setAssetTypeFieldValues:le.setOne,setAssetTypeFieldValuesMany:le.setMany,updateAssetTypeFieldValues:le.updateOne,updateAssetTypeFieldValuesMany:le.updateMany,deleteAssetTypeFieldValues:le.deleteOne,deleteAssetTypeFieldValuesMany:le.deleteMany}}),{initializeAssetTypeFieldValues:fl,addAssetTypeFieldValues:Tl,addAssetTypeFieldValuesMany:Sl,setAssetTypeFieldValues:Il,setAssetTypeFieldValuesMany:Ol,updateAssetTypeFieldValues:Pl,updateAssetTypeFieldValuesMany:Fl,deleteAssetTypeFieldValues:gl,deleteAssetTypeFieldValuesMany:bl}=Ks.actions,_l=t=>t.assetTypeFieldValuesReducer.instances,Pt=p.createSelector([_l],t=>Object.values(t)),$P=I([Pt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset===s))),UP=I([lt,Pt,(t,s)=>s],(t,s,e)=>{const n=new Set(t.filter(a=>a.asset_type===e).map(a=>a.uuid));return T(s.filter(a=>n.has(a.fields_revision)))}),Ml=(t,s)=>t.assetTypeFieldValuesReducer.instances[s],Rl=I([Pt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),wl=Ks.reducer,oe=R(t=>t.uuid),El={instances:{}},Ws=p.createSlice({name:"assetTypeIdentifiers",initialState:El,extraReducers:t=>t.addMatcher(p.isAnyOf(_,w),s=>Object.assign(s,El)),reducers:{initializeAssetTypeIdentifiers:oe.initialize,addAssetTypeIdentifier:oe.addOne,addAssetTypeIdentifiers:oe.addMany,setAssetTypeIdentifier:oe.setOne,setAssetTypeIdentifiers:oe.setMany,updateAssetTypeIdentifier:oe.updateOne,updateAssetTypeIdentifiers:oe.updateMany,deleteAssetTypeIdentifier:oe.deleteOne,deleteAssetTypeIdentifiers:oe.deleteMany}}),{initializeAssetTypeIdentifiers:vl,addAssetTypeIdentifier:Vl,addAssetTypeIdentifiers:zl,setAssetTypeIdentifier:Bl,setAssetTypeIdentifiers:jl,updateAssetTypeIdentifier:ql,updateAssetTypeIdentifiers:Dl,deleteAssetTypeIdentifier:Cl,deleteAssetTypeIdentifiers:$l}=Ws.actions,Ul=t=>t.assetTypeIdentifierReducer.instances,Ys=p.createSelector([Ul],t=>Object.values(t)),kl=(t,s)=>t.assetTypeIdentifierReducer.instances[s],Ll=I([Ys,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),kP=I([Ys,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_type===s))),Nl=Ws.reducer,he=R(t=>t.uuid),Gl={instances:{}},Zs=p.createSlice({name:"assetTypeIdentifierValues",initialState:Gl,extraReducers:t=>t.addMatcher(p.isAnyOf(_,C,w),s=>Object.assign(s,Gl)),reducers:{initializeAssetTypeIdentifierValues:he.initialize,addAssetTypeIdentifierValue:he.addOne,addAssetTypeIdentifierValues:he.addMany,setAssetTypeIdentifierValue:he.setOne,setAssetTypeIdentifierValues:he.setMany,updateAssetTypeIdentifierValue:he.updateOne,updateAssetTypeIdentifierValues:he.updateMany,deleteAssetTypeIdentifierValue:he.deleteOne,deleteAssetTypeIdentifierValues:he.deleteMany}}),{initializeAssetTypeIdentifierValues:Hl,addAssetTypeIdentifierValue:Kl,addAssetTypeIdentifierValues:Wl,setAssetTypeIdentifierValue:Yl,setAssetTypeIdentifierValues:Zl,updateAssetTypeIdentifierValue:Jl,updateAssetTypeIdentifierValues:Xl,deleteAssetTypeIdentifierValue:Ql,deleteAssetTypeIdentifierValues:xl}=Zs.actions,eo=t=>t.assetTypeIdentifierValueReducer.instances,Ft=p.createSelector([eo],t=>Object.values(t)),to=(t,s)=>t.assetTypeIdentifierValueReducer.instances[s],so=I([Ft,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),LP=I([Ft,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset===s))),NP=I([Ft,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_type_identifier===s))),io=Zs.reducer,me=R(t=>t.uuid),no={instances:{}},Js=p.createSlice({name:"assetTypes",initialState:no,extraReducers:t=>t.addMatcher(p.isAnyOf(_,w),s=>Object.assign(s,no)),reducers:{initializeAssetTypes:me.initialize,setAssetType:me.setOne,setAssetTypes:me.setMany,addAssetType:me.addOne,addAssetTypes:me.addMany,updateAssetType:me.updateOne,updateAssetTypes:me.updateMany,deleteAssetType:me.deleteOne,deleteAssetTypes:me.deleteMany}}),{initializeAssetTypes:ao,setAssetType:co,setAssetTypes:ro,addAssetType:uo,addAssetTypes:lo,updateAssetType:oo,updateAssetTypes:ho,deleteAssetType:mo,deleteAssetTypes:yo}=Js.actions,po=t=>t.assetTypeReducer.instances,Xs=p.createSelector([po],t=>Object.values(t)),Ao=(t,s)=>t.assetTypeReducer.instances[s],fo=I([Xs,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),GP=I([Xs,(t,s)=>s],(t,s)=>T(t.filter(e=>e.organization===s))),To=Js.reducer,ye=R(t=>t.uuid),So={instances:{}},Qs=p.createSlice({name:"assetTypeStatuses",initialState:So,extraReducers:t=>t.addMatcher(p.isAnyOf(_,w),s=>Object.assign(s,So)),reducers:{initializeAssetTypeStatuses:ye.initialize,addAssetTypeStatus:ye.addOne,addAssetTypeStatuses:ye.addMany,setAssetTypeStatus:ye.setOne,setAssetTypeStatuses:ye.setMany,updateAssetTypeStatus:ye.updateOne,updateAssetTypeStatuses:ye.updateMany,deleteAssetTypeStatus:ye.deleteOne,deleteAssetTypeStatuses:ye.deleteMany}}),{initializeAssetTypeStatuses:Io,addAssetTypeStatus:Oo,addAssetTypeStatuses:Po,setAssetTypeStatus:Fo,setAssetTypeStatuses:go,updateAssetTypeStatus:bo,updateAssetTypeStatuses:_o,deleteAssetTypeStatus:Mo,deleteAssetTypeStatuses:Ro}=Qs.actions,wo=t=>t.assetTypeStatusReducer.instances,xs=p.createSelector([wo],t=>T(Object.values(t).toSorted(oa))),Eo=(t,s)=>t.assetTypeStatusReducer.instances[s],vo=I([xs,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),HP=I([xs,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_type===s))),Vo=Qs.reducer,zo={accessToken:"",refreshToken:"",isLoggedIn:!1},gt=p.createSlice({name:"auth",initialState:zo,extraReducers:t=>t.addCase(_,s=>Object.assign(s,zo)),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||gt.caseReducers.clearTokens(t),t.isLoggedIn=s.payload}}}),{setTokens:KP,clearTokens:WP,setLoggedIn:Bo}=gt.actions,YP=t=>t.authReducer.accessToken,ZP=t=>t.authReducer.isLoggedIn,jo=gt.reducer,pe=R(t=>t.uuid),qo={instances:{}},ei=p.createSlice({name:"categories",initialState:qo,extraReducers:t=>t.addMatcher(p.isAnyOf(_,w),s=>Object.assign(s,qo)),reducers:{initializeCategories:pe.initialize,addCategory:pe.addOne,addCategories:pe.addMany,setCategory:pe.setOne,setCategories:pe.setMany,updateCategory:pe.updateOne,updateCategories:pe.updateMany,deleteCategory:pe.deleteOne,deleteCategories:pe.deleteMany}}),{initializeCategories:Do,addCategory:Co,addCategories:$o,setCategory:Uo,setCategories:ko,updateCategory:Lo,updateCategories:No,deleteCategory:Go,deleteCategories:Ho}=ei.actions,Ko=t=>t.categoryReducer.instances,ti=p.createSelector([Ko],t=>Object.values(t)),si=(t,s)=>t.categoryReducer.instances[s],Wo=I([ti,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),JP=I([ti,(t,s)=>s],(t,s)=>T(t.filter(e=>e.project===s))),Yo=ei.reducer,Ae=R(t=>t.uuid),Zo={instances:{}},ii=p.createSlice({name:"documentAttachments",initialState:Zo,extraReducers:t=>t.addCase(_,s=>Object.assign(s,Zo)),reducers:{initializeDocumentAttachments:Ae.initialize,addDocumentAttachment:Ae.addOne,addDocumentAttachments:Ae.addMany,setDocumentAttachment:Ae.setOne,setDocumentAttachments:Ae.setMany,updateDocumentAttachment:Ae.updateOne,updateDocumentAttachments:Ae.updateMany,deleteDocumentAttachment:Ae.deleteOne,deleteDocumentAttachments:Ae.deleteMany}}),{initializeDocumentAttachments:Jo,addDocumentAttachment:Xo,addDocumentAttachments:Qo,setDocumentAttachment:xo,setDocumentAttachments:eh,updateDocumentAttachment:th,updateDocumentAttachments:sh,deleteDocumentAttachment:ih,deleteDocumentAttachments:nh}=ii.actions,ah=t=>t.documentAttachmentReducer.instances,ni=p.createSelector([ah],t=>Object.values(t)),ch=(t,s)=>t.documentAttachmentReducer.instances[s],dh=I([ni,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),XP=I([ni,(t,s)=>s],(t,s)=>T(t.filter(({document:e})=>s===e))),rh=ii.reducer,fe=R(({uuid:t})=>t),uh={instances:{}},ai=p.createSlice({name:"documents",initialState:uh,extraReducers:t=>t.addMatcher(p.isAnyOf(_,w),s=>{Object.assign(s,uh)}),reducers:{initializeDocuments:fe.initialize,addDocument:fe.addOne,addDocuments:fe.addMany,setDocument:fe.setOne,setDocuments:fe.setMany,updateDocument:fe.updateOne,updateDocuments:fe.updateMany,deleteDocument:fe.deleteOne,deleteDocuments:fe.deleteMany}}),{initializeDocuments:lh,addDocument:oh,addDocuments:hh,setDocument:mh,setDocuments:yh,updateDocument:ph,updateDocuments:Ah,deleteDocument:fh,deleteDocuments:Th}=ai.actions,Sh=ai.reducer,ci=t=>t.documentsReducer.instances,bt=p.createSelector([ci],t=>Object.values(t)),Ih=(t,s)=>t.documentsReducer.instances[s],Oh=I([bt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),QP=I([bt,(t,s)=>s],(t,s)=>t.filter(e=>e.project===s)),xP=I([bt,(t,s)=>s],(t,s)=>t.filter(e=>e.organization===s)),Ph=I([ci,(t,s)=>s],(t,s)=>{if(!t[s])return T([]);const a=ya(s,Object.values(t)).all().map(({model:c})=>c);return T(a)}),Te=R(t=>t.uuid),Fh={instances:{}},di=p.createSlice({name:"emailDomains",initialState:Fh,extraReducers:t=>t.addMatcher(p.isAnyOf(_,w),s=>Object.assign(s,Fh)),reducers:{initializeEmailDomains:Te.initialize,addEmailDomain:Te.addOne,addEmailDomains:Te.addMany,setEmailDomain:Te.setOne,setEmailDomains:Te.setMany,updateEmailDomain:Te.updateOne,updateEmailDomains:Te.updateMany,deleteEmailDomain:Te.deleteOne,deleteEmailDomains:Te.deleteMany}}),{initializeEmailDomains:gh,addEmailDomain:bh,addEmailDomains:_h,setEmailDomain:Mh,setEmailDomains:Rh,updateEmailDomain:wh,updateEmailDomains:Eh,deleteEmailDomain:vh,deleteEmailDomains:Vh}=di.actions,zh=t=>t.emailDomainsReducer.instances,ri=p.createSelector([zh],t=>Object.values(t)),Bh=(t,s)=>t.emailDomainsReducer.instances[s],jh=I([ri,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),eF=I([ri,(t,s)=>s],(t,s)=>T(t.filter(e=>e.organization===s))),qh=di.reducer,Dh={s3Urls:{}},Ch=1e3*60*60,tF=Ch*24*7,ui=p.createSlice({name:"file",initialState:Dh,extraReducers:t=>t.addCase(_,s=>Object.assign(s,Dh)),reducers:{setUploadUrl:(t,s)=>{const{url:e,fields:n,sha1:a}=s.payload,c=new Date,r=new Date(c.getTime()+tF);t.s3Urls[a]={url:e,fields:n,exp:r.getTime()}}}}),{setUploadUrl:$h}=ui.actions,Uh=(t,s)=>{const e=t.fileReducer.s3Urls[s];if(!e)return;const n=new Date().getTime();if(!((e.exp??n)-n<Ch))return e},kh=ui.reducer,Se=R(t=>t.uuid),Lh={instances:{}},li=p.createSlice({name:"formIdentifiers",initialState:Lh,extraReducers:t=>t.addMatcher(p.isAnyOf(_,w),s=>Object.assign(s,Lh)),reducers:{initializeFormIdentifiers:Se.initialize,addFormIdentifier:Se.addOne,addFormIdentifiers:Se.addMany,setFormIdentifier:Se.setOne,setFormIdentifiers:Se.setMany,updateFormIdentifier:Se.updateOne,updateFormIdentifiers:Se.updateMany,deleteFormIdentifier:Se.deleteOne,deleteFormIdentifiers:Se.deleteMany}}),{initializeFormIdentifiers:Nh,addFormIdentifier:Gh,addFormIdentifiers:Hh,setFormIdentifier:Kh,setFormIdentifiers:Wh,updateFormIdentifier:Yh,updateFormIdentifiers:Zh,deleteFormIdentifier:Jh,deleteFormIdentifiers:Xh}=li.actions,Qh=t=>t.formIdentifierReducer.instances,oi=p.createSelector([Qh],t=>Object.values(t)),xh=(t,s)=>t.formIdentifierReducer.instances[s],em=I([oi,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),sF=I([oi,(t,s)=>s],(t,s)=>T(t.filter(e=>e.form===s))),tm=li.reducer,Ie=R(t=>t.uuid),sm={instances:{}},hi=p.createSlice({name:"formIdentifierValues",initialState:sm,extraReducers:t=>t.addMatcher(p.isAnyOf(_,w),s=>Object.assign(s,sm)),reducers:{initializeFormIdentifierValues:Ie.initialize,addFormIdentifierValue:Ie.addOne,addFormIdentifierValues:Ie.addMany,setFormIdentifierValue:Ie.setOne,setFormIdentifierValues:Ie.setMany,updateFormIdentifierValue:Ie.updateOne,updateFormIdentifierValues:Ie.updateMany,deleteFormIdentifierValue:Ie.deleteOne,deleteFormIdentifierValues:Ie.deleteMany}}),{initializeFormIdentifierValues:im,addFormIdentifierValue:nm,addFormIdentifierValues:am,setFormIdentifierValue:cm,setFormIdentifierValues:dm,updateFormIdentifierValue:rm,updateFormIdentifierValues:um,deleteFormIdentifierValue:lm,deleteFormIdentifierValues:om}=hi.actions,hm=t=>t.formIdentifierValueReducer.instances,_t=p.createSelector([hm],t=>Object.values(t)),mm=(t,s)=>t.formIdentifierValueReducer.instances[s],ym=I([_t,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),iF=I([_t,(t,s)=>s],(t,s)=>T(t.filter(e=>e.form_submission===s))),nF=I([_t,(t,s)=>s],(t,s)=>T(t.filter(e=>e.form_identifier===s))),pm=hi.reducer,Oe=R(t=>t.uuid),Am={instances:{}},mi=p.createSlice({name:"formRevisionAttachments",initialState:Am,extraReducers:t=>t.addMatcher(p.isAnyOf(_,w),s=>Object.assign(s,Am)),reducers:{initializeFormRevisionAttachments:Oe.initialize,addFormRevisionAttachment:Oe.addOne,addFormRevisionAttachments:Oe.addMany,setFormRevisionAttachment:Oe.setOne,setFormRevisionAttachments:Oe.setMany,updateFormRevisionAttachment:Oe.updateOne,updateFormRevisionAttachments:Oe.updateMany,deleteFormRevisionAttachment:Oe.deleteOne,deleteFormRevisionAttachments:Oe.deleteMany}}),{initializeFormRevisionAttachments:fm,addFormRevisionAttachment:Tm,addFormRevisionAttachments:Sm,setFormRevisionAttachment:Im,setFormRevisionAttachments:Om,updateFormRevisionAttachment:Pm,updateFormRevisionAttachments:Fm,deleteFormRevisionAttachment:gm,deleteFormRevisionAttachments:bm}=mi.actions,Mt=t=>t.formRevisionAttachmentReducer.instances,_m=p.createSelector([Mt],t=>Object.values(t)),Mm=p.createSelector([Mt,(t,s)=>s],(t,s)=>t[s]),Rm=I([_m,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),aF=I([Mt,(t,s)=>s],(t,s)=>T(Object.values(t).filter(e=>e.form_revision===s))),wm=mi.reducer,Pe=R(t=>t.uuid),Em={instances:{}},yi=p.createSlice({name:"formRevisions",initialState:Em,extraReducers:t=>t.addMatcher(p.isAnyOf(_,w),s=>Object.assign(s,Em)),reducers:{initializeFormRevisions:Pe.initialize,addFormRevision:Pe.addOne,addFormRevisions:Pe.addMany,setFormRevision:Pe.setOne,setFormRevisions:Pe.setMany,updateFormRevision:Pe.updateOne,updateFormRevisions:Pe.updateMany,deleteFormRevision:Pe.deleteOne,deleteFormRevisions:Pe.deleteMany}}),{initializeFormRevisions:vm,addFormRevision:pi,addFormRevisions:Ai,setFormRevision:Vm,setFormRevisions:zm,updateFormRevision:Bm,updateFormRevisions:jm,deleteFormRevision:fi,deleteFormRevisions:Ti}=yi.actions,Si=t=>t.formRevisionReducer.instances,Rt=p.createSelector([Si],t=>Object.values(t)),qm=(t,s)=>t.formRevisionReducer.instances[s],Dm=I([Rt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),cF=p.createSelector([Rt,(t,s)=>s],(t,s)=>t.filter(e=>e.form===s).sort((e,n)=>e.submitted_at>n.submitted_at?-1:1)[0]),Cm=I([Rt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.form===s))),$m=yi.reducer,Fe=R(t=>t.uuid),Um={instances:{}},Ii=p.createSlice({name:"forms",initialState:Um,extraReducers:t=>t.addMatcher(p.isAnyOf(_,w),s=>Object.assign(s,Um)),reducers:{initializeForms:Fe.initialize,addForm:Fe.addOne,addForms:Fe.addMany,setForm:Fe.setOne,setForms:Fe.setMany,updateForm:Fe.updateOne,updateForms:Fe.updateMany,deleteForm:Fe.deleteOne,deleteForms:Fe.deleteMany}}),{initializeForms:km,addForm:Lm,addForms:Nm,setForm:Gm,setForms:Hm,updateForm:Km,updateForms:Wm,deleteForm:Ym,deleteForms:Zm}=Ii.actions,Jm=Ii.reducer,Xm=t=>t.formReducer.instances,Oi=p.createSelector([Xm],t=>Object.values(t)),Qm=(t,s)=>t.formReducer.instances[s],xm=I([Oi,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),dF=I([Oi,(t,s)=>s],(t,s)=>T(t.filter(e=>e.organization===s))),ge=R(t=>t.uuid),ey={instances:{}},Pi=p.createSlice({name:"formSubmissionAttachments",initialState:ey,extraReducers:t=>t.addMatcher(p.isAnyOf(_,w),s=>Object.assign(s,ey)),reducers:{initializeFormSubmissionAttachments:ge.initialize,addFormSubmissionAttachment:ge.addOne,addFormSubmissionAttachments:ge.addMany,setFormSubmissionAttachment:ge.setOne,setFormSubmissionAttachments:ge.setMany,updateFormSubmissionAttachment:ge.updateOne,updateFormSubmissionAttachments:ge.updateMany,deleteFormSubmissionAttachment:ge.deleteOne,deleteFormSubmissionAttachments:ge.deleteMany}}),{initializeFormSubmissionAttachments:ty,addFormSubmissionAttachment:sy,addFormSubmissionAttachments:Fi,setFormSubmissionAttachment:iy,setFormSubmissionAttachments:ny,updateFormSubmissionAttachment:ay,updateFormSubmissionAttachments:cy,deleteFormSubmissionAttachment:dy,deleteFormSubmissionAttachments:gi}=Pi.actions,bi=t=>t.formSubmissionAttachmentReducer.instances,_i=p.createSelector([bi],t=>Object.values(t)),ry=p.createSelector([bi,(t,s)=>s],(t,s)=>t[s]),Mi=I([_i,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(n=>e.has(n.uuid)))}),uy=Mi,ly=I([_i,(t,s)=>s],(t,s)=>T(t.filter(e=>e.form_submission===s))),oy=Pi.reducer,be=R(t=>t.uuid),hy={instances:{}},Ri=p.createSlice({name:"formSubmissions",initialState:hy,extraReducers:t=>t.addMatcher(p.isAnyOf(_,w),s=>Object.assign(s,hy)),reducers:{initializeFormSubmissions:be.initialize,setFormSubmission:be.setOne,setFormSubmissions:be.setMany,addFormSubmission:be.addOne,addFormSubmissions:be.addMany,updateFormSubmission:be.updateOne,updateFormSubmissions:be.updateMany,deleteFormSubmission:be.deleteOne,deleteFormSubmissions:be.deleteMany}}),{initializeFormSubmissions:my,setFormSubmission:yy,setFormSubmissions:py,addFormSubmission:Ay,addFormSubmissions:wi,updateFormSubmission:fy,updateFormSubmissions:Ty,deleteFormSubmission:Sy,deleteFormSubmissions:Ei}=Ri.actions,vi=t=>t.formSubmissionReducer.instances,Iy=p.createSelector([vi],t=>Object.values(t)),Oy=(t,s)=>t.formSubmissionReducer.instances[s],Py=I([Iy,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),Fy=I([vi,Si,(t,s)=>s],(t,s,e)=>{const n=new Set;for(const a of Object.values(s))a.form===e&&n.add(a.uuid);return Object.values(t).filter(a=>n.has(a.form_revision))}),gy=Ri.reducer,_e=R(t=>t.uuid),by={instances:{}},Vi=p.createSlice({name:"geoImages",initialState:by,extraReducers:t=>t.addMatcher(p.isAnyOf(_,C,w),s=>Object.assign(s,by)),reducers:{initializeGeoImages:_e.initialize,setGeoImage:_e.setOne,setGeoImages:_e.setMany,addGeoImage:_e.addOne,addGeoImages:_e.addMany,updateGeoImage:_e.updateOne,updateGeoImages:_e.updateMany,deleteGeoImage:_e.deleteOne,deleteGeoImages:_e.deleteMany}}),{initializeGeoImages:_y,setGeoImage:My,setGeoImages:Ry,addGeoImage:wy,addGeoImages:Ey,updateGeoImage:vy,updateGeoImages:Vy,deleteGeoImage:zy,deleteGeoImages:By}=Vi.actions,jy=t=>t.geoImageReducer.instances,zi=p.createSelector([jy],t=>Object.values(t)),qy=(t,s)=>t.geoImageReducer.instances[s],Dy=I([zi,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),rF=I([zi,(t,s)=>s],(t,s)=>T(t.filter(e=>e.project===s))),Cy=Vi.reducer,Me=R(t=>t.uuid),$y={instances:{}},Bi=p.createSlice({name:"issueAssociations",initialState:$y,extraReducers:t=>t.addMatcher(p.isAnyOf(_,C,w),s=>Object.assign(s,$y)),reducers:{initializeIssueAssociations:Me.initialize,addIssueAssociation:Me.addOne,addIssueAssociations:Me.addMany,setIssueAssociation:Me.setOne,setIssueAssociations:Me.setMany,updateIssueAssociation:Me.updateOne,updateIssueAssociations:Me.updateMany,deleteIssueAssociation:Me.deleteOne,deleteIssueAssociations:Me.deleteMany}}),{initializeIssueAssociations:Uy,setIssueAssociations:ky,setIssueAssociation:Ly,updateIssueAssociation:Ny,updateIssueAssociations:Gy,addIssueAssociation:Hy,addIssueAssociations:wt,deleteIssueAssociation:Ky,deleteIssueAssociations:Et}=Bi.actions,ot=t=>t.issueAssociationReducer.instances,Wy=p.createSelector([ot],t=>Object.values(t)),Yy=(t,s)=>t.issueAssociationReducer.instances[s],Zy=I([Wy,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),Jy=I([ot,(t,s)=>s],(t,s)=>T(Object.values(t).filter(e=>e.associated_issue===s))),Xy=I([ot,(t,s)=>s],(t,s)=>T(Object.values(t).filter(e=>e.issue===s))),Qy=I([ot,(t,s)=>s],(t,s)=>T(Object.values(t).filter(e=>e.asset===s))),xy=Bi.reducer,Re=R(t=>t.uuid),ep={instances:{}},ji=p.createSlice({name:"issueAttachments",initialState:ep,extraReducers:t=>t.addMatcher(p.isAnyOf(_,C,w),s=>Object.assign(s,ep)),reducers:{initializeIssueAttachments:Re.initialize,addIssueAttachment:Re.addOne,addIssueAttachments:Re.addMany,setIssueAttachment:Re.setOne,setIssueAttachments:Re.setMany,updateIssueAttachment:Re.updateOne,updateIssueAttachments:Re.updateMany,deleteIssueAttachment:Re.deleteOne,deleteIssueAttachments:Re.deleteMany}}),{initializeIssueAttachments:tp,addIssueAttachment:sp,addIssueAttachments:qi,setIssueAttachment:ip,setIssueAttachments:np,updateIssueAttachment:ap,updateIssueAttachments:cp,deleteIssueAttachment:dp,deleteIssueAttachments:Di}=ji.actions,rp=t=>t.issueAttachmentReducer.instances,Ci=p.createSelector([rp],t=>Object.values(t)),up=I([Ci,(t,s)=>s],(t,s)=>T(t.filter(({issue:e})=>s===e))),lp=(t,s)=>t.issueAttachmentReducer.instances[s],op=I([Ci,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),hp=ji.reducer,we=R(t=>t.uuid),mp={instances:{}},$i=p.createSlice({name:"issueCommentAttachments",initialState:mp,extraReducers:t=>t.addMatcher(p.isAnyOf(_,C,w),s=>Object.assign(s,mp)),reducers:{initializeIssueCommentAttachments:we.initialize,addIssueCommentAttachment:we.addOne,addIssueCommentAttachments:we.addMany,setIssueCommentAttachment:we.setOne,setIssueCommentAttachments:we.setMany,updateIssueCommentAttachment:we.updateOne,updateIssueCommentAttachments:we.updateMany,deleteIssueCommentAttachment:we.deleteOne,deleteIssueCommentAttachments:we.deleteMany}}),{initializeIssueCommentAttachments:yp,addIssueCommentAttachment:pp,addIssueCommentAttachments:Ap,setIssueCommentAttachment:fp,setIssueCommentAttachments:Tp,updateIssueCommentAttachment:Sp,updateIssueCommentAttachments:Ip,deleteIssueCommentAttachment:Op,deleteIssueCommentAttachments:Pp}=$i.actions,Fp=t=>t.issueCommentAttachmentReducer.instances,Ui=p.createSelector([Fp],t=>Object.values(t)),gp=(t,s)=>t.issueCommentAttachmentReducer.instances[s],bp=I([Ui,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),uF=I([Ui,(t,s)=>s],(t,s)=>T(t.filter(({issue_comment:e})=>s===e))),_p=$i.reducer,Ee=R(t=>t.uuid),Mp={instances:{}},ki=p.createSlice({name:"issueComments",initialState:Mp,extraReducers:t=>t.addMatcher(p.isAnyOf(_,C,w),s=>Object.assign(s,Mp)),reducers:{initializeIssueComments:Ee.initialize,addIssueComment:Ee.addOne,addIssueComments:Ee.addMany,setIssueComment:Ee.setOne,setIssueComments:Ee.setMany,updateIssueComment:Ee.updateOne,updateIssueComments:Ee.updateMany,deleteIssueComment:Ee.deleteOne,deleteIssueComments:Ee.deleteMany}}),{initializeIssueComments:Rp,addIssueComment:wp,addIssueComments:Ep,setIssueComment:vp,setIssueComments:Vp,updateIssueComment:zp,updateIssueComments:Bp,deleteIssueComment:jp,deleteIssueComments:qp}=ki.actions,Li=t=>t.issueCommentReducer.instances,Dp=(t,s)=>t.issueCommentReducer.instances[s],Cp=I([Li,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(Object.values(t).filter(({uuid:n})=>e.has(n)))}),lF=I([Li,(t,s)=>s],(t,s)=>T(Object.values(t).filter(e=>e.issue===s))),$p=ki.reducer,ve=R(t=>t.uuid),Up={instances:{}},Ni=p.createSlice({name:"issues",initialState:Up,extraReducers:t=>t.addMatcher(p.isAnyOf(_,C,w),s=>Object.assign(s,Up)),reducers:{initializeIssues:ve.initialize,addIssue:ve.addOne,addIssues:ve.addMany,setIssue:ve.setOne,setIssues:ve.setMany,updateIssue:ve.updateOne,updateIssues:ve.updateMany,deleteIssue:ve.deleteOne,deleteIssues:ve.deleteMany}}),{initializeIssues:kp,addIssue:Lp,addIssues:Gi,setIssue:Np,setIssues:Gp,updateIssue:Hp,updateIssues:Kp,deleteIssue:Wp,deleteIssues:Hi}=Ni.actions,Yp=t=>t.issueReducer.instances,vt=p.createSelector([Yp],t=>Object.values(t)),Zp=(t,s)=>t.issueReducer.instances[s],Jp=I([vt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),oF=I([vt,(t,s)=>s],(t,s)=>t.filter(e=>e.project===s)),Xp=I([vt,(t,s)=>s],(t,s)=>t.filter(e=>e.issue_type===s)),Qp=Ni.reducer,Ve=R(t=>t.uuid),xp={instances:{}},Ki=p.createSlice({name:"issueTypeAttachments",initialState:xp,extraReducers:t=>t.addMatcher(p.isAnyOf(_,w),s=>Object.assign(s,xp)),reducers:{initializeIssueTypeAttachments:Ve.initialize,addIssueTypeAttachment:Ve.addOne,addIssueTypeAttachments:Ve.addMany,setIssueTypeAttachment:Ve.setOne,setIssueTypeAttachments:Ve.setMany,updateIssueTypeAttachment:Ve.updateOne,updateIssueTypeAttachments:Ve.updateMany,deleteIssueTypeAttachment:Ve.deleteOne,deleteIssueTypeAttachments:Ve.deleteMany}}),{initializeIssueTypeAttachments:eA,addIssueTypeAttachment:tA,addIssueTypeAttachments:sA,setIssueTypeAttachment:iA,setIssueTypeAttachments:nA,updateIssueTypeAttachment:aA,updateIssueTypeAttachments:cA,deleteIssueTypeAttachment:dA,deleteIssueTypeAttachments:rA}=Ki.actions,uA=t=>t.issueTypeAttachmentReducer.instances,Wi=p.createSelector([uA],t=>Object.values(t)),lA=(t,s)=>t.issueTypeAttachmentReducer.instances[s],oA=I([Wi,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),hF=I([Wi,(t,s)=>s],(t,s)=>T(t.filter(({issue_type:e})=>s===e))),hA=Ki.reducer,ze=R(t=>t.uuid),mA={instances:{}},Yi=p.createSlice({name:"issueTypeFieldsAttachments",initialState:mA,extraReducers:t=>t.addMatcher(p.isAnyOf(_,w),s=>Object.assign(s,mA)),reducers:{initializeIssueTypeFieldsAttachments:ze.initialize,addIssueTypeFieldsAttachment:ze.addOne,addIssueTypeFieldsAttachments:ze.addMany,setIssueTypeFieldsAttachment:ze.setOne,setIssueTypeFieldsAttachments:ze.setMany,updateIssueTypeFieldsAttachment:ze.updateOne,updateIssueTypeFieldsAttachments:ze.updateMany,deleteIssueTypeFieldsAttachment:ze.deleteOne,deleteIssueTypeFieldsAttachments:ze.deleteMany}}),{initializeIssueTypeFieldsAttachments:yA,addIssueTypeFieldsAttachment:pA,addIssueTypeFieldsAttachments:AA,setIssueTypeFieldsAttachment:fA,setIssueTypeFieldsAttachments:TA,updateIssueTypeFieldsAttachment:SA,updateIssueTypeFieldsAttachments:IA,deleteIssueTypeFieldsAttachment:OA,deleteIssueTypeFieldsAttachments:PA}=Yi.actions,FA=t=>t.issueTypeFieldsAttachmentReducer.instances,Zi=p.createSelector([FA],t=>Object.values(t)),mF=I([Zi,(t,s)=>s],(t,s)=>T(t.filter(e=>e.fields_revision===s))),gA=(t,s)=>t.issueTypeFieldsAttachmentReducer.instances[s],bA=I([Zi,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),_A=Yi.reducer,Be=R(t=>t.uuid),MA={instances:{}},Ji=p.createSlice({name:"issueTypeFieldValues",initialState:MA,extraReducers:t=>t.addMatcher(p.isAnyOf(_,C,w),s=>Object.assign(s,MA)),reducers:{initializeIssueTypeFieldValues:Be.initialize,addIssueTypeFieldValues:Be.addOne,addIssueTypeFieldValuesMany:Be.addMany,setIssueTypeFieldValues:Be.setOne,setIssueTypeFieldValuesMany:Be.setMany,updateIssueTypeFieldValues:Be.updateOne,updateIssueTypeFieldValuesMany:Be.updateMany,deleteIssueTypeFieldValues:Be.deleteOne,deleteIssueTypeFieldValuesMany:Be.deleteMany}}),{initializeIssueTypeFieldValues:RA,addIssueTypeFieldValues:wA,addIssueTypeFieldValuesMany:EA,setIssueTypeFieldValues:vA,setIssueTypeFieldValuesMany:VA,updateIssueTypeFieldValues:zA,updateIssueTypeFieldValuesMany:BA,deleteIssueTypeFieldValues:jA,deleteIssueTypeFieldValuesMany:qA}=Ji.actions,DA=t=>t.issueTypeFieldValuesReducer.instances,Vt=p.createSelector([DA],t=>Object.values(t)),yF=I([Vt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.issue===s))),CA=(t,s)=>t.issueTypeFieldValuesReducer.instances[s],$A=I([Vt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),UA=Ji.reducer,je=R(t=>t.uuid),kA={instances:{}},Xi=p.createSlice({name:"issueTypeFields",initialState:kA,extraReducers:t=>t.addMatcher(p.isAnyOf(_,w),s=>Object.assign(s,kA)),reducers:{initializeIssueTypeFields:je.initialize,addIssueTypeFields:je.addOne,addIssueTypeFieldsMany:je.addMany,setIssueTypeFields:je.setOne,setIssueTypeFieldsMany:je.setMany,updateIssueTypeFields:je.updateOne,updateIssueTypeFieldsMany:je.updateMany,deleteIssueTypeFields:je.deleteOne,deleteIssueTypeFieldsMany:je.deleteMany}}),{initializeIssueTypeFields:LA,addIssueTypeFields:NA,addIssueTypeFieldsMany:GA,setIssueTypeFields:HA,setIssueTypeFieldsMany:KA,updateIssueTypeFields:WA,updateIssueTypeFieldsMany:YA,deleteIssueTypeFields:ZA,deleteIssueTypeFieldsMany:JA}=Xi.actions,XA=t=>t.issueTypeFieldsReducer.instances,ht=p.createSelector([XA],t=>Object.values(t)),pF=I([ht,(t,s)=>s],(t,s)=>T(t.filter(e=>e.issue_type===s))),AF=p.createSelector([ht,(t,s)=>s],(t,s)=>t.filter(e=>e.issue_type===s).sort((e,n)=>e.submitted_at>n.submitted_at?-1:1)[0]),fF=I([ht,Vt,(t,s)=>s],(t,s,e)=>{const n=new Set(t.filter(a=>a.issue_type===e).map(a=>a.uuid));return T(s.filter(a=>n.has(a.fields_revision)))}),QA=(t,s)=>t.issueTypeFieldsReducer.instances[s],xA=I([ht,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),ef=Xi.reducer,qe=R(t=>t.uuid),tf={instances:{}},Qi=p.createSlice({name:"issueTypeFieldValuesAttachments",initialState:tf,extraReducers:t=>t.addMatcher(p.isAnyOf(_,C,w),s=>Object.assign(s,tf)),reducers:{initializeIssueTypeFieldValuesAttachments:qe.initialize,addIssueTypeFieldValuesAttachment:qe.addOne,addIssueTypeFieldValuesAttachments:qe.addMany,setIssueTypeFieldValuesAttachment:qe.setOne,setIssueTypeFieldValuesAttachments:qe.setMany,updateIssueTypeFieldValuesAttachment:qe.updateOne,updateIssueTypeFieldValuesAttachments:qe.updateMany,deleteIssueTypeFieldValuesAttachment:qe.deleteOne,deleteIssueTypeFieldValuesAttachments:qe.deleteMany}}),{initializeIssueTypeFieldValuesAttachments:sf,addIssueTypeFieldValuesAttachment:nf,addIssueTypeFieldValuesAttachments:xi,setIssueTypeFieldValuesAttachment:af,setIssueTypeFieldValuesAttachments:cf,updateIssueTypeFieldValuesAttachment:df,updateIssueTypeFieldValuesAttachments:rf,deleteIssueTypeFieldValuesAttachment:uf,deleteIssueTypeFieldValuesAttachments:en}=Qi.actions,lf=t=>t.issueTypeFieldValuesAttachmentReducer.instances,tn=p.createSelector([lf],t=>Object.values(t)),of=(t,s)=>t.issueTypeFieldValuesAttachmentReducer.instances[s],hf=I([tn,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),mf=I([tn,(t,s)=>s],(t,s)=>T(t.filter(e=>e.field_values===s))),yf=Qi.reducer,De=R(t=>t.uuid),pf={instances:{}},sn=p.createSlice({name:"issueTypeIdentifiers",initialState:pf,extraReducers:t=>t.addMatcher(p.isAnyOf(_,w),s=>Object.assign(s,pf)),reducers:{initializeIssueTypeIdentifiers:De.initialize,addIssueTypeIdentifier:De.addOne,addIssueTypeIdentifiers:De.addMany,setIssueTypeIdentifier:De.setOne,setIssueTypeIdentifiers:De.setMany,updateIssueTypeIdentifier:De.updateOne,updateIssueTypeIdentifiers:De.updateMany,deleteIssueTypeIdentifier:De.deleteOne,deleteIssueTypeIdentifiers:De.deleteMany}}),{initializeIssueTypeIdentifiers:Af,addIssueTypeIdentifier:ff,addIssueTypeIdentifiers:Tf,setIssueTypeIdentifier:Sf,setIssueTypeIdentifiers:If,updateIssueTypeIdentifier:Of,updateIssueTypeIdentifiers:Pf,deleteIssueTypeIdentifier:Ff,deleteIssueTypeIdentifiers:gf}=sn.actions,bf=t=>t.issueTypeIdentifierReducer.instances,nn=p.createSelector([bf],t=>Object.values(t)),_f=(t,s)=>t.issueTypeIdentifierReducer.instances[s],Mf=I([nn,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),TF=I([nn,(t,s)=>s],(t,s)=>T(t.filter(e=>e.issue_type===s))),Rf=sn.reducer,Ce=R(t=>t.uuid),wf={instances:{}},an=p.createSlice({name:"issueTypeIdentifierValues",initialState:wf,extraReducers:t=>t.addMatcher(p.isAnyOf(_,C,w),s=>Object.assign(s,wf)),reducers:{initializeIssueTypeIdentifierValues:Ce.initialize,addIssueTypeIdentifierValue:Ce.addOne,addIssueTypeIdentifierValues:Ce.addMany,setIssueTypeIdentifierValue:Ce.setOne,setIssueTypeIdentifierValues:Ce.setMany,updateIssueTypeIdentifierValue:Ce.updateOne,updateIssueTypeIdentifierValues:Ce.updateMany,deleteIssueTypeIdentifierValue:Ce.deleteOne,deleteIssueTypeIdentifierValues:Ce.deleteMany}}),{initializeIssueTypeIdentifierValues:Ef,addIssueTypeIdentifierValue:vf,addIssueTypeIdentifierValues:Vf,setIssueTypeIdentifierValue:zf,setIssueTypeIdentifierValues:Bf,updateIssueTypeIdentifierValue:jf,updateIssueTypeIdentifierValues:qf,deleteIssueTypeIdentifierValue:Df,deleteIssueTypeIdentifierValues:Cf}=an.actions,$f=t=>t.issueTypeIdentifierValueReducer.instances,zt=p.createSelector([$f],t=>Object.values(t)),Uf=(t,s)=>t.issueTypeIdentifierValueReducer.instances[s],kf=I([zt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),SF=I([zt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.issue===s))),IF=I([zt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.issue_type_identifier===s))),Lf=an.reducer,$e=R(t=>t.uuid),Nf={instances:{}},cn=p.createSlice({name:"issueTypes",initialState:Nf,extraReducers:t=>t.addMatcher(p.isAnyOf(_,w),s=>Object.assign(s,Nf)),reducers:{initializeIssueTypes:$e.initialize,addIssueType:$e.addOne,addIssueTypes:$e.addMany,setIssueType:$e.setOne,setIssueTypes:$e.setMany,updateIssueType:$e.updateOne,updateIssueTypes:$e.updateMany,deleteIssueType:$e.deleteOne,deleteIssueTypes:$e.deleteMany}}),{initializeIssueTypes:Gf,addIssueType:Hf,addIssueTypes:Kf,setIssueType:Wf,setIssueTypes:Yf,updateIssueType:Zf,updateIssueTypes:Jf,deleteIssueType:Xf,deleteIssueTypes:Qf}=cn.actions,xf=t=>t.issueTypeReducer.instances,dn=p.createSelector(xf,t=>Object.values(t)),eT=(t,s)=>t.issueTypeReducer.instances[s],tT=I([dn,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),OF=I([dn,(t,s)=>s],(t,s)=>T(t.filter(e=>e.organization===s))),sT=cn.reducer,Ue=R(t=>t.uuid),iT={instances:{}},rn=p.createSlice({name:"issueTypeStatuses",initialState:iT,extraReducers:t=>t.addMatcher(p.isAnyOf(_,w),s=>Object.assign(s,iT)),reducers:{initializeIssueTypeStatuses:Ue.initialize,addIssueTypeStatus:Ue.addOne,addIssueTypeStatuses:Ue.addMany,setIssueTypeStatus:Ue.setOne,setIssueTypeStatuses:Ue.setMany,updateIssueTypeStatus:Ue.updateOne,updateIssueTypeStatuses:Ue.updateMany,deleteIssueTypeStatus:Ue.deleteOne,deleteIssueTypeStatuses:Ue.deleteMany}}),{initializeIssueTypeStatuses:nT,addIssueTypeStatus:aT,addIssueTypeStatuses:cT,setIssueTypeStatus:dT,setIssueTypeStatuses:rT,updateIssueTypeStatus:uT,updateIssueTypeStatuses:lT,deleteIssueTypeStatus:oT,deleteIssueTypeStatuses:hT}=rn.actions,mT=t=>t.issueTypeStatusReducer.instances,un=p.createSelector([mT],t=>T(Object.values(t).toSorted(ha))),ln=(t,s)=>t.issueTypeStatusReducer.instances[s],yT=I([un,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),PF=I([un,(t,s)=>s],(t,s)=>T(t.filter(e=>e.issue_type===s))),pT=rn.reducer,ke=R(t=>t.uuid),AT={instances:{}},on=p.createSlice({name:"issueUpdates",initialState:AT,extraReducers:t=>t.addMatcher(p.isAnyOf(_,C,w),s=>Object.assign(s,AT)),reducers:{initializeIssueUpdates:ke.initialize,addIssueUpdate:ke.addOne,addIssueUpdates:ke.addMany,setIssueUpdate:ke.setOne,setIssueUpdates:ke.setMany,updateIssueUpdate:ke.updateOne,updateIssueUpdates:ke.updateMany,deleteIssueUpdate:ke.deleteOne,deleteIssueUpdates:ke.deleteMany}}),{initializeIssueUpdates:fT,addIssueUpdate:hn,addIssueUpdates:mn,setIssueUpdate:TT,setIssueUpdates:ST,updateIssueUpdate:IT,updateIssueUpdates:OT,deleteIssueUpdate:yn,deleteIssueUpdates:pn}=on.actions,An=t=>t.issueUpdateReducer.instances,fn=p.createSelector([An],t=>Object.values(t)),PT=p.createSelector([An,(t,s)=>s],(t,s)=>t[s]),FT=I([fn,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),gT=I([fn,(t,s)=>s],(t,s)=>T(t.filter(e=>e.issue===s))),bT=on.reducer,Le=R(t=>t.id),_T={instances:{},currentUser:null},Tn=p.createSlice({name:"users",initialState:_T,extraReducers:t=>t.addMatcher(p.isAnyOf(_,w),s=>Object.assign(s,_T)),reducers:{initializeUsers:Le.initialize,setUsers:Le.setMany,setUser:Le.setOne,addUsers:Le.addMany,addUser:Le.addOne,updateUsers:Le.updateMany,updateUser:Le.updateOne,deleteUser:Le.deleteOne,deleteUsers:Le.deleteMany,setCurrentUser:(t,s)=>{t.currentUser=s.payload},setProfilePicture:(t,s)=>{if(!t.currentUser)return;t.currentUser.profile.file=s.payload.file??null,t.currentUser.profile.file_sha1=s.payload.file_sha1??null;const e=t.instances[t.currentUser.id];if(!e)throw new Error("Unable to find current user in users slice");e.profile.file=s.payload.file??null,e.profile.file_sha1=s.payload.file_sha1??null}}}),{initializeUsers:MT,setUsers:RT,setUser:wT,addUsers:ET,addUser:Sn,updateUsers:vT,updateUser:VT,deleteUser:In,deleteUsers:zT,setCurrentUser:FF,setProfilePicture:gF}=Tn.actions,BT=Tn.reducer,jT=t=>t.userReducer.currentUser,On=t=>t.userReducer.instances,Bt=p.createSelector([On],t=>Object.values(t)),jt=(t,s)=>t.userReducer.instances[s],qT=I([Bt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({id:n})=>e.has(n)))}),Ne=R(t=>t.uuid),DT={instances:{}},Pn=p.createSlice({name:"organizationAccess",initialState:DT,extraReducers:t=>t.addMatcher(p.isAnyOf(_,w),s=>Object.assign(s,DT)),reducers:{initializeOrganizationAccesses:Ne.initialize,addOrganizationAccess:Ne.addOne,addOrganizationAccesses:Ne.addMany,setOrganizationAccess:Ne.setOne,setOrganizationAccesses:Ne.setMany,updateOrganizationAccess:Ne.updateOne,updateOrganizationAccesses:Ne.updateMany,deleteOrganizationAccess:Ne.deleteOne,deleteOrganizationAccesses:Ne.deleteMany}}),{initializeOrganizationAccesses:CT,addOrganizationAccess:$T,addOrganizationAccesses:UT,setOrganizationAccess:kT,setOrganizationAccesses:LT,updateOrganizationAccess:NT,updateOrganizationAccesses:GT,deleteOrganizationAccess:HT,deleteOrganizationAccesses:KT}=Pn.actions,WT=Pn.reducer,qt=t=>t.organizationAccessReducer.instances,YT=(t,s)=>t.organizationAccessReducer.instances[s],ZT=I([qt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(Object.values(t).filter(({uuid:n})=>e.has(n)))}),bF=p.createSelector([jT,qt],(t,s)=>Object.values(s).find(n=>n.user===(t==null?void 0:t.id))??null),JT=p.createSelector([qt],t=>{const s={};for(const e of Object.values(t))s[e.user]=e;return pt(s)}),_F=I([On,JT,(t,s)=>s],(t,s,e)=>T(Object.values(t).filter(n=>{const a=s[n.id];return!!a&&a.organization===e}))),Ge=R(t=>t.uuid),XT={instances:{}},Fn=p.createSlice({name:"organizations",initialState:XT,extraReducers:t=>t.addMatcher(p.isAnyOf(_,w),s=>Object.assign(s,XT)),reducers:{initializeOrganizations:Ge.initialize,setOrganizations:Ge.setMany,setOrganization:Ge.setOne,addOrganizations:Ge.addMany,addOrganization:Ge.addOne,updateOrganizations:Ge.updateMany,updateOrganization:Ge.updateOne,deleteOrganization:Ge.deleteOne,deleteOrganizations:Ge.deleteMany}}),{initializeOrganizations:QT,setOrganizations:xT,setOrganization:eS,addOrganizations:tS,addOrganization:sS,updateOrganizations:iS,updateOrganization:nS,deleteOrganization:aS,deleteOrganizations:cS}=Fn.actions,dS=t=>t.organizationReducer.instances,rS=p.createSelector([dS],t=>Object.values(t)),uS=(t,s)=>t.organizationReducer.instances[s],lS=I([rS,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),oS=Fn.reducer,hS=(t,s,e)=>{const n=t.uuid?t:{...t,uuid:xe.v4()};return{payload:n,type:"",meta:{offline:{effect:{timestamp:new Date().toISOString(),request:n,BASE_URL:s,serviceName:e}}}}},mS={deletedRequests:[],latestRetryTime:0},gn=p.createSlice({name:"outbox",initialState:mS,extraReducers:t=>t.addCase(_,s=>Object.assign(s,mS)),reducers:{enqueueRequest:{reducer:(t,s)=>t,prepare:t=>{console.debug("Preparing to enqueue request",t);const{BASE_URL:s,serviceName:e,...n}=t;return hS(n,s,e)}},markForDeletion(t,s){t.deletedRequests.push(s.payload)},markAsDeleted(t,s){const e=t.deletedRequests.indexOf(s.payload);e!==-1&&t.deletedRequests.splice(e,1)},_setLatestRetryTime:(t,s)=>{t.latestRetryTime=s.payload}}}),MF=t=>t.outboxReducer.deletedRequests,RF=t=>t.outboxReducer.latestRetryTime,{enqueueRequest:yS,markForDeletion:wF,markAsDeleted:pS,_setLatestRetryTime:AS}=gn.actions,fS=gn.reducer,He=R(t=>t.uuid),TS={instances:{}},bn=p.createSlice({name:"projectAccess",initialState:TS,extraReducers:t=>t.addMatcher(p.isAnyOf(_,w),s=>Object.assign(s,TS)),reducers:{initializeProjectAccesses:He.initialize,addProjectAccess:He.addOne,addProjectAccesses:He.addMany,setProjectAccess:He.setOne,setProjectAccesses:He.setMany,updateProjectAccess:He.updateOne,updateProjectAccesses:He.updateMany,deleteProjectAccess:He.deleteOne,deleteProjectAccesses:He.deleteMany}}),{initializeProjectAccesses:SS,addProjectAccess:IS,addProjectAccesses:OS,setProjectAccess:PS,setProjectAccesses:FS,updateProjectAccess:gS,updateProjectAccesses:bS,deleteProjectAccess:_S,deleteProjectAccesses:MS}=bn.actions,RS=bn.reducer,_n=t=>t.projectAccessReducer.instances,mt=p.createSelector(_n,t=>Object.values(t)),wS=(t,s)=>t.projectAccessReducer.instances[s],ES=I([mt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),EF=I([_n,(t,s)=>s],(t,s)=>T(Object.values(t).filter(e=>e.project===s))),vF=p.createSelector([mt,(t,s)=>s],(t,s)=>{const e={};for(const n of t.filter(a=>a.project===s))e[n.user]=n;return e}),VF=I([Bt,mt,(t,s)=>s],(t,s,e)=>{const n=new Set(s.filter(a=>a.project===e).map(a=>a.user));return T(t.filter(a=>n.has(a.id)))}),Ke=R(t=>t.uuid),vS={instances:{}},Mn=p.createSlice({name:"projectAttachments",initialState:vS,extraReducers:t=>t.addMatcher(p.isAnyOf(_,w),s=>Object.assign(s,vS)),reducers:{initializeProjectAttachments:Ke.initialize,addProjectAttachment:Ke.addOne,addProjectAttachments:Ke.addMany,setProjectAttachment:Ke.setOne,setProjectAttachments:Ke.setMany,updateProjectAttachment:Ke.updateOne,updateProjectAttachments:Ke.updateMany,deleteProjectAttachment:Ke.deleteOne,deleteProjectAttachments:Ke.deleteMany}}),{initializeProjectAttachments:VS,addProjectAttachment:zS,addProjectAttachments:BS,setProjectAttachment:jS,setProjectAttachments:qS,updateProjectAttachment:DS,updateProjectAttachments:CS,deleteProjectAttachment:$S,deleteProjectAttachments:US}=Mn.actions,kS=t=>t.projectAttachmentReducer.instances,Rn=p.createSelector([kS],t=>Object.values(t)),LS=(t,s)=>t.projectAttachmentReducer.instances[s],NS=I([Rn,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),zF=I([Rn,(t,s)=>s],(t,s)=>T(t.filter(({project:e})=>s===e))),GS=Mn.reducer,We=R(t=>t.uuid),HS={instances:{},activeProjectFileId:null,isImportingProjectFile:!1},wn=p.createSlice({name:"projectFiles",initialState:HS,extraReducers:t=>t.addMatcher(p.isAnyOf(_,C,w),s=>Object.assign(s,HS)),reducers:{initializeProjectFiles:We.initialize,setProjectFile:We.setOne,setProjectFiles:We.setMany,addProjectFile:We.addOne,addProjectFiles:We.addMany,updateProjectFile:We.updateOne,updateProjectFiles:We.updateMany,deleteProjectFile:We.deleteOne,deleteProjectFiles:We.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:KS,setProjectFile:WS,setProjectFiles:YS,addProjectFile:ZS,addProjectFiles:JS,updateProjectFile:XS,updateProjectFiles:QS,deleteProjectFile:xS,deleteProjectFiles:eI,setIsImportingProjectFile:tI,setActiveProjectFileId:sI,saveActiveProjectFileBounds:iI}=wn.actions,nI=t=>t.projectFileReducer.instances,aI=p.createSelector([nI],t=>T(Object.values(t).sort((s,e)=>s.z_index-e.z_index))),cI=(t,s)=>t.projectFileReducer.instances[s],dI=I([aI,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),BF=t=>t.projectFileReducer.activeProjectFileId,jF=t=>t.projectFileReducer.isImportingProjectFile,rI=wn.reducer,Ye=R(t=>t.uuid),uI={instances:{}},En=p.createSlice({name:"projects",initialState:uI,extraReducers:t=>t.addMatcher(p.isAnyOf(_,w),s=>Object.assign(s,uI)),reducers:{initializeProjects:Ye.initialize,setProjects:Ye.setMany,setProject:Ye.setOne,addProjects:Ye.addMany,addProject:Ye.addOne,updateProjects:Ye.updateMany,updateProject:Ye.updateOne,deleteProject:Ye.deleteOne,deleteProjects:Ye.deleteMany}}),{initializeProjects:lI,setProjects:oI,setProject:hI,addProjects:mI,addProject:yI,updateProjects:pI,updateProject:AI,deleteProject:fI,deleteProjects:TI}=En.actions,SI=En.reducer,II=t=>t.projectReducer.instances,Dt=p.createSelector([II],t=>Object.values(t)),OI=(t,s)=>t.projectReducer.instances[s],PI=I([Dt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),qF=I([Dt,mt,(t,s)=>s],(t,s,e)=>{const n=new Set(s.filter(a=>a.user===e).map(a=>a.project));return T(t.filter(a=>n.has(a.uuid)))}),DF=I([Dt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.organization===s))),CF={isRehydrated:!1},vn=p.createSlice({name:"rehydrated",initialState:CF,reducers:{setRehydrated:(t,s)=>{t.isRehydrated=s.payload}}}),{setRehydrated:$F}=vn.actions,UF=t=>t.rehydratedReducer.isRehydrated,FI=vn.reducer,Ze=R(t=>t.uuid),gI={instances:{}},Vn=p.createSlice({name:"teamMemberships",initialState:gI,extraReducers:t=>t.addMatcher(p.isAnyOf(_,w),s=>Object.assign(s,gI)),reducers:{initializeTeamMemberships:Ze.initialize,addTeamMembership:Ze.addOne,addTeamMemberships:Ze.addMany,setTeamMembership:Ze.setOne,setTeamMemberships:Ze.setMany,updateTeamMembership:Ze.updateOne,updateTeamMemberships:Ze.updateMany,deleteTeamMembership:Ze.deleteOne,deleteTeamMemberships:Ze.deleteMany}}),{initializeTeamMemberships:bI,addTeamMembership:_I,addTeamMemberships:MI,setTeamMembership:RI,setTeamMemberships:wI,updateTeamMembership:EI,updateTeamMemberships:vI,deleteTeamMembership:VI,deleteTeamMemberships:zI}=Vn.actions,BI=Vn.reducer,jI=t=>t.teamMembershipReducer.instances,Ct=p.createSelector([jI],t=>Object.values(t)),qI=(t,s)=>t.teamMembershipReducer.instances[s],DI=I([Ct,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),kF=p.createSelector([Ct,(t,s)=>s],(t,s)=>{const e={};for(const n of t.filter(a=>a.team===s))e[n.user]=n;return e}),LF=I([Bt,Ct,(t,s)=>s],(t,s,e)=>{const n=new Set(s.filter(a=>a.team===e).map(a=>a.user));return T(t.filter(a=>n.has(a.id)))}),Je=R(t=>t.uuid),CI={instances:{}},zn=p.createSlice({name:"teams",initialState:CI,extraReducers:t=>t.addMatcher(p.isAnyOf(_,w),s=>Object.assign(s,CI)),reducers:{initializeTeams:Je.initialize,addTeam:Je.addOne,addTeams:Je.addMany,setTeam:Je.setOne,setTeams:Je.setMany,updateTeam:Je.updateOne,updateTeams:Je.updateMany,deleteTeam:Je.deleteOne,deleteTeams:Je.deleteMany}}),{initializeTeams:$I,addTeam:UI,addTeams:kI,setTeam:LI,setTeams:NI,updateTeam:GI,updateTeams:HI,deleteTeam:KI,deleteTeams:WI}=zn.actions,YI=t=>t.teamReducer.instances,Bn=p.createSelector([YI],t=>Object.values(t)),ZI=(t,s)=>t.teamReducer.instances[s],JI=I([Bn,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))}),NF=I([Bn,(t,s)=>s],(t,s)=>T(t.filter(e=>e.organization===s))),XI=zn.reducer,GF={version:0},QI=p.createSlice({name:"versioning",initialState:GF,reducers:{}}),xI=QI.reducer,jn={outboxReducer:fS,fileReducer:kh,authReducer:jo},HF=p.combineReducers(jn),eO={...jn,[rt]:xI,categoryReducer:Yo,assetReducer:kr,assetAttachmentReducer:Ma,assetStageCompletionReducer:Qr,assetStageReducer:mu,assetTypeReducer:To,assetTypeAttachmentReducer:Ru,issueReducer:Qp,issueAttachmentReducer:hp,issueTypeReducer:sT,issueTypeAttachmentReducer:hA,organizationReducer:oS,projectReducer:SI,projectAttachmentReducer:GS,projectAccessReducer:RS,organizationAccessReducer:WT,projectFileReducer:rI,rehydratedReducer:FI,formReducer:Jm,formRevisionReducer:$m,formRevisionAttachmentReducer:wm,formSubmissionAttachmentReducer:oy,formSubmissionReducer:gy,formIdentifierReducer:tm,formIdentifierValueReducer:pm,userReducer:BT,emailDomainsReducer:qh,documentsReducer:Sh,documentAttachmentReducer:rh,teamReducer:XI,agentsReducer:ia,issueCommentReducer:$p,issueCommentAttachmentReducer:_p,issueUpdateReducer:bT,geoImageReducer:Cy,issueAssociationReducer:xy,issueTypeFieldsReducer:ef,issueTypeFieldValuesReducer:UA,issueTypeFieldsAttachmentReducer:_A,issueTypeFieldValuesAttachmentReducer:yf,issueTypeIdentifierReducer:Rf,issueTypeIdentifierValueReducer:Lf,issueTypeStatusReducer:pT,assetTypeFieldsReducer:sl,assetTypeFieldValuesReducer:wl,assetTypeFieldsAttachmentReducer:Lu,assetTypeFieldValuesAttachmentReducer:pl,assetTypeIdentifierReducer:Nl,assetTypeIdentifierValueReducer:io,assetTypeStatusReducer:Vo,assetProcedureTypeReducer:hd,assetProcedureReducer:Xc,assetProcedureTypeFieldsReducer:hc,assetProcedureTypeFieldValuesReducer:$c,assetProcedureTypeFieldsAttachmentReducer:Qa,assetProcedureTypeFieldValuesAttachmentReducer:gc,assetProcedureTypeAttachmentReducer:Ca,assetProcedureStepFieldsAttachmentReducer:wd,assetProcedureStepFieldsReducer:Ld,assetProcedureStepFieldValuesAttachmentReducer:tr,assetProcedureStepFieldValuesReducer:pr,assetProcedureStepReducer:_r,teamMembershipReducer:BI},KF=p.combineReducers(eO),tO=1e4,sO=200,qn=[400,409,403,404,405,500],L=1e4,iO={};class nO{constructor(s){m(this,"client");m(this,"pageSize",tO);iO[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 aO=()=>rO.length-1,cO=t=>(t[rt]={version:aO()},t),dO=()=>cO({}),WF=t=>(t.outboxReducer&&(t.outboxReducer.deletedRequests=[]),t),YF=t=>s=>{var e;return s===void 0&&(s={}),((e=s[rt])==null?void 0:e.version)===aO()?s:t(s)},rO=[cO,dO,dO,WF],ZF=Object.fromEntries(rO.map((t,s)=>[s,YF(t)])),JF=t=>{if(t)throw t;const s=dt();s?s.dispatch({type:"rehydrated/setRehydrated",payload:!0}):console.error("Client store not set")},uO=(t,s,e)=>{const n=tt();return n?(n.addRequest(s),n.getQueue()):(console.warn("Outbox coordinator not set; cannot enqueue request yet."),[])},lO=(t,s,e)=>{const n=tt();if(!n)return console.warn("Outbox coordinator not set; cannot dequeue request yet."),[];const c=s.meta.offlineAction.payload.uuid;return n.remove(c),n.getQueue()};async function XF(t,s){if(!s.payload)throw new Error("Received empty payload");return FO(s)}const QF={...Gn,effect:XF,discard:hO,returnPromises:!0,persistCallback:JF,retry:sg,persistOptions:{storage:VO},queue:{...Gn.queue,enqueue:uO,dequeue:lO,peek:(...t)=>tg(...t)}},xF=zO(ZF,rt),eg=p.compose(vO.offline(QF),xF);async function oO(t,s,e){if(s.store.getState().outboxReducer.deletedRequests.includes(t.payload.uuid))throw new Error("Request was marked for deletion");const a=iO[t.meta.offline.effect.serviceName];if(!a)throw new Error(`Service ${t.meta.offline.effect.serviceName} not found`);return Un(t.meta.offline.effect.BASE_URL,t.meta.offline.effect.request,s,a,e)}function hO(t,s,e=0){var d;if(console.debug("Considering discarding request due to error:",t,`(${typeof t})`,`
1
+ (function(i,L){typeof exports=="object"&&typeof module<"u"?L(exports,require("@redux-offline/redux-offline/lib/types"),require("@reduxjs/toolkit"),require("superagent"),require("uuid"),require("react"),require("react-redux"),require("file-saver"),require("fast-tree-builder"),require("ts-tree-lib"),require("react-fast-compare"),require("@redux-offline/redux-offline"),require("@redux-offline/redux-offline/lib/defaults"),require("localforage"),require("redux-persist-migrate"),require("buffer"),require("@overmap-ai/forms"),require("idb"),require("jwt-decode"),require("dependency-graph"),require("@tiptap/core")):typeof define=="function"&&define.amd?define(["exports","@redux-offline/redux-offline/lib/types","@reduxjs/toolkit","superagent","uuid","react","react-redux","file-saver","fast-tree-builder","ts-tree-lib","react-fast-compare","@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"],L):(i=typeof globalThis<"u"?globalThis:i||self,L(i["overmap-core"]={},null,i.toolkit,i.request,i.uuid,i.react,i.reactRedux,i.fileSaver,i.buildTree,i.tsTreeLib,i.isEqual,i.reduxOffline,i.offlineConfig,i.localforage,i.createMigration,null,null,i.idb,i.jwtDecode,i.dependencyGraph))})(this,function(i,L,p,it,et,Gn,Hn,EO,Kn,pt,vO,VO,Wn,zO,BO,Mb,Rb,jO,qO,DO){"use strict";var bb=Object.defineProperty;var _b=(i,L,p)=>L in i?bb(i,L,{enumerable:!0,configurable:!0,writable:!0,value:p}):i[L]=p;var m=(i,L,p)=>_b(i,typeof L!="symbol"?L+"":L,p);var RO;const Yn=Object.freeze([]),Zn=Object.freeze({});var Jn=(t=>(t[t.GUEST=0]="GUEST",t[t.BASIC=2]="BASIC",t[t.ADMIN=4]="ADMIN",t))(Jn||{}),h=(t=>(t.GET="GET",t.POST="POST",t.PATCH="PATCH",t.PUT="PUT",t.DELETE="DELETE",t))(h||{}),Xn=(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))(Xn||{}),Qn=(t=>(t.Issue="issue",t.Asset="asset",t.AssetType="asset_type",t.Project="project",t.Document="document",t))(Qn||{}),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||{}),U=(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))(U||{}),xn=(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))(xn||{});const CO=Lt.MEDIUM,ea=6e4;function w(t){return{addOne:(o,y)=>{const A=t(y.payload);o.instances[A]=y.payload},addMany:(o,y)=>{for(const A of y.payload){const f=t(A);o.instances[f]=A}},setOne:(o,y)=>{const A=t(y.payload);o.instances[A]=y.payload},setMany:(o,y)=>{for(const A of y.payload){const f=t(A);o.instances[f]=A}},updateOne:(o,y)=>{const A=t(y.payload);o.instances[A]=y.payload},updateMany:(o,y)=>{for(const A of y.payload){const f=t(A);o.instances[f]=A}},deleteOne:(o,y)=>{delete o.instances[y.payload]},deleteMany:(o,y)=>{for(const A of y.payload)delete o.instances[A]},initialize:(o,y)=>{o.instances={};const A=new Set;for(const f of y.payload){const I=t(f);A.add(I),o.instances[I]=f}A.size!==y.payload.length&&console.warn("duplicate ids detected when initializing model instances.")}}}function $O(){return{initializeSelection:(u,d)=>{u.selection=Array.from(new Set(d.payload))},selectOne:(u,d)=>{new Set(u.selection).has(d.payload)||u.selection.push(d.payload)},selectMany:(u,d)=>{const o=new Set(u.selection);for(const y of d.payload)o.has(y)||o.add(y);u.selection=Array.from(o)},unselectOne:(u,d)=>{const o=new Set(u.selection);o.has(d.payload)&&(o.delete(d.payload),u.selection=Array.from(o))},unselectMany:(u,d)=>{const o=new Set(u.selection);for(const y of d.payload)o.has(y)&&o.delete(y);u.selection=Array.from(o)},toggleOne:(u,d)=>{const o=new Set(u.selection);o.has(d.payload)?o.delete(d.payload):o.add(d.payload),u.selection=Array.from(o)},toggleMany:(u,d)=>{const o=new Set(u.selection);for(const y of d.payload)o.has(y)?o.delete(y):o.add(y);u.selection=Array.from(o)},getInitialState:u=>({...u,selection:[]})}}const ut="versioning",M=p.createAction("RESET"),$=p.createAction("RESET_PROJECT_STATE"),E=p.createAction("RESET_ORGANIZATION_STATE");function UO(t,s){return Gn.useMemo(t,s)}function kO(t,s){const e=Gn.useMemo(t,s);return Hn.useSelector(e)}RO=Symbol.toStringTag;class Nt{constructor(){m(this,RO,"Promise");m(this,"_promise");m(this,"_resolve");m(this,"_reject");m(this,"_state","pending");this._resolve=null,this._reject=null,this._promise=new Promise((s,e)=>{this._resolve=s,this._reject=e})}get state(){return this._state}then(s,e){return this._promise.then(s,e)}catch(s){return this._promise.catch(s)}resolve(s){if(!this._resolve)throw new Error("No resolve callback");this._resolve(s),this._state="fulfilled"}reject(s){if(!this._reject)throw s;this._reject(s),this._state="rejected"}finally(s){throw new Error("`finally` not implemented")}}let Gt=!1;["true","1"].includes("".toLowerCase())&&(Gt=!0);function LO(t,s){if(t===s)return!0;if(typeof t!=typeof s)return!1;const e=Object.keys(t),n=Object.keys(s),a=e.length;if(a!==n.length)return!1;for(let c=0;c<a;c++){const r=e[c];if(!Object.prototype.hasOwnProperty.call(s,r)||t[r]!==s[r])return!1}return!0}function Ht(t){const s={};return function(){const e=Array.prototype.slice.call(arguments);return e in s?(Gt&&console.debug(`Memoization debug: Using memorized return value for ${t.toString()}(`,e,")"),s[e]):(Gt&&console.debug(`Memoization debug: Cache miss! Memoizing ${t.toString()}(`,e,")"),s[e]=t.apply(this,e))}}function NO(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 T=t=>t.length===0?Yn:t,At=t=>Object.keys(t).length===0?Zn:t,ta=Ht(t=>{if(!t)return"";const s=new Date(t),e=s.getFullYear()===Kt.getFullYear(),n={day:"numeric",month:"short"};return e||(n.year="numeric"),s.toLocaleDateString([],n)}),GO=new Intl.RelativeTimeFormat([],{style:"long",numeric:"auto"}),HO=1e3*86400,Kt=new Date,KO=t=>new Date(t).toDateString()===Kt.toDateString(),WO=Ht((t,s,e)=>{const n=Math.round((new Date(t).getTime()-Kt.getTime())/HO);return n<s||n>e?ta(t):GO.format(n,"days")});function YO(t){return new Uint8Array(t).reduce((e,n)=>e+n.toString(16).padStart(2,"0"),"")}const Wt=async(t,s)=>{s||(s=await nt(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 nt(t){return new Promise((s,e)=>{const n=new FileReader;n.onload=()=>{const a=n.result;if(!a){e(new Error("FileReader did not return a valid ArrayBuffer."));return}crypto.subtle.digest("SHA-1",a).then(c=>{const r=YO(c);s(r)})},n.readAsArrayBuffer(t)})}function ZO(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 sa(t,s){return new File([t],s,{type:t.type})}function JO(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 XO=async t=>{const s={};for(const e of t){const n=await nt(e);s[n]={sha1:n,extension:e.name.split(".").pop()||"",file_type:e.type,size:e.size}}return Object.values(s)},ia=async t=>(await fetch(t)).blob(),QO=t=>new Promise((s,e)=>{const n=new FileReader;n.onloadend=()=>{var a;s(((a=n.result)==null?void 0:a.toString())||"")},n.readAsDataURL(t)});function xO(t){const s=new Blob([t]);EO.saveAs(s,t.name)}const na={};function eP(t,s,e,...n){const a=na[t];let c=!1;a?a[s]||(a[s]=!0,c=!0):(na[t]={[s]:!0},c=!0),c&&console[e](...n)}const aa=["created_at","updated_at","index","revision"];function R(t){return{...t,uuid:et.v4()}}function tP(t){const s={};for(const e of t)s[e.uuid]=e;return s}function C(t){return t.map(({uuid:s})=>s)}function ft(t,s){return t.localeCompare(s)}function Yt(t,s){return ft(t.uuid,s.uuid)}function sP(t,s=void 0,e=255){let n=t.replace(/[^a-z0-9_\-.]/gi,"_").replace(/_{2,}/g,"_");if(!s){const c=t.split(".");c.length>1&&(s=c[c.length-1])}s&&!s.startsWith(".")&&(s="."+s);const a=s?s.length:0;return n.length+a>e&&(n=n.slice(0,e-a)+(s||"")),n}function iP(t){return t.toLowerCase().replace(" ","-")}function nP(t,s=!1){return t.normalize("NFKD").toLowerCase().replace(/[^\w\s-]/g,"").trim().replace(/[-\s]+/g,s?"_":"-")}function aP(t,s){if(t.length<=s)return t;const e=t.slice(0,s-1);return e.slice(0,e.lastIndexOf(" "))+"…"}const cP=/^.+@.+\..+$/;function z(t){const s={...t};for(const e of[...aa,"created_by"])e in s&&delete s[e];return s}const ca=t=>{const s=t.toSorted((e,n)=>e.order-n.order);return Kn(s,{id:e=>e.uuid,parentId:e=>e.parent,includeEmptyChildrenArray:!0,valueKey:!1})},dP=t=>{const{roots:s}=ca(t);return s.map(e=>new pt.Tree(e))},da=(t,s)=>{const{nodes:e}=ca(s),n=e.get(t);if(!n)throw new Error(`Node with uuid ${t} does not exist in asset procedure step tree.`);return new pt.Tree(n)},ra=(t,s)=>t.type!==s.type?t.type-s.type:t.order-s.order,ua=(t,s)=>t.type!==s.type?t.type-s.type:t.order-s.order,la=t=>Kn(t,{id:s=>s.uuid,parentId:s=>s.parent_document,includeEmptyChildrenArray:!0,valueKey:!1}),rP=t=>{const{roots:s}=la(t);return s.map(e=>new pt.Tree(e))},oa=(t,s)=>{const{nodes:e}=la(s),n=e.get(t);if(!n)throw new Error(`Node with uuid ${t} does not exist in document tree.`);return new pt.Tree(n)};class uP{constructor(s){m(this,"operations",[]);m(this,"getData");this.getData=s}performOperations(s){let e=s;for(const n of this.operations)e=n(e);return e}filter(s,e){return this.operations.push(n=>n.filter(a=>a[s]===e)),this}exclude(s,e){return this.operations.push(n=>n.filter(a=>a[s]!==e)),this}orderBy(s){return this.operations.push(e=>[...e].sort((n,a)=>n[s]<=a[s]?1:-1)),this}reverse(){return this.operations.push(s=>[...s].reverse()),this}all(){return this.operations.push(s=>s),this}get(s,e){return p.createSelector([this.getData],n=>this.performOperations(n).find(a=>a[s]===e))}count(){return p.createSelector([this.getData],s=>this.performOperations(s).length)}first(){return p.createSelector([this.getData],s=>this.performOperations(s)[0])}last(){return p.createSelector([this.getData],s=>{const e=this.performOperations(s);return e[e.length-1]})}exists(){return p.createSelector([this.getData],s=>this.performOperations(s).length>0)}toSelector(){return p.createSelector([this.getData],s=>T(this.performOperations(s)))}}const S=t=>(...s)=>e=>t(e,...s),O=p.createSelectorCreator({memoize:p.lruMemoize,memoizeOptions:{resultEqualityCheck:Hn.shallowEqual}}),lP=p.createSelectorCreator({memoize:p.lruMemoize,memoizeOptions:{resultEqualityCheck:vO}}),G=w(t=>t.uuid),ha={instances:{}},Zt=p.createSlice({name:"agents",initialState:ha,extraReducers:t=>t.addMatcher(p.isAnyOf(M,$,E),s=>Object.assign(s,ha)),reducers:{initializeConversations:G.initialize,addConversation:G.addOne,addConversations:G.addMany,setConversation:G.setOne,setConversations:G.setMany,updateConversation:G.updateOne,updateConversations:G.updateMany,deleteConversation:G.deleteOne,deleteConversations:G.deleteMany}}),{initializeConversations:ma,addConversation:ya,addConversations:oP,setConversation:pa,setConversations:hP,updateConversation:Aa,updateConversations:mP,deleteConversation:yP,deleteConversations:pP}=Zt.actions,Jt=t=>t.agentsReducer.instances,AP=p.createSelector([Jt],t=>Object.values(t)),fP=S(p.createSelector([Jt,(t,s)=>s],(t,s)=>t[s])),fa=Zt.reducer,H=w(t=>t.uuid),Sa={instances:{}},Xt=p.createSlice({name:"assetAttachments",initialState:Sa,extraReducers:t=>t.addMatcher(p.isAnyOf(M,$,E),s=>Object.assign(s,Sa)),reducers:{initializeAssetAttachments:H.initialize,addAssetAttachment:H.addOne,addAssetAttachments:H.addMany,setAssetAttachment:H.setOne,setAssetAttachments:H.setMany,updateAssetAttachment:H.updateOne,updateAssetAttachments:H.updateMany,deleteAssetAttachment:H.deleteOne,deleteAssetAttachments:H.deleteMany}}),{initializeAssetAttachments:Ta,addAssetAttachment:Ia,addAssetAttachments:Qt,setAssetAttachment:Oa,setAssetAttachments:Pa,updateAssetAttachment:Fa,updateAssetAttachments:ga,deleteAssetAttachment:ba,deleteAssetAttachments:xt}=Xt.actions,_a=t=>t.assetAttachmentReducer.instances,es=p.createSelector([_a],t=>Object.values(t)),Ma=t=>s=>s.assetAttachmentReducer.instances[t],Ra=S(O([es,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),wa=S(O([es,(t,s)=>s],(t,s)=>T(t.filter(({asset:e})=>s===e)))),Ea=Xt.reducer,K=w(({uuid:t})=>t),va={instances:{}},ts=p.createSlice({name:"assetProcedureTypeAttachments",initialState:va,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,va)),reducers:{initializeAssetProcedureTypeAttachments:K.initialize,addAssetProcedureTypeAttachment:K.addOne,addAssetProcedureTypeAttachments:K.addMany,setAssetProcedureTypeAttachment:K.setOne,setAssetProcedureTypeAttachments:K.setMany,updateAssetProcedureTypeAttachment:K.updateOne,updateAssetProcedureTypeAttachments:K.updateMany,deleteAssetProcedureTypeAttachment:K.deleteOne,deleteAssetProcedureTypeAttachments:K.deleteMany}}),{initializeAssetProcedureTypeAttachments:Va,addAssetProcedureTypeAttachment:za,addAssetProcedureTypeAttachments:Ba,setAssetProcedureTypeAttachment:ja,setAssetProcedureTypeAttachments:qa,updateAssetProcedureTypeAttachment:Da,updateAssetProcedureTypeAttachments:Ca,deleteAssetProcedureTypeAttachment:$a,deleteAssetProcedureTypeAttachments:Ua}=ts.actions,ka=ts.reducer,La=t=>t.assetProcedureTypeAttachmentReducer.instances,ss=p.createSelector([La],t=>Object.values(t)),Na=t=>s=>s.assetProcedureTypeAttachmentReducer.instances[t],Ga=S(O([ss,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),SP=S(O([ss,(t,s)=>s],(t,s)=>T(t.filter(({asset_procedure_type:e})=>s===e)))),W=w(({uuid:t})=>t),Ha={instances:{}},is=p.createSlice({name:"assetProcedureTypeFieldsAttachments",initialState:Ha,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,Ha)),reducers:{initializeAssetProcedureTypeFieldsAttachments:W.initialize,addAssetProcedureTypeFieldsAttachment:W.addOne,addAssetProcedureTypeFieldsAttachments:W.addMany,setAssetProcedureTypeFieldsAttachment:W.setOne,setAssetProcedureTypeFieldsAttachments:W.setMany,updateAssetProcedureTypeFieldsAttachment:W.updateOne,updateAssetProcedureTypeFieldsAttachments:W.updateMany,deleteAssetProcedureTypeFieldsAttachment:W.deleteOne,deleteAssetProcedureTypeFieldsAttachments:W.deleteMany}}),{initializeAssetProcedureTypeFieldsAttachments:Ka,addAssetProcedureTypeFieldsAttachment:Wa,addAssetProcedureTypeFieldsAttachments:Ya,setAssetProcedureTypeFieldsAttachment:Za,setAssetProcedureTypeFieldsAttachments:Ja,updateAssetProcedureTypeFieldsAttachment:Xa,updateAssetProcedureTypeFieldsAttachments:Qa,deleteAssetProcedureTypeFieldsAttachment:xa,deleteAssetProcedureTypeFieldsAttachments:ec}=is.actions,tc=is.reducer,sc=t=>t.assetProcedureTypeFieldsAttachmentReducer.instances,ns=p.createSelector([sc],t=>Object.values(t)),TP=S(O([ns,(t,s)=>s],(t,s)=>T(t.filter(e=>e.fields_revision===s)))),ic=t=>s=>s.assetProcedureTypeFieldsAttachmentReducer.instances[t],nc=S(O([ns,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),Y=w(({uuid:t})=>t),ac={instances:{}},as=p.createSlice({name:"assetProcedureTypeFields",initialState:ac,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,ac)),reducers:{initializeAssetProcedureTypeFields:Y.initialize,addAssetProcedureTypeFields:Y.addOne,addAssetProcedureTypeFieldsMany:Y.addMany,setAssetProcedureTypeFields:Y.setOne,setAssetProcedureTypeFieldsMany:Y.setMany,updateAssetProcedureTypeFields:Y.updateOne,updateAssetProcedureTypeFieldsMany:Y.updateMany,deleteAssetProcedureTypeFields:Y.deleteOne,deleteAssetProcedureTypeFieldsMany:Y.deleteMany}}),{initializeAssetProcedureTypeFields:cc,addAssetProcedureTypeFields:dc,addAssetProcedureTypeFieldsMany:rc,setAssetProcedureTypeFields:uc,setAssetProcedureTypeFieldsMany:lc,updateAssetProcedureTypeFields:oc,updateAssetProcedureTypeFieldsMany:hc,deleteAssetProcedureTypeFields:mc,deleteAssetProcedureTypeFieldsMany:yc}=as.actions,pc=as.reducer,Ac=t=>t.assetProcedureTypeFieldsReducer.instances,St=p.createSelector([Ac],t=>Object.values(t)),IP=S(O([St,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_procedure_type===s)))),OP=S(p.createSelector([St,(t,s)=>s],(t,s)=>t.filter(e=>e.asset_procedure_type===s).sort((e,n)=>e.submitted_at>n.submitted_at?-1:1)[0])),fc=t=>s=>s.assetProcedureTypeFieldsReducer.instances[t],Sc=S(O([St,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),Z=w(({uuid:t})=>t),Tc={instances:{}},cs=p.createSlice({name:"assetProcedureTypeFieldValuesAttachments",initialState:Tc,extraReducers:t=>t.addMatcher(p.isAnyOf(M,$,E),s=>Object.assign(s,Tc)),reducers:{initializeAssetProcedureTypeFieldValuesAttachments:Z.initialize,addAssetProcedureTypeFieldValuesAttachment:Z.addOne,addAssetProcedureTypeFieldValuesAttachments:Z.addMany,setAssetProcedureTypeFieldValuesAttachment:Z.setOne,setAssetProcedureTypeFieldValuesAttachments:Z.setMany,updateAssetProcedureTypeFieldValuesAttachment:Z.updateOne,updateAssetProcedureTypeFieldValuesAttachments:Z.updateMany,deleteAssetProcedureTypeFieldValuesAttachment:Z.deleteOne,deleteAssetProcedureTypeFieldValuesAttachments:Z.deleteMany}}),{initializeAssetProcedureTypeFieldValuesAttachments:Ic,addAssetProcedureTypeFieldValuesAttachment:Oc,addAssetProcedureTypeFieldValuesAttachments:ds,setAssetProcedureTypeFieldValuesAttachment:Pc,setAssetProcedureTypeFieldValuesAttachments:Fc,updateAssetProcedureTypeFieldValuesAttachment:gc,updateAssetProcedureTypeFieldValuesAttachments:bc,deleteAssetProcedureTypeFieldValuesAttachment:_c,deleteAssetProcedureTypeFieldValuesAttachments:rs}=cs.actions,Mc=cs.reducer,Rc=t=>t.assetProcedureTypeFieldValuesAttachmentReducer.instances,us=p.createSelector([Rc],t=>Object.values(t)),wc=t=>s=>s.assetProcedureTypeFieldValuesAttachmentReducer.instances[t],Ec=S(O([us,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),vc=S(O([us,(t,s)=>s],(t,s)=>T(t.filter(e=>e.field_values===s)))),J=w(({uuid:t})=>t),Vc={instances:{}},ls=p.createSlice({name:"assetProcedureTypeFieldValues",initialState:Vc,extraReducers:t=>t.addMatcher(p.isAnyOf(M,$,E),s=>Object.assign(s,Vc)),reducers:{initializeAssetProcedureTypeFieldValues:J.initialize,addAssetProcedureTypeFieldValues:J.addOne,addAssetProcedureTypeFieldValuesMany:J.addMany,setAssetProcedureTypeFieldValues:J.setOne,setAssetProcedureTypeFieldValuesMany:J.setMany,updateAssetProcedureTypeFieldValues:J.updateOne,updateAssetProcedureTypeFieldValuesMany:J.updateMany,deleteAssetProcedureTypeFieldValues:J.deleteOne,deleteAssetProcedureTypeFieldValuesMany:J.deleteMany}}),{initializeAssetProcedureTypeFieldValues:zc,addAssetProcedureTypeFieldValues:Bc,addAssetProcedureTypeFieldValuesMany:jc,setAssetProcedureTypeFieldValues:qc,setAssetProcedureTypeFieldValuesMany:Dc,updateAssetProcedureTypeFieldValues:Cc,updateAssetProcedureTypeFieldValuesMany:$c,deleteAssetProcedureTypeFieldValues:Uc,deleteAssetProcedureTypeFieldValuesMany:kc}=ls.actions,Lc=ls.reducer,Nc=t=>t.assetProcedureTypeFieldValuesReducer.instances,Tt=p.createSelector([Nc],t=>Object.values(t)),PP=S(O([Tt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset===s)))),FP=S(O([Tt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_procedure===s)))),Gc=t=>s=>s.assetProcedureTypeFieldValuesReducer.instances[t],Hc=S(O([Tt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),X=w(({uuid:t})=>t),Kc={instances:{}},os=p.createSlice({name:"assetProcedures",initialState:Kc,extraReducers:t=>t.addMatcher(p.isAnyOf(M,$,E),s=>Object.assign(s,Kc)),reducers:{initializeAssetProcedures:X.initialize,addAssetProcedure:X.addOne,addAssetProcedures:X.addMany,setAssetProcedure:X.setOne,setAssetProcedures:X.setMany,updateAssetProcedure:X.updateOne,updateAssetProcedures:X.updateMany,deleteAssetProcedure:X.deleteOne,deleteAssetProcedures:X.deleteMany}}),{initializeAssetProcedures:Wc,addAssetProcedure:Yc,addAssetProcedures:hs,updateAssetProcedure:Zc,updateAssetProcedures:Jc,deleteAssetProcedure:Xc,deleteAssetProcedures:ms,setAssetProcedure:Qc,setAssetProcedures:xc}=os.actions,ed=os.reducer,td=t=>t.assetProcedureReducer.instances,It=p.createSelector([td],t=>Object.values(t)),sd=S(O([It,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_procedure_type===s)))),gP=S(O([It,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_type===s)))),id=t=>s=>s.assetProcedureReducer.instances[t],nd=S(O([It,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),Q=w(t=>t.uuid),ad={instances:{}},ys=p.createSlice({name:"assetProcedureTypes",initialState:ad,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,ad)),reducers:{initializeAssetProcedureTypes:Q.initialize,addAssetProcedureType:Q.addOne,addAssetProcedureTypes:Q.addMany,setAssetProcedureType:Q.setOne,setAssetProcedureTypes:Q.setMany,updateAssetProcedureType:Q.updateOne,updateAssetProcedureTypes:Q.updateMany,deleteAssetProcedureType:Q.deleteOne,deleteAssetProcedureTypes:Q.deleteMany}}),{initializeAssetProcedureTypes:cd,addAssetProcedureType:dd,addAssetProcedureTypes:rd,updateAssetProcedureType:ud,updateAssetProcedureTypes:ld,deleteAssetProcedureType:od,deleteAssetProcedureTypes:hd,setAssetProcedureType:md,setAssetProcedureTypes:yd}=ys.actions,pd=ys.reducer,Ad=t=>t.assetProcedureTypeReducer.instances,ps=p.createSelector([Ad],t=>Object.values(t)),fd=t=>s=>s.assetProcedureTypeReducer.instances[t],Sd=S(O([ps,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),bP=S(O([ps,(t,s)=>s],(t,s)=>T(t.filter(e=>e.organization===s)))),x=w(t=>t.uuid),Td={instances:{}},As=p.createSlice({name:"assetProcedureStepFieldsAttachments",initialState:Td,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,Td)),reducers:{initializeAssetProcedureStepFieldsAttachments:x.initialize,addAssetProcedureStepFieldsAttachment:x.addOne,addAssetProcedureStepFieldsAttachments:x.addMany,setAssetProcedureStepFieldsAttachment:x.setOne,setAssetProcedureStepFieldsAttachments:x.setMany,updateAssetProcedureStepFieldsAttachment:x.updateOne,updateAssetProcedureStepFieldsAttachments:x.updateMany,deleteAssetProcedureStepFieldsAttachment:x.deleteOne,deleteAssetProcedureStepFieldsAttachments:x.deleteMany}}),{initializeAssetProcedureStepFieldsAttachments:Id,addAssetProcedureStepFieldsAttachment:Od,addAssetProcedureStepFieldsAttachments:Pd,setAssetProcedureStepFieldsAttachment:Fd,setAssetProcedureStepFieldsAttachments:gd,updateAssetProcedureStepFieldsAttachment:bd,updateAssetProcedureStepFieldsAttachments:_d,deleteAssetProcedureStepFieldsAttachment:Md,deleteAssetProcedureStepFieldsAttachments:Rd}=As.actions,wd=t=>t.assetProcedureStepFieldsAttachmentReducer.instances,fs=p.createSelector([wd],t=>Object.values(t)),_P=S(O([fs,(t,s)=>s],(t,s)=>T(t.filter(e=>e.fields_revision===s)))),Ed=t=>s=>s.assetProcedureStepFieldsAttachmentReducer.instances[t],vd=S(O([fs,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),Vd=As.reducer,ee=w(t=>t.uuid),zd={instances:{}},Ss=p.createSlice({name:"assetProcedureStepFields",initialState:zd,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,zd)),reducers:{initializeAssetProcedureStepFields:ee.initialize,addAssetProcedureStepFields:ee.addOne,addAssetProcedureStepFieldsMany:ee.addMany,setAssetProcedureStepFields:ee.setOne,setAssetProcedureStepFieldsMany:ee.setMany,updateAssetProcedureStepFields:ee.updateOne,updateAssetProcedureStepFieldsMany:ee.updateMany,deleteAssetProcedureStepFields:ee.deleteOne,deleteAssetProcedureStepFieldsMany:ee.deleteMany}}),{initializeAssetProcedureStepFields:Bd,addAssetProcedureStepFields:jd,addAssetProcedureStepFieldsMany:qd,setAssetProcedureStepFields:Dd,setAssetProcedureStepFieldsMany:Cd,updateAssetProcedureStepFields:$d,updateAssetProcedureStepFieldsMany:Ud,deleteAssetProcedureStepFields:kd,deleteAssetProcedureStepFieldsMany:Ld}=Ss.actions,Ts=t=>t.assetProcedureStepFieldsReducer.instances,Ot=p.createSelector([Ts],t=>Object.values(t)),MP=S(O([Ot,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_procedure_step===s)))),RP=S(p.createSelector([Ot,(t,s)=>s],(t,s)=>t.filter(e=>e.asset_procedure_step===s).sort((e,n)=>e.submitted_at>n.submitted_at?-1:1)[0])),wP=p.createSelector([Ts],t=>{const s={};for(const e of Object.values(t)){const n=s[e.asset_procedure_step];(!n||n.submitted_at<e.submitted_at)&&(s[e.asset_procedure_step]=e)}return s}),Nd=t=>s=>s.assetProcedureStepFieldsReducer.instances[t],Gd=S(O([Ot,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),Hd=Ss.reducer,te=w(t=>t.uuid),Kd={instances:{}},Is=p.createSlice({name:"assetProcedureStepFieldValuesAttachments",initialState:Kd,extraReducers:t=>t.addMatcher(p.isAnyOf(M,$,E),s=>Object.assign(s,Kd)),reducers:{initializeAssetProcedureStepFieldValuesAttachments:te.initialize,addAssetProcedureStepFieldValuesAttachment:te.addOne,addAssetProcedureStepFieldValuesAttachments:te.addMany,setAssetProcedureStepFieldValuesAttachment:te.setOne,setAssetProcedureStepFieldValuesAttachments:te.setMany,updateAssetProcedureStepFieldValuesAttachment:te.updateOne,updateAssetProcedureStepFieldValuesAttachments:te.updateMany,deleteAssetProcedureStepFieldValuesAttachment:te.deleteOne,deleteAssetProcedureStepFieldValuesAttachments:te.deleteMany}}),{initializeAssetProcedureStepFieldValuesAttachments:Wd,addAssetProcedureStepFieldValuesAttachment:Yd,addAssetProcedureStepFieldValuesAttachments:Os,setAssetProcedureStepFieldValuesAttachment:Zd,setAssetProcedureStepFieldValuesAttachments:Jd,updateAssetProcedureStepFieldValuesAttachment:Xd,updateAssetProcedureStepFieldValuesAttachments:Qd,deleteAssetProcedureStepFieldValuesAttachment:xd,deleteAssetProcedureStepFieldValuesAttachments:Ps}=Is.actions,er=t=>t.assetProcedureStepFieldValuesAttachmentReducer.instances,Fs=p.createSelector([er],t=>Object.values(t)),tr=t=>s=>s.assetProcedureStepFieldValuesAttachmentReducer.instances[t],sr=S(O([Fs,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),ir=S(O([Fs,(t,s)=>s],(t,s)=>T(t.filter(e=>e.field_values===s)))),nr=Is.reducer,se=w(t=>t.uuid),ar={instances:{}},gs=p.createSlice({name:"assetProcedureStepFieldValues",initialState:ar,extraReducers:t=>t.addMatcher(p.isAnyOf(M,$,E),s=>Object.assign(s,ar)),reducers:{initializeAssetProcedureStepFieldValues:se.initialize,addAssetProcedureStepFieldValues:se.addOne,addAssetProcedureStepFieldValuesMany:se.addMany,setAssetProcedureStepFieldValues:se.setOne,setAssetProcedureStepFieldValuesMany:se.setMany,updateAssetProcedureStepFieldValues:se.updateOne,updateAssetProcedureStepFieldValuesMany:se.updateMany,deleteAssetProcedureStepFieldValues:se.deleteOne,deleteAssetProcedureStepFieldValuesMany:se.deleteMany}}),{initializeAssetProcedureStepFieldValues:cr,addAssetProcedureStepFieldValues:dr,addAssetProcedureStepFieldValuesMany:rr,setAssetProcedureStepFieldValues:ur,setAssetProcedureStepFieldValuesMany:lr,updateAssetProcedureStepFieldValues:or,updateAssetProcedureStepFieldValuesMany:hr,deleteAssetProcedureStepFieldValues:mr,deleteAssetProcedureStepFieldValuesMany:yr}=gs.actions,pr=t=>t.assetProcedureStepFieldValuesReducer.instances,lt=p.createSelector([pr],t=>Object.values(t)),EP=S(O([lt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset===s)))),vP=S(O([lt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_procedure===s)))),VP=S(O([lt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_procedure_step===s)))),Ar=t=>s=>s.assetProcedureStepFieldValuesReducer.instances[t],fr=S(O([lt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),Sr=gs.reducer,ie=w(t=>t.uuid),Tr={instances:{}},bs=p.createSlice({name:"assetProcedureSteps",initialState:Tr,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,Tr)),reducers:{initializeAssetProcedureSteps:ie.initialize,setAssetProcedureStep:ie.setOne,setAssetProcedureSteps:ie.setMany,addAssetProcedureStep:ie.addOne,addAssetProcedureSteps:ie.addMany,updateAssetProcedureStep:ie.updateOne,updateAssetProcedureSteps:ie.updateMany,deleteAssetProcedureStep:ie.deleteOne,deleteAssetProcedureSteps:ie.deleteMany}}),{initializeAssetProcedureSteps:Ir,setAssetProcedureStep:Or,setAssetProcedureSteps:Pr,addAssetProcedureStep:Fr,addAssetProcedureSteps:gr,updateAssetProcedureStep:br,updateAssetProcedureSteps:_r,deleteAssetProcedureStep:Mr,deleteAssetProcedureSteps:Rr}=bs.actions,wr=bs.reducer,Pt=t=>t.assetProcedureStepReducer.instances,Er=t=>s=>s.assetProcedureStepReducer.instances[t],_s=p.createSelector([Pt],t=>Object.values(t)),zP=S(p.createSelector([Pt,(t,s)=>s],(t,s)=>{const e={};for(const[n,a]of Object.entries(t))a.asset_procedure_type===s&&(e[n]=a);return At(e)})),BP=S(O([_s,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_procedure_type===s)))),vr=S(O([_s,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),Vr=S(O([Pt,(t,s)=>s],(t,s)=>{if(!t[s])return T([]);const a=da(s,Object.values(t)).all().map(({model:c})=>c);return T(a)})),ne=w(t=>t.uuid),zr={instances:{}},Ms=p.createSlice({name:"assets",initialState:zr,extraReducers:t=>t.addMatcher(p.isAnyOf(M,$,E),s=>Object.assign(s,zr)),reducers:{initializeAssets:ne.initialize,addAsset:ne.addOne,addAssets:ne.addMany,setAsset:ne.setOne,setAssets:ne.setMany,updateAsset:ne.updateOne,updateAssets:ne.updateMany,deleteAsset:ne.deleteOne,deleteAssets:ne.deleteMany}}),{initializeAssets:Br,addAsset:jr,addAssets:Rs,updateAsset:qr,updateAssets:Dr,deleteAsset:Cr,deleteAssets:ws,setAsset:$r,setAssets:Ur}=Ms.actions,kr=t=>t.assetReducer.instances,Es=p.createSelector([kr],t=>T(Object.values(t))),vs=S(O([Es,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_type===s)))),Lr=t=>s=>s.assetReducer.instances[t],Nr=S(O([Es,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),jP=t=>s=>vs(t)(s).length,Gr=Ms.reducer,ae=w(t=>t.uuid),Hr={instances:{}},Vs=p.createSlice({name:"assetStageCompletions",initialState:Hr,extraReducers:t=>t.addMatcher(p.isAnyOf(M,$,E),s=>Object.assign(s,Hr)),reducers:{initializeAssetStageCompletions:ae.initialize,addAssetStageCompletion:ae.addOne,addAssetStageCompletions:ae.addMany,setAssetStageCompletion:ae.setOne,setAssetStageCompletions:ae.setMany,updateAssetStageCompletion:ae.updateOne,updateAssetStageCompletions:ae.updateMany,deleteAssetStageCompletion:ae.deleteOne,deleteAssetStageCompletions:ae.deleteMany}}),{initializeAssetStageCompletions:Kr,addAssetStageCompletion:Wr,addAssetStageCompletions:Yr,setAssetStageCompletion:Zr,setAssetStageCompletions:Jr,updateAssetStageCompletion:Xr,updateAssetStageCompletions:Qr,deleteAssetStageCompletion:xr,deleteAssetStageCompletions:eu}=Vs.actions,tu=Vs.reducer,su=t=>t.assetStageCompletionReducer.instances,iu=p.createSelector([su],t=>Object.values(t)),nu=t=>s=>s.assetStageCompletionReducer.instances[t],au=S(O([iu,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),ce=w(t=>t.uuid),cu={instances:{}},zs=p.createSlice({name:"assetStages",initialState:cu,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,cu)),reducers:{initializeAssetStages:ce.initialize,setAssetStage:ce.setOne,setAssetStages:ce.setMany,addAssetStage:ce.addOne,addAssetStages:ce.addMany,updateAssetStage:ce.updateOne,updateAssetStages:ce.updateMany,deleteAssetStage:ce.deleteOne,deleteAssetStages:ce.deleteMany}}),{initializeAssetStages:du,setAssetStage:ru,setAssetStages:uu,addAssetStage:lu,addAssetStages:ou,updateAssetStage:hu,updateAssetStages:mu,deleteAssetStage:yu,deleteAssetStages:pu}=zs.actions,Au=zs.reducer,Bs=t=>t.assetStageReducer.instances,fu=t=>s=>s.assetStageReducer.instances[t],js=p.createSelector([Bs],t=>Object.values(t)),qP=S(p.createSelector([Bs,(t,s)=>s],(t,s)=>{const e={};for(const[n,a]of Object.entries(t))a.asset_procedure_type===s&&(e[n]=a);return At(e)})),DP=S(O([js,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_procedure_type===s)))),Su=S(O([js,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),de=w(t=>t.uuid),Tu={instances:{}},qs=p.createSlice({name:"assetTypeAttachments",initialState:Tu,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,Tu)),reducers:{initializeAssetTypeAttachments:de.initialize,addAssetTypeAttachment:de.addOne,addAssetTypeAttachments:de.addMany,setAssetTypeAttachment:de.setOne,setAssetTypeAttachments:de.setMany,updateAssetTypeAttachment:de.updateOne,updateAssetTypeAttachments:de.updateMany,deleteAssetTypeAttachment:de.deleteOne,deleteAssetTypeAttachments:de.deleteMany}}),{initializeAssetTypeAttachments:Iu,addAssetTypeAttachment:Ou,addAssetTypeAttachments:Ds,setAssetTypeAttachment:Pu,setAssetTypeAttachments:Fu,updateAssetTypeAttachment:gu,updateAssetTypeAttachments:bu,deleteAssetTypeAttachment:_u,deleteAssetTypeAttachments:Cs}=qs.actions,Mu=t=>t.assetTypeAttachmentReducer.instances,$s=p.createSelector([Mu],t=>Object.values(t)),Ru=t=>s=>s.assetTypeAttachmentReducer.instances[t],wu=S(O([$s,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),Eu=S(O([$s,(t,s)=>s],(t,s)=>T(t.filter(({asset_type:e})=>s===e)))),vu=qs.reducer,re=w(t=>t.uuid),Vu={instances:{}},Us=p.createSlice({name:"assetTypeFieldsAttachments",initialState:Vu,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,Vu)),reducers:{initializeAssetTypeFieldsAttachments:re.initialize,addAssetTypeFieldsAttachment:re.addOne,addAssetTypeFieldsAttachments:re.addMany,setAssetTypeFieldsAttachment:re.setOne,setAssetTypeFieldsAttachments:re.setMany,updateAssetTypeFieldsAttachment:re.updateOne,updateAssetTypeFieldsAttachments:re.updateMany,deleteAssetTypeFieldsAttachment:re.deleteOne,deleteAssetTypeFieldsAttachments:re.deleteMany}}),{initializeAssetTypeFieldsAttachments:zu,addAssetTypeFieldsAttachment:Bu,addAssetTypeFieldsAttachments:ju,setAssetTypeFieldsAttachment:qu,setAssetTypeFieldsAttachments:Du,updateAssetTypeFieldsAttachment:Cu,updateAssetTypeFieldsAttachments:$u,deleteAssetTypeFieldsAttachment:Uu,deleteAssetTypeFieldsAttachments:ku}=Us.actions,Lu=t=>t.assetTypeFieldsAttachmentReducer.instances,ks=p.createSelector([Lu],t=>Object.values(t)),CP=S(O([ks,(t,s)=>s],(t,s)=>T(t.filter(e=>e.fields_revision===s)))),Nu=t=>s=>s.assetTypeFieldsAttachmentReducer.instances[t],Gu=S(O([ks,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),Hu=Us.reducer,ue=w(t=>t.uuid),Ku={instances:{}},Ls=p.createSlice({name:"assetTypeFields",initialState:Ku,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,Ku)),reducers:{initializeAssetTypeFields:ue.initialize,addAssetTypeFields:ue.addOne,addAssetTypeFieldsMany:ue.addMany,setAssetTypeFields:ue.setOne,setAssetTypeFieldsMany:ue.setMany,updateAssetTypeFields:ue.updateOne,updateAssetTypeFieldsMany:ue.updateMany,deleteAssetTypeFields:ue.deleteOne,deleteAssetTypeFieldsMany:ue.deleteMany}}),{initializeAssetTypeFields:Wu,addAssetTypeFields:Yu,addAssetTypeFieldsMany:Zu,setAssetTypeFields:Ju,setAssetTypeFieldsMany:Xu,updateAssetTypeFields:Qu,updateAssetTypeFieldsMany:xu,deleteAssetTypeFields:el,deleteAssetTypeFieldsMany:tl}=Ls.actions,sl=t=>t.assetTypeFieldsReducer.instances,ot=p.createSelector([sl],t=>Object.values(t)),$P=S(O([ot,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_type===s)))),UP=S(p.createSelector([ot,(t,s)=>s],(t,s)=>t.filter(e=>e.asset_type===s).sort((e,n)=>e.submitted_at>n.submitted_at?-1:1)[0])),il=t=>s=>s.assetTypeFieldsReducer.instances[t],nl=S(O([ot,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),al=Ls.reducer,le=w(t=>t.uuid),cl={instances:{}},Ns=p.createSlice({name:"assetTypeFieldValuesAttachments",initialState:cl,extraReducers:t=>t.addMatcher(p.isAnyOf(M,$,E),s=>Object.assign(s,cl)),reducers:{initializeAssetTypeFieldValuesAttachments:le.initialize,addAssetTypeFieldValuesAttachment:le.addOne,addAssetTypeFieldValuesAttachments:le.addMany,setAssetTypeFieldValuesAttachment:le.setOne,setAssetTypeFieldValuesAttachments:le.setMany,updateAssetTypeFieldValuesAttachment:le.updateOne,updateAssetTypeFieldValuesAttachments:le.updateMany,deleteAssetTypeFieldValuesAttachment:le.deleteOne,deleteAssetTypeFieldValuesAttachments:le.deleteMany}}),{initializeAssetTypeFieldValuesAttachments:dl,addAssetTypeFieldValuesAttachment:rl,addAssetTypeFieldValuesAttachments:Gs,setAssetTypeFieldValuesAttachment:ul,setAssetTypeFieldValuesAttachments:ll,updateAssetTypeFieldValuesAttachment:ol,updateAssetTypeFieldValuesAttachments:hl,deleteAssetTypeFieldValuesAttachment:ml,deleteAssetTypeFieldValuesAttachments:Hs}=Ns.actions,yl=t=>t.assetTypeFieldValuesAttachmentReducer.instances,Ks=p.createSelector([yl],t=>Object.values(t)),pl=t=>s=>s.assetTypeFieldValuesAttachmentReducer.instances[t],Al=S(O([Ks,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),fl=S(O([Ks,(t,s)=>s],(t,s)=>T(t.filter(e=>e.field_values===s)))),Sl=Ns.reducer,oe=w(t=>t.uuid),Tl={instances:{}},Ws=p.createSlice({name:"assetTypeFieldValues",initialState:Tl,extraReducers:t=>t.addMatcher(p.isAnyOf(M,$,E),s=>Object.assign(s,Tl)),reducers:{initializeAssetTypeFieldValues:oe.initialize,addAssetTypeFieldValues:oe.addOne,addAssetTypeFieldValuesMany:oe.addMany,setAssetTypeFieldValues:oe.setOne,setAssetTypeFieldValuesMany:oe.setMany,updateAssetTypeFieldValues:oe.updateOne,updateAssetTypeFieldValuesMany:oe.updateMany,deleteAssetTypeFieldValues:oe.deleteOne,deleteAssetTypeFieldValuesMany:oe.deleteMany}}),{initializeAssetTypeFieldValues:Il,addAssetTypeFieldValues:Ol,addAssetTypeFieldValuesMany:Pl,setAssetTypeFieldValues:Fl,setAssetTypeFieldValuesMany:gl,updateAssetTypeFieldValues:bl,updateAssetTypeFieldValuesMany:_l,deleteAssetTypeFieldValues:Ml,deleteAssetTypeFieldValuesMany:Rl}=Ws.actions,wl=t=>t.assetTypeFieldValuesReducer.instances,Ft=p.createSelector([wl],t=>Object.values(t)),kP=S(O([Ft,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset===s)))),LP=S(O([ot,Ft,(t,s)=>s],(t,s,e)=>{const n=new Set(t.filter(a=>a.asset_type===e).map(a=>a.uuid));return T(s.filter(a=>n.has(a.fields_revision)))})),El=t=>s=>s.assetTypeFieldValuesReducer.instances[t],vl=S(O([Ft,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),Vl=Ws.reducer,he=w(t=>t.uuid),zl={instances:{}},Ys=p.createSlice({name:"assetTypeIdentifiers",initialState:zl,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,zl)),reducers:{initializeAssetTypeIdentifiers:he.initialize,addAssetTypeIdentifier:he.addOne,addAssetTypeIdentifiers:he.addMany,setAssetTypeIdentifier:he.setOne,setAssetTypeIdentifiers:he.setMany,updateAssetTypeIdentifier:he.updateOne,updateAssetTypeIdentifiers:he.updateMany,deleteAssetTypeIdentifier:he.deleteOne,deleteAssetTypeIdentifiers:he.deleteMany}}),{initializeAssetTypeIdentifiers:Bl,addAssetTypeIdentifier:jl,addAssetTypeIdentifiers:ql,setAssetTypeIdentifier:Dl,setAssetTypeIdentifiers:Cl,updateAssetTypeIdentifier:$l,updateAssetTypeIdentifiers:Ul,deleteAssetTypeIdentifier:kl,deleteAssetTypeIdentifiers:Ll}=Ys.actions,Nl=t=>t.assetTypeIdentifierReducer.instances,Zs=p.createSelector([Nl],t=>Object.values(t)),Gl=t=>s=>s.assetTypeIdentifierReducer.instances[t],Hl=S(O([Zs,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),NP=S(O([Zs,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_type===s)))),Kl=Ys.reducer,me=w(t=>t.uuid),Wl={instances:{}},Js=p.createSlice({name:"assetTypeIdentifierValues",initialState:Wl,extraReducers:t=>t.addMatcher(p.isAnyOf(M,$,E),s=>Object.assign(s,Wl)),reducers:{initializeAssetTypeIdentifierValues:me.initialize,addAssetTypeIdentifierValue:me.addOne,addAssetTypeIdentifierValues:me.addMany,setAssetTypeIdentifierValue:me.setOne,setAssetTypeIdentifierValues:me.setMany,updateAssetTypeIdentifierValue:me.updateOne,updateAssetTypeIdentifierValues:me.updateMany,deleteAssetTypeIdentifierValue:me.deleteOne,deleteAssetTypeIdentifierValues:me.deleteMany}}),{initializeAssetTypeIdentifierValues:Yl,addAssetTypeIdentifierValue:Zl,addAssetTypeIdentifierValues:Jl,setAssetTypeIdentifierValue:Xl,setAssetTypeIdentifierValues:Ql,updateAssetTypeIdentifierValue:xl,updateAssetTypeIdentifierValues:eo,deleteAssetTypeIdentifierValue:to,deleteAssetTypeIdentifierValues:so}=Js.actions,io=t=>t.assetTypeIdentifierValueReducer.instances,gt=p.createSelector([io],t=>Object.values(t)),no=t=>s=>s.assetTypeIdentifierValueReducer.instances[t],ao=S(O([gt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),GP=S(O([gt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset===s)))),HP=S(O([gt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_type_identifier===s)))),co=Js.reducer,ye=w(t=>t.uuid),ro={instances:{}},Xs=p.createSlice({name:"assetTypes",initialState:ro,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,ro)),reducers:{initializeAssetTypes:ye.initialize,setAssetType:ye.setOne,setAssetTypes:ye.setMany,addAssetType:ye.addOne,addAssetTypes:ye.addMany,updateAssetType:ye.updateOne,updateAssetTypes:ye.updateMany,deleteAssetType:ye.deleteOne,deleteAssetTypes:ye.deleteMany}}),{initializeAssetTypes:uo,setAssetType:lo,setAssetTypes:oo,addAssetType:ho,addAssetTypes:mo,updateAssetType:yo,updateAssetTypes:po,deleteAssetType:Ao,deleteAssetTypes:fo}=Xs.actions,So=t=>t.assetTypeReducer.instances,Qs=p.createSelector([So],t=>Object.values(t)),To=t=>s=>s.assetTypeReducer.instances[t],Io=S(O([Qs,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),KP=S(O([Qs,(t,s)=>s],(t,s)=>T(t.filter(e=>e.organization===s)))),Oo=Xs.reducer,pe=w(t=>t.uuid),Po={instances:{}},xs=p.createSlice({name:"assetTypeStatuses",initialState:Po,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,Po)),reducers:{initializeAssetTypeStatuses:pe.initialize,addAssetTypeStatus:pe.addOne,addAssetTypeStatuses:pe.addMany,setAssetTypeStatus:pe.setOne,setAssetTypeStatuses:pe.setMany,updateAssetTypeStatus:pe.updateOne,updateAssetTypeStatuses:pe.updateMany,deleteAssetTypeStatus:pe.deleteOne,deleteAssetTypeStatuses:pe.deleteMany}}),{initializeAssetTypeStatuses:Fo,addAssetTypeStatus:go,addAssetTypeStatuses:bo,setAssetTypeStatus:_o,setAssetTypeStatuses:Mo,updateAssetTypeStatus:Ro,updateAssetTypeStatuses:wo,deleteAssetTypeStatus:Eo,deleteAssetTypeStatuses:vo}=xs.actions,Vo=t=>t.assetTypeStatusReducer.instances,ei=p.createSelector([Vo],t=>T(Object.values(t).toSorted(ra))),zo=t=>s=>s.assetTypeStatusReducer.instances[t],Bo=S(O([ei,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),WP=S(O([ei,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_type===s)))),jo=xs.reducer,qo={accessToken:"",refreshToken:"",isLoggedIn:!1},bt=p.createSlice({name:"auth",initialState:qo,extraReducers:t=>t.addCase(M,s=>Object.assign(s,qo)),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||bt.caseReducers.clearTokens(t),t.isLoggedIn=s.payload}}}),{setTokens:YP,clearTokens:ZP,setLoggedIn:Do}=bt.actions,JP=t=>t.authReducer.accessToken,XP=t=>t.authReducer.isLoggedIn,Co=bt.reducer,Ae=w(t=>t.uuid),$o={instances:{}},ti=p.createSlice({name:"categories",initialState:$o,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,$o)),reducers:{initializeCategories:Ae.initialize,addCategory:Ae.addOne,addCategories:Ae.addMany,setCategory:Ae.setOne,setCategories:Ae.setMany,updateCategory:Ae.updateOne,updateCategories:Ae.updateMany,deleteCategory:Ae.deleteOne,deleteCategories:Ae.deleteMany}}),{initializeCategories:Uo,addCategory:ko,addCategories:Lo,setCategory:No,setCategories:Go,updateCategory:Ho,updateCategories:Ko,deleteCategory:Wo,deleteCategories:Yo}=ti.actions,Zo=t=>t.categoryReducer.instances,si=p.createSelector([Zo],t=>Object.values(t)),ii=t=>s=>s.categoryReducer.instances[t],Jo=S(O([si,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),QP=S(O([si,(t,s)=>s],(t,s)=>T(t.filter(e=>e.project===s)))),Xo=ti.reducer,fe=w(t=>t.uuid),Qo={instances:{}},ni=p.createSlice({name:"documentAttachments",initialState:Qo,extraReducers:t=>t.addCase(M,s=>Object.assign(s,Qo)),reducers:{initializeDocumentAttachments:fe.initialize,addDocumentAttachment:fe.addOne,addDocumentAttachments:fe.addMany,setDocumentAttachment:fe.setOne,setDocumentAttachments:fe.setMany,updateDocumentAttachment:fe.updateOne,updateDocumentAttachments:fe.updateMany,deleteDocumentAttachment:fe.deleteOne,deleteDocumentAttachments:fe.deleteMany}}),{initializeDocumentAttachments:xo,addDocumentAttachment:eh,addDocumentAttachments:th,setDocumentAttachment:sh,setDocumentAttachments:ih,updateDocumentAttachment:nh,updateDocumentAttachments:ah,deleteDocumentAttachment:ch,deleteDocumentAttachments:dh}=ni.actions,rh=t=>t.documentAttachmentReducer.instances,ai=p.createSelector([rh],t=>Object.values(t)),uh=t=>s=>s.documentAttachmentReducer.instances[t],lh=S(O([ai,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),xP=S(O([ai,(t,s)=>s],(t,s)=>T(t.filter(({document:e})=>s===e)))),oh=ni.reducer,Se=w(({uuid:t})=>t),hh={instances:{}},ci=p.createSlice({name:"documents",initialState:hh,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>{Object.assign(s,hh)}),reducers:{initializeDocuments:Se.initialize,addDocument:Se.addOne,addDocuments:Se.addMany,setDocument:Se.setOne,setDocuments:Se.setMany,updateDocument:Se.updateOne,updateDocuments:Se.updateMany,deleteDocument:Se.deleteOne,deleteDocuments:Se.deleteMany}}),{initializeDocuments:mh,addDocument:yh,addDocuments:ph,setDocument:Ah,setDocuments:fh,updateDocument:Sh,updateDocuments:Th,deleteDocument:Ih,deleteDocuments:Oh}=ci.actions,Ph=ci.reducer,di=t=>t.documentsReducer.instances,_t=p.createSelector([di],t=>Object.values(t)),Fh=t=>s=>s.documentsReducer.instances[t],gh=S(O([_t,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),eF=S(O([_t,(t,s)=>s],(t,s)=>t.filter(e=>e.project===s))),tF=S(O([_t,(t,s)=>s],(t,s)=>t.filter(e=>e.organization===s))),bh=S(O([di,(t,s)=>s],(t,s)=>{if(!t[s])return T([]);const a=oa(s,Object.values(t)).all().map(({model:c})=>c);return T(a)})),Te=w(t=>t.uuid),_h={instances:{}},ri=p.createSlice({name:"emailDomains",initialState:_h,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,_h)),reducers:{initializeEmailDomains:Te.initialize,addEmailDomain:Te.addOne,addEmailDomains:Te.addMany,setEmailDomain:Te.setOne,setEmailDomains:Te.setMany,updateEmailDomain:Te.updateOne,updateEmailDomains:Te.updateMany,deleteEmailDomain:Te.deleteOne,deleteEmailDomains:Te.deleteMany}}),{initializeEmailDomains:Mh,addEmailDomain:Rh,addEmailDomains:wh,setEmailDomain:Eh,setEmailDomains:vh,updateEmailDomain:Vh,updateEmailDomains:zh,deleteEmailDomain:Bh,deleteEmailDomains:jh}=ri.actions,qh=t=>t.emailDomainsReducer.instances,ui=p.createSelector([qh],t=>Object.values(t)),Dh=t=>s=>s.emailDomainsReducer.instances[t],Ch=S(O([ui,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),sF=S(O([ui,(t,s)=>s],(t,s)=>T(t.filter(e=>e.organization===s)))),$h=ri.reducer,Uh={s3Urls:{}},kh=1e3*60*60,iF=kh*24*7,li=p.createSlice({name:"file",initialState:Uh,extraReducers:t=>t.addCase(M,s=>Object.assign(s,Uh)),reducers:{setUploadUrl:(t,s)=>{const{url:e,fields:n,sha1:a}=s.payload,c=new Date,r=new Date(c.getTime()+iF);t.s3Urls[a]={url:e,fields:n,exp:r.getTime()}}}}),{setUploadUrl:Lh}=li.actions,Nh=t=>s=>{const e=s.fileReducer.s3Urls[t];if(!e)return;const n=new Date().getTime();if(!((e.exp??n)-n<kh))return e},Gh=li.reducer,Ie=w(t=>t.uuid),Hh={instances:{}},oi=p.createSlice({name:"formIdentifiers",initialState:Hh,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,Hh)),reducers:{initializeFormIdentifiers:Ie.initialize,addFormIdentifier:Ie.addOne,addFormIdentifiers:Ie.addMany,setFormIdentifier:Ie.setOne,setFormIdentifiers:Ie.setMany,updateFormIdentifier:Ie.updateOne,updateFormIdentifiers:Ie.updateMany,deleteFormIdentifier:Ie.deleteOne,deleteFormIdentifiers:Ie.deleteMany}}),{initializeFormIdentifiers:Kh,addFormIdentifier:Wh,addFormIdentifiers:Yh,setFormIdentifier:Zh,setFormIdentifiers:Jh,updateFormIdentifier:Xh,updateFormIdentifiers:Qh,deleteFormIdentifier:xh,deleteFormIdentifiers:em}=oi.actions,tm=t=>t.formIdentifierReducer.instances,hi=p.createSelector([tm],t=>Object.values(t)),sm=t=>s=>s.formIdentifierReducer.instances[t],im=S(O([hi,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),nF=S(O([hi,(t,s)=>s],(t,s)=>T(t.filter(e=>e.form===s)))),nm=oi.reducer,Oe=w(t=>t.uuid),am={instances:{}},mi=p.createSlice({name:"formIdentifierValues",initialState:am,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,am)),reducers:{initializeFormIdentifierValues:Oe.initialize,addFormIdentifierValue:Oe.addOne,addFormIdentifierValues:Oe.addMany,setFormIdentifierValue:Oe.setOne,setFormIdentifierValues:Oe.setMany,updateFormIdentifierValue:Oe.updateOne,updateFormIdentifierValues:Oe.updateMany,deleteFormIdentifierValue:Oe.deleteOne,deleteFormIdentifierValues:Oe.deleteMany}}),{initializeFormIdentifierValues:cm,addFormIdentifierValue:dm,addFormIdentifierValues:rm,setFormIdentifierValue:um,setFormIdentifierValues:lm,updateFormIdentifierValue:om,updateFormIdentifierValues:hm,deleteFormIdentifierValue:mm,deleteFormIdentifierValues:ym}=mi.actions,pm=t=>t.formIdentifierValueReducer.instances,Mt=p.createSelector([pm],t=>Object.values(t)),Am=t=>s=>s.formIdentifierValueReducer.instances[t],fm=S(O([Mt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),aF=S(O([Mt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.form_submission===s)))),cF=S(O([Mt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.form_identifier===s)))),Sm=mi.reducer,Pe=w(t=>t.uuid),Tm={instances:{}},yi=p.createSlice({name:"formRevisionAttachments",initialState:Tm,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,Tm)),reducers:{initializeFormRevisionAttachments:Pe.initialize,addFormRevisionAttachment:Pe.addOne,addFormRevisionAttachments:Pe.addMany,setFormRevisionAttachment:Pe.setOne,setFormRevisionAttachments:Pe.setMany,updateFormRevisionAttachment:Pe.updateOne,updateFormRevisionAttachments:Pe.updateMany,deleteFormRevisionAttachment:Pe.deleteOne,deleteFormRevisionAttachments:Pe.deleteMany}}),{initializeFormRevisionAttachments:Im,addFormRevisionAttachment:Om,addFormRevisionAttachments:Pm,setFormRevisionAttachment:Fm,setFormRevisionAttachments:gm,updateFormRevisionAttachment:bm,updateFormRevisionAttachments:_m,deleteFormRevisionAttachment:Mm,deleteFormRevisionAttachments:Rm}=yi.actions,Rt=t=>t.formRevisionAttachmentReducer.instances,wm=p.createSelector([Rt],t=>Object.values(t)),Em=S(p.createSelector([Rt,(t,s)=>s],(t,s)=>t[s])),vm=S(O([wm,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),dF=S(O([Rt,(t,s)=>s],(t,s)=>T(Object.values(t).filter(e=>e.form_revision===s)))),Vm=yi.reducer,Fe=w(t=>t.uuid),zm={instances:{}},pi=p.createSlice({name:"formRevisions",initialState:zm,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,zm)),reducers:{initializeFormRevisions:Fe.initialize,addFormRevision:Fe.addOne,addFormRevisions:Fe.addMany,setFormRevision:Fe.setOne,setFormRevisions:Fe.setMany,updateFormRevision:Fe.updateOne,updateFormRevisions:Fe.updateMany,deleteFormRevision:Fe.deleteOne,deleteFormRevisions:Fe.deleteMany}}),{initializeFormRevisions:Bm,addFormRevision:Ai,addFormRevisions:fi,setFormRevision:jm,setFormRevisions:qm,updateFormRevision:Dm,updateFormRevisions:Cm,deleteFormRevision:Si,deleteFormRevisions:Ti}=pi.actions,Ii=t=>t.formRevisionReducer.instances,wt=p.createSelector([Ii],t=>Object.values(t)),$m=t=>s=>s.formRevisionReducer.instances[t],Um=S(O([wt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),rF=S(p.createSelector([wt,(t,s)=>s],(t,s)=>t.filter(e=>e.form===s).sort((e,n)=>e.submitted_at>n.submitted_at?-1:1)[0])),km=S(O([wt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.form===s)))),Lm=pi.reducer,ge=w(t=>t.uuid),Nm={instances:{}},Oi=p.createSlice({name:"forms",initialState:Nm,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,Nm)),reducers:{initializeForms:ge.initialize,addForm:ge.addOne,addForms:ge.addMany,setForm:ge.setOne,setForms:ge.setMany,updateForm:ge.updateOne,updateForms:ge.updateMany,deleteForm:ge.deleteOne,deleteForms:ge.deleteMany}}),{initializeForms:Gm,addForm:Hm,addForms:Km,setForm:Wm,setForms:Ym,updateForm:Zm,updateForms:Jm,deleteForm:Xm,deleteForms:Qm}=Oi.actions,xm=Oi.reducer,ey=t=>t.formReducer.instances,Pi=p.createSelector([ey],t=>Object.values(t)),ty=t=>s=>s.formReducer.instances[t],sy=S(O([Pi,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),uF=S(O([Pi,(t,s)=>s],(t,s)=>T(t.filter(e=>e.organization===s)))),be=w(t=>t.uuid),iy={instances:{}},Fi=p.createSlice({name:"formSubmissionAttachments",initialState:iy,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,iy)),reducers:{initializeFormSubmissionAttachments:be.initialize,addFormSubmissionAttachment:be.addOne,addFormSubmissionAttachments:be.addMany,setFormSubmissionAttachment:be.setOne,setFormSubmissionAttachments:be.setMany,updateFormSubmissionAttachment:be.updateOne,updateFormSubmissionAttachments:be.updateMany,deleteFormSubmissionAttachment:be.deleteOne,deleteFormSubmissionAttachments:be.deleteMany}}),{initializeFormSubmissionAttachments:ny,addFormSubmissionAttachment:ay,addFormSubmissionAttachments:gi,setFormSubmissionAttachment:cy,setFormSubmissionAttachments:dy,updateFormSubmissionAttachment:ry,updateFormSubmissionAttachments:uy,deleteFormSubmissionAttachment:ly,deleteFormSubmissionAttachments:bi}=Fi.actions,_i=t=>t.formSubmissionAttachmentReducer.instances,Mi=p.createSelector([_i],t=>Object.values(t)),oy=S(p.createSelector([_i,(t,s)=>s],(t,s)=>t[s])),Ri=S(O([Mi,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(n=>e.has(n.uuid)))})),hy=Ri,my=S(O([Mi,(t,s)=>s],(t,s)=>T(t.filter(e=>e.form_submission===s)))),yy=Fi.reducer,_e=w(t=>t.uuid),py={instances:{}},wi=p.createSlice({name:"formSubmissions",initialState:py,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,py)),reducers:{initializeFormSubmissions:_e.initialize,setFormSubmission:_e.setOne,setFormSubmissions:_e.setMany,addFormSubmission:_e.addOne,addFormSubmissions:_e.addMany,updateFormSubmission:_e.updateOne,updateFormSubmissions:_e.updateMany,deleteFormSubmission:_e.deleteOne,deleteFormSubmissions:_e.deleteMany}}),{initializeFormSubmissions:Ay,setFormSubmission:fy,setFormSubmissions:Sy,addFormSubmission:Ty,addFormSubmissions:Ei,updateFormSubmission:Iy,updateFormSubmissions:Oy,deleteFormSubmission:Py,deleteFormSubmissions:vi}=wi.actions,Vi=t=>t.formSubmissionReducer.instances,Fy=p.createSelector([Vi],t=>Object.values(t)),gy=t=>s=>s.formSubmissionReducer.instances[t],by=S(O([Fy,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),_y=S(O([Vi,Ii,(t,s)=>s],(t,s,e)=>{const n=new Set;for(const a of Object.values(s))a.form===e&&n.add(a.uuid);return Object.values(t).filter(a=>n.has(a.form_revision))})),My=wi.reducer,Me=w(t=>t.uuid),Ry={instances:{}},zi=p.createSlice({name:"geoImages",initialState:Ry,extraReducers:t=>t.addMatcher(p.isAnyOf(M,$,E),s=>Object.assign(s,Ry)),reducers:{initializeGeoImages:Me.initialize,setGeoImage:Me.setOne,setGeoImages:Me.setMany,addGeoImage:Me.addOne,addGeoImages:Me.addMany,updateGeoImage:Me.updateOne,updateGeoImages:Me.updateMany,deleteGeoImage:Me.deleteOne,deleteGeoImages:Me.deleteMany}}),{initializeGeoImages:wy,setGeoImage:Ey,setGeoImages:vy,addGeoImage:Vy,addGeoImages:zy,updateGeoImage:By,updateGeoImages:jy,deleteGeoImage:qy,deleteGeoImages:Dy}=zi.actions,Cy=t=>t.geoImageReducer.instances,Bi=p.createSelector([Cy],t=>Object.values(t)),$y=t=>s=>s.geoImageReducer.instances[t],Uy=S(O([Bi,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),lF=S(O([Bi,(t,s)=>s],(t,s)=>T(t.filter(e=>e.project===s)))),ky=zi.reducer,Re=w(t=>t.uuid),Ly={instances:{}},ji=p.createSlice({name:"issueAssociations",initialState:Ly,extraReducers:t=>t.addMatcher(p.isAnyOf(M,$,E),s=>Object.assign(s,Ly)),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:Ny,setIssueAssociations:Gy,setIssueAssociation:Hy,updateIssueAssociation:Ky,updateIssueAssociations:Wy,addIssueAssociation:Yy,addIssueAssociations:Et,deleteIssueAssociation:Zy,deleteIssueAssociations:vt}=ji.actions,ht=t=>t.issueAssociationReducer.instances,Jy=p.createSelector([ht],t=>Object.values(t)),Xy=t=>s=>s.issueAssociationReducer.instances[t],Qy=S(O([Jy,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),xy=S(O([ht,(t,s)=>s],(t,s)=>T(Object.values(t).filter(e=>e.associated_issue===s)))),ep=S(O([ht,(t,s)=>s],(t,s)=>T(Object.values(t).filter(e=>e.issue===s)))),tp=S(O([ht,(t,s)=>s],(t,s)=>T(Object.values(t).filter(e=>e.asset===s)))),sp=ji.reducer,we=w(t=>t.uuid),ip={instances:{}},qi=p.createSlice({name:"issueAttachments",initialState:ip,extraReducers:t=>t.addMatcher(p.isAnyOf(M,$,E),s=>Object.assign(s,ip)),reducers:{initializeIssueAttachments:we.initialize,addIssueAttachment:we.addOne,addIssueAttachments:we.addMany,setIssueAttachment:we.setOne,setIssueAttachments:we.setMany,updateIssueAttachment:we.updateOne,updateIssueAttachments:we.updateMany,deleteIssueAttachment:we.deleteOne,deleteIssueAttachments:we.deleteMany}}),{initializeIssueAttachments:np,addIssueAttachment:ap,addIssueAttachments:Di,setIssueAttachment:cp,setIssueAttachments:dp,updateIssueAttachment:rp,updateIssueAttachments:up,deleteIssueAttachment:lp,deleteIssueAttachments:Ci}=qi.actions,op=t=>t.issueAttachmentReducer.instances,$i=p.createSelector([op],t=>Object.values(t)),hp=S(O([$i,(t,s)=>s],(t,s)=>T(t.filter(({issue:e})=>s===e)))),mp=t=>s=>s.issueAttachmentReducer.instances[t],yp=S(O([$i,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),pp=qi.reducer,Ee=w(t=>t.uuid),Ap={instances:{}},Ui=p.createSlice({name:"issueCommentAttachments",initialState:Ap,extraReducers:t=>t.addMatcher(p.isAnyOf(M,$,E),s=>Object.assign(s,Ap)),reducers:{initializeIssueCommentAttachments:Ee.initialize,addIssueCommentAttachment:Ee.addOne,addIssueCommentAttachments:Ee.addMany,setIssueCommentAttachment:Ee.setOne,setIssueCommentAttachments:Ee.setMany,updateIssueCommentAttachment:Ee.updateOne,updateIssueCommentAttachments:Ee.updateMany,deleteIssueCommentAttachment:Ee.deleteOne,deleteIssueCommentAttachments:Ee.deleteMany}}),{initializeIssueCommentAttachments:fp,addIssueCommentAttachment:Sp,addIssueCommentAttachments:Tp,setIssueCommentAttachment:Ip,setIssueCommentAttachments:Op,updateIssueCommentAttachment:Pp,updateIssueCommentAttachments:Fp,deleteIssueCommentAttachment:gp,deleteIssueCommentAttachments:bp}=Ui.actions,_p=t=>t.issueCommentAttachmentReducer.instances,ki=p.createSelector([_p],t=>Object.values(t)),Mp=t=>s=>s.issueCommentAttachmentReducer.instances[t],Rp=S(O([ki,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),oF=S(O([ki,(t,s)=>s],(t,s)=>T(t.filter(({issue_comment:e})=>s===e)))),wp=Ui.reducer,ve=w(t=>t.uuid),Ep={instances:{}},Li=p.createSlice({name:"issueComments",initialState:Ep,extraReducers:t=>t.addMatcher(p.isAnyOf(M,$,E),s=>Object.assign(s,Ep)),reducers:{initializeIssueComments:ve.initialize,addIssueComment:ve.addOne,addIssueComments:ve.addMany,setIssueComment:ve.setOne,setIssueComments:ve.setMany,updateIssueComment:ve.updateOne,updateIssueComments:ve.updateMany,deleteIssueComment:ve.deleteOne,deleteIssueComments:ve.deleteMany}}),{initializeIssueComments:vp,addIssueComment:Vp,addIssueComments:zp,setIssueComment:Bp,setIssueComments:jp,updateIssueComment:qp,updateIssueComments:Dp,deleteIssueComment:Cp,deleteIssueComments:$p}=Li.actions,Ni=t=>t.issueCommentReducer.instances,Up=t=>s=>s.issueCommentReducer.instances[t],kp=S(O([Ni,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(Object.values(t).filter(({uuid:n})=>e.has(n)))})),hF=S(O([Ni,(t,s)=>s],(t,s)=>T(Object.values(t).filter(e=>e.issue===s)))),Lp=Li.reducer,Ve=w(t=>t.uuid),Np={instances:{}},Gi=p.createSlice({name:"issues",initialState:Np,extraReducers:t=>t.addMatcher(p.isAnyOf(M,$,E),s=>Object.assign(s,Np)),reducers:{initializeIssues:Ve.initialize,addIssue:Ve.addOne,addIssues:Ve.addMany,setIssue:Ve.setOne,setIssues:Ve.setMany,updateIssue:Ve.updateOne,updateIssues:Ve.updateMany,deleteIssue:Ve.deleteOne,deleteIssues:Ve.deleteMany}}),{initializeIssues:Gp,addIssue:Hp,addIssues:Hi,setIssue:Kp,setIssues:Wp,updateIssue:Yp,updateIssues:Zp,deleteIssue:Jp,deleteIssues:Ki}=Gi.actions,Xp=t=>t.issueReducer.instances,Vt=p.createSelector([Xp],t=>Object.values(t)),Qp=t=>s=>s.issueReducer.instances[t],xp=S(O([Vt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),mF=S(O([Vt,(t,s)=>s],(t,s)=>t.filter(e=>e.project===s))),eA=S(O([Vt,(t,s)=>s],(t,s)=>t.filter(e=>e.issue_type===s))),tA=Gi.reducer,ze=w(t=>t.uuid),sA={instances:{}},Wi=p.createSlice({name:"issueTypeAttachments",initialState:sA,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,sA)),reducers:{initializeIssueTypeAttachments:ze.initialize,addIssueTypeAttachment:ze.addOne,addIssueTypeAttachments:ze.addMany,setIssueTypeAttachment:ze.setOne,setIssueTypeAttachments:ze.setMany,updateIssueTypeAttachment:ze.updateOne,updateIssueTypeAttachments:ze.updateMany,deleteIssueTypeAttachment:ze.deleteOne,deleteIssueTypeAttachments:ze.deleteMany}}),{initializeIssueTypeAttachments:iA,addIssueTypeAttachment:nA,addIssueTypeAttachments:aA,setIssueTypeAttachment:cA,setIssueTypeAttachments:dA,updateIssueTypeAttachment:rA,updateIssueTypeAttachments:uA,deleteIssueTypeAttachment:lA,deleteIssueTypeAttachments:oA}=Wi.actions,hA=t=>t.issueTypeAttachmentReducer.instances,Yi=p.createSelector([hA],t=>Object.values(t)),mA=t=>s=>s.issueTypeAttachmentReducer.instances[t],yA=S(O([Yi,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),yF=S(O([Yi,(t,s)=>s],(t,s)=>T(t.filter(({issue_type:e})=>s===e)))),pA=Wi.reducer,Be=w(t=>t.uuid),AA={instances:{}},Zi=p.createSlice({name:"issueTypeFieldsAttachments",initialState:AA,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,AA)),reducers:{initializeIssueTypeFieldsAttachments:Be.initialize,addIssueTypeFieldsAttachment:Be.addOne,addIssueTypeFieldsAttachments:Be.addMany,setIssueTypeFieldsAttachment:Be.setOne,setIssueTypeFieldsAttachments:Be.setMany,updateIssueTypeFieldsAttachment:Be.updateOne,updateIssueTypeFieldsAttachments:Be.updateMany,deleteIssueTypeFieldsAttachment:Be.deleteOne,deleteIssueTypeFieldsAttachments:Be.deleteMany}}),{initializeIssueTypeFieldsAttachments:fA,addIssueTypeFieldsAttachment:SA,addIssueTypeFieldsAttachments:TA,setIssueTypeFieldsAttachment:IA,setIssueTypeFieldsAttachments:OA,updateIssueTypeFieldsAttachment:PA,updateIssueTypeFieldsAttachments:FA,deleteIssueTypeFieldsAttachment:gA,deleteIssueTypeFieldsAttachments:bA}=Zi.actions,_A=t=>t.issueTypeFieldsAttachmentReducer.instances,Ji=p.createSelector([_A],t=>Object.values(t)),pF=S(O([Ji,(t,s)=>s],(t,s)=>T(t.filter(e=>e.fields_revision===s)))),MA=t=>s=>s.issueTypeFieldsAttachmentReducer.instances[t],RA=S(O([Ji,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),wA=Zi.reducer,je=w(t=>t.uuid),EA={instances:{}},Xi=p.createSlice({name:"issueTypeFieldValues",initialState:EA,extraReducers:t=>t.addMatcher(p.isAnyOf(M,$,E),s=>Object.assign(s,EA)),reducers:{initializeIssueTypeFieldValues:je.initialize,addIssueTypeFieldValues:je.addOne,addIssueTypeFieldValuesMany:je.addMany,setIssueTypeFieldValues:je.setOne,setIssueTypeFieldValuesMany:je.setMany,updateIssueTypeFieldValues:je.updateOne,updateIssueTypeFieldValuesMany:je.updateMany,deleteIssueTypeFieldValues:je.deleteOne,deleteIssueTypeFieldValuesMany:je.deleteMany}}),{initializeIssueTypeFieldValues:vA,addIssueTypeFieldValues:VA,addIssueTypeFieldValuesMany:zA,setIssueTypeFieldValues:BA,setIssueTypeFieldValuesMany:jA,updateIssueTypeFieldValues:qA,updateIssueTypeFieldValuesMany:DA,deleteIssueTypeFieldValues:CA,deleteIssueTypeFieldValuesMany:$A}=Xi.actions,UA=t=>t.issueTypeFieldValuesReducer.instances,zt=p.createSelector([UA],t=>Object.values(t)),AF=S(O([zt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.issue===s)))),kA=t=>s=>s.issueTypeFieldValuesReducer.instances[t],LA=S(O([zt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),NA=Xi.reducer,qe=w(t=>t.uuid),GA={instances:{}},Qi=p.createSlice({name:"issueTypeFields",initialState:GA,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,GA)),reducers:{initializeIssueTypeFields:qe.initialize,addIssueTypeFields:qe.addOne,addIssueTypeFieldsMany:qe.addMany,setIssueTypeFields:qe.setOne,setIssueTypeFieldsMany:qe.setMany,updateIssueTypeFields:qe.updateOne,updateIssueTypeFieldsMany:qe.updateMany,deleteIssueTypeFields:qe.deleteOne,deleteIssueTypeFieldsMany:qe.deleteMany}}),{initializeIssueTypeFields:HA,addIssueTypeFields:KA,addIssueTypeFieldsMany:WA,setIssueTypeFields:YA,setIssueTypeFieldsMany:ZA,updateIssueTypeFields:JA,updateIssueTypeFieldsMany:XA,deleteIssueTypeFields:QA,deleteIssueTypeFieldsMany:xA}=Qi.actions,ef=t=>t.issueTypeFieldsReducer.instances,mt=p.createSelector([ef],t=>Object.values(t)),fF=S(O([mt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.issue_type===s)))),SF=S(p.createSelector([mt,(t,s)=>s],(t,s)=>t.filter(e=>e.issue_type===s).sort((e,n)=>e.submitted_at>n.submitted_at?-1:1)[0])),TF=S(O([mt,zt,(t,s)=>s],(t,s,e)=>{const n=new Set(t.filter(a=>a.issue_type===e).map(a=>a.uuid));return T(s.filter(a=>n.has(a.fields_revision)))})),tf=t=>s=>s.issueTypeFieldsReducer.instances[t],sf=S(O([mt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),nf=Qi.reducer,De=w(t=>t.uuid),af={instances:{}},xi=p.createSlice({name:"issueTypeFieldValuesAttachments",initialState:af,extraReducers:t=>t.addMatcher(p.isAnyOf(M,$,E),s=>Object.assign(s,af)),reducers:{initializeIssueTypeFieldValuesAttachments:De.initialize,addIssueTypeFieldValuesAttachment:De.addOne,addIssueTypeFieldValuesAttachments:De.addMany,setIssueTypeFieldValuesAttachment:De.setOne,setIssueTypeFieldValuesAttachments:De.setMany,updateIssueTypeFieldValuesAttachment:De.updateOne,updateIssueTypeFieldValuesAttachments:De.updateMany,deleteIssueTypeFieldValuesAttachment:De.deleteOne,deleteIssueTypeFieldValuesAttachments:De.deleteMany}}),{initializeIssueTypeFieldValuesAttachments:cf,addIssueTypeFieldValuesAttachment:df,addIssueTypeFieldValuesAttachments:en,setIssueTypeFieldValuesAttachment:rf,setIssueTypeFieldValuesAttachments:uf,updateIssueTypeFieldValuesAttachment:lf,updateIssueTypeFieldValuesAttachments:of,deleteIssueTypeFieldValuesAttachment:hf,deleteIssueTypeFieldValuesAttachments:tn}=xi.actions,mf=t=>t.issueTypeFieldValuesAttachmentReducer.instances,sn=p.createSelector([mf],t=>Object.values(t)),yf=t=>s=>s.issueTypeFieldValuesAttachmentReducer.instances[t],pf=S(O([sn,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),Af=S(O([sn,(t,s)=>s],(t,s)=>T(t.filter(e=>e.field_values===s)))),ff=xi.reducer,Ce=w(t=>t.uuid),Sf={instances:{}},nn=p.createSlice({name:"issueTypeIdentifiers",initialState:Sf,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,Sf)),reducers:{initializeIssueTypeIdentifiers:Ce.initialize,addIssueTypeIdentifier:Ce.addOne,addIssueTypeIdentifiers:Ce.addMany,setIssueTypeIdentifier:Ce.setOne,setIssueTypeIdentifiers:Ce.setMany,updateIssueTypeIdentifier:Ce.updateOne,updateIssueTypeIdentifiers:Ce.updateMany,deleteIssueTypeIdentifier:Ce.deleteOne,deleteIssueTypeIdentifiers:Ce.deleteMany}}),{initializeIssueTypeIdentifiers:Tf,addIssueTypeIdentifier:If,addIssueTypeIdentifiers:Of,setIssueTypeIdentifier:Pf,setIssueTypeIdentifiers:Ff,updateIssueTypeIdentifier:gf,updateIssueTypeIdentifiers:bf,deleteIssueTypeIdentifier:_f,deleteIssueTypeIdentifiers:Mf}=nn.actions,Rf=t=>t.issueTypeIdentifierReducer.instances,an=p.createSelector([Rf],t=>Object.values(t)),wf=t=>s=>s.issueTypeIdentifierReducer.instances[t],Ef=S(O([an,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),IF=S(O([an,(t,s)=>s],(t,s)=>T(t.filter(e=>e.issue_type===s)))),vf=nn.reducer,$e=w(t=>t.uuid),Vf={instances:{}},cn=p.createSlice({name:"issueTypeIdentifierValues",initialState:Vf,extraReducers:t=>t.addMatcher(p.isAnyOf(M,$,E),s=>Object.assign(s,Vf)),reducers:{initializeIssueTypeIdentifierValues:$e.initialize,addIssueTypeIdentifierValue:$e.addOne,addIssueTypeIdentifierValues:$e.addMany,setIssueTypeIdentifierValue:$e.setOne,setIssueTypeIdentifierValues:$e.setMany,updateIssueTypeIdentifierValue:$e.updateOne,updateIssueTypeIdentifierValues:$e.updateMany,deleteIssueTypeIdentifierValue:$e.deleteOne,deleteIssueTypeIdentifierValues:$e.deleteMany}}),{initializeIssueTypeIdentifierValues:zf,addIssueTypeIdentifierValue:Bf,addIssueTypeIdentifierValues:jf,setIssueTypeIdentifierValue:qf,setIssueTypeIdentifierValues:Df,updateIssueTypeIdentifierValue:Cf,updateIssueTypeIdentifierValues:$f,deleteIssueTypeIdentifierValue:Uf,deleteIssueTypeIdentifierValues:kf}=cn.actions,Lf=t=>t.issueTypeIdentifierValueReducer.instances,Bt=p.createSelector([Lf],t=>Object.values(t)),Nf=t=>s=>s.issueTypeIdentifierValueReducer.instances[t],Gf=S(O([Bt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),OF=S(O([Bt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.issue===s)))),PF=S(O([Bt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.issue_type_identifier===s)))),Hf=cn.reducer,Ue=w(t=>t.uuid),Kf={instances:{}},dn=p.createSlice({name:"issueTypes",initialState:Kf,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,Kf)),reducers:{initializeIssueTypes:Ue.initialize,addIssueType:Ue.addOne,addIssueTypes:Ue.addMany,setIssueType:Ue.setOne,setIssueTypes:Ue.setMany,updateIssueType:Ue.updateOne,updateIssueTypes:Ue.updateMany,deleteIssueType:Ue.deleteOne,deleteIssueTypes:Ue.deleteMany}}),{initializeIssueTypes:Wf,addIssueType:Yf,addIssueTypes:Zf,setIssueType:Jf,setIssueTypes:Xf,updateIssueType:Qf,updateIssueTypes:xf,deleteIssueType:eS,deleteIssueTypes:tS}=dn.actions,sS=t=>t.issueTypeReducer.instances,rn=p.createSelector(sS,t=>Object.values(t)),iS=t=>s=>s.issueTypeReducer.instances[t],nS=S(O([rn,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),FF=S(O([rn,(t,s)=>s],(t,s)=>T(t.filter(e=>e.organization===s)))),aS=dn.reducer,ke=w(t=>t.uuid),cS={instances:{}},un=p.createSlice({name:"issueTypeStatuses",initialState:cS,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,cS)),reducers:{initializeIssueTypeStatuses:ke.initialize,addIssueTypeStatus:ke.addOne,addIssueTypeStatuses:ke.addMany,setIssueTypeStatus:ke.setOne,setIssueTypeStatuses:ke.setMany,updateIssueTypeStatus:ke.updateOne,updateIssueTypeStatuses:ke.updateMany,deleteIssueTypeStatus:ke.deleteOne,deleteIssueTypeStatuses:ke.deleteMany}}),{initializeIssueTypeStatuses:dS,addIssueTypeStatus:rS,addIssueTypeStatuses:uS,setIssueTypeStatus:lS,setIssueTypeStatuses:oS,updateIssueTypeStatus:hS,updateIssueTypeStatuses:mS,deleteIssueTypeStatus:yS,deleteIssueTypeStatuses:pS}=un.actions,AS=t=>t.issueTypeStatusReducer.instances,ln=p.createSelector([AS],t=>T(Object.values(t).toSorted(ua))),on=t=>s=>s.issueTypeStatusReducer.instances[t],fS=S(O([ln,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),gF=S(O([ln,(t,s)=>s],(t,s)=>T(t.filter(e=>e.issue_type===s)))),SS=un.reducer,Le=w(t=>t.uuid),TS={instances:{}},hn=p.createSlice({name:"issueUpdates",initialState:TS,extraReducers:t=>t.addMatcher(p.isAnyOf(M,$,E),s=>Object.assign(s,TS)),reducers:{initializeIssueUpdates:Le.initialize,addIssueUpdate:Le.addOne,addIssueUpdates:Le.addMany,setIssueUpdate:Le.setOne,setIssueUpdates:Le.setMany,updateIssueUpdate:Le.updateOne,updateIssueUpdates:Le.updateMany,deleteIssueUpdate:Le.deleteOne,deleteIssueUpdates:Le.deleteMany}}),{initializeIssueUpdates:IS,addIssueUpdate:mn,addIssueUpdates:yn,setIssueUpdate:OS,setIssueUpdates:PS,updateIssueUpdate:FS,updateIssueUpdates:gS,deleteIssueUpdate:pn,deleteIssueUpdates:An}=hn.actions,fn=t=>t.issueUpdateReducer.instances,Sn=p.createSelector([fn],t=>Object.values(t)),bS=S(p.createSelector([fn,(t,s)=>s],(t,s)=>t[s])),_S=S(O([Sn,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),MS=S(O([Sn,(t,s)=>s],(t,s)=>T(t.filter(e=>e.issue===s)))),RS=hn.reducer,Ne=w(t=>t.id),wS={instances:{},currentUser:null},Tn=p.createSlice({name:"users",initialState:wS,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,wS)),reducers:{initializeUsers:Ne.initialize,setUsers:Ne.setMany,setUser:Ne.setOne,addUsers:Ne.addMany,addUser:Ne.addOne,updateUsers:Ne.updateMany,updateUser:Ne.updateOne,deleteUser:Ne.deleteOne,deleteUsers:Ne.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:ES,setUsers:vS,setUser:VS,addUsers:zS,addUser:In,updateUsers:BS,updateUser:jS,deleteUser:On,deleteUsers:qS,setCurrentUser:bF,setProfilePicture:_F}=Tn.actions,DS=Tn.reducer,CS=t=>t.userReducer.currentUser,Pn=t=>t.userReducer.instances,jt=p.createSelector([Pn],t=>Object.values(t)),qt=t=>s=>s.userReducer.instances[t],$S=S(O([jt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({id:n})=>e.has(n)))})),Ge=w(t=>t.uuid),US={instances:{}},Fn=p.createSlice({name:"organizationAccess",initialState:US,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,US)),reducers:{initializeOrganizationAccesses:Ge.initialize,addOrganizationAccess:Ge.addOne,addOrganizationAccesses:Ge.addMany,setOrganizationAccess:Ge.setOne,setOrganizationAccesses:Ge.setMany,updateOrganizationAccess:Ge.updateOne,updateOrganizationAccesses:Ge.updateMany,deleteOrganizationAccess:Ge.deleteOne,deleteOrganizationAccesses:Ge.deleteMany}}),{initializeOrganizationAccesses:kS,addOrganizationAccess:LS,addOrganizationAccesses:NS,setOrganizationAccess:GS,setOrganizationAccesses:HS,updateOrganizationAccess:KS,updateOrganizationAccesses:WS,deleteOrganizationAccess:YS,deleteOrganizationAccesses:ZS}=Fn.actions,JS=Fn.reducer,Dt=t=>t.organizationAccessReducer.instances,XS=t=>s=>s.organizationAccessReducer.instances[t],QS=S(O([Dt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(Object.values(t).filter(({uuid:n})=>e.has(n)))})),MF=p.createSelector([CS,Dt],(t,s)=>Object.values(s).find(n=>n.user===(t==null?void 0:t.id))??null),xS=p.createSelector([Dt],t=>{const s={};for(const e of Object.values(t))s[e.user]=e;return At(s)}),RF=S(O([Pn,xS,(t,s)=>s],(t,s,e)=>T(Object.values(t).filter(n=>{const a=s[n.id];return!!a&&a.organization===e})))),He=w(t=>t.uuid),eT={instances:{}},gn=p.createSlice({name:"organizations",initialState:eT,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,eT)),reducers:{initializeOrganizations:He.initialize,setOrganizations:He.setMany,setOrganization:He.setOne,addOrganizations:He.addMany,addOrganization:He.addOne,updateOrganizations:He.updateMany,updateOrganization:He.updateOne,deleteOrganization:He.deleteOne,deleteOrganizations:He.deleteMany}}),{initializeOrganizations:tT,setOrganizations:sT,setOrganization:iT,addOrganizations:nT,addOrganization:aT,updateOrganizations:cT,updateOrganization:dT,deleteOrganization:rT,deleteOrganizations:uT}=gn.actions,lT=t=>t.organizationReducer.instances,oT=p.createSelector([lT],t=>Object.values(t)),hT=t=>s=>s.organizationReducer.instances[t],mT=S(O([oT,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),yT=gn.reducer,pT=(t,s,e)=>{const n=t.uuid?t:{...t,uuid:et.v4()};return{payload:n,type:"",meta:{offline:{effect:{timestamp:new Date().toISOString(),request:n,BASE_URL:s,serviceName:e}}}}},AT={deletedRequests:[],latestRetryTime:0},bn=p.createSlice({name:"outbox",initialState:AT,extraReducers:t=>t.addCase(M,s=>Object.assign(s,AT)),reducers:{enqueueRequest:{reducer:(t,s)=>t,prepare:t=>{console.debug("Preparing to enqueue request",t);const{BASE_URL:s,serviceName:e,...n}=t;return pT(n,s,e)}},markForDeletion(t,s){t.deletedRequests.push(s.payload)},markAsDeleted(t,s){const e=t.deletedRequests.indexOf(s.payload);e!==-1&&t.deletedRequests.splice(e,1)},_setLatestRetryTime:(t,s)=>{t.latestRetryTime=s.payload}}}),wF=t=>t.outboxReducer.deletedRequests,EF=t=>t.outboxReducer.latestRetryTime,{enqueueRequest:fT,markForDeletion:vF,markAsDeleted:ST,_setLatestRetryTime:TT}=bn.actions,IT=bn.reducer,Ke=w(t=>t.uuid),OT={instances:{}},_n=p.createSlice({name:"projectAccess",initialState:OT,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,OT)),reducers:{initializeProjectAccesses:Ke.initialize,addProjectAccess:Ke.addOne,addProjectAccesses:Ke.addMany,setProjectAccess:Ke.setOne,setProjectAccesses:Ke.setMany,updateProjectAccess:Ke.updateOne,updateProjectAccesses:Ke.updateMany,deleteProjectAccess:Ke.deleteOne,deleteProjectAccesses:Ke.deleteMany}}),{initializeProjectAccesses:PT,addProjectAccess:FT,addProjectAccesses:gT,setProjectAccess:bT,setProjectAccesses:_T,updateProjectAccess:MT,updateProjectAccesses:RT,deleteProjectAccess:wT,deleteProjectAccesses:ET}=_n.actions,vT=_n.reducer,Mn=t=>t.projectAccessReducer.instances,yt=p.createSelector(Mn,t=>Object.values(t)),VT=t=>s=>s.projectAccessReducer.instances[t],zT=S(O([yt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),VF=S(O([Mn,(t,s)=>s],(t,s)=>T(Object.values(t).filter(e=>e.project===s)))),zF=S(p.createSelector([yt,(t,s)=>s],(t,s)=>{const e={};for(const n of t.filter(a=>a.project===s))e[n.user]=n;return e})),BF=S(O([jt,yt,(t,s)=>s],(t,s,e)=>{const n=new Set(s.filter(a=>a.project===e).map(a=>a.user));return T(t.filter(a=>n.has(a.id)))})),We=w(t=>t.uuid),BT={instances:{}},Rn=p.createSlice({name:"projectAttachments",initialState:BT,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,BT)),reducers:{initializeProjectAttachments:We.initialize,addProjectAttachment:We.addOne,addProjectAttachments:We.addMany,setProjectAttachment:We.setOne,setProjectAttachments:We.setMany,updateProjectAttachment:We.updateOne,updateProjectAttachments:We.updateMany,deleteProjectAttachment:We.deleteOne,deleteProjectAttachments:We.deleteMany}}),{initializeProjectAttachments:jT,addProjectAttachment:qT,addProjectAttachments:DT,setProjectAttachment:CT,setProjectAttachments:$T,updateProjectAttachment:UT,updateProjectAttachments:kT,deleteProjectAttachment:LT,deleteProjectAttachments:NT}=Rn.actions,GT=t=>t.projectAttachmentReducer.instances,wn=p.createSelector([GT],t=>Object.values(t)),HT=t=>s=>s.projectAttachmentReducer.instances[t],KT=S(O([wn,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),jF=S(O([wn,(t,s)=>s],(t,s)=>T(t.filter(({project:e})=>s===e)))),WT=Rn.reducer,Ye=w(t=>t.uuid),YT={instances:{},activeProjectFileId:null,isImportingProjectFile:!1},En=p.createSlice({name:"projectFiles",initialState:YT,extraReducers:t=>t.addMatcher(p.isAnyOf(M,$,E),s=>Object.assign(s,YT)),reducers:{initializeProjectFiles:Ye.initialize,setProjectFile:Ye.setOne,setProjectFiles:Ye.setMany,addProjectFile:Ye.addOne,addProjectFiles:Ye.addMany,updateProjectFile:Ye.updateOne,updateProjectFiles:Ye.updateMany,deleteProjectFile:Ye.deleteOne,deleteProjectFiles:Ye.deleteMany,setIsImportingProjectFile:(t,s)=>{t.isImportingProjectFile=s.payload},saveActiveProjectFileBounds:(t,s)=>{const e=t.activeProjectFileId;if(!e)throw new Error("Tried to save bounds for active project file, but no active project file was set.");if(!t.instances[e])throw new Error(`Tried to save bounds for active project file, but project file with ID ${e}
2
+ doesn't exist.`);t.instances[e].bounds=s.payload},setActiveProjectFileId:(t,s)=>{t.activeProjectFileId=s.payload}}}),{initializeProjectFiles:ZT,setProjectFile:JT,setProjectFiles:XT,addProjectFile:QT,addProjectFiles:xT,updateProjectFile:eI,updateProjectFiles:tI,deleteProjectFile:sI,deleteProjectFiles:iI,setIsImportingProjectFile:nI,setActiveProjectFileId:aI,saveActiveProjectFileBounds:cI}=En.actions,dI=t=>t.projectFileReducer.instances,rI=p.createSelector([dI],t=>T(Object.values(t).sort((s,e)=>s.z_index-e.z_index))),uI=t=>s=>s.projectFileReducer.instances[t],lI=S(O([rI,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),qF=t=>t.projectFileReducer.activeProjectFileId,DF=t=>t.projectFileReducer.isImportingProjectFile,oI=En.reducer,Ze=w(t=>t.uuid),hI={instances:{}},vn=p.createSlice({name:"projects",initialState:hI,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,hI)),reducers:{initializeProjects:Ze.initialize,setProjects:Ze.setMany,setProject:Ze.setOne,addProjects:Ze.addMany,addProject:Ze.addOne,updateProjects:Ze.updateMany,updateProject:Ze.updateOne,deleteProject:Ze.deleteOne,deleteProjects:Ze.deleteMany}}),{initializeProjects:mI,setProjects:yI,setProject:pI,addProjects:AI,addProject:fI,updateProjects:SI,updateProject:TI,deleteProject:II,deleteProjects:OI}=vn.actions,PI=vn.reducer,FI=t=>t.projectReducer.instances,Ct=p.createSelector([FI],t=>Object.values(t)),gI=t=>s=>s.projectReducer.instances[t],bI=S(O([Ct,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),CF=S(O([Ct,yt,(t,s)=>s],(t,s,e)=>{const n=new Set(s.filter(a=>a.user===e).map(a=>a.project));return T(t.filter(a=>n.has(a.uuid)))})),$F=S(O([Ct,(t,s)=>s],(t,s)=>T(t.filter(e=>e.organization===s)))),UF={isRehydrated:!1},Vn=p.createSlice({name:"rehydrated",initialState:UF,reducers:{setRehydrated:(t,s)=>{t.isRehydrated=s.payload}}}),{setRehydrated:kF}=Vn.actions,LF=t=>t.rehydratedReducer.isRehydrated,_I=Vn.reducer,Je=w(t=>t.uuid),MI={instances:{}},zn=p.createSlice({name:"teamMemberships",initialState:MI,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,MI)),reducers:{initializeTeamMemberships:Je.initialize,addTeamMembership:Je.addOne,addTeamMemberships:Je.addMany,setTeamMembership:Je.setOne,setTeamMemberships:Je.setMany,updateTeamMembership:Je.updateOne,updateTeamMemberships:Je.updateMany,deleteTeamMembership:Je.deleteOne,deleteTeamMemberships:Je.deleteMany}}),{initializeTeamMemberships:RI,addTeamMembership:wI,addTeamMemberships:EI,setTeamMembership:vI,setTeamMemberships:VI,updateTeamMembership:zI,updateTeamMemberships:BI,deleteTeamMembership:jI,deleteTeamMemberships:qI}=zn.actions,DI=zn.reducer,CI=t=>t.teamMembershipReducer.instances,$t=p.createSelector([CI],t=>Object.values(t)),$I=t=>s=>s.teamMembershipReducer.instances[t],UI=S(O([$t,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),NF=S(p.createSelector([$t,(t,s)=>s],(t,s)=>{const e={};for(const n of t.filter(a=>a.team===s))e[n.user]=n;return e})),GF=S(O([jt,$t,(t,s)=>s],(t,s,e)=>{const n=new Set(s.filter(a=>a.team===e).map(a=>a.user));return T(t.filter(a=>n.has(a.id)))})),Xe=w(t=>t.uuid),kI={instances:{}},Bn=p.createSlice({name:"teams",initialState:kI,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,kI)),reducers:{initializeTeams:Xe.initialize,addTeam:Xe.addOne,addTeams:Xe.addMany,setTeam:Xe.setOne,setTeams:Xe.setMany,updateTeam:Xe.updateOne,updateTeams:Xe.updateMany,deleteTeam:Xe.deleteOne,deleteTeams:Xe.deleteMany}}),{initializeTeams:LI,addTeam:NI,addTeams:GI,setTeam:HI,setTeams:KI,updateTeam:WI,updateTeams:YI,deleteTeam:ZI,deleteTeams:JI}=Bn.actions,XI=t=>t.teamReducer.instances,jn=p.createSelector([XI],t=>Object.values(t)),QI=t=>s=>s.teamReducer.instances[t],xI=S(O([jn,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),HF=S(O([jn,(t,s)=>s],(t,s)=>T(t.filter(e=>e.organization===s)))),eO=Bn.reducer,KF={version:0},tO=p.createSlice({name:"versioning",initialState:KF,reducers:{}}),sO=tO.reducer,qn={outboxReducer:IT,fileReducer:Gh,authReducer:Co},WF=p.combineReducers(qn),iO={...qn,[ut]:sO,categoryReducer:Xo,assetReducer:Gr,assetAttachmentReducer:Ea,assetStageCompletionReducer:tu,assetStageReducer:Au,assetTypeReducer:Oo,assetTypeAttachmentReducer:vu,issueReducer:tA,issueAttachmentReducer:pp,issueTypeReducer:aS,issueTypeAttachmentReducer:pA,organizationReducer:yT,projectReducer:PI,projectAttachmentReducer:WT,projectAccessReducer:vT,organizationAccessReducer:JS,projectFileReducer:oI,rehydratedReducer:_I,formReducer:xm,formRevisionReducer:Lm,formRevisionAttachmentReducer:Vm,formSubmissionAttachmentReducer:yy,formSubmissionReducer:My,formIdentifierReducer:nm,formIdentifierValueReducer:Sm,userReducer:DS,emailDomainsReducer:$h,documentsReducer:Ph,documentAttachmentReducer:oh,teamReducer:eO,agentsReducer:fa,issueCommentReducer:Lp,issueCommentAttachmentReducer:wp,issueUpdateReducer:RS,geoImageReducer:ky,issueAssociationReducer:sp,issueTypeFieldsReducer:nf,issueTypeFieldValuesReducer:NA,issueTypeFieldsAttachmentReducer:wA,issueTypeFieldValuesAttachmentReducer:ff,issueTypeIdentifierReducer:vf,issueTypeIdentifierValueReducer:Hf,issueTypeStatusReducer:SS,assetTypeFieldsReducer:al,assetTypeFieldValuesReducer:Vl,assetTypeFieldsAttachmentReducer:Hu,assetTypeFieldValuesAttachmentReducer:Sl,assetTypeIdentifierReducer:Kl,assetTypeIdentifierValueReducer:co,assetTypeStatusReducer:jo,assetProcedureTypeReducer:pd,assetProcedureReducer:ed,assetProcedureTypeFieldsReducer:pc,assetProcedureTypeFieldValuesReducer:Lc,assetProcedureTypeFieldsAttachmentReducer:tc,assetProcedureTypeFieldValuesAttachmentReducer:Mc,assetProcedureTypeAttachmentReducer:ka,assetProcedureStepFieldsAttachmentReducer:Vd,assetProcedureStepFieldsReducer:Hd,assetProcedureStepFieldValuesAttachmentReducer:nr,assetProcedureStepFieldValuesReducer:Sr,assetProcedureStepReducer:wr,teamMembershipReducer:DI},YF=p.combineReducers(iO),nO=1e4,aO=200,Dn=[400,409,403,404,405,500],N=1e4,cO={};class dO{constructor(s){m(this,"client");m(this,"pageSize",nO);cO[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 rO=()=>oO.length-1,uO=t=>(t[ut]={version:rO()},t),lO=()=>uO({}),ZF=t=>(t.outboxReducer&&(t.outboxReducer.deletedRequests=[]),t),JF=t=>s=>{var e;return s===void 0&&(s={}),((e=s[ut])==null?void 0:e.version)===rO()?s:t(s)},oO=[uO,lO,lO,ZF],XF=Object.fromEntries(oO.map((t,s)=>[s,JF(t)])),QF=t=>{if(t)throw t;const s=rt();s?s.dispatch({type:"rehydrated/setRehydrated",payload:!0}):console.error("Client store not set")},hO=(t,s,e)=>{const n=st();return n?(n.addRequest(s),n.getQueue()):(console.warn("Outbox coordinator not set; cannot enqueue request yet."),[])},mO=(t,s,e)=>{const n=st();if(!n)return console.warn("Outbox coordinator not set; cannot dequeue request yet."),[];const c=s.meta.offlineAction.payload.uuid;return n.remove(c),n.getQueue()};async function xF(t,s){if(!s.payload)throw new Error("Received empty payload");return _O(s)}const eg={...Wn,effect:xF,discard:pO,returnPromises:!0,persistCallback:QF,retry:ng,persistOptions:{storage:zO},queue:{...Wn.queue,enqueue:hO,dequeue:mO,peek:(...t)=>ig(...t)}},tg=BO(XF,ut),sg=p.compose(VO.offline(eg),tg);async function yO(t,s,e){if(s.store.getState().outboxReducer.deletedRequests.includes(t.payload.uuid))throw new Error("Request was marked for deletion");const a=cO[t.meta.offline.effect.serviceName];if(!a)throw new Error(`Service ${t.meta.offline.effect.serviceName} not found`);return kn(t.meta.offline.effect.BASE_URL,t.meta.offline.effect.request,s,a,e)}function pO(t,s,e=0){var d;if(console.debug("Considering discarding request due to error:",t,`(${typeof t})`,`
3
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 n=dt(),c=n.getState().outboxReducer.deletedRequests,r=s.payload.uuid;function l(){n.dispatch(pS(r));const o=tt();if(!o)throw new Error("Outbox coordinator not set");o.remove(s.payload.uuid);const y=s.meta.offline.rollback;throw y&&(console.warn("Rolling back request due to SDK error:",s),n.dispatch(y)),t}if(t instanceof U&&t.options.discard&&(console.debug("Discarding request due to explicit discard:",s),l()),c.includes(r)&&(console.debug("Discarding request due to deletion:",s),l()),t instanceof U){const o=t.status||((d=t.response)==null?void 0:d.status);if(o||console.warn("Error has no status code:",t),o!==void 0&&qn.includes(o)){console.warn("Discarding request due to error:",t,`
5
- Action:`,s);const y=tt();if(!y)throw new Error("Outbox coordinator not set");y.remove(s.payload.uuid),t.options.discard=!0,l()}}console.debug("Registering a retry for request:",s.payload.uuid);const u=tt();if(!u)throw new Error("Outbox coordinator not set");return u.registerRetry(s.payload.uuid),!1}function tg(t,s,e){var n;return(n=tt())==null?void 0:n.peek()}function sg(t,s){return dt().dispatch(AS(new Date().getTime())),Xn}const nt="An unknown error occurred",ig=500,mO=["non_field_errors","detail"];function ng(t,s){let e;if(t!=null&&t.body)if(typeof t.body=="object"){const n=t.body;if(typeof n.error=="string")e=n.error;else if(typeof n.message=="string")e=n.message;else try{e=Object.entries(n).map(([a,c])=>typeof c=="string"?mO.includes(a)?c:`${a}: ${c}`:Array.isArray(c)?mO.includes(a)?c.join(`
4
+ Retries:`,e),!(t instanceof Error))throw console.error("ENCOUNTERED NON-ERROR ERROR:",t,"(throwing immediately, which may lead to unexpected behavior)"),t;const n=rt(),c=n.getState().outboxReducer.deletedRequests,r=s.payload.uuid;function l(){n.dispatch(ST(r));const o=st();if(!o)throw new Error("Outbox coordinator not set");o.remove(s.payload.uuid);const y=s.meta.offline.rollback;throw y&&(console.warn("Rolling back request due to SDK error:",s),n.dispatch(y)),t}if(t instanceof k&&t.options.discard&&(console.debug("Discarding request due to explicit discard:",s),l()),c.includes(r)&&(console.debug("Discarding request due to deletion:",s),l()),t instanceof k){const o=t.status||((d=t.response)==null?void 0:d.status);if(o||console.warn("Error has no status code:",t),o!==void 0&&Dn.includes(o)){console.warn("Discarding request due to error:",t,`
5
+ Action:`,s);const y=st();if(!y)throw new Error("Outbox coordinator not set");y.remove(s.payload.uuid),t.options.discard=!0,l()}}console.debug("Registering a retry for request:",s.payload.uuid);const u=st();if(!u)throw new Error("Outbox coordinator not set");return u.registerRetry(s.payload.uuid),!1}function ig(t,s,e){var n;return(n=st())==null?void 0:n.peek()}function ng(t,s){return rt().dispatch(TT(new Date().getTime())),ea}const at="An unknown error occurred",ag=500,AO=["non_field_errors","detail"];function cg(t,s){let e;if(t!=null&&t.body)if(typeof t.body=="object"){const n=t.body;if(typeof n.error=="string")e=n.error;else if(typeof n.message=="string")e=n.message;else try{e=Object.entries(n).map(([a,c])=>typeof c=="string"?AO.includes(a)?c:`${a}: ${c}`:Array.isArray(c)?AO.includes(a)?c.join(`
6
6
  `):c.map(r=>`${a}: ${r}`).join(`
7
7
  `):`${a}: ${JSON.stringify(c)}`).join(`
8
- `)}catch(a){console.error("Failed to extract error message from response body",a)}}else typeof t.body=="string"&&(e=t.body);else t!=null&&t.text?e=t.text:s instanceof Error&&(e=s.message);return!e||e.length>ig?nt:e}class U extends Error{constructor(e){super(nt);m(this,"status");m(this,"response");m(this,"message");m(this,"options");const{response:n,innerError:a}=e;this.message=e.message??ng(n,a)??nt,this.status=(n==null?void 0:n.status)??0,this.response=n,e.discard=e.discard??!1,this.options=e}}function yO(t){function s(e){return typeof e=="object"&&e!==null&&["ok","redirect","clientError","serverError","error"].every(a=>a in e)}if(s(t))return t;if(typeof t=="object"&&t!==null){const e=t;if(s(e.response))return e.response;if(e.response&&s(e.response.response))return e.response.response}}class ag extends nO{constructor(s){super(s)}}class et extends nO{constructor(e,n){super(e);m(this,"auth");this.auth=n}}class cg extends et{async startConversation(s,e){return this.enqueueRequest({description:"Start agent conversation",method:h.POST,url:"/agents/prompt/",payload:{prompt:s,active_project:e},blockers:["prompt"],blocks:["prompt"]}).then(n=>(this.dispatch(ea(n)),n))}async continueConversation(s,e,n){return this.enqueueRequest({description:"Prompt agent",method:h.POST,url:"/agents/prompt/",payload:{prompt:s,active_project:n},blockers:["prompt"],blocks:["prompt"],queryParams:{conversation_id:e}}).then(a=>{this.dispatch(sa(a))})}async fetchDetails(s){return this.enqueueRequest({description:"Get agent conversation",method:h.GET,url:`/agents/conversations/${s}/`,blockers:["conversation"],blocks:["conversation"]}).then(e=>{this.dispatch(ta(e))})}async rate(s,e){return this.enqueueRequest({description:"Rate agent response",method:h.PUT,url:`/agents/responses/${s}/rate/`,payload:{rating:e},blockers:["rate"],blocks:["rate"]})}async list(s,e){return this.performRequest({method:h.GET,url:"/agents/conversations/",...s},e)}async refreshStore(s,e){const n=await this.list({queryParams:{project:s}},e);return this.dispatch(xn(n)),n}}function O(t,s,e){const n=`${s}${e?"s":""}`;switch(t){case h.GET:return`Get ${n}`;case h.POST:return`Create ${n}`;case h.PATCH:return`Update ${n}`;case h.PUT:return`Update ${n}`;case h.DELETE:return`Delete ${n}`}}class v extends et{async get(s,e){return this.performRequest({url:`${this.url}/${s}/`,method:h.GET},e)}async list(s,e){return this.performRequest({url:`${this.url}/`,method:h.GET,...s},e)}async listPaginated(s,e){return this.performPagination({url:`${this.url}/`,method:h.GET,...s},e)}}class Xe extends v{constructor(){super(...arguments);m(this,"pageSize",sO)}async _bulkAdd(e){var f;const{store:n}=this.client,{addMany:a,updateMany:c,deleteMany:r}=this.actions,l=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,u=new Date().toISOString(),d=[],o=[],y={};for(const S of e){const{modelUuid:F,file:P}=S,g=await this.client.files.getFilePayload(P);g.sha1 in y||(y[g.sha1]=g);const b=this.buildModel({file:P,file_sha1:g.sha1,submitted_at:u,created_by:l,modelUuid:F});d.push(b),o.push(this.buildPayload(b,g))}this.dispatch(a(d));const A=this.enqueueRequest({description:O(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{submitted_at:u,attachments:o,files:Object.values(y)},blocks:d.map(S=>this.getId(S)),blockers:d.map(S=>S.file_sha1)});return A.then(({attachments:S,presigned_urls:F})=>{this.dispatch(c(S)),this.client.files.processPresignedUrls(F)}).catch(()=>{this.dispatch(r(d.map(S=>this.getId(S))))}),[d,A.then(({attachments:S})=>S)]}async _delete(e){const{store:n}=this.client,{addOne:a,deleteOne:c}=this.actions,{selectById:r}=this.selectors,l=r(n.getState(),e);if(!l)throw new Error(`Attempting to delete attachment with uuid ${e} that does not exist in the store`);this.dispatch(c(this.getId(l)));const u=this.enqueueRequest({description:O(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return u.then(()=>{this.client.files.removeCache(l.file_sha1)}).catch(()=>{this.dispatch(a(l))}),u}}class dg extends Xe{constructor(){super(...arguments);m(this,"name","Asset attachment");m(this,"url","/asset-attachments");m(this,"actions",{addOne:fa,addMany:Xt,setOne:Ta,setMany:Sa,updateOne:Ia,updateMany:Oa,deleteOne:Pa,deleteMany:Qt,initialize:Aa});m(this,"selectors",{selectById:ga,selectByIds:ba})}getId(e){return e.uuid}buildModel(e){return M({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,asset:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,asset:e.asset}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.assetUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{asset__project:e}},n)).flat();return this.dispatch(a(r)),r}}class rg extends Xe{constructor(){super(...arguments);m(this,"name","Asset Procedure Attachment");m(this,"url","/asset-procedure-type-attachments");m(this,"actions",{addOne:Ea,addMany:va,setOne:Va,setMany:za,updateOne:Ba,updateMany:ja,deleteOne:qa,deleteMany:Da,initialize:wa});m(this,"selectors",{selectById:Ua,selectByIds:ka})}getId(e){return e.uuid}buildModel(e){return M({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,asset_procedure_type:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,asset_procedure_type:e.asset_procedure_type}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.assetProcedureTypeUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class ug extends v{constructor(){super(...arguments);m(this,"name","Asset Procedure Type Fields Attachment");m(this,"url","/asset-procedure-type-fields-attachments");m(this,"actions",{addOne:Ga,addMany:Ha,setOne:Ka,setMany:Wa,updateOne:Ya,updateMany:Za,deleteOne:Ja,deleteMany:Xa,initialize:Na});m(this,"selectors",{selectById:ec,selectByIds:tc})}async bulkAdd(e){var A;const{addMany:n,setMany:a,deleteMany:c}=this.actions,r=new Date().toISOString(),l=((A=this.client.store.getState().userReducer.currentUser)==null?void 0:A.id)??null,u={},d=[],o=[];for(const f of e){const{fieldsRevisionUuid:S,fieldIdentifier:F,file:P}=f,g=await this.client.files.getFilePayload(P);g.sha1 in u||(u[g.sha1]=g);const b=M({file:URL.createObjectURL(P),file_type:P.type,file_name:P.name,file_sha1:g.sha1,created_by:l,fields_revision:S,submitted_at:r,field_identifier:F});d.push(b);const E={uuid:b.uuid,file_name:P.name,field_identifier:F,file_extension:g.extension,file_sha1:g.sha1,fields_revision:S};o.push(E)}this.dispatch(n(d));const y=this.enqueueRequest({description:O(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:o,files:Object.values(u)},blockers:d.map(f=>f.fields_revision),blocks:d.map(f=>f.uuid)});return y.then(f=>{this.client.files.processPresignedUrls(f.presigned_urls),this.dispatch(a(f.attachments))}).catch(()=>{this.dispatch(c(d.map(f=>f.uuid)))}),[d,y.then(({attachments:f})=>f)]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{fields_revision__asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class lg extends v{constructor(){super(...arguments);m(this,"name","Asset Procedure Type Fields");m(this,"url","/asset-procedure-type-fields");m(this,"actions",{addOne:nc,addMany:ac,setOne:cc,setMany:dc,updateOne:rc,updateMany:uc,deleteOne:lc,deleteMany:oc,initialize:ic});m(this,"selectors",{selectById:yc,selectByIds:pc})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:O(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:V(d),blockers:[d.asset_procedure_type],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(r(d.uuid)),A}),[d,o]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}function Qe(t,s){const e=[];let n=0;const a=t.length;for(;n<a;)e.push(t.slice(n,n+=s));return e}class og extends v{constructor(){super(...arguments);m(this,"name","Asset Procedure Type Field Values Attachment");m(this,"url","/asset-procedure-type-field-values-attachments");m(this,"actions",{addOne:Tc,addMany:cs,setOne:Sc,setMany:Ic,updateOne:Oc,updateMany:Pc,deleteOne:Fc,deleteMany:ds,initialize:fc});m(this,"selectors",{selectById:_c,selectByIds:Mc})}async bulkAdd(e,n){var f;const{addMany:a,setMany:c,deleteMany:r}=this.actions,l=new Date().toISOString(),u=((f=this.client.store.getState().userReducer.currentUser)==null?void 0:f.id)??null,d=Qe(e,Math.min(n??e.length,L)),o=[],y=[];for(const S of d){const F={},P=[];for(const g of S){const{fieldValuesUuid:b,fieldIdentifier:E,file:B}=g,z=await this.client.files.getFilePayload(B);z.sha1 in F||(F[z.sha1]=z);const q=M({file:URL.createObjectURL(B),file_type:B.type,file_name:B.name,file_sha1:z.sha1,created_by:u,field_values:b,submitted_at:l,field_identifier:E});o.push(q);const j={uuid:q.uuid,file_name:B.name,file_sha1:z.sha1,file_extension:z.extension,field_identifier:E,field_values:b};P.push(j)}y.push({submitted_at:l,attachments:P,files:Object.values(F)})}this.dispatch(a(o));const A=y.map(S=>this.enqueueRequest({description:O(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:S,blockers:S.attachments.map(F=>F.field_values),blocks:S.attachments.map(F=>F.uuid)}));return Promise.all(A).then(S=>{for(const P of S)this.client.files.processPresignedUrls(P.presigned_urls);const F=S.flatMap(P=>P.attachments);this.dispatch(c(F))}).catch(S=>{throw this.dispatch(r(o.map(F=>F.uuid))),S}),[o,A.map(S=>S.then(({attachments:F})=>F))]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:r}=this.selectors,l=n.getState(),u=r(l,e);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(h.DELETE,this.name,!0),method:h.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{field_values__asset_procedure__project:e,latest:!0}},n)).flat();return this.dispatch(a(r)),r}}class hg extends v{constructor(){super(...arguments);m(this,"name","Asset Procedure Type Field Values");m(this,"url","/asset-procedure-type-field-values");m(this,"actions",{addOne:vc,addMany:Vc,setOne:zc,setMany:Bc,updateOne:jc,updateMany:qc,deleteOne:Dc,deleteMany:Cc,initialize:Ec});m(this,"selectors",{selectById:kc,selectByIds:Lc})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,u=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=new Date().toISOString(),o=M({...e,created_by:u,submitted_at:d}),y=this.enqueueRequest({description:O(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:V(o),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[o.uuid]});return this.dispatch(a(o)),y.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(o.uuid))}),[o,y]}bulkAdd(e,n){var F;const{values:a,payloads:c}=e,{addMany:r,setMany:l,deleteMany:u}=this.actions,d=new Date().toISOString(),o=((F=this.client.store.getState().userReducer.currentUser)==null?void 0:F.id)??null,y=[],A=Qe(c,Math.min(n??c.length,L)),f=[];for(const P of A){const g=[];for(const b of P){const E=M({...b,values:b.values,created_by:o,submitted_at:d});y.push(E),g.push({uuid:E.uuid,asset:b.asset,fields_revision:b.fields_revision,asset_procedure:b.asset_procedure,published_at:b.published_at,values:E.values})}f.push({submitted_at:d,values:a,field_values:g})}this.dispatch(r(y));const S=[];for(const P of f){const{field_values:g}=P,b=g.map(({asset:j})=>j),E=g.map(({fields_revision:j})=>j),B=g.map(({asset_procedure:j})=>j),z=g.map(({uuid:j})=>j),q=this.enqueueRequest({description:O(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:P,blockers:b.concat(E).concat(B),blocks:z});S.push(q)}return Promise.all(S).then(P=>{this.dispatch(l(P.flat()))}).catch(()=>{this.dispatch(u(D(y)))}),[y,S]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=n.getState(),l=c(r,e.uuid);if(!l)throw new Error(`Expected AssetProcedureTypeFieldValues with uuid ${e.uuid} to exist`);const u={...l,...e};this.dispatch(a(u));const d=this.enqueueRequest({description:O(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[u.fields_revision,u.asset,u.asset_procedure],blocks:[u.uuid]});return d.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(a(l))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(l,e);if(!u)throw new Error(`Expected submission with uuid ${e} to exist`);const d=Rc(l,e);this.dispatch(a(e)),this.dispatch(ds(D(d)));try{return await this.enqueueRequest({description:O(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(o){throw this.dispatch(c(u)),this.dispatch(cs(d)),o}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{asset_procedure__project:e,latest:!0}},n)).flat();return this.dispatch(a(r)),r}}class mg extends v{constructor(){super(...arguments);m(this,"name","Asset Procedure");m(this,"url","/asset-procedures");m(this,"actions",{addOne:Hc,addMany:os,setOne:Zc,setMany:Jc,updateOne:Kc,updateMany:Wc,deleteOne:Yc,deleteMany:hs,initialize:Gc});m(this,"selectors",{selectById:ed,selectByIds:td})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:O(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:V(d),blockers:[e.asset_procedure_type,e.asset_type],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(n.getState(),e.uuid);if(!r)throw new Error(`Expected asset procedure with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[r.uuid],blocks:[r.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(l,e);if(!u)throw new Error(`Expected asset procedure with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(r)),r}}class yg extends v{constructor(){super(...arguments);m(this,"name","Asset Procedure Type");m(this,"url","/asset-procedure-types");m(this,"actions",{addOne:nd,addMany:ad,setOne:ld,setMany:od,updateOne:cd,updateMany:dd,deleteOne:rd,deleteMany:ud,initialize:id});m(this,"selectors",{selectById:yd,selectByIds:pd})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:O(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:V(d),blockers:[],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(n.getState(),e.uuid);if(!r)throw new Error(`Expected asset procedure type with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[r.uuid],blocks:[r.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(l,e);if(!u)throw new Error(`Expected asset procedure type with uuid ${e} to exist`);const d=xc(l,e);this.dispatch(a(e)),this.dispatch(hs(D(d)));try{return await this.enqueueRequest({description:O(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(o){throw this.dispatch(c(u)),this.dispatch(os(d)),o}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class pg extends v{constructor(){super(...arguments);m(this,"name","Asset Procedure Step Fields Attachment");m(this,"url","/asset-procedure-step-fields-attachments");m(this,"actions",{addOne:Td,addMany:Sd,setOne:Id,setMany:Od,updateOne:Pd,updateMany:Fd,deleteOne:gd,deleteMany:bd,initialize:fd});m(this,"selectors",{selectById:Md,selectByIds:Rd})}async bulkAdd(e){var A;const{addMany:n,setMany:a,deleteMany:c}=this.actions,r=new Date().toISOString(),l=((A=this.client.store.getState().userReducer.currentUser)==null?void 0:A.id)??null,u={},d=[],o=[];for(const f of e){const{fieldsRevisionUuid:S,fieldIdentifier:F,file:P}=f,g=await this.client.files.getFilePayload(P);g.sha1 in u||(u[g.sha1]=g);const b=M({file:URL.createObjectURL(P),file_type:P.type,file_name:P.name,file_sha1:g.sha1,created_by:l,fields_revision:S,submitted_at:r,field_identifier:F});d.push(b);const E={uuid:b.uuid,file_name:P.name,field_identifier:F,file_extension:g.extension,file_sha1:g.sha1,fields_revision:S};o.push(E)}this.dispatch(n(d));const y=this.enqueueRequest({description:O(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:o,files:Object.values(u)},blockers:d.map(f=>f.fields_revision),blocks:d.map(f=>f.uuid)});return y.then(f=>{this.client.files.processPresignedUrls(f.presigned_urls),this.dispatch(a(f.attachments))}).catch(()=>{this.dispatch(c(d.map(f=>f.uuid)))}),[d,y.then(({attachments:f})=>f)]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{fields_revision__asset_procedure_step__organization:e}},n);return this.dispatch(a(c)),c}}class Ag extends v{constructor(){super(...arguments);m(this,"name","Asset Procedure Step Fields");m(this,"url","/asset-procedure-step-fields");m(this,"actions",{addOne:Vd,addMany:zd,setOne:Bd,setMany:jd,updateOne:qd,updateMany:Dd,deleteOne:Cd,deleteMany:$d,initialize:vd});m(this,"selectors",{selectById:Ud,selectByIds:kd})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:O(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:V(d),blockers:[d.asset_procedure_step],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(r(d.uuid)),A}),[d,o]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,c=n.getState().assetProcedureStepFieldsReducer.instances[e.uuid];if(!c)throw new Error(`AssetProcedureStepFields with uuid ${e.uuid} not found`);const r={...c,...e};this.dispatch(a(r));const l=this.enqueueRequest({description:O(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${c.uuid}/`,payload:e,blockers:[c.uuid],blocks:[c.uuid]});return l.then(u=>{this.dispatch(a(u))}).catch(u=>{throw this.dispatch(a(c)),u}),[r,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,r=n.getState().assetProcedureStepFieldsReducer.instances[e];if(!r)throw new Error(`AssetProcedureStepFields with uuid ${e} not found`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(l){throw this.dispatch(c(r)),l}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_step__asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class fg extends v{constructor(){super(...arguments);m(this,"name","Asset Procedure Step Field Values Attachment");m(this,"url","/asset-procedure-step-field-values-attachments");m(this,"actions",{addOne:Hd,addMany:Is,setOne:Kd,setMany:Wd,updateOne:Yd,updateMany:Zd,deleteOne:Jd,deleteMany:Os,initialize:Gd});m(this,"selectors",{selectById:Qd,selectByIds:xd})}async bulkAdd(e,n){var f;const{addMany:a,setMany:c,deleteMany:r}=this.actions,l=new Date().toISOString(),u=((f=this.client.store.getState().userReducer.currentUser)==null?void 0:f.id)??null,d=Qe(e,Math.min(n??e.length,L)),o=[],y=[];for(const S of d){const F={},P=[];for(const g of S){const{fieldValuesUuid:b,fieldIdentifier:E,file:B}=g,z=await this.client.files.getFilePayload(B);z.sha1 in F||(F[z.sha1]=z);const q=M({file:URL.createObjectURL(B),file_type:B.type,file_name:B.name,file_sha1:z.sha1,created_by:u,field_values:b,submitted_at:l,field_identifier:E});o.push(q);const j={uuid:q.uuid,file_name:B.name,file_sha1:z.sha1,file_extension:z.extension,field_identifier:E,field_values:b};P.push(j)}y.push({submitted_at:l,attachments:P,files:Object.values(F)})}this.dispatch(a(o));const A=y.map(S=>this.enqueueRequest({description:O(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:S,blockers:S.attachments.map(F=>F.field_values),blocks:S.attachments.map(F=>F.uuid)}));return Promise.all(A).then(S=>{for(const P of S)this.client.files.processPresignedUrls(P.presigned_urls);const F=S.flatMap(P=>P.attachments);this.dispatch(c(F))}).catch(S=>{throw this.dispatch(r(o.map(F=>F.uuid))),S}),[o,A.map(S=>S.then(({attachments:F})=>F))]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:r}=this.selectors,l=n.getState(),u=r(l,e);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(h.DELETE,this.name,!0),method:h.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{field_values__asset_procedure__project:e,latest:!0}},n)).flat();return this.dispatch(a(r)),r}}class Tg extends v{constructor(){super(...arguments);m(this,"name","Asset Procedure Step Field Values");m(this,"url","/asset-procedure-step-field-values");m(this,"actions",{addOne:nr,addMany:ar,setOne:cr,setMany:dr,updateOne:rr,updateMany:ur,deleteOne:lr,deleteMany:or,initialize:ir});m(this,"selectors",{selectById:mr,selectByIds:yr})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,u=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=new Date().toISOString(),o=M({...e,created_by:u,submitted_at:d}),y=this.enqueueRequest({description:O(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:V(o),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[o.uuid]});return this.dispatch(a(o)),y.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(o.uuid))}),[o,y]}bulkAdd(e,n){var F;const{payloads:a,values:c}=e,{addMany:r,setMany:l,deleteMany:u}=this.actions,d=new Date().toISOString(),o=((F=this.client.store.getState().userReducer.currentUser)==null?void 0:F.id)??null,y=[],A=Qe(a,Math.min(n??a.length,L)),f=[];for(const P of A){const g=[];for(const b of P){const E=M({...b,values:b.values,created_by:o,submitted_at:d});y.push(E),g.push({uuid:E.uuid,asset:b.asset,fields_revision:b.fields_revision,asset_procedure:b.asset_procedure,asset_procedure_step:b.asset_procedure_step,published_at:b.published_at,values:E.values})}f.push({submitted_at:d,values:c,field_values:g})}this.dispatch(r(y));const S=[];for(const P of f){const{field_values:g}=P,b=g.map(({asset:j})=>j),E=g.map(({fields_revision:j})=>j),B=g.map(({asset_procedure:j})=>j),z=g.map(({uuid:j})=>j),q=this.enqueueRequest({description:O(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:P,blockers:b.concat(E).concat(B),blocks:z});S.push(q)}return Promise.all(S).then(P=>{this.dispatch(l(P.flat()))}).catch(()=>{this.dispatch(u(D(y)))}),[y,S]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=n.getState(),l=c(r,e.uuid);if(!l)throw new Error(`Expected AssetProcedureStepFieldValues with uuid ${e.uuid} to exist`);const u={...l,...e};this.dispatch(a(u));const d=this.enqueueRequest({description:O(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[u.fields_revision,u.asset,u.asset_procedure],blocks:[u.uuid]});return d.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(a(l))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(l,e);if(!u)throw new Error(`Expected submission with uuid ${e} to exist`);const d=er(l,e);this.dispatch(a(e)),this.dispatch(Os(D(d)));try{return await this.enqueueRequest({description:O(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(o){throw this.dispatch(c(u)),this.dispatch(Is(d)),o}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{asset_procedure__project:e,latest:!0}},n)).flat();return this.dispatch(a(r)),r}}class Sg extends v{constructor(){super(...arguments);m(this,"name","Asset Procedure Step");m(this,"url","/asset-procedure-steps");m(this,"actions",{addOne:Ir,addMany:Or,setOne:Tr,setMany:Sr,updateOne:Pr,updateMany:Fr,deleteOne:gr,deleteMany:br,initialize:fr});m(this,"selectors",{selectById:Mr,selectByIds:Rr})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:O(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:V(d),blockers:[d.asset_procedure_type],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(n.getState(),e.uuid);if(!r)throw new Error(`No asset procedure step with uuid ${e.uuid} found in the store`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${r.uuid}/`,payload:{name:e.name,description:e.description,priority:e.order,color:e.color},blockers:[r.uuid],blocks:[r.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteMany:a,addMany:c,addOne:r,deleteOne:l}=this.actions,{selectById:u}=this.selectors,d=n.getState(),o=u(d,e);if(!o)throw new Error(`No asset procedure step with uuid ${e} found in the store`);const y=wr(d,e);this.dispatch(l(e)),this.dispatch(a(D(y)));try{return await this.enqueueRequest({description:O(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(A){throw this.dispatch(r(o)),this.dispatch(c(y)),A}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class Ig extends v{constructor(){super(...arguments);m(this,"url","/assets");m(this,"name","Asset");m(this,"actions",{addOne:Vr,addMany:Ms,setOne:qr,setMany:Dr,updateOne:zr,updateMany:Br,deleteOne:jr,deleteMany:Rs,initialize:vr});m(this,"selectors",{selectById:$r,selectByIds:Ur})}add(e){var y;const{store:n}=this.client,{addOne:a,updateOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:O(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:V(d),blockers:[d.asset_type],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:c}=this.selectors,r=c(n.getState(),e.uuid);if(!r)throw new Error(`No asset with uuid ${e.uuid} found in the store`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{addOne:a,deleteOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(l,e);if(!u)throw new Error(`No asset with uuid ${e} found in the store`);const d=_a(l,e),o=Qy(l,e);this.dispatch(c(e)),this.dispatch(Qt(D(d))),this.dispatch(Et(D(o)));try{return await this.enqueueRequest({description:O(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(y){throw this.dispatch(a(u)),this.dispatch(Xt(d)),this.dispatch(wt(o)),y}}bulkAdd(e,n){const{addMany:a}=this.actions,c=new Date().toISOString(),r=xe.v4(),l=Qe(e,Math.min(n??e.length,L)).map(o=>{const y=o.map(A=>M(A));return{batchId:xe.v4(),payload:{transaction_id:r,submitted_at:c,assets:y}}}),u=[];let d=null;for(const o of l){const{batchId:y,payload:A}=o,f=A.assets.map(({uuid:E})=>E),S=A.assets.map(({asset_type:E})=>E),F=A.assets.map(({project:E})=>E),P=S.concat(F);d&&P.push(d);const g=f;g.push(y);const b=this.enqueueRequest({description:O(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:A,blockers:P,blocks:g});d=o.batchId,u.push(b)}return Promise.all(u).then(o=>{const y=o.flat();this.dispatch(a(y))}),u}bulkUpdate(e,n){const{store:a}=this.client,{updateMany:c}=this.actions,{selectByIds:r}=this.selectors,l=D(e).toSorted(At);if(l.length!==e.length)throw new Error("payloads contains duplicate uuids.");const u=r(a.getState(),l).toSorted(Zt);if(l.length!=u.length)throw new Error(`Attempting to bulk update ${l.length-u.length} assets that dont exist in the store`);const d=[];for(let f=0;f<l.length;f++)d.push({...u[f],...e[f]});this.dispatch(c(d));const o=Qe(e,Math.min(n??e.length,L)),y=[];let A=null;for(const f of o){const S=xe.v4(),F=D(f),P=f.map(({status:b})=>b).filter(Boolean),g=this.enqueueRequest({description:O(h.PATCH,this.name,!0),method:h.PATCH,url:`${this.url}/bulk/`,payload:{payloads:f},blockers:F.concat(P).concat(A?[A]:[]),blocks:F.concat([S])});y.push(g),A=S}return Promise.all(y).then(f=>{this.dispatch(c(f.flat()))}).catch(()=>{this.dispatch(c(u))}),[d,y]}async bulkDelete(e){const{store:n}=this.client,{addMany:a,deleteMany:c}=this.actions,{selectByIds:r}=this.selectors,l=n.getState(),u=r(l,e);this.dispatch(c(e));try{return await this.enqueueRequest({description:O(h.DELETE,this.name,!0),method:h.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(a(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(r)),r}}class Og extends v{constructor(){super(...arguments);m(this,"name","Asset Stage Completion");m(this,"url","/asset-stage-completions");m(this,"actions",{addOne:Gr,addMany:Hr,setOne:Kr,setMany:Wr,updateOne:Yr,updateMany:Zr,deleteOne:Jr,deleteMany:Xr,initialize:Nr});m(this,"selectors",{selectById:tu,selectByIds:su})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:O(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:V(d),blockers:[e.asset,e.asset_stage],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(n.getState(),e);if(!l)throw new Error(`Expected asset stage completion with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(l)),u}}bulkAdd(e){var f;const{store:n}=this.client,{addMany:a,setMany:c,deleteMany:r}=this.actions,l=new Date().toISOString(),u=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,d=e.map(S=>M(S)),o=d.map(S=>({...S,created_by:u,submitted_at:l})),y=o.map(({uuid:S})=>S);this.dispatch(a(o));const A=this.enqueueRequest({description:O(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{submitted_at:l,completions:d},blockers:[...e.map(S=>S.asset_procedure),...e.map(S=>S.asset_stage),...e.map(S=>S.asset)],blocks:y});return A.then(S=>{this.dispatch(c(S))}).catch(()=>{this.dispatch(r(y))}),[o,A]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:r}=this.selectors,l=r(n.getState(),e);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(h.DELETE,this.name,!0),method:h.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(c(l)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{asset_procedure__project:e}},n)).flat();return this.dispatch(a(r)),r}}class Pg extends v{constructor(){super(...arguments);m(this,"name","Asset Stage");m(this,"url","/asset-stages");m(this,"actions",{addOne:du,addMany:ru,setOne:au,setMany:cu,updateOne:uu,updateMany:lu,deleteOne:ou,deleteMany:hu,initialize:nu});m(this,"selectors",{selectById:yu,selectByIds:pu})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:O(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:V(d),blockers:[d.asset_procedure_type],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(n.getState(),e.uuid);if(!r)throw new Error(`No asset stage with uuid ${e.uuid} found in the store`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${r.uuid}/`,payload:e,blockers:[r.uuid],blocks:[r.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(l,e);if(!u)throw new Error(`No asset stage with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class Fg extends Xe{constructor(){super(...arguments);m(this,"name","Asset Type Attachment");m(this,"url","/asset-type-attachments");m(this,"actions",{addOne:Tu,addMany:qs,setOne:Su,setMany:Iu,updateOne:Ou,updateMany:Pu,deleteOne:Fu,deleteMany:Ds,initialize:fu});m(this,"selectors",{selectById:bu,selectByIds:_u})}getId(e){return e.uuid}buildModel(e){return M({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,asset_type:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,asset_type:e.asset_type}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.assetTypeUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class gg extends v{constructor(){super(...arguments);m(this,"name","Asset Type Fields Attachment");m(this,"url","/asset-type-fields-attachments");m(this,"actions",{addOne:vu,addMany:Vu,setOne:zu,setMany:Bu,updateOne:ju,updateMany:qu,deleteOne:Du,deleteMany:Cu,initialize:Eu});m(this,"selectors",{selectById:Uu,selectByIds:ku})}async bulkAdd(e){var A;const{addMany:n,setMany:a,deleteMany:c}=this.actions,r=new Date().toISOString(),l=((A=this.client.store.getState().userReducer.currentUser)==null?void 0:A.id)??null,u={},d=[],o=[];for(const f of e){const{fieldsRevisionUuid:S,fieldIdentifier:F,file:P}=f,g=await this.client.files.getFilePayload(P);g.sha1 in u||(u[g.sha1]=g);const b=M({file:URL.createObjectURL(P),file_type:P.type,file_name:P.name,file_sha1:g.sha1,created_by:l,fields_revision:S,submitted_at:r,field_identifier:F});d.push(b);const E={uuid:b.uuid,file_name:P.name,field_identifier:F,file_extension:g.extension,file_sha1:g.sha1,fields_revision:S};o.push(E)}this.dispatch(n(d));const y=this.enqueueRequest({description:O(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:o,files:Object.values(u)},blockers:d.map(f=>f.fields_revision),blocks:d.map(f=>f.uuid)});return y.then(f=>{this.client.files.processPresignedUrls(f.presigned_urls),this.dispatch(a(f.attachments))}).catch(()=>{this.dispatch(c(d.map(f=>f.uuid)))}),[d,y.then(({attachments:f})=>f)]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{fields_revision__asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class bg extends v{constructor(){super(...arguments);m(this,"name","Asset Type Fields");m(this,"url","/asset-type-fields");m(this,"actions",{addOne:Hu,addMany:Ku,setOne:Wu,setMany:Yu,updateOne:Zu,updateMany:Ju,deleteOne:Xu,deleteMany:Qu,initialize:Gu});m(this,"selectors",{selectById:el,selectByIds:tl})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:O(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:V(d),blockers:[d.asset_type],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(r(d.uuid)),A}),[d,o]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class _g extends v{constructor(){super(...arguments);m(this,"name","Asset Type Field Values Attachment");m(this,"url","/asset-type-field-values-attachments");m(this,"actions",{addOne:al,addMany:Ns,setOne:cl,setMany:dl,updateOne:rl,updateMany:ul,deleteOne:ll,deleteMany:Gs,initialize:nl});m(this,"selectors",{selectById:hl,selectByIds:ml})}async bulkAdd(e,n){var f;const{addMany:a,setMany:c,deleteMany:r}=this.actions,l=new Date().toISOString(),u=((f=this.client.store.getState().userReducer.currentUser)==null?void 0:f.id)??null,d=Qe(e,Math.min(n??e.length,L)),o=[],y=[];for(const S of d){const F={},P=[];for(const g of S){const{fieldValuesUuid:b,fieldIdentifier:E,file:B}=g,z=await this.client.files.getFilePayload(B);z.sha1 in F||(F[z.sha1]=z);const q=M({file:URL.createObjectURL(B),file_type:B.type,file_name:B.name,file_sha1:z.sha1,created_by:u,field_values:b,submitted_at:l,field_identifier:E});o.push(q);const j={uuid:q.uuid,file_name:B.name,file_sha1:z.sha1,file_extension:z.extension,field_identifier:E,field_values:b};P.push(j)}y.push({submitted_at:l,attachments:P,files:Object.values(F)})}this.dispatch(a(o));const A=y.map(S=>this.enqueueRequest({description:O(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:S,blockers:S.attachments.map(F=>F.field_values),blocks:S.attachments.map(F=>F.uuid)}));return Promise.all(A).then(S=>{for(const P of S)this.client.files.processPresignedUrls(P.presigned_urls);const F=S.flatMap(P=>P.attachments);this.dispatch(c(F))}).catch(S=>{throw this.dispatch(r(o.map(F=>F.uuid))),S}),[o,A.map(S=>S.then(({attachments:F})=>F))]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:r}=this.selectors,l=n.getState(),u=r(l,e);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(h.DELETE,this.name,!0),method:h.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{field_values__asset__project:e,latest:!0}},n)).flat();return this.dispatch(a(r)),r}}class Mg extends v{constructor(){super(...arguments);m(this,"name","Asset Type Field Values");m(this,"url","/asset-type-field-values");m(this,"actions",{addOne:Tl,addMany:Sl,setOne:Il,setMany:Ol,updateOne:Pl,updateMany:Fl,deleteOne:gl,deleteMany:bl,initialize:fl});m(this,"selectors",{selectById:Ml,selectByIds:Rl})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,u=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=new Date().toISOString(),o=M({...e,created_by:u,submitted_at:d}),y=this.enqueueRequest({description:O(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:V(o),blockers:[e.asset,e.fields_revision],blocks:[o.uuid]});return this.dispatch(a(o)),y.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(o.uuid))}),[o,y]}bulkAdd(e,n){var S;const{payloads:a,values:c}=e,{addMany:r,setMany:l,deleteMany:u}=this.actions,d=new Date().toISOString(),o=[],y=Qe(a,Math.min(n??a.length,L)),A=[];for(const F of y){const P=[];for(const g of F){const b=M({...g,values:g.values,created_by:((S=this.client.store.getState().userReducer.currentUser)==null?void 0:S.id)??null,submitted_at:d});o.push(b),P.push({uuid:b.uuid,asset:g.asset,fields_revision:g.fields_revision,published_at:g.published_at,values:b.values})}A.push({submitted_at:d,values:c,field_values:P})}this.dispatch(r(o));const f=[];for(const F of A){const{field_values:P}=F,g=P.map(({asset:z})=>z),b=P.map(({fields_revision:z})=>z),E=P.map(({uuid:z})=>z),B=this.enqueueRequest({description:O(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:F,blockers:g.concat(b),blocks:E});f.push(B)}return Promise.all(f).then(F=>{this.dispatch(l(F.flat()))}).catch(()=>{this.dispatch(u(D(o)))}),[o,f]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=n.getState(),l=c(r,e.uuid);if(!l)throw new Error(`Expected AssetTypeFieldValues with uuid ${e.uuid} to exist`);const u={...l,...e};this.dispatch(a(u));const d=this.enqueueRequest({description:O(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[u.uuid,u.fields_revision,u.asset],blocks:[u.uuid]});return d.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(a(l))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(l,e);if(!u)throw new Error(`Expected submission with uuid ${e} to exist`);const d=yl(l,e);this.dispatch(a(e)),this.dispatch(Gs(D(d)));try{return await this.enqueueRequest({description:O(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(o){throw this.dispatch(c(u)),this.dispatch(Ns(d)),o}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{asset__project:e,latest:!0}},n)).flat();return this.dispatch(a(r)),r}}class Rg extends v{constructor(){super(...arguments);m(this,"name","Asset Type Identifier");m(this,"url","/asset-type-identifiers");m(this,"actions",{addOne:Vl,addMany:zl,setOne:Bl,setMany:jl,updateOne:ql,updateMany:Dl,deleteOne:Cl,deleteMany:$l,initialize:vl});m(this,"selectors",{selectById:kl,selectByIds:Ll})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:O(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:V(d),blockers:[d.asset_type],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(n.getState(),e.uuid);if(!r)throw new Error(`Expected asset type identifier with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(l,e);if(!u)throw new Error(`Expected asset type identifier with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class wg extends v{constructor(){super(...arguments);m(this,"name","Asset Type Identifier Value");m(this,"url","/asset-type-identifier-values");m(this,"actions",{addOne:Kl,addMany:Wl,setOne:Yl,setMany:Zl,updateOne:Jl,updateMany:Xl,deleteOne:Ql,deleteMany:xl,initialize:Hl});m(this,"selectors",{selectById:to,selectByIds:so})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:O(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:V(d),blockers:[e.asset,e.asset_type_identifier],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(n.getState(),e.uuid);if(!r)throw new Error(`Expected asset type identifier value with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(l,e);if(!u)throw new Error(`Expected asset type identifier value with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{asset__project:e}},n)).flat();return this.dispatch(a(r)),r}}class Eg extends v{constructor(){super(...arguments);m(this,"name","Asset Type");m(this,"url","/asset-types");m(this,"actions",{addOne:uo,addMany:lo,setOne:co,setMany:ro,updateOne:oo,updateMany:ho,deleteOne:mo,deleteMany:yo,initialize:ao});m(this,"selectors",{selectById:Ao,selectByIds:fo})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:O(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:V(d),blockers:[],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(n.getState(),e.uuid);if(!r)throw new Error(`Expected asset type with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[r.uuid],blocks:[r.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(l,e);if(!u)throw new Error(`Expected asset type with uuid ${e} to exist`);const d=Es(l,e),o=Mu(l,e);this.dispatch(a(e)),this.dispatch(Rs(D(d))),this.dispatch(Ds(D(o)));try{return await this.enqueueRequest({description:O(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(y){throw this.dispatch(c(u)),this.dispatch(Ms(d)),this.dispatch(qs(o)),y}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class vg extends v{constructor(){super(...arguments);m(this,"name","Asset Type Status");m(this,"url","/asset-type-statuses");m(this,"actions",{addOne:Oo,addMany:Po,setOne:Fo,setMany:go,updateOne:bo,updateMany:_o,deleteOne:Mo,deleteMany:Ro,initialize:Io});m(this,"selectors",{selectById:Eo,selectByIds:vo})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:O(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:V(d),blockers:[e.asset_type],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.client.store.getState(),r=a(c,e.uuid);if(!r)throw new Error(`Expected an existing asset type status with uuid ${e.uuid}`);const l={...r,...e};this.dispatch(n(l));const u=this.enqueueRequest({description:O(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(n.getState(),e);if(!l)throw new Error(`No asset type status with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(l)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class Vg extends v{constructor(){super(...arguments);m(this,"name","Category");m(this,"url","/categories");m(this,"actions",{addOne:Co,addMany:$o,setOne:Uo,setMany:ko,updateOne:Lo,updateMany:No,deleteOne:Go,deleteMany:Ho,initialize:Do});m(this,"selectors",{selectById:si,selectByIds:Wo})}add(e){var y;const{store:n}=this.client,{addOne:a,updateOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:O(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:V(d),blockers:[e.project],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}update(e){const{updateOne:n}=this.actions,{selectById:a}=this.selectors,c=this.client.store.getState(),r=a(c,e.uuid);if(!r)throw new Error(`Expected an existing category with uuid ${e.uuid}`);const l={...r,...e};this.dispatch(n(l));const u=this.enqueueRequest({description:O(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(n.getState(),e);if(!l)throw new Error(`No category with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${l.uuid}/`,blockers:[l.uuid],blocks:[]})}catch(u){throw this.dispatch(c(l)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{project__organization:e}},n);return this.dispatch(a(c)),c}}class zg extends Xe{constructor(){super(...arguments);m(this,"name","Document Attachment");m(this,"url","/document-attachments");m(this,"actions",{addOne:Xo,addMany:Qo,setOne:xo,setMany:eh,updateOne:th,updateMany:sh,deleteOne:ih,deleteMany:nh,initialize:Jo});m(this,"selectors",{selectById:ch,selectByIds:dh})}getId(e){return e.uuid}buildModel(e){return M({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,document:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,document:e.document}}async bulkAdd(e){var S;const{store:n}=this.client,{addMany:a,updateMany:c,deleteMany:r}=this.actions,l=((S=n.getState().userReducer.currentUser)==null?void 0:S.id)??null,u=new Date().toISOString(),d=[],o=[],y={},A={};for(const F of e){const{documentUuid:P,file:g}=F,b=await this.client.files.getFilePayload(g);b.sha1 in y||(y[b.sha1]=b,A[b.sha1]=[]);const E=this.buildModel({file:g,file_sha1:b.sha1,submitted_at:u,created_by:l,modelUuid:P});d.push(E),o.push(this.buildPayload(E,b)),A[b.sha1].push(E.uuid)}this.dispatch(a(d));const f=this.enqueueRequest({description:O(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{submitted_at:u,attachments:o,files:Object.values(y)},blocks:d.map(F=>F.uuid),blockers:d.map(F=>F.file_sha1)});return f.then(({attachments:F,presigned_urls:P})=>{this.dispatch(c(F));const g=this.client.files.processPresignedUrls(P);for(const[b,E]of Object.entries(g))E.then(()=>{const B=A[b];for(const z of B)this.makeReadable(z)})}).catch(()=>{this.dispatch(r(d.map(F=>F.uuid)))}),[d,f.then(({attachments:F})=>F)]}async delete(e){return this._delete(e)}makeReadable(e){this.enqueueRequest({description:"Add attachment to AI assistant",method:h.PATCH,url:`${this.url}/${e}/`,payload:{readable_to_assistant:!0},blockers:["index-document-attachment",e],blocks:["index-document-attachment"]})}async refreshStore(e,n){const{initialize:a}=this.actions,c=this.list({queryParams:{document__project__organization:e}},n),r=this.list({queryParams:{document__organization:e}},n),u=(await Promise.all([c,r])).flat();return this.dispatch(a(u)),u}}class Bg extends v{constructor(){super(...arguments);m(this,"name","Document");m(this,"url","/documents");m(this,"actions",{addOne:oh,addMany:hh,setOne:mh,setMany:yh,updateOne:ph,updateMany:Ah,deleteOne:fh,deleteMany:Th,initialize:lh});m(this,"selectors",{selectById:Ih,selectByIds:Oh})}add(e){var y;const{store:n}=this.client,{addOne:a,deleteOne:c,updateOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:O(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:V(d),blockers:d.parent_document?[d.parent_document]:[],blocks:[d.uuid]});return o.then(A=>{this.dispatch(r(A))}).catch(()=>{this.dispatch(c(d.uuid))}),[d,o]}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:c}=this.selectors,r=c(n.getState(),e.uuid);if(!r)throw new Error(`attempting to update a document with uuid ${e.uuid} that does not exist in store.documents`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c,addMany:r,deleteMany:l}=this.actions,{selectById:u}=this.selectors,d=n.getState(),o=u(d,e);if(!o)throw new Error(`attempting to delete a document with uuid ${e} that does not exist in store.documents`);const y=Ph(d,e);this.dispatch(a(e)),this.dispatch(l(D(y)));try{return await this.enqueueRequest({description:O(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(A){throw this.dispatch(c(o)),this.dispatch(r(y)),A}}async refreshStore(e,n){const{initialize:a}=this.actions,c=this.list({queryParams:{project__organization:e}},n),r=this.list({queryParams:{organization:e}},n),u=(await Promise.all([c,r])).flat();return this.dispatch(a(u)),u}}class at extends et{async get(s,e){return this.performRequest({url:`${this.url}/${s}/`,method:h.GET},e)}async list(s,e){return this.performRequest({url:`${this.url}/`,method:h.GET,...s},e)}async listPaginated(s,e){return this.performPagination({url:`${this.url}/`,method:h.GET,...s},e)}}class jg extends at{constructor(){super(...arguments);m(this,"name","Email Domains");m(this,"url","/organization-email-domains");m(this,"actions",{addOne:bh,addMany:_h,setOne:Mh,setMany:Rh,updateOne:wh,updateMany:Eh,deleteOne:vh,deleteMany:Vh,initialize:gh});m(this,"selectors",{selectById:Bh,selectByIds:jh})}async add(e,n){return this.enqueueRequest({description:O(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:{email:n,organization:e},blockers:[e,"create-org"],blocks:[]})}async delete(e){const{deleteOne:n,addOne:a}=this.actions;this.dispatch(n(e.uuid));try{return await this.enqueueRequest({description:O(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e.uuid}/`,blockers:[e.domain],blocks:[]})}catch(c){throw this.dispatch(a(e)),c}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class qg extends et{async getVerificationCode(s){return this.enqueueRequest({description:"Get verification code",method:h.GET,url:`/verification/email-verification/${s}/`,isAuthNeeded:!1,blockers:[],blocks:[]})}validateVerificationCode(s,e=void 0){return this.enqueueRequest({description:"Validate verification code",method:h.POST,url:`/verification/email-verification/${s}/`,isAuthNeeded:!1,payload:e,blockers:[],blocks:[]})}}const $t={},Dn=new Set;let Ut=0,Cn=0,$n=0;const Dg=20;class Cg extends et{constructor(){super(...arguments);m(this,"host");m(this,"_dbPromise",BO.openDB("fileCache",1,{upgrade(e){e.createObjectStore("files")}}))}async renewUploadUrl(e){const n=await this.fetchCache(e);if(!n)throw new Error(`File with sha1 ${e} not found in cache`);const a=await Yt(n,e),c=await this.enqueueRequest({description:"Get S3 URL",method:h.GET,url:"/authentication/files/presigned-upload-url/",queryParams:{sha1:await it(n),file_type:n.type,extension:n.name.split(".").pop(),size:n.size.toString()},blockers:[],blocks:[`s3-${a}`]});return"url"in c&&this.dispatch($h({sha1:e,...c})),c}async addCache(e,n){if(Dn.has(n))return;if(!e.type){const r=e.name.split("."),l=r[r.length-1];e=new File([e],e.name,{type:l})}if(!e.name||!e.size||!e.type)throw new Error("Cannot add files to cache that do not have a name, size and type.");const a=await this._dbPromise;!!await a.get("files",n)?(console.error("File already cached (this is unexpected at this point):",e.name,n),Ut++):(await a.put("files",e,n),Cn++),Dn.add(n),$n++,$n%Dg===0&&console.debug(`File cache summary: ${Ut} hits and ${Cn} misses, ${Ut/(Ut+Cn)*100}% hit rate over ${$n} calls to addCache.`)}async removeCache(e){await(await this._dbPromise).delete("files",e),Dn.delete(e)}async fetchCache(e){return(await this._dbPromise).get("files",e)}async getOrRenewUploadUrl(e){const n=this.client.store.getState();return Uh(n,e)??await this.renewUploadUrl(e)}async uploadFileToS3(e){const n=await this.fetchCache(e);if(!n)throw new Error(`File with sha1 ${e} not found in cache`);const a=await Yt(n,e),c={file_name:n.name,file_sha1:e,file:a},r=await this.getOrRenewUploadUrl(e);if("warning"in r){if(r.warning==="already_uploaded")return[c,Promise.resolve(void 0)];throw new Error(r.warning)}const l=r.url,u=this.enqueueRequest({url:l,description:"Upload file",method:h.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:e,blockers:[`s3-${a}`],blocks:[e],s3url:r});return[c,u]}async fetchFileFromUrl(e,n,a){const c=e.split("?")[0]??e,r=await this.fetchCache(n);if(r){if(!r.name)throw new Error("Cached file unexpectedly has no name.");return r}if(e.startsWith("blob:")){const o=await ca(e),y=new File([o],a??n,{type:o.type});return await this.addCache(y,n),y}let l=$t[c],u=!0;l?u=!1:(l=new Promise(o=>{this.enqueueRequest({description:"Download file",method:h.GET,url:e,isExternalUrl:!0,isResponseBlob:!0,isAuthNeeded:!1,blockers:[n],blocks:[n]}).then(y=>{const A=new File([y],a??n,{type:y.type});o(A)})}),$t[c]=l);let d;try{d=await l}catch(o){throw u&&o instanceof U&&delete $t[c],o}if(u){const o=await it(d);if(o!==n){const f=`The hash of the file returned from the server (${o}) does not match the
8
+ `)}catch(a){console.error("Failed to extract error message from response body",a)}}else typeof t.body=="string"&&(e=t.body);else t!=null&&t.text?e=t.text:s instanceof Error&&(e=s.message);return!e||e.length>ag?at:e}class k extends Error{constructor(e){super(at);m(this,"status");m(this,"response");m(this,"message");m(this,"options");const{response:n,innerError:a}=e;this.message=e.message??cg(n,a)??at,this.status=(n==null?void 0:n.status)??0,this.response=n,e.discard=e.discard??!1,this.options=e}}function fO(t){function s(e){return typeof e=="object"&&e!==null&&["ok","redirect","clientError","serverError","error"].every(a=>a in e)}if(s(t))return t;if(typeof t=="object"&&t!==null){const e=t;if(s(e.response))return e.response;if(e.response&&s(e.response.response))return e.response.response}}class dg extends dO{constructor(s){super(s)}}class tt extends dO{constructor(e,n){super(e);m(this,"auth");this.auth=n}}class rg extends tt{async startConversation(s,e){return this.enqueueRequest({description:"Start agent conversation",method:h.POST,url:"/agents/prompt/",payload:{prompt:s,active_project:e},blockers:["prompt"],blocks:["prompt"]}).then(n=>(this.dispatch(ya(n)),n))}async continueConversation(s,e,n){return this.enqueueRequest({description:"Prompt agent",method:h.POST,url:"/agents/prompt/",payload:{prompt:s,active_project:n},blockers:["prompt"],blocks:["prompt"],queryParams:{conversation_id:e}}).then(a=>{this.dispatch(Aa(a))})}async fetchDetails(s){return this.enqueueRequest({description:"Get agent conversation",method:h.GET,url:`/agents/conversations/${s}/`,blockers:["conversation"],blocks:["conversation"]}).then(e=>{this.dispatch(pa(e))})}async rate(s,e){return this.enqueueRequest({description:"Rate agent response",method:h.PUT,url:`/agents/responses/${s}/rate/`,payload:{rating:e},blockers:["rate"],blocks:["rate"]})}async list(s,e){return this.performRequest({method:h.GET,url:"/agents/conversations/",...s},e)}async refreshStore(s,e){const n=await this.list({queryParams:{project:s}},e);return this.dispatch(ma(n)),n}}function P(t,s,e){const n=`${s}${e?"s":""}`;switch(t){case h.GET:return`Get ${n}`;case h.POST:return`Create ${n}`;case h.PATCH:return`Update ${n}`;case h.PUT:return`Update ${n}`;case h.DELETE:return`Delete ${n}`}}class V extends tt{async get(s,e){return this.performRequest({url:`${this.url}/${s}/`,method:h.GET},e)}async list(s,e){return this.performRequest({url:`${this.url}/`,method:h.GET,...s},e)}async listPaginated(s,e){return this.performPagination({url:`${this.url}/`,method:h.GET,...s},e)}}class Qe extends V{constructor(){super(...arguments);m(this,"pageSize",aO)}async _bulkAdd(e){var f;const{store:n}=this.client,{addMany:a,updateMany:c,deleteMany:r}=this.actions,l=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,u=new Date().toISOString(),d=[],o=[],y={};for(const I of e){const{modelUuid:g,file:F}=I,b=await this.client.files.getFilePayload(F);b.sha1 in y||(y[b.sha1]=b);const _=this.buildModel({file:F,file_sha1:b.sha1,submitted_at:u,created_by:l,modelUuid:g});d.push(_),o.push(this.buildPayload(_,b))}this.dispatch(a(d));const A=this.enqueueRequest({description:P(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{submitted_at:u,attachments:o,files:Object.values(y)},blocks:d.map(I=>this.getId(I)),blockers:d.map(I=>I.file_sha1)});return A.then(({attachments:I,presigned_urls:g})=>{this.dispatch(c(I)),this.client.files.processPresignedUrls(g)}).catch(()=>{this.dispatch(r(d.map(I=>this.getId(I))))}),[d,A.then(({attachments:I})=>I)]}async _delete(e){const{store:n}=this.client,{addOne:a,deleteOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`Attempting to delete attachment with uuid ${e} that does not exist in the store`);this.dispatch(c(this.getId(l)));const u=this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return u.then(()=>{this.client.files.removeCache(l.file_sha1)}).catch(()=>{this.dispatch(a(l))}),u}}class ug extends Qe{constructor(){super(...arguments);m(this,"name","Asset attachment");m(this,"url","/asset-attachments");m(this,"actions",{addOne:Ia,addMany:Qt,setOne:Oa,setMany:Pa,updateOne:Fa,updateMany:ga,deleteOne:ba,deleteMany:xt,initialize:Ta});m(this,"selectors",{selectById:Ma,selectByIds:Ra})}getId(e){return e.uuid}buildModel(e){return R({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,asset:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,asset:e.asset}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.assetUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{asset__project:e}},n)).flat();return this.dispatch(a(r)),r}}class lg extends Qe{constructor(){super(...arguments);m(this,"name","Asset Procedure Attachment");m(this,"url","/asset-procedure-type-attachments");m(this,"actions",{addOne:za,addMany:Ba,setOne:ja,setMany:qa,updateOne:Da,updateMany:Ca,deleteOne:$a,deleteMany:Ua,initialize:Va});m(this,"selectors",{selectById:Na,selectByIds:Ga})}getId(e){return e.uuid}buildModel(e){return R({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,asset_procedure_type:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,asset_procedure_type:e.asset_procedure_type}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.assetProcedureTypeUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class og extends V{constructor(){super(...arguments);m(this,"name","Asset Procedure Type Fields Attachment");m(this,"url","/asset-procedure-type-fields-attachments");m(this,"actions",{addOne:Wa,addMany:Ya,setOne:Za,setMany:Ja,updateOne:Xa,updateMany:Qa,deleteOne:xa,deleteMany:ec,initialize:Ka});m(this,"selectors",{selectById:ic,selectByIds:nc})}async bulkAdd(e){var A;const{addMany:n,setMany:a,deleteMany:c}=this.actions,r=new Date().toISOString(),l=((A=this.client.store.getState().userReducer.currentUser)==null?void 0:A.id)??null,u={},d=[],o=[];for(const f of e){const{fieldsRevisionUuid:I,fieldIdentifier:g,file:F}=f,b=await this.client.files.getFilePayload(F);b.sha1 in u||(u[b.sha1]=b);const _=R({file:URL.createObjectURL(F),file_type:F.type,file_name:F.name,file_sha1:b.sha1,created_by:l,fields_revision:I,submitted_at:r,field_identifier:g});d.push(_);const v={uuid:_.uuid,file_name:F.name,field_identifier:g,file_extension:b.extension,file_sha1:b.sha1,fields_revision:I};o.push(v)}this.dispatch(n(d));const y=this.enqueueRequest({description:P(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:o,files:Object.values(u)},blockers:d.map(f=>f.fields_revision),blocks:d.map(f=>f.uuid)});return y.then(f=>{this.client.files.processPresignedUrls(f.presigned_urls),this.dispatch(a(f.attachments))}).catch(()=>{this.dispatch(c(d.map(f=>f.uuid)))}),[d,y.then(({attachments:f})=>f)]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{fields_revision__asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class hg extends V{constructor(){super(...arguments);m(this,"name","Asset Procedure Type Fields");m(this,"url","/asset-procedure-type-fields");m(this,"actions",{addOne:dc,addMany:rc,setOne:uc,setMany:lc,updateOne:oc,updateMany:hc,deleteOne:mc,deleteMany:yc,initialize:cc});m(this,"selectors",{selectById:fc,selectByIds:Sc})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=R({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(d),blockers:[d.asset_procedure_type],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(r(d.uuid)),A}),[d,o]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}function xe(t,s){const e=[];let n=0;const a=t.length;for(;n<a;)e.push(t.slice(n,n+=s));return e}class mg extends V{constructor(){super(...arguments);m(this,"name","Asset Procedure Type Field Values Attachment");m(this,"url","/asset-procedure-type-field-values-attachments");m(this,"actions",{addOne:Oc,addMany:ds,setOne:Pc,setMany:Fc,updateOne:gc,updateMany:bc,deleteOne:_c,deleteMany:rs,initialize:Ic});m(this,"selectors",{selectById:wc,selectByIds:Ec})}async bulkAdd(e,n){var f;const{addMany:a,setMany:c,deleteMany:r}=this.actions,l=new Date().toISOString(),u=((f=this.client.store.getState().userReducer.currentUser)==null?void 0:f.id)??null,d=xe(e,Math.min(n??e.length,N)),o=[],y=[];for(const I of d){const g={},F=[];for(const b of I){const{fieldValuesUuid:_,fieldIdentifier:v,file:j}=b,B=await this.client.files.getFilePayload(j);B.sha1 in g||(g[B.sha1]=B);const D=R({file:URL.createObjectURL(j),file_type:j.type,file_name:j.name,file_sha1:B.sha1,created_by:u,field_values:_,submitted_at:l,field_identifier:v});o.push(D);const q={uuid:D.uuid,file_name:j.name,file_sha1:B.sha1,file_extension:B.extension,field_identifier:v,field_values:_};F.push(q)}y.push({submitted_at:l,attachments:F,files:Object.values(g)})}this.dispatch(a(o));const A=y.map(I=>this.enqueueRequest({description:P(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:I,blockers:I.attachments.map(g=>g.field_values),blocks:I.attachments.map(g=>g.uuid)}));return Promise.all(A).then(I=>{for(const F of I)this.client.files.processPresignedUrls(F.presigned_urls);const g=I.flatMap(F=>F.attachments);this.dispatch(c(g))}).catch(I=>{throw this.dispatch(r(o.map(g=>g.uuid))),I}),[o,A.map(I=>I.then(({attachments:g})=>g))]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:r}=this.selectors,l=n.getState(),u=r(e)(l);this.dispatch(a(e));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!0),method:h.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{field_values__asset_procedure__project:e,latest:!0}},n)).flat();return this.dispatch(a(r)),r}}class yg extends V{constructor(){super(...arguments);m(this,"name","Asset Procedure Type Field Values");m(this,"url","/asset-procedure-type-field-values");m(this,"actions",{addOne:Bc,addMany:jc,setOne:qc,setMany:Dc,updateOne:Cc,updateMany:$c,deleteOne:Uc,deleteMany:kc,initialize:zc});m(this,"selectors",{selectById:Gc,selectByIds:Hc})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,u=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=new Date().toISOString(),o=R({...e,created_by:u,submitted_at:d}),y=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(o),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[o.uuid]});return this.dispatch(a(o)),y.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(o.uuid))}),[o,y]}bulkAdd(e,n){var g;const{values:a,payloads:c}=e,{addMany:r,setMany:l,deleteMany:u}=this.actions,d=new Date().toISOString(),o=((g=this.client.store.getState().userReducer.currentUser)==null?void 0:g.id)??null,y=[],A=xe(c,Math.min(n??c.length,N)),f=[];for(const F of A){const b=[];for(const _ of F){const v=R({..._,values:_.values,created_by:o,submitted_at:d});y.push(v),b.push({uuid:v.uuid,asset:_.asset,fields_revision:_.fields_revision,asset_procedure:_.asset_procedure,published_at:_.published_at,values:v.values})}f.push({submitted_at:d,values:a,field_values:b})}this.dispatch(r(y));const I=[];for(const F of f){const{field_values:b}=F,_=b.map(({asset:q})=>q),v=b.map(({fields_revision:q})=>q),j=b.map(({asset_procedure:q})=>q),B=b.map(({uuid:q})=>q),D=this.enqueueRequest({description:P(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:F,blockers:_.concat(v).concat(j),blocks:B});I.push(D)}return Promise.all(I).then(F=>{this.dispatch(l(F.flat()))}).catch(()=>{this.dispatch(u(C(y)))}),[y,I]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=n.getState(),l=c(e.uuid)(r);if(!l)throw new Error(`Expected AssetProcedureTypeFieldValues with uuid ${e.uuid} to exist`);const u={...l,...e};this.dispatch(a(u));const d=this.enqueueRequest({description:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[u.fields_revision,u.asset,u.asset_procedure],blocks:[u.uuid]});return d.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(a(l))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected submission with uuid ${e} to exist`);const d=vc(e)(l);this.dispatch(a(e)),this.dispatch(rs(C(d)));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(o){throw this.dispatch(c(u)),this.dispatch(ds(d)),o}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{asset_procedure__project:e,latest:!0}},n)).flat();return this.dispatch(a(r)),r}}class pg extends V{constructor(){super(...arguments);m(this,"name","Asset Procedure");m(this,"url","/asset-procedures");m(this,"actions",{addOne:Yc,addMany:hs,setOne:Qc,setMany:xc,updateOne:Zc,updateMany:Jc,deleteOne:Xc,deleteMany:ms,initialize:Wc});m(this,"selectors",{selectById:id,selectByIds:nd})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=R({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(d),blockers:[e.asset_procedure_type,e.asset_type],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected asset procedure with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[r.uuid],blocks:[r.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected asset procedure with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(r)),r}}class Ag extends V{constructor(){super(...arguments);m(this,"name","Asset Procedure Type");m(this,"url","/asset-procedure-types");m(this,"actions",{addOne:dd,addMany:rd,setOne:md,setMany:yd,updateOne:ud,updateMany:ld,deleteOne:od,deleteMany:hd,initialize:cd});m(this,"selectors",{selectById:fd,selectByIds:Sd})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=R({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(d),blockers:[],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected asset procedure type with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[r.uuid],blocks:[r.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected asset procedure type with uuid ${e} to exist`);const d=sd(e)(l);this.dispatch(a(e)),this.dispatch(ms(C(d)));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(o){throw this.dispatch(c(u)),this.dispatch(hs(d)),o}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class fg extends V{constructor(){super(...arguments);m(this,"name","Asset Procedure Step Fields Attachment");m(this,"url","/asset-procedure-step-fields-attachments");m(this,"actions",{addOne:Od,addMany:Pd,setOne:Fd,setMany:gd,updateOne:bd,updateMany:_d,deleteOne:Md,deleteMany:Rd,initialize:Id});m(this,"selectors",{selectById:Ed,selectByIds:vd})}async bulkAdd(e){var A;const{addMany:n,setMany:a,deleteMany:c}=this.actions,r=new Date().toISOString(),l=((A=this.client.store.getState().userReducer.currentUser)==null?void 0:A.id)??null,u={},d=[],o=[];for(const f of e){const{fieldsRevisionUuid:I,fieldIdentifier:g,file:F}=f,b=await this.client.files.getFilePayload(F);b.sha1 in u||(u[b.sha1]=b);const _=R({file:URL.createObjectURL(F),file_type:F.type,file_name:F.name,file_sha1:b.sha1,created_by:l,fields_revision:I,submitted_at:r,field_identifier:g});d.push(_);const v={uuid:_.uuid,file_name:F.name,field_identifier:g,file_extension:b.extension,file_sha1:b.sha1,fields_revision:I};o.push(v)}this.dispatch(n(d));const y=this.enqueueRequest({description:P(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:o,files:Object.values(u)},blockers:d.map(f=>f.fields_revision),blocks:d.map(f=>f.uuid)});return y.then(f=>{this.client.files.processPresignedUrls(f.presigned_urls),this.dispatch(a(f.attachments))}).catch(()=>{this.dispatch(c(d.map(f=>f.uuid)))}),[d,y.then(({attachments:f})=>f)]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{fields_revision__asset_procedure_step__organization:e}},n);return this.dispatch(a(c)),c}}class Sg extends V{constructor(){super(...arguments);m(this,"name","Asset Procedure Step Fields");m(this,"url","/asset-procedure-step-fields");m(this,"actions",{addOne:jd,addMany:qd,setOne:Dd,setMany:Cd,updateOne:$d,updateMany:Ud,deleteOne:kd,deleteMany:Ld,initialize:Bd});m(this,"selectors",{selectById:Nd,selectByIds:Gd})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=R({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(d),blockers:[d.asset_procedure_step],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(r(d.uuid)),A}),[d,o]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,c=n.getState().assetProcedureStepFieldsReducer.instances[e.uuid];if(!c)throw new Error(`AssetProcedureStepFields with uuid ${e.uuid} not found`);const r={...c,...e};this.dispatch(a(r));const l=this.enqueueRequest({description:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${c.uuid}/`,payload:e,blockers:[c.uuid],blocks:[c.uuid]});return l.then(u=>{this.dispatch(a(u))}).catch(u=>{throw this.dispatch(a(c)),u}),[r,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,r=n.getState().assetProcedureStepFieldsReducer.instances[e];if(!r)throw new Error(`AssetProcedureStepFields with uuid ${e} not found`);this.dispatch(a(e));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(l){throw this.dispatch(c(r)),l}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_step__asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class Tg extends V{constructor(){super(...arguments);m(this,"name","Asset Procedure Step Field Values Attachment");m(this,"url","/asset-procedure-step-field-values-attachments");m(this,"actions",{addOne:Yd,addMany:Os,setOne:Zd,setMany:Jd,updateOne:Xd,updateMany:Qd,deleteOne:xd,deleteMany:Ps,initialize:Wd});m(this,"selectors",{selectById:tr,selectByIds:sr})}async bulkAdd(e,n){var f;const{addMany:a,setMany:c,deleteMany:r}=this.actions,l=new Date().toISOString(),u=((f=this.client.store.getState().userReducer.currentUser)==null?void 0:f.id)??null,d=xe(e,Math.min(n??e.length,N)),o=[],y=[];for(const I of d){const g={},F=[];for(const b of I){const{fieldValuesUuid:_,fieldIdentifier:v,file:j}=b,B=await this.client.files.getFilePayload(j);B.sha1 in g||(g[B.sha1]=B);const D=R({file:URL.createObjectURL(j),file_type:j.type,file_name:j.name,file_sha1:B.sha1,created_by:u,field_values:_,submitted_at:l,field_identifier:v});o.push(D);const q={uuid:D.uuid,file_name:j.name,file_sha1:B.sha1,file_extension:B.extension,field_identifier:v,field_values:_};F.push(q)}y.push({submitted_at:l,attachments:F,files:Object.values(g)})}this.dispatch(a(o));const A=y.map(I=>this.enqueueRequest({description:P(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:I,blockers:I.attachments.map(g=>g.field_values),blocks:I.attachments.map(g=>g.uuid)}));return Promise.all(A).then(I=>{for(const F of I)this.client.files.processPresignedUrls(F.presigned_urls);const g=I.flatMap(F=>F.attachments);this.dispatch(c(g))}).catch(I=>{throw this.dispatch(r(o.map(g=>g.uuid))),I}),[o,A.map(I=>I.then(({attachments:g})=>g))]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:r}=this.selectors,l=n.getState(),u=r(e)(l);this.dispatch(a(e));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!0),method:h.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{field_values__asset_procedure__project:e,latest:!0}},n)).flat();return this.dispatch(a(r)),r}}class Ig extends V{constructor(){super(...arguments);m(this,"name","Asset Procedure Step Field Values");m(this,"url","/asset-procedure-step-field-values");m(this,"actions",{addOne:dr,addMany:rr,setOne:ur,setMany:lr,updateOne:or,updateMany:hr,deleteOne:mr,deleteMany:yr,initialize:cr});m(this,"selectors",{selectById:Ar,selectByIds:fr})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,u=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=new Date().toISOString(),o=R({...e,created_by:u,submitted_at:d}),y=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(o),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[o.uuid]});return this.dispatch(a(o)),y.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(o.uuid))}),[o,y]}bulkAdd(e,n){var g;const{payloads:a,values:c}=e,{addMany:r,setMany:l,deleteMany:u}=this.actions,d=new Date().toISOString(),o=((g=this.client.store.getState().userReducer.currentUser)==null?void 0:g.id)??null,y=[],A=xe(a,Math.min(n??a.length,N)),f=[];for(const F of A){const b=[];for(const _ of F){const v=R({..._,values:_.values,created_by:o,submitted_at:d});y.push(v),b.push({uuid:v.uuid,asset:_.asset,fields_revision:_.fields_revision,asset_procedure:_.asset_procedure,asset_procedure_step:_.asset_procedure_step,published_at:_.published_at,values:v.values})}f.push({submitted_at:d,values:c,field_values:b})}this.dispatch(r(y));const I=[];for(const F of f){const{field_values:b}=F,_=b.map(({asset:q})=>q),v=b.map(({fields_revision:q})=>q),j=b.map(({asset_procedure:q})=>q),B=b.map(({uuid:q})=>q),D=this.enqueueRequest({description:P(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:F,blockers:_.concat(v).concat(j),blocks:B});I.push(D)}return Promise.all(I).then(F=>{this.dispatch(l(F.flat()))}).catch(()=>{this.dispatch(u(C(y)))}),[y,I]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=n.getState(),l=c(e.uuid)(r);if(!l)throw new Error(`Expected AssetProcedureStepFieldValues with uuid ${e.uuid} to exist`);const u={...l,...e};this.dispatch(a(u));const d=this.enqueueRequest({description:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[u.fields_revision,u.asset,u.asset_procedure],blocks:[u.uuid]});return d.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(a(l))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected submission with uuid ${e} to exist`);const d=ir(e)(l);this.dispatch(a(e)),this.dispatch(Ps(C(d)));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(o){throw this.dispatch(c(u)),this.dispatch(Os(d)),o}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{asset_procedure__project:e,latest:!0}},n)).flat();return this.dispatch(a(r)),r}}class Og extends V{constructor(){super(...arguments);m(this,"name","Asset Procedure Step");m(this,"url","/asset-procedure-steps");m(this,"actions",{addOne:Fr,addMany:gr,setOne:Or,setMany:Pr,updateOne:br,updateMany:_r,deleteOne:Mr,deleteMany:Rr,initialize:Ir});m(this,"selectors",{selectById:Er,selectByIds:vr})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=R({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(d),blockers:[d.asset_procedure_type],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`No asset procedure step with uuid ${e.uuid} found in the store`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${r.uuid}/`,payload:{name:e.name,description:e.description,priority:e.order,color:e.color},blockers:[r.uuid],blocks:[r.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteMany:a,addMany:c,addOne:r,deleteOne:l}=this.actions,{selectById:u}=this.selectors,d=n.getState(),o=u(e)(d);if(!o)throw new Error(`No asset procedure step with uuid ${e} found in the store`);const y=Vr(e)(d);this.dispatch(l(e)),this.dispatch(a(C(y)));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(A){throw this.dispatch(r(o)),this.dispatch(c(y)),A}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class Pg extends V{constructor(){super(...arguments);m(this,"url","/assets");m(this,"name","Asset");m(this,"actions",{addOne:jr,addMany:Rs,setOne:$r,setMany:Ur,updateOne:qr,updateMany:Dr,deleteOne:Cr,deleteMany:ws,initialize:Br});m(this,"selectors",{selectById:Lr,selectByIds:Nr})}add(e){var y;const{store:n}=this.client,{addOne:a,updateOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=R({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(d),blockers:[d.asset_type],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`No asset with uuid ${e.uuid} found in the store`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{addOne:a,deleteOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`No asset with uuid ${e} found in the store`);const d=wa(e)(l),o=tp(e)(l);this.dispatch(c(e)),this.dispatch(xt(C(d))),this.dispatch(vt(C(o)));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(y){throw this.dispatch(a(u)),this.dispatch(Qt(d)),this.dispatch(Et(o)),y}}bulkAdd(e,n){const{addMany:a}=this.actions,c=new Date().toISOString(),r=et.v4(),l=xe(e,Math.min(n??e.length,N)).map(o=>{const y=o.map(A=>R(A));return{batchId:et.v4(),payload:{transaction_id:r,submitted_at:c,assets:y}}}),u=[];let d=null;for(const o of l){const{batchId:y,payload:A}=o,f=A.assets.map(({uuid:v})=>v),I=A.assets.map(({asset_type:v})=>v),g=A.assets.map(({project:v})=>v),F=I.concat(g);d&&F.push(d);const b=f;b.push(y);const _=this.enqueueRequest({description:P(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:A,blockers:F,blocks:b});d=o.batchId,u.push(_)}return Promise.all(u).then(o=>{const y=o.flat();this.dispatch(a(y))}),u}bulkUpdate(e,n){const{store:a}=this.client,{updateMany:c}=this.actions,{selectByIds:r}=this.selectors,l=C(e).toSorted(ft);if(l.length!==e.length)throw new Error("payloads contains duplicate uuids.");const u=r(l)(a.getState()).toSorted(Yt);if(l.length!=u.length)throw new Error(`Attempting to bulk update ${l.length-u.length} assets that dont exist in the store`);const d=[];for(let f=0;f<l.length;f++)d.push({...u[f],...e[f]});this.dispatch(c(d));const o=xe(e,Math.min(n??e.length,N)),y=[];let A=null;for(const f of o){const I=et.v4(),g=C(f),F=f.map(({status:_})=>_).filter(Boolean),b=this.enqueueRequest({description:P(h.PATCH,this.name,!0),method:h.PATCH,url:`${this.url}/bulk/`,payload:{payloads:f},blockers:g.concat(F).concat(A?[A]:[]),blocks:g.concat([I])});y.push(b),A=I}return Promise.all(y).then(f=>{this.dispatch(c(f.flat()))}).catch(()=>{this.dispatch(c(u))}),[d,y]}async bulkDelete(e){const{store:n}=this.client,{addMany:a,deleteMany:c}=this.actions,{selectByIds:r}=this.selectors,l=n.getState(),u=r(e)(l);this.dispatch(c(e));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!0),method:h.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(a(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(r)),r}}class Fg extends V{constructor(){super(...arguments);m(this,"name","Asset Stage Completion");m(this,"url","/asset-stage-completions");m(this,"actions",{addOne:Wr,addMany:Yr,setOne:Zr,setMany:Jr,updateOne:Xr,updateMany:Qr,deleteOne:xr,deleteMany:eu,initialize:Kr});m(this,"selectors",{selectById:nu,selectByIds:au})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=R({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(d),blockers:[e.asset,e.asset_stage],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`Expected asset stage completion with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(l)),u}}bulkAdd(e){var f;const{store:n}=this.client,{addMany:a,setMany:c,deleteMany:r}=this.actions,l=new Date().toISOString(),u=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,d=e.map(I=>R(I)),o=d.map(I=>({...I,created_by:u,submitted_at:l})),y=o.map(({uuid:I})=>I);this.dispatch(a(o));const A=this.enqueueRequest({description:P(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{submitted_at:l,completions:d},blockers:[...e.map(I=>I.asset_procedure),...e.map(I=>I.asset_stage),...e.map(I=>I.asset)],blocks:y});return A.then(I=>{this.dispatch(c(I))}).catch(()=>{this.dispatch(r(y))}),[o,A]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:r}=this.selectors,l=r(e)(n.getState());this.dispatch(a(e));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!0),method:h.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(c(l)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{asset_procedure__project:e}},n)).flat();return this.dispatch(a(r)),r}}class gg extends V{constructor(){super(...arguments);m(this,"name","Asset Stage");m(this,"url","/asset-stages");m(this,"actions",{addOne:lu,addMany:ou,setOne:ru,setMany:uu,updateOne:hu,updateMany:mu,deleteOne:yu,deleteMany:pu,initialize:du});m(this,"selectors",{selectById:fu,selectByIds:Su})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=R({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(d),blockers:[d.asset_procedure_type],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`No asset stage with uuid ${e.uuid} found in the store`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${r.uuid}/`,payload:e,blockers:[r.uuid],blocks:[r.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`No asset stage with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class bg extends Qe{constructor(){super(...arguments);m(this,"name","Asset Type Attachment");m(this,"url","/asset-type-attachments");m(this,"actions",{addOne:Ou,addMany:Ds,setOne:Pu,setMany:Fu,updateOne:gu,updateMany:bu,deleteOne:_u,deleteMany:Cs,initialize:Iu});m(this,"selectors",{selectById:Ru,selectByIds:wu})}getId(e){return e.uuid}buildModel(e){return R({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,asset_type:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,asset_type:e.asset_type}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.assetTypeUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class _g extends V{constructor(){super(...arguments);m(this,"name","Asset Type Fields Attachment");m(this,"url","/asset-type-fields-attachments");m(this,"actions",{addOne:Bu,addMany:ju,setOne:qu,setMany:Du,updateOne:Cu,updateMany:$u,deleteOne:Uu,deleteMany:ku,initialize:zu});m(this,"selectors",{selectById:Nu,selectByIds:Gu})}async bulkAdd(e){var A;const{addMany:n,setMany:a,deleteMany:c}=this.actions,r=new Date().toISOString(),l=((A=this.client.store.getState().userReducer.currentUser)==null?void 0:A.id)??null,u={},d=[],o=[];for(const f of e){const{fieldsRevisionUuid:I,fieldIdentifier:g,file:F}=f,b=await this.client.files.getFilePayload(F);b.sha1 in u||(u[b.sha1]=b);const _=R({file:URL.createObjectURL(F),file_type:F.type,file_name:F.name,file_sha1:b.sha1,created_by:l,fields_revision:I,submitted_at:r,field_identifier:g});d.push(_);const v={uuid:_.uuid,file_name:F.name,field_identifier:g,file_extension:b.extension,file_sha1:b.sha1,fields_revision:I};o.push(v)}this.dispatch(n(d));const y=this.enqueueRequest({description:P(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:o,files:Object.values(u)},blockers:d.map(f=>f.fields_revision),blocks:d.map(f=>f.uuid)});return y.then(f=>{this.client.files.processPresignedUrls(f.presigned_urls),this.dispatch(a(f.attachments))}).catch(()=>{this.dispatch(c(d.map(f=>f.uuid)))}),[d,y.then(({attachments:f})=>f)]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{fields_revision__asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class Mg extends V{constructor(){super(...arguments);m(this,"name","Asset Type Fields");m(this,"url","/asset-type-fields");m(this,"actions",{addOne:Yu,addMany:Zu,setOne:Ju,setMany:Xu,updateOne:Qu,updateMany:xu,deleteOne:el,deleteMany:tl,initialize:Wu});m(this,"selectors",{selectById:il,selectByIds:nl})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=R({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(d),blockers:[d.asset_type],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(r(d.uuid)),A}),[d,o]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class Rg extends V{constructor(){super(...arguments);m(this,"name","Asset Type Field Values Attachment");m(this,"url","/asset-type-field-values-attachments");m(this,"actions",{addOne:rl,addMany:Gs,setOne:ul,setMany:ll,updateOne:ol,updateMany:hl,deleteOne:ml,deleteMany:Hs,initialize:dl});m(this,"selectors",{selectById:pl,selectByIds:Al})}async bulkAdd(e,n){var f;const{addMany:a,setMany:c,deleteMany:r}=this.actions,l=new Date().toISOString(),u=((f=this.client.store.getState().userReducer.currentUser)==null?void 0:f.id)??null,d=xe(e,Math.min(n??e.length,N)),o=[],y=[];for(const I of d){const g={},F=[];for(const b of I){const{fieldValuesUuid:_,fieldIdentifier:v,file:j}=b,B=await this.client.files.getFilePayload(j);B.sha1 in g||(g[B.sha1]=B);const D=R({file:URL.createObjectURL(j),file_type:j.type,file_name:j.name,file_sha1:B.sha1,created_by:u,field_values:_,submitted_at:l,field_identifier:v});o.push(D);const q={uuid:D.uuid,file_name:j.name,file_sha1:B.sha1,file_extension:B.extension,field_identifier:v,field_values:_};F.push(q)}y.push({submitted_at:l,attachments:F,files:Object.values(g)})}this.dispatch(a(o));const A=y.map(I=>this.enqueueRequest({description:P(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:I,blockers:I.attachments.map(g=>g.field_values),blocks:I.attachments.map(g=>g.uuid)}));return Promise.all(A).then(I=>{for(const F of I)this.client.files.processPresignedUrls(F.presigned_urls);const g=I.flatMap(F=>F.attachments);this.dispatch(c(g))}).catch(I=>{throw this.dispatch(r(o.map(g=>g.uuid))),I}),[o,A.map(I=>I.then(({attachments:g})=>g))]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:r}=this.selectors,l=n.getState(),u=r(e)(l);this.dispatch(a(e));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!0),method:h.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{field_values__asset__project:e,latest:!0}},n)).flat();return this.dispatch(a(r)),r}}class wg extends V{constructor(){super(...arguments);m(this,"name","Asset Type Field Values");m(this,"url","/asset-type-field-values");m(this,"actions",{addOne:Ol,addMany:Pl,setOne:Fl,setMany:gl,updateOne:bl,updateMany:_l,deleteOne:Ml,deleteMany:Rl,initialize:Il});m(this,"selectors",{selectById:El,selectByIds:vl})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,u=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=new Date().toISOString(),o=R({...e,created_by:u,submitted_at:d}),y=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(o),blockers:[e.asset,e.fields_revision],blocks:[o.uuid]});return this.dispatch(a(o)),y.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(o.uuid))}),[o,y]}bulkAdd(e,n){var I;const{payloads:a,values:c}=e,{addMany:r,setMany:l,deleteMany:u}=this.actions,d=new Date().toISOString(),o=[],y=xe(a,Math.min(n??a.length,N)),A=[];for(const g of y){const F=[];for(const b of g){const _=R({...b,values:b.values,created_by:((I=this.client.store.getState().userReducer.currentUser)==null?void 0:I.id)??null,submitted_at:d});o.push(_),F.push({uuid:_.uuid,asset:b.asset,fields_revision:b.fields_revision,published_at:b.published_at,values:_.values})}A.push({submitted_at:d,values:c,field_values:F})}this.dispatch(r(o));const f=[];for(const g of A){const{field_values:F}=g,b=F.map(({asset:B})=>B),_=F.map(({fields_revision:B})=>B),v=F.map(({uuid:B})=>B),j=this.enqueueRequest({description:P(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:g,blockers:b.concat(_),blocks:v});f.push(j)}return Promise.all(f).then(g=>{this.dispatch(l(g.flat()))}).catch(()=>{this.dispatch(u(C(o)))}),[o,f]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=n.getState(),l=c(e.uuid)(r);if(!l)throw new Error(`Expected AssetTypeFieldValues with uuid ${e.uuid} to exist`);const u={...l,...e};this.dispatch(a(u));const d=this.enqueueRequest({description:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[u.uuid,u.fields_revision,u.asset],blocks:[u.uuid]});return d.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(a(l))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected submission with uuid ${e} to exist`);const d=fl(e)(l);this.dispatch(a(e)),this.dispatch(Hs(C(d)));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(o){throw this.dispatch(c(u)),this.dispatch(Gs(d)),o}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{asset__project:e,latest:!0}},n)).flat();return this.dispatch(a(r)),r}}class Eg extends V{constructor(){super(...arguments);m(this,"name","Asset Type Identifier");m(this,"url","/asset-type-identifiers");m(this,"actions",{addOne:jl,addMany:ql,setOne:Dl,setMany:Cl,updateOne:$l,updateMany:Ul,deleteOne:kl,deleteMany:Ll,initialize:Bl});m(this,"selectors",{selectById:Gl,selectByIds:Hl})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=R({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(d),blockers:[d.asset_type],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected asset type identifier with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected asset type identifier with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class vg extends V{constructor(){super(...arguments);m(this,"name","Asset Type Identifier Value");m(this,"url","/asset-type-identifier-values");m(this,"actions",{addOne:Zl,addMany:Jl,setOne:Xl,setMany:Ql,updateOne:xl,updateMany:eo,deleteOne:to,deleteMany:so,initialize:Yl});m(this,"selectors",{selectById:no,selectByIds:ao})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=R({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(d),blockers:[e.asset,e.asset_type_identifier],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected asset type identifier value with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected asset type identifier value with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{asset__project:e}},n)).flat();return this.dispatch(a(r)),r}}class Vg extends V{constructor(){super(...arguments);m(this,"name","Asset Type");m(this,"url","/asset-types");m(this,"actions",{addOne:ho,addMany:mo,setOne:lo,setMany:oo,updateOne:yo,updateMany:po,deleteOne:Ao,deleteMany:fo,initialize:uo});m(this,"selectors",{selectById:To,selectByIds:Io})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=R({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(d),blockers:[],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected asset type with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[r.uuid],blocks:[r.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected asset type with uuid ${e} to exist`);const d=vs(e)(l),o=Eu(e)(l);this.dispatch(a(e)),this.dispatch(ws(C(d))),this.dispatch(Cs(C(o)));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(y){throw this.dispatch(c(u)),this.dispatch(Rs(d)),this.dispatch(Ds(o)),y}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class zg extends V{constructor(){super(...arguments);m(this,"name","Asset Type Status");m(this,"url","/asset-type-statuses");m(this,"actions",{addOne:go,addMany:bo,setOne:_o,setMany:Mo,updateOne:Ro,updateMany:wo,deleteOne:Eo,deleteMany:vo,initialize:Fo});m(this,"selectors",{selectById:zo,selectByIds:Bo})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=R({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(d),blockers:[e.asset_type],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.client.store.getState(),r=a(e.uuid)(c);if(!r)throw new Error(`Expected an existing asset type status with uuid ${e.uuid}`);const l={...r,...e};this.dispatch(n(l));const u=this.enqueueRequest({description:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`No asset type status with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(l)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class Bg extends V{constructor(){super(...arguments);m(this,"name","Category");m(this,"url","/categories");m(this,"actions",{addOne:ko,addMany:Lo,setOne:No,setMany:Go,updateOne:Ho,updateMany:Ko,deleteOne:Wo,deleteMany:Yo,initialize:Uo});m(this,"selectors",{selectById:ii,selectByIds:Jo})}add(e){var y;const{store:n}=this.client,{addOne:a,updateOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=R({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(d),blockers:[e.project],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}update(e){const{updateOne:n}=this.actions,{selectById:a}=this.selectors,c=this.client.store.getState(),r=a(e.uuid)(c);if(!r)throw new Error(`Expected an existing category with uuid ${e.uuid}`);const l={...r,...e};this.dispatch(n(l));const u=this.enqueueRequest({description:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`No category with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${l.uuid}/`,blockers:[l.uuid],blocks:[]})}catch(u){throw this.dispatch(c(l)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{project__organization:e}},n);return this.dispatch(a(c)),c}}class jg extends Qe{constructor(){super(...arguments);m(this,"name","Document Attachment");m(this,"url","/document-attachments");m(this,"actions",{addOne:eh,addMany:th,setOne:sh,setMany:ih,updateOne:nh,updateMany:ah,deleteOne:ch,deleteMany:dh,initialize:xo});m(this,"selectors",{selectById:uh,selectByIds:lh})}getId(e){return e.uuid}buildModel(e){return R({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,document:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,document:e.document}}async bulkAdd(e){var I;const{store:n}=this.client,{addMany:a,updateMany:c,deleteMany:r}=this.actions,l=((I=n.getState().userReducer.currentUser)==null?void 0:I.id)??null,u=new Date().toISOString(),d=[],o=[],y={},A={};for(const g of e){const{documentUuid:F,file:b}=g,_=await this.client.files.getFilePayload(b);_.sha1 in y||(y[_.sha1]=_,A[_.sha1]=[]);const v=this.buildModel({file:b,file_sha1:_.sha1,submitted_at:u,created_by:l,modelUuid:F});d.push(v),o.push(this.buildPayload(v,_)),A[_.sha1].push(v.uuid)}this.dispatch(a(d));const f=this.enqueueRequest({description:P(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{submitted_at:u,attachments:o,files:Object.values(y)},blocks:d.map(g=>g.uuid),blockers:d.map(g=>g.file_sha1)});return f.then(({attachments:g,presigned_urls:F})=>{this.dispatch(c(g));const b=this.client.files.processPresignedUrls(F);for(const[_,v]of Object.entries(b))v.then(()=>{const j=A[_];for(const B of j)this.makeReadable(B)})}).catch(()=>{this.dispatch(r(d.map(g=>g.uuid)))}),[d,f.then(({attachments:g})=>g)]}async delete(e){return this._delete(e)}makeReadable(e){this.enqueueRequest({description:"Add attachment to AI assistant",method:h.PATCH,url:`${this.url}/${e}/`,payload:{readable_to_assistant:!0},blockers:["index-document-attachment",e],blocks:["index-document-attachment"]})}async refreshStore(e,n){const{initialize:a}=this.actions,c=this.list({queryParams:{document__project__organization:e}},n),r=this.list({queryParams:{document__organization:e}},n),u=(await Promise.all([c,r])).flat();return this.dispatch(a(u)),u}}class qg extends V{constructor(){super(...arguments);m(this,"name","Document");m(this,"url","/documents");m(this,"actions",{addOne:yh,addMany:ph,setOne:Ah,setMany:fh,updateOne:Sh,updateMany:Th,deleteOne:Ih,deleteMany:Oh,initialize:mh});m(this,"selectors",{selectById:Fh,selectByIds:gh})}add(e){var y;const{store:n}=this.client,{addOne:a,deleteOne:c,updateOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=R({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(d),blockers:d.parent_document?[d.parent_document]:[],blocks:[d.uuid]});return o.then(A=>{this.dispatch(r(A))}).catch(()=>{this.dispatch(c(d.uuid))}),[d,o]}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`attempting to update a document with uuid ${e.uuid} that does not exist in store.documents`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c,addMany:r,deleteMany:l}=this.actions,{selectById:u}=this.selectors,d=n.getState(),o=u(e)(d);if(!o)throw new Error(`attempting to delete a document with uuid ${e} that does not exist in store.documents`);const y=bh(e)(d);this.dispatch(a(e)),this.dispatch(l(C(y)));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(A){throw this.dispatch(c(o)),this.dispatch(r(y)),A}}async refreshStore(e,n){const{initialize:a}=this.actions,c=this.list({queryParams:{project__organization:e}},n),r=this.list({queryParams:{organization:e}},n),u=(await Promise.all([c,r])).flat();return this.dispatch(a(u)),u}}class ct extends tt{async get(s,e){return this.performRequest({url:`${this.url}/${s}/`,method:h.GET},e)}async list(s,e){return this.performRequest({url:`${this.url}/`,method:h.GET,...s},e)}async listPaginated(s,e){return this.performPagination({url:`${this.url}/`,method:h.GET,...s},e)}}class Dg extends ct{constructor(){super(...arguments);m(this,"name","Email Domains");m(this,"url","/organization-email-domains");m(this,"actions",{addOne:Rh,addMany:wh,setOne:Eh,setMany:vh,updateOne:Vh,updateMany:zh,deleteOne:Bh,deleteMany:jh,initialize:Mh});m(this,"selectors",{selectById:Dh,selectByIds:Ch})}async add(e,n){return this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:{email:n,organization:e},blockers:[e,"create-org"],blocks:[]})}async delete(e){const{deleteOne:n,addOne:a}=this.actions;this.dispatch(n(e.uuid));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e.uuid}/`,blockers:[e.domain],blocks:[]})}catch(c){throw this.dispatch(a(e)),c}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class Cg extends tt{async getVerificationCode(s){return this.enqueueRequest({description:"Get verification code",method:h.GET,url:`/verification/email-verification/${s}/`,isAuthNeeded:!1,blockers:[],blocks:[]})}validateVerificationCode(s,e=void 0){return this.enqueueRequest({description:"Validate verification code",method:h.POST,url:`/verification/email-verification/${s}/`,isAuthNeeded:!1,payload:e,blockers:[],blocks:[]})}}const Ut={},Cn=new Set;let kt=0,$n=0,Un=0;const $g=20;class Ug extends tt{constructor(){super(...arguments);m(this,"host");m(this,"_dbPromise",jO.openDB("fileCache",1,{upgrade(e){e.createObjectStore("files")}}))}async renewUploadUrl(e){const n=await this.fetchCache(e);if(!n)throw new Error(`File with sha1 ${e} not found in cache`);const a=await Wt(n,e),c=await this.enqueueRequest({description:"Get S3 URL",method:h.GET,url:"/authentication/files/presigned-upload-url/",queryParams:{sha1:await nt(n),file_type:n.type,extension:n.name.split(".").pop(),size:n.size.toString()},blockers:[],blocks:[`s3-${a}`]});return"url"in c&&this.dispatch(Lh({sha1:e,...c})),c}async addCache(e,n){if(Cn.has(n))return;if(!e.type){const r=e.name.split("."),l=r[r.length-1];e=new File([e],e.name,{type:l})}if(!e.name||!e.size||!e.type)throw new Error("Cannot add files to cache that do not have a name, size and type.");const a=await this._dbPromise;!!await a.get("files",n)?(console.error("File already cached (this is unexpected at this point):",e.name,n),kt++):(await a.put("files",e,n),$n++),Cn.add(n),Un++,Un%$g===0&&console.debug(`File cache summary: ${kt} hits and ${$n} misses, ${kt/(kt+$n)*100}% hit rate over ${Un} calls to addCache.`)}async removeCache(e){await(await this._dbPromise).delete("files",e),Cn.delete(e)}async fetchCache(e){return(await this._dbPromise).get("files",e)}async getOrRenewUploadUrl(e){const n=this.client.store.getState();return Nh(e)(n)??await this.renewUploadUrl(e)}async uploadFileToS3(e){const n=await this.fetchCache(e);if(!n)throw new Error(`File with sha1 ${e} not found in cache`);const a=await Wt(n,e),c={file_name:n.name,file_sha1:e,file:a},r=await this.getOrRenewUploadUrl(e);if("warning"in r){if(r.warning==="already_uploaded")return[c,Promise.resolve(void 0)];throw new Error(r.warning)}const l=r.url,u=this.enqueueRequest({url:l,description:"Upload file",method:h.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:e,blockers:[`s3-${a}`],blocks:[e],s3url:r});return[c,u]}async fetchFileFromUrl(e,n,a){const c=e.split("?")[0]??e,r=await this.fetchCache(n);if(r){if(!r.name)throw new Error("Cached file unexpectedly has no name.");return r}if(e.startsWith("blob:")){const o=await ia(e),y=new File([o],a??n,{type:o.type});return await this.addCache(y,n),y}let l=Ut[c],u=!0;l?u=!1:(l=new Promise(o=>{this.enqueueRequest({description:"Download file",method:h.GET,url:e,isExternalUrl:!0,isResponseBlob:!0,isAuthNeeded:!1,blockers:[n],blocks:[n]}).then(y=>{const A=new File([y],a??n,{type:y.type});o(A)})}),Ut[c]=l);let d;try{d=await l}catch(o){throw u&&o instanceof k&&delete Ut[c],o}if(u){const o=await nt(d);if(o!==n){const f=`The hash of the file returned from the server (${o}) does not match the
9
9
  expected hash (${n}). This can happen if you're using a local development server and the
10
10
  isExternalUrl flag in the request details is set to true, because instead of requesting the local
11
11
  REST API, you will be requesting localhost:80 (where this app runs), resulting in a transformed blob
12
12
  (with an uuid attached) being returned. Alternatively, you may be running with
13
13
  import.meta.env.PROD, which will result in some file requests being treated as
14
- external URLs and therefore not prepended with VITE_API_URL.`;throw new Error(f)}const y=d.type.split("/")[1];if(!y)throw new Error("File has no extension");const A=a??o+"."+y;if(d=aa(d,A),!d.name)throw new Error("Failed to set file's name");await this.addCache(d,o),$t[c]=new Promise(f=>{f(d)})}return d}processPresignedUrls(e){const n={};for(const[a,c]of Object.entries(e))n[a]=this.enqueueRequest({url:c.url,description:"Upload file to S3",method:h.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:a,blockers:[`s3-${c.fields.key}`],blocks:[a],s3url:c});return n}async getFilePayload(e){const n=await it(e),a={sha1:n,file_type:e.type,extension:e.name.split(".").pop(),size:e.size};return await this.client.files.addCache(e,n),a}}class $g extends v{constructor(){super(...arguments);m(this,"name","Form Identifier");m(this,"url","/form-identifiers");m(this,"actions",{addOne:Gh,addMany:Hh,setOne:Kh,setMany:Wh,updateOne:Yh,updateMany:Zh,deleteOne:Jh,deleteMany:Xh,initialize:Nh});m(this,"selectors",{selectById:xh,selectByIds:em})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:O(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:V(d),blockers:[d.form],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(n.getState(),e.uuid);if(!r)throw new Error(`Expected form identifier with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(l,e);if(!u)throw new Error(`Expected form identifier with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{form__organization:e}},n);return this.dispatch(a(c)),c}}class Ug extends v{constructor(){super(...arguments);m(this,"name","Form Identifier Value");m(this,"url","/form-identifier-values");m(this,"actions",{addOne:nm,addMany:am,setOne:cm,setMany:dm,updateOne:rm,updateMany:um,deleteOne:lm,deleteMany:om,initialize:im});m(this,"selectors",{selectById:mm,selectByIds:ym})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:O(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:V(d),blockers:[e.form_submission,e.form_identifier],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(n.getState(),e.uuid);if(!r)throw new Error(`Expected form identifier value with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(l,e);if(!u)throw new Error(`Expected form identifier value with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{form_submission__form_revision__form__organization:e}},n)).flat();return this.dispatch(a(r)),r}}class kg extends v{constructor(){super(...arguments);m(this,"name","Form Revision Attachment");m(this,"url","/form-revision-attachments");m(this,"actions",{addOne:Tm,addMany:Sm,setOne:Im,setMany:Om,updateOne:Pm,updateMany:Fm,deleteOne:gm,deleteMany:bm,initialize:fm});m(this,"selectors",{selectById:Mm,selectByIds:Rm})}async bulkAdd(e){var A;const{addMany:n,setMany:a,deleteMany:c}=this.actions,r=new Date().toISOString(),l=((A=this.client.store.getState().userReducer.currentUser)==null?void 0:A.id)??null,u={},d=[],o=[];for(const f of e){const{revisionUuid:S,fieldIdentifier:F,file:P}=f,g=await this.client.files.getFilePayload(P);g.sha1 in u||(u[g.sha1]=g);const b=M({file:URL.createObjectURL(P),file_type:P.type,file_name:P.name,file_sha1:g.sha1,created_by:l,form_revision:S,submitted_at:r,field_identifier:F});d.push(b);const E={uuid:b.uuid,file_name:P.name,field_identifier:F,file_extension:g.extension,file_sha1:g.sha1,form_revision:S};o.push(E)}this.dispatch(n(d));const y=this.enqueueRequest({description:O(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:o,files:Object.values(u)},blockers:d.map(f=>f.form_revision),blocks:d.map(f=>f.uuid)});return y.then(f=>{this.client.files.processPresignedUrls(f.presigned_urls),this.dispatch(a(f.attachments))}).catch(()=>{this.dispatch(c(d.map(f=>f.uuid)))}),[d,y.then(({attachments:f})=>f)]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{form_revision__form__organization:e}},n);return this.dispatch(a(c)),c}}class Lg extends v{constructor(){super(...arguments);m(this,"name","Form Revision");m(this,"url","/form-revisions");m(this,"actions",{addOne:pi,addMany:Ai,setOne:Vm,setMany:zm,updateOne:Bm,updateMany:jm,deleteOne:fi,deleteMany:Ti,initialize:vm});m(this,"selectors",{selectById:qm,selectByIds:Dm})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,u=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=new Date().toISOString(),o=M({...e,created_by:u,submitted_at:d});this.dispatch(a(o));const y=this.enqueueRequest({description:O(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:V(o),blockers:[e.form],blocks:[o.uuid]});return y.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(o.uuid))}),[o,y]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{form__organization:e}},n);return this.dispatch(a(c)),c}}class Ng extends v{constructor(){super(...arguments);m(this,"name","Form");m(this,"url","/forms");m(this,"actions",{addOne:Lm,addMany:Nm,setOne:Gm,setMany:Hm,updateOne:Km,updateMany:Wm,deleteOne:Ym,deleteMany:Zm,initialize:km});m(this,"selectors",{selectById:Qm,selectByIds:xm})}add(e,n){var A;const{store:a}=this.client,{addOne:c,deleteOne:r}=this.actions,l=new Date().toISOString(),u=((A=a.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=M({...e,submitted_at:l,created_by:u}),o=M({...n,form:d.uuid,submitted_at:l,created_by:u});this.dispatch(c(d)),this.dispatch(pi(o));const y=this.enqueueRequest({description:O(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:{...V(d),initial_revision:{uuid:o.uuid,submitted_at:o.submitted_at,title:o.title,description:o.description,fields:o.fields}},blockers:[],blocks:[d.uuid,o.uuid]});return y.catch(f=>{throw this.dispatch(r(d.uuid)),this.dispatch(fi(o.uuid)),f}),[d,o,y]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(l,e);if(!u)throw new Error("Expected form to exist");const d=Fy(l,e),o=Cm(l,e);this.dispatch(a(e)),this.dispatch(Ei(D(d))),this.dispatch(Ti(D(o)));try{return await this.enqueueRequest({description:O(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(y){throw this.dispatch(c(u)),this.dispatch(Ai(o)),this.dispatch(wi(d)),y}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class Gg extends v{constructor(){super(...arguments);m(this,"name","Form Submission Attachment");m(this,"url","/form-submission-attachments");m(this,"actions",{addOne:sy,addMany:Fi,setOne:iy,setMany:ny,updateOne:ay,updateMany:cy,deleteOne:dy,deleteMany:gi,initialize:ty});m(this,"selectors",{selectById:ry,selectByIds:uy})}async bulkAdd(e){var A;const{addMany:n,setMany:a,deleteMany:c}=this.actions,r=new Date().toISOString(),l=((A=this.client.store.getState().userReducer.currentUser)==null?void 0:A.id)??null,u={},d=[],o=[];for(const f of e){const{submissionUuid:S,fieldIdentifier:F,file:P}=f,g=await this.client.files.getFilePayload(P);g.sha1 in u||(u[g.sha1]=g);const b=M({file:URL.createObjectURL(P),file_type:P.type,file_name:P.name,file_sha1:g.sha1,created_by:l,form_submission:S,submitted_at:r,field_identifier:F});d.push(b);const E={uuid:b.uuid,file_name:P.name,file_sha1:g.sha1,file_extension:g.extension,field_identifier:F,form_submission:S};o.push(E)}this.dispatch(n(d));const y=this.enqueueRequest({description:O(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:o,files:Object.values(u)},blockers:d.map(f=>f.form_submission),blocks:d.map(f=>f.uuid)});return y.then(f=>{this.client.files.processPresignedUrls(f.presigned_urls),this.dispatch(a(f.attachments))}).catch(f=>{throw this.dispatch(c(d.map(S=>S.uuid))),f}),[d,y.then(({attachments:f})=>f)]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,r=n.getState(),l=Mi(r,e);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(h.DELETE,this.name,!0),method:h.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(c(l)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{form_submission__form_revision__form__organization:e}},n)).flat();return this.dispatch(a(r)),r}}class Hg extends v{constructor(){super(...arguments);m(this,"name","Form Submission");m(this,"url","/form-submissions");m(this,"actions",{addOne:Ay,addMany:wi,setOne:yy,setMany:py,updateOne:fy,updateMany:Ty,deleteOne:Sy,deleteMany:Ei,initialize:my});m(this,"selectors",{selectById:Oy,selectByIds:Py})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,u=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=new Date().toISOString(),o=M({...e,created_by:u,submitted_at:d}),y=this.enqueueRequest({description:O(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:V(o),blockers:[e.form_revision],blocks:[o.uuid]});return this.dispatch(a(o)),y.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(o.uuid))}),[o,y]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=n.getState(),l=c(r,e.uuid);if(!l)throw new Error(`Expected submission with uuid ${e.uuid} to exist`);const u={...l,...e};this.dispatch(a(u));const d=this.enqueueRequest({description:O(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${u.uuid}/`,payload:e,blockers:[u.uuid],blocks:[u.uuid]});return d.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(a(l))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(l,e);if(!u)throw new Error(`Expected submission with uuid ${e} to exist`);const d=ly(l,e);this.dispatch(a(e)),this.dispatch(gi(D(d)));try{return await this.enqueueRequest({description:O(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(o){throw this.dispatch(c(u)),this.dispatch(Fi(d)),o}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{limit:this.pageSize,paginate:!0,form_revision__form_organization:e}},n)).flat();return this.dispatch(a(r)),r}}class Kg extends v{constructor(){super(...arguments);m(this,"name","Geo Image");m(this,"url","/geo-images");m(this,"actions",{addOne:wy,addMany:Ey,setOne:My,setMany:Ry,updateOne:vy,updateMany:Vy,deleteOne:zy,deleteMany:By,initialize:_y});m(this,"selectors",{selectById:qy,selectByIds:Dy})}async add(e){var F;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,{file:l,...u}=e,d=new Date().toISOString(),o=((F=n.getState().userReducer.currentUser)==null?void 0:F.id)??null,y=u.project,A=await this.client.files.getFilePayload(l),f=M({...u,file_name:l.name,file_sha1:A.sha1,file_type:l.type,file:URL.createObjectURL(l),submitted_at:d,created_by:o});this.dispatch(a(f));const S=this.enqueueRequest({description:O(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:{uuid:f.uuid,submitted_at:d,title:f.title,description:f.description,geo_marker:f.geo_marker,canvas_marker:f.canvas_marker,sha1:f.file_sha1,project:f.project,file_name:f.file_name,direction:f.direction,original_date:f.original_date,file:A},blocks:[y],blockers:[y]});return S.then(P=>{this.client.files.processPresignedUrls(P.presigned_urls),this.dispatch(c(P.geo_image))}).catch(()=>{this.dispatch(r(f.uuid))}),[f,S.then(P=>P.geo_image)]}async bulkAdd(e,n){var F;const{store:a}=this.client,{addMany:c,setMany:r,deleteMany:l}=this.actions,u=new Date().toISOString(),d=((F=a.getState().userReducer.currentUser)==null?void 0:F.id)??null,o=[],y=[],A=[],f={};for(const P of e){const{file:g,...b}=P,E=await this.client.files.getFilePayload(g);E.sha1 in f||(f[E.sha1]=E);const B=M({...b,file_name:g.name,file_sha1:E.sha1,file_type:g.type,file:URL.createObjectURL(g),submitted_at:u,created_by:d,project:n});o.push(B),y.push(B.uuid),A.push({uuid:B.uuid,sha1:B.file_sha1,file_name:B.file_name,title:B.title,description:B.description,geo_marker:B.geo_marker,canvas_marker:B.canvas_marker,direction:B.direction,original_date:B.original_date})}this.dispatch(c(o));const S=this.enqueueRequest({description:O(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{submitted_at:u,project:n,geo_images:A,files:Object.values(f)},blocks:[n],blockers:y});return S.then(P=>{this.client.files.processPresignedUrls(P.presigned_urls),this.dispatch(r(P.geo_images))}).catch(()=>{this.dispatch(l(y))}),[o,S.then(P=>P.geo_images)]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=n.getState(),l=c(r,e.uuid);if(!l)throw new Error(`Map image with uuid ${e.uuid} does not exist in the store`);const u={...l,...e};this.dispatch(a(u));const d=this.enqueueRequest({description:O(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return d.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(a(l))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(l,e);if(!u)throw new Error(`Map image with uuid ${e} does not exist in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blocks:[e],blockers:[e]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.listPaginated({queryParams:{project:e}},n),r=c.flat();return this.dispatch(a(r)),c}}class Wg extends v{constructor(){super(...arguments);m(this,"name","Issue Association");m(this,"url","/issue-associations");m(this,"actions",{addOne:Hy,addMany:wt,setOne:Ly,setMany:ky,updateOne:Ny,updateMany:Gy,deleteOne:Ky,deleteMany:Et,initialize:Uy});m(this,"selectors",{selectById:Yy,selectByIds:Zy})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=new Date().toISOString(),u=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,d=M({...e,submitted_at:l,created_by:u});this.dispatch(a(d));const o=this.enqueueRequest({description:O(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:V(d),blockers:[e.associated_issue,...e.issue?[e.issue]:[],...e.asset?[e.asset]:[]],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(n.getState(),e);if(!l)throw new Error(`Issue association with uuid ${e} not found in store.`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(l)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{associated_issue__project:e}},n)).flat();return this.dispatch(a(r)),r}}class Yg extends Xe{constructor(){super(...arguments);m(this,"name","Issue Attachment");m(this,"url","/issue-attachments");m(this,"actions",{addOne:sp,addMany:qi,setOne:ip,setMany:np,updateOne:ap,updateMany:cp,deleteOne:dp,deleteMany:Di,initialize:tp});m(this,"selectors",{selectById:lp,selectByIds:op})}getId(e){return e.uuid}buildModel(e){return M({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,issue:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,issue:e.issue}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.issueUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(a(r)),r}}class Zg extends Xe{constructor(){super(...arguments);m(this,"name","Issue Comment Attachment");m(this,"url","/issue-comment-attachments");m(this,"actions",{addOne:pp,addMany:Ap,setOne:fp,setMany:Tp,updateOne:Sp,updateMany:Ip,deleteOne:Op,deleteMany:Pp,initialize:yp});m(this,"selectors",{selectById:gp,selectByIds:bp})}getId(e){return e.uuid}buildModel(e){return M({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,issue_comment:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,issue_comment:e.issue_comment}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.issueCommentUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{issue_comment__issue__project:e}},n)).flat();return this.dispatch(a(r)),r}}class Jg extends v{constructor(){super(...arguments);m(this,"name","Issue Comment");m(this,"url","/issue-comments");m(this,"actions",{addOne:wp,addMany:Ep,setOne:vp,setMany:Vp,updateOne:zp,updateMany:Bp,deleteOne:jp,deleteMany:qp,initialize:Rp});m(this,"selectors",{selectById:Dp,selectByIds:Cp})}add(e){const{store:n}=this.client,{addOne:a,updateOne:c,deleteOne:r}=this.actions,l=M({...e,author:n.getState().userReducer.currentUser.id,submitted_at:new Date().toISOString()});this.dispatch(a(l));const u=this.enqueueRequest({description:O(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:V(l),blockers:[e.issue],blocks:[l.uuid]});return u.then(d=>{this.dispatch(c(d))}).catch(()=>{this.dispatch(r(l.uuid))}),[l,u]}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:c}=this.selectors,r=c(n.getState(),e.uuid);if(!r)throw new Error(`Comment with uuid ${e.uuid} not found in store`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(n.getState(),e);if(!l)throw new Error(`Comment with uuid ${e} not found in store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(l)),u}}async refreshStore(e,n){const{setMany:a}=this.actions,r=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(a(r)),r}}class Xg extends v{constructor(){super(...arguments);m(this,"name","Issue");m(this,"url","/issues");m(this,"actions",{addOne:Lp,addMany:Gi,setOne:Np,setMany:Gp,updateOne:Hp,updateMany:Kp,deleteOne:Wp,deleteMany:Hi,initialize:kp});m(this,"selectors",{selectById:Zp,selectByIds:Jp})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=n.getState(),u=new Date().toISOString(),d=((A=l.userReducer.currentUser)==null?void 0:A.id)??null,o=M({...e,submitted_at:u,created_by:d});this.dispatch(a(o));const y=this.enqueueRequest({description:O(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:V(o),blockers:[o.project,o.issue_type,...o.category?[o.category]:[]],blocks:[o.uuid]});return y.then(f=>{this.dispatch(c(f))}).catch(f=>{throw this.dispatch(r(o.uuid)),f}),[o,y]}update(e){var y;const{updateOne:n}=this.actions,{selectById:a}=this.selectors,c=this.client.store.getState(),r=a(c,e.uuid);if(!r)throw new Error(`Attempting to update an issue with uuid ${e.uuid} that doesn't exist in the store`);const l={...r,...e};this.dispatch(n(l));const u={};for(const A of[$.TITLE,$.DESCRIPTION,$.STATUS,$.CATEGORY,$.PRIORITY,$.ASSIGNED_TO,$.DUE_DATE])if(A in e&&e[A]!==r[A])switch(A){case $.PRIORITY:u[A]=e[A];break;case $.DUE_DATE:u[A]=e[A];break;case $.DESCRIPTION:u[A]=e[A];break;case $.TITLE:u[A]=e[A];break;case $.STATUS:{const f=e[A],S=ln(c,f);if(!S)throw new Error(`Trying to update issue type status with ${f} which does not exist in store`);u[A]={name:S.name,color:S.color,uuid:S.uuid};break}case $.CATEGORY:{const f=e[A];if(f===null)u[A]=null;else{const S=si(c,f);if(!S)throw new Error(`Trying to update category with ${f} which does not exist in store.`);u[A]={name:S.name,color:S.color,uuid:S.uuid}}break}case $.ASSIGNED_TO:{const f=e[A];if(f===null)u[A]=null;else{const S=jt(c,f);if(!S)throw new Error(`Trying to update assigned to with ${f} which does not exist in store.`);u[A]={full_name:S.username,id:S.id}}break}}const d=M({created_by:((y=c.userReducer.currentUser)==null?void 0:y.id)??null,submitted_at:new Date().toISOString(),issue:r.uuid,changes:u});this.dispatch(hn(d));const o=this.enqueueRequest({description:O(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return o.then(A=>{this.dispatch(n(A))}).catch(()=>{this.dispatch(n(r)),this.dispatch(yn(d.uuid))}),[l,o]}bulkUpdate(e,n){const{store:a}=this.client,{updateMany:c}=this.actions,{selectByIds:r}=this.selectors,l=D(e).toSorted(At);if(l.length!==e.length)throw new Error("payloads contains duplicate uuids.");const u=r(a.getState(),l).toSorted(Zt);if(l.length!=u.length)throw new Error(`Attempting to bulk update ${l.length-u.length} issues that dont exist in the store`);const d=[];for(let f=0;f<l.length;f++)d.push({...u[f],...e[f]});this.dispatch(c(d));const o=Qe(e,Math.min(n??e.length,L)),y=[];let A=null;for(const f of o){const S=xe.v4(),F=D(f),P=f.map(({status:E})=>E).filter(Boolean),g=f.map(({category:E})=>E).filter(Boolean),b=this.enqueueRequest({description:O(h.PATCH,this.name,!0),method:h.PATCH,url:`${this.url}/bulk/`,payload:{payloads:f},blockers:F.concat(P).concat(g).concat(A?[A]:[]),blocks:F.concat([S])});y.push(b),A=S}return Promise.all(y).then(f=>{this.dispatch(c(f.flat()))}).catch(()=>{this.dispatch(c(u))}),[d,y]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(l,e);if(!u)throw new Error(`No issue with uuid ${e} found in the store`);const d=up(l,e),o=gT(l,e),y={};for(const f of Jy(l,e))y[f.uuid]=f;for(const f of Xy(l,e))y[f.uuid]=f;const A=Object.values(y);this.dispatch(a(e)),this.dispatch(Di(D(d))),this.dispatch(pn(D(o))),this.dispatch(Et(D(A)));try{return await this.enqueueRequest({description:O(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(f){throw this.dispatch(c(u)),this.dispatch(qi(d)),this.dispatch(mn(o)),this.dispatch(wt(A)),f}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(r)),r}}class Qg extends Xe{constructor(){super(...arguments);m(this,"name","Issue Type Attachment");m(this,"url","/issue-type-attachments");m(this,"actions",{addOne:tA,addMany:sA,setOne:iA,setMany:nA,updateOne:aA,updateMany:cA,deleteOne:dA,deleteMany:rA,initialize:eA});m(this,"selectors",{selectById:lA,selectByIds:oA})}getId(e){return e.uuid}buildModel(e){return M({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,issue_type:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,issue_type:e.issue_type}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.issueTypeUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class xg extends v{constructor(){super(...arguments);m(this,"name","Issue Type Fields Attachment");m(this,"url","/issue-type-fields-attachments");m(this,"actions",{addOne:pA,addMany:AA,setOne:fA,setMany:TA,updateOne:SA,updateMany:IA,deleteOne:OA,deleteMany:PA,initialize:yA});m(this,"selectors",{selectById:gA,selectByIds:bA})}async bulkAdd(e){var A;const{addMany:n,setMany:a,deleteMany:c}=this.actions,r=new Date().toISOString(),l=((A=this.client.store.getState().userReducer.currentUser)==null?void 0:A.id)??null,u={},d=[],o=[];for(const f of e){const{fieldsRevisionUuid:S,fieldIdentifier:F,file:P}=f,g=await this.client.files.getFilePayload(P);g.sha1 in u||(u[g.sha1]=g);const b=M({file:URL.createObjectURL(P),file_type:P.type,file_name:P.name,file_sha1:g.sha1,created_by:l,fields_revision:S,submitted_at:r,field_identifier:F});d.push(b);const E={uuid:b.uuid,file_name:P.name,file_extension:g.extension,field_identifier:F,file_sha1:g.sha1,fields_revision:S};o.push(E)}this.dispatch(n(d));const y=this.enqueueRequest({description:O(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:o,files:Object.values(u)},blockers:d.map(f=>f.fields_revision),blocks:d.map(f=>f.uuid)});return y.then(f=>{this.client.files.processPresignedUrls(f.presigned_urls),this.dispatch(a(f.attachments))}).catch(()=>{this.dispatch(c(d.map(f=>f.uuid)))}),[d,y.then(({attachments:f})=>f)]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{fields_revision__issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class eb extends v{constructor(){super(...arguments);m(this,"name","Issue Type Fields");m(this,"url","/issue-type-fields");m(this,"actions",{addOne:NA,addMany:GA,setOne:HA,setMany:KA,updateOne:WA,updateMany:YA,deleteOne:ZA,deleteMany:JA,initialize:LA});m(this,"selectors",{selectById:QA,selectByIds:xA})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:O(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:V(d),blockers:[d.issue_type],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(r(d.uuid)),A}),[d,o]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class tb extends v{constructor(){super(...arguments);m(this,"name","Issue Type Field Values Attachment");m(this,"url","/issue-type-field-values-attachments");m(this,"actions",{addOne:nf,addMany:xi,setOne:af,setMany:cf,updateOne:df,updateMany:rf,deleteOne:uf,deleteMany:en,initialize:sf});m(this,"selectors",{selectById:of,selectByIds:hf})}async bulkAdd(e){var A;const{addMany:n,setMany:a,deleteMany:c}=this.actions,r=new Date().toISOString(),l=((A=this.client.store.getState().userReducer.currentUser)==null?void 0:A.id)??null,u={},d=[],o=[];for(const f of e){const{fieldValuesUuid:S,fieldIdentifier:F,file:P}=f,g=await this.client.files.getFilePayload(P);g.sha1 in u||(u[g.sha1]=g);const b=M({file:URL.createObjectURL(P),file_type:P.type,file_name:P.name,file_sha1:g.sha1,created_by:l,field_values:S,submitted_at:r,field_identifier:F});d.push(b);const E={uuid:b.uuid,file_name:P.name,file_sha1:g.sha1,file_extension:g.extension,field_identifier:F,field_values:S};o.push(E)}this.dispatch(n(d));const y=this.enqueueRequest({description:O(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:o,files:Object.values(u)},blockers:d.map(f=>f.field_values),blocks:d.map(f=>f.uuid)});return y.then(({presigned_urls:f,attachments:S})=>{this.client.files.processPresignedUrls(f),this.dispatch(a(S))}).catch(f=>{throw this.dispatch(c(d.map(S=>S.uuid))),f}),[d,y.then(({attachments:f})=>f)]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:r}=this.selectors,l=n.getState(),u=r(l,e);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(h.DELETE,this.name,!0),method:h.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{field_values__issue__project:e,latest:!0}},n)).flat();return this.dispatch(a(r)),r}}class sb extends v{constructor(){super(...arguments);m(this,"name","Issue Type Field Values");m(this,"url","/issue-type-field-values");m(this,"actions",{addOne:wA,addMany:EA,setOne:vA,setMany:VA,updateOne:zA,updateMany:BA,deleteOne:jA,deleteMany:qA,initialize:RA});m(this,"selectors",{selectById:CA,selectByIds:$A})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,u=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=new Date().toISOString(),o=M({...e,created_by:u,submitted_at:d}),y=this.enqueueRequest({description:O(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:V(o),blockers:[e.issue,e.fields_revision],blocks:[o.uuid]});return this.dispatch(a(o)),y.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(o.uuid))}),[o,y]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=n.getState(),l=c(r,e.uuid);if(!l)throw new Error(`Expected IssueTypeFieldValues with uuid ${e.uuid} to exist`);const u={...l,...e};this.dispatch(a(u));const d=this.enqueueRequest({description:O(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[u.uuid,u.fields_revision,u.issue],blocks:[u.uuid]});return d.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(a(l))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(l,e);if(!u)throw new Error(`Expected submission with uuid ${e} to exist`);const d=mf(l,e);this.dispatch(a(e)),this.dispatch(en(D(d)));try{return await this.enqueueRequest({description:O(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(o){throw this.dispatch(c(u)),this.dispatch(xi(d)),o}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{issue__project:e,latest:!0}},n)).flat();return this.dispatch(a(r)),r}}class ib extends v{constructor(){super(...arguments);m(this,"name","Issue Type Identifier");m(this,"url","/issue-type-identifiers");m(this,"actions",{addOne:ff,addMany:Tf,setOne:Sf,setMany:If,updateOne:Of,updateMany:Pf,deleteOne:Ff,deleteMany:gf,initialize:Af});m(this,"selectors",{selectById:_f,selectByIds:Mf})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:O(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:V(d),blockers:[d.issue_type],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(n.getState(),e.uuid);if(!r)throw new Error(`Expected issue type identifier with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(l,e);if(!u)throw new Error(`Expected issue type identifier with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class nb extends v{constructor(){super(...arguments);m(this,"name","Issue Type Identifier Value");m(this,"url","/issue-type-identifier-values");m(this,"actions",{addOne:vf,addMany:Vf,setOne:zf,setMany:Bf,updateOne:jf,updateMany:qf,deleteOne:Df,deleteMany:Cf,initialize:Ef});m(this,"selectors",{selectById:Uf,selectByIds:kf})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:O(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:V(d),blockers:[e.issue,e.issue_type_identifier],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(n.getState(),e.uuid);if(!r)throw new Error(`Expected issue type identifier value with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(l,e);if(!u)throw new Error(`Expected issue type identifier value with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(a(r)),r}}class ab extends v{constructor(){super(...arguments);m(this,"name","Issue Type");m(this,"url","/issue-types");m(this,"actions",{addOne:Hf,addMany:Kf,setOne:Wf,setMany:Yf,updateOne:Zf,updateMany:Jf,deleteOne:Xf,deleteMany:Qf,initialize:Gf});m(this,"selectors",{selectById:eT,selectByIds:tT})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,u=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=new Date().toISOString(),o=M({...e,submitted_at:d,created_by:u});this.dispatch(a(o));const y=this.enqueueRequest({method:h.POST,url:`${this.url}/`,payload:V(o),blockers:[],blocks:[o.uuid]});return y.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(o.uuid))}),[o,y]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=n.getState(),l=c(r,e.uuid);if(!l)throw new Error(`IssueType with uuid ${e.uuid} does not exist in the store.`);const u={...l,...e};this.dispatch(a(u));const d=this.enqueueRequest({method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(a(l))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(l,e);if(!u)throw new Error(`IssueType with uuid ${e} does not exist in the store.`);const d=Xp(l,e);this.dispatch(a(e)),this.dispatch(Hi(D(d)));try{return await this.enqueueRequest({description:O(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(o){throw this.dispatch(c(u)),this.dispatch(Gi(d)),o}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class cb extends v{constructor(){super(...arguments);m(this,"name","Issue Type Status");m(this,"url","/issue-type-statuses");m(this,"actions",{addOne:aT,addMany:cT,setOne:dT,setMany:rT,updateOne:uT,updateMany:lT,deleteOne:oT,deleteMany:hT,initialize:nT});m(this,"selectors",{selectById:ln,selectByIds:yT})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:O(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:V(d),blockers:[e.issue_type],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.client.store.getState(),r=a(c,e.uuid);if(!r)throw new Error(`Expected an existing issue type status with uuid ${e.uuid}`);const l={...r,...e};this.dispatch(n(l));const u=this.enqueueRequest({description:O(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(n.getState(),e);if(!l)throw new Error(`No issue type status with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(l)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class db extends v{constructor(){super(...arguments);m(this,"name","Issue Update");m(this,"url","/issue-updates");m(this,"actions",{addOne:hn,addMany:mn,setOne:TT,setMany:ST,updateOne:IT,updateMany:OT,deleteOne:yn,deleteMany:pn,initialize:fT});m(this,"selectors",{selectById:PT,selectByIds:FT})}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(a(r)),r}}const rb=1800;function ub(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 lb extends ag{constructor(){super(...arguments);m(this,"_getRenewedTokens",async e=>{const n=this.performRequest({method:h.POST,url:this.refreshTokensUrl,payload:{refresh:e},isAuthNeeded:!1,checkAuth:!1});let a;try{a=await n}catch(c){console.error("Could not renew tokens; clearing auth",c),this.clearAuth();return}if(!a.access)throw new Error("Missing access token");return{accessToken:a.access,refreshToken:a.refresh??this.getRefreshToken()}})}clearAuth(){console.debug(this.constructor.name,"clearing auth;"),this.dispatch(Bo(!1)),this.clearTokens(),this.dispatch(_()),this.dispatch(_())}async renewTokens(){const e=this.getRefreshToken();if(!e)throw new Error("No refresh token found");console.debug(this.constructor.name,"renewing tokens");try{const n=await this._getRenewedTokens(e);if(!n)return;console.log("Got renewed tokens"),this.setTokens(n)}catch(n){throw console.error("Could not renew tokens; clearing auth",n),this.clearAuth(),n}}tokenIsExpiringSoon(){const e=this.getAccessToken();if(!e)return!1;const n=Date.now()/1e3;let a;try{a=jO(e).exp??n}catch{a=n}return a-n<rb}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 U&&this.clearAuth(),e instanceof Error?Promise.reject(e):Promise.reject(new Error((e??nt).toString()))}}}async handleUnauthorized(e,n){const a=this.client.store.getState();if(e.url.endsWith("/token/refresh/"))throw a.authReducer.isLoggedIn&&console.warn("No signed-in user to sign out."),this.clearAuth(),new U({message:"You have been signed out due to inactivity.",response:n,discard:!0});if(a.authReducer.isLoggedIn)await this.renewTokens();else throw console.debug("Forbidden; user is not logged in."),new U({message:"Incorrect username or password.",response:n,discard:!0})}async initAuth(e){const n=xe.v4();return console.debug(this.constructor.name,"Initiating auth"),this.performRequest({uuid:n,method:h.POST,url:this.initTokensUrl,payload:e,isAuthNeeded:!1,checkAuth:!1}).then(a=>{this.setTokens(ub(a))})}}class ob extends at{constructor(){super(...arguments);m(this,"name","Organization Access");m(this,"url","/organization-accesses");m(this,"actions",{addOne:$T,addMany:UT,setOne:kT,setMany:LT,updateOne:NT,updateMany:GT,deleteOne:HT,deleteMany:KT,initialize:CT});m(this,"selectors",{selectById:YT,selectByIds:ZT})}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:c}=this.selectors,r=c(n.getState(),e.uuid),l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(d=>{throw this.dispatch(a(r)),d}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(l,e),d=jt(l,u.user);this.dispatch(a(u.uuid)),this.dispatch(In(u.user));try{return await this.enqueueRequest({description:O(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${u.uuid}/`,blockers:[u.uuid],blocks:[]})}catch(o){throw this.dispatch(c(u)),this.dispatch(Sn(d)),o}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class hb extends at{constructor(){super(...arguments);m(this,"name","Organization");m(this,"url","/organizations");m(this,"actions",{addOne:sS,addMany:tS,setOne:eS,setMany:xT,updateOne:nS,updateMany:iS,deleteOne:aS,deleteMany:cS,initialize:QT});m(this,"selectors",{selectById:uS,selectByIds:lS})}async add(e){const{addOne:n}=this.actions,a=await this.enqueueRequest({description:O(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:e,blockers:[],blocks:[]});return this.dispatch(n(a)),a}async update(e){const{setOne:n}=this.actions,a=await this.enqueueRequest({description:O(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return this.dispatch(n(a)),a}async invite(e,n){return this.enqueueRequest({description:O(h.POST,this.name,!1),method:h.POST,url:`${this.url}/${e}/invite/${n}/`,blockers:[],blocks:[]})}async refreshStore(e){const{initialize:n}=this.actions,a=await this.list({},e);return this.dispatch(n(a)),a}}class mb extends v{constructor(){super(...arguments);m(this,"name","Project Access");m(this,"url","/project-accesses");m(this,"actions",{addOne:IS,addMany:OS,setOne:PS,setMany:FS,updateOne:gS,updateMany:bS,deleteOne:_S,deleteMany:MS,initialize:SS});m(this,"selectors",{selectById:wS,selectByIds:ES})}add(e){var d;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=M({...e,created_by:((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null});this.dispatch(a(l));const u=this.enqueueRequest({description:O(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:V(l),blockers:[l.organization_access,l.project],blocks:[l.uuid]});return u.then(o=>{this.dispatch(c(o))}).catch(o=>{throw this.dispatch(r(l.uuid)),o}),[l,u]}bulkAdd(e){var o;const{store:n}=this.client,{addMany:a,deleteMany:c,updateMany:r}=this.actions,l=((o=n.getState().userReducer.currentUser)==null?void 0:o.id)??null,u=e.map(y=>M({...y,created_by:l}));this.dispatch(a(u));const d=this.enqueueRequest({description:O(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{project_accesses:u.map(y=>V(y))},blockers:u.flatMap(y=>[y.project,y.organization_access]),blocks:u.map(y=>y.uuid)});return d.then(y=>{this.dispatch(r(y))}).catch(y=>{throw this.dispatch(c(u.map(A=>A.uuid))),y}),[u,d]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(n.getState(),e.uuid),l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[]});return u.then(d=>{this.dispatch(a(d))}).catch(d=>{throw this.dispatch(a(r)),d}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(n.getState(),e);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(l)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{project__organization:e}},n);return this.dispatch(a(c)),c}}class yb extends Xe{constructor(){super(...arguments);m(this,"name","Project Attachment");m(this,"url","/project-attachments");m(this,"actions",{addOne:zS,addMany:BS,setOne:jS,setMany:qS,updateOne:DS,updateMany:CS,deleteOne:$S,deleteMany:US,initialize:VS});m(this,"selectors",{selectById:LS,selectByIds:NS})}getId(e){return e.uuid}buildModel(e){return M({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,project:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,project:e.project}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.projectUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{project__organization:e}},n);return this.dispatch(a(c)),c}}class pb extends v{constructor(){super(...arguments);m(this,"name","Project File");m(this,"url","/project-files");m(this,"actions",{addOne:ZS,addMany:JS,setOne:WS,setMany:YS,updateOne:XS,updateMany:QS,deleteOne:xS,deleteMany:eI,initialize:KS});m(this,"selectors",{selectById:cI,selectByIds:dI})}async saveExisting(e){const{setOne:n}=this.actions;if(!e.uuid)throw new Error("You can only use this method to save existing project files. The one provided has no uuid.");const a={...e};delete a.file;const c=this.enqueueRequest({method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:a,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(n(r))}),c}saveActive(){const{store:e}=this.client,{setOne:n}=this.actions,a=e.getState(),c=a.projectFileReducer.activeProjectFileId;if(!c)throw new Error("No active project file");const r=a.projectFileReducer.instances[c];if(!r)throw new Error("No active project file");if(!r.bounds&&!r.canvas_bounds)throw new Error("Project file must either have bounds or canvas_bounds set");let l;if(typeof r.file=="string"&&!r.file.startsWith("blob:")){const o={...r};delete o.file,l={method:h.PATCH,url:`${this.url}/${c}/`,payload:o,blockers:[c],blocks:[c]}}else l=new Promise((o,y)=>{this.client.files.uploadFileToS3(r.file_sha1).then(([A])=>{o({method:h.POST,url:`${this.url}/`,payload:{...r,...A},blockers:[c],blocks:[c]})}).catch(y)});const d=Promise.resolve(l).then(o=>this.enqueueRequest(o));return d.then(o=>{this.dispatch(n(o))}),this.dispatch(iI),this.dispatch(sI(null)),this.dispatch(tI(!1)),[r,d]}async delete(e){const{store:n}=this.client,{addOne:a,deleteOne:c}=this.actions,{selectById:r}=this.selectors,l=r(n.getState(),e);if(!l)throw new Error(`Expected project file with uuid ${e} to exist in the store.`);this.dispatch(c(e));try{return await this.enqueueRequest({description:O(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(a(l)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(r)),r}}class Ab extends at{constructor(){super(...arguments);m(this,"name","Project");m(this,"url","/projects");m(this,"actions",{addOne:yI,addMany:mI,setOne:hI,setMany:oI,updateOne:AI,updateMany:pI,deleteOne:fI,deleteMany:TI,initialize:lI});m(this,"selectors",{selectById:OI,selectByIds:PI})}async add(e){const{addOne:n}=this.actions,a=await this.performRequest({method:h.POST,url:`${this.url}/`,payload:V(e)});return this.dispatch(n(a)),a}async update(e){const{updateOne:n}=this.actions,a=await this.performRequest({method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:V(e)});return this.dispatch(n(a)),a}async delete(e){const{deleteOne:n}=this.actions,a=await this.enqueueRequest({description:O(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return this.dispatch(n(e)),a}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class fb extends v{constructor(){super(...arguments);m(this,"name","Team Membership");m(this,"url","/team-memberships");m(this,"actions",{addOne:_I,addMany:MI,setOne:RI,setMany:wI,updateOne:EI,updateMany:vI,deleteOne:VI,deleteMany:zI,initialize:bI});m(this,"selectors",{selectById:qI,selectByIds:DI})}add(e){var d;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=M({...e,created_by:((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null});this.dispatch(a(l));const u=this.enqueueRequest({description:O(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:V(l),blockers:[e.team],blocks:[l.uuid]});return u.then(o=>{this.dispatch(c(o))}).catch(()=>{this.dispatch(r(l.uuid))}),[l,u]}bulkAdd(e){var o;const{store:n}=this.client,{addMany:a,setMany:c,deleteMany:r}=this.actions,l=((o=n.getState().userReducer.currentUser)==null?void 0:o.id)??null,u=e.map(y=>M({...y,created_by:l}));this.dispatch(a(u));const d=this.enqueueRequest({description:O(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{team_memberships:u.map(y=>V(y))},blockers:u.map(y=>y.team),blocks:u.map(y=>y.uuid)});return d.then(y=>{this.dispatch(c(y))}).catch(()=>{this.dispatch(r(u.map(y=>y.uuid)))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(l,e);if(!u)throw new Error(`Expected team membership with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{team__organization:e}},n);return this.dispatch(a(c)),c}}class Tb extends v{constructor(){super(...arguments);m(this,"name","Team");m(this,"url","/teams");m(this,"actions",{addOne:UI,addMany:kI,setOne:LI,setMany:NI,updateOne:GI,updateMany:HI,deleteOne:KI,deleteMany:WI,initialize:$I});m(this,"selectors",{selectById:ZI,selectByIds:JI})}add(e){var d;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=M({...e,submitted_at:new Date().toISOString(),created_by:((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null});this.dispatch(a(l));const u=this.enqueueRequest({description:O(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:V(l),blockers:[],blocks:[l.uuid]});return u.then(o=>{this.dispatch(c(o))}).catch(()=>{this.dispatch(r(l.uuid))}),[l,u]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(n.getState(),e.uuid);if(!r)throw new Error(`Expected team with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:V(e),blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(l,e);if(!u)throw new Error(`Expected team with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class Sb extends at{constructor(){super(...arguments);m(this,"name","User");m(this,"url","/user");m(this,"actions",{addOne:Sn,addMany:ET,setOne:wT,setMany:RT,updateOne:VT,updateMany:vT,deleteOne:In,deleteMany:zT,initialize:MT});m(this,"selectors",{selectById:jt,selectByIds:qT})}async list(e,n){const{organizationUuid:a,...c}=e,r=a?`/organizations/${a}${this.url}s/`:`/${this.url}`;return this.performRequest({method:h.GET,url:r,...c},n)}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({organizationUuid:e},n);return this.dispatch(a(c)),c}}async function Un(t,s,e,n,a){const c=n instanceof et;c&&s.checkAuth!==!1&&await n.auth.prepareAuth();const r={queryParams:"",isAuthNeeded:!0},{s3url:l,payload:u,headers:d,method:o,queryParams:y,attachmentHash:A,isExternalUrl:f,isAuthNeeded:S,isResponseBlob:F}={...r,...s};let P=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.`);!f&&!P.startsWith("http")&&(!P.startsWith("/")&&!P.startsWith("blob:")&&(P="/"+P),P=t+P);const b=q=>{if(A){if(!l)throw new Error(`No S3 URL for file ${A}`);if("warning"in l)throw new Error(`S3 URL warning for file ${A}`);if(!g)throw new Error(`No file for file ${A}`);const j=l.fields["x-amz-checksum-sha1"];if(!j)throw new Error(`No checksum for file ${A}`);return q.set("x-amz-checksum-sha1",j).field({...u,...l.fields}).attach("file",g)}return q.send(u)},B={[h.GET]:()=>F?st.get(P.toString()).responseType("blob"):st.get(P.toString()),[h.POST]:()=>{const q=st.post(P.toString());return b(q)},[h.PATCH]:()=>{const q=st.patch(P.toString());return b(q)},[h.PUT]:()=>{const q=st.put(P.toString());return b(q)},[h.DELETE]:()=>{const q=st.delete(P.toString());return b(q)}}[o];let z=B();if(a==null||a.addEventListener("abort",()=>{console.debug("aborting request:",s),z.abort()}),S&&c){const q=n.auth.getAuthHeader();z=z.set("Authorization",q)}d&&(z=z.set(d));try{return await z.query(y)}catch(q){const j=yO(q),_O=j==null?void 0:j.status;if(c&&_O===401)return await n.auth.handleUnauthorized(z,j),z.query(y);throw new U({response:j,innerError:q,discard:qn.includes(_O)})}}class Ib{constructor(s){m(this,"store");this.store=s}_performRequest(s,e,n,a){const c=new Gt,r={...e,uuid:e.uuid??xe.v4()};return Un(s,r,this,n,a).then(l=>{c.resolve(l.body)}).catch(l=>{l instanceof Error?c.reject(l):c.reject(new Error((l??nt).toString()))}),c}async performRequest(s,e,n,a){return this._performRequest(s,e,n,a).then(c=>{if(c instanceof U)throw c;return c})}async enqueueRequest(s,e,n){return this._enqueueRequest(s,e,n).then(a=>{if(a instanceof U)throw a;return a})}_enqueueRequest(s,e,n){const a=new Gt,c={...s,BASE_URL:e,serviceName:n},r=this.store.dispatch(yS(c)),l=d=>{if(d)a.resolve(d.body);else{const o=new U({message:"Could not get a response from the server.",response:d,discard:!0});a.reject(o)}},u=d=>{d instanceof U?d.options.discard=!0:(console.error("Received an unexpected error while processing a request:",d,`
15
- Converting error to APIError and discarding.`),d=new U({message:"An error occurred while processing the request.",innerError:d,discard:!0})),a.reject(d)};return r.then(l,u),a}async performPagination(s,e,n,a,c){const r={...e,queryParams:{...e.queryParams,paginate:!0,limit:n}},{method:l}=r,u=[];let d=await this.performRequest(s,r,a,c);for(u.push(d.results);d.next;)d=await this.performRequest(s,{url:d.next,method:l},a,c),u.push(d.results);return u}}class ct{constructor(){m(this,"graph");m(this,"requestAttemptCounter");this.graph=new qO.DepGraph,this.requestAttemptCounter={}}static _fromOutbox(s){const e=new ct;for(let n=0;n<s.length;n++){const a=s[n];if(!a){console.error("Outbox item was undefined");continue}e.sneakRequest(a);for(let c=0;c<n;c++){const r=s[c];if(!r){console.error("Previous outbox item was undefined");continue}r.payload.uuid!==a.payload.uuid&&r.payload.blocks.some(l=>a.payload.blockers.includes(l))&&ct._addDependency(a.payload.uuid,r.payload.uuid,e.graph)}}return e}_addDependency(s,e){ct._addDependency(s,e,this.graph)}static _addDependency(s,e,n){if(s===e)throw new Error(`Tried to add dependency from node to itself: ${s}`);if(!n.hasNode(s))throw new Error(`Tried to add dependency from non-existent node: ${s} (to node: ${e})`);if(!n.hasNode(e))throw new Error(`Tried to add dependency to non-existent node: ${e} (from node: ${s})`);n.addDependency(s,e)}addRequest(s){if(this.graph.addNode(s.payload.uuid,s),!(s.payload.blockers.length===0||this.graph.size()===1))for(const e of this.graph.overallOrder()){if(e===s.payload.uuid)continue;const n=this.graph.getNodeData(e);s.payload.blockers.some(a=>n.payload.blocks.includes(a))&&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(a=>s.payload.blocks.includes(a))&&this._addDependency(e,s.payload.uuid)}}sneakRequest(s){this.graph.addNode(s.payload.uuid,s)}_getNextNode(){const s=this.graph.overallOrder(!0);let e=1/0,n;for(const a of s){const c=this.requestAttemptCounter[a]||0;c<e&&(e=c,n=a)}return n}peek(){const s=this._getNextNode();if(s)return this.graph.getNodeData(s)}remove(s){this.graph.removeNode(s),delete this.requestAttemptCounter[s]}pop(){const s=this.peek();return s&&this.graph.removeNode(s.payload.uuid),s}getQueue(){const s=this.graph.overallOrder().map(n=>this.graph.getNodeData(n)),e=this._getNextNode();if(e){const n=this.graph.getNodeData(e),a=s.findIndex(c=>c.payload.uuid===n.payload.uuid);a!==-1&&(s.splice(a,1),s.unshift(n))}return s}getReady(){let s=this.graph.overallOrder(!0).map(e=>this.graph.getNodeData(e));return s=s.sort((e,n)=>e.meta.offline.effect.timestamp.localeCompare(n.meta.offline.effect.timestamp)),s=s.sort((e,n)=>{const a=this.requestAttemptCounter[e.payload.uuid]||0,c=this.requestAttemptCounter[n.payload.uuid]||0;return a-c}),s}registerRetry(s){this.requestAttemptCounter[s]=(this.requestAttemptCounter[s]||0)+1}}let pO;function AO(t){pO=t}function dt(){return pO}let fO;function TO(t){fO=t}function SO(){return fO}let kn=null;function tt(){const t=dt();if(!t)return console.warn("Client store not set; cannot get outbox coordinator yet."),null;if(kn)return kn;const s=t.getState().offline.outbox,e=ct._fromOutbox(s);return kn=e,e}const Ob=(t,s)=>{const e=new s(t);return TO(e),AO(t),e};class Pb{constructor(s){m(this,"_all");m(this,"_previous");this._all=[s],this._previous=s,this.then=this.then.bind(this),this.compile=this.compile.bind(this)}then(s){return this._previous&&(this._previous.next=s),this._all.push(s),this._previous=s,{then:this.then,compile:this.compile}}compile(){return this._all}}class Ln{constructor(){m(this,"next");this.next=null}then(s){return new Pb(this).then(s)}async run(s){if(this.next)return this.next.run(s);{if(console.debug("Middleware finished. Performing request:",s),!dt())throw new Error("Client store not set");const n=SO();if(!n)throw new Error("Client SDK not set");return oO(s,n)}}}class IO extends Ln{async run(s){return super.run(s)}}class OO extends Ln{async run(s){return super.run(s)}}const PO=new IO().then(new OO).compile();function FO(t){var s;return(s=PO[0])==null?void 0:s.run(t)}var gO=(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))(gO||{});i.ALL_MIDDLEWARE=PO,i.APIError=U,i.ATTACHMENT_MODEL_DEFAULT_PAGE_SIZE=sO,i.AgentService=cg,i.AssetAttachmentService=dg,i.AssetProcedureService=mg,i.AssetProcedureStepFieldValuesAttachmentService=fg,i.AssetProcedureStepFieldValuesService=Tg,i.AssetProcedureStepFieldsAttachmentService=pg,i.AssetProcedureStepFieldsService=Ag,i.AssetProcedureStepService=Sg,i.AssetProcedureTypeAttachmentService=rg,i.AssetProcedureTypeFieldValuesAttachmentService=og,i.AssetProcedureTypeFieldValuesService=hg,i.AssetProcedureTypeFieldsAttachmentService=ug,i.AssetProcedureTypeFieldsService=lg,i.AssetProcedureTypeService=yg,i.AssetService=Ig,i.AssetStageCompletionService=Og,i.AssetStageService=Pg,i.AssetStatusType=Yn,i.AssetTypeAttachmentService=Fg,i.AssetTypeFieldValuesAttachmentService=_g,i.AssetTypeFieldValuesService=Mg,i.AssetTypeFieldsAttachmentService=gg,i.AssetTypeFieldsService=bg,i.AssetTypeIdentifierService=Rg,i.AssetTypeIdentifierValueService=wg,i.AssetTypeService=Eg,i.AssetTypeStatusService=vg,i.AttachmentModel=Zn,i.BaseApiService=et,i.BaseModelApiService=at,i.BaseOfflineAttachmentModelService=Xe,i.BaseOfflineModelApiService=v,i.BaseSDK=Ib,i.COMMON_AUTO_FIELDS=ra,i.CategoryService=Vg,i.DEFAULT_ISSUE_PRIORITY=DO,i.DEFAULT_PAGE_SIZE=tO,i.DISCARD_HTTP_STATUSES=qn,i.DeferredPromise=Gt,i.DocumentAttachmentService=zg,i.DocumentService=Bg,i.EMPTY_ARRAY=Hn,i.EMPTY_OBJECT=Kn,i.EmailDomainsService=jg,i.EmailVerificationService=qg,i.FileService=Cg,i.FormIdentifierService=$g,i.FormIdentifierValueService=Ug,i.FormRevisionAttachmentService=kg,i.FormRevisionService=Lg,i.FormService=Ng,i.FormSubmissionAttachmentService=Gg,i.FormSubmissionService=Hg,i.GeoImageService=Kg,i.HttpMethod=h,i.IssueAssociationService=Wg,i.IssueAttachmentService=Yg,i.IssueCommentAttachmentService=Zg,i.IssueCommentService=Jg,i.IssuePriority=kt,i.IssueService=Xg,i.IssueStatusType=Jn,i.IssueTypeAttachmentService=Qg,i.IssueTypeFieldValuesAttachmentService=tb,i.IssueTypeFieldValuesService=sb,i.IssueTypeFieldsAttachmentService=xg,i.IssueTypeFieldsService=eb,i.IssueTypeIdentifierService=ib,i.IssueTypeIdentifierValueService=nb,i.IssueTypeService=ab,i.IssueTypeStatusService=cb,i.IssueUpdateChange=$,i.IssueUpdateService=db,i.JWTService=lb,i.MAX_SERVICE_BATCH_SIZE=L,i.OUTBOX_RETRY_DELAY=Xn,i.OfflineAnalyticsMiddleware=IO,i.OfflineMiddleware=Ln,i.OrganizationAccessLevel=Wn,i.OrganizationAccessService=ob,i.OrganizationService=hb,i.OutboxCoordinator=ct,i.ProjectAccessService=mb,i.ProjectAttachmentService=yb,i.ProjectFileService=pb,i.ProjectService=Ab,i.RESET_ORGANIZATION_STATE=w,i.RESET_PROJECT_STATE=C,i.RESET_STATE=_,i.RateLimitingMiddleware=OO,i.SelectorBuilder=yP,i.TeamMembershipService=fb,i.TeamService=Tb,i.UNKNOWN_ERROR_MESSAGE=nt,i.UserService=Sb,i.VERSION_REDUCER_KEY=rt,i.VerificationCodeType=gO,i._setLatestRetryTime=AS,i.addAsset=Vr,i.addAssetAttachment=fa,i.addAssetAttachments=Xt,i.addAssetProcedure=Hc,i.addAssetProcedureStep=Ir,i.addAssetProcedureStepFieldValues=nr,i.addAssetProcedureStepFieldValuesAttachment=Hd,i.addAssetProcedureStepFieldValuesAttachments=Is,i.addAssetProcedureStepFieldValuesMany=ar,i.addAssetProcedureStepFields=Vd,i.addAssetProcedureStepFieldsAttachment=Td,i.addAssetProcedureStepFieldsAttachments=Sd,i.addAssetProcedureStepFieldsMany=zd,i.addAssetProcedureSteps=Or,i.addAssetProcedureType=nd,i.addAssetProcedureTypeAttachment=Ea,i.addAssetProcedureTypeAttachments=va,i.addAssetProcedureTypeFieldValues=vc,i.addAssetProcedureTypeFieldValuesAttachment=Tc,i.addAssetProcedureTypeFieldValuesAttachments=cs,i.addAssetProcedureTypeFieldValuesMany=Vc,i.addAssetProcedureTypeFields=nc,i.addAssetProcedureTypeFieldsAttachment=Ga,i.addAssetProcedureTypeFieldsAttachments=Ha,i.addAssetProcedureTypeFieldsMany=ac,i.addAssetProcedureTypes=ad,i.addAssetProcedures=os,i.addAssetStage=du,i.addAssetStageCompletion=Gr,i.addAssetStageCompletions=Hr,i.addAssetStages=ru,i.addAssetType=uo,i.addAssetTypeAttachment=Tu,i.addAssetTypeAttachments=qs,i.addAssetTypeFieldValues=Tl,i.addAssetTypeFieldValuesAttachment=al,i.addAssetTypeFieldValuesAttachments=Ns,i.addAssetTypeFieldValuesMany=Sl,i.addAssetTypeFields=Hu,i.addAssetTypeFieldsAttachment=vu,i.addAssetTypeFieldsAttachments=Vu,i.addAssetTypeFieldsMany=Ku,i.addAssetTypeIdentifier=Vl,i.addAssetTypeIdentifierValue=Kl,i.addAssetTypeIdentifierValues=Wl,i.addAssetTypeIdentifiers=zl,i.addAssetTypeStatus=Oo,i.addAssetTypeStatuses=Po,i.addAssetTypes=lo,i.addAssets=Ms,i.addCategories=$o,i.addCategory=Co,i.addConversation=ea,i.addConversations=$O,i.addDocument=oh,i.addDocumentAttachment=Xo,i.addDocumentAttachments=Qo,i.addDocuments=hh,i.addEmailDomain=bh,i.addEmailDomains=_h,i.addForm=Lm,i.addFormIdentifier=Gh,i.addFormIdentifierValue=nm,i.addFormIdentifierValues=am,i.addFormIdentifiers=Hh,i.addFormRevision=pi,i.addFormRevisionAttachment=Tm,i.addFormRevisionAttachments=Sm,i.addFormRevisions=Ai,i.addFormSubmission=Ay,i.addFormSubmissionAttachment=sy,i.addFormSubmissionAttachments=Fi,i.addFormSubmissions=wi,i.addForms=Nm,i.addGeoImage=wy,i.addGeoImages=Ey,i.addIssue=Lp,i.addIssueAssociation=Hy,i.addIssueAssociations=wt,i.addIssueAttachment=sp,i.addIssueAttachments=qi,i.addIssueComment=wp,i.addIssueCommentAttachment=pp,i.addIssueCommentAttachments=Ap,i.addIssueComments=Ep,i.addIssueType=Hf,i.addIssueTypeAttachment=tA,i.addIssueTypeAttachments=sA,i.addIssueTypeFieldValues=wA,i.addIssueTypeFieldValuesAttachment=nf,i.addIssueTypeFieldValuesAttachments=xi,i.addIssueTypeFieldValuesMany=EA,i.addIssueTypeFields=NA,i.addIssueTypeFieldsAttachment=pA,i.addIssueTypeFieldsAttachments=AA,i.addIssueTypeFieldsMany=GA,i.addIssueTypeIdentifier=ff,i.addIssueTypeIdentifierValue=vf,i.addIssueTypeIdentifierValues=Vf,i.addIssueTypeIdentifiers=Tf,i.addIssueTypeStatus=aT,i.addIssueTypeStatuses=cT,i.addIssueTypes=Kf,i.addIssueUpdate=hn,i.addIssueUpdates=mn,i.addIssues=Gi,i.addOrganization=sS,i.addOrganizationAccess=$T,i.addOrganizationAccesses=UT,i.addOrganizations=tS,i.addProject=yI,i.addProjectAccess=IS,i.addProjectAccesses=OS,i.addProjectAttachment=zS,i.addProjectAttachments=BS,i.addProjectFile=ZS,i.addProjectFiles=JS,i.addProjects=mI,i.addTeam=UI,i.addTeamMembership=_I,i.addTeamMemberships=MI,i.addTeams=kI,i.addUser=Sn,i.addUsers=ET,i.agentsReducer=ia,i.agentsSlice=Lt,i.areArraysEqual=WO,i.assetAttachmentReducer=Ma,i.assetAttachmentSlice=Jt,i.assetProcedureReducer=Xc,i.assetProcedureSlice=ls,i.assetProcedureStepFieldValuesAttachmentReducer=tr,i.assetProcedureStepFieldValuesAttachmentSlice=Ss,i.assetProcedureStepFieldValuesReducer=pr,i.assetProcedureStepFieldValuesSlice=Fs,i.assetProcedureStepFieldsAttachmentReducer=wd,i.assetProcedureStepFieldsAttachmentSlice=ps,i.assetProcedureStepFieldsReducer=Ld,i.assetProcedureStepFieldsSlice=fs,i.assetProcedureStepReducer=_r,i.assetProcedureStepSlice=gs,i.assetProcedureTypeAttachmentReducer=Ca,i.assetProcedureTypeAttachmentSlice=es,i.assetProcedureTypeFieldValuesAttachmentReducer=gc,i.assetProcedureTypeFieldValuesAttachmentSlice=as,i.assetProcedureTypeFieldValuesReducer=$c,i.assetProcedureTypeFieldValuesSlice=us,i.assetProcedureTypeFieldsAttachmentReducer=Qa,i.assetProcedureTypeFieldsAttachmentSlice=ss,i.assetProcedureTypeFieldsReducer=hc,i.assetProcedureTypeFieldsSlice=ns,i.assetProcedureTypeReducer=hd,i.assetProcedureTypeSlice=ms,i.assetReducer=kr,i.assetSlice=_s,i.assetStageCompletionReducer=Qr,i.assetStageCompletionSlice=vs,i.assetStageReducer=mu,i.assetStageSlice=Vs,i.assetTypeAttachmentReducer=Ru,i.assetTypeAttachmentSlice=js,i.assetTypeFieldValuesAttachmentReducer=pl,i.assetTypeFieldValuesAttachmentSlice=Ls,i.assetTypeFieldValuesReducer=wl,i.assetTypeFieldValuesSlice=Ks,i.assetTypeFieldsAttachmentReducer=Lu,i.assetTypeFieldsAttachmentSlice=$s,i.assetTypeFieldsReducer=sl,i.assetTypeFieldsSlice=ks,i.assetTypeIdentifierReducer=Nl,i.assetTypeIdentifierSlice=Ws,i.assetTypeIdentifierValueReducer=io,i.assetTypeIdentifierValueSlice=Zs,i.assetTypeReducer=To,i.assetTypeSlice=Js,i.assetTypeStatusReducer=Vo,i.assetTypeStatusSlice=Qs,i.assetTypeStatusSortFn=oa,i.authReducer=jo,i.authSlice=gt,i.baseReducer=HF,i.baseReducers=jn,i.blobToBase64=sP,i.categoryReducer=Yo,i.categorySlice=ei,i.clearTokens=WP,i.constructUploadedFilePayloads=tP,i.createDeepEqualSelector=pP,i.createModelAdapter=R,i.createOfflineAction=hS,i.createPayload=V,i.createSelectionAdapter=CO,i.createShallowEqualSelector=I,i.deleteAsset=jr,i.deleteAssetAttachment=Pa,i.deleteAssetAttachments=Qt,i.deleteAssetProcedure=Yc,i.deleteAssetProcedureStep=gr,i.deleteAssetProcedureStepFieldValues=lr,i.deleteAssetProcedureStepFieldValuesAttachment=Jd,i.deleteAssetProcedureStepFieldValuesAttachments=Os,i.deleteAssetProcedureStepFieldValuesMany=or,i.deleteAssetProcedureStepFields=Cd,i.deleteAssetProcedureStepFieldsAttachment=gd,i.deleteAssetProcedureStepFieldsAttachments=bd,i.deleteAssetProcedureStepFieldsMany=$d,i.deleteAssetProcedureSteps=br,i.deleteAssetProcedureType=rd,i.deleteAssetProcedureTypeAttachment=qa,i.deleteAssetProcedureTypeAttachments=Da,i.deleteAssetProcedureTypeFieldValues=Dc,i.deleteAssetProcedureTypeFieldValuesAttachment=Fc,i.deleteAssetProcedureTypeFieldValuesAttachments=ds,i.deleteAssetProcedureTypeFieldValuesMany=Cc,i.deleteAssetProcedureTypeFields=lc,i.deleteAssetProcedureTypeFieldsAttachment=Ja,i.deleteAssetProcedureTypeFieldsAttachments=Xa,i.deleteAssetProcedureTypeFieldsMany=oc,i.deleteAssetProcedureTypes=ud,i.deleteAssetProcedures=hs,i.deleteAssetStage=ou,i.deleteAssetStageCompletion=Jr,i.deleteAssetStageCompletions=Xr,i.deleteAssetStages=hu,i.deleteAssetType=mo,i.deleteAssetTypeAttachment=Fu,i.deleteAssetTypeAttachments=Ds,i.deleteAssetTypeFieldValues=gl,i.deleteAssetTypeFieldValuesAttachment=ll,i.deleteAssetTypeFieldValuesAttachments=Gs,i.deleteAssetTypeFieldValuesMany=bl,i.deleteAssetTypeFields=Xu,i.deleteAssetTypeFieldsAttachment=Du,i.deleteAssetTypeFieldsAttachments=Cu,i.deleteAssetTypeFieldsMany=Qu,i.deleteAssetTypeIdentifier=Cl,i.deleteAssetTypeIdentifierValue=Ql,i.deleteAssetTypeIdentifierValues=xl,i.deleteAssetTypeIdentifiers=$l,i.deleteAssetTypeStatus=Mo,i.deleteAssetTypeStatuses=Ro,i.deleteAssetTypes=yo,i.deleteAssets=Rs,i.deleteCategories=Ho,i.deleteCategory=Go,i.deleteConversation=LO,i.deleteConversations=NO,i.deleteDocument=fh,i.deleteDocumentAttachment=ih,i.deleteDocumentAttachments=nh,i.deleteDocuments=Th,i.deleteEmailDomain=vh,i.deleteEmailDomains=Vh,i.deleteForm=Ym,i.deleteFormIdentifier=Jh,i.deleteFormIdentifierValue=lm,i.deleteFormIdentifierValues=om,i.deleteFormIdentifiers=Xh,i.deleteFormRevision=fi,i.deleteFormRevisionAttachment=gm,i.deleteFormRevisionAttachments=bm,i.deleteFormRevisions=Ti,i.deleteFormSubmission=Sy,i.deleteFormSubmissionAttachment=dy,i.deleteFormSubmissionAttachments=gi,i.deleteFormSubmissions=Ei,i.deleteForms=Zm,i.deleteGeoImage=zy,i.deleteGeoImages=By,i.deleteIssue=Wp,i.deleteIssueAssociation=Ky,i.deleteIssueAssociations=Et,i.deleteIssueAttachment=dp,i.deleteIssueAttachments=Di,i.deleteIssueComment=jp,i.deleteIssueCommentAttachment=Op,i.deleteIssueCommentAttachments=Pp,i.deleteIssueComments=qp,i.deleteIssueType=Xf,i.deleteIssueTypeAttachment=dA,i.deleteIssueTypeAttachments=rA,i.deleteIssueTypeFieldValues=jA,i.deleteIssueTypeFieldValuesAttachment=uf,i.deleteIssueTypeFieldValuesAttachments=en,i.deleteIssueTypeFieldValuesMany=qA,i.deleteIssueTypeFields=ZA,i.deleteIssueTypeFieldsAttachment=OA,i.deleteIssueTypeFieldsAttachments=PA,i.deleteIssueTypeFieldsMany=JA,i.deleteIssueTypeIdentifier=Ff,i.deleteIssueTypeIdentifierValue=Df,i.deleteIssueTypeIdentifierValues=Cf,i.deleteIssueTypeIdentifiers=gf,i.deleteIssueTypeStatus=oT,i.deleteIssueTypeStatuses=hT,i.deleteIssueTypes=Qf,i.deleteIssueUpdate=yn,i.deleteIssueUpdates=pn,i.deleteIssues=Hi,i.deleteOrganization=aS,i.deleteOrganizationAccess=HT,i.deleteOrganizationAccesses=KT,i.deleteOrganizations=cS,i.deleteProject=fI,i.deleteProjectAccess=_S,i.deleteProjectAccesses=MS,i.deleteProjectAttachment=$S,i.deleteProjectAttachments=US,i.deleteProjectFile=xS,i.deleteProjectFiles=eI,i.deleteProjects=TI,i.deleteTeam=KI,i.deleteTeamMembership=VI,i.deleteTeamMemberships=zI,i.deleteTeams=WI,i.deleteUser=In,i.deleteUsers=zT,i.dequeue=lO,i.discard=hO,i.documentAttachmentReducer=rh,i.documentAttachmentSlice=ii,i.documentSlice=ai,i.documentsReducer=Sh,i.downloadFile=iP,i.downloadInMemoryFile=eP,i.emailDomainsReducer=qh,i.emailDomainsSlice=di,i.emailRegex=lP,i.enqueue=uO,i.enqueueRequest=yS,i.extractResponseFromError=yO,i.fallbackToEmptyArray=T,i.fallbackToEmptyObject=pt,i.fileReducer=kh,i.fileSlice=ui,i.fileToBlob=ca,i.formIdentifierReducer=tm,i.formIdentifierSlice=li,i.formIdentifierValueReducer=pm,i.formIdentifierValueSlice=hi,i.formReducer=Jm,i.formRevisionAttachmentReducer=wm,i.formRevisionAttachmentSlice=mi,i.formRevisionReducer=$m,i.formRevisionsSlice=yi,i.formSlice=Ii,i.formSubmissionAttachmentReducer=oy,i.formSubmissionAttachmentSlice=Pi,i.formSubmissionReducer=gy,i.formSubmissionSlice=Ri,i.geoImageReducer=Cy,i.geoImageSlice=Vi,i.getAssetProcedureStepSubTree=la,i.getAssetProcedureStepTrees=oP,i.getClientSDK=SO,i.getClientStore=dt,i.getDocumentSubTree=ya,i.getDocumentTrees=hP,i.getFileIdentifier=xO,i.getFileS3Key=Yt,i.getLocalDateString=na,i.getLocalRelativeDateString=XO,i.getOutboxCoordinator=tt,i.getRenamedFile=aa,i.getRequestDescription=O,i.hashFile=it,i.initSDK=Ob,i.initializeAssetAttachments=Aa,i.initializeAssetProcedureStepFieldValues=ir,i.initializeAssetProcedureStepFieldValuesAttachments=Gd,i.initializeAssetProcedureStepFields=vd,i.initializeAssetProcedureStepFieldsAttachments=fd,i.initializeAssetProcedureSteps=fr,i.initializeAssetProcedureTypeAttachments=wa,i.initializeAssetProcedureTypeFieldValues=Ec,i.initializeAssetProcedureTypeFieldValuesAttachments=fc,i.initializeAssetProcedureTypeFields=ic,i.initializeAssetProcedureTypeFieldsAttachments=Na,i.initializeAssetProcedureTypes=id,i.initializeAssetProcedures=Gc,i.initializeAssetStageCompletions=Nr,i.initializeAssetStages=nu,i.initializeAssetTypeAttachments=fu,i.initializeAssetTypeFieldValues=fl,i.initializeAssetTypeFieldValuesAttachments=nl,i.initializeAssetTypeFields=Gu,i.initializeAssetTypeFieldsAttachments=Eu,i.initializeAssetTypeIdentifierValues=Hl,i.initializeAssetTypeIdentifiers=vl,i.initializeAssetTypeStatuses=Io,i.initializeAssetTypes=ao,i.initializeAssets=vr,i.initializeCategories=Do,i.initializeConversations=xn,i.initializeDocumentAttachments=Jo,i.initializeDocuments=lh,i.initializeEmailDomains=gh,i.initializeFormIdentifierValues=im,i.initializeFormIdentifiers=Nh,i.initializeFormRevisionAttachments=fm,i.initializeFormRevisions=vm,i.initializeFormSubmissionAttachments=ty,i.initializeFormSubmissions=my,i.initializeForms=km,i.initializeGeoImages=_y,i.initializeIssueAssociations=Uy,i.initializeIssueAttachments=tp,i.initializeIssueCommentAttachments=yp,i.initializeIssueComments=Rp,i.initializeIssueTypeAttachments=eA,i.initializeIssueTypeFieldValues=RA,i.initializeIssueTypeFieldValuesAttachments=sf,i.initializeIssueTypeFields=LA,i.initializeIssueTypeFieldsAttachments=yA,i.initializeIssueTypeIdentifierValues=Ef,i.initializeIssueTypeIdentifiers=Af,i.initializeIssueTypeStatuses=nT,i.initializeIssueTypes=Gf,i.initializeIssueUpdates=fT,i.initializeIssues=kp,i.initializeOrganizationAccesses=CT,i.initializeOrganizations=QT,i.initializeProjectAccesses=SS,i.initializeProjectAttachments=VS,i.initializeProjectFiles=KS,i.initializeProjects=lI,i.initializeTeamMemberships=bI,i.initializeTeams=$I,i.initializeUsers=MT,i.isToday=JO,i.issueAssociationReducer=xy,i.issueAssociationSlice=Bi,i.issueAttachmentReducer=hp,i.issueAttachmentSlice=ji,i.issueCommentAttachmentReducer=_p,i.issueCommentAttachmentSlice=$i,i.issueCommentReducer=$p,i.issueCommentSlice=ki,i.issueReducer=Qp,i.issueSlice=Ni,i.issueTypeAttachmentReducer=hA,i.issueTypeAttachmentSlice=Ki,i.issueTypeFieldValuesAttachmentReducer=yf,i.issueTypeFieldValuesAttachmentSlice=Qi,i.issueTypeFieldValuesReducer=UA,i.issueTypeFieldValuesSlice=Ji,i.issueTypeFieldsAttachmentReducer=_A,i.issueTypeFieldsAttachmentSlice=Yi,i.issueTypeFieldsReducer=ef,i.issueTypeFieldsSlice=Xi,i.issueTypeIdentifierReducer=Rf,i.issueTypeIdentifierSlice=sn,i.issueTypeIdentifierValueReducer=Lf,i.issueTypeIdentifierValueSlice=an,i.issueTypeReducer=sT,i.issueTypeSlice=cn,i.issueTypeStatusReducer=pT,i.issueTypeStatusSlice=rn,i.issueTypeStatusSortFn=ha,i.issueUpdateReducer=bT,i.issueUpdateSlice=on,i.logOnlyOnce=nP,i.markAsDeleted=pS,i.markForDeletion=wF,i.memoize=Kt,i.organizationAccessReducer=WT,i.organizationAccessSlice=Pn,i.organizationReducer=oS,i.organizationSlice=Fn,i.outboxReducer=fS,i.outboxSlice=gn,i.overmapEnhancer=eg,i.overmapReducer=KF,i.overmapReducers=eO,i.performRequest=Un,i.performRequestFromAction=oO,i.projectAccessReducer=RS,i.projectAccessSlice=bn,i.projectAttachmentReducer=GS,i.projectAttachmentSlice=Mn,i.projectFileReducer=rI,i.projectFileSlice=wn,i.projectReducer=SI,i.projectSlice=En,i.rehydratedReducer=FI,i.rehydratedSlice=vn,i.runMiddleware=FO,i.saveActiveProjectFileBounds=iI,i.selectAccessToken=YP,i.selectAccessesByUserOfProject=vF,i.selectAccessibleProjects=qF,i.selectActiveOrganizationAccess=bF,i.selectActiveProjectFileId=BF,i.selectAllDocumentAttachments=ni,i.selectAssetAttachmentById=ga,i.selectAssetAttachmentMapping=Fa,i.selectAssetAttachments=xt,i.selectAssetAttachmentsByIds=ba,i.selectAssetById=$r,i.selectAssetProcedureById=ed,i.selectAssetProcedureStepById=Mr,i.selectAssetProcedureStepFieldValues=ut,i.selectAssetProcedureStepFieldValuesAttachmentById=Qd,i.selectAssetProcedureStepFieldValuesAttachments=Ps,i.selectAssetProcedureStepFieldValuesAttachmentsByIds=xd,i.selectAssetProcedureStepFieldValuesAttachmentsMapping=Xd,i.selectAssetProcedureStepFieldValuesById=mr,i.selectAssetProcedureStepFieldValuesByIds=yr,i.selectAssetProcedureStepFieldValuesMapping=hr,i.selectAssetProcedureStepFieldValuesOfAsset=RP,i.selectAssetProcedureStepFieldValuesOfAssetProcedure=wP,i.selectAssetProcedureStepFieldValuesOfAssetProcedureStep=EP,i.selectAssetProcedureStepFields=It,i.selectAssetProcedureStepFieldsAttachmentById=Md,i.selectAssetProcedureStepFieldsAttachments=As,i.selectAssetProcedureStepFieldsAttachmentsByIds=Rd,i.selectAssetProcedureStepFieldsAttachmentsMapping=_d,i.selectAssetProcedureStepFieldsById=Ud,i.selectAssetProcedureStepFieldsByIds=kd,i.selectAssetProcedureStepFieldsMapping=Ts,i.selectAssetProcedureStepFieldsOfAssetProcedureStep=bP,i.selectAssetProcedureStepMapping=Ot,i.selectAssetProcedureSteps=bs,i.selectAssetProcedureStepsByIds=Rr,i.selectAssetProcedureStepsMappingOfAssetProcedureType=vP,i.selectAssetProcedureStepsOfAssetProcedureType=VP,i.selectAssetProcedureTypeAttachmentById=Ua,i.selectAssetProcedureTypeAttachmentMapping=$a,i.selectAssetProcedureTypeAttachments=ts,i.selectAssetProcedureTypeAttachmentsByIds=ka,i.selectAssetProcedureTypeById=yd,i.selectAssetProcedureTypeFieldValues=Tt,i.selectAssetProcedureTypeFieldValuesAttachmentById=_c,i.selectAssetProcedureTypeFieldValuesAttachments=rs,i.selectAssetProcedureTypeFieldValuesAttachmentsByIds=Mc,i.selectAssetProcedureTypeFieldValuesAttachmentsMapping=bc,i.selectAssetProcedureTypeFieldValuesById=kc,i.selectAssetProcedureTypeFieldValuesByIds=Lc,i.selectAssetProcedureTypeFieldValuesMapping=Uc,i.selectAssetProcedureTypeFieldValuesOfAsset=IP,i.selectAssetProcedureTypeFields=ft,i.selectAssetProcedureTypeFieldsAttachmentById=ec,i.selectAssetProcedureTypeFieldsAttachments=is,i.selectAssetProcedureTypeFieldsAttachmentsByIds=tc,i.selectAssetProcedureTypeFieldsAttachmentsMapping=xa,i.selectAssetProcedureTypeFieldsById=yc,i.selectAssetProcedureTypeFieldsByIds=pc,i.selectAssetProcedureTypeFieldsMapping=mc,i.selectAssetProcedureTypeFieldsOfAssetProcedureType=TP,i.selectAssetProcedureTypes=ys,i.selectAssetProcedureTypesByIds=pd,i.selectAssetProcedureTypesMapping=md,i.selectAssetProcedureTypesOfOrganization=FP,i.selectAssetProcedures=St,i.selectAssetProceduresByIds=td,i.selectAssetProceduresMapping=Qc,i.selectAssetProceduresOfAssetProcedureType=xc,i.selectAssetProceduresOfAssetType=PP,i.selectAssetStageById=yu,i.selectAssetStageCompletionById=tu,i.selectAssetStageCompletionMapping=xr,i.selectAssetStageCompletions=eu,i.selectAssetStageCompletionsByIds=su,i.selectAssetStages=Bs,i.selectAssetStagesByIds=pu,i.selectAssetStagesMappingOfAssetProcedureType=BP,i.selectAssetStagesOfAssetProcedureType=jP,i.selectAssetTypeAttachmentById=bu,i.selectAssetTypeAttachmentMapping=gu,i.selectAssetTypeAttachments=Cs,i.selectAssetTypeAttachmentsByIds=_u,i.selectAssetTypeById=Ao,i.selectAssetTypeFieldValues=Pt,i.selectAssetTypeFieldValuesAttachmentById=hl,i.selectAssetTypeFieldValuesAttachments=Hs,i.selectAssetTypeFieldValuesAttachmentsByIds=ml,i.selectAssetTypeFieldValuesAttachmentsMapping=ol,i.selectAssetTypeFieldValuesById=Ml,i.selectAssetTypeFieldValuesByIds=Rl,i.selectAssetTypeFieldValuesMapping=_l,i.selectAssetTypeFieldValuesOfAsset=$P,i.selectAssetTypeFields=lt,i.selectAssetTypeFieldsAttachmentById=Uu,i.selectAssetTypeFieldsAttachments=Us,i.selectAssetTypeFieldsAttachmentsByIds=ku,i.selectAssetTypeFieldsAttachmentsMapping=$u,i.selectAssetTypeFieldsById=el,i.selectAssetTypeFieldsByIds=tl,i.selectAssetTypeFieldsMapping=xu,i.selectAssetTypeFieldsOfAssetType=DP,i.selectAssetTypeIdentifierById=kl,i.selectAssetTypeIdentifierMapping=Ul,i.selectAssetTypeIdentifierValueById=to,i.selectAssetTypeIdentifierValueMapping=eo,i.selectAssetTypeIdentifierValues=Ft,i.selectAssetTypeIdentifierValuesByIds=so,i.selectAssetTypeIdentifierValuesOfAsset=LP,i.selectAssetTypeIdentifierValuesOfIdentifier=NP,i.selectAssetTypeIdentifiers=Ys,i.selectAssetTypeIdentifiersByIds=Ll,i.selectAssetTypeIdentifiersOfAssetType=kP,i.selectAssetTypeStatusById=Eo,i.selectAssetTypeStatusMapping=wo,i.selectAssetTypeStatuses=xs,i.selectAssetTypeStatusesByIds=vo,i.selectAssetTypeStatusesOfAssetType=HP,i.selectAssetTypeValuesOfAssetType=UP,i.selectAssetTypes=Xs,i.selectAssetTypesByIds=fo,i.selectAssetTypesMapping=po,i.selectAssetTypesOfOrganization=GP,i.selectAssets=ws,i.selectAssetsByIds=Ur,i.selectAssetsMapping=Cr,i.selectAssetsOfAssetType=Es,i.selectAttachmentsOfAsset=_a,i.selectAttachmentsOfAssetProcedureStepFieldValues=er,i.selectAttachmentsOfAssetProcedureStepFields=gP,i.selectAttachmentsOfAssetProcedureType=AP,i.selectAttachmentsOfAssetProcedureTypeFieldValues=Rc,i.selectAttachmentsOfAssetProcedureTypeFields=fP,i.selectAttachmentsOfAssetType=Mu,i.selectAttachmentsOfAssetTypeFieldValues=yl,i.selectAttachmentsOfAssetTypeFields=qP,i.selectAttachmentsOfDocument=XP,i.selectAttachmentsOfFormRevision=aF,i.selectAttachmentsOfFormSubmission=ly,i.selectAttachmentsOfIssue=up,i.selectAttachmentsOfIssueComment=uF,i.selectAttachmentsOfIssueType=hF,i.selectAttachmentsOfIssueTypeFieldValues=mf,i.selectAttachmentsOfIssueTypeFields=mF,i.selectAttachmentsOfProject=zF,i.selectCategories=ti,i.selectCategoriesByIds=Wo,i.selectCategoriesOfProject=JP,i.selectCategoryById=si,i.selectCategoryMapping=Ko,i.selectCommentsOfIssue=lF,i.selectConversation=HO,i.selectConversationMapping=Nt,i.selectConversations=GO,i.selectCurrentUser=jT,i.selectDeletedRequests=MF,i.selectDescendantsOfAssetProcedureStep=wr,i.selectDescendantsOfDocument=Ph,i.selectDocumentAttachmentById=ch,i.selectDocumentAttachmentMapping=ah,i.selectDocumentAttachmentsByIds=dh,i.selectDocumentById=Ih,i.selectDocuments=bt,i.selectDocumentsByIds=Oh,i.selectDocumentsMapping=ci,i.selectEmailDomainById=Bh,i.selectEmailDomains=ri,i.selectEmailDomainsAsMapping=zh,i.selectEmailDomainsByIds=jh,i.selectEmailDomainsOfOrganization=eF,i.selectFieldValuesOfAssetProcedure=OP,i.selectFormById=Qm,i.selectFormIdentifierById=xh,i.selectFormIdentifierMapping=Qh,i.selectFormIdentifierValueById=mm,i.selectFormIdentifierValueMapping=hm,i.selectFormIdentifierValues=_t,i.selectFormIdentifierValuesByIds=ym,i.selectFormIdentifierValuesOfFormSubmission=iF,i.selectFormIdentifierValuesOfIdentifier=nF,i.selectFormIdentifiers=oi,i.selectFormIdentifiersByIds=em,i.selectFormIdentifiersOfForm=sF,i.selectFormMapping=Xm,i.selectFormRevisionAttachmentById=Mm,i.selectFormRevisionAttachments=_m,i.selectFormRevisionAttachmentsByIds=Rm,i.selectFormRevisionAttachmentsMapping=Mt,i.selectFormRevisionById=qm,i.selectFormRevisionMapping=Si,i.selectFormRevisions=Rt,i.selectFormRevisionsByIds=Dm,i.selectFormRevisionsOfForm=Cm,i.selectFormSubmissionAttachemntsByIds=Mi,i.selectFormSubmissionAttachmentById=ry,i.selectFormSubmissionAttachments=_i,i.selectFormSubmissionAttachmentsByIds=uy,i.selectFormSubmissionAttachmentsMapping=bi,i.selectFormSubmissionById=Oy,i.selectFormSubmissions=Iy,i.selectFormSubmissionsByIds=Py,i.selectFormSubmissionsMapping=vi,i.selectFormSubmissionsOfForm=Fy,i.selectForms=Oi,i.selectFormsByIds=xm,i.selectFormsOfOrganization=dF,i.selectGeoImageById=qy,i.selectGeoImageMapping=jy,i.selectGeoImages=zi,i.selectGeoImagesByIds=Dy,i.selectGeoImagesOfProject=rF,i.selectIsImportingProjectFile=jF,i.selectIsLoggedIn=ZP,i.selectIssueAssociationById=Yy,i.selectIssueAssociationMapping=ot,i.selectIssueAssociations=Wy,i.selectIssueAssociationsByIds=Zy,i.selectIssueAssociationsOfAsset=Qy,i.selectIssueAssociationsOfIssue=Xy,i.selectIssueAssociationsToIssue=Jy,i.selectIssueAttachmentById=lp,i.selectIssueAttachmentMapping=rp,i.selectIssueAttachments=Ci,i.selectIssueAttachmentsByIds=op,i.selectIssueById=Zp,i.selectIssueCommentAttachmentById=gp,i.selectIssueCommentAttachmentMapping=Fp,i.selectIssueCommentAttachments=Ui,i.selectIssueCommentAttachmentsByIds=bp,i.selectIssueCommentById=Dp,i.selectIssueCommentMapping=Li,i.selectIssueCommentsByIds=Cp,i.selectIssueMapping=Yp,i.selectIssueTypeAttachmentById=lA,i.selectIssueTypeAttachmentMapping=uA,i.selectIssueTypeAttachments=Wi,i.selectIssueTypeAttachmentsByIds=oA,i.selectIssueTypeById=eT,i.selectIssueTypeFieldValues=Vt,i.selectIssueTypeFieldValuesAttachmentById=of,i.selectIssueTypeFieldValuesAttachments=tn,i.selectIssueTypeFieldValuesAttachmentsByIds=hf,i.selectIssueTypeFieldValuesAttachmentsMapping=lf,i.selectIssueTypeFieldValuesById=CA,i.selectIssueTypeFieldValuesByIds=$A,i.selectIssueTypeFieldValuesMapping=DA,i.selectIssueTypeFieldValuesOfIssue=yF,i.selectIssueTypeFields=ht,i.selectIssueTypeFieldsAttachmentById=gA,i.selectIssueTypeFieldsAttachments=Zi,i.selectIssueTypeFieldsAttachmentsByIds=bA,i.selectIssueTypeFieldsAttachmentsMapping=FA,i.selectIssueTypeFieldsById=QA,i.selectIssueTypeFieldsByIds=xA,i.selectIssueTypeFieldsMapping=XA,i.selectIssueTypeFieldsOfIssueType=pF,i.selectIssueTypeIdentifierById=_f,i.selectIssueTypeIdentifierMapping=bf,i.selectIssueTypeIdentifierValueById=Uf,i.selectIssueTypeIdentifierValueMapping=$f,i.selectIssueTypeIdentifierValues=zt,i.selectIssueTypeIdentifierValuesByIds=kf,i.selectIssueTypeIdentifierValuesOfIdentifier=IF,i.selectIssueTypeIdentifierValuesOfIssue=SF,i.selectIssueTypeIdentifiers=nn,i.selectIssueTypeIdentifiersByIds=Mf,i.selectIssueTypeIdentifiersOfIssueType=TF,i.selectIssueTypeMapping=xf,i.selectIssueTypeStatusById=ln,i.selectIssueTypeStatusMapping=mT,i.selectIssueTypeStatuses=un,i.selectIssueTypeStatusesByIds=yT,i.selectIssueTypeStatusesOfIssueType=PF,i.selectIssueTypeValuesOfIssueType=fF,i.selectIssueTypes=dn,i.selectIssueTypesByIds=tT,i.selectIssueTypesOfOrganization=OF,i.selectIssueUpdateById=PT,i.selectIssueUpdateMapping=An,i.selectIssueUpdates=fn,i.selectIssueUpdatesByIds=FT,i.selectIssueUpdatesOfIssue=gT,i.selectIssues=vt,i.selectIssuesByIds=Jp,i.selectIssuesOfIssueType=Xp,i.selectIssuesOfProject=oF,i.selectLatestAssetProcedureStepFieldsOfAssetProcedureStep=_P,i.selectLatestAssetProcedureTypeFieldsOfAssetProcedureType=SP,i.selectLatestAssetTypeFieldsOfAssetType=CP,i.selectLatestFieldsByAssetProcedureStep=MP,i.selectLatestFormRevisionOfForm=cF,i.selectLatestIssueTypeFieldsOfIssueType=AF,i.selectLatestRetryTime=RF,i.selectMembershipsByUserOfTeam=kF,i.selectNumberOfAssetsOfAssetType=zP,i.selectOrganizationAccessById=YT,i.selectOrganizationAccessMapping=qt,i.selectOrganizationAccessUserMapping=JT,i.selectOrganizationAccessesByIds=ZT,i.selectOrganizationById=uS,i.selectOrganizationDocuments=xP,i.selectOrganizations=rS,i.selectOrganizationsByIds=lS,i.selectOrganizationsMapping=dS,i.selectProjectAccessById=wS,i.selectProjectAccessMapping=_n,i.selectProjectAccesses=mt,i.selectProjectAccessesByIds=ES,i.selectProjectAccessesOfProject=EF,i.selectProjectAttachmentById=LS,i.selectProjectAttachmentMapping=kS,i.selectProjectAttachments=Rn,i.selectProjectAttachmentsByIds=NS,i.selectProjectById=OI,i.selectProjectDocuments=QP,i.selectProjectFileById=cI,i.selectProjectFileMapping=nI,i.selectProjectFiles=aI,i.selectProjectFilesByIds=dI,i.selectProjectMapping=II,i.selectProjects=Dt,i.selectProjectsByIds=PI,i.selectProjectsOfOrganization=DF,i.selectRehydrated=UF,i.selectStageMapping=zs,i.selectTeamById=ZI,i.selectTeamMembershipById=qI,i.selectTeamMemberships=Ct,i.selectTeamMembershipsByIds=DI,i.selectTeamMembershipsMapping=jI,i.selectTeams=Bn,i.selectTeamsByIds=JI,i.selectTeamsMapping=YI,i.selectTeamsOfOrganization=NF,i.selectUploadUrl=Uh,i.selectUserById=jt,i.selectUsers=Bt,i.selectUsersByIds=qT,i.selectUsersMapping=On,i.selectUsersOfOrganization=_F,i.selectUsersOfProject=VF,i.selectUsersOfTeam=LF,i.setActiveProjectFileId=sI,i.setAsset=qr,i.setAssetAttachment=Ta,i.setAssetAttachments=Sa,i.setAssetProcedure=Zc,i.setAssetProcedureStep=Tr,i.setAssetProcedureStepFieldValues=cr,i.setAssetProcedureStepFieldValuesAttachment=Kd,i.setAssetProcedureStepFieldValuesAttachments=Wd,i.setAssetProcedureStepFieldValuesMany=dr,i.setAssetProcedureStepFields=Bd,i.setAssetProcedureStepFieldsAttachment=Id,i.setAssetProcedureStepFieldsAttachments=Od,i.setAssetProcedureStepFieldsMany=jd,i.setAssetProcedureSteps=Sr,i.setAssetProcedureType=ld,i.setAssetProcedureTypeAttachment=Va,i.setAssetProcedureTypeAttachments=za,i.setAssetProcedureTypeFieldValues=zc,i.setAssetProcedureTypeFieldValuesAttachment=Sc,i.setAssetProcedureTypeFieldValuesAttachments=Ic,i.setAssetProcedureTypeFieldValuesMany=Bc,i.setAssetProcedureTypeFields=cc,i.setAssetProcedureTypeFieldsAttachment=Ka,i.setAssetProcedureTypeFieldsAttachments=Wa,i.setAssetProcedureTypeFieldsMany=dc,i.setAssetProcedureTypes=od,i.setAssetProcedures=Jc,i.setAssetStage=au,i.setAssetStageCompletion=Kr,i.setAssetStageCompletions=Wr,i.setAssetStages=cu,i.setAssetType=co,i.setAssetTypeAttachment=Su,i.setAssetTypeAttachments=Iu,i.setAssetTypeFieldValues=Il,i.setAssetTypeFieldValuesAttachment=cl,i.setAssetTypeFieldValuesAttachments=dl,i.setAssetTypeFieldValuesMany=Ol,i.setAssetTypeFields=Wu,i.setAssetTypeFieldsAttachment=zu,i.setAssetTypeFieldsAttachments=Bu,i.setAssetTypeFieldsMany=Yu,i.setAssetTypeIdentifier=Bl,i.setAssetTypeIdentifierValue=Yl,i.setAssetTypeIdentifierValues=Zl,i.setAssetTypeIdentifiers=jl,i.setAssetTypeStatus=Fo,i.setAssetTypeStatuses=go,i.setAssetTypes=ro,i.setAssets=Dr,i.setCategories=ko,i.setCategory=Uo,i.setClientSDK=TO,i.setClientStore=AO,i.setConversation=ta,i.setConversations=UO,i.setCurrentUser=FF,i.setDocument=mh,i.setDocumentAttachment=xo,i.setDocumentAttachments=eh,i.setDocuments=yh,i.setEmailDomain=Mh,i.setEmailDomains=Rh,i.setForm=Gm,i.setFormIdentifier=Kh,i.setFormIdentifierValue=cm,i.setFormIdentifierValues=dm,i.setFormIdentifiers=Wh,i.setFormRevision=Vm,i.setFormRevisionAttachment=Im,i.setFormRevisionAttachments=Om,i.setFormRevisions=zm,i.setFormSubmission=yy,i.setFormSubmissionAttachment=iy,i.setFormSubmissionAttachments=ny,i.setFormSubmissions=py,i.setForms=Hm,i.setGeoImage=My,i.setGeoImages=Ry,i.setIsImportingProjectFile=tI,i.setIssue=Np,i.setIssueAssociation=Ly,i.setIssueAssociations=ky,i.setIssueAttachment=ip,i.setIssueAttachments=np,i.setIssueComment=vp,i.setIssueCommentAttachment=fp,i.setIssueCommentAttachments=Tp,i.setIssueComments=Vp,i.setIssueType=Wf,i.setIssueTypeAttachment=iA,i.setIssueTypeAttachments=nA,i.setIssueTypeFieldValues=vA,i.setIssueTypeFieldValuesAttachment=af,i.setIssueTypeFieldValuesAttachments=cf,i.setIssueTypeFieldValuesMany=VA,i.setIssueTypeFields=HA,i.setIssueTypeFieldsAttachment=fA,i.setIssueTypeFieldsAttachments=TA,i.setIssueTypeFieldsMany=KA,i.setIssueTypeIdentifier=Sf,i.setIssueTypeIdentifierValue=zf,i.setIssueTypeIdentifierValues=Bf,i.setIssueTypeIdentifiers=If,i.setIssueTypeStatus=dT,i.setIssueTypeStatuses=rT,i.setIssueTypes=Yf,i.setIssueUpdate=TT,i.setIssueUpdates=ST,i.setIssues=Gp,i.setLoggedIn=Bo,i.setOrganization=eS,i.setOrganizationAccess=kT,i.setOrganizationAccesses=LT,i.setOrganizations=xT,i.setProfilePicture=gF,i.setProject=hI,i.setProjectAccess=PS,i.setProjectAccesses=FS,i.setProjectAttachment=jS,i.setProjectAttachments=qS,i.setProjectFile=WS,i.setProjectFiles=YS,i.setProjects=oI,i.setRehydrated=$F,i.setTeam=LI,i.setTeamMembership=RI,i.setTeamMemberships=wI,i.setTeams=NI,i.setTokens=KP,i.setUploadUrl=$h,i.setUser=wT,i.setUsers=RT,i.shallowEqual=KO,i.slugify=rP,i.spacesToDashesLower=dP,i.teamMembershipReducer=BI,i.teamMembershipSlice=Vn,i.teamReducer=XI,i.teamSlice=zn,i.toFileNameSafeString=cP,i.toUuidArray=D,i.toUuidIdRecord=aP,i.truncate=uP,i.updateAsset=zr,i.updateAssetAttachment=Ia,i.updateAssetAttachments=Oa,i.updateAssetProcedure=Kc,i.updateAssetProcedureStep=Pr,i.updateAssetProcedureStepFieldValues=rr,i.updateAssetProcedureStepFieldValuesAttachment=Yd,i.updateAssetProcedureStepFieldValuesAttachments=Zd,i.updateAssetProcedureStepFieldValuesMany=ur,i.updateAssetProcedureStepFields=qd,i.updateAssetProcedureStepFieldsAttachment=Pd,i.updateAssetProcedureStepFieldsAttachments=Fd,i.updateAssetProcedureStepFieldsMany=Dd,i.updateAssetProcedureSteps=Fr,i.updateAssetProcedureType=cd,i.updateAssetProcedureTypeAttachment=Ba,i.updateAssetProcedureTypeAttachments=ja,i.updateAssetProcedureTypeFieldValues=jc,i.updateAssetProcedureTypeFieldValuesAttachment=Oc,i.updateAssetProcedureTypeFieldValuesAttachments=Pc,i.updateAssetProcedureTypeFieldValuesMany=qc,i.updateAssetProcedureTypeFields=rc,i.updateAssetProcedureTypeFieldsAttachment=Ya,i.updateAssetProcedureTypeFieldsAttachments=Za,i.updateAssetProcedureTypeFieldsMany=uc,i.updateAssetProcedureTypes=dd,i.updateAssetProcedures=Wc,i.updateAssetStage=uu,i.updateAssetStageCompletion=Yr,i.updateAssetStageCompletions=Zr,i.updateAssetStages=lu,i.updateAssetType=oo,i.updateAssetTypeAttachment=Ou,i.updateAssetTypeAttachments=Pu,i.updateAssetTypeFieldValues=Pl,i.updateAssetTypeFieldValuesAttachment=rl,i.updateAssetTypeFieldValuesAttachments=ul,i.updateAssetTypeFieldValuesMany=Fl,i.updateAssetTypeFields=Zu,i.updateAssetTypeFieldsAttachment=ju,i.updateAssetTypeFieldsAttachments=qu,i.updateAssetTypeFieldsMany=Ju,i.updateAssetTypeIdentifier=ql,i.updateAssetTypeIdentifierValue=Jl,i.updateAssetTypeIdentifierValues=Xl,i.updateAssetTypeIdentifiers=Dl,i.updateAssetTypeStatus=bo,i.updateAssetTypeStatuses=_o,i.updateAssetTypes=ho,i.updateAssets=Br,i.updateCategories=No,i.updateCategory=Lo,i.updateConversation=sa,i.updateConversations=kO,i.updateDocument=ph,i.updateDocumentAttachment=th,i.updateDocumentAttachments=sh,i.updateDocuments=Ah,i.updateEmailDomain=wh,i.updateEmailDomains=Eh,i.updateForm=Km,i.updateFormIdentifier=Yh,i.updateFormIdentifierValue=rm,i.updateFormIdentifierValues=um,i.updateFormIdentifiers=Zh,i.updateFormRevision=Bm,i.updateFormRevisionAttachment=Pm,i.updateFormRevisionAttachments=Fm,i.updateFormRevisions=jm,i.updateFormSubmission=fy,i.updateFormSubmissionAttachment=ay,i.updateFormSubmissionAttachments=cy,i.updateFormSubmissions=Ty,i.updateForms=Wm,i.updateGeoImage=vy,i.updateGeoImages=Vy,i.updateIssue=Hp,i.updateIssueAssociation=Ny,i.updateIssueAssociations=Gy,i.updateIssueAttachment=ap,i.updateIssueAttachments=cp,i.updateIssueComment=zp,i.updateIssueCommentAttachment=Sp,i.updateIssueCommentAttachments=Ip,i.updateIssueComments=Bp,i.updateIssueType=Zf,i.updateIssueTypeAttachment=aA,i.updateIssueTypeAttachments=cA,i.updateIssueTypeFieldValues=zA,i.updateIssueTypeFieldValuesAttachment=df,i.updateIssueTypeFieldValuesAttachments=rf,i.updateIssueTypeFieldValuesMany=BA,i.updateIssueTypeFields=WA,i.updateIssueTypeFieldsAttachment=SA,i.updateIssueTypeFieldsAttachments=IA,i.updateIssueTypeFieldsMany=YA,i.updateIssueTypeIdentifier=Of,i.updateIssueTypeIdentifierValue=jf,i.updateIssueTypeIdentifierValues=qf,i.updateIssueTypeIdentifiers=Pf,i.updateIssueTypeStatus=uT,i.updateIssueTypeStatuses=lT,i.updateIssueTypes=Jf,i.updateIssueUpdate=IT,i.updateIssueUpdates=OT,i.updateIssues=Kp,i.updateOrganization=nS,i.updateOrganizationAccess=NT,i.updateOrganizationAccesses=GT,i.updateOrganizations=iS,i.updateProject=AI,i.updateProjectAccess=gS,i.updateProjectAccesses=bS,i.updateProjectAttachment=DS,i.updateProjectAttachments=CS,i.updateProjectFile=XS,i.updateProjectFiles=QS,i.updateProjects=pI,i.updateTeam=GI,i.updateTeamMembership=EI,i.updateTeamMemberships=vI,i.updateTeams=HI,i.updateUser=VT,i.updateUsers=vT,i.useSelectorBuilder=mP,i.userReducer=BT,i.userSlice=Tn,i.uuidObj=M,i.uuidObjSortFn=Zt,i.uuidSortFn=At,i.versioningReducer=xI,i.versioningSlice=QI,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
14
+ external URLs and therefore not prepended with VITE_API_URL.`;throw new Error(f)}const y=d.type.split("/")[1];if(!y)throw new Error("File has no extension");const A=a??o+"."+y;if(d=sa(d,A),!d.name)throw new Error("Failed to set file's name");await this.addCache(d,o),Ut[c]=new Promise(f=>{f(d)})}return d}processPresignedUrls(e){const n={};for(const[a,c]of Object.entries(e))n[a]=this.enqueueRequest({url:c.url,description:"Upload file to S3",method:h.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:a,blockers:[`s3-${c.fields.key}`],blocks:[a],s3url:c});return n}async getFilePayload(e){const n=await nt(e),a={sha1:n,file_type:e.type,extension:e.name.split(".").pop(),size:e.size};return await this.client.files.addCache(e,n),a}}class kg extends V{constructor(){super(...arguments);m(this,"name","Form Identifier");m(this,"url","/form-identifiers");m(this,"actions",{addOne:Wh,addMany:Yh,setOne:Zh,setMany:Jh,updateOne:Xh,updateMany:Qh,deleteOne:xh,deleteMany:em,initialize:Kh});m(this,"selectors",{selectById:sm,selectByIds:im})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=R({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(d),blockers:[d.form],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected form identifier with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected form identifier with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{form__organization:e}},n);return this.dispatch(a(c)),c}}class Lg extends V{constructor(){super(...arguments);m(this,"name","Form Identifier Value");m(this,"url","/form-identifier-values");m(this,"actions",{addOne:dm,addMany:rm,setOne:um,setMany:lm,updateOne:om,updateMany:hm,deleteOne:mm,deleteMany:ym,initialize:cm});m(this,"selectors",{selectById:Am,selectByIds:fm})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=R({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(d),blockers:[e.form_submission,e.form_identifier],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected form identifier value with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected form identifier value with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{form_submission__form_revision__form__organization:e}},n)).flat();return this.dispatch(a(r)),r}}class Ng extends V{constructor(){super(...arguments);m(this,"name","Form Revision Attachment");m(this,"url","/form-revision-attachments");m(this,"actions",{addOne:Om,addMany:Pm,setOne:Fm,setMany:gm,updateOne:bm,updateMany:_m,deleteOne:Mm,deleteMany:Rm,initialize:Im});m(this,"selectors",{selectById:Em,selectByIds:vm})}async bulkAdd(e){var A;const{addMany:n,setMany:a,deleteMany:c}=this.actions,r=new Date().toISOString(),l=((A=this.client.store.getState().userReducer.currentUser)==null?void 0:A.id)??null,u={},d=[],o=[];for(const f of e){const{revisionUuid:I,fieldIdentifier:g,file:F}=f,b=await this.client.files.getFilePayload(F);b.sha1 in u||(u[b.sha1]=b);const _=R({file:URL.createObjectURL(F),file_type:F.type,file_name:F.name,file_sha1:b.sha1,created_by:l,form_revision:I,submitted_at:r,field_identifier:g});d.push(_);const v={uuid:_.uuid,file_name:F.name,field_identifier:g,file_extension:b.extension,file_sha1:b.sha1,form_revision:I};o.push(v)}this.dispatch(n(d));const y=this.enqueueRequest({description:P(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:o,files:Object.values(u)},blockers:d.map(f=>f.form_revision),blocks:d.map(f=>f.uuid)});return y.then(f=>{this.client.files.processPresignedUrls(f.presigned_urls),this.dispatch(a(f.attachments))}).catch(()=>{this.dispatch(c(d.map(f=>f.uuid)))}),[d,y.then(({attachments:f})=>f)]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{form_revision__form__organization:e}},n);return this.dispatch(a(c)),c}}class Gg extends V{constructor(){super(...arguments);m(this,"name","Form Revision");m(this,"url","/form-revisions");m(this,"actions",{addOne:Ai,addMany:fi,setOne:jm,setMany:qm,updateOne:Dm,updateMany:Cm,deleteOne:Si,deleteMany:Ti,initialize:Bm});m(this,"selectors",{selectById:$m,selectByIds:Um})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,u=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=new Date().toISOString(),o=R({...e,created_by:u,submitted_at:d});this.dispatch(a(o));const y=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(o),blockers:[e.form],blocks:[o.uuid]});return y.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(o.uuid))}),[o,y]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{form__organization:e}},n);return this.dispatch(a(c)),c}}class Hg extends V{constructor(){super(...arguments);m(this,"name","Form");m(this,"url","/forms");m(this,"actions",{addOne:Hm,addMany:Km,setOne:Wm,setMany:Ym,updateOne:Zm,updateMany:Jm,deleteOne:Xm,deleteMany:Qm,initialize:Gm});m(this,"selectors",{selectById:ty,selectByIds:sy})}add(e,n){var A;const{store:a}=this.client,{addOne:c,deleteOne:r}=this.actions,l=new Date().toISOString(),u=((A=a.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=R({...e,submitted_at:l,created_by:u}),o=R({...n,form:d.uuid,submitted_at:l,created_by:u});this.dispatch(c(d)),this.dispatch(Ai(o));const y=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:{...z(d),initial_revision:{uuid:o.uuid,submitted_at:o.submitted_at,title:o.title,description:o.description,fields:o.fields}},blockers:[],blocks:[d.uuid,o.uuid]});return y.catch(f=>{throw this.dispatch(r(d.uuid)),this.dispatch(Si(o.uuid)),f}),[d,o,y]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error("Expected form to exist");const d=_y(e)(l),o=km(e)(l);this.dispatch(a(e)),this.dispatch(vi(C(d))),this.dispatch(Ti(C(o)));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(y){throw this.dispatch(c(u)),this.dispatch(fi(o)),this.dispatch(Ei(d)),y}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class Kg extends V{constructor(){super(...arguments);m(this,"name","Form Submission Attachment");m(this,"url","/form-submission-attachments");m(this,"actions",{addOne:ay,addMany:gi,setOne:cy,setMany:dy,updateOne:ry,updateMany:uy,deleteOne:ly,deleteMany:bi,initialize:ny});m(this,"selectors",{selectById:oy,selectByIds:hy})}async bulkAdd(e){var A;const{addMany:n,setMany:a,deleteMany:c}=this.actions,r=new Date().toISOString(),l=((A=this.client.store.getState().userReducer.currentUser)==null?void 0:A.id)??null,u={},d=[],o=[];for(const f of e){const{submissionUuid:I,fieldIdentifier:g,file:F}=f,b=await this.client.files.getFilePayload(F);b.sha1 in u||(u[b.sha1]=b);const _=R({file:URL.createObjectURL(F),file_type:F.type,file_name:F.name,file_sha1:b.sha1,created_by:l,form_submission:I,submitted_at:r,field_identifier:g});d.push(_);const v={uuid:_.uuid,file_name:F.name,file_sha1:b.sha1,file_extension:b.extension,field_identifier:g,form_submission:I};o.push(v)}this.dispatch(n(d));const y=this.enqueueRequest({description:P(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:o,files:Object.values(u)},blockers:d.map(f=>f.form_submission),blocks:d.map(f=>f.uuid)});return y.then(f=>{this.client.files.processPresignedUrls(f.presigned_urls),this.dispatch(a(f.attachments))}).catch(f=>{throw this.dispatch(c(d.map(I=>I.uuid))),f}),[d,y.then(({attachments:f})=>f)]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,r=n.getState(),l=Ri(e)(r);this.dispatch(a(e));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!0),method:h.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(c(l)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{form_submission__form_revision__form__organization:e}},n)).flat();return this.dispatch(a(r)),r}}class Wg extends V{constructor(){super(...arguments);m(this,"name","Form Submission");m(this,"url","/form-submissions");m(this,"actions",{addOne:Ty,addMany:Ei,setOne:fy,setMany:Sy,updateOne:Iy,updateMany:Oy,deleteOne:Py,deleteMany:vi,initialize:Ay});m(this,"selectors",{selectById:gy,selectByIds:by})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,u=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=new Date().toISOString(),o=R({...e,created_by:u,submitted_at:d}),y=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(o),blockers:[e.form_revision],blocks:[o.uuid]});return this.dispatch(a(o)),y.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(o.uuid))}),[o,y]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=n.getState(),l=c(e.uuid)(r);if(!l)throw new Error(`Expected submission with uuid ${e.uuid} to exist`);const u={...l,...e};this.dispatch(a(u));const d=this.enqueueRequest({description:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${u.uuid}/`,payload:e,blockers:[u.uuid],blocks:[u.uuid]});return d.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(a(l))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected submission with uuid ${e} to exist`);const d=my(e)(l);this.dispatch(a(e)),this.dispatch(bi(C(d)));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(o){throw this.dispatch(c(u)),this.dispatch(gi(d)),o}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{limit:this.pageSize,paginate:!0,form_revision__form_organization:e}},n)).flat();return this.dispatch(a(r)),r}}class Yg extends V{constructor(){super(...arguments);m(this,"name","Geo Image");m(this,"url","/geo-images");m(this,"actions",{addOne:Vy,addMany:zy,setOne:Ey,setMany:vy,updateOne:By,updateMany:jy,deleteOne:qy,deleteMany:Dy,initialize:wy});m(this,"selectors",{selectById:$y,selectByIds:Uy})}async add(e){var g;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,{file:l,...u}=e,d=new Date().toISOString(),o=((g=n.getState().userReducer.currentUser)==null?void 0:g.id)??null,y=u.project,A=await this.client.files.getFilePayload(l),f=R({...u,file_name:l.name,file_sha1:A.sha1,file_type:l.type,file:URL.createObjectURL(l),submitted_at:d,created_by:o});this.dispatch(a(f));const I=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:{uuid:f.uuid,submitted_at:d,title:f.title,description:f.description,geo_marker:f.geo_marker,canvas_marker:f.canvas_marker,sha1:f.file_sha1,project:f.project,file_name:f.file_name,direction:f.direction,original_date:f.original_date,file:A},blocks:[y],blockers:[y]});return I.then(F=>{this.client.files.processPresignedUrls(F.presigned_urls),this.dispatch(c(F.geo_image))}).catch(()=>{this.dispatch(r(f.uuid))}),[f,I.then(F=>F.geo_image)]}async bulkAdd(e,n){var g;const{store:a}=this.client,{addMany:c,setMany:r,deleteMany:l}=this.actions,u=new Date().toISOString(),d=((g=a.getState().userReducer.currentUser)==null?void 0:g.id)??null,o=[],y=[],A=[],f={};for(const F of e){const{file:b,..._}=F,v=await this.client.files.getFilePayload(b);v.sha1 in f||(f[v.sha1]=v);const j=R({..._,file_name:b.name,file_sha1:v.sha1,file_type:b.type,file:URL.createObjectURL(b),submitted_at:u,created_by:d,project:n});o.push(j),y.push(j.uuid),A.push({uuid:j.uuid,sha1:j.file_sha1,file_name:j.file_name,title:j.title,description:j.description,geo_marker:j.geo_marker,canvas_marker:j.canvas_marker,direction:j.direction,original_date:j.original_date})}this.dispatch(c(o));const I=this.enqueueRequest({description:P(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{submitted_at:u,project:n,geo_images:A,files:Object.values(f)},blocks:[n],blockers:y});return I.then(F=>{this.client.files.processPresignedUrls(F.presigned_urls),this.dispatch(r(F.geo_images))}).catch(()=>{this.dispatch(l(y))}),[o,I.then(F=>F.geo_images)]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=n.getState(),l=c(e.uuid)(r);if(!l)throw new Error(`Map image with uuid ${e.uuid} does not exist in the store`);const u={...l,...e};this.dispatch(a(u));const d=this.enqueueRequest({description:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return d.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(a(l))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Map image with uuid ${e} does not exist in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blocks:[e],blockers:[e]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.listPaginated({queryParams:{project:e}},n),r=c.flat();return this.dispatch(a(r)),c}}class Zg extends V{constructor(){super(...arguments);m(this,"name","Issue Association");m(this,"url","/issue-associations");m(this,"actions",{addOne:Yy,addMany:Et,setOne:Hy,setMany:Gy,updateOne:Ky,updateMany:Wy,deleteOne:Zy,deleteMany:vt,initialize:Ny});m(this,"selectors",{selectById:Xy,selectByIds:Qy})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=new Date().toISOString(),u=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,d=R({...e,submitted_at:l,created_by:u});this.dispatch(a(d));const o=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(d),blockers:[e.associated_issue,...e.issue?[e.issue]:[],...e.asset?[e.asset]:[]],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`Issue association with uuid ${e} not found in store.`);this.dispatch(a(e));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(l)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{associated_issue__project:e}},n)).flat();return this.dispatch(a(r)),r}}class Jg extends Qe{constructor(){super(...arguments);m(this,"name","Issue Attachment");m(this,"url","/issue-attachments");m(this,"actions",{addOne:ap,addMany:Di,setOne:cp,setMany:dp,updateOne:rp,updateMany:up,deleteOne:lp,deleteMany:Ci,initialize:np});m(this,"selectors",{selectById:mp,selectByIds:yp})}getId(e){return e.uuid}buildModel(e){return R({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,issue:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,issue:e.issue}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.issueUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(a(r)),r}}class Xg extends Qe{constructor(){super(...arguments);m(this,"name","Issue Comment Attachment");m(this,"url","/issue-comment-attachments");m(this,"actions",{addOne:Sp,addMany:Tp,setOne:Ip,setMany:Op,updateOne:Pp,updateMany:Fp,deleteOne:gp,deleteMany:bp,initialize:fp});m(this,"selectors",{selectById:Mp,selectByIds:Rp})}getId(e){return e.uuid}buildModel(e){return R({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,issue_comment:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,issue_comment:e.issue_comment}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.issueCommentUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{issue_comment__issue__project:e}},n)).flat();return this.dispatch(a(r)),r}}class Qg extends V{constructor(){super(...arguments);m(this,"name","Issue Comment");m(this,"url","/issue-comments");m(this,"actions",{addOne:Vp,addMany:zp,setOne:Bp,setMany:jp,updateOne:qp,updateMany:Dp,deleteOne:Cp,deleteMany:$p,initialize:vp});m(this,"selectors",{selectById:Up,selectByIds:kp})}add(e){const{store:n}=this.client,{addOne:a,updateOne:c,deleteOne:r}=this.actions,l=R({...e,author:n.getState().userReducer.currentUser.id,submitted_at:new Date().toISOString()});this.dispatch(a(l));const u=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(l),blockers:[e.issue],blocks:[l.uuid]});return u.then(d=>{this.dispatch(c(d))}).catch(()=>{this.dispatch(r(l.uuid))}),[l,u]}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Comment with uuid ${e.uuid} not found in store`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`Comment with uuid ${e} not found in store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(l)),u}}async refreshStore(e,n){const{setMany:a}=this.actions,r=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(a(r)),r}}class xg extends V{constructor(){super(...arguments);m(this,"name","Issue");m(this,"url","/issues");m(this,"actions",{addOne:Hp,addMany:Hi,setOne:Kp,setMany:Wp,updateOne:Yp,updateMany:Zp,deleteOne:Jp,deleteMany:Ki,initialize:Gp});m(this,"selectors",{selectById:Qp,selectByIds:xp})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=n.getState(),u=new Date().toISOString(),d=((A=l.userReducer.currentUser)==null?void 0:A.id)??null,o=R({...e,submitted_at:u,created_by:d});this.dispatch(a(o));const y=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(o),blockers:[o.project,o.issue_type,...o.category?[o.category]:[]],blocks:[o.uuid]});return y.then(f=>{this.dispatch(c(f))}).catch(f=>{throw this.dispatch(r(o.uuid)),f}),[o,y]}update(e){var y;const{updateOne:n}=this.actions,{selectById:a}=this.selectors,c=this.client.store.getState(),r=a(e.uuid)(c);if(!r)throw new Error(`Attempting to update an issue with uuid ${e.uuid} that doesn't exist in the store`);const l={...r,...e};this.dispatch(n(l));const u={};for(const A of[U.TITLE,U.DESCRIPTION,U.STATUS,U.CATEGORY,U.PRIORITY,U.ASSIGNED_TO,U.DUE_DATE])if(A in e&&e[A]!==r[A])switch(A){case U.PRIORITY:u[A]=e[A];break;case U.DUE_DATE:u[A]=e[A];break;case U.DESCRIPTION:u[A]=e[A];break;case U.TITLE:u[A]=e[A];break;case U.STATUS:{const f=e[A],I=on(f)(c);if(!I)throw new Error(`Trying to update issue type status with ${f} which does not exist in store`);u[A]={name:I.name,color:I.color,uuid:I.uuid};break}case U.CATEGORY:{const f=e[A];if(f===null)u[A]=null;else{const I=ii(f)(c);if(!I)throw new Error(`Trying to update category with ${f} which does not exist in store.`);u[A]={name:I.name,color:I.color,uuid:I.uuid}}break}case U.ASSIGNED_TO:{const f=e[A];if(f===null)u[A]=null;else{const I=qt(f)(c);if(!I)throw new Error(`Trying to update assigned to with ${f} which does not exist in store.`);u[A]={full_name:I.username,id:I.id}}break}}const d=R({created_by:((y=c.userReducer.currentUser)==null?void 0:y.id)??null,submitted_at:new Date().toISOString(),issue:r.uuid,changes:u});this.dispatch(mn(d));const o=this.enqueueRequest({description:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return o.then(A=>{this.dispatch(n(A))}).catch(()=>{this.dispatch(n(r)),this.dispatch(pn(d.uuid))}),[l,o]}bulkUpdate(e,n){const{store:a}=this.client,{updateMany:c}=this.actions,{selectByIds:r}=this.selectors,l=C(e).toSorted(ft);if(l.length!==e.length)throw new Error("payloads contains duplicate uuids.");const u=r(l)(a.getState()).toSorted(Yt);if(l.length!=u.length)throw new Error(`Attempting to bulk update ${l.length-u.length} issues that dont exist in the store`);const d=[];for(let f=0;f<l.length;f++)d.push({...u[f],...e[f]});this.dispatch(c(d));const o=xe(e,Math.min(n??e.length,N)),y=[];let A=null;for(const f of o){const I=et.v4(),g=C(f),F=f.map(({status:v})=>v).filter(Boolean),b=f.map(({category:v})=>v).filter(Boolean),_=this.enqueueRequest({description:P(h.PATCH,this.name,!0),method:h.PATCH,url:`${this.url}/bulk/`,payload:{payloads:f},blockers:g.concat(F).concat(b).concat(A?[A]:[]),blocks:g.concat([I])});y.push(_),A=I}return Promise.all(y).then(f=>{this.dispatch(c(f.flat()))}).catch(()=>{this.dispatch(c(u))}),[d,y]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`No issue with uuid ${e} found in the store`);const d=hp(e)(l),o=MS(e)(l),y={};for(const f of xy(e)(l))y[f.uuid]=f;for(const f of ep(e)(l))y[f.uuid]=f;const A=Object.values(y);this.dispatch(a(e)),this.dispatch(Ci(C(d))),this.dispatch(An(C(o))),this.dispatch(vt(C(A)));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(f){throw this.dispatch(c(u)),this.dispatch(Di(d)),this.dispatch(yn(o)),this.dispatch(Et(A)),f}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(r)),r}}class eb extends Qe{constructor(){super(...arguments);m(this,"name","Issue Type Attachment");m(this,"url","/issue-type-attachments");m(this,"actions",{addOne:nA,addMany:aA,setOne:cA,setMany:dA,updateOne:rA,updateMany:uA,deleteOne:lA,deleteMany:oA,initialize:iA});m(this,"selectors",{selectById:mA,selectByIds:yA})}getId(e){return e.uuid}buildModel(e){return R({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,issue_type:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,issue_type:e.issue_type}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.issueTypeUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class tb extends V{constructor(){super(...arguments);m(this,"name","Issue Type Fields Attachment");m(this,"url","/issue-type-fields-attachments");m(this,"actions",{addOne:SA,addMany:TA,setOne:IA,setMany:OA,updateOne:PA,updateMany:FA,deleteOne:gA,deleteMany:bA,initialize:fA});m(this,"selectors",{selectById:MA,selectByIds:RA})}async bulkAdd(e){var A;const{addMany:n,setMany:a,deleteMany:c}=this.actions,r=new Date().toISOString(),l=((A=this.client.store.getState().userReducer.currentUser)==null?void 0:A.id)??null,u={},d=[],o=[];for(const f of e){const{fieldsRevisionUuid:I,fieldIdentifier:g,file:F}=f,b=await this.client.files.getFilePayload(F);b.sha1 in u||(u[b.sha1]=b);const _=R({file:URL.createObjectURL(F),file_type:F.type,file_name:F.name,file_sha1:b.sha1,created_by:l,fields_revision:I,submitted_at:r,field_identifier:g});d.push(_);const v={uuid:_.uuid,file_name:F.name,file_extension:b.extension,field_identifier:g,file_sha1:b.sha1,fields_revision:I};o.push(v)}this.dispatch(n(d));const y=this.enqueueRequest({description:P(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:o,files:Object.values(u)},blockers:d.map(f=>f.fields_revision),blocks:d.map(f=>f.uuid)});return y.then(f=>{this.client.files.processPresignedUrls(f.presigned_urls),this.dispatch(a(f.attachments))}).catch(()=>{this.dispatch(c(d.map(f=>f.uuid)))}),[d,y.then(({attachments:f})=>f)]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{fields_revision__issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class sb extends V{constructor(){super(...arguments);m(this,"name","Issue Type Fields");m(this,"url","/issue-type-fields");m(this,"actions",{addOne:KA,addMany:WA,setOne:YA,setMany:ZA,updateOne:JA,updateMany:XA,deleteOne:QA,deleteMany:xA,initialize:HA});m(this,"selectors",{selectById:tf,selectByIds:sf})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=R({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(d),blockers:[d.issue_type],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(r(d.uuid)),A}),[d,o]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class ib extends V{constructor(){super(...arguments);m(this,"name","Issue Type Field Values Attachment");m(this,"url","/issue-type-field-values-attachments");m(this,"actions",{addOne:df,addMany:en,setOne:rf,setMany:uf,updateOne:lf,updateMany:of,deleteOne:hf,deleteMany:tn,initialize:cf});m(this,"selectors",{selectById:yf,selectByIds:pf})}async bulkAdd(e){var A;const{addMany:n,setMany:a,deleteMany:c}=this.actions,r=new Date().toISOString(),l=((A=this.client.store.getState().userReducer.currentUser)==null?void 0:A.id)??null,u={},d=[],o=[];for(const f of e){const{fieldValuesUuid:I,fieldIdentifier:g,file:F}=f,b=await this.client.files.getFilePayload(F);b.sha1 in u||(u[b.sha1]=b);const _=R({file:URL.createObjectURL(F),file_type:F.type,file_name:F.name,file_sha1:b.sha1,created_by:l,field_values:I,submitted_at:r,field_identifier:g});d.push(_);const v={uuid:_.uuid,file_name:F.name,file_sha1:b.sha1,file_extension:b.extension,field_identifier:g,field_values:I};o.push(v)}this.dispatch(n(d));const y=this.enqueueRequest({description:P(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:o,files:Object.values(u)},blockers:d.map(f=>f.field_values),blocks:d.map(f=>f.uuid)});return y.then(({presigned_urls:f,attachments:I})=>{this.client.files.processPresignedUrls(f),this.dispatch(a(I))}).catch(f=>{throw this.dispatch(c(d.map(I=>I.uuid))),f}),[d,y.then(({attachments:f})=>f)]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:r}=this.selectors,l=n.getState(),u=r(e)(l);this.dispatch(a(e));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!0),method:h.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{field_values__issue__project:e,latest:!0}},n)).flat();return this.dispatch(a(r)),r}}class nb extends V{constructor(){super(...arguments);m(this,"name","Issue Type Field Values");m(this,"url","/issue-type-field-values");m(this,"actions",{addOne:VA,addMany:zA,setOne:BA,setMany:jA,updateOne:qA,updateMany:DA,deleteOne:CA,deleteMany:$A,initialize:vA});m(this,"selectors",{selectById:kA,selectByIds:LA})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,u=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=new Date().toISOString(),o=R({...e,created_by:u,submitted_at:d}),y=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(o),blockers:[e.issue,e.fields_revision],blocks:[o.uuid]});return this.dispatch(a(o)),y.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(o.uuid))}),[o,y]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=n.getState(),l=c(e.uuid)(r);if(!l)throw new Error(`Expected IssueTypeFieldValues with uuid ${e.uuid} to exist`);const u={...l,...e};this.dispatch(a(u));const d=this.enqueueRequest({description:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[u.uuid,u.fields_revision,u.issue],blocks:[u.uuid]});return d.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(a(l))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected submission with uuid ${e} to exist`);const d=Af(e)(l);this.dispatch(a(e)),this.dispatch(tn(C(d)));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(o){throw this.dispatch(c(u)),this.dispatch(en(d)),o}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{issue__project:e,latest:!0}},n)).flat();return this.dispatch(a(r)),r}}class ab extends V{constructor(){super(...arguments);m(this,"name","Issue Type Identifier");m(this,"url","/issue-type-identifiers");m(this,"actions",{addOne:If,addMany:Of,setOne:Pf,setMany:Ff,updateOne:gf,updateMany:bf,deleteOne:_f,deleteMany:Mf,initialize:Tf});m(this,"selectors",{selectById:wf,selectByIds:Ef})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=R({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(d),blockers:[d.issue_type],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected issue type identifier with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected issue type identifier with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class cb extends V{constructor(){super(...arguments);m(this,"name","Issue Type Identifier Value");m(this,"url","/issue-type-identifier-values");m(this,"actions",{addOne:Bf,addMany:jf,setOne:qf,setMany:Df,updateOne:Cf,updateMany:$f,deleteOne:Uf,deleteMany:kf,initialize:zf});m(this,"selectors",{selectById:Nf,selectByIds:Gf})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=R({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(d),blockers:[e.issue,e.issue_type_identifier],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected issue type identifier value with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected issue type identifier value with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(a(r)),r}}class db extends V{constructor(){super(...arguments);m(this,"name","Issue Type");m(this,"url","/issue-types");m(this,"actions",{addOne:Yf,addMany:Zf,setOne:Jf,setMany:Xf,updateOne:Qf,updateMany:xf,deleteOne:eS,deleteMany:tS,initialize:Wf});m(this,"selectors",{selectById:iS,selectByIds:nS})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,u=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=new Date().toISOString(),o=R({...e,submitted_at:d,created_by:u});this.dispatch(a(o));const y=this.enqueueRequest({method:h.POST,url:`${this.url}/`,payload:z(o),blockers:[],blocks:[o.uuid]});return y.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(o.uuid))}),[o,y]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=n.getState(),l=c(e.uuid)(r);if(!l)throw new Error(`IssueType with uuid ${e.uuid} does not exist in the store.`);const u={...l,...e};this.dispatch(a(u));const d=this.enqueueRequest({method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(a(l))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`IssueType with uuid ${e} does not exist in the store.`);const d=eA(e)(l);this.dispatch(a(e)),this.dispatch(Ki(C(d)));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(o){throw this.dispatch(c(u)),this.dispatch(Hi(d)),o}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class rb extends V{constructor(){super(...arguments);m(this,"name","Issue Type Status");m(this,"url","/issue-type-statuses");m(this,"actions",{addOne:rS,addMany:uS,setOne:lS,setMany:oS,updateOne:hS,updateMany:mS,deleteOne:yS,deleteMany:pS,initialize:dS});m(this,"selectors",{selectById:on,selectByIds:fS})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=R({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(d),blockers:[e.issue_type],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.client.store.getState(),r=a(e.uuid)(c);if(!r)throw new Error(`Expected an existing issue type status with uuid ${e.uuid}`);const l={...r,...e};this.dispatch(n(l));const u=this.enqueueRequest({description:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`No issue type status with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(l)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class ub extends V{constructor(){super(...arguments);m(this,"name","Issue Update");m(this,"url","/issue-updates");m(this,"actions",{addOne:mn,addMany:yn,setOne:OS,setMany:PS,updateOne:FS,updateMany:gS,deleteOne:pn,deleteMany:An,initialize:IS});m(this,"selectors",{selectById:bS,selectByIds:_S})}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(a(r)),r}}const lb=1800;function ob(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 hb extends dg{constructor(){super(...arguments);m(this,"_getRenewedTokens",async e=>{const n=this.performRequest({method:h.POST,url:this.refreshTokensUrl,payload:{refresh:e},isAuthNeeded:!1,checkAuth:!1});let a;try{a=await n}catch(c){console.error("Could not renew tokens; clearing auth",c),this.clearAuth();return}if(!a.access)throw new Error("Missing access token");return{accessToken:a.access,refreshToken:a.refresh??this.getRefreshToken()}})}clearAuth(){console.debug(this.constructor.name,"clearing auth;"),this.dispatch(Do(!1)),this.clearTokens(),this.dispatch(M()),this.dispatch(M())}async renewTokens(){const e=this.getRefreshToken();if(!e)throw new Error("No refresh token found");console.debug(this.constructor.name,"renewing tokens");try{const n=await this._getRenewedTokens(e);if(!n)return;console.log("Got renewed tokens"),this.setTokens(n)}catch(n){throw console.error("Could not renew tokens; clearing auth",n),this.clearAuth(),n}}tokenIsExpiringSoon(){const e=this.getAccessToken();if(!e)return!1;const n=Date.now()/1e3;let a;try{a=qO(e).exp??n}catch{a=n}return a-n<lb}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 k&&this.clearAuth(),e instanceof Error?Promise.reject(e):Promise.reject(new Error((e??at).toString()))}}}async handleUnauthorized(e,n){const a=this.client.store.getState();if(e.url.endsWith("/token/refresh/"))throw a.authReducer.isLoggedIn&&console.warn("No signed-in user to sign out."),this.clearAuth(),new k({message:"You have been signed out due to inactivity.",response:n,discard:!0});if(a.authReducer.isLoggedIn)await this.renewTokens();else throw console.debug("Forbidden; user is not logged in."),new k({message:"Incorrect username or password.",response:n,discard:!0})}async initAuth(e){const n=et.v4();return console.debug(this.constructor.name,"Initiating auth"),this.performRequest({uuid:n,method:h.POST,url:this.initTokensUrl,payload:e,isAuthNeeded:!1,checkAuth:!1}).then(a=>{this.setTokens(ob(a))})}}class mb extends ct{constructor(){super(...arguments);m(this,"name","Organization Access");m(this,"url","/organization-accesses");m(this,"actions",{addOne:LS,addMany:NS,setOne:GS,setMany:HS,updateOne:KS,updateMany:WS,deleteOne:YS,deleteMany:ZS,initialize:kS});m(this,"selectors",{selectById:XS,selectByIds:QS})}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState()),l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(d=>{throw this.dispatch(a(r)),d}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l),d=qt(u.user)(l);this.dispatch(a(u.uuid)),this.dispatch(On(u.user));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${u.uuid}/`,blockers:[u.uuid],blocks:[]})}catch(o){throw this.dispatch(c(u)),this.dispatch(In(d)),o}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class yb extends ct{constructor(){super(...arguments);m(this,"name","Organization");m(this,"url","/organizations");m(this,"actions",{addOne:aT,addMany:nT,setOne:iT,setMany:sT,updateOne:dT,updateMany:cT,deleteOne:rT,deleteMany:uT,initialize:tT});m(this,"selectors",{selectById:hT,selectByIds:mT})}async add(e){const{addOne:n}=this.actions,a=await this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:e,blockers:[],blocks:[]});return this.dispatch(n(a)),a}async update(e){const{setOne:n}=this.actions,a=await this.enqueueRequest({description:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return this.dispatch(n(a)),a}async invite(e,n){return this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/${e}/invite/${n}/`,blockers:[],blocks:[]})}async refreshStore(e){const{initialize:n}=this.actions,a=await this.list({},e);return this.dispatch(n(a)),a}}class pb extends V{constructor(){super(...arguments);m(this,"name","Project Access");m(this,"url","/project-accesses");m(this,"actions",{addOne:FT,addMany:gT,setOne:bT,setMany:_T,updateOne:MT,updateMany:RT,deleteOne:wT,deleteMany:ET,initialize:PT});m(this,"selectors",{selectById:VT,selectByIds:zT})}add(e){var d;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=R({...e,created_by:((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null});this.dispatch(a(l));const u=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(l),blockers:[l.organization_access,l.project],blocks:[l.uuid]});return u.then(o=>{this.dispatch(c(o))}).catch(o=>{throw this.dispatch(r(l.uuid)),o}),[l,u]}bulkAdd(e){var o;const{store:n}=this.client,{addMany:a,deleteMany:c,updateMany:r}=this.actions,l=((o=n.getState().userReducer.currentUser)==null?void 0:o.id)??null,u=e.map(y=>R({...y,created_by:l}));this.dispatch(a(u));const d=this.enqueueRequest({description:P(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{project_accesses:u.map(y=>z(y))},blockers:u.flatMap(y=>[y.project,y.organization_access]),blocks:u.map(y=>y.uuid)});return d.then(y=>{this.dispatch(r(y))}).catch(y=>{throw this.dispatch(c(u.map(A=>A.uuid))),y}),[u,d]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState()),l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[]});return u.then(d=>{this.dispatch(a(d))}).catch(d=>{throw this.dispatch(a(r)),d}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());this.dispatch(a(e));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(l)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{project__organization:e}},n);return this.dispatch(a(c)),c}}class Ab extends Qe{constructor(){super(...arguments);m(this,"name","Project Attachment");m(this,"url","/project-attachments");m(this,"actions",{addOne:qT,addMany:DT,setOne:CT,setMany:$T,updateOne:UT,updateMany:kT,deleteOne:LT,deleteMany:NT,initialize:jT});m(this,"selectors",{selectById:HT,selectByIds:KT})}getId(e){return e.uuid}buildModel(e){return R({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,project:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,project:e.project}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.projectUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{project__organization:e}},n);return this.dispatch(a(c)),c}}class fb extends V{constructor(){super(...arguments);m(this,"name","Project File");m(this,"url","/project-files");m(this,"actions",{addOne:QT,addMany:xT,setOne:JT,setMany:XT,updateOne:eI,updateMany:tI,deleteOne:sI,deleteMany:iI,initialize:ZT});m(this,"selectors",{selectById:uI,selectByIds:lI})}async saveExisting(e){const{setOne:n}=this.actions;if(!e.uuid)throw new Error("You can only use this method to save existing project files. The one provided has no uuid.");const a={...e};delete a.file;const c=this.enqueueRequest({method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:a,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(n(r))}),c}saveActive(){const{store:e}=this.client,{setOne:n}=this.actions,a=e.getState(),c=a.projectFileReducer.activeProjectFileId;if(!c)throw new Error("No active project file");const r=a.projectFileReducer.instances[c];if(!r)throw new Error("No active project file");if(!r.bounds&&!r.canvas_bounds)throw new Error("Project file must either have bounds or canvas_bounds set");let l;if(typeof r.file=="string"&&!r.file.startsWith("blob:")){const o={...r};delete o.file,l={method:h.PATCH,url:`${this.url}/${c}/`,payload:o,blockers:[c],blocks:[c]}}else l=new Promise((o,y)=>{this.client.files.uploadFileToS3(r.file_sha1).then(([A])=>{o({method:h.POST,url:`${this.url}/`,payload:{...r,...A},blockers:[c],blocks:[c]})}).catch(y)});const d=Promise.resolve(l).then(o=>this.enqueueRequest(o));return d.then(o=>{this.dispatch(n(o))}),this.dispatch(cI),this.dispatch(aI(null)),this.dispatch(nI(!1)),[r,d]}async delete(e){const{store:n}=this.client,{addOne:a,deleteOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`Expected project file with uuid ${e} to exist in the store.`);this.dispatch(c(e));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(a(l)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(r)),r}}class Sb extends ct{constructor(){super(...arguments);m(this,"name","Project");m(this,"url","/projects");m(this,"actions",{addOne:fI,addMany:AI,setOne:pI,setMany:yI,updateOne:TI,updateMany:SI,deleteOne:II,deleteMany:OI,initialize:mI});m(this,"selectors",{selectById:gI,selectByIds:bI})}async add(e){const{addOne:n}=this.actions,a=await this.performRequest({method:h.POST,url:`${this.url}/`,payload:z(e)});return this.dispatch(n(a)),a}async update(e){const{updateOne:n}=this.actions,a=await this.performRequest({method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:z(e)});return this.dispatch(n(a)),a}async delete(e){const{deleteOne:n}=this.actions,a=await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return this.dispatch(n(e)),a}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class Tb extends V{constructor(){super(...arguments);m(this,"name","Team Membership");m(this,"url","/team-memberships");m(this,"actions",{addOne:wI,addMany:EI,setOne:vI,setMany:VI,updateOne:zI,updateMany:BI,deleteOne:jI,deleteMany:qI,initialize:RI});m(this,"selectors",{selectById:$I,selectByIds:UI})}add(e){var d;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=R({...e,created_by:((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null});this.dispatch(a(l));const u=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(l),blockers:[e.team],blocks:[l.uuid]});return u.then(o=>{this.dispatch(c(o))}).catch(()=>{this.dispatch(r(l.uuid))}),[l,u]}bulkAdd(e){var o;const{store:n}=this.client,{addMany:a,setMany:c,deleteMany:r}=this.actions,l=((o=n.getState().userReducer.currentUser)==null?void 0:o.id)??null,u=e.map(y=>R({...y,created_by:l}));this.dispatch(a(u));const d=this.enqueueRequest({description:P(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{team_memberships:u.map(y=>z(y))},blockers:u.map(y=>y.team),blocks:u.map(y=>y.uuid)});return d.then(y=>{this.dispatch(c(y))}).catch(()=>{this.dispatch(r(u.map(y=>y.uuid)))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected team membership with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{team__organization:e}},n);return this.dispatch(a(c)),c}}class Ib extends V{constructor(){super(...arguments);m(this,"name","Team");m(this,"url","/teams");m(this,"actions",{addOne:NI,addMany:GI,setOne:HI,setMany:KI,updateOne:WI,updateMany:YI,deleteOne:ZI,deleteMany:JI,initialize:LI});m(this,"selectors",{selectById:QI,selectByIds:xI})}add(e){var d;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=R({...e,submitted_at:new Date().toISOString(),created_by:((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null});this.dispatch(a(l));const u=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(l),blockers:[],blocks:[l.uuid]});return u.then(o=>{this.dispatch(c(o))}).catch(()=>{this.dispatch(r(l.uuid))}),[l,u]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected team with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:z(e),blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected team with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class Ob extends ct{constructor(){super(...arguments);m(this,"name","User");m(this,"url","/user");m(this,"actions",{addOne:In,addMany:zS,setOne:VS,setMany:vS,updateOne:jS,updateMany:BS,deleteOne:On,deleteMany:qS,initialize:ES});m(this,"selectors",{selectById:qt,selectByIds:$S})}async list(e,n){const{organizationUuid:a,...c}=e,r=a?`/organizations/${a}${this.url}s/`:`/${this.url}`;return this.performRequest({method:h.GET,url:r,...c},n)}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({organizationUuid:e},n);return this.dispatch(a(c)),c}}async function kn(t,s,e,n,a){const c=n instanceof tt;c&&s.checkAuth!==!1&&await n.auth.prepareAuth();const r={queryParams:"",isAuthNeeded:!0},{s3url:l,payload:u,headers:d,method:o,queryParams:y,attachmentHash:A,isExternalUrl:f,isAuthNeeded:I,isResponseBlob:g}={...r,...s};let F=s.url;const b=A?await e.files.fetchCache(A):void 0;if(A&&!b)throw new Error(`Cannot upload file ${A} because it's not cached.`);!f&&!F.startsWith("http")&&(!F.startsWith("/")&&!F.startsWith("blob:")&&(F="/"+F),F=t+F);const _=D=>{if(A){if(!l)throw new Error(`No S3 URL for file ${A}`);if("warning"in l)throw new Error(`S3 URL warning for file ${A}`);if(!b)throw new Error(`No file for file ${A}`);const q=l.fields["x-amz-checksum-sha1"];if(!q)throw new Error(`No checksum for file ${A}`);return D.set("x-amz-checksum-sha1",q).field({...u,...l.fields}).attach("file",b)}return D.send(u)},j={[h.GET]:()=>g?it.get(F.toString()).responseType("blob"):it.get(F.toString()),[h.POST]:()=>{const D=it.post(F.toString());return _(D)},[h.PATCH]:()=>{const D=it.patch(F.toString());return _(D)},[h.PUT]:()=>{const D=it.put(F.toString());return _(D)},[h.DELETE]:()=>{const D=it.delete(F.toString());return _(D)}}[o];let B=j();if(a==null||a.addEventListener("abort",()=>{console.debug("aborting request:",s),B.abort()}),I&&c){const D=n.auth.getAuthHeader();B=B.set("Authorization",D)}d&&(B=B.set(d));try{return await B.query(y)}catch(D){const q=fO(D),wO=q==null?void 0:q.status;if(c&&wO===401)return await n.auth.handleUnauthorized(B,q),B.query(y);throw new k({response:q,innerError:D,discard:Dn.includes(wO)})}}class Pb{constructor(s){m(this,"store");this.store=s}_performRequest(s,e,n,a){const c=new Nt,r={...e,uuid:e.uuid??et.v4()};return kn(s,r,this,n,a).then(l=>{c.resolve(l.body)}).catch(l=>{l instanceof Error?c.reject(l):c.reject(new Error((l??at).toString()))}),c}async performRequest(s,e,n,a){return this._performRequest(s,e,n,a).then(c=>{if(c instanceof k)throw c;return c})}async enqueueRequest(s,e,n){return this._enqueueRequest(s,e,n).then(a=>{if(a instanceof k)throw a;return a})}_enqueueRequest(s,e,n){const a=new Nt,c={...s,BASE_URL:e,serviceName:n},r=this.store.dispatch(fT(c)),l=d=>{if(d)a.resolve(d.body);else{const o=new k({message:"Could not get a response from the server.",response:d,discard:!0});a.reject(o)}},u=d=>{d instanceof k?d.options.discard=!0:(console.error("Received an unexpected error while processing a request:",d,`
15
+ Converting error to APIError and discarding.`),d=new k({message:"An error occurred while processing the request.",innerError:d,discard:!0})),a.reject(d)};return r.then(l,u),a}async performPagination(s,e,n,a,c){const r={...e,queryParams:{...e.queryParams,paginate:!0,limit:n}},{method:l}=r,u=[];let d=await this.performRequest(s,r,a,c);for(u.push(d.results);d.next;)d=await this.performRequest(s,{url:d.next,method:l},a,c),u.push(d.results);return u}}class dt{constructor(){m(this,"graph");m(this,"requestAttemptCounter");this.graph=new DO.DepGraph,this.requestAttemptCounter={}}static _fromOutbox(s){const e=new dt;for(let n=0;n<s.length;n++){const a=s[n];if(!a){console.error("Outbox item was undefined");continue}e.sneakRequest(a);for(let c=0;c<n;c++){const r=s[c];if(!r){console.error("Previous outbox item was undefined");continue}r.payload.uuid!==a.payload.uuid&&r.payload.blocks.some(l=>a.payload.blockers.includes(l))&&dt._addDependency(a.payload.uuid,r.payload.uuid,e.graph)}}return e}_addDependency(s,e){dt._addDependency(s,e,this.graph)}static _addDependency(s,e,n){if(s===e)throw new Error(`Tried to add dependency from node to itself: ${s}`);if(!n.hasNode(s))throw new Error(`Tried to add dependency from non-existent node: ${s} (to node: ${e})`);if(!n.hasNode(e))throw new Error(`Tried to add dependency to non-existent node: ${e} (from node: ${s})`);n.addDependency(s,e)}addRequest(s){if(this.graph.addNode(s.payload.uuid,s),!(s.payload.blockers.length===0||this.graph.size()===1))for(const e of this.graph.overallOrder()){if(e===s.payload.uuid)continue;const n=this.graph.getNodeData(e);s.payload.blockers.some(a=>n.payload.blocks.includes(a))&&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(a=>s.payload.blocks.includes(a))&&this._addDependency(e,s.payload.uuid)}}sneakRequest(s){this.graph.addNode(s.payload.uuid,s)}_getNextNode(){const s=this.graph.overallOrder(!0);let e=1/0,n;for(const a of s){const c=this.requestAttemptCounter[a]||0;c<e&&(e=c,n=a)}return n}peek(){const s=this._getNextNode();if(s)return this.graph.getNodeData(s)}remove(s){this.graph.removeNode(s),delete this.requestAttemptCounter[s]}pop(){const s=this.peek();return s&&this.graph.removeNode(s.payload.uuid),s}getQueue(){const s=this.graph.overallOrder().map(n=>this.graph.getNodeData(n)),e=this._getNextNode();if(e){const n=this.graph.getNodeData(e),a=s.findIndex(c=>c.payload.uuid===n.payload.uuid);a!==-1&&(s.splice(a,1),s.unshift(n))}return s}getReady(){let s=this.graph.overallOrder(!0).map(e=>this.graph.getNodeData(e));return s=s.sort((e,n)=>e.meta.offline.effect.timestamp.localeCompare(n.meta.offline.effect.timestamp)),s=s.sort((e,n)=>{const a=this.requestAttemptCounter[e.payload.uuid]||0,c=this.requestAttemptCounter[n.payload.uuid]||0;return a-c}),s}registerRetry(s){this.requestAttemptCounter[s]=(this.requestAttemptCounter[s]||0)+1}}let SO;function TO(t){SO=t}function rt(){return SO}let IO;function OO(t){IO=t}function PO(){return IO}let Ln=null;function st(){const t=rt();if(!t)return console.warn("Client store not set; cannot get outbox coordinator yet."),null;if(Ln)return Ln;const s=t.getState().offline.outbox,e=dt._fromOutbox(s);return Ln=e,e}const Fb=(t,s)=>{const e=new s(t);return OO(e),TO(t),e};class gb{constructor(s){m(this,"_all");m(this,"_previous");this._all=[s],this._previous=s,this.then=this.then.bind(this),this.compile=this.compile.bind(this)}then(s){return this._previous&&(this._previous.next=s),this._all.push(s),this._previous=s,{then:this.then,compile:this.compile}}compile(){return this._all}}class Nn{constructor(){m(this,"next");this.next=null}then(s){return new gb(this).then(s)}async run(s){if(this.next)return this.next.run(s);{if(console.debug("Middleware finished. Performing request:",s),!rt())throw new Error("Client store not set");const n=PO();if(!n)throw new Error("Client SDK not set");return yO(s,n)}}}class FO extends Nn{async run(s){return super.run(s)}}class gO extends Nn{async run(s){return super.run(s)}}const bO=new FO().then(new gO).compile();function _O(t){var s;return(s=bO[0])==null?void 0:s.run(t)}var MO=(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))(MO||{});i.ALL_MIDDLEWARE=bO,i.APIError=k,i.ATTACHMENT_MODEL_DEFAULT_PAGE_SIZE=aO,i.AgentService=rg,i.AssetAttachmentService=ug,i.AssetProcedureService=pg,i.AssetProcedureStepFieldValuesAttachmentService=Tg,i.AssetProcedureStepFieldValuesService=Ig,i.AssetProcedureStepFieldsAttachmentService=fg,i.AssetProcedureStepFieldsService=Sg,i.AssetProcedureStepService=Og,i.AssetProcedureTypeAttachmentService=lg,i.AssetProcedureTypeFieldValuesAttachmentService=mg,i.AssetProcedureTypeFieldValuesService=yg,i.AssetProcedureTypeFieldsAttachmentService=og,i.AssetProcedureTypeFieldsService=hg,i.AssetProcedureTypeService=Ag,i.AssetService=Pg,i.AssetStageCompletionService=Fg,i.AssetStageService=gg,i.AssetStatusType=Xn,i.AssetTypeAttachmentService=bg,i.AssetTypeFieldValuesAttachmentService=Rg,i.AssetTypeFieldValuesService=wg,i.AssetTypeFieldsAttachmentService=_g,i.AssetTypeFieldsService=Mg,i.AssetTypeIdentifierService=Eg,i.AssetTypeIdentifierValueService=vg,i.AssetTypeService=Vg,i.AssetTypeStatusService=zg,i.AttachmentModel=Qn,i.BaseApiService=tt,i.BaseModelApiService=ct,i.BaseOfflineAttachmentModelService=Qe,i.BaseOfflineModelApiService=V,i.BaseSDK=Pb,i.COMMON_AUTO_FIELDS=aa,i.CategoryService=Bg,i.DEFAULT_ISSUE_PRIORITY=CO,i.DEFAULT_PAGE_SIZE=nO,i.DISCARD_HTTP_STATUSES=Dn,i.DeferredPromise=Nt,i.DocumentAttachmentService=jg,i.DocumentService=qg,i.EMPTY_ARRAY=Yn,i.EMPTY_OBJECT=Zn,i.EmailDomainsService=Dg,i.EmailVerificationService=Cg,i.FileService=Ug,i.FormIdentifierService=kg,i.FormIdentifierValueService=Lg,i.FormRevisionAttachmentService=Ng,i.FormRevisionService=Gg,i.FormService=Hg,i.FormSubmissionAttachmentService=Kg,i.FormSubmissionService=Wg,i.GeoImageService=Yg,i.HttpMethod=h,i.IssueAssociationService=Zg,i.IssueAttachmentService=Jg,i.IssueCommentAttachmentService=Xg,i.IssueCommentService=Qg,i.IssuePriority=Lt,i.IssueService=xg,i.IssueStatusType=xn,i.IssueTypeAttachmentService=eb,i.IssueTypeFieldValuesAttachmentService=ib,i.IssueTypeFieldValuesService=nb,i.IssueTypeFieldsAttachmentService=tb,i.IssueTypeFieldsService=sb,i.IssueTypeIdentifierService=ab,i.IssueTypeIdentifierValueService=cb,i.IssueTypeService=db,i.IssueTypeStatusService=rb,i.IssueUpdateChange=U,i.IssueUpdateService=ub,i.JWTService=hb,i.MAX_SERVICE_BATCH_SIZE=N,i.OUTBOX_RETRY_DELAY=ea,i.OfflineAnalyticsMiddleware=FO,i.OfflineMiddleware=Nn,i.OrganizationAccessLevel=Jn,i.OrganizationAccessService=mb,i.OrganizationService=yb,i.OutboxCoordinator=dt,i.ProjectAccessService=pb,i.ProjectAttachmentService=Ab,i.ProjectFileService=fb,i.ProjectService=Sb,i.RESET_ORGANIZATION_STATE=E,i.RESET_PROJECT_STATE=$,i.RESET_STATE=M,i.RateLimitingMiddleware=gO,i.SelectorBuilder=uP,i.TeamMembershipService=Tb,i.TeamService=Ib,i.UNKNOWN_ERROR_MESSAGE=at,i.UserService=Ob,i.VERSION_REDUCER_KEY=ut,i.VerificationCodeType=MO,i._setLatestRetryTime=TT,i.addAsset=jr,i.addAssetAttachment=Ia,i.addAssetAttachments=Qt,i.addAssetProcedure=Yc,i.addAssetProcedureStep=Fr,i.addAssetProcedureStepFieldValues=dr,i.addAssetProcedureStepFieldValuesAttachment=Yd,i.addAssetProcedureStepFieldValuesAttachments=Os,i.addAssetProcedureStepFieldValuesMany=rr,i.addAssetProcedureStepFields=jd,i.addAssetProcedureStepFieldsAttachment=Od,i.addAssetProcedureStepFieldsAttachments=Pd,i.addAssetProcedureStepFieldsMany=qd,i.addAssetProcedureSteps=gr,i.addAssetProcedureType=dd,i.addAssetProcedureTypeAttachment=za,i.addAssetProcedureTypeAttachments=Ba,i.addAssetProcedureTypeFieldValues=Bc,i.addAssetProcedureTypeFieldValuesAttachment=Oc,i.addAssetProcedureTypeFieldValuesAttachments=ds,i.addAssetProcedureTypeFieldValuesMany=jc,i.addAssetProcedureTypeFields=dc,i.addAssetProcedureTypeFieldsAttachment=Wa,i.addAssetProcedureTypeFieldsAttachments=Ya,i.addAssetProcedureTypeFieldsMany=rc,i.addAssetProcedureTypes=rd,i.addAssetProcedures=hs,i.addAssetStage=lu,i.addAssetStageCompletion=Wr,i.addAssetStageCompletions=Yr,i.addAssetStages=ou,i.addAssetType=ho,i.addAssetTypeAttachment=Ou,i.addAssetTypeAttachments=Ds,i.addAssetTypeFieldValues=Ol,i.addAssetTypeFieldValuesAttachment=rl,i.addAssetTypeFieldValuesAttachments=Gs,i.addAssetTypeFieldValuesMany=Pl,i.addAssetTypeFields=Yu,i.addAssetTypeFieldsAttachment=Bu,i.addAssetTypeFieldsAttachments=ju,i.addAssetTypeFieldsMany=Zu,i.addAssetTypeIdentifier=jl,i.addAssetTypeIdentifierValue=Zl,i.addAssetTypeIdentifierValues=Jl,i.addAssetTypeIdentifiers=ql,i.addAssetTypeStatus=go,i.addAssetTypeStatuses=bo,i.addAssetTypes=mo,i.addAssets=Rs,i.addCategories=Lo,i.addCategory=ko,i.addConversation=ya,i.addConversations=oP,i.addDocument=yh,i.addDocumentAttachment=eh,i.addDocumentAttachments=th,i.addDocuments=ph,i.addEmailDomain=Rh,i.addEmailDomains=wh,i.addForm=Hm,i.addFormIdentifier=Wh,i.addFormIdentifierValue=dm,i.addFormIdentifierValues=rm,i.addFormIdentifiers=Yh,i.addFormRevision=Ai,i.addFormRevisionAttachment=Om,i.addFormRevisionAttachments=Pm,i.addFormRevisions=fi,i.addFormSubmission=Ty,i.addFormSubmissionAttachment=ay,i.addFormSubmissionAttachments=gi,i.addFormSubmissions=Ei,i.addForms=Km,i.addGeoImage=Vy,i.addGeoImages=zy,i.addIssue=Hp,i.addIssueAssociation=Yy,i.addIssueAssociations=Et,i.addIssueAttachment=ap,i.addIssueAttachments=Di,i.addIssueComment=Vp,i.addIssueCommentAttachment=Sp,i.addIssueCommentAttachments=Tp,i.addIssueComments=zp,i.addIssueType=Yf,i.addIssueTypeAttachment=nA,i.addIssueTypeAttachments=aA,i.addIssueTypeFieldValues=VA,i.addIssueTypeFieldValuesAttachment=df,i.addIssueTypeFieldValuesAttachments=en,i.addIssueTypeFieldValuesMany=zA,i.addIssueTypeFields=KA,i.addIssueTypeFieldsAttachment=SA,i.addIssueTypeFieldsAttachments=TA,i.addIssueTypeFieldsMany=WA,i.addIssueTypeIdentifier=If,i.addIssueTypeIdentifierValue=Bf,i.addIssueTypeIdentifierValues=jf,i.addIssueTypeIdentifiers=Of,i.addIssueTypeStatus=rS,i.addIssueTypeStatuses=uS,i.addIssueTypes=Zf,i.addIssueUpdate=mn,i.addIssueUpdates=yn,i.addIssues=Hi,i.addOrganization=aT,i.addOrganizationAccess=LS,i.addOrganizationAccesses=NS,i.addOrganizations=nT,i.addProject=fI,i.addProjectAccess=FT,i.addProjectAccesses=gT,i.addProjectAttachment=qT,i.addProjectAttachments=DT,i.addProjectFile=QT,i.addProjectFiles=xT,i.addProjects=AI,i.addTeam=NI,i.addTeamMembership=wI,i.addTeamMemberships=EI,i.addTeams=GI,i.addUser=In,i.addUsers=zS,i.agentsReducer=fa,i.agentsSlice=Zt,i.areArraysEqual=NO,i.assetAttachmentReducer=Ea,i.assetAttachmentSlice=Xt,i.assetProcedureReducer=ed,i.assetProcedureSlice=os,i.assetProcedureStepFieldValuesAttachmentReducer=nr,i.assetProcedureStepFieldValuesAttachmentSlice=Is,i.assetProcedureStepFieldValuesReducer=Sr,i.assetProcedureStepFieldValuesSlice=gs,i.assetProcedureStepFieldsAttachmentReducer=Vd,i.assetProcedureStepFieldsAttachmentSlice=As,i.assetProcedureStepFieldsReducer=Hd,i.assetProcedureStepFieldsSlice=Ss,i.assetProcedureStepReducer=wr,i.assetProcedureStepSlice=bs,i.assetProcedureTypeAttachmentReducer=ka,i.assetProcedureTypeAttachmentSlice=ts,i.assetProcedureTypeFieldValuesAttachmentReducer=Mc,i.assetProcedureTypeFieldValuesAttachmentSlice=cs,i.assetProcedureTypeFieldValuesReducer=Lc,i.assetProcedureTypeFieldValuesSlice=ls,i.assetProcedureTypeFieldsAttachmentReducer=tc,i.assetProcedureTypeFieldsAttachmentSlice=is,i.assetProcedureTypeFieldsReducer=pc,i.assetProcedureTypeFieldsSlice=as,i.assetProcedureTypeReducer=pd,i.assetProcedureTypeSlice=ys,i.assetReducer=Gr,i.assetSlice=Ms,i.assetStageCompletionReducer=tu,i.assetStageCompletionSlice=Vs,i.assetStageReducer=Au,i.assetStageSlice=zs,i.assetTypeAttachmentReducer=vu,i.assetTypeAttachmentSlice=qs,i.assetTypeFieldValuesAttachmentReducer=Sl,i.assetTypeFieldValuesAttachmentSlice=Ns,i.assetTypeFieldValuesReducer=Vl,i.assetTypeFieldValuesSlice=Ws,i.assetTypeFieldsAttachmentReducer=Hu,i.assetTypeFieldsAttachmentSlice=Us,i.assetTypeFieldsReducer=al,i.assetTypeFieldsSlice=Ls,i.assetTypeIdentifierReducer=Kl,i.assetTypeIdentifierSlice=Ys,i.assetTypeIdentifierValueReducer=co,i.assetTypeIdentifierValueSlice=Js,i.assetTypeReducer=Oo,i.assetTypeSlice=Xs,i.assetTypeStatusReducer=jo,i.assetTypeStatusSlice=xs,i.assetTypeStatusSortFn=ra,i.authReducer=Co,i.authSlice=bt,i.baseReducer=WF,i.baseReducers=qn,i.blobToBase64=QO,i.categoryReducer=Xo,i.categorySlice=ti,i.clearTokens=ZP,i.constructUploadedFilePayloads=XO,i.createDeepEqualSelector=lP,i.createModelAdapter=w,i.createOfflineAction=pT,i.createPayload=z,i.createSelectionAdapter=$O,i.createShallowEqualSelector=O,i.deleteAsset=Cr,i.deleteAssetAttachment=ba,i.deleteAssetAttachments=xt,i.deleteAssetProcedure=Xc,i.deleteAssetProcedureStep=Mr,i.deleteAssetProcedureStepFieldValues=mr,i.deleteAssetProcedureStepFieldValuesAttachment=xd,i.deleteAssetProcedureStepFieldValuesAttachments=Ps,i.deleteAssetProcedureStepFieldValuesMany=yr,i.deleteAssetProcedureStepFields=kd,i.deleteAssetProcedureStepFieldsAttachment=Md,i.deleteAssetProcedureStepFieldsAttachments=Rd,i.deleteAssetProcedureStepFieldsMany=Ld,i.deleteAssetProcedureSteps=Rr,i.deleteAssetProcedureType=od,i.deleteAssetProcedureTypeAttachment=$a,i.deleteAssetProcedureTypeAttachments=Ua,i.deleteAssetProcedureTypeFieldValues=Uc,i.deleteAssetProcedureTypeFieldValuesAttachment=_c,i.deleteAssetProcedureTypeFieldValuesAttachments=rs,i.deleteAssetProcedureTypeFieldValuesMany=kc,i.deleteAssetProcedureTypeFields=mc,i.deleteAssetProcedureTypeFieldsAttachment=xa,i.deleteAssetProcedureTypeFieldsAttachments=ec,i.deleteAssetProcedureTypeFieldsMany=yc,i.deleteAssetProcedureTypes=hd,i.deleteAssetProcedures=ms,i.deleteAssetStage=yu,i.deleteAssetStageCompletion=xr,i.deleteAssetStageCompletions=eu,i.deleteAssetStages=pu,i.deleteAssetType=Ao,i.deleteAssetTypeAttachment=_u,i.deleteAssetTypeAttachments=Cs,i.deleteAssetTypeFieldValues=Ml,i.deleteAssetTypeFieldValuesAttachment=ml,i.deleteAssetTypeFieldValuesAttachments=Hs,i.deleteAssetTypeFieldValuesMany=Rl,i.deleteAssetTypeFields=el,i.deleteAssetTypeFieldsAttachment=Uu,i.deleteAssetTypeFieldsAttachments=ku,i.deleteAssetTypeFieldsMany=tl,i.deleteAssetTypeIdentifier=kl,i.deleteAssetTypeIdentifierValue=to,i.deleteAssetTypeIdentifierValues=so,i.deleteAssetTypeIdentifiers=Ll,i.deleteAssetTypeStatus=Eo,i.deleteAssetTypeStatuses=vo,i.deleteAssetTypes=fo,i.deleteAssets=ws,i.deleteCategories=Yo,i.deleteCategory=Wo,i.deleteConversation=yP,i.deleteConversations=pP,i.deleteDocument=Ih,i.deleteDocumentAttachment=ch,i.deleteDocumentAttachments=dh,i.deleteDocuments=Oh,i.deleteEmailDomain=Bh,i.deleteEmailDomains=jh,i.deleteForm=Xm,i.deleteFormIdentifier=xh,i.deleteFormIdentifierValue=mm,i.deleteFormIdentifierValues=ym,i.deleteFormIdentifiers=em,i.deleteFormRevision=Si,i.deleteFormRevisionAttachment=Mm,i.deleteFormRevisionAttachments=Rm,i.deleteFormRevisions=Ti,i.deleteFormSubmission=Py,i.deleteFormSubmissionAttachment=ly,i.deleteFormSubmissionAttachments=bi,i.deleteFormSubmissions=vi,i.deleteForms=Qm,i.deleteGeoImage=qy,i.deleteGeoImages=Dy,i.deleteIssue=Jp,i.deleteIssueAssociation=Zy,i.deleteIssueAssociations=vt,i.deleteIssueAttachment=lp,i.deleteIssueAttachments=Ci,i.deleteIssueComment=Cp,i.deleteIssueCommentAttachment=gp,i.deleteIssueCommentAttachments=bp,i.deleteIssueComments=$p,i.deleteIssueType=eS,i.deleteIssueTypeAttachment=lA,i.deleteIssueTypeAttachments=oA,i.deleteIssueTypeFieldValues=CA,i.deleteIssueTypeFieldValuesAttachment=hf,i.deleteIssueTypeFieldValuesAttachments=tn,i.deleteIssueTypeFieldValuesMany=$A,i.deleteIssueTypeFields=QA,i.deleteIssueTypeFieldsAttachment=gA,i.deleteIssueTypeFieldsAttachments=bA,i.deleteIssueTypeFieldsMany=xA,i.deleteIssueTypeIdentifier=_f,i.deleteIssueTypeIdentifierValue=Uf,i.deleteIssueTypeIdentifierValues=kf,i.deleteIssueTypeIdentifiers=Mf,i.deleteIssueTypeStatus=yS,i.deleteIssueTypeStatuses=pS,i.deleteIssueTypes=tS,i.deleteIssueUpdate=pn,i.deleteIssueUpdates=An,i.deleteIssues=Ki,i.deleteOrganization=rT,i.deleteOrganizationAccess=YS,i.deleteOrganizationAccesses=ZS,i.deleteOrganizations=uT,i.deleteProject=II,i.deleteProjectAccess=wT,i.deleteProjectAccesses=ET,i.deleteProjectAttachment=LT,i.deleteProjectAttachments=NT,i.deleteProjectFile=sI,i.deleteProjectFiles=iI,i.deleteProjects=OI,i.deleteTeam=ZI,i.deleteTeamMembership=jI,i.deleteTeamMemberships=qI,i.deleteTeams=JI,i.deleteUser=On,i.deleteUsers=qS,i.dequeue=mO,i.discard=pO,i.documentAttachmentReducer=oh,i.documentAttachmentSlice=ni,i.documentSlice=ci,i.documentsReducer=Ph,i.downloadFile=xO,i.downloadInMemoryFile=JO,i.emailDomainsReducer=$h,i.emailDomainsSlice=ri,i.emailRegex=cP,i.enqueue=hO,i.enqueueRequest=fT,i.extractResponseFromError=fO,i.fallbackToEmptyArray=T,i.fallbackToEmptyObject=At,i.fileReducer=Gh,i.fileSlice=li,i.fileToBlob=ia,i.formIdentifierReducer=nm,i.formIdentifierSlice=oi,i.formIdentifierValueReducer=Sm,i.formIdentifierValueSlice=mi,i.formReducer=xm,i.formRevisionAttachmentReducer=Vm,i.formRevisionAttachmentSlice=yi,i.formRevisionReducer=Lm,i.formRevisionsSlice=pi,i.formSlice=Oi,i.formSubmissionAttachmentReducer=yy,i.formSubmissionAttachmentSlice=Fi,i.formSubmissionReducer=My,i.formSubmissionSlice=wi,i.geoImageReducer=ky,i.geoImageSlice=zi,i.getAssetProcedureStepSubTree=da,i.getAssetProcedureStepTrees=dP,i.getClientSDK=PO,i.getClientStore=rt,i.getDocumentSubTree=oa,i.getDocumentTrees=rP,i.getFileIdentifier=ZO,i.getFileS3Key=Wt,i.getLocalDateString=ta,i.getLocalRelativeDateString=WO,i.getOutboxCoordinator=st,i.getRenamedFile=sa,i.getRequestDescription=P,i.hashFile=nt,i.initSDK=Fb,i.initializeAssetAttachments=Ta,i.initializeAssetProcedureStepFieldValues=cr,i.initializeAssetProcedureStepFieldValuesAttachments=Wd,i.initializeAssetProcedureStepFields=Bd,i.initializeAssetProcedureStepFieldsAttachments=Id,i.initializeAssetProcedureSteps=Ir,i.initializeAssetProcedureTypeAttachments=Va,i.initializeAssetProcedureTypeFieldValues=zc,i.initializeAssetProcedureTypeFieldValuesAttachments=Ic,i.initializeAssetProcedureTypeFields=cc,i.initializeAssetProcedureTypeFieldsAttachments=Ka,i.initializeAssetProcedureTypes=cd,i.initializeAssetProcedures=Wc,i.initializeAssetStageCompletions=Kr,i.initializeAssetStages=du,i.initializeAssetTypeAttachments=Iu,i.initializeAssetTypeFieldValues=Il,i.initializeAssetTypeFieldValuesAttachments=dl,i.initializeAssetTypeFields=Wu,i.initializeAssetTypeFieldsAttachments=zu,i.initializeAssetTypeIdentifierValues=Yl,i.initializeAssetTypeIdentifiers=Bl,i.initializeAssetTypeStatuses=Fo,i.initializeAssetTypes=uo,i.initializeAssets=Br,i.initializeCategories=Uo,i.initializeConversations=ma,i.initializeDocumentAttachments=xo,i.initializeDocuments=mh,i.initializeEmailDomains=Mh,i.initializeFormIdentifierValues=cm,i.initializeFormIdentifiers=Kh,i.initializeFormRevisionAttachments=Im,i.initializeFormRevisions=Bm,i.initializeFormSubmissionAttachments=ny,i.initializeFormSubmissions=Ay,i.initializeForms=Gm,i.initializeGeoImages=wy,i.initializeIssueAssociations=Ny,i.initializeIssueAttachments=np,i.initializeIssueCommentAttachments=fp,i.initializeIssueComments=vp,i.initializeIssueTypeAttachments=iA,i.initializeIssueTypeFieldValues=vA,i.initializeIssueTypeFieldValuesAttachments=cf,i.initializeIssueTypeFields=HA,i.initializeIssueTypeFieldsAttachments=fA,i.initializeIssueTypeIdentifierValues=zf,i.initializeIssueTypeIdentifiers=Tf,i.initializeIssueTypeStatuses=dS,i.initializeIssueTypes=Wf,i.initializeIssueUpdates=IS,i.initializeIssues=Gp,i.initializeOrganizationAccesses=kS,i.initializeOrganizations=tT,i.initializeProjectAccesses=PT,i.initializeProjectAttachments=jT,i.initializeProjectFiles=ZT,i.initializeProjects=mI,i.initializeTeamMemberships=RI,i.initializeTeams=LI,i.initializeUsers=ES,i.isToday=KO,i.issueAssociationReducer=sp,i.issueAssociationSlice=ji,i.issueAttachmentReducer=pp,i.issueAttachmentSlice=qi,i.issueCommentAttachmentReducer=wp,i.issueCommentAttachmentSlice=Ui,i.issueCommentReducer=Lp,i.issueCommentSlice=Li,i.issueReducer=tA,i.issueSlice=Gi,i.issueTypeAttachmentReducer=pA,i.issueTypeAttachmentSlice=Wi,i.issueTypeFieldValuesAttachmentReducer=ff,i.issueTypeFieldValuesAttachmentSlice=xi,i.issueTypeFieldValuesReducer=NA,i.issueTypeFieldValuesSlice=Xi,i.issueTypeFieldsAttachmentReducer=wA,i.issueTypeFieldsAttachmentSlice=Zi,i.issueTypeFieldsReducer=nf,i.issueTypeFieldsSlice=Qi,i.issueTypeIdentifierReducer=vf,i.issueTypeIdentifierSlice=nn,i.issueTypeIdentifierValueReducer=Hf,i.issueTypeIdentifierValueSlice=cn,i.issueTypeReducer=aS,i.issueTypeSlice=dn,i.issueTypeStatusReducer=SS,i.issueTypeStatusSlice=un,i.issueTypeStatusSortFn=ua,i.issueUpdateReducer=RS,i.issueUpdateSlice=hn,i.logOnlyOnce=eP,i.markAsDeleted=ST,i.markForDeletion=vF,i.memoize=Ht,i.organizationAccessReducer=JS,i.organizationAccessSlice=Fn,i.organizationReducer=yT,i.organizationSlice=gn,i.outboxReducer=IT,i.outboxSlice=bn,i.overmapEnhancer=sg,i.overmapReducer=YF,i.overmapReducers=iO,i.performRequest=kn,i.performRequestFromAction=yO,i.projectAccessReducer=vT,i.projectAccessSlice=_n,i.projectAttachmentReducer=WT,i.projectAttachmentSlice=Rn,i.projectFileReducer=oI,i.projectFileSlice=En,i.projectReducer=PI,i.projectSlice=vn,i.rehydratedReducer=_I,i.rehydratedSlice=Vn,i.restructureSelectorArgs=S,i.runMiddleware=_O,i.saveActiveProjectFileBounds=cI,i.selectAccessToken=JP,i.selectAccessesByUserOfProject=zF,i.selectAccessibleProjects=CF,i.selectActiveOrganizationAccess=MF,i.selectActiveProjectFileId=qF,i.selectAllDocumentAttachments=ai,i.selectAssetAttachmentById=Ma,i.selectAssetAttachmentMapping=_a,i.selectAssetAttachments=es,i.selectAssetAttachmentsByIds=Ra,i.selectAssetById=Lr,i.selectAssetProcedureById=id,i.selectAssetProcedureStepById=Er,i.selectAssetProcedureStepFieldValues=lt,i.selectAssetProcedureStepFieldValuesAttachmentById=tr,i.selectAssetProcedureStepFieldValuesAttachments=Fs,i.selectAssetProcedureStepFieldValuesAttachmentsByIds=sr,i.selectAssetProcedureStepFieldValuesAttachmentsMapping=er,i.selectAssetProcedureStepFieldValuesById=Ar,i.selectAssetProcedureStepFieldValuesByIds=fr,i.selectAssetProcedureStepFieldValuesMapping=pr,i.selectAssetProcedureStepFieldValuesOfAsset=EP,i.selectAssetProcedureStepFieldValuesOfAssetProcedure=vP,i.selectAssetProcedureStepFieldValuesOfAssetProcedureStep=VP,i.selectAssetProcedureStepFields=Ot,i.selectAssetProcedureStepFieldsAttachmentById=Ed,i.selectAssetProcedureStepFieldsAttachments=fs,i.selectAssetProcedureStepFieldsAttachmentsByIds=vd,i.selectAssetProcedureStepFieldsAttachmentsMapping=wd,i.selectAssetProcedureStepFieldsById=Nd,i.selectAssetProcedureStepFieldsByIds=Gd,i.selectAssetProcedureStepFieldsMapping=Ts,i.selectAssetProcedureStepFieldsOfAssetProcedureStep=MP,i.selectAssetProcedureStepMapping=Pt,i.selectAssetProcedureSteps=_s,i.selectAssetProcedureStepsByIds=vr,i.selectAssetProcedureStepsMappingOfAssetProcedureType=zP,i.selectAssetProcedureStepsOfAssetProcedureType=BP,i.selectAssetProcedureTypeAttachmentById=Na,i.selectAssetProcedureTypeAttachmentMapping=La,i.selectAssetProcedureTypeAttachments=ss,i.selectAssetProcedureTypeAttachmentsByIds=Ga,i.selectAssetProcedureTypeById=fd,i.selectAssetProcedureTypeFieldValues=Tt,i.selectAssetProcedureTypeFieldValuesAttachmentById=wc,i.selectAssetProcedureTypeFieldValuesAttachments=us,i.selectAssetProcedureTypeFieldValuesAttachmentsByIds=Ec,i.selectAssetProcedureTypeFieldValuesAttachmentsMapping=Rc,i.selectAssetProcedureTypeFieldValuesById=Gc,i.selectAssetProcedureTypeFieldValuesByIds=Hc,i.selectAssetProcedureTypeFieldValuesMapping=Nc,i.selectAssetProcedureTypeFieldValuesOfAsset=PP,i.selectAssetProcedureTypeFields=St,i.selectAssetProcedureTypeFieldsAttachmentById=ic,i.selectAssetProcedureTypeFieldsAttachments=ns,i.selectAssetProcedureTypeFieldsAttachmentsByIds=nc,i.selectAssetProcedureTypeFieldsAttachmentsMapping=sc,i.selectAssetProcedureTypeFieldsById=fc,i.selectAssetProcedureTypeFieldsByIds=Sc,i.selectAssetProcedureTypeFieldsMapping=Ac,i.selectAssetProcedureTypeFieldsOfAssetProcedureType=IP,i.selectAssetProcedureTypes=ps,i.selectAssetProcedureTypesByIds=Sd,i.selectAssetProcedureTypesMapping=Ad,i.selectAssetProcedureTypesOfOrganization=bP,i.selectAssetProcedures=It,i.selectAssetProceduresByIds=nd,i.selectAssetProceduresMapping=td,i.selectAssetProceduresOfAssetProcedureType=sd,i.selectAssetProceduresOfAssetType=gP,i.selectAssetStageById=fu,i.selectAssetStageCompletionById=nu,i.selectAssetStageCompletionMapping=su,i.selectAssetStageCompletions=iu,i.selectAssetStageCompletionsByIds=au,i.selectAssetStages=js,i.selectAssetStagesByIds=Su,i.selectAssetStagesMappingOfAssetProcedureType=qP,i.selectAssetStagesOfAssetProcedureType=DP,i.selectAssetTypeAttachmentById=Ru,i.selectAssetTypeAttachmentMapping=Mu,i.selectAssetTypeAttachments=$s,i.selectAssetTypeAttachmentsByIds=wu,i.selectAssetTypeById=To,i.selectAssetTypeFieldValues=Ft,i.selectAssetTypeFieldValuesAttachmentById=pl,i.selectAssetTypeFieldValuesAttachments=Ks,i.selectAssetTypeFieldValuesAttachmentsByIds=Al,i.selectAssetTypeFieldValuesAttachmentsMapping=yl,i.selectAssetTypeFieldValuesById=El,i.selectAssetTypeFieldValuesByIds=vl,i.selectAssetTypeFieldValuesMapping=wl,i.selectAssetTypeFieldValuesOfAsset=kP,i.selectAssetTypeFields=ot,i.selectAssetTypeFieldsAttachmentById=Nu,i.selectAssetTypeFieldsAttachments=ks,i.selectAssetTypeFieldsAttachmentsByIds=Gu,i.selectAssetTypeFieldsAttachmentsMapping=Lu,i.selectAssetTypeFieldsById=il,i.selectAssetTypeFieldsByIds=nl,i.selectAssetTypeFieldsMapping=sl,i.selectAssetTypeFieldsOfAssetType=$P,i.selectAssetTypeIdentifierById=Gl,i.selectAssetTypeIdentifierMapping=Nl,i.selectAssetTypeIdentifierValueById=no,i.selectAssetTypeIdentifierValueMapping=io,i.selectAssetTypeIdentifierValues=gt,i.selectAssetTypeIdentifierValuesByIds=ao,i.selectAssetTypeIdentifierValuesOfAsset=GP,i.selectAssetTypeIdentifierValuesOfIdentifier=HP,i.selectAssetTypeIdentifiers=Zs,i.selectAssetTypeIdentifiersByIds=Hl,i.selectAssetTypeIdentifiersOfAssetType=NP,i.selectAssetTypeStatusById=zo,i.selectAssetTypeStatusMapping=Vo,i.selectAssetTypeStatuses=ei,i.selectAssetTypeStatusesByIds=Bo,i.selectAssetTypeStatusesOfAssetType=WP,i.selectAssetTypeValuesOfAssetType=LP,i.selectAssetTypes=Qs,i.selectAssetTypesByIds=Io,i.selectAssetTypesMapping=So,i.selectAssetTypesOfOrganization=KP,i.selectAssets=Es,i.selectAssetsByIds=Nr,i.selectAssetsMapping=kr,i.selectAssetsOfAssetType=vs,i.selectAttachmentsOfAsset=wa,i.selectAttachmentsOfAssetProcedureStepFieldValues=ir,i.selectAttachmentsOfAssetProcedureStepFields=_P,i.selectAttachmentsOfAssetProcedureType=SP,i.selectAttachmentsOfAssetProcedureTypeFieldValues=vc,i.selectAttachmentsOfAssetProcedureTypeFields=TP,i.selectAttachmentsOfAssetType=Eu,i.selectAttachmentsOfAssetTypeFieldValues=fl,i.selectAttachmentsOfAssetTypeFields=CP,i.selectAttachmentsOfDocument=xP,i.selectAttachmentsOfFormRevision=dF,i.selectAttachmentsOfFormSubmission=my,i.selectAttachmentsOfIssue=hp,i.selectAttachmentsOfIssueComment=oF,i.selectAttachmentsOfIssueType=yF,i.selectAttachmentsOfIssueTypeFieldValues=Af,i.selectAttachmentsOfIssueTypeFields=pF,i.selectAttachmentsOfProject=jF,i.selectCategories=si,i.selectCategoriesByIds=Jo,i.selectCategoriesOfProject=QP,i.selectCategoryById=ii,i.selectCategoryMapping=Zo,i.selectCommentsOfIssue=hF,i.selectConversation=fP,i.selectConversationMapping=Jt,i.selectConversations=AP,i.selectCurrentUser=CS,i.selectDeletedRequests=wF,i.selectDescendantsOfAssetProcedureStep=Vr,i.selectDescendantsOfDocument=bh,i.selectDocumentAttachmentById=uh,i.selectDocumentAttachmentMapping=rh,i.selectDocumentAttachmentsByIds=lh,i.selectDocumentById=Fh,i.selectDocuments=_t,i.selectDocumentsByIds=gh,i.selectDocumentsMapping=di,i.selectEmailDomainById=Dh,i.selectEmailDomains=ui,i.selectEmailDomainsAsMapping=qh,i.selectEmailDomainsByIds=Ch,i.selectEmailDomainsOfOrganization=sF,i.selectFieldValuesOfAssetProcedure=FP,i.selectFormById=ty,i.selectFormIdentifierById=sm,i.selectFormIdentifierMapping=tm,i.selectFormIdentifierValueById=Am,i.selectFormIdentifierValueMapping=pm,i.selectFormIdentifierValues=Mt,i.selectFormIdentifierValuesByIds=fm,i.selectFormIdentifierValuesOfFormSubmission=aF,i.selectFormIdentifierValuesOfIdentifier=cF,i.selectFormIdentifiers=hi,i.selectFormIdentifiersByIds=im,i.selectFormIdentifiersOfForm=nF,i.selectFormMapping=ey,i.selectFormRevisionAttachmentById=Em,i.selectFormRevisionAttachments=wm,i.selectFormRevisionAttachmentsByIds=vm,i.selectFormRevisionAttachmentsMapping=Rt,i.selectFormRevisionById=$m,i.selectFormRevisionMapping=Ii,i.selectFormRevisions=wt,i.selectFormRevisionsByIds=Um,i.selectFormRevisionsOfForm=km,i.selectFormSubmissionAttachemntsByIds=Ri,i.selectFormSubmissionAttachmentById=oy,i.selectFormSubmissionAttachments=Mi,i.selectFormSubmissionAttachmentsByIds=hy,i.selectFormSubmissionAttachmentsMapping=_i,i.selectFormSubmissionById=gy,i.selectFormSubmissions=Fy,i.selectFormSubmissionsByIds=by,i.selectFormSubmissionsMapping=Vi,i.selectFormSubmissionsOfForm=_y,i.selectForms=Pi,i.selectFormsByIds=sy,i.selectFormsOfOrganization=uF,i.selectGeoImageById=$y,i.selectGeoImageMapping=Cy,i.selectGeoImages=Bi,i.selectGeoImagesByIds=Uy,i.selectGeoImagesOfProject=lF,i.selectIsImportingProjectFile=DF,i.selectIsLoggedIn=XP,i.selectIssueAssociationById=Xy,i.selectIssueAssociationMapping=ht,i.selectIssueAssociations=Jy,i.selectIssueAssociationsByIds=Qy,i.selectIssueAssociationsOfAsset=tp,i.selectIssueAssociationsOfIssue=ep,i.selectIssueAssociationsToIssue=xy,i.selectIssueAttachmentById=mp,i.selectIssueAttachmentMapping=op,i.selectIssueAttachments=$i,i.selectIssueAttachmentsByIds=yp,i.selectIssueById=Qp,i.selectIssueCommentAttachmentById=Mp,i.selectIssueCommentAttachmentMapping=_p,i.selectIssueCommentAttachments=ki,i.selectIssueCommentAttachmentsByIds=Rp,i.selectIssueCommentById=Up,i.selectIssueCommentMapping=Ni,i.selectIssueCommentsByIds=kp,i.selectIssueMapping=Xp,i.selectIssueTypeAttachmentById=mA,i.selectIssueTypeAttachmentMapping=hA,i.selectIssueTypeAttachments=Yi,i.selectIssueTypeAttachmentsByIds=yA,i.selectIssueTypeById=iS,i.selectIssueTypeFieldValues=zt,i.selectIssueTypeFieldValuesAttachmentById=yf,i.selectIssueTypeFieldValuesAttachments=sn,i.selectIssueTypeFieldValuesAttachmentsByIds=pf,i.selectIssueTypeFieldValuesAttachmentsMapping=mf,i.selectIssueTypeFieldValuesById=kA,i.selectIssueTypeFieldValuesByIds=LA,i.selectIssueTypeFieldValuesMapping=UA,i.selectIssueTypeFieldValuesOfIssue=AF,i.selectIssueTypeFields=mt,i.selectIssueTypeFieldsAttachmentById=MA,i.selectIssueTypeFieldsAttachments=Ji,i.selectIssueTypeFieldsAttachmentsByIds=RA,i.selectIssueTypeFieldsAttachmentsMapping=_A,i.selectIssueTypeFieldsById=tf,i.selectIssueTypeFieldsByIds=sf,i.selectIssueTypeFieldsMapping=ef,i.selectIssueTypeFieldsOfIssueType=fF,i.selectIssueTypeIdentifierById=wf,i.selectIssueTypeIdentifierMapping=Rf,i.selectIssueTypeIdentifierValueById=Nf,i.selectIssueTypeIdentifierValueMapping=Lf,i.selectIssueTypeIdentifierValues=Bt,i.selectIssueTypeIdentifierValuesByIds=Gf,i.selectIssueTypeIdentifierValuesOfIdentifier=PF,i.selectIssueTypeIdentifierValuesOfIssue=OF,i.selectIssueTypeIdentifiers=an,i.selectIssueTypeIdentifiersByIds=Ef,i.selectIssueTypeIdentifiersOfIssueType=IF,i.selectIssueTypeMapping=sS,i.selectIssueTypeStatusById=on,i.selectIssueTypeStatusMapping=AS,i.selectIssueTypeStatuses=ln,i.selectIssueTypeStatusesByIds=fS,i.selectIssueTypeStatusesOfIssueType=gF,i.selectIssueTypeValuesOfIssueType=TF,i.selectIssueTypes=rn,i.selectIssueTypesByIds=nS,i.selectIssueTypesOfOrganization=FF,i.selectIssueUpdateById=bS,i.selectIssueUpdateMapping=fn,i.selectIssueUpdates=Sn,i.selectIssueUpdatesByIds=_S,i.selectIssueUpdatesOfIssue=MS,i.selectIssues=Vt,i.selectIssuesByIds=xp,i.selectIssuesOfIssueType=eA,i.selectIssuesOfProject=mF,i.selectLatestAssetProcedureStepFieldsOfAssetProcedureStep=RP,i.selectLatestAssetProcedureTypeFieldsOfAssetProcedureType=OP,i.selectLatestAssetTypeFieldsOfAssetType=UP,i.selectLatestFieldsByAssetProcedureStep=wP,i.selectLatestFormRevisionOfForm=rF,i.selectLatestIssueTypeFieldsOfIssueType=SF,i.selectLatestRetryTime=EF,i.selectMembershipsByUserOfTeam=NF,i.selectNumberOfAssetsOfAssetType=jP,i.selectOrganizationAccessById=XS,i.selectOrganizationAccessMapping=Dt,i.selectOrganizationAccessUserMapping=xS,i.selectOrganizationAccessesByIds=QS,i.selectOrganizationById=hT,i.selectOrganizationDocuments=tF,i.selectOrganizations=oT,i.selectOrganizationsByIds=mT,i.selectOrganizationsMapping=lT,i.selectProjectAccessById=VT,i.selectProjectAccessMapping=Mn,i.selectProjectAccesses=yt,i.selectProjectAccessesByIds=zT,i.selectProjectAccessesOfProject=VF,i.selectProjectAttachmentById=HT,i.selectProjectAttachmentMapping=GT,i.selectProjectAttachments=wn,i.selectProjectAttachmentsByIds=KT,i.selectProjectById=gI,i.selectProjectDocuments=eF,i.selectProjectFileById=uI,i.selectProjectFileMapping=dI,i.selectProjectFiles=rI,i.selectProjectFilesByIds=lI,i.selectProjectMapping=FI,i.selectProjects=Ct,i.selectProjectsByIds=bI,i.selectProjectsOfOrganization=$F,i.selectRehydrated=LF,i.selectStageMapping=Bs,i.selectTeamById=QI,i.selectTeamMembershipById=$I,i.selectTeamMemberships=$t,i.selectTeamMembershipsByIds=UI,i.selectTeamMembershipsMapping=CI,i.selectTeams=jn,i.selectTeamsByIds=xI,i.selectTeamsMapping=XI,i.selectTeamsOfOrganization=HF,i.selectUploadUrl=Nh,i.selectUserById=qt,i.selectUsers=jt,i.selectUsersByIds=$S,i.selectUsersMapping=Pn,i.selectUsersOfOrganization=RF,i.selectUsersOfProject=BF,i.selectUsersOfTeam=GF,i.setActiveProjectFileId=aI,i.setAsset=$r,i.setAssetAttachment=Oa,i.setAssetAttachments=Pa,i.setAssetProcedure=Qc,i.setAssetProcedureStep=Or,i.setAssetProcedureStepFieldValues=ur,i.setAssetProcedureStepFieldValuesAttachment=Zd,i.setAssetProcedureStepFieldValuesAttachments=Jd,i.setAssetProcedureStepFieldValuesMany=lr,i.setAssetProcedureStepFields=Dd,i.setAssetProcedureStepFieldsAttachment=Fd,i.setAssetProcedureStepFieldsAttachments=gd,i.setAssetProcedureStepFieldsMany=Cd,i.setAssetProcedureSteps=Pr,i.setAssetProcedureType=md,i.setAssetProcedureTypeAttachment=ja,i.setAssetProcedureTypeAttachments=qa,i.setAssetProcedureTypeFieldValues=qc,i.setAssetProcedureTypeFieldValuesAttachment=Pc,i.setAssetProcedureTypeFieldValuesAttachments=Fc,i.setAssetProcedureTypeFieldValuesMany=Dc,i.setAssetProcedureTypeFields=uc,i.setAssetProcedureTypeFieldsAttachment=Za,i.setAssetProcedureTypeFieldsAttachments=Ja,i.setAssetProcedureTypeFieldsMany=lc,i.setAssetProcedureTypes=yd,i.setAssetProcedures=xc,i.setAssetStage=ru,i.setAssetStageCompletion=Zr,i.setAssetStageCompletions=Jr,i.setAssetStages=uu,i.setAssetType=lo,i.setAssetTypeAttachment=Pu,i.setAssetTypeAttachments=Fu,i.setAssetTypeFieldValues=Fl,i.setAssetTypeFieldValuesAttachment=ul,i.setAssetTypeFieldValuesAttachments=ll,i.setAssetTypeFieldValuesMany=gl,i.setAssetTypeFields=Ju,i.setAssetTypeFieldsAttachment=qu,i.setAssetTypeFieldsAttachments=Du,i.setAssetTypeFieldsMany=Xu,i.setAssetTypeIdentifier=Dl,i.setAssetTypeIdentifierValue=Xl,i.setAssetTypeIdentifierValues=Ql,i.setAssetTypeIdentifiers=Cl,i.setAssetTypeStatus=_o,i.setAssetTypeStatuses=Mo,i.setAssetTypes=oo,i.setAssets=Ur,i.setCategories=Go,i.setCategory=No,i.setClientSDK=OO,i.setClientStore=TO,i.setConversation=pa,i.setConversations=hP,i.setCurrentUser=bF,i.setDocument=Ah,i.setDocumentAttachment=sh,i.setDocumentAttachments=ih,i.setDocuments=fh,i.setEmailDomain=Eh,i.setEmailDomains=vh,i.setForm=Wm,i.setFormIdentifier=Zh,i.setFormIdentifierValue=um,i.setFormIdentifierValues=lm,i.setFormIdentifiers=Jh,i.setFormRevision=jm,i.setFormRevisionAttachment=Fm,i.setFormRevisionAttachments=gm,i.setFormRevisions=qm,i.setFormSubmission=fy,i.setFormSubmissionAttachment=cy,i.setFormSubmissionAttachments=dy,i.setFormSubmissions=Sy,i.setForms=Ym,i.setGeoImage=Ey,i.setGeoImages=vy,i.setIsImportingProjectFile=nI,i.setIssue=Kp,i.setIssueAssociation=Hy,i.setIssueAssociations=Gy,i.setIssueAttachment=cp,i.setIssueAttachments=dp,i.setIssueComment=Bp,i.setIssueCommentAttachment=Ip,i.setIssueCommentAttachments=Op,i.setIssueComments=jp,i.setIssueType=Jf,i.setIssueTypeAttachment=cA,i.setIssueTypeAttachments=dA,i.setIssueTypeFieldValues=BA,i.setIssueTypeFieldValuesAttachment=rf,i.setIssueTypeFieldValuesAttachments=uf,i.setIssueTypeFieldValuesMany=jA,i.setIssueTypeFields=YA,i.setIssueTypeFieldsAttachment=IA,i.setIssueTypeFieldsAttachments=OA,i.setIssueTypeFieldsMany=ZA,i.setIssueTypeIdentifier=Pf,i.setIssueTypeIdentifierValue=qf,i.setIssueTypeIdentifierValues=Df,i.setIssueTypeIdentifiers=Ff,i.setIssueTypeStatus=lS,i.setIssueTypeStatuses=oS,i.setIssueTypes=Xf,i.setIssueUpdate=OS,i.setIssueUpdates=PS,i.setIssues=Wp,i.setLoggedIn=Do,i.setOrganization=iT,i.setOrganizationAccess=GS,i.setOrganizationAccesses=HS,i.setOrganizations=sT,i.setProfilePicture=_F,i.setProject=pI,i.setProjectAccess=bT,i.setProjectAccesses=_T,i.setProjectAttachment=CT,i.setProjectAttachments=$T,i.setProjectFile=JT,i.setProjectFiles=XT,i.setProjects=yI,i.setRehydrated=kF,i.setTeam=HI,i.setTeamMembership=vI,i.setTeamMemberships=VI,i.setTeams=KI,i.setTokens=YP,i.setUploadUrl=Lh,i.setUser=VS,i.setUsers=vS,i.shallowEqual=LO,i.slugify=nP,i.spacesToDashesLower=iP,i.teamMembershipReducer=DI,i.teamMembershipSlice=zn,i.teamReducer=eO,i.teamSlice=Bn,i.toFileNameSafeString=sP,i.toUuidArray=C,i.toUuidIdRecord=tP,i.truncate=aP,i.updateAsset=qr,i.updateAssetAttachment=Fa,i.updateAssetAttachments=ga,i.updateAssetProcedure=Zc,i.updateAssetProcedureStep=br,i.updateAssetProcedureStepFieldValues=or,i.updateAssetProcedureStepFieldValuesAttachment=Xd,i.updateAssetProcedureStepFieldValuesAttachments=Qd,i.updateAssetProcedureStepFieldValuesMany=hr,i.updateAssetProcedureStepFields=$d,i.updateAssetProcedureStepFieldsAttachment=bd,i.updateAssetProcedureStepFieldsAttachments=_d,i.updateAssetProcedureStepFieldsMany=Ud,i.updateAssetProcedureSteps=_r,i.updateAssetProcedureType=ud,i.updateAssetProcedureTypeAttachment=Da,i.updateAssetProcedureTypeAttachments=Ca,i.updateAssetProcedureTypeFieldValues=Cc,i.updateAssetProcedureTypeFieldValuesAttachment=gc,i.updateAssetProcedureTypeFieldValuesAttachments=bc,i.updateAssetProcedureTypeFieldValuesMany=$c,i.updateAssetProcedureTypeFields=oc,i.updateAssetProcedureTypeFieldsAttachment=Xa,i.updateAssetProcedureTypeFieldsAttachments=Qa,i.updateAssetProcedureTypeFieldsMany=hc,i.updateAssetProcedureTypes=ld,i.updateAssetProcedures=Jc,i.updateAssetStage=hu,i.updateAssetStageCompletion=Xr,i.updateAssetStageCompletions=Qr,i.updateAssetStages=mu,i.updateAssetType=yo,i.updateAssetTypeAttachment=gu,i.updateAssetTypeAttachments=bu,i.updateAssetTypeFieldValues=bl,i.updateAssetTypeFieldValuesAttachment=ol,i.updateAssetTypeFieldValuesAttachments=hl,i.updateAssetTypeFieldValuesMany=_l,i.updateAssetTypeFields=Qu,i.updateAssetTypeFieldsAttachment=Cu,i.updateAssetTypeFieldsAttachments=$u,i.updateAssetTypeFieldsMany=xu,i.updateAssetTypeIdentifier=$l,i.updateAssetTypeIdentifierValue=xl,i.updateAssetTypeIdentifierValues=eo,i.updateAssetTypeIdentifiers=Ul,i.updateAssetTypeStatus=Ro,i.updateAssetTypeStatuses=wo,i.updateAssetTypes=po,i.updateAssets=Dr,i.updateCategories=Ko,i.updateCategory=Ho,i.updateConversation=Aa,i.updateConversations=mP,i.updateDocument=Sh,i.updateDocumentAttachment=nh,i.updateDocumentAttachments=ah,i.updateDocuments=Th,i.updateEmailDomain=Vh,i.updateEmailDomains=zh,i.updateForm=Zm,i.updateFormIdentifier=Xh,i.updateFormIdentifierValue=om,i.updateFormIdentifierValues=hm,i.updateFormIdentifiers=Qh,i.updateFormRevision=Dm,i.updateFormRevisionAttachment=bm,i.updateFormRevisionAttachments=_m,i.updateFormRevisions=Cm,i.updateFormSubmission=Iy,i.updateFormSubmissionAttachment=ry,i.updateFormSubmissionAttachments=uy,i.updateFormSubmissions=Oy,i.updateForms=Jm,i.updateGeoImage=By,i.updateGeoImages=jy,i.updateIssue=Yp,i.updateIssueAssociation=Ky,i.updateIssueAssociations=Wy,i.updateIssueAttachment=rp,i.updateIssueAttachments=up,i.updateIssueComment=qp,i.updateIssueCommentAttachment=Pp,i.updateIssueCommentAttachments=Fp,i.updateIssueComments=Dp,i.updateIssueType=Qf,i.updateIssueTypeAttachment=rA,i.updateIssueTypeAttachments=uA,i.updateIssueTypeFieldValues=qA,i.updateIssueTypeFieldValuesAttachment=lf,i.updateIssueTypeFieldValuesAttachments=of,i.updateIssueTypeFieldValuesMany=DA,i.updateIssueTypeFields=JA,i.updateIssueTypeFieldsAttachment=PA,i.updateIssueTypeFieldsAttachments=FA,i.updateIssueTypeFieldsMany=XA,i.updateIssueTypeIdentifier=gf,i.updateIssueTypeIdentifierValue=Cf,i.updateIssueTypeIdentifierValues=$f,i.updateIssueTypeIdentifiers=bf,i.updateIssueTypeStatus=hS,i.updateIssueTypeStatuses=mS,i.updateIssueTypes=xf,i.updateIssueUpdate=FS,i.updateIssueUpdates=gS,i.updateIssues=Zp,i.updateOrganization=dT,i.updateOrganizationAccess=KS,i.updateOrganizationAccesses=WS,i.updateOrganizations=cT,i.updateProject=TI,i.updateProjectAccess=MT,i.updateProjectAccesses=RT,i.updateProjectAttachment=UT,i.updateProjectAttachments=kT,i.updateProjectFile=eI,i.updateProjectFiles=tI,i.updateProjects=SI,i.updateTeam=WI,i.updateTeamMembership=zI,i.updateTeamMemberships=BI,i.updateTeams=YI,i.updateUser=jS,i.updateUsers=BS,i.useSelectorBuilder=UO,i.useSelectorFactory=kO,i.userReducer=DS,i.userSlice=Tn,i.uuidObj=R,i.uuidObjSortFn=Yt,i.uuidSortFn=ft,i.versioningReducer=sO,i.versioningSlice=tO,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});