@overmap-ai/core 1.0.78-bulk-update.11 → 1.0.78-bulk-update.14

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.
@@ -1,15 +1,15 @@
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("@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","@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.reduxOffline,i.offlineConfig,i.localforage,i.createMigration,null,null,i.idb,i.jwtDecode,i.dependencyGraph))})(this,function(i,L,o,st,xe,Nn,RO,wO,Gn,yt,EO,Hn,vO,VO,gb,bb,zO,BO,jO){"use strict";var Pb=Object.defineProperty;var Fb=(i,L,o)=>L in i?Pb(i,L,{enumerable:!0,configurable:!0,writable:!0,value:o}):i[L]=o;var y=(i,L,o)=>Fb(i,typeof L!="symbol"?L+"":L,o);var _O;const Wn=Object.freeze([]),Kn=Object.freeze({});var Yn=(t=>(t[t.GUEST=0]="GUEST",t[t.BASIC=2]="BASIC",t[t.ADMIN=4]="ADMIN",t))(Yn||{}),m=(t=>(t.GET="GET",t.POST="POST",t.PATCH="PATCH",t.PUT="PUT",t.DELETE="DELETE",t))(m||{}),Zn=(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))(Zn||{}),Jn=(t=>(t.Issue="issue",t.Asset="asset",t.AssetType="asset_type",t.Project="project",t.Document="document",t))(Jn||{}),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||{}),$=(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))($||{}),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 qO=Lt.MEDIUM,Qn=6e4;function R(t){return{addOne:(h,p)=>{const A=t(p.payload);h.instances[A]=p.payload},addMany:(h,p)=>{for(const A of p.payload){const f=t(A);h.instances[f]=A}},setOne:(h,p)=>{const A=t(p.payload);h.instances[A]=p.payload},setMany:(h,p)=>{for(const A of p.payload){const f=t(A);h.instances[f]=A}},updateOne:(h,p)=>{const A=t(p.payload);h.instances[A]=p.payload},updateMany:(h,p)=>{for(const A of p.payload){const f=t(A);h.instances[f]=A}},deleteOne:(h,p)=>{delete h.instances[p.payload]},deleteMany:(h,p)=>{for(const A of p.payload)delete h.instances[A]},initialize:(h,p)=>{h.instances={};const A=new Set;for(const f of p.payload){const I=t(f);A.add(I),h.instances[I]=f}A.size!==p.payload.length&&console.warn("duplicate ids detected when initializing model instances.")}}}function DO(){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 h=new Set(u.selection);for(const p of d.payload)h.has(p)||h.add(p);u.selection=Array.from(h)},unselectOne:(u,d)=>{const h=new Set(u.selection);h.has(d.payload)&&(h.delete(d.payload),u.selection=Array.from(h))},unselectMany:(u,d)=>{const h=new Set(u.selection);for(const p of d.payload)h.has(p)&&h.delete(p);u.selection=Array.from(h)},toggleOne:(u,d)=>{const h=new Set(u.selection);h.has(d.payload)?h.delete(d.payload):h.add(d.payload),u.selection=Array.from(h)},toggleMany:(u,d)=>{const h=new Set(u.selection);for(const p of d.payload)h.has(p)?h.delete(p):h.add(p);u.selection=Array.from(h)},getInitialState:u=>({...u,selection:[]})}}const rt="versioning",_=o.createAction("RESET"),C=o.createAction("RESET_PROJECT_STATE"),w=o.createAction("RESET_ORGANIZATION_STATE");function CO(t,s){return Nn.useMemo(t,s)}function $O(t,s){const e=Nn.useMemo(t,s);return RO.useSelector(e)}_O=Symbol.toStringTag;class kt{constructor(){y(this,_O,"Promise");y(this,"_promise");y(this,"_resolve");y(this,"_reject");y(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 Nt=!1;["true","1"].includes("".toLowerCase())&&(Nt=!0);function UO(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 Gt(t){const s={};return function(){const e=Array.prototype.slice.call(arguments);return e in s?(Nt&&console.debug(`Memoization debug: Using memorized return value for ${t.toString()}(`,e,")"),s[e]):(Nt&&console.debug(`Memoization debug: Cache miss! Memoizing ${t.toString()}(`,e,")"),s[e]=t.apply(this,e))}}function LO(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?Wn:t,pt=t=>Object.keys(t).length===0?Kn:t,xn=Gt(t=>{if(!t)return"";const s=new Date(t),e=s.getFullYear()===Ht.getFullYear(),n={day:"numeric",month:"short"};return e||(n.year="numeric"),s.toLocaleDateString([],n)}),kO=new Intl.RelativeTimeFormat([],{style:"long",numeric:"auto"}),NO=1e3*86400,Ht=new Date,GO=t=>new Date(t).toDateString()===Ht.toDateString(),HO=Gt((t,s,e)=>{const n=Math.round((new Date(t).getTime()-Ht.getTime())/NO);return n<s||n>e?xn(t):kO.format(n,"days")});function WO(t){return new Uint8Array(t).reduce((e,n)=>e+n.toString(16).padStart(2,"0"),"")}const Wt=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=WO(c);s(r)})},n.readAsArrayBuffer(t)})}function KO(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 ea(t,s){return new File([t],s,{type:t.type})}function YO(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 ZO=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)},ta=async t=>(await fetch(t)).blob(),JO=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]);wO.saveAs(s,t.name)}const sa={};function QO(t,s,e,...n){const a=sa[t];let c=!1;a?a[s]||(a[s]=!0,c=!0):(sa[t]={[s]:!0},c=!0),c&&console[e](...n)}const ia=["created_at","updated_at","index","revision"];function M(t){return{...t,uuid:xe.v4()}}function xO(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 Kt(t,s){return At(t.uuid,s.uuid)}function eP(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 tP(t){return t.toLowerCase().replace(" ","-")}function sP(t,s=!1){return t.normalize("NFKD").toLowerCase().replace(/[^\w\s-]/g,"").trim().replace(/[-\s]+/g,s?"_":"-")}function iP(t,s){if(t.length<=s)return t;const e=t.slice(0,s-1);return e.slice(0,e.lastIndexOf(" "))+"…"}const nP=/^.+@.+\..+$/;function V(t){const s={...t};for(const e of[...ia,"created_by"])e in s&&delete s[e];return s}const na=t=>{const s=t.toSorted((e,n)=>e.order-n.order);return Gn(s,{id:e=>e.uuid,parentId:e=>e.parent,includeEmptyChildrenArray:!0,valueKey:!1})},aP=t=>{const{roots:s}=na(t);return s.map(e=>new yt.Tree(e))},aa=(t,s)=>{const{nodes:e}=na(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)},ca=(t,s)=>t.type!==s.type?t.type-s.type:t.order-s.order,da=(t,s)=>t.type!==s.type?t.type-s.type:t.order-s.order,ra=t=>Gn(t,{id:s=>s.uuid,parentId:s=>s.parent_document,includeEmptyChildrenArray:!0,valueKey:!1}),cP=t=>{const{roots:s}=ra(t);return s.map(e=>new yt.Tree(e))},ua=(t,s)=>{const{nodes:e}=ra(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)};class dP{constructor(s){y(this,"operations",[]);y(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 o.createSelector([this.getData],n=>this.performOperations(n).find(a=>a[s]===e))}count(){return o.createSelector([this.getData],s=>this.performOperations(s).length)}first(){return o.createSelector([this.getData],s=>this.performOperations(s)[0])}last(){return o.createSelector([this.getData],s=>{const e=this.performOperations(s);return e[e.length-1]})}exists(){return o.createSelector([this.getData],s=>this.performOperations(s).length>0)}toSelector(){return o.createSelector([this.getData],s=>T(this.performOperations(s)))}}const S=t=>(...s)=>e=>t(e,...s),N=R(t=>t.uuid),la={instances:{}},Yt=o.createSlice({name:"agents",initialState:la,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,la)),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:oa,addConversation:ha,addConversations:rP,setConversation:ma,setConversations:uP,updateConversation:ya,updateConversations:lP,deleteConversation:oP,deleteConversations:hP}=Yt.actions,Zt=t=>t.agentsReducer.instances,mP=o.createSelector([Zt],t=>Object.values(t)),yP=S(o.createSelector([Zt,(t,s)=>s],(t,s)=>t[s])),pa=Yt.reducer,G=R(t=>t.uuid),Aa={instances:{}},Jt=o.createSlice({name:"assetAttachments",initialState:Aa,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,Aa)),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:fa,addAssetAttachment:Sa,addAssetAttachments:Xt,setAssetAttachment:Ta,setAssetAttachments:Ia,updateAssetAttachment:Oa,updateAssetAttachments:Pa,deleteAssetAttachment:Fa,deleteAssetAttachments:Qt}=Jt.actions,ga=t=>t.assetAttachmentReducer.instances,xt=o.createSelector([ga],t=>Object.values(t)),ba=t=>s=>s.assetAttachmentReducer.instances[t],_a=S(o.createSelector([xt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),Ma=S(o.createSelector([xt,(t,s)=>s],(t,s)=>T(t.filter(({asset:e})=>s===e)))),Ra=Jt.reducer,H=R(({uuid:t})=>t),wa={instances:{}},es=o.createSlice({name:"assetProcedureTypeAttachments",initialState:wa,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,wa)),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:Ea,addAssetProcedureTypeAttachment:va,addAssetProcedureTypeAttachments:Va,setAssetProcedureTypeAttachment:za,setAssetProcedureTypeAttachments:Ba,updateAssetProcedureTypeAttachment:ja,updateAssetProcedureTypeAttachments:qa,deleteAssetProcedureTypeAttachment:Da,deleteAssetProcedureTypeAttachments:Ca}=es.actions,$a=es.reducer,Ua=t=>t.assetProcedureTypeAttachmentReducer.instances,ts=o.createSelector([Ua],t=>Object.values(t)),La=t=>s=>s.assetProcedureTypeAttachmentReducer.instances[t],ka=S(o.createSelector([ts,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),pP=S(o.createSelector([ts,(t,s)=>s],(t,s)=>T(t.filter(({asset_procedure_type:e})=>s===e)))),W=R(({uuid:t})=>t),Na={instances:{}},ss=o.createSlice({name:"assetProcedureTypeFieldsAttachments",initialState:Na,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,Na)),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:Ga,addAssetProcedureTypeFieldsAttachment:Ha,addAssetProcedureTypeFieldsAttachments:Wa,setAssetProcedureTypeFieldsAttachment:Ka,setAssetProcedureTypeFieldsAttachments:Ya,updateAssetProcedureTypeFieldsAttachment:Za,updateAssetProcedureTypeFieldsAttachments:Ja,deleteAssetProcedureTypeFieldsAttachment:Xa,deleteAssetProcedureTypeFieldsAttachments:Qa}=ss.actions,xa=ss.reducer,ec=t=>t.assetProcedureTypeFieldsAttachmentReducer.instances,is=o.createSelector([ec],t=>Object.values(t)),AP=S(o.createSelector([is,(t,s)=>s],(t,s)=>T(t.filter(e=>e.fields_revision===s)))),tc=t=>s=>s.assetProcedureTypeFieldsAttachmentReducer.instances[t],sc=S(o.createSelector([is,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),K=R(({uuid:t})=>t),ic={instances:{}},ns=o.createSlice({name:"assetProcedureTypeFields",initialState:ic,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,ic)),reducers:{initializeAssetProcedureTypeFields:K.initialize,addAssetProcedureTypeFields:K.addOne,addAssetProcedureTypeFieldsMany:K.addMany,setAssetProcedureTypeFields:K.setOne,setAssetProcedureTypeFieldsMany:K.setMany,updateAssetProcedureTypeFields:K.updateOne,updateAssetProcedureTypeFieldsMany:K.updateMany,deleteAssetProcedureTypeFields:K.deleteOne,deleteAssetProcedureTypeFieldsMany:K.deleteMany}}),{initializeAssetProcedureTypeFields:nc,addAssetProcedureTypeFields:ac,addAssetProcedureTypeFieldsMany:cc,setAssetProcedureTypeFields:dc,setAssetProcedureTypeFieldsMany:rc,updateAssetProcedureTypeFields:uc,updateAssetProcedureTypeFieldsMany:lc,deleteAssetProcedureTypeFields:oc,deleteAssetProcedureTypeFieldsMany:hc}=ns.actions,mc=ns.reducer,yc=t=>t.assetProcedureTypeFieldsReducer.instances,ft=o.createSelector([yc],t=>Object.values(t)),fP=S(o.createSelector([ft,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_procedure_type===s)))),SP=S(o.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])),pc=t=>s=>s.assetProcedureTypeFieldsReducer.instances[t],Ac=S(o.createSelector([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),fc={instances:{}},as=o.createSlice({name:"assetProcedureTypeFieldValuesAttachments",initialState:fc,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,fc)),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:Sc,addAssetProcedureTypeFieldValuesAttachment:Tc,addAssetProcedureTypeFieldValuesAttachments:cs,setAssetProcedureTypeFieldValuesAttachment:Ic,setAssetProcedureTypeFieldValuesAttachments:Oc,updateAssetProcedureTypeFieldValuesAttachment:Pc,updateAssetProcedureTypeFieldValuesAttachments:Fc,deleteAssetProcedureTypeFieldValuesAttachment:gc,deleteAssetProcedureTypeFieldValuesAttachments:ds}=as.actions,bc=as.reducer,_c=t=>t.assetProcedureTypeFieldValuesAttachmentReducer.instances,rs=o.createSelector([_c],t=>Object.values(t)),Mc=t=>s=>s.assetProcedureTypeFieldValuesAttachmentReducer.instances[t],Rc=S(o.createSelector([rs,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),wc=S(o.createSelector([rs,(t,s)=>s],(t,s)=>T(t.filter(e=>e.field_values===s)))),Z=R(({uuid:t})=>t),Ec={instances:{}},us=o.createSlice({name:"assetProcedureTypeFieldValues",initialState:Ec,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,Ec)),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:vc,addAssetProcedureTypeFieldValues:Vc,addAssetProcedureTypeFieldValuesMany:zc,setAssetProcedureTypeFieldValues:Bc,setAssetProcedureTypeFieldValuesMany:jc,updateAssetProcedureTypeFieldValues:qc,updateAssetProcedureTypeFieldValuesMany:Dc,deleteAssetProcedureTypeFieldValues:Cc,deleteAssetProcedureTypeFieldValuesMany:$c}=us.actions,Uc=us.reducer,Lc=t=>t.assetProcedureTypeFieldValuesReducer.instances,St=o.createSelector([Lc],t=>Object.values(t)),TP=S(o.createSelector([St,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset===s)))),IP=S(o.createSelector([St,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_procedure===s)))),kc=t=>s=>s.assetProcedureTypeFieldValuesReducer.instances[t],Nc=S(o.createSelector([St,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),J=R(({uuid:t})=>t),Gc={instances:{}},ls=o.createSlice({name:"assetProcedures",initialState:Gc,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,Gc)),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:Hc,addAssetProcedure:Wc,addAssetProcedures:os,updateAssetProcedure:Kc,updateAssetProcedures:Yc,deleteAssetProcedure:Zc,deleteAssetProcedures:hs,setAssetProcedure:Jc,setAssetProcedures:Xc}=ls.actions,Qc=ls.reducer,xc=t=>t.assetProcedureReducer.instances,Tt=o.createSelector([xc],t=>Object.values(t)),ed=S(o.createSelector([Tt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_procedure_type===s)))),OP=S(o.createSelector([Tt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_type===s)))),td=t=>s=>s.assetProcedureReducer.instances[t],sd=S(o.createSelector([Tt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),X=R(t=>t.uuid),id={instances:{}},ms=o.createSlice({name:"assetProcedureTypes",initialState:id,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,id)),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:nd,addAssetProcedureType:ad,addAssetProcedureTypes:cd,updateAssetProcedureType:dd,updateAssetProcedureTypes:rd,deleteAssetProcedureType:ud,deleteAssetProcedureTypes:ld,setAssetProcedureType:od,setAssetProcedureTypes:hd}=ms.actions,md=ms.reducer,yd=t=>t.assetProcedureTypeReducer.instances,ys=o.createSelector([yd],t=>Object.values(t)),pd=t=>s=>s.assetProcedureTypeReducer.instances[t],Ad=S(o.createSelector([ys,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),PP=S(o.createSelector([ys,(t,s)=>s],(t,s)=>T(t.filter(e=>e.organization===s)))),Q=R(t=>t.uuid),fd={instances:{}},ps=o.createSlice({name:"assetProcedureStepFieldsAttachments",initialState:fd,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,fd)),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:Sd,addAssetProcedureStepFieldsAttachment:Td,addAssetProcedureStepFieldsAttachments:Id,setAssetProcedureStepFieldsAttachment:Od,setAssetProcedureStepFieldsAttachments:Pd,updateAssetProcedureStepFieldsAttachment:Fd,updateAssetProcedureStepFieldsAttachments:gd,deleteAssetProcedureStepFieldsAttachment:bd,deleteAssetProcedureStepFieldsAttachments:_d}=ps.actions,Md=t=>t.assetProcedureStepFieldsAttachmentReducer.instances,As=o.createSelector([Md],t=>Object.values(t)),FP=S(o.createSelector([As,(t,s)=>s],(t,s)=>T(t.filter(e=>e.fields_revision===s)))),Rd=t=>s=>s.assetProcedureStepFieldsAttachmentReducer.instances[t],wd=S(o.createSelector([As,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),Ed=ps.reducer,x=R(t=>t.uuid),vd={instances:{}},fs=o.createSlice({name:"assetProcedureStepFields",initialState:vd,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,vd)),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:zd,addAssetProcedureStepFieldsMany:Bd,setAssetProcedureStepFields:jd,setAssetProcedureStepFieldsMany:qd,updateAssetProcedureStepFields:Dd,updateAssetProcedureStepFieldsMany:Cd,deleteAssetProcedureStepFields:$d,deleteAssetProcedureStepFieldsMany:Ud}=fs.actions,Ss=t=>t.assetProcedureStepFieldsReducer.instances,It=o.createSelector([Ss],t=>Object.values(t)),gP=S(o.createSelector([It,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_procedure_step===s)))),bP=S(o.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])),_P=o.createSelector([Ss],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}),Ld=t=>s=>s.assetProcedureStepFieldsReducer.instances[t],kd=S(o.createSelector([It,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),Nd=fs.reducer,ee=R(t=>t.uuid),Gd={instances:{}},Ts=o.createSlice({name:"assetProcedureStepFieldValuesAttachments",initialState:Gd,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,Gd)),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:Hd,addAssetProcedureStepFieldValuesAttachment:Wd,addAssetProcedureStepFieldValuesAttachments:Is,setAssetProcedureStepFieldValuesAttachment:Kd,setAssetProcedureStepFieldValuesAttachments:Yd,updateAssetProcedureStepFieldValuesAttachment:Zd,updateAssetProcedureStepFieldValuesAttachments:Jd,deleteAssetProcedureStepFieldValuesAttachment:Xd,deleteAssetProcedureStepFieldValuesAttachments:Os}=Ts.actions,Qd=t=>t.assetProcedureStepFieldValuesAttachmentReducer.instances,Ps=o.createSelector([Qd],t=>Object.values(t)),xd=t=>s=>s.assetProcedureStepFieldValuesAttachmentReducer.instances[t],er=S(o.createSelector([Ps,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),tr=S(o.createSelector([Ps,(t,s)=>s],(t,s)=>T(t.filter(e=>e.field_values===s)))),sr=Ts.reducer,te=R(t=>t.uuid),ir={instances:{}},Fs=o.createSlice({name:"assetProcedureStepFieldValues",initialState:ir,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,ir)),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:nr,addAssetProcedureStepFieldValues:ar,addAssetProcedureStepFieldValuesMany:cr,setAssetProcedureStepFieldValues:dr,setAssetProcedureStepFieldValuesMany:rr,updateAssetProcedureStepFieldValues:ur,updateAssetProcedureStepFieldValuesMany:lr,deleteAssetProcedureStepFieldValues:or,deleteAssetProcedureStepFieldValuesMany:hr}=Fs.actions,mr=t=>t.assetProcedureStepFieldValuesReducer.instances,ut=o.createSelector([mr],t=>Object.values(t)),MP=S(o.createSelector([ut,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset===s)))),RP=S(o.createSelector([ut,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_procedure===s)))),wP=S(o.createSelector([ut,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_procedure_step===s)))),yr=t=>s=>s.assetProcedureStepFieldValuesReducer.instances[t],pr=S(o.createSelector([ut,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),Ar=Fs.reducer,se=R(t=>t.uuid),fr={instances:{}},gs=o.createSlice({name:"assetProcedureSteps",initialState:fr,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,fr)),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:Sr,setAssetProcedureStep:Tr,setAssetProcedureSteps:Ir,addAssetProcedureStep:Or,addAssetProcedureSteps:Pr,updateAssetProcedureStep:Fr,updateAssetProcedureSteps:gr,deleteAssetProcedureStep:br,deleteAssetProcedureSteps:_r}=gs.actions,Mr=gs.reducer,Ot=t=>t.assetProcedureStepReducer.instances,Rr=t=>s=>s.assetProcedureStepReducer.instances[t],bs=o.createSelector([Ot],t=>Object.values(t)),EP=S(o.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=S(o.createSelector([bs,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_procedure_type===s)))),wr=S(o.createSelector([bs,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),Er=S(o.createSelector([Ot,(t,s)=>s],(t,s)=>{if(!t[s])return T([]);const a=aa(s,Object.values(t)).all().map(({model:c})=>c);return T(a)})),ie=R(t=>t.uuid),vr={instances:{}},_s=o.createSlice({name:"assets",initialState:vr,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,vr)),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:zr,addAssets:Ms,updateAsset:Br,updateAssets:jr,deleteAsset:qr,deleteAssets:Rs,setAsset:Dr,setAssets:Cr}=_s.actions,$r=t=>t.assetReducer.instances,ws=o.createSelector([$r],t=>T(Object.values(t))),Es=S(o.createSelector([ws,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_type===s)))),Ur=t=>s=>s.assetReducer.instances[t],Lr=S(o.createSelector([ws,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),VP=t=>s=>Es(t)(s).length,kr=_s.reducer,ne=R(t=>t.uuid),Nr={instances:{}},vs=o.createSlice({name:"assetStageCompletions",initialState:Nr,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,Nr)),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:Gr,addAssetStageCompletion:Hr,addAssetStageCompletions:Wr,setAssetStageCompletion:Kr,setAssetStageCompletions:Yr,updateAssetStageCompletion:Zr,updateAssetStageCompletions:Jr,deleteAssetStageCompletion:Xr,deleteAssetStageCompletions:Qr}=vs.actions,xr=vs.reducer,eu=t=>t.assetStageCompletionReducer.instances,tu=o.createSelector([eu],t=>Object.values(t)),su=t=>s=>s.assetStageCompletionReducer.instances[t],iu=S(o.createSelector([tu,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),ae=R(t=>t.uuid),nu={instances:{}},Vs=o.createSlice({name:"assetStages",initialState:nu,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,nu)),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:au,setAssetStage:cu,setAssetStages:du,addAssetStage:ru,addAssetStages:uu,updateAssetStage:lu,updateAssetStages:ou,deleteAssetStage:hu,deleteAssetStages:mu}=Vs.actions,yu=Vs.reducer,zs=t=>t.assetStageReducer.instances,pu=t=>s=>s.assetStageReducer.instances[t],Bs=o.createSelector([zs],t=>Object.values(t)),zP=S(o.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)})),BP=S(o.createSelector([Bs,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_procedure_type===s)))),Au=S(o.createSelector([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),fu={instances:{}},js=o.createSlice({name:"assetTypeAttachments",initialState:fu,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,fu)),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:Su,addAssetTypeAttachment:Tu,addAssetTypeAttachments:qs,setAssetTypeAttachment:Iu,setAssetTypeAttachments:Ou,updateAssetTypeAttachment:Pu,updateAssetTypeAttachments:Fu,deleteAssetTypeAttachment:gu,deleteAssetTypeAttachments:Ds}=js.actions,bu=t=>t.assetTypeAttachmentReducer.instances,Cs=o.createSelector([bu],t=>Object.values(t)),_u=t=>s=>s.assetTypeAttachmentReducer.instances[t],Mu=S(o.createSelector([Cs,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),Ru=S(o.createSelector([Cs,(t,s)=>s],(t,s)=>T(t.filter(({asset_type:e})=>s===e)))),wu=js.reducer,de=R(t=>t.uuid),Eu={instances:{}},$s=o.createSlice({name:"assetTypeFieldsAttachments",initialState:Eu,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,Eu)),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:vu,addAssetTypeFieldsAttachment:Vu,addAssetTypeFieldsAttachments:zu,setAssetTypeFieldsAttachment:Bu,setAssetTypeFieldsAttachments:ju,updateAssetTypeFieldsAttachment:qu,updateAssetTypeFieldsAttachments:Du,deleteAssetTypeFieldsAttachment:Cu,deleteAssetTypeFieldsAttachments:$u}=$s.actions,Uu=t=>t.assetTypeFieldsAttachmentReducer.instances,Us=o.createSelector([Uu],t=>Object.values(t)),jP=S(o.createSelector([Us,(t,s)=>s],(t,s)=>T(t.filter(e=>e.fields_revision===s)))),Lu=t=>s=>s.assetTypeFieldsAttachmentReducer.instances[t],ku=S(o.createSelector([Us,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),Nu=$s.reducer,re=R(t=>t.uuid),Gu={instances:{}},Ls=o.createSlice({name:"assetTypeFields",initialState:Gu,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,Gu)),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:Hu,addAssetTypeFields:Wu,addAssetTypeFieldsMany:Ku,setAssetTypeFields:Yu,setAssetTypeFieldsMany:Zu,updateAssetTypeFields:Ju,updateAssetTypeFieldsMany:Xu,deleteAssetTypeFields:Qu,deleteAssetTypeFieldsMany:xu}=Ls.actions,el=t=>t.assetTypeFieldsReducer.instances,lt=o.createSelector([el],t=>Object.values(t)),qP=S(o.createSelector([lt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_type===s)))),DP=S(o.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])),tl=t=>s=>s.assetTypeFieldsReducer.instances[t],sl=S(o.createSelector([lt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),il=Ls.reducer,ue=R(t=>t.uuid),nl={instances:{}},ks=o.createSlice({name:"assetTypeFieldValuesAttachments",initialState:nl,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,nl)),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:al,addAssetTypeFieldValuesAttachment:cl,addAssetTypeFieldValuesAttachments:Ns,setAssetTypeFieldValuesAttachment:dl,setAssetTypeFieldValuesAttachments:rl,updateAssetTypeFieldValuesAttachment:ul,updateAssetTypeFieldValuesAttachments:ll,deleteAssetTypeFieldValuesAttachment:ol,deleteAssetTypeFieldValuesAttachments:Gs}=ks.actions,hl=t=>t.assetTypeFieldValuesAttachmentReducer.instances,Hs=o.createSelector([hl],t=>Object.values(t)),ml=t=>s=>s.assetTypeFieldValuesAttachmentReducer.instances[t],yl=S(o.createSelector([Hs,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),pl=S(o.createSelector([Hs,(t,s)=>s],(t,s)=>T(t.filter(e=>e.field_values===s)))),Al=ks.reducer,le=R(t=>t.uuid),fl={instances:{}},Ws=o.createSlice({name:"assetTypeFieldValues",initialState:fl,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,fl)),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:Sl,addAssetTypeFieldValues:Tl,addAssetTypeFieldValuesMany:Il,setAssetTypeFieldValues:Ol,setAssetTypeFieldValuesMany:Pl,updateAssetTypeFieldValues:Fl,updateAssetTypeFieldValuesMany:gl,deleteAssetTypeFieldValues:bl,deleteAssetTypeFieldValuesMany:_l}=Ws.actions,Ml=t=>t.assetTypeFieldValuesReducer.instances,Pt=o.createSelector([Ml],t=>Object.values(t)),CP=S(o.createSelector([Pt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset===s)))),$P=S(o.createSelector([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)))})),Rl=t=>s=>s.assetTypeFieldValuesReducer.instances[t],wl=S(o.createSelector([Pt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),El=Ws.reducer,oe=R(t=>t.uuid),vl={instances:{}},Ks=o.createSlice({name:"assetTypeIdentifiers",initialState:vl,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,vl)),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:zl,addAssetTypeIdentifiers:Bl,setAssetTypeIdentifier:jl,setAssetTypeIdentifiers:ql,updateAssetTypeIdentifier:Dl,updateAssetTypeIdentifiers:Cl,deleteAssetTypeIdentifier:$l,deleteAssetTypeIdentifiers:Ul}=Ks.actions,Ll=t=>t.assetTypeIdentifierReducer.instances,Ys=o.createSelector([Ll],t=>Object.values(t)),kl=t=>s=>s.assetTypeIdentifierReducer.instances[t],Nl=S(o.createSelector([Ys,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),UP=S(o.createSelector([Ys,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_type===s)))),Gl=Ks.reducer,he=R(t=>t.uuid),Hl={instances:{}},Zs=o.createSlice({name:"assetTypeIdentifierValues",initialState:Hl,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,Hl)),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:Wl,addAssetTypeIdentifierValue:Kl,addAssetTypeIdentifierValues:Yl,setAssetTypeIdentifierValue:Zl,setAssetTypeIdentifierValues:Jl,updateAssetTypeIdentifierValue:Xl,updateAssetTypeIdentifierValues:Ql,deleteAssetTypeIdentifierValue:xl,deleteAssetTypeIdentifierValues:eo}=Zs.actions,to=t=>t.assetTypeIdentifierValueReducer.instances,Ft=o.createSelector([to],t=>Object.values(t)),so=t=>s=>s.assetTypeIdentifierValueReducer.instances[t],io=S(o.createSelector([Ft,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),LP=S(o.createSelector([Ft,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset===s)))),kP=S(o.createSelector([Ft,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_type_identifier===s)))),no=Zs.reducer,me=R(t=>t.uuid),ao={instances:{}},Js=o.createSlice({name:"assetTypes",initialState:ao,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,ao)),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:co,setAssetType:ro,setAssetTypes:uo,addAssetType:lo,addAssetTypes:oo,updateAssetType:ho,updateAssetTypes:mo,deleteAssetType:yo,deleteAssetTypes:po}=Js.actions,Ao=t=>t.assetTypeReducer.instances,Xs=o.createSelector([Ao],t=>Object.values(t)),fo=t=>s=>s.assetTypeReducer.instances[t],So=S(o.createSelector([Xs,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),NP=S(o.createSelector([Xs,(t,s)=>s],(t,s)=>T(t.filter(e=>e.organization===s)))),To=Js.reducer,ye=R(t=>t.uuid),Io={instances:{}},Qs=o.createSlice({name:"assetTypeStatuses",initialState:Io,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,Io)),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:Oo,addAssetTypeStatus:Po,addAssetTypeStatuses:Fo,setAssetTypeStatus:go,setAssetTypeStatuses:bo,updateAssetTypeStatus:_o,updateAssetTypeStatuses:Mo,deleteAssetTypeStatus:Ro,deleteAssetTypeStatuses:wo}=Qs.actions,Eo=t=>t.assetTypeStatusReducer.instances,xs=o.createSelector([Eo],t=>T(Object.values(t).toSorted(ca))),vo=t=>s=>s.assetTypeStatusReducer.instances[t],Vo=S(o.createSelector([xs,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),GP=S(o.createSelector([xs,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_type===s)))),zo=Qs.reducer,Bo={accessToken:"",refreshToken:"",isLoggedIn:!1},gt=o.createSlice({name:"auth",initialState:Bo,extraReducers:t=>t.addCase(_,s=>Object.assign(s,Bo)),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:HP,clearTokens:WP,setLoggedIn:jo}=gt.actions,KP=t=>t.authReducer.accessToken,YP=t=>t.authReducer.isLoggedIn,qo=gt.reducer,pe=R(t=>t.uuid),Do={instances:{}},ei=o.createSlice({name:"categories",initialState:Do,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,Do)),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:Co,addCategory:$o,addCategories:Uo,setCategory:Lo,setCategories:ko,updateCategory:No,updateCategories:Go,deleteCategory:Ho,deleteCategories:Wo}=ei.actions,Ko=t=>t.categoryReducer.instances,ti=o.createSelector([Ko],t=>Object.values(t)),si=t=>s=>s.categoryReducer.instances[t],Yo=S(o.createSelector([ti,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),ZP=S(o.createSelector([ti,(t,s)=>s],(t,s)=>T(t.filter(e=>e.project===s)))),Zo=ei.reducer,Ae=R(t=>t.uuid),Jo={instances:{}},ii=o.createSlice({name:"documentAttachments",initialState:Jo,extraReducers:t=>t.addCase(_,s=>Object.assign(s,Jo)),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:Xo,addDocumentAttachment:Qo,addDocumentAttachments:xo,setDocumentAttachment:eh,setDocumentAttachments:th,updateDocumentAttachment:sh,updateDocumentAttachments:ih,deleteDocumentAttachment:nh,deleteDocumentAttachments:ah}=ii.actions,ch=t=>t.documentAttachmentReducer.instances,ni=o.createSelector([ch],t=>Object.values(t)),dh=t=>s=>s.documentAttachmentReducer.instances[t],rh=S(o.createSelector([ni,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),JP=S(o.createSelector([ni,(t,s)=>s],(t,s)=>T(t.filter(({document:e})=>s===e)))),uh=ii.reducer,fe=R(({uuid:t})=>t),lh={instances:{}},ai=o.createSlice({name:"documents",initialState:lh,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>{Object.assign(s,lh)}),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:oh,addDocument:hh,addDocuments:mh,setDocument:yh,setDocuments:ph,updateDocument:Ah,updateDocuments:fh,deleteDocument:Sh,deleteDocuments:Th}=ai.actions,Ih=ai.reducer,ci=t=>t.documentsReducer.instances,bt=o.createSelector([ci],t=>Object.values(t)),Oh=t=>s=>s.documentsReducer.instances[t],Ph=S(o.createSelector([bt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),XP=S(o.createSelector([bt,(t,s)=>s],(t,s)=>t.filter(e=>e.project===s))),QP=S(o.createSelector([bt,(t,s)=>s],(t,s)=>t.filter(e=>e.organization===s))),Fh=S(o.createSelector([ci,(t,s)=>s],(t,s)=>{if(!t[s])return T([]);const a=ua(s,Object.values(t)).all().map(({model:c})=>c);return T(a)})),Se=R(t=>t.uuid),gh={instances:{}},di=o.createSlice({name:"emailDomains",initialState:gh,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,gh)),reducers:{initializeEmailDomains:Se.initialize,addEmailDomain:Se.addOne,addEmailDomains:Se.addMany,setEmailDomain:Se.setOne,setEmailDomains:Se.setMany,updateEmailDomain:Se.updateOne,updateEmailDomains:Se.updateMany,deleteEmailDomain:Se.deleteOne,deleteEmailDomains:Se.deleteMany}}),{initializeEmailDomains:bh,addEmailDomain:_h,addEmailDomains:Mh,setEmailDomain:Rh,setEmailDomains:wh,updateEmailDomain:Eh,updateEmailDomains:vh,deleteEmailDomain:Vh,deleteEmailDomains:zh}=di.actions,Bh=t=>t.emailDomainsReducer.instances,ri=o.createSelector([Bh],t=>Object.values(t)),jh=t=>s=>s.emailDomainsReducer.instances[t],qh=S(o.createSelector([ri,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),xP=S(o.createSelector([ri,(t,s)=>s],(t,s)=>T(t.filter(e=>e.organization===s)))),Dh=di.reducer,Ch={s3Urls:{}},$h=1e3*60*60,eF=$h*24*7,ui=o.createSlice({name:"file",initialState:Ch,extraReducers:t=>t.addCase(_,s=>Object.assign(s,Ch)),reducers:{setUploadUrl:(t,s)=>{const{url:e,fields:n,sha1:a}=s.payload,c=new Date,r=new Date(c.getTime()+eF);t.s3Urls[a]={url:e,fields:n,exp:r.getTime()}}}}),{setUploadUrl:Uh}=ui.actions,Lh=t=>s=>{const e=s.fileReducer.s3Urls[t];if(!e)return;const n=new Date().getTime();if(!((e.exp??n)-n<$h))return e},kh=ui.reducer,Te=R(t=>t.uuid),Nh={instances:{}},li=o.createSlice({name:"formIdentifiers",initialState:Nh,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,Nh)),reducers:{initializeFormIdentifiers:Te.initialize,addFormIdentifier:Te.addOne,addFormIdentifiers:Te.addMany,setFormIdentifier:Te.setOne,setFormIdentifiers:Te.setMany,updateFormIdentifier:Te.updateOne,updateFormIdentifiers:Te.updateMany,deleteFormIdentifier:Te.deleteOne,deleteFormIdentifiers:Te.deleteMany}}),{initializeFormIdentifiers:Gh,addFormIdentifier:Hh,addFormIdentifiers:Wh,setFormIdentifier:Kh,setFormIdentifiers:Yh,updateFormIdentifier:Zh,updateFormIdentifiers:Jh,deleteFormIdentifier:Xh,deleteFormIdentifiers:Qh}=li.actions,xh=t=>t.formIdentifierReducer.instances,oi=o.createSelector([xh],t=>Object.values(t)),em=t=>s=>s.formIdentifierReducer.instances[t],tm=S(o.createSelector([oi,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),tF=S(o.createSelector([oi,(t,s)=>s],(t,s)=>T(t.filter(e=>e.form===s)))),sm=li.reducer,Ie=R(t=>t.uuid),im={instances:{}},hi=o.createSlice({name:"formIdentifierValues",initialState:im,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,im)),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:nm,addFormIdentifierValue:am,addFormIdentifierValues:cm,setFormIdentifierValue:dm,setFormIdentifierValues:rm,updateFormIdentifierValue:um,updateFormIdentifierValues:lm,deleteFormIdentifierValue:om,deleteFormIdentifierValues:hm}=hi.actions,mm=t=>t.formIdentifierValueReducer.instances,_t=o.createSelector([mm],t=>Object.values(t)),ym=t=>s=>s.formIdentifierValueReducer.instances[t],pm=S(o.createSelector([_t,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),sF=S(o.createSelector([_t,(t,s)=>s],(t,s)=>T(t.filter(e=>e.form_submission===s)))),iF=S(o.createSelector([_t,(t,s)=>s],(t,s)=>T(t.filter(e=>e.form_identifier===s)))),Am=hi.reducer,Oe=R(t=>t.uuid),fm={instances:{}},mi=o.createSlice({name:"formRevisionAttachments",initialState:fm,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,fm)),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:Sm,addFormRevisionAttachment:Tm,addFormRevisionAttachments:Im,setFormRevisionAttachment:Om,setFormRevisionAttachments:Pm,updateFormRevisionAttachment:Fm,updateFormRevisionAttachments:gm,deleteFormRevisionAttachment:bm,deleteFormRevisionAttachments:_m}=mi.actions,Mt=t=>t.formRevisionAttachmentReducer.instances,Mm=o.createSelector([Mt],t=>Object.values(t)),Rm=S(o.createSelector([Mt,(t,s)=>s],(t,s)=>t[s])),wm=S(o.createSelector([Mm,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),nF=S(o.createSelector([Mt,(t,s)=>s],(t,s)=>T(Object.values(t).filter(e=>e.form_revision===s)))),Em=mi.reducer,Pe=R(t=>t.uuid),vm={instances:{}},yi=o.createSlice({name:"formRevisions",initialState:vm,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,vm)),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:zm,setFormRevisions:Bm,updateFormRevision:jm,updateFormRevisions:qm,deleteFormRevision:fi,deleteFormRevisions:Si}=yi.actions,Ti=t=>t.formRevisionReducer.instances,Rt=o.createSelector([Ti],t=>Object.values(t)),Dm=t=>s=>s.formRevisionReducer.instances[t],Cm=S(o.createSelector([Rt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),aF=S(o.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])),$m=S(o.createSelector([Rt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.form===s)))),Um=yi.reducer,Fe=R(t=>t.uuid),Lm={instances:{}},Ii=o.createSlice({name:"forms",initialState:Lm,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,Lm)),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:Nm,addForms:Gm,setForm:Hm,setForms:Wm,updateForm:Km,updateForms:Ym,deleteForm:Zm,deleteForms:Jm}=Ii.actions,Xm=Ii.reducer,Qm=t=>t.formReducer.instances,Oi=o.createSelector([Qm],t=>Object.values(t)),xm=t=>s=>s.formReducer.instances[t],ey=S(o.createSelector([Oi,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),cF=S(o.createSelector([Oi,(t,s)=>s],(t,s)=>T(t.filter(e=>e.organization===s)))),ge=R(t=>t.uuid),ty={instances:{}},Pi=o.createSlice({name:"formSubmissionAttachments",initialState:ty,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,ty)),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:sy,addFormSubmissionAttachment:iy,addFormSubmissionAttachments:Fi,setFormSubmissionAttachment:ny,setFormSubmissionAttachments:ay,updateFormSubmissionAttachment:cy,updateFormSubmissionAttachments:dy,deleteFormSubmissionAttachment:ry,deleteFormSubmissionAttachments:gi}=Pi.actions,bi=t=>t.formSubmissionAttachmentReducer.instances,_i=o.createSelector([bi],t=>Object.values(t)),uy=S(o.createSelector([bi,(t,s)=>s],(t,s)=>t[s])),Mi=S(o.createSelector([_i,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(n=>e.has(n.uuid)))})),ly=Mi,oy=S(o.createSelector([_i,(t,s)=>s],(t,s)=>T(t.filter(e=>e.form_submission===s)))),hy=Pi.reducer,be=R(t=>t.uuid),my={instances:{}},Ri=o.createSlice({name:"formSubmissions",initialState:my,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,my)),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:yy,setFormSubmission:py,setFormSubmissions:Ay,addFormSubmission:fy,addFormSubmissions:wi,updateFormSubmission:Sy,updateFormSubmissions:Ty,deleteFormSubmission:Iy,deleteFormSubmissions:Ei}=Ri.actions,vi=t=>t.formSubmissionReducer.instances,Oy=o.createSelector([vi],t=>Object.values(t)),Py=t=>s=>s.formSubmissionReducer.instances[t],Fy=S(o.createSelector([Oy,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),gy=S(o.createSelector([vi,Ti,(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))})),by=Ri.reducer,_e=R(t=>t.uuid),_y={instances:{}},Vi=o.createSlice({name:"geoImages",initialState:_y,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,_y)),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:My,setGeoImage:Ry,setGeoImages:wy,addGeoImage:Ey,addGeoImages:vy,updateGeoImage:Vy,updateGeoImages:zy,deleteGeoImage:By,deleteGeoImages:jy}=Vi.actions,qy=t=>t.geoImageReducer.instances,zi=o.createSelector([qy],t=>Object.values(t)),Dy=t=>s=>s.geoImageReducer.instances[t],Cy=S(o.createSelector([zi,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),dF=S(o.createSelector([zi,(t,s)=>s],(t,s)=>T(t.filter(e=>e.project===s)))),$y=Vi.reducer,Me=R(t=>t.uuid),Uy={instances:{}},Bi=o.createSlice({name:"issueAssociations",initialState:Uy,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,Uy)),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:Ly,setIssueAssociations:ky,setIssueAssociation:Ny,updateIssueAssociation:Gy,updateIssueAssociations:Hy,addIssueAssociation:Wy,addIssueAssociations:wt,deleteIssueAssociation:Ky,deleteIssueAssociations:Et}=Bi.actions,ot=t=>t.issueAssociationReducer.instances,Yy=o.createSelector([ot],t=>Object.values(t)),Zy=t=>s=>s.issueAssociationReducer.instances[t],Jy=S(o.createSelector([Yy,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),Xy=S(o.createSelector([ot,(t,s)=>s],(t,s)=>T(Object.values(t).filter(e=>e.associated_issue===s)))),Qy=S(o.createSelector([ot,(t,s)=>s],(t,s)=>T(Object.values(t).filter(e=>e.issue===s)))),xy=S(o.createSelector([ot,(t,s)=>s],(t,s)=>T(Object.values(t).filter(e=>e.asset===s)))),ep=Bi.reducer,Re=R(t=>t.uuid),tp={instances:{}},ji=o.createSlice({name:"issueAttachments",initialState:tp,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,tp)),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:sp,addIssueAttachment:ip,addIssueAttachments:qi,setIssueAttachment:np,setIssueAttachments:ap,updateIssueAttachment:cp,updateIssueAttachments:dp,deleteIssueAttachment:rp,deleteIssueAttachments:Di}=ji.actions,up=t=>t.issueAttachmentReducer.instances,Ci=o.createSelector([up],t=>Object.values(t)),lp=S(o.createSelector([Ci,(t,s)=>s],(t,s)=>T(t.filter(({issue:e})=>s===e)))),op=t=>s=>s.issueAttachmentReducer.instances[t],hp=S(o.createSelector([Ci,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),mp=ji.reducer,we=R(t=>t.uuid),yp={instances:{}},$i=o.createSlice({name:"issueCommentAttachments",initialState:yp,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,yp)),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:pp,addIssueCommentAttachment:Ap,addIssueCommentAttachments:fp,setIssueCommentAttachment:Sp,setIssueCommentAttachments:Tp,updateIssueCommentAttachment:Ip,updateIssueCommentAttachments:Op,deleteIssueCommentAttachment:Pp,deleteIssueCommentAttachments:Fp}=$i.actions,gp=t=>t.issueCommentAttachmentReducer.instances,Ui=o.createSelector([gp],t=>Object.values(t)),bp=t=>s=>s.issueCommentAttachmentReducer.instances[t],_p=S(o.createSelector([Ui,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),rF=S(o.createSelector([Ui,(t,s)=>s],(t,s)=>T(t.filter(({issue_comment:e})=>s===e)))),Mp=$i.reducer,Ee=R(t=>t.uuid),Rp={instances:{}},Li=o.createSlice({name:"issueComments",initialState:Rp,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,Rp)),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:wp,addIssueComment:Ep,addIssueComments:vp,setIssueComment:Vp,setIssueComments:zp,updateIssueComment:Bp,updateIssueComments:jp,deleteIssueComment:qp,deleteIssueComments:Dp}=Li.actions,ki=t=>t.issueCommentReducer.instances,Cp=t=>s=>s.issueCommentReducer.instances[t],$p=S(o.createSelector([ki,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(Object.values(t).filter(({uuid:n})=>e.has(n)))})),uF=S(o.createSelector([ki,(t,s)=>s],(t,s)=>T(Object.values(t).filter(e=>e.issue===s)))),Up=Li.reducer,ve=R(t=>t.uuid),Lp={instances:{}},Ni=o.createSlice({name:"issues",initialState:Lp,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,Lp)),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:Np,addIssues:Gi,setIssue:Gp,setIssues:Hp,updateIssue:Wp,updateIssues:Kp,deleteIssue:Yp,deleteIssues:Hi}=Ni.actions,Zp=t=>t.issueReducer.instances,vt=o.createSelector([Zp],t=>Object.values(t)),Jp=t=>s=>s.issueReducer.instances[t],Xp=S(o.createSelector([vt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),lF=S(o.createSelector([vt,(t,s)=>s],(t,s)=>t.filter(e=>e.project===s))),Qp=S(o.createSelector([vt,(t,s)=>s],(t,s)=>t.filter(e=>e.issue_type===s))),xp=Ni.reducer,Ve=R(t=>t.uuid),eA={instances:{}},Wi=o.createSlice({name:"issueTypeAttachments",initialState:eA,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,eA)),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:tA,addIssueTypeAttachment:sA,addIssueTypeAttachments:iA,setIssueTypeAttachment:nA,setIssueTypeAttachments:aA,updateIssueTypeAttachment:cA,updateIssueTypeAttachments:dA,deleteIssueTypeAttachment:rA,deleteIssueTypeAttachments:uA}=Wi.actions,lA=t=>t.issueTypeAttachmentReducer.instances,Ki=o.createSelector([lA],t=>Object.values(t)),oA=t=>s=>s.issueTypeAttachmentReducer.instances[t],hA=S(o.createSelector([Ki,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),oF=S(o.createSelector([Ki,(t,s)=>s],(t,s)=>T(t.filter(({issue_type:e})=>s===e)))),mA=Wi.reducer,ze=R(t=>t.uuid),yA={instances:{}},Yi=o.createSlice({name:"issueTypeFieldsAttachments",initialState:yA,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,yA)),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:pA,addIssueTypeFieldsAttachment:AA,addIssueTypeFieldsAttachments:fA,setIssueTypeFieldsAttachment:SA,setIssueTypeFieldsAttachments:TA,updateIssueTypeFieldsAttachment:IA,updateIssueTypeFieldsAttachments:OA,deleteIssueTypeFieldsAttachment:PA,deleteIssueTypeFieldsAttachments:FA}=Yi.actions,gA=t=>t.issueTypeFieldsAttachmentReducer.instances,Zi=o.createSelector([gA],t=>Object.values(t)),hF=S(o.createSelector([Zi,(t,s)=>s],(t,s)=>T(t.filter(e=>e.fields_revision===s)))),bA=t=>s=>s.issueTypeFieldsAttachmentReducer.instances[t],_A=S(o.createSelector([Zi,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),MA=Yi.reducer,Be=R(t=>t.uuid),RA={instances:{}},Ji=o.createSlice({name:"issueTypeFieldValues",initialState:RA,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,RA)),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:wA,addIssueTypeFieldValues:EA,addIssueTypeFieldValuesMany:vA,setIssueTypeFieldValues:VA,setIssueTypeFieldValuesMany:zA,updateIssueTypeFieldValues:BA,updateIssueTypeFieldValuesMany:jA,deleteIssueTypeFieldValues:qA,deleteIssueTypeFieldValuesMany:DA}=Ji.actions,CA=t=>t.issueTypeFieldValuesReducer.instances,Vt=o.createSelector([CA],t=>Object.values(t)),mF=S(o.createSelector([Vt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.issue===s)))),$A=t=>s=>s.issueTypeFieldValuesReducer.instances[t],UA=S(o.createSelector([Vt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),LA=Ji.reducer,je=R(t=>t.uuid),kA={instances:{}},Xi=o.createSlice({name:"issueTypeFields",initialState:kA,extraReducers:t=>t.addMatcher(o.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:NA,addIssueTypeFields:GA,addIssueTypeFieldsMany:HA,setIssueTypeFields:WA,setIssueTypeFieldsMany:KA,updateIssueTypeFields:YA,updateIssueTypeFieldsMany:ZA,deleteIssueTypeFields:JA,deleteIssueTypeFieldsMany:XA}=Xi.actions,QA=t=>t.issueTypeFieldsReducer.instances,ht=o.createSelector([QA],t=>Object.values(t)),yF=S(o.createSelector([ht,(t,s)=>s],(t,s)=>T(t.filter(e=>e.issue_type===s)))),pF=S(o.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])),AF=S(o.createSelector([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)))})),xA=t=>s=>s.issueTypeFieldsReducer.instances[t],ef=S(o.createSelector([ht,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),tf=Xi.reducer,qe=R(t=>t.uuid),sf={instances:{}},Qi=o.createSlice({name:"issueTypeFieldValuesAttachments",initialState:sf,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,sf)),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:nf,addIssueTypeFieldValuesAttachment:af,addIssueTypeFieldValuesAttachments:xi,setIssueTypeFieldValuesAttachment:cf,setIssueTypeFieldValuesAttachments:df,updateIssueTypeFieldValuesAttachment:rf,updateIssueTypeFieldValuesAttachments:uf,deleteIssueTypeFieldValuesAttachment:lf,deleteIssueTypeFieldValuesAttachments:en}=Qi.actions,of=t=>t.issueTypeFieldValuesAttachmentReducer.instances,tn=o.createSelector([of],t=>Object.values(t)),hf=t=>s=>s.issueTypeFieldValuesAttachmentReducer.instances[t],mf=S(o.createSelector([tn,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),yf=S(o.createSelector([tn,(t,s)=>s],(t,s)=>T(t.filter(e=>e.field_values===s)))),pf=Qi.reducer,De=R(t=>t.uuid),Af={instances:{}},sn=o.createSlice({name:"issueTypeIdentifiers",initialState:Af,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,Af)),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:ff,addIssueTypeIdentifier:Sf,addIssueTypeIdentifiers:Tf,setIssueTypeIdentifier:If,setIssueTypeIdentifiers:Of,updateIssueTypeIdentifier:Pf,updateIssueTypeIdentifiers:Ff,deleteIssueTypeIdentifier:gf,deleteIssueTypeIdentifiers:bf}=sn.actions,_f=t=>t.issueTypeIdentifierReducer.instances,nn=o.createSelector([_f],t=>Object.values(t)),Mf=t=>s=>s.issueTypeIdentifierReducer.instances[t],Rf=S(o.createSelector([nn,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),fF=S(o.createSelector([nn,(t,s)=>s],(t,s)=>T(t.filter(e=>e.issue_type===s)))),wf=sn.reducer,Ce=R(t=>t.uuid),Ef={instances:{}},an=o.createSlice({name:"issueTypeIdentifierValues",initialState:Ef,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,Ef)),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:vf,addIssueTypeIdentifierValue:Vf,addIssueTypeIdentifierValues:zf,setIssueTypeIdentifierValue:Bf,setIssueTypeIdentifierValues:jf,updateIssueTypeIdentifierValue:qf,updateIssueTypeIdentifierValues:Df,deleteIssueTypeIdentifierValue:Cf,deleteIssueTypeIdentifierValues:$f}=an.actions,Uf=t=>t.issueTypeIdentifierValueReducer.instances,zt=o.createSelector([Uf],t=>Object.values(t)),Lf=t=>s=>s.issueTypeIdentifierValueReducer.instances[t],kf=S(o.createSelector([zt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),SF=S(o.createSelector([zt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.issue===s)))),TF=S(o.createSelector([zt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.issue_type_identifier===s)))),Nf=an.reducer,$e=R(t=>t.uuid),Gf={instances:{}},cn=o.createSlice({name:"issueTypes",initialState:Gf,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,Gf)),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:Hf,addIssueType:Wf,addIssueTypes:Kf,setIssueType:Yf,setIssueTypes:Zf,updateIssueType:Jf,updateIssueTypes:Xf,deleteIssueType:Qf,deleteIssueTypes:xf}=cn.actions,eS=t=>t.issueTypeReducer.instances,dn=o.createSelector(eS,t=>Object.values(t)),tS=t=>s=>s.issueTypeReducer.instances[t],sS=S(o.createSelector([dn,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),IF=S(o.createSelector([dn,(t,s)=>s],(t,s)=>T(t.filter(e=>e.organization===s)))),iS=cn.reducer,Ue=R(t=>t.uuid),nS={instances:{}},rn=o.createSlice({name:"issueTypeStatuses",initialState:nS,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,nS)),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:aS,addIssueTypeStatus:cS,addIssueTypeStatuses:dS,setIssueTypeStatus:rS,setIssueTypeStatuses:uS,updateIssueTypeStatus:lS,updateIssueTypeStatuses:oS,deleteIssueTypeStatus:hS,deleteIssueTypeStatuses:mS}=rn.actions,yS=t=>t.issueTypeStatusReducer.instances,un=o.createSelector([yS],t=>T(Object.values(t).toSorted(da))),ln=t=>s=>s.issueTypeStatusReducer.instances[t],pS=S(o.createSelector([un,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),OF=S(o.createSelector([un,(t,s)=>s],(t,s)=>T(t.filter(e=>e.issue_type===s)))),AS=rn.reducer,Le=R(t=>t.uuid),fS={instances:{}},on=o.createSlice({name:"issueUpdates",initialState:fS,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,fS)),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:SS,addIssueUpdate:hn,addIssueUpdates:mn,setIssueUpdate:TS,setIssueUpdates:IS,updateIssueUpdate:OS,updateIssueUpdates:PS,deleteIssueUpdate:yn,deleteIssueUpdates:pn}=on.actions,An=t=>t.issueUpdateReducer.instances,fn=o.createSelector([An],t=>Object.values(t)),FS=S(o.createSelector([An,(t,s)=>s],(t,s)=>t[s])),gS=S(o.createSelector([fn,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),bS=S(o.createSelector([fn,(t,s)=>s],(t,s)=>T(t.filter(e=>e.issue===s)))),_S=on.reducer,ke=R(t=>t.id),MS={instances:{},currentUser:null},Sn=o.createSlice({name:"users",initialState:MS,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,MS)),reducers:{initializeUsers:ke.initialize,setUsers:ke.setMany,setUser:ke.setOne,addUsers:ke.addMany,addUser:ke.addOne,updateUsers:ke.updateMany,updateUser:ke.updateOne,deleteUser:ke.deleteOne,deleteUsers:ke.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:RS,setUsers:wS,setUser:ES,addUsers:vS,addUser:Tn,updateUsers:VS,updateUser:zS,deleteUser:In,deleteUsers:BS,setCurrentUser:PF,setProfilePicture:FF}=Sn.actions,jS=Sn.reducer,qS=t=>t.userReducer.currentUser,On=t=>t.userReducer.instances,Bt=o.createSelector([On],t=>Object.values(t)),jt=t=>s=>s.userReducer.instances[t],DS=S(o.createSelector([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),CS={instances:{}},Pn=o.createSlice({name:"organizationAccess",initialState:CS,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,CS)),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:$S,addOrganizationAccess:US,addOrganizationAccesses:LS,setOrganizationAccess:kS,setOrganizationAccesses:NS,updateOrganizationAccess:GS,updateOrganizationAccesses:HS,deleteOrganizationAccess:WS,deleteOrganizationAccesses:KS}=Pn.actions,YS=Pn.reducer,qt=t=>t.organizationAccessReducer.instances,ZS=t=>s=>s.organizationAccessReducer.instances[t],JS=S(o.createSelector([qt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(Object.values(t).filter(({uuid:n})=>e.has(n)))})),gF=o.createSelector([qS,qt],(t,s)=>Object.values(s).find(n=>n.user===(t==null?void 0:t.id))??null),XS=o.createSelector([qt],t=>{const s={};for(const e of Object.values(t))s[e.user]=e;return pt(s)}),bF=S(o.createSelector([On,XS,(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),QS={instances:{}},Fn=o.createSlice({name:"organizations",initialState:QS,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,QS)),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:xS,setOrganizations:eT,setOrganization:tT,addOrganizations:sT,addOrganization:iT,updateOrganizations:nT,updateOrganization:aT,deleteOrganization:cT,deleteOrganizations:dT}=Fn.actions,rT=t=>t.organizationReducer.instances,uT=o.createSelector([rT],t=>Object.values(t)),lT=t=>s=>s.organizationReducer.instances[t],oT=S(o.createSelector([uT,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),hT=Fn.reducer,mT=(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}}}}},yT={deletedRequests:[],latestRetryTime:0},gn=o.createSlice({name:"outbox",initialState:yT,extraReducers:t=>t.addCase(_,s=>Object.assign(s,yT)),reducers:{enqueueRequest:{reducer:(t,s)=>t,prepare:t=>{console.debug("Preparing to enqueue request",t);const{BASE_URL:s,serviceName:e,...n}=t;return mT(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}}}),_F=t=>t.outboxReducer.deletedRequests,MF=t=>t.outboxReducer.latestRetryTime,{enqueueRequest:pT,markForDeletion:RF,markAsDeleted:AT,_setLatestRetryTime:fT}=gn.actions,ST=gn.reducer,He=R(t=>t.uuid),TT={instances:{}},bn=o.createSlice({name:"projectAccess",initialState:TT,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,TT)),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:IT,addProjectAccess:OT,addProjectAccesses:PT,setProjectAccess:FT,setProjectAccesses:gT,updateProjectAccess:bT,updateProjectAccesses:_T,deleteProjectAccess:MT,deleteProjectAccesses:RT}=bn.actions,wT=bn.reducer,_n=t=>t.projectAccessReducer.instances,mt=o.createSelector(_n,t=>Object.values(t)),ET=t=>s=>s.projectAccessReducer.instances[t],vT=S(o.createSelector([mt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),wF=S(o.createSelector([_n,(t,s)=>s],(t,s)=>T(Object.values(t).filter(e=>e.project===s)))),EF=S(o.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=S(o.createSelector([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)))})),We=R(t=>t.uuid),VT={instances:{}},Mn=o.createSlice({name:"projectAttachments",initialState:VT,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,VT)),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:zT,addProjectAttachment:BT,addProjectAttachments:jT,setProjectAttachment:qT,setProjectAttachments:DT,updateProjectAttachment:CT,updateProjectAttachments:$T,deleteProjectAttachment:UT,deleteProjectAttachments:LT}=Mn.actions,kT=t=>t.projectAttachmentReducer.instances,Rn=o.createSelector([kT],t=>Object.values(t)),NT=t=>s=>s.projectAttachmentReducer.instances[t],GT=S(o.createSelector([Rn,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),VF=S(o.createSelector([Rn,(t,s)=>s],(t,s)=>T(t.filter(({project:e})=>s===e)))),HT=Mn.reducer,Ke=R(t=>t.uuid),WT={instances:{},activeProjectFileId:null,isImportingProjectFile:!1},wn=o.createSlice({name:"projectFiles",initialState:WT,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,WT)),reducers:{initializeProjectFiles:Ke.initialize,setProjectFile:Ke.setOne,setProjectFiles:Ke.setMany,addProjectFile:Ke.addOne,addProjectFiles:Ke.addMany,updateProjectFile:Ke.updateOne,updateProjectFiles:Ke.updateMany,deleteProjectFile:Ke.deleteOne,deleteProjectFiles:Ke.deleteMany,setIsImportingProjectFile:(t,s)=>{t.isImportingProjectFile=s.payload},saveActiveProjectFileBounds:(t,s)=>{const e=t.activeProjectFileId;if(!e)throw new Error("Tried to save bounds for active project file, but no active project file was set.");if(!t.instances[e])throw new Error(`Tried to save bounds for active project file, but project file with ID ${e}
2
- doesn't exist.`);t.instances[e].bounds=s.payload},setActiveProjectFileId:(t,s)=>{t.activeProjectFileId=s.payload}}}),{initializeProjectFiles:KT,setProjectFile:YT,setProjectFiles:ZT,addProjectFile:JT,addProjectFiles:XT,updateProjectFile:QT,updateProjectFiles:xT,deleteProjectFile:eI,deleteProjectFiles:tI,setIsImportingProjectFile:sI,setActiveProjectFileId:iI,saveActiveProjectFileBounds:nI}=wn.actions,aI=t=>t.projectFileReducer.instances,cI=o.createSelector([aI],t=>T(Object.values(t).sort((s,e)=>s.z_index-e.z_index))),dI=t=>s=>s.projectFileReducer.instances[t],rI=S(o.createSelector([cI,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),zF=t=>t.projectFileReducer.activeProjectFileId,BF=t=>t.projectFileReducer.isImportingProjectFile,uI=wn.reducer,Ye=R(t=>t.uuid),lI={instances:{}},En=o.createSlice({name:"projects",initialState:lI,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,lI)),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:oI,setProjects:hI,setProject:mI,addProjects:yI,addProject:pI,updateProjects:AI,updateProject:fI,deleteProject:SI,deleteProjects:TI}=En.actions,II=En.reducer,OI=t=>t.projectReducer.instances,Dt=o.createSelector([OI],t=>Object.values(t)),PI=t=>s=>s.projectReducer.instances[t],FI=S(o.createSelector([Dt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),jF=S(o.createSelector([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)))})),qF=S(o.createSelector([Dt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.organization===s)))),DF={isRehydrated:!1},vn=o.createSlice({name:"rehydrated",initialState:DF,reducers:{setRehydrated:(t,s)=>{t.isRehydrated=s.payload}}}),{setRehydrated:CF}=vn.actions,$F=t=>t.rehydratedReducer.isRehydrated,gI=vn.reducer,Ze=R(t=>t.uuid),bI={instances:{}},Vn=o.createSlice({name:"teamMemberships",initialState:bI,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,bI)),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:_I,addTeamMembership:MI,addTeamMemberships:RI,setTeamMembership:wI,setTeamMemberships:EI,updateTeamMembership:vI,updateTeamMemberships:VI,deleteTeamMembership:zI,deleteTeamMemberships:BI}=Vn.actions,jI=Vn.reducer,qI=t=>t.teamMembershipReducer.instances,Ct=o.createSelector([qI],t=>Object.values(t)),DI=t=>s=>s.teamMembershipReducer.instances[t],CI=S(o.createSelector([Ct,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),UF=S(o.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=S(o.createSelector([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),$I={instances:{}},zn=o.createSlice({name:"teams",initialState:$I,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,$I)),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:UI,addTeam:LI,addTeams:kI,setTeam:NI,setTeams:GI,updateTeam:HI,updateTeams:WI,deleteTeam:KI,deleteTeams:YI}=zn.actions,ZI=t=>t.teamReducer.instances,Bn=o.createSelector([ZI],t=>Object.values(t)),JI=t=>s=>s.teamReducer.instances[t],XI=S(o.createSelector([Bn,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),kF=S(o.createSelector([Bn,(t,s)=>s],(t,s)=>T(t.filter(e=>e.organization===s)))),QI=zn.reducer,NF={version:0},xI=o.createSlice({name:"versioning",initialState:NF,reducers:{}}),eO=xI.reducer,jn={outboxReducer:ST,fileReducer:kh,authReducer:qo},GF=o.combineReducers(jn),tO={...jn,[rt]:eO,categoryReducer:Zo,assetReducer:kr,assetAttachmentReducer:Ra,assetStageCompletionReducer:xr,assetStageReducer:yu,assetTypeReducer:To,assetTypeAttachmentReducer:wu,issueReducer:xp,issueAttachmentReducer:mp,issueTypeReducer:iS,issueTypeAttachmentReducer:mA,organizationReducer:hT,projectReducer:II,projectAttachmentReducer:HT,projectAccessReducer:wT,organizationAccessReducer:YS,projectFileReducer:uI,rehydratedReducer:gI,formReducer:Xm,formRevisionReducer:Um,formRevisionAttachmentReducer:Em,formSubmissionAttachmentReducer:hy,formSubmissionReducer:by,formIdentifierReducer:sm,formIdentifierValueReducer:Am,userReducer:jS,emailDomainsReducer:Dh,documentsReducer:Ih,documentAttachmentReducer:uh,teamReducer:QI,agentsReducer:pa,issueCommentReducer:Up,issueCommentAttachmentReducer:Mp,issueUpdateReducer:_S,geoImageReducer:$y,issueAssociationReducer:ep,issueTypeFieldsReducer:tf,issueTypeFieldValuesReducer:LA,issueTypeFieldsAttachmentReducer:MA,issueTypeFieldValuesAttachmentReducer:pf,issueTypeIdentifierReducer:wf,issueTypeIdentifierValueReducer:Nf,issueTypeStatusReducer:AS,assetTypeFieldsReducer:il,assetTypeFieldValuesReducer:El,assetTypeFieldsAttachmentReducer:Nu,assetTypeFieldValuesAttachmentReducer:Al,assetTypeIdentifierReducer:Gl,assetTypeIdentifierValueReducer:no,assetTypeStatusReducer:zo,assetProcedureTypeReducer:md,assetProcedureReducer:Qc,assetProcedureTypeFieldsReducer:mc,assetProcedureTypeFieldValuesReducer:Uc,assetProcedureTypeFieldsAttachmentReducer:xa,assetProcedureTypeFieldValuesAttachmentReducer:bc,assetProcedureTypeAttachmentReducer:$a,assetProcedureStepFieldsAttachmentReducer:Ed,assetProcedureStepFieldsReducer:Nd,assetProcedureStepFieldValuesAttachmentReducer:sr,assetProcedureStepFieldValuesReducer:Ar,assetProcedureStepReducer:Mr,teamMembershipReducer:jI},HF=o.combineReducers(tO),sO=1e4,iO=200,qn=[400,409,403,404,405,500],k=1e4,nO={};class aO{constructor(s){y(this,"client");y(this,"pageSize",sO);nO[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 cO=()=>uO.length-1,dO=t=>(t[rt]={version:cO()},t),rO=()=>dO({}),WF=t=>(t.outboxReducer&&(t.outboxReducer.deletedRequests=[]),t),KF=t=>s=>{var e;return s===void 0&&(s={}),((e=s[rt])==null?void 0:e.version)===cO()?s:t(s)},uO=[dO,rO,rO,WF],YF=Object.fromEntries(uO.map((t,s)=>[s,KF(t)])),ZF=t=>{if(t)throw t;const s=dt();s?s.dispatch({type:"rehydrated/setRehydrated",payload:!0}):console.error("Client store not set")},lO=(t,s,e)=>{const n=tt();return n?(n.addRequest(s),n.getQueue()):(console.warn("Outbox coordinator not set; cannot enqueue request yet."),[])},oO=(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 JF(t,s){if(!s.payload)throw new Error("Received empty payload");return gO(s)}const XF={...Hn,effect:JF,discard:mO,returnPromises:!0,persistCallback:ZF,retry:tg,persistOptions:{storage:vO},queue:{...Hn.queue,enqueue:lO,dequeue:oO,peek:(...t)=>eg(...t)}},QF=VO(YF,rt),xF=o.compose(EO.offline(XF),QF);async function hO(t,s,e){if(s.store.getState().outboxReducer.deletedRequests.includes(t.payload.uuid))throw new Error("Request was marked for deletion");const a=nO[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 mO(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("@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","@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.reduxOffline,i.offlineConfig,i.localforage,i.createMigration,null,null,i.idb,i.jwtDecode,i.dependencyGraph))})(this,function(i,L,o,st,xe,kn,RO,wO,Nn,yt,EO,Gn,vO,VO,gb,bb,zO,BO,jO){"use strict";var Pb=Object.defineProperty;var Fb=(i,L,o)=>L in i?Pb(i,L,{enumerable:!0,configurable:!0,writable:!0,value:o}):i[L]=o;var y=(i,L,o)=>Fb(i,typeof L!="symbol"?L+"":L,o);var _O;const Hn=Object.freeze([]),Wn=Object.freeze({});var Kn=(t=>(t[t.GUEST=0]="GUEST",t[t.BASIC=2]="BASIC",t[t.ADMIN=4]="ADMIN",t))(Kn||{}),m=(t=>(t.GET="GET",t.POST="POST",t.PATCH="PATCH",t.PUT="PUT",t.DELETE="DELETE",t))(m||{}),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 qO=kt.MEDIUM,Xn=6e4;function R(t){return{addOne:(h,p)=>{const A=t(p.payload);h.instances[A]=p.payload},addMany:(h,p)=>{for(const A of p.payload){const f=t(A);h.instances[f]=A}},setOne:(h,p)=>{const A=t(p.payload);h.instances[A]=p.payload},setMany:(h,p)=>{for(const A of p.payload){const f=t(A);h.instances[f]=A}},updateOne:(h,p)=>{const A=t(p.payload);h.instances[A]=p.payload},updateMany:(h,p)=>{for(const A of p.payload){const f=t(A);h.instances[f]=A}},deleteOne:(h,p)=>{delete h.instances[p.payload]},deleteMany:(h,p)=>{for(const A of p.payload)delete h.instances[A]},initialize:(h,p)=>{h.instances={};const A=new Set;for(const f of p.payload){const I=t(f);A.add(I),h.instances[I]=f}A.size!==p.payload.length&&console.warn("duplicate ids detected when initializing model instances.")}}}function DO(){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 h=new Set(u.selection);for(const p of d.payload)h.has(p)||h.add(p);u.selection=Array.from(h)},unselectOne:(u,d)=>{const h=new Set(u.selection);h.has(d.payload)&&(h.delete(d.payload),u.selection=Array.from(h))},unselectMany:(u,d)=>{const h=new Set(u.selection);for(const p of d.payload)h.has(p)&&h.delete(p);u.selection=Array.from(h)},toggleOne:(u,d)=>{const h=new Set(u.selection);h.has(d.payload)?h.delete(d.payload):h.add(d.payload),u.selection=Array.from(h)},toggleMany:(u,d)=>{const h=new Set(u.selection);for(const p of d.payload)h.has(p)?h.delete(p):h.add(p);u.selection=Array.from(h)},getInitialState:u=>({...u,selection:[]})}}const rt="versioning",_=o.createAction("RESET"),C=o.createAction("RESET_PROJECT_STATE"),w=o.createAction("RESET_ORGANIZATION_STATE");function CO(t,s){return kn.useMemo(t,s)}function $O(t,s){const e=kn.useMemo(t,s);return RO.useSelector(e)}_O=Symbol.toStringTag;class Nt{constructor(){y(this,_O,"Promise");y(this,"_promise");y(this,"_resolve");y(this,"_reject");y(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 UO(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 LO(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?Wn:t,Qn=Ht(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)}),kO=new Intl.RelativeTimeFormat([],{style:"long",numeric:"auto"}),NO=1e3*86400,Wt=new Date,GO=t=>new Date(t).toDateString()===Wt.toDateString(),HO=Ht((t,s,e)=>{const n=Math.round((new Date(t).getTime()-Wt.getTime())/NO);return n<s||n>e?Qn(t):kO.format(n,"days")});function WO(t){return new Uint8Array(t).reduce((e,n)=>e+n.toString(16).padStart(2,"0"),"")}const Kt=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=WO(c);s(r)})},n.readAsArrayBuffer(t)})}function KO(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 xn(t,s){return new File([t],s,{type:t.type})}function YO(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 ZO=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)},ea=async t=>(await fetch(t)).blob(),JO=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]);wO.saveAs(s,t.name)}const ta={};function QO(t,s,e,...n){const a=ta[t];let c=!1;a?a[s]||(a[s]=!0,c=!0):(ta[t]={[s]:!0},c=!0),c&&console[e](...n)}const sa=["created_at","updated_at","index","revision"];function M(t){return{...t,uuid:xe.v4()}}function xO(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 Yt(t,s){return At(t.uuid,s.uuid)}function eP(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 tP(t){return t.toLowerCase().replace(" ","-")}function sP(t,s=!1){return t.normalize("NFKD").toLowerCase().replace(/[^\w\s-]/g,"").trim().replace(/[-\s]+/g,s?"_":"-")}function iP(t,s){if(t.length<=s)return t;const e=t.slice(0,s-1);return e.slice(0,e.lastIndexOf(" "))+"…"}const nP=/^.+@.+\..+$/;function V(t){const s={...t};for(const e of[...sa,"created_by"])e in s&&delete s[e];return s}const ia=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})},aP=t=>{const{roots:s}=ia(t);return s.map(e=>new yt.Tree(e))},na=(t,s)=>{const{nodes:e}=ia(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)},aa=(t,s)=>t.type!==s.type?t.type-s.type:t.order-s.order,ca=(t,s)=>t.type!==s.type?t.type-s.type:t.order-s.order,da=t=>Nn(t,{id:s=>s.uuid,parentId:s=>s.parent_document,includeEmptyChildrenArray:!0,valueKey:!1}),cP=t=>{const{roots:s}=da(t);return s.map(e=>new yt.Tree(e))},ra=(t,s)=>{const{nodes:e}=da(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)};class dP{constructor(s){y(this,"operations",[]);y(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 o.createSelector([this.getData],n=>this.performOperations(n).find(a=>a[s]===e))}count(){return o.createSelector([this.getData],s=>this.performOperations(s).length)}first(){return o.createSelector([this.getData],s=>this.performOperations(s)[0])}last(){return o.createSelector([this.getData],s=>{const e=this.performOperations(s);return e[e.length-1]})}exists(){return o.createSelector([this.getData],s=>this.performOperations(s).length>0)}toSelector(){return o.createSelector([this.getData],s=>T(this.performOperations(s)))}}const S=t=>(...s)=>e=>t(e,...s),N=R(t=>t.uuid),ua={instances:{}},Zt=o.createSlice({name:"agents",initialState:ua,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,ua)),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:la,addConversation:oa,addConversations:rP,setConversation:ha,setConversations:uP,updateConversation:ma,updateConversations:lP,deleteConversation:oP,deleteConversations:hP}=Zt.actions,Jt=t=>t.agentsReducer.instances,mP=o.createSelector([Jt],t=>Object.values(t)),yP=S(o.createSelector([Jt,(t,s)=>s],(t,s)=>t[s])),ya=Zt.reducer,G=R(t=>t.uuid),pa={instances:{}},Xt=o.createSlice({name:"assetAttachments",initialState:pa,extraReducers:t=>t.addMatcher(o.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:Qt,setAssetAttachment:Sa,setAssetAttachments:Ta,updateAssetAttachment:Ia,updateAssetAttachments:Oa,deleteAssetAttachment:Pa,deleteAssetAttachments:xt}=Xt.actions,Fa=t=>t.assetAttachmentReducer.instances,es=o.createSelector([Fa],t=>Object.values(t)),ga=t=>s=>s.assetAttachmentReducer.instances[t],ba=S(o.createSelector([es,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),_a=S(o.createSelector([es,(t,s)=>s],(t,s)=>T(t.filter(({asset:e})=>s===e)))),Ma=Xt.reducer,H=R(({uuid:t})=>t),Ra={instances:{}},ts=o.createSlice({name:"assetProcedureTypeAttachments",initialState:Ra,extraReducers:t=>t.addMatcher(o.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}=ts.actions,Ca=ts.reducer,$a=t=>t.assetProcedureTypeAttachmentReducer.instances,ss=o.createSelector([$a],t=>Object.values(t)),Ua=t=>s=>s.assetProcedureTypeAttachmentReducer.instances[t],La=S(o.createSelector([ss,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),pP=S(o.createSelector([ss,(t,s)=>s],(t,s)=>T(t.filter(({asset_procedure_type:e})=>s===e)))),W=R(({uuid:t})=>t),ka={instances:{}},is=o.createSlice({name:"assetProcedureTypeFieldsAttachments",initialState:ka,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,ka)),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:Na,addAssetProcedureTypeFieldsAttachment:Ga,addAssetProcedureTypeFieldsAttachments:Ha,setAssetProcedureTypeFieldsAttachment:Wa,setAssetProcedureTypeFieldsAttachments:Ka,updateAssetProcedureTypeFieldsAttachment:Ya,updateAssetProcedureTypeFieldsAttachments:Za,deleteAssetProcedureTypeFieldsAttachment:Ja,deleteAssetProcedureTypeFieldsAttachments:Xa}=is.actions,Qa=is.reducer,xa=t=>t.assetProcedureTypeFieldsAttachmentReducer.instances,ns=o.createSelector([xa],t=>Object.values(t)),AP=S(o.createSelector([ns,(t,s)=>s],(t,s)=>T(t.filter(e=>e.fields_revision===s)))),ec=t=>s=>s.assetProcedureTypeFieldsAttachmentReducer.instances[t],tc=S(o.createSelector([ns,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),K=R(({uuid:t})=>t),sc={instances:{}},as=o.createSlice({name:"assetProcedureTypeFields",initialState:sc,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,sc)),reducers:{initializeAssetProcedureTypeFields:K.initialize,addAssetProcedureTypeFields:K.addOne,addAssetProcedureTypeFieldsMany:K.addMany,setAssetProcedureTypeFields:K.setOne,setAssetProcedureTypeFieldsMany:K.setMany,updateAssetProcedureTypeFields:K.updateOne,updateAssetProcedureTypeFieldsMany:K.updateMany,deleteAssetProcedureTypeFields:K.deleteOne,deleteAssetProcedureTypeFieldsMany:K.deleteMany}}),{initializeAssetProcedureTypeFields:ic,addAssetProcedureTypeFields:nc,addAssetProcedureTypeFieldsMany:ac,setAssetProcedureTypeFields:cc,setAssetProcedureTypeFieldsMany:dc,updateAssetProcedureTypeFields:rc,updateAssetProcedureTypeFieldsMany:uc,deleteAssetProcedureTypeFields:lc,deleteAssetProcedureTypeFieldsMany:oc}=as.actions,hc=as.reducer,mc=t=>t.assetProcedureTypeFieldsReducer.instances,ft=o.createSelector([mc],t=>Object.values(t)),fP=S(o.createSelector([ft,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_procedure_type===s)))),SP=S(o.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=>s.assetProcedureTypeFieldsReducer.instances[t],pc=S(o.createSelector([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:{}},cs=o.createSlice({name:"assetProcedureTypeFieldValuesAttachments",initialState:Ac,extraReducers:t=>t.addMatcher(o.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:Sc,addAssetProcedureTypeFieldValuesAttachments:ds,setAssetProcedureTypeFieldValuesAttachment:Tc,setAssetProcedureTypeFieldValuesAttachments:Ic,updateAssetProcedureTypeFieldValuesAttachment:Oc,updateAssetProcedureTypeFieldValuesAttachments:Pc,deleteAssetProcedureTypeFieldValuesAttachment:Fc,deleteAssetProcedureTypeFieldValuesAttachments:rs}=cs.actions,gc=cs.reducer,bc=t=>t.assetProcedureTypeFieldValuesAttachmentReducer.instances,us=o.createSelector([bc],t=>Object.values(t)),_c=t=>s=>s.assetProcedureTypeFieldValuesAttachmentReducer.instances[t],Mc=S(o.createSelector([us,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),Rc=S(o.createSelector([us,(t,s)=>s],(t,s)=>T(t.filter(e=>e.field_values===s)))),Z=R(({uuid:t})=>t),wc={instances:{}},ls=o.createSlice({name:"assetProcedureTypeFieldValues",initialState:wc,extraReducers:t=>t.addMatcher(o.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}=ls.actions,$c=ls.reducer,Uc=t=>t.assetProcedureTypeFieldValuesReducer.instances,St=o.createSelector([Uc],t=>Object.values(t)),TP=S(o.createSelector([St,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset===s)))),IP=S(o.createSelector([St,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_procedure===s)))),Lc=t=>s=>s.assetProcedureTypeFieldValuesReducer.instances[t],kc=S(o.createSelector([St,(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:{}},os=o.createSlice({name:"assetProcedures",initialState:Nc,extraReducers:t=>t.addMatcher(o.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:hs,updateAssetProcedure:Wc,updateAssetProcedures:Kc,deleteAssetProcedure:Yc,deleteAssetProcedures:ms,setAssetProcedure:Zc,setAssetProcedures:Jc}=os.actions,Xc=os.reducer,Qc=t=>t.assetProcedureReducer.instances,Tt=o.createSelector([Qc],t=>Object.values(t)),xc=S(o.createSelector([Tt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_procedure_type===s)))),OP=S(o.createSelector([Tt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_type===s)))),ed=t=>s=>s.assetProcedureReducer.instances[t],td=S(o.createSelector([Tt,(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:{}},ys=o.createSlice({name:"assetProcedureTypes",initialState:sd,extraReducers:t=>t.addMatcher(o.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}=ys.actions,hd=ys.reducer,md=t=>t.assetProcedureTypeReducer.instances,ps=o.createSelector([md],t=>Object.values(t)),yd=t=>s=>s.assetProcedureTypeReducer.instances[t],pd=S(o.createSelector([ps,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),PP=S(o.createSelector([ps,(t,s)=>s],(t,s)=>T(t.filter(e=>e.organization===s)))),Q=R(t=>t.uuid),Ad={instances:{}},As=o.createSlice({name:"assetProcedureStepFieldsAttachments",initialState:Ad,extraReducers:t=>t.addMatcher(o.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:Sd,addAssetProcedureStepFieldsAttachments:Td,setAssetProcedureStepFieldsAttachment:Id,setAssetProcedureStepFieldsAttachments:Od,updateAssetProcedureStepFieldsAttachment:Pd,updateAssetProcedureStepFieldsAttachments:Fd,deleteAssetProcedureStepFieldsAttachment:gd,deleteAssetProcedureStepFieldsAttachments:bd}=As.actions,_d=t=>t.assetProcedureStepFieldsAttachmentReducer.instances,fs=o.createSelector([_d],t=>Object.values(t)),FP=S(o.createSelector([fs,(t,s)=>s],(t,s)=>T(t.filter(e=>e.fields_revision===s)))),Md=t=>s=>s.assetProcedureStepFieldsAttachmentReducer.instances[t],Rd=S(o.createSelector([fs,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),wd=As.reducer,x=R(t=>t.uuid),Ed={instances:{}},Ss=o.createSlice({name:"assetProcedureStepFields",initialState:Ed,extraReducers:t=>t.addMatcher(o.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}=Ss.actions,Ts=t=>t.assetProcedureStepFieldsReducer.instances,It=o.createSelector([Ts],t=>Object.values(t)),gP=S(o.createSelector([It,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_procedure_step===s)))),bP=S(o.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])),_P=o.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=>s.assetProcedureStepFieldsReducer.instances[t],Ld=S(o.createSelector([It,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),kd=Ss.reducer,ee=R(t=>t.uuid),Nd={instances:{}},Is=o.createSlice({name:"assetProcedureStepFieldValuesAttachments",initialState:Nd,extraReducers:t=>t.addMatcher(o.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:Os,setAssetProcedureStepFieldValuesAttachment:Wd,setAssetProcedureStepFieldValuesAttachments:Kd,updateAssetProcedureStepFieldValuesAttachment:Yd,updateAssetProcedureStepFieldValuesAttachments:Zd,deleteAssetProcedureStepFieldValuesAttachment:Jd,deleteAssetProcedureStepFieldValuesAttachments:Ps}=Is.actions,Xd=t=>t.assetProcedureStepFieldValuesAttachmentReducer.instances,Fs=o.createSelector([Xd],t=>Object.values(t)),Qd=t=>s=>s.assetProcedureStepFieldValuesAttachmentReducer.instances[t],xd=S(o.createSelector([Fs,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),er=S(o.createSelector([Fs,(t,s)=>s],(t,s)=>T(t.filter(e=>e.field_values===s)))),tr=Is.reducer,te=R(t=>t.uuid),sr={instances:{}},gs=o.createSlice({name:"assetProcedureStepFieldValues",initialState:sr,extraReducers:t=>t.addMatcher(o.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}=gs.actions,hr=t=>t.assetProcedureStepFieldValuesReducer.instances,ut=o.createSelector([hr],t=>Object.values(t)),MP=S(o.createSelector([ut,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset===s)))),RP=S(o.createSelector([ut,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_procedure===s)))),wP=S(o.createSelector([ut,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_procedure_step===s)))),mr=t=>s=>s.assetProcedureStepFieldValuesReducer.instances[t],yr=S(o.createSelector([ut,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),pr=gs.reducer,se=R(t=>t.uuid),Ar={instances:{}},bs=o.createSlice({name:"assetProcedureSteps",initialState:Ar,extraReducers:t=>t.addMatcher(o.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:Sr,setAssetProcedureSteps:Tr,addAssetProcedureStep:Ir,addAssetProcedureSteps:Or,updateAssetProcedureStep:Pr,updateAssetProcedureSteps:Fr,deleteAssetProcedureStep:gr,deleteAssetProcedureSteps:br}=bs.actions,_r=bs.reducer,Ot=t=>t.assetProcedureStepReducer.instances,Mr=t=>s=>s.assetProcedureStepReducer.instances[t],_s=o.createSelector([Ot],t=>Object.values(t)),EP=S(o.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=S(o.createSelector([_s,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_procedure_type===s)))),Rr=S(o.createSelector([_s,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),wr=S(o.createSelector([Ot,(t,s)=>s],(t,s)=>{if(!t[s])return T([]);const a=na(s,Object.values(t)).all().map(({model:c})=>c);return T(a)})),ie=R(t=>t.uuid),Er={instances:{}},Ms=o.createSlice({name:"assets",initialState:Er,extraReducers:t=>t.addMatcher(o.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:Rs,updateAsset:zr,updateAssets:Br,deleteAsset:jr,deleteAssets:ws,setAsset:qr,setAssets:Dr}=Ms.actions,Cr=t=>t.assetReducer.instances,Pt=o.createSelector([Cr],t=>T(Object.values(t))),VP=S(o.createSelector([Pt,(t,s)=>s],(t,s)=>T(t.filter(({project:e})=>e===s)))),$r=S(o.createSelector([Pt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_type===s)))),Ur=t=>s=>s.assetReducer.instances[t],Lr=S(o.createSelector([Pt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),kr=Ms.reducer,ne=R(t=>t.uuid),Nr={instances:{}},Es=o.createSlice({name:"assetStageCompletions",initialState:Nr,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,Nr)),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:Gr,addAssetStageCompletion:Hr,addAssetStageCompletions:Wr,setAssetStageCompletion:Kr,setAssetStageCompletions:Yr,updateAssetStageCompletion:Zr,updateAssetStageCompletions:Jr,deleteAssetStageCompletion:Xr,deleteAssetStageCompletions:Qr}=Es.actions,xr=Es.reducer,eu=t=>t.assetStageCompletionReducer.instances,tu=o.createSelector([eu],t=>Object.values(t)),su=t=>s=>s.assetStageCompletionReducer.instances[t],iu=S(o.createSelector([tu,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),ae=R(t=>t.uuid),nu={instances:{}},vs=o.createSlice({name:"assetStages",initialState:nu,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,nu)),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:au,setAssetStage:cu,setAssetStages:du,addAssetStage:ru,addAssetStages:uu,updateAssetStage:lu,updateAssetStages:ou,deleteAssetStage:hu,deleteAssetStages:mu}=vs.actions,yu=vs.reducer,Vs=t=>t.assetStageReducer.instances,pu=t=>s=>s.assetStageReducer.instances[t],zs=o.createSelector([Vs],t=>Object.values(t)),zP=S(o.createSelector([Vs,(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)})),BP=S(o.createSelector([zs,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_procedure_type===s)))),Au=S(o.createSelector([zs,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),ce=R(t=>t.uuid),fu={instances:{}},Bs=o.createSlice({name:"assetTypeAttachments",initialState:fu,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,fu)),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:Su,addAssetTypeAttachment:Tu,addAssetTypeAttachments:js,setAssetTypeAttachment:Iu,setAssetTypeAttachments:Ou,updateAssetTypeAttachment:Pu,updateAssetTypeAttachments:Fu,deleteAssetTypeAttachment:gu,deleteAssetTypeAttachments:qs}=Bs.actions,bu=t=>t.assetTypeAttachmentReducer.instances,Ds=o.createSelector([bu],t=>Object.values(t)),_u=t=>s=>s.assetTypeAttachmentReducer.instances[t],Mu=S(o.createSelector([Ds,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),Ru=S(o.createSelector([Ds,(t,s)=>s],(t,s)=>T(t.filter(({asset_type:e})=>s===e)))),wu=Bs.reducer,de=R(t=>t.uuid),Eu={instances:{}},Cs=o.createSlice({name:"assetTypeFieldsAttachments",initialState:Eu,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,Eu)),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:vu,addAssetTypeFieldsAttachment:Vu,addAssetTypeFieldsAttachments:zu,setAssetTypeFieldsAttachment:Bu,setAssetTypeFieldsAttachments:ju,updateAssetTypeFieldsAttachment:qu,updateAssetTypeFieldsAttachments:Du,deleteAssetTypeFieldsAttachment:Cu,deleteAssetTypeFieldsAttachments:$u}=Cs.actions,Uu=t=>t.assetTypeFieldsAttachmentReducer.instances,$s=o.createSelector([Uu],t=>Object.values(t)),jP=S(o.createSelector([$s,(t,s)=>s],(t,s)=>T(t.filter(e=>e.fields_revision===s)))),Lu=t=>s=>s.assetTypeFieldsAttachmentReducer.instances[t],ku=S(o.createSelector([$s,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),Nu=Cs.reducer,re=R(t=>t.uuid),Gu={instances:{}},Us=o.createSlice({name:"assetTypeFields",initialState:Gu,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,Gu)),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:Hu,addAssetTypeFields:Wu,addAssetTypeFieldsMany:Ku,setAssetTypeFields:Yu,setAssetTypeFieldsMany:Zu,updateAssetTypeFields:Ju,updateAssetTypeFieldsMany:Xu,deleteAssetTypeFields:Qu,deleteAssetTypeFieldsMany:xu}=Us.actions,el=t=>t.assetTypeFieldsReducer.instances,lt=o.createSelector([el],t=>Object.values(t)),qP=S(o.createSelector([lt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_type===s)))),DP=S(o.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])),tl=t=>s=>s.assetTypeFieldsReducer.instances[t],sl=S(o.createSelector([lt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),il=Us.reducer,ue=R(t=>t.uuid),nl={instances:{}},Ls=o.createSlice({name:"assetTypeFieldValuesAttachments",initialState:nl,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,nl)),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:al,addAssetTypeFieldValuesAttachment:cl,addAssetTypeFieldValuesAttachments:ks,setAssetTypeFieldValuesAttachment:dl,setAssetTypeFieldValuesAttachments:rl,updateAssetTypeFieldValuesAttachment:ul,updateAssetTypeFieldValuesAttachments:ll,deleteAssetTypeFieldValuesAttachment:ol,deleteAssetTypeFieldValuesAttachments:Ns}=Ls.actions,hl=t=>t.assetTypeFieldValuesAttachmentReducer.instances,Gs=o.createSelector([hl],t=>Object.values(t)),ml=t=>s=>s.assetTypeFieldValuesAttachmentReducer.instances[t],yl=S(o.createSelector([Gs,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),pl=S(o.createSelector([Gs,(t,s)=>s],(t,s)=>T(t.filter(e=>e.field_values===s)))),Al=Ls.reducer,le=R(t=>t.uuid),fl={instances:{}},Hs=o.createSlice({name:"assetTypeFieldValues",initialState:fl,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,fl)),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:Sl,addAssetTypeFieldValues:Tl,addAssetTypeFieldValuesMany:Il,setAssetTypeFieldValues:Ol,setAssetTypeFieldValuesMany:Pl,updateAssetTypeFieldValues:Fl,updateAssetTypeFieldValuesMany:gl,deleteAssetTypeFieldValues:bl,deleteAssetTypeFieldValuesMany:_l}=Hs.actions,Ml=t=>t.assetTypeFieldValuesReducer.instances,Ft=o.createSelector([Ml],t=>Object.values(t)),CP=S(o.createSelector([Ft,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset===s)))),$P=S(o.createSelector([lt,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)))})),Rl=t=>s=>s.assetTypeFieldValuesReducer.instances[t],wl=S(o.createSelector([Ft,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),El=Hs.reducer,oe=R(t=>t.uuid),vl={instances:{}},Ws=o.createSlice({name:"assetTypeIdentifiers",initialState:vl,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,vl)),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:zl,addAssetTypeIdentifiers:Bl,setAssetTypeIdentifier:jl,setAssetTypeIdentifiers:ql,updateAssetTypeIdentifier:Dl,updateAssetTypeIdentifiers:Cl,deleteAssetTypeIdentifier:$l,deleteAssetTypeIdentifiers:Ul}=Ws.actions,Ll=t=>t.assetTypeIdentifierReducer.instances,Ks=o.createSelector([Ll],t=>Object.values(t)),kl=t=>s=>s.assetTypeIdentifierReducer.instances[t],Nl=S(o.createSelector([Ks,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),UP=S(o.createSelector([Ks,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_type===s)))),Gl=Ws.reducer,he=R(t=>t.uuid),Hl={instances:{}},Ys=o.createSlice({name:"assetTypeIdentifierValues",initialState:Hl,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,Hl)),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:Wl,addAssetTypeIdentifierValue:Kl,addAssetTypeIdentifierValues:Yl,setAssetTypeIdentifierValue:Zl,setAssetTypeIdentifierValues:Jl,updateAssetTypeIdentifierValue:Xl,updateAssetTypeIdentifierValues:Ql,deleteAssetTypeIdentifierValue:xl,deleteAssetTypeIdentifierValues:eo}=Ys.actions,to=t=>t.assetTypeIdentifierValueReducer.instances,gt=o.createSelector([to],t=>Object.values(t)),so=t=>s=>s.assetTypeIdentifierValueReducer.instances[t],io=S(o.createSelector([gt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),LP=S(o.createSelector([gt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset===s)))),kP=S(o.createSelector([gt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_type_identifier===s)))),no=Ys.reducer,me=R(t=>t.uuid),ao={instances:{}},Zs=o.createSlice({name:"assetTypes",initialState:ao,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,ao)),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:co,setAssetType:ro,setAssetTypes:uo,addAssetType:lo,addAssetTypes:oo,updateAssetType:ho,updateAssetTypes:mo,deleteAssetType:yo,deleteAssetTypes:po}=Zs.actions,Ao=t=>t.assetTypeReducer.instances,Js=o.createSelector([Ao],t=>Object.values(t)),fo=t=>s=>s.assetTypeReducer.instances[t],So=S(o.createSelector([Js,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),NP=S(o.createSelector([Js,(t,s)=>s],(t,s)=>T(t.filter(e=>e.organization===s)))),To=Zs.reducer,ye=R(t=>t.uuid),Io={instances:{}},Xs=o.createSlice({name:"assetTypeStatuses",initialState:Io,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,Io)),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:Oo,addAssetTypeStatus:Po,addAssetTypeStatuses:Fo,setAssetTypeStatus:go,setAssetTypeStatuses:bo,updateAssetTypeStatus:_o,updateAssetTypeStatuses:Mo,deleteAssetTypeStatus:Ro,deleteAssetTypeStatuses:wo}=Xs.actions,Eo=t=>t.assetTypeStatusReducer.instances,Qs=o.createSelector([Eo],t=>T(Object.values(t).toSorted(aa))),vo=t=>s=>s.assetTypeStatusReducer.instances[t],Vo=S(o.createSelector([Qs,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),GP=S(o.createSelector([Qs,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_type===s)))),zo=Xs.reducer,Bo={accessToken:"",refreshToken:"",isLoggedIn:!1},bt=o.createSlice({name:"auth",initialState:Bo,extraReducers:t=>t.addCase(_,s=>Object.assign(s,Bo)),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:HP,clearTokens:WP,setLoggedIn:jo}=bt.actions,KP=t=>t.authReducer.accessToken,YP=t=>t.authReducer.isLoggedIn,qo=bt.reducer,pe=R(t=>t.uuid),Do={instances:{}},xs=o.createSlice({name:"categories",initialState:Do,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,Do)),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:Co,addCategory:$o,addCategories:Uo,setCategory:Lo,setCategories:ko,updateCategory:No,updateCategories:Go,deleteCategory:Ho,deleteCategories:Wo}=xs.actions,Ko=t=>t.categoryReducer.instances,ei=o.createSelector([Ko],t=>Object.values(t)),ti=t=>s=>s.categoryReducer.instances[t],Yo=S(o.createSelector([ei,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),ZP=S(o.createSelector([ei,(t,s)=>s],(t,s)=>T(t.filter(e=>e.project===s)))),Zo=xs.reducer,Ae=R(t=>t.uuid),Jo={instances:{}},si=o.createSlice({name:"documentAttachments",initialState:Jo,extraReducers:t=>t.addCase(_,s=>Object.assign(s,Jo)),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:Xo,addDocumentAttachment:Qo,addDocumentAttachments:xo,setDocumentAttachment:eh,setDocumentAttachments:th,updateDocumentAttachment:sh,updateDocumentAttachments:ih,deleteDocumentAttachment:nh,deleteDocumentAttachments:ah}=si.actions,ch=t=>t.documentAttachmentReducer.instances,ii=o.createSelector([ch],t=>Object.values(t)),dh=t=>s=>s.documentAttachmentReducer.instances[t],rh=S(o.createSelector([ii,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),JP=S(o.createSelector([ii,(t,s)=>s],(t,s)=>T(t.filter(({document:e})=>s===e)))),uh=si.reducer,fe=R(({uuid:t})=>t),lh={instances:{}},ni=o.createSlice({name:"documents",initialState:lh,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>{Object.assign(s,lh)}),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:oh,addDocument:hh,addDocuments:mh,setDocument:yh,setDocuments:ph,updateDocument:Ah,updateDocuments:fh,deleteDocument:Sh,deleteDocuments:Th}=ni.actions,Ih=ni.reducer,ai=t=>t.documentsReducer.instances,_t=o.createSelector([ai],t=>Object.values(t)),Oh=t=>s=>s.documentsReducer.instances[t],Ph=S(o.createSelector([_t,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),XP=S(o.createSelector([_t,(t,s)=>s],(t,s)=>t.filter(e=>e.project===s))),QP=S(o.createSelector([_t,(t,s)=>s],(t,s)=>t.filter(e=>e.organization===s))),Fh=S(o.createSelector([ai,(t,s)=>s],(t,s)=>{if(!t[s])return T([]);const a=ra(s,Object.values(t)).all().map(({model:c})=>c);return T(a)})),Se=R(t=>t.uuid),gh={instances:{}},ci=o.createSlice({name:"emailDomains",initialState:gh,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,gh)),reducers:{initializeEmailDomains:Se.initialize,addEmailDomain:Se.addOne,addEmailDomains:Se.addMany,setEmailDomain:Se.setOne,setEmailDomains:Se.setMany,updateEmailDomain:Se.updateOne,updateEmailDomains:Se.updateMany,deleteEmailDomain:Se.deleteOne,deleteEmailDomains:Se.deleteMany}}),{initializeEmailDomains:bh,addEmailDomain:_h,addEmailDomains:Mh,setEmailDomain:Rh,setEmailDomains:wh,updateEmailDomain:Eh,updateEmailDomains:vh,deleteEmailDomain:Vh,deleteEmailDomains:zh}=ci.actions,Bh=t=>t.emailDomainsReducer.instances,di=o.createSelector([Bh],t=>Object.values(t)),jh=t=>s=>s.emailDomainsReducer.instances[t],qh=S(o.createSelector([di,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),xP=S(o.createSelector([di,(t,s)=>s],(t,s)=>T(t.filter(e=>e.organization===s)))),Dh=ci.reducer,Ch={s3Urls:{}},$h=1e3*60*60,eF=$h*24*7,ri=o.createSlice({name:"file",initialState:Ch,extraReducers:t=>t.addCase(_,s=>Object.assign(s,Ch)),reducers:{setUploadUrl:(t,s)=>{const{url:e,fields:n,sha1:a}=s.payload,c=new Date,r=new Date(c.getTime()+eF);t.s3Urls[a]={url:e,fields:n,exp:r.getTime()}}}}),{setUploadUrl:Uh}=ri.actions,Lh=t=>s=>{const e=s.fileReducer.s3Urls[t];if(!e)return;const n=new Date().getTime();if(!((e.exp??n)-n<$h))return e},kh=ri.reducer,Te=R(t=>t.uuid),Nh={instances:{}},ui=o.createSlice({name:"formIdentifiers",initialState:Nh,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,Nh)),reducers:{initializeFormIdentifiers:Te.initialize,addFormIdentifier:Te.addOne,addFormIdentifiers:Te.addMany,setFormIdentifier:Te.setOne,setFormIdentifiers:Te.setMany,updateFormIdentifier:Te.updateOne,updateFormIdentifiers:Te.updateMany,deleteFormIdentifier:Te.deleteOne,deleteFormIdentifiers:Te.deleteMany}}),{initializeFormIdentifiers:Gh,addFormIdentifier:Hh,addFormIdentifiers:Wh,setFormIdentifier:Kh,setFormIdentifiers:Yh,updateFormIdentifier:Zh,updateFormIdentifiers:Jh,deleteFormIdentifier:Xh,deleteFormIdentifiers:Qh}=ui.actions,xh=t=>t.formIdentifierReducer.instances,li=o.createSelector([xh],t=>Object.values(t)),em=t=>s=>s.formIdentifierReducer.instances[t],tm=S(o.createSelector([li,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),tF=S(o.createSelector([li,(t,s)=>s],(t,s)=>T(t.filter(e=>e.form===s)))),sm=ui.reducer,Ie=R(t=>t.uuid),im={instances:{}},oi=o.createSlice({name:"formIdentifierValues",initialState:im,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,im)),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:nm,addFormIdentifierValue:am,addFormIdentifierValues:cm,setFormIdentifierValue:dm,setFormIdentifierValues:rm,updateFormIdentifierValue:um,updateFormIdentifierValues:lm,deleteFormIdentifierValue:om,deleteFormIdentifierValues:hm}=oi.actions,mm=t=>t.formIdentifierValueReducer.instances,Mt=o.createSelector([mm],t=>Object.values(t)),ym=t=>s=>s.formIdentifierValueReducer.instances[t],pm=S(o.createSelector([Mt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),sF=S(o.createSelector([Mt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.form_submission===s)))),iF=S(o.createSelector([Mt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.form_identifier===s)))),Am=oi.reducer,Oe=R(t=>t.uuid),fm={instances:{}},hi=o.createSlice({name:"formRevisionAttachments",initialState:fm,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,fm)),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:Sm,addFormRevisionAttachment:Tm,addFormRevisionAttachments:Im,setFormRevisionAttachment:Om,setFormRevisionAttachments:Pm,updateFormRevisionAttachment:Fm,updateFormRevisionAttachments:gm,deleteFormRevisionAttachment:bm,deleteFormRevisionAttachments:_m}=hi.actions,Rt=t=>t.formRevisionAttachmentReducer.instances,Mm=o.createSelector([Rt],t=>Object.values(t)),Rm=S(o.createSelector([Rt,(t,s)=>s],(t,s)=>t[s])),wm=S(o.createSelector([Mm,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),nF=S(o.createSelector([Rt,(t,s)=>s],(t,s)=>T(Object.values(t).filter(e=>e.form_revision===s)))),Em=hi.reducer,Pe=R(t=>t.uuid),vm={instances:{}},mi=o.createSlice({name:"formRevisions",initialState:vm,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,vm)),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:yi,addFormRevisions:pi,setFormRevision:zm,setFormRevisions:Bm,updateFormRevision:jm,updateFormRevisions:qm,deleteFormRevision:Ai,deleteFormRevisions:fi}=mi.actions,Si=t=>t.formRevisionReducer.instances,wt=o.createSelector([Si],t=>Object.values(t)),Dm=t=>s=>s.formRevisionReducer.instances[t],Cm=S(o.createSelector([wt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),aF=S(o.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])),$m=S(o.createSelector([wt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.form===s)))),Um=mi.reducer,Fe=R(t=>t.uuid),Lm={instances:{}},Ti=o.createSlice({name:"forms",initialState:Lm,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,Lm)),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:Nm,addForms:Gm,setForm:Hm,setForms:Wm,updateForm:Km,updateForms:Ym,deleteForm:Zm,deleteForms:Jm}=Ti.actions,Xm=Ti.reducer,Qm=t=>t.formReducer.instances,Ii=o.createSelector([Qm],t=>Object.values(t)),xm=t=>s=>s.formReducer.instances[t],ey=S(o.createSelector([Ii,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),cF=S(o.createSelector([Ii,(t,s)=>s],(t,s)=>T(t.filter(e=>e.organization===s)))),ge=R(t=>t.uuid),ty={instances:{}},Oi=o.createSlice({name:"formSubmissionAttachments",initialState:ty,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,ty)),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:sy,addFormSubmissionAttachment:iy,addFormSubmissionAttachments:Pi,setFormSubmissionAttachment:ny,setFormSubmissionAttachments:ay,updateFormSubmissionAttachment:cy,updateFormSubmissionAttachments:dy,deleteFormSubmissionAttachment:ry,deleteFormSubmissionAttachments:Fi}=Oi.actions,gi=t=>t.formSubmissionAttachmentReducer.instances,bi=o.createSelector([gi],t=>Object.values(t)),uy=S(o.createSelector([gi,(t,s)=>s],(t,s)=>t[s])),_i=S(o.createSelector([bi,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(n=>e.has(n.uuid)))})),ly=_i,oy=S(o.createSelector([bi,(t,s)=>s],(t,s)=>T(t.filter(e=>e.form_submission===s)))),hy=Oi.reducer,be=R(t=>t.uuid),my={instances:{}},Mi=o.createSlice({name:"formSubmissions",initialState:my,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,my)),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:yy,setFormSubmission:py,setFormSubmissions:Ay,addFormSubmission:fy,addFormSubmissions:Ri,updateFormSubmission:Sy,updateFormSubmissions:Ty,deleteFormSubmission:Iy,deleteFormSubmissions:wi}=Mi.actions,Ei=t=>t.formSubmissionReducer.instances,Oy=o.createSelector([Ei],t=>Object.values(t)),Py=t=>s=>s.formSubmissionReducer.instances[t],Fy=S(o.createSelector([Oy,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),gy=S(o.createSelector([Ei,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))})),by=Mi.reducer,_e=R(t=>t.uuid),_y={instances:{}},vi=o.createSlice({name:"geoImages",initialState:_y,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,_y)),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:My,setGeoImage:Ry,setGeoImages:wy,addGeoImage:Ey,addGeoImages:vy,updateGeoImage:Vy,updateGeoImages:zy,deleteGeoImage:By,deleteGeoImages:jy}=vi.actions,qy=t=>t.geoImageReducer.instances,Vi=o.createSelector([qy],t=>Object.values(t)),Dy=t=>s=>s.geoImageReducer.instances[t],Cy=S(o.createSelector([Vi,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),dF=S(o.createSelector([Vi,(t,s)=>s],(t,s)=>T(t.filter(e=>e.project===s)))),$y=vi.reducer,Me=R(t=>t.uuid),Uy={instances:{}},zi=o.createSlice({name:"issueAssociations",initialState:Uy,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,Uy)),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:Ly,setIssueAssociations:ky,setIssueAssociation:Ny,updateIssueAssociation:Gy,updateIssueAssociations:Hy,addIssueAssociation:Wy,addIssueAssociations:Et,deleteIssueAssociation:Ky,deleteIssueAssociations:vt}=zi.actions,ot=t=>t.issueAssociationReducer.instances,Yy=o.createSelector([ot],t=>Object.values(t)),Zy=t=>s=>s.issueAssociationReducer.instances[t],Jy=S(o.createSelector([Yy,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),Xy=S(o.createSelector([ot,(t,s)=>s],(t,s)=>T(Object.values(t).filter(e=>e.associated_issue===s)))),Qy=S(o.createSelector([ot,(t,s)=>s],(t,s)=>T(Object.values(t).filter(e=>e.issue===s)))),xy=S(o.createSelector([ot,(t,s)=>s],(t,s)=>T(Object.values(t).filter(e=>e.asset===s)))),ep=zi.reducer,Re=R(t=>t.uuid),tp={instances:{}},Bi=o.createSlice({name:"issueAttachments",initialState:tp,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,tp)),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:sp,addIssueAttachment:ip,addIssueAttachments:ji,setIssueAttachment:np,setIssueAttachments:ap,updateIssueAttachment:cp,updateIssueAttachments:dp,deleteIssueAttachment:rp,deleteIssueAttachments:qi}=Bi.actions,up=t=>t.issueAttachmentReducer.instances,Di=o.createSelector([up],t=>Object.values(t)),lp=S(o.createSelector([Di,(t,s)=>s],(t,s)=>T(t.filter(({issue:e})=>s===e)))),op=t=>s=>s.issueAttachmentReducer.instances[t],hp=S(o.createSelector([Di,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),mp=Bi.reducer,we=R(t=>t.uuid),yp={instances:{}},Ci=o.createSlice({name:"issueCommentAttachments",initialState:yp,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,yp)),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:pp,addIssueCommentAttachment:Ap,addIssueCommentAttachments:fp,setIssueCommentAttachment:Sp,setIssueCommentAttachments:Tp,updateIssueCommentAttachment:Ip,updateIssueCommentAttachments:Op,deleteIssueCommentAttachment:Pp,deleteIssueCommentAttachments:Fp}=Ci.actions,gp=t=>t.issueCommentAttachmentReducer.instances,$i=o.createSelector([gp],t=>Object.values(t)),bp=t=>s=>s.issueCommentAttachmentReducer.instances[t],_p=S(o.createSelector([$i,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),rF=S(o.createSelector([$i,(t,s)=>s],(t,s)=>T(t.filter(({issue_comment:e})=>s===e)))),Mp=Ci.reducer,Ee=R(t=>t.uuid),Rp={instances:{}},Ui=o.createSlice({name:"issueComments",initialState:Rp,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,Rp)),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:wp,addIssueComment:Ep,addIssueComments:vp,setIssueComment:Vp,setIssueComments:zp,updateIssueComment:Bp,updateIssueComments:jp,deleteIssueComment:qp,deleteIssueComments:Dp}=Ui.actions,Li=t=>t.issueCommentReducer.instances,Cp=t=>s=>s.issueCommentReducer.instances[t],$p=S(o.createSelector([Li,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(Object.values(t).filter(({uuid:n})=>e.has(n)))})),uF=S(o.createSelector([Li,(t,s)=>s],(t,s)=>T(Object.values(t).filter(e=>e.issue===s)))),Up=Ui.reducer,ve=R(t=>t.uuid),Lp={instances:{}},ki=o.createSlice({name:"issues",initialState:Lp,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,Lp)),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:Np,addIssues:Ni,setIssue:Gp,setIssues:Hp,updateIssue:Wp,updateIssues:Kp,deleteIssue:Yp,deleteIssues:Gi}=ki.actions,Zp=t=>t.issueReducer.instances,Vt=o.createSelector([Zp],t=>Object.values(t)),Jp=t=>s=>s.issueReducer.instances[t],Xp=S(o.createSelector([Vt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),lF=S(o.createSelector([Vt,(t,s)=>s],(t,s)=>t.filter(e=>e.project===s))),Qp=S(o.createSelector([Vt,(t,s)=>s],(t,s)=>t.filter(e=>e.issue_type===s))),xp=ki.reducer,Ve=R(t=>t.uuid),eA={instances:{}},Hi=o.createSlice({name:"issueTypeAttachments",initialState:eA,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,eA)),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:tA,addIssueTypeAttachment:sA,addIssueTypeAttachments:iA,setIssueTypeAttachment:nA,setIssueTypeAttachments:aA,updateIssueTypeAttachment:cA,updateIssueTypeAttachments:dA,deleteIssueTypeAttachment:rA,deleteIssueTypeAttachments:uA}=Hi.actions,lA=t=>t.issueTypeAttachmentReducer.instances,Wi=o.createSelector([lA],t=>Object.values(t)),oA=t=>s=>s.issueTypeAttachmentReducer.instances[t],hA=S(o.createSelector([Wi,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),oF=S(o.createSelector([Wi,(t,s)=>s],(t,s)=>T(t.filter(({issue_type:e})=>s===e)))),mA=Hi.reducer,ze=R(t=>t.uuid),yA={instances:{}},Ki=o.createSlice({name:"issueTypeFieldsAttachments",initialState:yA,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,yA)),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:pA,addIssueTypeFieldsAttachment:AA,addIssueTypeFieldsAttachments:fA,setIssueTypeFieldsAttachment:SA,setIssueTypeFieldsAttachments:TA,updateIssueTypeFieldsAttachment:IA,updateIssueTypeFieldsAttachments:OA,deleteIssueTypeFieldsAttachment:PA,deleteIssueTypeFieldsAttachments:FA}=Ki.actions,gA=t=>t.issueTypeFieldsAttachmentReducer.instances,Yi=o.createSelector([gA],t=>Object.values(t)),hF=S(o.createSelector([Yi,(t,s)=>s],(t,s)=>T(t.filter(e=>e.fields_revision===s)))),bA=t=>s=>s.issueTypeFieldsAttachmentReducer.instances[t],_A=S(o.createSelector([Yi,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),MA=Ki.reducer,Be=R(t=>t.uuid),RA={instances:{}},Zi=o.createSlice({name:"issueTypeFieldValues",initialState:RA,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,RA)),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:wA,addIssueTypeFieldValues:EA,addIssueTypeFieldValuesMany:vA,setIssueTypeFieldValues:VA,setIssueTypeFieldValuesMany:zA,updateIssueTypeFieldValues:BA,updateIssueTypeFieldValuesMany:jA,deleteIssueTypeFieldValues:qA,deleteIssueTypeFieldValuesMany:DA}=Zi.actions,CA=t=>t.issueTypeFieldValuesReducer.instances,zt=o.createSelector([CA],t=>Object.values(t)),mF=S(o.createSelector([zt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.issue===s)))),$A=t=>s=>s.issueTypeFieldValuesReducer.instances[t],UA=S(o.createSelector([zt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),LA=Zi.reducer,je=R(t=>t.uuid),kA={instances:{}},Ji=o.createSlice({name:"issueTypeFields",initialState:kA,extraReducers:t=>t.addMatcher(o.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:NA,addIssueTypeFields:GA,addIssueTypeFieldsMany:HA,setIssueTypeFields:WA,setIssueTypeFieldsMany:KA,updateIssueTypeFields:YA,updateIssueTypeFieldsMany:ZA,deleteIssueTypeFields:JA,deleteIssueTypeFieldsMany:XA}=Ji.actions,QA=t=>t.issueTypeFieldsReducer.instances,ht=o.createSelector([QA],t=>Object.values(t)),yF=S(o.createSelector([ht,(t,s)=>s],(t,s)=>T(t.filter(e=>e.issue_type===s)))),pF=S(o.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])),AF=S(o.createSelector([ht,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)))})),xA=t=>s=>s.issueTypeFieldsReducer.instances[t],ef=S(o.createSelector([ht,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),tf=Ji.reducer,qe=R(t=>t.uuid),sf={instances:{}},Xi=o.createSlice({name:"issueTypeFieldValuesAttachments",initialState:sf,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,sf)),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:nf,addIssueTypeFieldValuesAttachment:af,addIssueTypeFieldValuesAttachments:Qi,setIssueTypeFieldValuesAttachment:cf,setIssueTypeFieldValuesAttachments:df,updateIssueTypeFieldValuesAttachment:rf,updateIssueTypeFieldValuesAttachments:uf,deleteIssueTypeFieldValuesAttachment:lf,deleteIssueTypeFieldValuesAttachments:xi}=Xi.actions,of=t=>t.issueTypeFieldValuesAttachmentReducer.instances,en=o.createSelector([of],t=>Object.values(t)),hf=t=>s=>s.issueTypeFieldValuesAttachmentReducer.instances[t],mf=S(o.createSelector([en,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),yf=S(o.createSelector([en,(t,s)=>s],(t,s)=>T(t.filter(e=>e.field_values===s)))),pf=Xi.reducer,De=R(t=>t.uuid),Af={instances:{}},tn=o.createSlice({name:"issueTypeIdentifiers",initialState:Af,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,Af)),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:ff,addIssueTypeIdentifier:Sf,addIssueTypeIdentifiers:Tf,setIssueTypeIdentifier:If,setIssueTypeIdentifiers:Of,updateIssueTypeIdentifier:Pf,updateIssueTypeIdentifiers:Ff,deleteIssueTypeIdentifier:gf,deleteIssueTypeIdentifiers:bf}=tn.actions,_f=t=>t.issueTypeIdentifierReducer.instances,sn=o.createSelector([_f],t=>Object.values(t)),Mf=t=>s=>s.issueTypeIdentifierReducer.instances[t],Rf=S(o.createSelector([sn,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),fF=S(o.createSelector([sn,(t,s)=>s],(t,s)=>T(t.filter(e=>e.issue_type===s)))),wf=tn.reducer,Ce=R(t=>t.uuid),Ef={instances:{}},nn=o.createSlice({name:"issueTypeIdentifierValues",initialState:Ef,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,Ef)),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:vf,addIssueTypeIdentifierValue:Vf,addIssueTypeIdentifierValues:zf,setIssueTypeIdentifierValue:Bf,setIssueTypeIdentifierValues:jf,updateIssueTypeIdentifierValue:qf,updateIssueTypeIdentifierValues:Df,deleteIssueTypeIdentifierValue:Cf,deleteIssueTypeIdentifierValues:$f}=nn.actions,Uf=t=>t.issueTypeIdentifierValueReducer.instances,Bt=o.createSelector([Uf],t=>Object.values(t)),Lf=t=>s=>s.issueTypeIdentifierValueReducer.instances[t],kf=S(o.createSelector([Bt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),SF=S(o.createSelector([Bt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.issue===s)))),TF=S(o.createSelector([Bt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.issue_type_identifier===s)))),Nf=nn.reducer,$e=R(t=>t.uuid),Gf={instances:{}},an=o.createSlice({name:"issueTypes",initialState:Gf,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,Gf)),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:Hf,addIssueType:Wf,addIssueTypes:Kf,setIssueType:Yf,setIssueTypes:Zf,updateIssueType:Jf,updateIssueTypes:Xf,deleteIssueType:Qf,deleteIssueTypes:xf}=an.actions,eS=t=>t.issueTypeReducer.instances,cn=o.createSelector(eS,t=>Object.values(t)),tS=t=>s=>s.issueTypeReducer.instances[t],sS=S(o.createSelector([cn,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),IF=S(o.createSelector([cn,(t,s)=>s],(t,s)=>T(t.filter(e=>e.organization===s)))),iS=an.reducer,Ue=R(t=>t.uuid),nS={instances:{}},dn=o.createSlice({name:"issueTypeStatuses",initialState:nS,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,nS)),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:aS,addIssueTypeStatus:cS,addIssueTypeStatuses:dS,setIssueTypeStatus:rS,setIssueTypeStatuses:uS,updateIssueTypeStatus:lS,updateIssueTypeStatuses:oS,deleteIssueTypeStatus:hS,deleteIssueTypeStatuses:mS}=dn.actions,yS=t=>t.issueTypeStatusReducer.instances,rn=o.createSelector([yS],t=>T(Object.values(t).toSorted(ca))),un=t=>s=>s.issueTypeStatusReducer.instances[t],pS=S(o.createSelector([rn,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),OF=S(o.createSelector([rn,(t,s)=>s],(t,s)=>T(t.filter(e=>e.issue_type===s)))),AS=dn.reducer,Le=R(t=>t.uuid),fS={instances:{}},ln=o.createSlice({name:"issueUpdates",initialState:fS,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,fS)),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:SS,addIssueUpdate:on,addIssueUpdates:hn,setIssueUpdate:TS,setIssueUpdates:IS,updateIssueUpdate:OS,updateIssueUpdates:PS,deleteIssueUpdate:mn,deleteIssueUpdates:yn}=ln.actions,pn=t=>t.issueUpdateReducer.instances,An=o.createSelector([pn],t=>Object.values(t)),FS=S(o.createSelector([pn,(t,s)=>s],(t,s)=>t[s])),gS=S(o.createSelector([An,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),bS=S(o.createSelector([An,(t,s)=>s],(t,s)=>T(t.filter(e=>e.issue===s)))),_S=ln.reducer,ke=R(t=>t.id),MS={instances:{},currentUser:null},fn=o.createSlice({name:"users",initialState:MS,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,MS)),reducers:{initializeUsers:ke.initialize,setUsers:ke.setMany,setUser:ke.setOne,addUsers:ke.addMany,addUser:ke.addOne,updateUsers:ke.updateMany,updateUser:ke.updateOne,deleteUser:ke.deleteOne,deleteUsers:ke.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:RS,setUsers:wS,setUser:ES,addUsers:vS,addUser:Sn,updateUsers:VS,updateUser:zS,deleteUser:Tn,deleteUsers:BS,setCurrentUser:PF,setProfilePicture:FF}=fn.actions,jS=fn.reducer,qS=t=>t.userReducer.currentUser,In=t=>t.userReducer.instances,jt=o.createSelector([In],t=>Object.values(t)),qt=t=>s=>s.userReducer.instances[t],DS=S(o.createSelector([jt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({id:n})=>e.has(n)))})),Ne=R(t=>t.uuid),CS={instances:{}},On=o.createSlice({name:"organizationAccess",initialState:CS,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,CS)),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:$S,addOrganizationAccess:US,addOrganizationAccesses:LS,setOrganizationAccess:kS,setOrganizationAccesses:NS,updateOrganizationAccess:GS,updateOrganizationAccesses:HS,deleteOrganizationAccess:WS,deleteOrganizationAccesses:KS}=On.actions,YS=On.reducer,Dt=t=>t.organizationAccessReducer.instances,ZS=t=>s=>s.organizationAccessReducer.instances[t],JS=S(o.createSelector([Dt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(Object.values(t).filter(({uuid:n})=>e.has(n)))})),gF=o.createSelector([qS,Dt],(t,s)=>Object.values(s).find(n=>n.user===(t==null?void 0:t.id))??null),XS=o.createSelector([Dt],t=>{const s={};for(const e of Object.values(t))s[e.user]=e;return pt(s)}),bF=S(o.createSelector([In,XS,(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),QS={instances:{}},Pn=o.createSlice({name:"organizations",initialState:QS,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,QS)),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:xS,setOrganizations:eT,setOrganization:tT,addOrganizations:sT,addOrganization:iT,updateOrganizations:nT,updateOrganization:aT,deleteOrganization:cT,deleteOrganizations:dT}=Pn.actions,rT=t=>t.organizationReducer.instances,uT=o.createSelector([rT],t=>Object.values(t)),lT=t=>s=>s.organizationReducer.instances[t],oT=S(o.createSelector([uT,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),hT=Pn.reducer,mT=(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}}}}},yT={deletedRequests:[],latestRetryTime:0},Fn=o.createSlice({name:"outbox",initialState:yT,extraReducers:t=>t.addCase(_,s=>Object.assign(s,yT)),reducers:{enqueueRequest:{reducer:(t,s)=>t,prepare:t=>{console.debug("Preparing to enqueue request",t);const{BASE_URL:s,serviceName:e,...n}=t;return mT(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}}}),_F=t=>t.outboxReducer.deletedRequests,MF=t=>t.outboxReducer.latestRetryTime,{enqueueRequest:pT,markForDeletion:RF,markAsDeleted:AT,_setLatestRetryTime:fT}=Fn.actions,ST=Fn.reducer,He=R(t=>t.uuid),TT={instances:{}},gn=o.createSlice({name:"projectAccess",initialState:TT,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,TT)),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:IT,addProjectAccess:OT,addProjectAccesses:PT,setProjectAccess:FT,setProjectAccesses:gT,updateProjectAccess:bT,updateProjectAccesses:_T,deleteProjectAccess:MT,deleteProjectAccesses:RT}=gn.actions,wT=gn.reducer,bn=t=>t.projectAccessReducer.instances,mt=o.createSelector(bn,t=>Object.values(t)),ET=t=>s=>s.projectAccessReducer.instances[t],vT=S(o.createSelector([mt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),wF=S(o.createSelector([bn,(t,s)=>s],(t,s)=>T(Object.values(t).filter(e=>e.project===s)))),EF=S(o.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=S(o.createSelector([jt,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)))})),We=R(t=>t.uuid),VT={instances:{}},_n=o.createSlice({name:"projectAttachments",initialState:VT,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,VT)),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:zT,addProjectAttachment:BT,addProjectAttachments:jT,setProjectAttachment:qT,setProjectAttachments:DT,updateProjectAttachment:CT,updateProjectAttachments:$T,deleteProjectAttachment:UT,deleteProjectAttachments:LT}=_n.actions,kT=t=>t.projectAttachmentReducer.instances,Mn=o.createSelector([kT],t=>Object.values(t)),NT=t=>s=>s.projectAttachmentReducer.instances[t],GT=S(o.createSelector([Mn,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),VF=S(o.createSelector([Mn,(t,s)=>s],(t,s)=>T(t.filter(({project:e})=>s===e)))),HT=_n.reducer,Ke=R(t=>t.uuid),WT={instances:{},activeProjectFileId:null,isImportingProjectFile:!1},Rn=o.createSlice({name:"projectFiles",initialState:WT,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,WT)),reducers:{initializeProjectFiles:Ke.initialize,setProjectFile:Ke.setOne,setProjectFiles:Ke.setMany,addProjectFile:Ke.addOne,addProjectFiles:Ke.addMany,updateProjectFile:Ke.updateOne,updateProjectFiles:Ke.updateMany,deleteProjectFile:Ke.deleteOne,deleteProjectFiles:Ke.deleteMany,setIsImportingProjectFile:(t,s)=>{t.isImportingProjectFile=s.payload},saveActiveProjectFileBounds:(t,s)=>{const e=t.activeProjectFileId;if(!e)throw new Error("Tried to save bounds for active project file, but no active project file was set.");if(!t.instances[e])throw new Error(`Tried to save bounds for active project file, but project file with ID ${e}
2
+ doesn't exist.`);t.instances[e].bounds=s.payload},setActiveProjectFileId:(t,s)=>{t.activeProjectFileId=s.payload}}}),{initializeProjectFiles:KT,setProjectFile:YT,setProjectFiles:ZT,addProjectFile:JT,addProjectFiles:XT,updateProjectFile:QT,updateProjectFiles:xT,deleteProjectFile:eI,deleteProjectFiles:tI,setIsImportingProjectFile:sI,setActiveProjectFileId:iI,saveActiveProjectFileBounds:nI}=Rn.actions,aI=t=>t.projectFileReducer.instances,cI=o.createSelector([aI],t=>T(Object.values(t).sort((s,e)=>s.z_index-e.z_index))),dI=t=>s=>s.projectFileReducer.instances[t],rI=S(o.createSelector([cI,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),zF=t=>t.projectFileReducer.activeProjectFileId,BF=t=>t.projectFileReducer.isImportingProjectFile,uI=Rn.reducer,Ye=R(t=>t.uuid),lI={instances:{}},wn=o.createSlice({name:"projects",initialState:lI,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,lI)),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:oI,setProjects:hI,setProject:mI,addProjects:yI,addProject:pI,updateProjects:AI,updateProject:fI,deleteProject:SI,deleteProjects:TI}=wn.actions,II=wn.reducer,OI=t=>t.projectReducer.instances,Ct=o.createSelector([OI],t=>Object.values(t)),PI=t=>s=>s.projectReducer.instances[t],FI=S(o.createSelector([Ct,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),jF=S(o.createSelector([Ct,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)))})),qF=S(o.createSelector([Ct,(t,s)=>s],(t,s)=>T(t.filter(e=>e.organization===s)))),DF={isRehydrated:!1},En=o.createSlice({name:"rehydrated",initialState:DF,reducers:{setRehydrated:(t,s)=>{t.isRehydrated=s.payload}}}),{setRehydrated:CF}=En.actions,$F=t=>t.rehydratedReducer.isRehydrated,gI=En.reducer,Ze=R(t=>t.uuid),bI={instances:{}},vn=o.createSlice({name:"teamMemberships",initialState:bI,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,bI)),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:_I,addTeamMembership:MI,addTeamMemberships:RI,setTeamMembership:wI,setTeamMemberships:EI,updateTeamMembership:vI,updateTeamMemberships:VI,deleteTeamMembership:zI,deleteTeamMemberships:BI}=vn.actions,jI=vn.reducer,qI=t=>t.teamMembershipReducer.instances,$t=o.createSelector([qI],t=>Object.values(t)),DI=t=>s=>s.teamMembershipReducer.instances[t],CI=S(o.createSelector([$t,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),UF=S(o.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})),LF=S(o.createSelector([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)))})),Je=R(t=>t.uuid),$I={instances:{}},Vn=o.createSlice({name:"teams",initialState:$I,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,$I)),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:UI,addTeam:LI,addTeams:kI,setTeam:NI,setTeams:GI,updateTeam:HI,updateTeams:WI,deleteTeam:KI,deleteTeams:YI}=Vn.actions,ZI=t=>t.teamReducer.instances,zn=o.createSelector([ZI],t=>Object.values(t)),JI=t=>s=>s.teamReducer.instances[t],XI=S(o.createSelector([zn,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),kF=S(o.createSelector([zn,(t,s)=>s],(t,s)=>T(t.filter(e=>e.organization===s)))),QI=Vn.reducer,NF={version:0},xI=o.createSlice({name:"versioning",initialState:NF,reducers:{}}),eO=xI.reducer,Bn={outboxReducer:ST,fileReducer:kh,authReducer:qo},GF=o.combineReducers(Bn),tO={...Bn,[rt]:eO,categoryReducer:Zo,assetReducer:kr,assetAttachmentReducer:Ma,assetStageCompletionReducer:xr,assetStageReducer:yu,assetTypeReducer:To,assetTypeAttachmentReducer:wu,issueReducer:xp,issueAttachmentReducer:mp,issueTypeReducer:iS,issueTypeAttachmentReducer:mA,organizationReducer:hT,projectReducer:II,projectAttachmentReducer:HT,projectAccessReducer:wT,organizationAccessReducer:YS,projectFileReducer:uI,rehydratedReducer:gI,formReducer:Xm,formRevisionReducer:Um,formRevisionAttachmentReducer:Em,formSubmissionAttachmentReducer:hy,formSubmissionReducer:by,formIdentifierReducer:sm,formIdentifierValueReducer:Am,userReducer:jS,emailDomainsReducer:Dh,documentsReducer:Ih,documentAttachmentReducer:uh,teamReducer:QI,agentsReducer:ya,issueCommentReducer:Up,issueCommentAttachmentReducer:Mp,issueUpdateReducer:_S,geoImageReducer:$y,issueAssociationReducer:ep,issueTypeFieldsReducer:tf,issueTypeFieldValuesReducer:LA,issueTypeFieldsAttachmentReducer:MA,issueTypeFieldValuesAttachmentReducer:pf,issueTypeIdentifierReducer:wf,issueTypeIdentifierValueReducer:Nf,issueTypeStatusReducer:AS,assetTypeFieldsReducer:il,assetTypeFieldValuesReducer:El,assetTypeFieldsAttachmentReducer:Nu,assetTypeFieldValuesAttachmentReducer:Al,assetTypeIdentifierReducer:Gl,assetTypeIdentifierValueReducer:no,assetTypeStatusReducer:zo,assetProcedureTypeReducer:hd,assetProcedureReducer:Xc,assetProcedureTypeFieldsReducer:hc,assetProcedureTypeFieldValuesReducer:$c,assetProcedureTypeFieldsAttachmentReducer:Qa,assetProcedureTypeFieldValuesAttachmentReducer:gc,assetProcedureTypeAttachmentReducer:Ca,assetProcedureStepFieldsAttachmentReducer:wd,assetProcedureStepFieldsReducer:kd,assetProcedureStepFieldValuesAttachmentReducer:tr,assetProcedureStepFieldValuesReducer:pr,assetProcedureStepReducer:_r,teamMembershipReducer:jI},HF=o.combineReducers(tO),sO=1e4,iO=200,jn=[400,409,403,404,405,500],k=1e4,nO={};class aO{constructor(s){y(this,"client");y(this,"pageSize",sO);nO[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 cO=()=>uO.length-1,dO=t=>(t[rt]={version:cO()},t),rO=()=>dO({}),WF=t=>(t.outboxReducer&&(t.outboxReducer.deletedRequests=[]),t),KF=t=>s=>{var e;return s===void 0&&(s={}),((e=s[rt])==null?void 0:e.version)===cO()?s:t(s)},uO=[dO,rO,rO,WF],YF=Object.fromEntries(uO.map((t,s)=>[s,KF(t)])),ZF=t=>{if(t)throw t;const s=dt();s?s.dispatch({type:"rehydrated/setRehydrated",payload:!0}):console.error("Client store not set")},lO=(t,s,e)=>{const n=tt();return n?(n.addRequest(s),n.getQueue()):(console.warn("Outbox coordinator not set; cannot enqueue request yet."),[])},oO=(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 JF(t,s){if(!s.payload)throw new Error("Received empty payload");return gO(s)}const XF={...Gn,effect:JF,discard:mO,returnPromises:!0,persistCallback:ZF,retry:tg,persistOptions:{storage:vO},queue:{...Gn.queue,enqueue:lO,dequeue:oO,peek:(...t)=>eg(...t)}},QF=VO(YF,rt),xF=o.compose(EO.offline(XF),QF);async function hO(t,s,e){if(s.store.getState().outboxReducer.deletedRequests.includes(t.payload.uuid))throw new Error("Request was marked for deletion");const a=nO[t.meta.offline.effect.serviceName];if(!a)throw new Error(`Service ${t.meta.offline.effect.serviceName} not found`);return $n(t.meta.offline.effect.BASE_URL,t.meta.offline.effect.request,s,a,e)}function mO(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(AT(r));const h=tt();if(!h)throw new Error("Outbox coordinator not set");h.remove(s.payload.uuid);const p=s.meta.offline.rollback;throw p&&(console.warn("Rolling back request due to SDK error:",s),n.dispatch(p)),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 h=t.status||((d=t.response)==null?void 0:d.status);if(h||console.warn("Error has no status code:",t),h!==void 0&&qn.includes(h)){console.warn("Discarding request due to error:",t,`
5
- Action:`,s);const p=tt();if(!p)throw new Error("Outbox coordinator not set");p.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 eg(t,s,e){var n;return(n=tt())==null?void 0:n.peek()}function tg(t,s){return dt().dispatch(fT(new Date().getTime())),Qn}const nt="An unknown error occurred",sg=500,yO=["non_field_errors","detail"];function ig(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"?yO.includes(a)?c:`${a}: ${c}`:Array.isArray(c)?yO.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=dt(),c=n.getState().outboxReducer.deletedRequests,r=s.payload.uuid;function l(){n.dispatch(AT(r));const h=tt();if(!h)throw new Error("Outbox coordinator not set");h.remove(s.payload.uuid);const p=s.meta.offline.rollback;throw p&&(console.warn("Rolling back request due to SDK error:",s),n.dispatch(p)),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 h=t.status||((d=t.response)==null?void 0:d.status);if(h||console.warn("Error has no status code:",t),h!==void 0&&jn.includes(h)){console.warn("Discarding request due to error:",t,`
5
+ Action:`,s);const p=tt();if(!p)throw new Error("Outbox coordinator not set");p.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 eg(t,s,e){var n;return(n=tt())==null?void 0:n.peek()}function tg(t,s){return dt().dispatch(fT(new Date().getTime())),Xn}const nt="An unknown error occurred",sg=500,yO=["non_field_errors","detail"];function ig(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"?yO.includes(a)?c:`${a}: ${c}`:Array.isArray(c)?yO.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>sg?nt:e}class U extends Error{constructor(e){super(nt);y(this,"status");y(this,"response");y(this,"message");y(this,"options");const{response:n,innerError:a}=e;this.message=e.message??ig(n,a)??nt,this.status=(n==null?void 0:n.status)??0,this.response=n,e.discard=e.discard??!1,this.options=e}}function pO(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 ng extends aO{constructor(s){super(s)}}class et extends aO{constructor(e,n){super(e);y(this,"auth");this.auth=n}}class ag extends et{async startConversation(s,e){return this.enqueueRequest({description:"Start agent conversation",method:m.POST,url:"/agents/prompt/",payload:{prompt:s,active_project:e},blockers:["prompt"],blocks:["prompt"]}).then(n=>(this.dispatch(ha(n)),n))}async continueConversation(s,e,n){return this.enqueueRequest({description:"Prompt agent",method:m.POST,url:"/agents/prompt/",payload:{prompt:s,active_project:n},blockers:["prompt"],blocks:["prompt"],queryParams:{conversation_id:e}}).then(a=>{this.dispatch(ya(a))})}async fetchDetails(s){return this.enqueueRequest({description:"Get agent conversation",method:m.GET,url:`/agents/conversations/${s}/`,blockers:["conversation"],blocks:["conversation"]}).then(e=>{this.dispatch(ma(e))})}async rate(s,e){return this.enqueueRequest({description:"Rate agent response",method:m.PUT,url:`/agents/responses/${s}/rate/`,payload:{rating:e},blockers:["rate"],blocks:["rate"]})}async list(s,e){return this.performRequest({method:m.GET,url:"/agents/conversations/",...s},e)}async refreshStore(s,e){const n=await this.list({queryParams:{project:s}},e);return this.dispatch(oa(n)),n}}function O(t,s,e){const n=`${s}${e?"s":""}`;switch(t){case m.GET:return`Get ${n}`;case m.POST:return`Create ${n}`;case m.PATCH:return`Update ${n}`;case m.PUT:return`Update ${n}`;case m.DELETE:return`Delete ${n}`}}class v extends et{async get(s,e){return this.performRequest({url:`${this.url}/${s}/`,method:m.GET},e)}async list(s,e){return this.performRequest({url:`${this.url}/`,method:m.GET,...s},e)}async listPaginated(s,e){return this.performPagination({url:`${this.url}/`,method:m.GET,...s},e)}}class Xe extends v{constructor(){super(...arguments);y(this,"pageSize",iO)}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=[],h=[],p={};for(const I of e){const{modelUuid:F,file:P}=I,g=await this.client.files.getFilePayload(P);g.sha1 in p||(p[g.sha1]=g);const b=this.buildModel({file:P,file_sha1:g.sha1,submitted_at:u,created_by:l,modelUuid:F});d.push(b),h.push(this.buildPayload(b,g))}this.dispatch(a(d));const A=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:u,attachments:h,files:Object.values(p)},blocks:d.map(I=>this.getId(I)),blockers:d.map(I=>I.file_sha1)});return A.then(({attachments:I,presigned_urls:F})=>{this.dispatch(c(I)),this.client.files.processPresignedUrls(F)}).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:O(m.DELETE,this.name,!1),method:m.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 cg extends Xe{constructor(){super(...arguments);y(this,"name","Asset attachment");y(this,"url","/asset-attachments");y(this,"actions",{addOne:Sa,addMany:Xt,setOne:Ta,setMany:Ia,updateOne:Oa,updateMany:Pa,deleteOne:Fa,deleteMany:Qt,initialize:fa});y(this,"selectors",{selectById:ba,selectByIds:_a})}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 dg extends Xe{constructor(){super(...arguments);y(this,"name","Asset Procedure Attachment");y(this,"url","/asset-procedure-type-attachments");y(this,"actions",{addOne:va,addMany:Va,setOne:za,setMany:Ba,updateOne:ja,updateMany:qa,deleteOne:Da,deleteMany:Ca,initialize:Ea});y(this,"selectors",{selectById:La,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 rg extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Type Fields Attachment");y(this,"url","/asset-procedure-type-fields-attachments");y(this,"actions",{addOne:Ha,addMany:Wa,setOne:Ka,setMany:Ya,updateOne:Za,updateMany:Ja,deleteOne:Xa,deleteMany:Qa,initialize:Ga});y(this,"selectors",{selectById:tc,selectByIds:sc})}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=[],h=[];for(const f of e){const{fieldsRevisionUuid:I,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:I,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:I};h.push(E)}this.dispatch(n(d));const p=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:h,files:Object.values(u)},blockers:d.map(f=>f.fields_revision),blocks:d.map(f=>f.uuid)});return p.then(f=>{this.client.files.processPresignedUrls(f.presigned_urls),this.dispatch(a(f.attachments))}).catch(()=>{this.dispatch(c(d.map(f=>f.uuid)))}),[d,p.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 ug extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Type Fields");y(this,"url","/asset-procedure-type-fields");y(this,"actions",{addOne:ac,addMany:cc,setOne:dc,setMany:rc,updateOne:uc,updateMany:lc,deleteOne:oc,deleteMany:hc,initialize:nc});y(this,"selectors",{selectById:pc,selectByIds:Ac})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.asset_procedure_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(r(d.uuid)),A}),[d,h]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}function 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 lg extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Type Field Values Attachment");y(this,"url","/asset-procedure-type-field-values-attachments");y(this,"actions",{addOne:Tc,addMany:cs,setOne:Ic,setMany:Oc,updateOne:Pc,updateMany:Fc,deleteOne:gc,deleteMany:ds,initialize:Sc});y(this,"selectors",{selectById:Mc,selectByIds:Rc})}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,k)),h=[],p=[];for(const I of d){const F={},P=[];for(const g of I){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});h.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)}p.push({submitted_at:l,attachments:P,files:Object.values(F)})}this.dispatch(a(h));const A=p.map(I=>this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:I,blockers:I.attachments.map(F=>F.field_values),blocks:I.attachments.map(F=>F.uuid)}));return Promise.all(A).then(I=>{for(const P of I)this.client.files.processPresignedUrls(P.presigned_urls);const F=I.flatMap(P=>P.attachments);this.dispatch(c(F))}).catch(I=>{throw this.dispatch(r(h.map(F=>F.uuid))),I}),[h,A.map(I=>I.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:O(m.DELETE,this.name,!0),method:m.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 og extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Type Field Values");y(this,"url","/asset-procedure-type-field-values");y(this,"actions",{addOne:Vc,addMany:zc,setOne:Bc,setMany:jc,updateOne:qc,updateMany:Dc,deleteOne:Cc,deleteMany:$c,initialize:vc});y(this,"selectors",{selectById:kc,selectByIds:Nc})}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(),h=M({...e,created_by:u,submitted_at:d}),p=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(h),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[h.uuid]});return this.dispatch(a(h)),p.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(h.uuid))}),[h,p]}bulkAdd(e,n){var F;const{values:a,payloads:c}=e,{addMany:r,setMany:l,deleteMany:u}=this.actions,d=new Date().toISOString(),h=((F=this.client.store.getState().userReducer.currentUser)==null?void 0:F.id)??null,p=[],A=Qe(c,Math.min(n??c.length,k)),f=[];for(const P of A){const g=[];for(const b of P){const E=M({...b,values:b.values,created_by:h,submitted_at:d});p.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(p));const I=[];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(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:P,blockers:b.concat(E).concat(B),blocks:z});I.push(q)}return Promise.all(I).then(P=>{this.dispatch(l(P.flat()))}).catch(()=>{this.dispatch(u(D(p)))}),[p,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:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[u.fields_revision,u.asset,u.asset_procedure],blocks:[u.uuid]});return d.then(h=>{this.dispatch(a(h))}).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=wc(e)(l);this.dispatch(a(e)),this.dispatch(ds(D(d)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(u)),this.dispatch(cs(d)),h}}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 hg extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure");y(this,"url","/asset-procedures");y(this,"actions",{addOne:Wc,addMany:os,setOne:Jc,setMany:Xc,updateOne:Kc,updateMany:Yc,deleteOne:Zc,deleteMany:hs,initialize:Hc});y(this,"selectors",{selectById:td,selectByIds:sd})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[e.asset_procedure_type,e.asset_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}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:O(m.PATCH,this.name,!1),method:m.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:O(m.DELETE,this.name,!1),method:m.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 mg extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Type");y(this,"url","/asset-procedure-types");y(this,"actions",{addOne:ad,addMany:cd,setOne:od,setMany:hd,updateOne:dd,updateMany:rd,deleteOne:ud,deleteMany:ld,initialize:nd});y(this,"selectors",{selectById:pd,selectByIds:Ad})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}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:O(m.PATCH,this.name,!1),method:m.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=ed(e)(l);this.dispatch(a(e)),this.dispatch(hs(D(d)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(u)),this.dispatch(os(d)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class yg extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Step Fields Attachment");y(this,"url","/asset-procedure-step-fields-attachments");y(this,"actions",{addOne:Td,addMany:Id,setOne:Od,setMany:Pd,updateOne:Fd,updateMany:gd,deleteOne:bd,deleteMany:_d,initialize:Sd});y(this,"selectors",{selectById:Rd,selectByIds:wd})}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=[],h=[];for(const f of e){const{fieldsRevisionUuid:I,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:I,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:I};h.push(E)}this.dispatch(n(d));const p=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:h,files:Object.values(u)},blockers:d.map(f=>f.fields_revision),blocks:d.map(f=>f.uuid)});return p.then(f=>{this.client.files.processPresignedUrls(f.presigned_urls),this.dispatch(a(f.attachments))}).catch(()=>{this.dispatch(c(d.map(f=>f.uuid)))}),[d,p.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 pg extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Step Fields");y(this,"url","/asset-procedure-step-fields");y(this,"actions",{addOne:zd,addMany:Bd,setOne:jd,setMany:qd,updateOne:Dd,updateMany:Cd,deleteOne:$d,deleteMany:Ud,initialize:Vd});y(this,"selectors",{selectById:Ld,selectByIds:kd})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.asset_procedure_step],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(r(d.uuid)),A}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,c=n.getState().assetProcedureStepFieldsReducer.instances[e.uuid];if(!c)throw new Error(`AssetProcedureStepFields with uuid ${e.uuid} not found`);const r={...c,...e};this.dispatch(a(r));const l=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.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(m.DELETE,this.name,!1),method:m.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 Ag extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Step Field Values Attachment");y(this,"url","/asset-procedure-step-field-values-attachments");y(this,"actions",{addOne:Wd,addMany:Is,setOne:Kd,setMany:Yd,updateOne:Zd,updateMany:Jd,deleteOne:Xd,deleteMany:Os,initialize:Hd});y(this,"selectors",{selectById:xd,selectByIds:er})}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,k)),h=[],p=[];for(const I of d){const F={},P=[];for(const g of I){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});h.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)}p.push({submitted_at:l,attachments:P,files:Object.values(F)})}this.dispatch(a(h));const A=p.map(I=>this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:I,blockers:I.attachments.map(F=>F.field_values),blocks:I.attachments.map(F=>F.uuid)}));return Promise.all(A).then(I=>{for(const P of I)this.client.files.processPresignedUrls(P.presigned_urls);const F=I.flatMap(P=>P.attachments);this.dispatch(c(F))}).catch(I=>{throw this.dispatch(r(h.map(F=>F.uuid))),I}),[h,A.map(I=>I.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:O(m.DELETE,this.name,!0),method:m.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 fg extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Step Field Values");y(this,"url","/asset-procedure-step-field-values");y(this,"actions",{addOne:ar,addMany:cr,setOne:dr,setMany:rr,updateOne:ur,updateMany:lr,deleteOne:or,deleteMany:hr,initialize:nr});y(this,"selectors",{selectById:yr,selectByIds:pr})}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(),h=M({...e,created_by:u,submitted_at:d}),p=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(h),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[h.uuid]});return this.dispatch(a(h)),p.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(h.uuid))}),[h,p]}bulkAdd(e,n){var F;const{payloads:a,values:c}=e,{addMany:r,setMany:l,deleteMany:u}=this.actions,d=new Date().toISOString(),h=((F=this.client.store.getState().userReducer.currentUser)==null?void 0:F.id)??null,p=[],A=Qe(a,Math.min(n??a.length,k)),f=[];for(const P of A){const g=[];for(const b of P){const E=M({...b,values:b.values,created_by:h,submitted_at:d});p.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(p));const I=[];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(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:P,blockers:b.concat(E).concat(B),blocks:z});I.push(q)}return Promise.all(I).then(P=>{this.dispatch(l(P.flat()))}).catch(()=>{this.dispatch(u(D(p)))}),[p,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:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[u.fields_revision,u.asset,u.asset_procedure],blocks:[u.uuid]});return d.then(h=>{this.dispatch(a(h))}).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=tr(e)(l);this.dispatch(a(e)),this.dispatch(Os(D(d)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(u)),this.dispatch(Is(d)),h}}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);y(this,"name","Asset Procedure Step");y(this,"url","/asset-procedure-steps");y(this,"actions",{addOne:Or,addMany:Pr,setOne:Tr,setMany:Ir,updateOne:Fr,updateMany:gr,deleteOne:br,deleteMany:_r,initialize:Sr});y(this,"selectors",{selectById:Rr,selectByIds:wr})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.asset_procedure_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}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:O(m.PATCH,this.name,!1),method:m.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(),h=u(e)(d);if(!h)throw new Error(`No asset procedure step with uuid ${e} found in the store`);const p=Er(e)(d);this.dispatch(l(e)),this.dispatch(a(D(p)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(A){throw this.dispatch(r(h)),this.dispatch(c(p)),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 Tg extends v{constructor(){super(...arguments);y(this,"url","/assets");y(this,"name","Asset");y(this,"actions",{addOne:zr,addMany:Ms,setOne:Dr,setMany:Cr,updateOne:Br,updateMany:jr,deleteOne:qr,deleteMany:Rs,initialize:Vr});y(this,"selectors",{selectById:Ur,selectByIds:Lr})}add(e){var p;const{store:n}=this.client,{addOne:a,updateOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.asset_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}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:O(m.PATCH,this.name,!1),method:m.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=Ma(e)(l),h=xy(e)(l);this.dispatch(c(e)),this.dispatch(Qt(D(d))),this.dispatch(Et(D(h)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(p){throw this.dispatch(a(u)),this.dispatch(Xt(d)),this.dispatch(wt(h)),p}}bulkAdd(e,n){const{addMany:a}=this.actions,c=new Date().toISOString(),r=xe.v4(),l=Qe(e,Math.min(n??e.length,k)).map(h=>{const p=h.map(A=>M(A));return{batchId:xe.v4(),payload:{transaction_id:r,submitted_at:c,assets:p}}}),u=[];let d=null;for(const h of l){const{batchId:p,payload:A}=h,f=A.assets.map(({uuid:E})=>E),I=A.assets.map(({asset_type:E})=>E),F=A.assets.map(({project:E})=>E),P=I.concat(F);d&&P.push(d);const g=f;g.push(p);const b=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:A,blockers:P,blocks:g});d=h.batchId,u.push(b)}return Promise.all(u).then(h=>{const p=h.flat();this.dispatch(a(p))}),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(l)(a.getState()).toSorted(Kt);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 h=Qe(e,Math.min(n??e.length,k)),p=[];let A=null;for(const f of h){const I=xe.v4(),F=D(f),P=f.map(({status:b})=>b).filter(Boolean),g=this.enqueueRequest({description:O(m.PATCH,this.name,!0),method:m.PATCH,url:`${this.url}/bulk/`,payload:{payloads:f},blockers:F.concat(P).concat(A?[A]:[]),blocks:F.concat([I])});p.push(g),A=I}return Promise.all(p).then(f=>{this.dispatch(c(f.flat()))}).catch(()=>{this.dispatch(c(u))}),[d,p]}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:O(m.DELETE,this.name,!0),method:m.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 Ig extends v{constructor(){super(...arguments);y(this,"name","Asset Stage Completion");y(this,"url","/asset-stage-completions");y(this,"actions",{addOne:Hr,addMany:Wr,setOne:Kr,setMany:Yr,updateOne:Zr,updateMany:Jr,deleteOne:Xr,deleteMany:Qr,initialize:Gr});y(this,"selectors",{selectById:su,selectByIds:iu})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[e.asset,e.asset_stage],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}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:O(m.DELETE,this.name,!1),method:m.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=>M(I)),h=d.map(I=>({...I,created_by:u,submitted_at:l})),p=h.map(({uuid:I})=>I);this.dispatch(a(h));const A=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.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:p});return A.then(I=>{this.dispatch(c(I))}).catch(()=>{this.dispatch(r(p))}),[h,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:O(m.DELETE,this.name,!0),method:m.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 Og extends v{constructor(){super(...arguments);y(this,"name","Asset Stage");y(this,"url","/asset-stages");y(this,"actions",{addOne:ru,addMany:uu,setOne:cu,setMany:du,updateOne:lu,updateMany:ou,deleteOne:hu,deleteMany:mu,initialize:au});y(this,"selectors",{selectById:pu,selectByIds:Au})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.asset_procedure_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}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:O(m.PATCH,this.name,!1),method:m.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:O(m.DELETE,this.name,!1),method:m.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 Pg extends Xe{constructor(){super(...arguments);y(this,"name","Asset Type Attachment");y(this,"url","/asset-type-attachments");y(this,"actions",{addOne:Tu,addMany:qs,setOne:Iu,setMany:Ou,updateOne:Pu,updateMany:Fu,deleteOne:gu,deleteMany:Ds,initialize:Su});y(this,"selectors",{selectById:_u,selectByIds:Mu})}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 Fg extends v{constructor(){super(...arguments);y(this,"name","Asset Type Fields Attachment");y(this,"url","/asset-type-fields-attachments");y(this,"actions",{addOne:Vu,addMany:zu,setOne:Bu,setMany:ju,updateOne:qu,updateMany:Du,deleteOne:Cu,deleteMany:$u,initialize:vu});y(this,"selectors",{selectById:Lu,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=[],h=[];for(const f of e){const{fieldsRevisionUuid:I,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:I,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:I};h.push(E)}this.dispatch(n(d));const p=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:h,files:Object.values(u)},blockers:d.map(f=>f.fields_revision),blocks:d.map(f=>f.uuid)});return p.then(f=>{this.client.files.processPresignedUrls(f.presigned_urls),this.dispatch(a(f.attachments))}).catch(()=>{this.dispatch(c(d.map(f=>f.uuid)))}),[d,p.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 gg extends v{constructor(){super(...arguments);y(this,"name","Asset Type Fields");y(this,"url","/asset-type-fields");y(this,"actions",{addOne:Wu,addMany:Ku,setOne:Yu,setMany:Zu,updateOne:Ju,updateMany:Xu,deleteOne:Qu,deleteMany:xu,initialize:Hu});y(this,"selectors",{selectById:tl,selectByIds:sl})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.asset_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(r(d.uuid)),A}),[d,h]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class bg extends v{constructor(){super(...arguments);y(this,"name","Asset Type Field Values Attachment");y(this,"url","/asset-type-field-values-attachments");y(this,"actions",{addOne:cl,addMany:Ns,setOne:dl,setMany:rl,updateOne:ul,updateMany:ll,deleteOne:ol,deleteMany:Gs,initialize:al});y(this,"selectors",{selectById:ml,selectByIds:yl})}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,k)),h=[],p=[];for(const I of d){const F={},P=[];for(const g of I){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});h.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)}p.push({submitted_at:l,attachments:P,files:Object.values(F)})}this.dispatch(a(h));const A=p.map(I=>this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:I,blockers:I.attachments.map(F=>F.field_values),blocks:I.attachments.map(F=>F.uuid)}));return Promise.all(A).then(I=>{for(const P of I)this.client.files.processPresignedUrls(P.presigned_urls);const F=I.flatMap(P=>P.attachments);this.dispatch(c(F))}).catch(I=>{throw this.dispatch(r(h.map(F=>F.uuid))),I}),[h,A.map(I=>I.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:O(m.DELETE,this.name,!0),method:m.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 _g extends v{constructor(){super(...arguments);y(this,"name","Asset Type Field Values");y(this,"url","/asset-type-field-values");y(this,"actions",{addOne:Tl,addMany:Il,setOne:Ol,setMany:Pl,updateOne:Fl,updateMany:gl,deleteOne:bl,deleteMany:_l,initialize:Sl});y(this,"selectors",{selectById:Rl,selectByIds:wl})}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(),h=M({...e,created_by:u,submitted_at:d}),p=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(h),blockers:[e.asset,e.fields_revision],blocks:[h.uuid]});return this.dispatch(a(h)),p.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(h.uuid))}),[h,p]}bulkAdd(e,n){var I;const{payloads:a,values:c}=e,{addMany:r,setMany:l,deleteMany:u}=this.actions,d=new Date().toISOString(),h=[],p=Qe(a,Math.min(n??a.length,k)),A=[];for(const F of p){const P=[];for(const g of F){const b=M({...g,values:g.values,created_by:((I=this.client.store.getState().userReducer.currentUser)==null?void 0:I.id)??null,submitted_at:d});h.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(h));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(m.POST,this.name,!0),method:m.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(h)))}),[h,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:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[u.uuid,u.fields_revision,u.asset],blocks:[u.uuid]});return d.then(h=>{this.dispatch(a(h))}).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=pl(e)(l);this.dispatch(a(e)),this.dispatch(Gs(D(d)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(u)),this.dispatch(Ns(d)),h}}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 Mg extends v{constructor(){super(...arguments);y(this,"name","Asset Type Identifier");y(this,"url","/asset-type-identifiers");y(this,"actions",{addOne:zl,addMany:Bl,setOne:jl,setMany:ql,updateOne:Dl,updateMany:Cl,deleteOne:$l,deleteMany:Ul,initialize:Vl});y(this,"selectors",{selectById:kl,selectByIds:Nl})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.asset_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}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:O(m.PATCH,this.name,!1),method:m.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:O(m.DELETE,this.name,!1),method:m.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 Rg extends v{constructor(){super(...arguments);y(this,"name","Asset Type Identifier Value");y(this,"url","/asset-type-identifier-values");y(this,"actions",{addOne:Kl,addMany:Yl,setOne:Zl,setMany:Jl,updateOne:Xl,updateMany:Ql,deleteOne:xl,deleteMany:eo,initialize:Wl});y(this,"selectors",{selectById:so,selectByIds:io})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[e.asset,e.asset_type_identifier],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}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:O(m.PATCH,this.name,!1),method:m.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:O(m.DELETE,this.name,!1),method:m.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 wg extends v{constructor(){super(...arguments);y(this,"name","Asset Type");y(this,"url","/asset-types");y(this,"actions",{addOne:lo,addMany:oo,setOne:ro,setMany:uo,updateOne:ho,updateMany:mo,deleteOne:yo,deleteMany:po,initialize:co});y(this,"selectors",{selectById:fo,selectByIds:So})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}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:O(m.PATCH,this.name,!1),method:m.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=Es(e)(l),h=Ru(e)(l);this.dispatch(a(e)),this.dispatch(Rs(D(d))),this.dispatch(Ds(D(h)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(p){throw this.dispatch(c(u)),this.dispatch(Ms(d)),this.dispatch(qs(h)),p}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class Eg extends v{constructor(){super(...arguments);y(this,"name","Asset Type Status");y(this,"url","/asset-type-statuses");y(this,"actions",{addOne:Po,addMany:Fo,setOne:go,setMany:bo,updateOne:_o,updateMany:Mo,deleteOne:Ro,deleteMany:wo,initialize:Oo});y(this,"selectors",{selectById:vo,selectByIds:Vo})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[e.asset_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}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:O(m.PATCH,this.name,!1),method:m.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:O(m.DELETE,this.name,!1),method:m.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);y(this,"name","Category");y(this,"url","/categories");y(this,"actions",{addOne:$o,addMany:Uo,setOne:Lo,setMany:ko,updateOne:No,updateMany:Go,deleteOne:Ho,deleteMany:Wo,initialize:Co});y(this,"selectors",{selectById:si,selectByIds:Yo})}add(e){var p;const{store:n}=this.client,{addOne:a,updateOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[e.project],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}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:O(m.PATCH,this.name,!1),method:m.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:O(m.DELETE,this.name,!1),method:m.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 Vg extends Xe{constructor(){super(...arguments);y(this,"name","Document Attachment");y(this,"url","/document-attachments");y(this,"actions",{addOne:Qo,addMany:xo,setOne:eh,setMany:th,updateOne:sh,updateMany:ih,deleteOne:nh,deleteMany:ah,initialize:Xo});y(this,"selectors",{selectById:dh,selectByIds:rh})}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 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=[],h=[],p={},A={};for(const F of e){const{documentUuid:P,file:g}=F,b=await this.client.files.getFilePayload(g);b.sha1 in p||(p[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),h.push(this.buildPayload(E,b)),A[b.sha1].push(E.uuid)}this.dispatch(a(d));const f=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:u,attachments:h,files:Object.values(p)},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:m.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 zg extends v{constructor(){super(...arguments);y(this,"name","Document");y(this,"url","/documents");y(this,"actions",{addOne:hh,addMany:mh,setOne:yh,setMany:ph,updateOne:Ah,updateMany:fh,deleteOne:Sh,deleteMany:Th,initialize:oh});y(this,"selectors",{selectById:Oh,selectByIds:Ph})}add(e){var p;const{store:n}=this.client,{addOne:a,deleteOne:c,updateOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:d.parent_document?[d.parent_document]:[],blocks:[d.uuid]});return h.then(A=>{this.dispatch(r(A))}).catch(()=>{this.dispatch(c(d.uuid))}),[d,h]}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:O(m.PATCH,this.name,!1),method:m.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(),h=u(e)(d);if(!h)throw new Error(`attempting to delete a document with uuid ${e} that does not exist in store.documents`);const p=Fh(e)(d);this.dispatch(a(e)),this.dispatch(l(D(p)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(A){throw this.dispatch(c(h)),this.dispatch(r(p)),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:m.GET},e)}async list(s,e){return this.performRequest({url:`${this.url}/`,method:m.GET,...s},e)}async listPaginated(s,e){return this.performPagination({url:`${this.url}/`,method:m.GET,...s},e)}}class Bg extends at{constructor(){super(...arguments);y(this,"name","Email Domains");y(this,"url","/organization-email-domains");y(this,"actions",{addOne:_h,addMany:Mh,setOne:Rh,setMany:wh,updateOne:Eh,updateMany:vh,deleteOne:Vh,deleteMany:zh,initialize:bh});y(this,"selectors",{selectById:jh,selectByIds:qh})}async add(e,n){return this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.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(m.DELETE,this.name,!1),method:m.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 jg extends et{async getVerificationCode(s){return this.enqueueRequest({description:"Get verification code",method:m.GET,url:`/verification/email-verification/${s}/`,isAuthNeeded:!1,blockers:[],blocks:[]})}validateVerificationCode(s,e=void 0){return this.enqueueRequest({description:"Validate verification code",method:m.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 qg=20;class Dg extends et{constructor(){super(...arguments);y(this,"host");y(this,"_dbPromise",zO.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:m.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(Uh({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%qg===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 Lh(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:m.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 h=await ta(e),p=new File([h],a??n,{type:h.type});return await this.addCache(p,n),p}let l=$t[c],u=!0;l?u=!1:(l=new Promise(h=>{this.enqueueRequest({description:"Download file",method:m.GET,url:e,isExternalUrl:!0,isResponseBlob:!0,isAuthNeeded:!1,blockers:[n],blocks:[n]}).then(p=>{const A=new File([p],a??n,{type:p.type});h(A)})}),$t[c]=l);let d;try{d=await l}catch(h){throw u&&h instanceof U&&delete $t[c],h}if(u){const h=await it(d);if(h!==n){const f=`The hash of the file returned from the server (${h}) 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>sg?nt:e}class U extends Error{constructor(e){super(nt);y(this,"status");y(this,"response");y(this,"message");y(this,"options");const{response:n,innerError:a}=e;this.message=e.message??ig(n,a)??nt,this.status=(n==null?void 0:n.status)??0,this.response=n,e.discard=e.discard??!1,this.options=e}}function pO(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 ng extends aO{constructor(s){super(s)}}class et extends aO{constructor(e,n){super(e);y(this,"auth");this.auth=n}}class ag extends et{async startConversation(s,e){return this.enqueueRequest({description:"Start agent conversation",method:m.POST,url:"/agents/prompt/",payload:{prompt:s,active_project:e},blockers:["prompt"],blocks:["prompt"]}).then(n=>(this.dispatch(oa(n)),n))}async continueConversation(s,e,n){return this.enqueueRequest({description:"Prompt agent",method:m.POST,url:"/agents/prompt/",payload:{prompt:s,active_project:n},blockers:["prompt"],blocks:["prompt"],queryParams:{conversation_id:e}}).then(a=>{this.dispatch(ma(a))})}async fetchDetails(s){return this.enqueueRequest({description:"Get agent conversation",method:m.GET,url:`/agents/conversations/${s}/`,blockers:["conversation"],blocks:["conversation"]}).then(e=>{this.dispatch(ha(e))})}async rate(s,e){return this.enqueueRequest({description:"Rate agent response",method:m.PUT,url:`/agents/responses/${s}/rate/`,payload:{rating:e},blockers:["rate"],blocks:["rate"]})}async list(s,e){return this.performRequest({method:m.GET,url:"/agents/conversations/",...s},e)}async refreshStore(s,e){const n=await this.list({queryParams:{project:s}},e);return this.dispatch(la(n)),n}}function O(t,s,e){const n=`${s}${e?"s":""}`;switch(t){case m.GET:return`Get ${n}`;case m.POST:return`Create ${n}`;case m.PATCH:return`Update ${n}`;case m.PUT:return`Update ${n}`;case m.DELETE:return`Delete ${n}`}}class v extends et{async get(s,e){return this.performRequest({url:`${this.url}/${s}/`,method:m.GET},e)}async list(s,e){return this.performRequest({url:`${this.url}/`,method:m.GET,...s},e)}async listPaginated(s,e){return this.performPagination({url:`${this.url}/`,method:m.GET,...s},e)}}class Xe extends v{constructor(){super(...arguments);y(this,"pageSize",iO)}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=[],h=[],p={};for(const I of e){const{modelUuid:F,file:P}=I,g=await this.client.files.getFilePayload(P);g.sha1 in p||(p[g.sha1]=g);const b=this.buildModel({file:P,file_sha1:g.sha1,submitted_at:u,created_by:l,modelUuid:F});d.push(b),h.push(this.buildPayload(b,g))}this.dispatch(a(d));const A=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:u,attachments:h,files:Object.values(p)},blocks:d.map(I=>this.getId(I)),blockers:d.map(I=>I.file_sha1)});return A.then(({attachments:I,presigned_urls:F})=>{this.dispatch(c(I)),this.client.files.processPresignedUrls(F)}).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:O(m.DELETE,this.name,!1),method:m.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 cg extends Xe{constructor(){super(...arguments);y(this,"name","Asset attachment");y(this,"url","/asset-attachments");y(this,"actions",{addOne:fa,addMany:Qt,setOne:Sa,setMany:Ta,updateOne:Ia,updateMany:Oa,deleteOne:Pa,deleteMany:xt,initialize:Aa});y(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 dg extends Xe{constructor(){super(...arguments);y(this,"name","Asset Procedure Attachment");y(this,"url","/asset-procedure-type-attachments");y(this,"actions",{addOne:Ea,addMany:va,setOne:Va,setMany:za,updateOne:Ba,updateMany:ja,deleteOne:qa,deleteMany:Da,initialize:wa});y(this,"selectors",{selectById:Ua,selectByIds:La})}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 rg extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Type Fields Attachment");y(this,"url","/asset-procedure-type-fields-attachments");y(this,"actions",{addOne:Ga,addMany:Ha,setOne:Wa,setMany:Ka,updateOne:Ya,updateMany:Za,deleteOne:Ja,deleteMany:Xa,initialize:Na});y(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=[],h=[];for(const f of e){const{fieldsRevisionUuid:I,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:I,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:I};h.push(E)}this.dispatch(n(d));const p=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:h,files:Object.values(u)},blockers:d.map(f=>f.fields_revision),blocks:d.map(f=>f.uuid)});return p.then(f=>{this.client.files.processPresignedUrls(f.presigned_urls),this.dispatch(a(f.attachments))}).catch(()=>{this.dispatch(c(d.map(f=>f.uuid)))}),[d,p.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 ug extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Type Fields");y(this,"url","/asset-procedure-type-fields");y(this,"actions",{addOne:nc,addMany:ac,setOne:cc,setMany:dc,updateOne:rc,updateMany:uc,deleteOne:lc,deleteMany:oc,initialize:ic});y(this,"selectors",{selectById:yc,selectByIds:pc})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.asset_procedure_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(r(d.uuid)),A}),[d,h]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}function 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 lg extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Type Field Values Attachment");y(this,"url","/asset-procedure-type-field-values-attachments");y(this,"actions",{addOne:Sc,addMany:ds,setOne:Tc,setMany:Ic,updateOne:Oc,updateMany:Pc,deleteOne:Fc,deleteMany:rs,initialize:fc});y(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,k)),h=[],p=[];for(const I of d){const F={},P=[];for(const g of I){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});h.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)}p.push({submitted_at:l,attachments:P,files:Object.values(F)})}this.dispatch(a(h));const A=p.map(I=>this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:I,blockers:I.attachments.map(F=>F.field_values),blocks:I.attachments.map(F=>F.uuid)}));return Promise.all(A).then(I=>{for(const P of I)this.client.files.processPresignedUrls(P.presigned_urls);const F=I.flatMap(P=>P.attachments);this.dispatch(c(F))}).catch(I=>{throw this.dispatch(r(h.map(F=>F.uuid))),I}),[h,A.map(I=>I.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:O(m.DELETE,this.name,!0),method:m.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 og extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Type Field Values");y(this,"url","/asset-procedure-type-field-values");y(this,"actions",{addOne:vc,addMany:Vc,setOne:zc,setMany:Bc,updateOne:jc,updateMany:qc,deleteOne:Dc,deleteMany:Cc,initialize:Ec});y(this,"selectors",{selectById:Lc,selectByIds:kc})}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(),h=M({...e,created_by:u,submitted_at:d}),p=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(h),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[h.uuid]});return this.dispatch(a(h)),p.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(h.uuid))}),[h,p]}bulkAdd(e,n){var F;const{values:a,payloads:c}=e,{addMany:r,setMany:l,deleteMany:u}=this.actions,d=new Date().toISOString(),h=((F=this.client.store.getState().userReducer.currentUser)==null?void 0:F.id)??null,p=[],A=Qe(c,Math.min(n??c.length,k)),f=[];for(const P of A){const g=[];for(const b of P){const E=M({...b,values:b.values,created_by:h,submitted_at:d});p.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(p));const I=[];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(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:P,blockers:b.concat(E).concat(B),blocks:z});I.push(q)}return Promise.all(I).then(P=>{this.dispatch(l(P.flat()))}).catch(()=>{this.dispatch(u(D(p)))}),[p,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:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[u.fields_revision,u.asset,u.asset_procedure],blocks:[u.uuid]});return d.then(h=>{this.dispatch(a(h))}).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=Rc(e)(l);this.dispatch(a(e)),this.dispatch(rs(D(d)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(u)),this.dispatch(ds(d)),h}}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 hg extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure");y(this,"url","/asset-procedures");y(this,"actions",{addOne:Hc,addMany:hs,setOne:Zc,setMany:Jc,updateOne:Wc,updateMany:Kc,deleteOne:Yc,deleteMany:ms,initialize:Gc});y(this,"selectors",{selectById:ed,selectByIds:td})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[e.asset_procedure_type,e.asset_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}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:O(m.PATCH,this.name,!1),method:m.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:O(m.DELETE,this.name,!1),method:m.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 mg extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Type");y(this,"url","/asset-procedure-types");y(this,"actions",{addOne:nd,addMany:ad,setOne:ld,setMany:od,updateOne:cd,updateMany:dd,deleteOne:rd,deleteMany:ud,initialize:id});y(this,"selectors",{selectById:yd,selectByIds:pd})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}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:O(m.PATCH,this.name,!1),method:m.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=xc(e)(l);this.dispatch(a(e)),this.dispatch(ms(D(d)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(u)),this.dispatch(hs(d)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class yg extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Step Fields Attachment");y(this,"url","/asset-procedure-step-fields-attachments");y(this,"actions",{addOne:Sd,addMany:Td,setOne:Id,setMany:Od,updateOne:Pd,updateMany:Fd,deleteOne:gd,deleteMany:bd,initialize:fd});y(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=[],h=[];for(const f of e){const{fieldsRevisionUuid:I,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:I,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:I};h.push(E)}this.dispatch(n(d));const p=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:h,files:Object.values(u)},blockers:d.map(f=>f.fields_revision),blocks:d.map(f=>f.uuid)});return p.then(f=>{this.client.files.processPresignedUrls(f.presigned_urls),this.dispatch(a(f.attachments))}).catch(()=>{this.dispatch(c(d.map(f=>f.uuid)))}),[d,p.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 pg extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Step Fields");y(this,"url","/asset-procedure-step-fields");y(this,"actions",{addOne:Vd,addMany:zd,setOne:Bd,setMany:jd,updateOne:qd,updateMany:Dd,deleteOne:Cd,deleteMany:$d,initialize:vd});y(this,"selectors",{selectById:Ud,selectByIds:Ld})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.asset_procedure_step],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(r(d.uuid)),A}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,c=n.getState().assetProcedureStepFieldsReducer.instances[e.uuid];if(!c)throw new Error(`AssetProcedureStepFields with uuid ${e.uuid} not found`);const r={...c,...e};this.dispatch(a(r));const l=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.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(m.DELETE,this.name,!1),method:m.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 Ag extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Step Field Values Attachment");y(this,"url","/asset-procedure-step-field-values-attachments");y(this,"actions",{addOne:Hd,addMany:Os,setOne:Wd,setMany:Kd,updateOne:Yd,updateMany:Zd,deleteOne:Jd,deleteMany:Ps,initialize:Gd});y(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,k)),h=[],p=[];for(const I of d){const F={},P=[];for(const g of I){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});h.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)}p.push({submitted_at:l,attachments:P,files:Object.values(F)})}this.dispatch(a(h));const A=p.map(I=>this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:I,blockers:I.attachments.map(F=>F.field_values),blocks:I.attachments.map(F=>F.uuid)}));return Promise.all(A).then(I=>{for(const P of I)this.client.files.processPresignedUrls(P.presigned_urls);const F=I.flatMap(P=>P.attachments);this.dispatch(c(F))}).catch(I=>{throw this.dispatch(r(h.map(F=>F.uuid))),I}),[h,A.map(I=>I.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:O(m.DELETE,this.name,!0),method:m.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 fg extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Step Field Values");y(this,"url","/asset-procedure-step-field-values");y(this,"actions",{addOne:nr,addMany:ar,setOne:cr,setMany:dr,updateOne:rr,updateMany:ur,deleteOne:lr,deleteMany:or,initialize:ir});y(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(),h=M({...e,created_by:u,submitted_at:d}),p=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(h),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[h.uuid]});return this.dispatch(a(h)),p.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(h.uuid))}),[h,p]}bulkAdd(e,n){var F;const{payloads:a,values:c}=e,{addMany:r,setMany:l,deleteMany:u}=this.actions,d=new Date().toISOString(),h=((F=this.client.store.getState().userReducer.currentUser)==null?void 0:F.id)??null,p=[],A=Qe(a,Math.min(n??a.length,k)),f=[];for(const P of A){const g=[];for(const b of P){const E=M({...b,values:b.values,created_by:h,submitted_at:d});p.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(p));const I=[];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(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:P,blockers:b.concat(E).concat(B),blocks:z});I.push(q)}return Promise.all(I).then(P=>{this.dispatch(l(P.flat()))}).catch(()=>{this.dispatch(u(D(p)))}),[p,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:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[u.fields_revision,u.asset,u.asset_procedure],blocks:[u.uuid]});return d.then(h=>{this.dispatch(a(h))}).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=er(e)(l);this.dispatch(a(e)),this.dispatch(Ps(D(d)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(u)),this.dispatch(Os(d)),h}}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);y(this,"name","Asset Procedure Step");y(this,"url","/asset-procedure-steps");y(this,"actions",{addOne:Ir,addMany:Or,setOne:Sr,setMany:Tr,updateOne:Pr,updateMany:Fr,deleteOne:gr,deleteMany:br,initialize:fr});y(this,"selectors",{selectById:Mr,selectByIds:Rr})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.asset_procedure_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}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:O(m.PATCH,this.name,!1),method:m.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(),h=u(e)(d);if(!h)throw new Error(`No asset procedure step with uuid ${e} found in the store`);const p=wr(e)(d);this.dispatch(l(e)),this.dispatch(a(D(p)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(A){throw this.dispatch(r(h)),this.dispatch(c(p)),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 Tg extends v{constructor(){super(...arguments);y(this,"url","/assets");y(this,"name","Asset");y(this,"actions",{addOne:Vr,addMany:Rs,setOne:qr,setMany:Dr,updateOne:zr,updateMany:Br,deleteOne:jr,deleteMany:ws,initialize:vr});y(this,"selectors",{selectById:Ur,selectByIds:Lr})}add(e){var p;const{store:n}=this.client,{addOne:a,updateOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.asset_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}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:O(m.PATCH,this.name,!1),method:m.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=_a(e)(l),h=xy(e)(l);this.dispatch(c(e)),this.dispatch(xt(D(d))),this.dispatch(vt(D(h)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(p){throw this.dispatch(a(u)),this.dispatch(Qt(d)),this.dispatch(Et(h)),p}}bulkAdd(e,n){const{addMany:a}=this.actions,c=new Date().toISOString(),r=xe.v4(),l=Qe(e,Math.min(n??e.length,k)).map(h=>{const p=h.map(A=>M(A));return{batchId:xe.v4(),payload:{transaction_id:r,submitted_at:c,assets:p}}}),u=[];let d=null;for(const h of l){const{batchId:p,payload:A}=h,f=A.assets.map(({uuid:E})=>E),I=A.assets.map(({asset_type:E})=>E),F=A.assets.map(({project:E})=>E),P=I.concat(F);d&&P.push(d);const g=f;g.push(p);const b=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:A,blockers:P,blocks:g});d=h.batchId,u.push(b)}return Promise.all(u).then(h=>{const p=h.flat();this.dispatch(a(p))}),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(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 h=Qe(e,Math.min(n??e.length,k)),p=[];let A=null;for(const f of h){const I=xe.v4(),F=D(f),P=f.map(({status:b})=>b).filter(Boolean),g=this.enqueueRequest({description:O(m.PATCH,this.name,!0),method:m.PATCH,url:`${this.url}/bulk/`,payload:{payloads:f},blockers:F.concat(P).concat(A?[A]:[]),blocks:F.concat([I])});p.push(g),A=I}return Promise.all(p).then(f=>{this.dispatch(c(f.flat()))}).catch(()=>{this.dispatch(c(u))}),[d,p]}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:O(m.DELETE,this.name,!0),method:m.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 Ig extends v{constructor(){super(...arguments);y(this,"name","Asset Stage Completion");y(this,"url","/asset-stage-completions");y(this,"actions",{addOne:Hr,addMany:Wr,setOne:Kr,setMany:Yr,updateOne:Zr,updateMany:Jr,deleteOne:Xr,deleteMany:Qr,initialize:Gr});y(this,"selectors",{selectById:su,selectByIds:iu})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[e.asset,e.asset_stage],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}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:O(m.DELETE,this.name,!1),method:m.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=>M(I)),h=d.map(I=>({...I,created_by:u,submitted_at:l})),p=h.map(({uuid:I})=>I);this.dispatch(a(h));const A=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.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:p});return A.then(I=>{this.dispatch(c(I))}).catch(()=>{this.dispatch(r(p))}),[h,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:O(m.DELETE,this.name,!0),method:m.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 Og extends v{constructor(){super(...arguments);y(this,"name","Asset Stage");y(this,"url","/asset-stages");y(this,"actions",{addOne:ru,addMany:uu,setOne:cu,setMany:du,updateOne:lu,updateMany:ou,deleteOne:hu,deleteMany:mu,initialize:au});y(this,"selectors",{selectById:pu,selectByIds:Au})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.asset_procedure_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}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:O(m.PATCH,this.name,!1),method:m.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:O(m.DELETE,this.name,!1),method:m.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 Pg extends Xe{constructor(){super(...arguments);y(this,"name","Asset Type Attachment");y(this,"url","/asset-type-attachments");y(this,"actions",{addOne:Tu,addMany:js,setOne:Iu,setMany:Ou,updateOne:Pu,updateMany:Fu,deleteOne:gu,deleteMany:qs,initialize:Su});y(this,"selectors",{selectById:_u,selectByIds:Mu})}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 Fg extends v{constructor(){super(...arguments);y(this,"name","Asset Type Fields Attachment");y(this,"url","/asset-type-fields-attachments");y(this,"actions",{addOne:Vu,addMany:zu,setOne:Bu,setMany:ju,updateOne:qu,updateMany:Du,deleteOne:Cu,deleteMany:$u,initialize:vu});y(this,"selectors",{selectById:Lu,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=[],h=[];for(const f of e){const{fieldsRevisionUuid:I,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:I,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:I};h.push(E)}this.dispatch(n(d));const p=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:h,files:Object.values(u)},blockers:d.map(f=>f.fields_revision),blocks:d.map(f=>f.uuid)});return p.then(f=>{this.client.files.processPresignedUrls(f.presigned_urls),this.dispatch(a(f.attachments))}).catch(()=>{this.dispatch(c(d.map(f=>f.uuid)))}),[d,p.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 gg extends v{constructor(){super(...arguments);y(this,"name","Asset Type Fields");y(this,"url","/asset-type-fields");y(this,"actions",{addOne:Wu,addMany:Ku,setOne:Yu,setMany:Zu,updateOne:Ju,updateMany:Xu,deleteOne:Qu,deleteMany:xu,initialize:Hu});y(this,"selectors",{selectById:tl,selectByIds:sl})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.asset_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(r(d.uuid)),A}),[d,h]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class bg extends v{constructor(){super(...arguments);y(this,"name","Asset Type Field Values Attachment");y(this,"url","/asset-type-field-values-attachments");y(this,"actions",{addOne:cl,addMany:ks,setOne:dl,setMany:rl,updateOne:ul,updateMany:ll,deleteOne:ol,deleteMany:Ns,initialize:al});y(this,"selectors",{selectById:ml,selectByIds:yl})}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,k)),h=[],p=[];for(const I of d){const F={},P=[];for(const g of I){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});h.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)}p.push({submitted_at:l,attachments:P,files:Object.values(F)})}this.dispatch(a(h));const A=p.map(I=>this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:I,blockers:I.attachments.map(F=>F.field_values),blocks:I.attachments.map(F=>F.uuid)}));return Promise.all(A).then(I=>{for(const P of I)this.client.files.processPresignedUrls(P.presigned_urls);const F=I.flatMap(P=>P.attachments);this.dispatch(c(F))}).catch(I=>{throw this.dispatch(r(h.map(F=>F.uuid))),I}),[h,A.map(I=>I.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:O(m.DELETE,this.name,!0),method:m.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 _g extends v{constructor(){super(...arguments);y(this,"name","Asset Type Field Values");y(this,"url","/asset-type-field-values");y(this,"actions",{addOne:Tl,addMany:Il,setOne:Ol,setMany:Pl,updateOne:Fl,updateMany:gl,deleteOne:bl,deleteMany:_l,initialize:Sl});y(this,"selectors",{selectById:Rl,selectByIds:wl})}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(),h=M({...e,created_by:u,submitted_at:d}),p=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(h),blockers:[e.asset,e.fields_revision],blocks:[h.uuid]});return this.dispatch(a(h)),p.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(h.uuid))}),[h,p]}bulkAdd(e,n){var I;const{payloads:a,values:c}=e,{addMany:r,setMany:l,deleteMany:u}=this.actions,d=new Date().toISOString(),h=[],p=Qe(a,Math.min(n??a.length,k)),A=[];for(const F of p){const P=[];for(const g of F){const b=M({...g,values:g.values,created_by:((I=this.client.store.getState().userReducer.currentUser)==null?void 0:I.id)??null,submitted_at:d});h.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(h));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(m.POST,this.name,!0),method:m.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(h)))}),[h,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:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[u.uuid,u.fields_revision,u.asset],blocks:[u.uuid]});return d.then(h=>{this.dispatch(a(h))}).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=pl(e)(l);this.dispatch(a(e)),this.dispatch(Ns(D(d)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(u)),this.dispatch(ks(d)),h}}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 Mg extends v{constructor(){super(...arguments);y(this,"name","Asset Type Identifier");y(this,"url","/asset-type-identifiers");y(this,"actions",{addOne:zl,addMany:Bl,setOne:jl,setMany:ql,updateOne:Dl,updateMany:Cl,deleteOne:$l,deleteMany:Ul,initialize:Vl});y(this,"selectors",{selectById:kl,selectByIds:Nl})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.asset_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}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:O(m.PATCH,this.name,!1),method:m.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:O(m.DELETE,this.name,!1),method:m.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 Rg extends v{constructor(){super(...arguments);y(this,"name","Asset Type Identifier Value");y(this,"url","/asset-type-identifier-values");y(this,"actions",{addOne:Kl,addMany:Yl,setOne:Zl,setMany:Jl,updateOne:Xl,updateMany:Ql,deleteOne:xl,deleteMany:eo,initialize:Wl});y(this,"selectors",{selectById:so,selectByIds:io})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[e.asset,e.asset_type_identifier],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}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:O(m.PATCH,this.name,!1),method:m.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:O(m.DELETE,this.name,!1),method:m.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 wg extends v{constructor(){super(...arguments);y(this,"name","Asset Type");y(this,"url","/asset-types");y(this,"actions",{addOne:lo,addMany:oo,setOne:ro,setMany:uo,updateOne:ho,updateMany:mo,deleteOne:yo,deleteMany:po,initialize:co});y(this,"selectors",{selectById:fo,selectByIds:So})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}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:O(m.PATCH,this.name,!1),method:m.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=$r(e)(l),h=Ru(e)(l);this.dispatch(a(e)),this.dispatch(ws(D(d))),this.dispatch(qs(D(h)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(p){throw this.dispatch(c(u)),this.dispatch(Rs(d)),this.dispatch(js(h)),p}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class Eg extends v{constructor(){super(...arguments);y(this,"name","Asset Type Status");y(this,"url","/asset-type-statuses");y(this,"actions",{addOne:Po,addMany:Fo,setOne:go,setMany:bo,updateOne:_o,updateMany:Mo,deleteOne:Ro,deleteMany:wo,initialize:Oo});y(this,"selectors",{selectById:vo,selectByIds:Vo})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[e.asset_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}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:O(m.PATCH,this.name,!1),method:m.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:O(m.DELETE,this.name,!1),method:m.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);y(this,"name","Category");y(this,"url","/categories");y(this,"actions",{addOne:$o,addMany:Uo,setOne:Lo,setMany:ko,updateOne:No,updateMany:Go,deleteOne:Ho,deleteMany:Wo,initialize:Co});y(this,"selectors",{selectById:ti,selectByIds:Yo})}add(e){var p;const{store:n}=this.client,{addOne:a,updateOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[e.project],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}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:O(m.PATCH,this.name,!1),method:m.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:O(m.DELETE,this.name,!1),method:m.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 Vg extends Xe{constructor(){super(...arguments);y(this,"name","Document Attachment");y(this,"url","/document-attachments");y(this,"actions",{addOne:Qo,addMany:xo,setOne:eh,setMany:th,updateOne:sh,updateMany:ih,deleteOne:nh,deleteMany:ah,initialize:Xo});y(this,"selectors",{selectById:dh,selectByIds:rh})}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 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=[],h=[],p={},A={};for(const F of e){const{documentUuid:P,file:g}=F,b=await this.client.files.getFilePayload(g);b.sha1 in p||(p[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),h.push(this.buildPayload(E,b)),A[b.sha1].push(E.uuid)}this.dispatch(a(d));const f=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:u,attachments:h,files:Object.values(p)},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:m.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 zg extends v{constructor(){super(...arguments);y(this,"name","Document");y(this,"url","/documents");y(this,"actions",{addOne:hh,addMany:mh,setOne:yh,setMany:ph,updateOne:Ah,updateMany:fh,deleteOne:Sh,deleteMany:Th,initialize:oh});y(this,"selectors",{selectById:Oh,selectByIds:Ph})}add(e){var p;const{store:n}=this.client,{addOne:a,deleteOne:c,updateOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:d.parent_document?[d.parent_document]:[],blocks:[d.uuid]});return h.then(A=>{this.dispatch(r(A))}).catch(()=>{this.dispatch(c(d.uuid))}),[d,h]}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:O(m.PATCH,this.name,!1),method:m.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(),h=u(e)(d);if(!h)throw new Error(`attempting to delete a document with uuid ${e} that does not exist in store.documents`);const p=Fh(e)(d);this.dispatch(a(e)),this.dispatch(l(D(p)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(A){throw this.dispatch(c(h)),this.dispatch(r(p)),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:m.GET},e)}async list(s,e){return this.performRequest({url:`${this.url}/`,method:m.GET,...s},e)}async listPaginated(s,e){return this.performPagination({url:`${this.url}/`,method:m.GET,...s},e)}}class Bg extends at{constructor(){super(...arguments);y(this,"name","Email Domains");y(this,"url","/organization-email-domains");y(this,"actions",{addOne:_h,addMany:Mh,setOne:Rh,setMany:wh,updateOne:Eh,updateMany:vh,deleteOne:Vh,deleteMany:zh,initialize:bh});y(this,"selectors",{selectById:jh,selectByIds:qh})}async add(e,n){return this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.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(m.DELETE,this.name,!1),method:m.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 jg extends et{async getVerificationCode(s){return this.enqueueRequest({description:"Get verification code",method:m.GET,url:`/verification/email-verification/${s}/`,isAuthNeeded:!1,blockers:[],blocks:[]})}validateVerificationCode(s,e=void 0){return this.enqueueRequest({description:"Validate verification code",method:m.POST,url:`/verification/email-verification/${s}/`,isAuthNeeded:!1,payload:e,blockers:[],blocks:[]})}}const Ut={},qn=new Set;let Lt=0,Dn=0,Cn=0;const qg=20;class Dg extends et{constructor(){super(...arguments);y(this,"host");y(this,"_dbPromise",zO.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 Kt(n,e),c=await this.enqueueRequest({description:"Get S3 URL",method:m.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(Uh({sha1:e,...c})),c}async addCache(e,n){if(qn.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),Lt++):(await a.put("files",e,n),Dn++),qn.add(n),Cn++,Cn%qg===0&&console.debug(`File cache summary: ${Lt} hits and ${Dn} misses, ${Lt/(Lt+Dn)*100}% hit rate over ${Cn} calls to addCache.`)}async removeCache(e){await(await this._dbPromise).delete("files",e),qn.delete(e)}async fetchCache(e){return(await this._dbPromise).get("files",e)}async getOrRenewUploadUrl(e){const n=this.client.store.getState();return Lh(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 Kt(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:m.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 h=await ea(e),p=new File([h],a??n,{type:h.type});return await this.addCache(p,n),p}let l=Ut[c],u=!0;l?u=!1:(l=new Promise(h=>{this.enqueueRequest({description:"Download file",method:m.GET,url:e,isExternalUrl:!0,isResponseBlob:!0,isAuthNeeded:!1,blockers:[n],blocks:[n]}).then(p=>{const A=new File([p],a??n,{type:p.type});h(A)})}),Ut[c]=l);let d;try{d=await l}catch(h){throw u&&h instanceof U&&delete Ut[c],h}if(u){const h=await it(d);if(h!==n){const f=`The hash of the file returned from the server (${h}) does not match the
9
9
  expected hash (${n}). This can happen if you're using a local development server and the
10
10
  isExternalUrl flag in the request details is set to true, because instead of requesting the local
11
11
  REST API, you will be requesting localhost:80 (where this app runs), resulting in a transformed blob
12
12
  (with an uuid attached) being returned. Alternatively, you may be running with
13
13
  import.meta.env.PROD, which will result in some file requests being treated as
14
- external URLs and therefore not prepended with VITE_API_URL.`;throw new Error(f)}const p=d.type.split("/")[1];if(!p)throw new Error("File has no extension");const A=a??h+"."+p;if(d=ea(d,A),!d.name)throw new Error("Failed to set file's name");await this.addCache(d,h),$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:m.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 Cg extends v{constructor(){super(...arguments);y(this,"name","Form Identifier");y(this,"url","/form-identifiers");y(this,"actions",{addOne:Hh,addMany:Wh,setOne:Kh,setMany:Yh,updateOne:Zh,updateMany:Jh,deleteOne:Xh,deleteMany:Qh,initialize:Gh});y(this,"selectors",{selectById:em,selectByIds:tm})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.form],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}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:O(m.PATCH,this.name,!1),method:m.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:O(m.DELETE,this.name,!1),method:m.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 $g extends v{constructor(){super(...arguments);y(this,"name","Form Identifier Value");y(this,"url","/form-identifier-values");y(this,"actions",{addOne:am,addMany:cm,setOne:dm,setMany:rm,updateOne:um,updateMany:lm,deleteOne:om,deleteMany:hm,initialize:nm});y(this,"selectors",{selectById:ym,selectByIds:pm})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[e.form_submission,e.form_identifier],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}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:O(m.PATCH,this.name,!1),method:m.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:O(m.DELETE,this.name,!1),method:m.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 Ug extends v{constructor(){super(...arguments);y(this,"name","Form Revision Attachment");y(this,"url","/form-revision-attachments");y(this,"actions",{addOne:Tm,addMany:Im,setOne:Om,setMany:Pm,updateOne:Fm,updateMany:gm,deleteOne:bm,deleteMany:_m,initialize:Sm});y(this,"selectors",{selectById:Rm,selectByIds:wm})}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=[],h=[];for(const f of e){const{revisionUuid:I,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:I,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:I};h.push(E)}this.dispatch(n(d));const p=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:h,files:Object.values(u)},blockers:d.map(f=>f.form_revision),blocks:d.map(f=>f.uuid)});return p.then(f=>{this.client.files.processPresignedUrls(f.presigned_urls),this.dispatch(a(f.attachments))}).catch(()=>{this.dispatch(c(d.map(f=>f.uuid)))}),[d,p.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);y(this,"name","Form Revision");y(this,"url","/form-revisions");y(this,"actions",{addOne:pi,addMany:Ai,setOne:zm,setMany:Bm,updateOne:jm,updateMany:qm,deleteOne:fi,deleteMany:Si,initialize:Vm});y(this,"selectors",{selectById:Dm,selectByIds:Cm})}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(),h=M({...e,created_by:u,submitted_at:d});this.dispatch(a(h));const p=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(h),blockers:[e.form],blocks:[h.uuid]});return p.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(h.uuid))}),[h,p]}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 kg extends v{constructor(){super(...arguments);y(this,"name","Form");y(this,"url","/forms");y(this,"actions",{addOne:Nm,addMany:Gm,setOne:Hm,setMany:Wm,updateOne:Km,updateMany:Ym,deleteOne:Zm,deleteMany:Jm,initialize:km});y(this,"selectors",{selectById:xm,selectByIds:ey})}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}),h=M({...n,form:d.uuid,submitted_at:l,created_by:u});this.dispatch(c(d)),this.dispatch(pi(h));const p=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:{...V(d),initial_revision:{uuid:h.uuid,submitted_at:h.submitted_at,title:h.title,description:h.description,fields:h.fields}},blockers:[],blocks:[d.uuid,h.uuid]});return p.catch(f=>{throw this.dispatch(r(d.uuid)),this.dispatch(fi(h.uuid)),f}),[d,h,p]}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=gy(e)(l),h=$m(e)(l);this.dispatch(a(e)),this.dispatch(Ei(D(d))),this.dispatch(Si(D(h)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(p){throw this.dispatch(c(u)),this.dispatch(Ai(h)),this.dispatch(wi(d)),p}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class Ng extends v{constructor(){super(...arguments);y(this,"name","Form Submission Attachment");y(this,"url","/form-submission-attachments");y(this,"actions",{addOne:iy,addMany:Fi,setOne:ny,setMany:ay,updateOne:cy,updateMany:dy,deleteOne:ry,deleteMany:gi,initialize:sy});y(this,"selectors",{selectById:uy,selectByIds:ly})}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=[],h=[];for(const f of e){const{submissionUuid:I,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:I,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:I};h.push(E)}this.dispatch(n(d));const p=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:h,files:Object.values(u)},blockers:d.map(f=>f.form_submission),blocks:d.map(f=>f.uuid)});return p.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,p.then(({attachments:f})=>f)]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,r=n.getState(),l=Mi(e)(r);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!0),method:m.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 Gg extends v{constructor(){super(...arguments);y(this,"name","Form Submission");y(this,"url","/form-submissions");y(this,"actions",{addOne:fy,addMany:wi,setOne:py,setMany:Ay,updateOne:Sy,updateMany:Ty,deleteOne:Iy,deleteMany:Ei,initialize:yy});y(this,"selectors",{selectById:Py,selectByIds:Fy})}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(),h=M({...e,created_by:u,submitted_at:d}),p=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(h),blockers:[e.form_revision],blocks:[h.uuid]});return this.dispatch(a(h)),p.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(h.uuid))}),[h,p]}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:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${u.uuid}/`,payload:e,blockers:[u.uuid],blocks:[u.uuid]});return d.then(h=>{this.dispatch(a(h))}).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=oy(e)(l);this.dispatch(a(e)),this.dispatch(gi(D(d)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(u)),this.dispatch(Fi(d)),h}}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 Hg extends v{constructor(){super(...arguments);y(this,"name","Geo Image");y(this,"url","/geo-images");y(this,"actions",{addOne:Ey,addMany:vy,setOne:Ry,setMany:wy,updateOne:Vy,updateMany:zy,deleteOne:By,deleteMany:jy,initialize:My});y(this,"selectors",{selectById:Dy,selectByIds:Cy})}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(),h=((F=n.getState().userReducer.currentUser)==null?void 0:F.id)??null,p=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:h});this.dispatch(a(f));const I=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.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:[p],blockers:[p]});return I.then(P=>{this.client.files.processPresignedUrls(P.presigned_urls),this.dispatch(c(P.geo_image))}).catch(()=>{this.dispatch(r(f.uuid))}),[f,I.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,h=[],p=[],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});h.push(B),p.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(h));const I=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:u,project:n,geo_images:A,files:Object.values(f)},blocks:[n],blockers:p});return I.then(P=>{this.client.files.processPresignedUrls(P.presigned_urls),this.dispatch(r(P.geo_images))}).catch(()=>{this.dispatch(l(p))}),[h,I.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(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:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return d.then(h=>{this.dispatch(a(h))}).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:O(m.DELETE,this.name,!1),method:m.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);y(this,"name","Issue Association");y(this,"url","/issue-associations");y(this,"actions",{addOne:Wy,addMany:wt,setOne:Ny,setMany:ky,updateOne:Gy,updateMany:Hy,deleteOne:Ky,deleteMany:Et,initialize:Ly});y(this,"selectors",{selectById:Zy,selectByIds:Jy})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=new Date().toISOString(),u=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,d=M({...e,submitted_at:l,created_by:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[e.associated_issue,...e.issue?[e.issue]:[],...e.asset?[e.asset]:[]],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}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:O(m.DELETE,this.name,!1),method:m.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 Kg extends Xe{constructor(){super(...arguments);y(this,"name","Issue Attachment");y(this,"url","/issue-attachments");y(this,"actions",{addOne:ip,addMany:qi,setOne:np,setMany:ap,updateOne:cp,updateMany:dp,deleteOne:rp,deleteMany:Di,initialize:sp});y(this,"selectors",{selectById:op,selectByIds:hp})}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 Yg extends Xe{constructor(){super(...arguments);y(this,"name","Issue Comment Attachment");y(this,"url","/issue-comment-attachments");y(this,"actions",{addOne:Ap,addMany:fp,setOne:Sp,setMany:Tp,updateOne:Ip,updateMany:Op,deleteOne:Pp,deleteMany:Fp,initialize:pp});y(this,"selectors",{selectById:bp,selectByIds:_p})}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 Zg extends v{constructor(){super(...arguments);y(this,"name","Issue Comment");y(this,"url","/issue-comments");y(this,"actions",{addOne:Ep,addMany:vp,setOne:Vp,setMany:zp,updateOne:Bp,updateMany:jp,deleteOne:qp,deleteMany:Dp,initialize:wp});y(this,"selectors",{selectById:Cp,selectByIds:$p})}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(m.POST,this.name,!1),method:m.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(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:O(m.PATCH,this.name,!1),method:m.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:O(m.DELETE,this.name,!1),method:m.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 Jg extends v{constructor(){super(...arguments);y(this,"name","Issue");y(this,"url","/issues");y(this,"actions",{addOne:Np,addMany:Gi,setOne:Gp,setMany:Hp,updateOne:Wp,updateMany:Kp,deleteOne:Yp,deleteMany:Hi,initialize:kp});y(this,"selectors",{selectById:Jp,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,h=M({...e,submitted_at:u,created_by:d});this.dispatch(a(h));const p=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(h),blockers:[h.project,h.issue_type,...h.category?[h.category]:[]],blocks:[h.uuid]});return p.then(f=>{this.dispatch(c(f))}).catch(f=>{throw this.dispatch(r(h.uuid)),f}),[h,p]}update(e){var p;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[$.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],I=ln(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 $.CATEGORY:{const f=e[A];if(f===null)u[A]=null;else{const I=si(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 $.ASSIGNED_TO:{const f=e[A];if(f===null)u[A]=null;else{const I=jt(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=M({created_by:((p=c.userReducer.currentUser)==null?void 0:p.id)??null,submitted_at:new Date().toISOString(),issue:r.uuid,changes:u});this.dispatch(hn(d));const h=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return h.then(A=>{this.dispatch(n(A))}).catch(()=>{this.dispatch(n(r)),this.dispatch(yn(d.uuid))}),[l,h]}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(l)(a.getState()).toSorted(Kt);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 h=Qe(e,Math.min(n??e.length,k)),p=[];let A=null;for(const f of h){const I=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(m.PATCH,this.name,!0),method:m.PATCH,url:`${this.url}/bulk/`,payload:{payloads:f},blockers:F.concat(P).concat(g).concat(A?[A]:[]),blocks:F.concat([I])});p.push(b),A=I}return Promise.all(p).then(f=>{this.dispatch(c(f.flat()))}).catch(()=>{this.dispatch(c(u))}),[d,p]}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=lp(e)(l),h=bS(e)(l),p={};for(const f of Xy(e)(l))p[f.uuid]=f;for(const f of Qy(e)(l))p[f.uuid]=f;const A=Object.values(p);this.dispatch(a(e)),this.dispatch(Di(D(d))),this.dispatch(pn(D(h))),this.dispatch(Et(D(A)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(f){throw this.dispatch(c(u)),this.dispatch(qi(d)),this.dispatch(mn(h)),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 Xg extends Xe{constructor(){super(...arguments);y(this,"name","Issue Type Attachment");y(this,"url","/issue-type-attachments");y(this,"actions",{addOne:sA,addMany:iA,setOne:nA,setMany:aA,updateOne:cA,updateMany:dA,deleteOne:rA,deleteMany:uA,initialize:tA});y(this,"selectors",{selectById:oA,selectByIds:hA})}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 Qg extends v{constructor(){super(...arguments);y(this,"name","Issue Type Fields Attachment");y(this,"url","/issue-type-fields-attachments");y(this,"actions",{addOne:AA,addMany:fA,setOne:SA,setMany:TA,updateOne:IA,updateMany:OA,deleteOne:PA,deleteMany:FA,initialize:pA});y(this,"selectors",{selectById:bA,selectByIds:_A})}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=[],h=[];for(const f of e){const{fieldsRevisionUuid:I,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:I,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:I};h.push(E)}this.dispatch(n(d));const p=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:h,files:Object.values(u)},blockers:d.map(f=>f.fields_revision),blocks:d.map(f=>f.uuid)});return p.then(f=>{this.client.files.processPresignedUrls(f.presigned_urls),this.dispatch(a(f.attachments))}).catch(()=>{this.dispatch(c(d.map(f=>f.uuid)))}),[d,p.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 xg extends v{constructor(){super(...arguments);y(this,"name","Issue Type Fields");y(this,"url","/issue-type-fields");y(this,"actions",{addOne:GA,addMany:HA,setOne:WA,setMany:KA,updateOne:YA,updateMany:ZA,deleteOne:JA,deleteMany:XA,initialize:NA});y(this,"selectors",{selectById:xA,selectByIds:ef})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.issue_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(r(d.uuid)),A}),[d,h]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class eb extends v{constructor(){super(...arguments);y(this,"name","Issue Type Field Values Attachment");y(this,"url","/issue-type-field-values-attachments");y(this,"actions",{addOne:af,addMany:xi,setOne:cf,setMany:df,updateOne:rf,updateMany:uf,deleteOne:lf,deleteMany:en,initialize:nf});y(this,"selectors",{selectById:hf,selectByIds:mf})}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=[],h=[];for(const f of e){const{fieldValuesUuid:I,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:I,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:I};h.push(E)}this.dispatch(n(d));const p=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:h,files:Object.values(u)},blockers:d.map(f=>f.field_values),blocks:d.map(f=>f.uuid)});return p.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,p.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:O(m.DELETE,this.name,!0),method:m.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 tb extends v{constructor(){super(...arguments);y(this,"name","Issue Type Field Values");y(this,"url","/issue-type-field-values");y(this,"actions",{addOne:EA,addMany:vA,setOne:VA,setMany:zA,updateOne:BA,updateMany:jA,deleteOne:qA,deleteMany:DA,initialize:wA});y(this,"selectors",{selectById:$A,selectByIds:UA})}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(),h=M({...e,created_by:u,submitted_at:d}),p=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(h),blockers:[e.issue,e.fields_revision],blocks:[h.uuid]});return this.dispatch(a(h)),p.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(h.uuid))}),[h,p]}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:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[u.uuid,u.fields_revision,u.issue],blocks:[u.uuid]});return d.then(h=>{this.dispatch(a(h))}).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=yf(e)(l);this.dispatch(a(e)),this.dispatch(en(D(d)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(u)),this.dispatch(xi(d)),h}}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 sb extends v{constructor(){super(...arguments);y(this,"name","Issue Type Identifier");y(this,"url","/issue-type-identifiers");y(this,"actions",{addOne:Sf,addMany:Tf,setOne:If,setMany:Of,updateOne:Pf,updateMany:Ff,deleteOne:gf,deleteMany:bf,initialize:ff});y(this,"selectors",{selectById:Mf,selectByIds:Rf})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.issue_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}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:O(m.PATCH,this.name,!1),method:m.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:O(m.DELETE,this.name,!1),method:m.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 ib extends v{constructor(){super(...arguments);y(this,"name","Issue Type Identifier Value");y(this,"url","/issue-type-identifier-values");y(this,"actions",{addOne:Vf,addMany:zf,setOne:Bf,setMany:jf,updateOne:qf,updateMany:Df,deleteOne:Cf,deleteMany:$f,initialize:vf});y(this,"selectors",{selectById:Lf,selectByIds:kf})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[e.issue,e.issue_type_identifier],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}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:O(m.PATCH,this.name,!1),method:m.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:O(m.DELETE,this.name,!1),method:m.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 nb extends v{constructor(){super(...arguments);y(this,"name","Issue Type");y(this,"url","/issue-types");y(this,"actions",{addOne:Wf,addMany:Kf,setOne:Yf,setMany:Zf,updateOne:Jf,updateMany:Xf,deleteOne:Qf,deleteMany:xf,initialize:Hf});y(this,"selectors",{selectById:tS,selectByIds:sS})}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(),h=M({...e,submitted_at:d,created_by:u});this.dispatch(a(h));const p=this.enqueueRequest({method:m.POST,url:`${this.url}/`,payload:V(h),blockers:[],blocks:[h.uuid]});return p.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(h.uuid))}),[h,p]}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:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(h=>{this.dispatch(a(h))}).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=Qp(e)(l);this.dispatch(a(e)),this.dispatch(Hi(D(d)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(u)),this.dispatch(Gi(d)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class ab extends v{constructor(){super(...arguments);y(this,"name","Issue Type Status");y(this,"url","/issue-type-statuses");y(this,"actions",{addOne:cS,addMany:dS,setOne:rS,setMany:uS,updateOne:lS,updateMany:oS,deleteOne:hS,deleteMany:mS,initialize:aS});y(this,"selectors",{selectById:ln,selectByIds:pS})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[e.issue_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}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:O(m.PATCH,this.name,!1),method:m.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:O(m.DELETE,this.name,!1),method:m.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 cb extends v{constructor(){super(...arguments);y(this,"name","Issue Update");y(this,"url","/issue-updates");y(this,"actions",{addOne:hn,addMany:mn,setOne:TS,setMany:IS,updateOne:OS,updateMany:PS,deleteOne:yn,deleteMany:pn,initialize:SS});y(this,"selectors",{selectById:FS,selectByIds:gS})}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 db=1800;function rb(t){if(!t.access)throw new Error("Missing access token");if(!t.refresh)throw new Error("Missing refresh token");return{accessToken:t.access,refreshToken:t.refresh}}class ub extends ng{constructor(){super(...arguments);y(this,"_getRenewedTokens",async e=>{const n=this.performRequest({method:m.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(jo(!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=BO(e).exp??n}catch{a=n}return a-n<db}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:m.POST,url:this.initTokensUrl,payload:e,isAuthNeeded:!1,checkAuth:!1}).then(a=>{this.setTokens(rb(a))})}}class lb extends at{constructor(){super(...arguments);y(this,"name","Organization Access");y(this,"url","/organization-accesses");y(this,"actions",{addOne:US,addMany:LS,setOne:kS,setMany:NS,updateOne:GS,updateMany:HS,deleteOne:WS,deleteMany:KS,initialize:$S});y(this,"selectors",{selectById:ZS,selectByIds:JS})}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:O(m.PATCH,this.name,!1),method:m.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=jt(u.user)(l);this.dispatch(a(u.uuid)),this.dispatch(In(u.user));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${u.uuid}/`,blockers:[u.uuid],blocks:[]})}catch(h){throw this.dispatch(c(u)),this.dispatch(Tn(d)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class ob extends at{constructor(){super(...arguments);y(this,"name","Organization");y(this,"url","/organizations");y(this,"actions",{addOne:iT,addMany:sT,setOne:tT,setMany:eT,updateOne:aT,updateMany:nT,deleteOne:cT,deleteMany:dT,initialize:xS});y(this,"selectors",{selectById:lT,selectByIds:oT})}async add(e){const{addOne:n}=this.actions,a=await this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.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(m.PATCH,this.name,!1),method:m.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(m.POST,this.name,!1),method:m.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 hb extends v{constructor(){super(...arguments);y(this,"name","Project Access");y(this,"url","/project-accesses");y(this,"actions",{addOne:OT,addMany:PT,setOne:FT,setMany:gT,updateOne:bT,updateMany:_T,deleteOne:MT,deleteMany:RT,initialize:IT});y(this,"selectors",{selectById:ET,selectByIds:vT})}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(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(l),blockers:[l.organization_access,l.project],blocks:[l.uuid]});return u.then(h=>{this.dispatch(c(h))}).catch(h=>{throw this.dispatch(r(l.uuid)),h}),[l,u]}bulkAdd(e){var h;const{store:n}=this.client,{addMany:a,deleteMany:c,updateMany:r}=this.actions,l=((h=n.getState().userReducer.currentUser)==null?void 0:h.id)??null,u=e.map(p=>M({...p,created_by:l}));this.dispatch(a(u));const d=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{project_accesses:u.map(p=>V(p))},blockers:u.flatMap(p=>[p.project,p.organization_access]),blocks:u.map(p=>p.uuid)});return d.then(p=>{this.dispatch(r(p))}).catch(p=>{throw this.dispatch(c(u.map(A=>A.uuid))),p}),[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:O(m.PATCH,this.name,!1),method:m.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:O(m.DELETE,this.name,!1),method:m.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 mb extends Xe{constructor(){super(...arguments);y(this,"name","Project Attachment");y(this,"url","/project-attachments");y(this,"actions",{addOne:BT,addMany:jT,setOne:qT,setMany:DT,updateOne:CT,updateMany:$T,deleteOne:UT,deleteMany:LT,initialize:zT});y(this,"selectors",{selectById:NT,selectByIds:GT})}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 yb extends v{constructor(){super(...arguments);y(this,"name","Project File");y(this,"url","/project-files");y(this,"actions",{addOne:JT,addMany:XT,setOne:YT,setMany:ZT,updateOne:QT,updateMany:xT,deleteOne:eI,deleteMany:tI,initialize:KT});y(this,"selectors",{selectById:dI,selectByIds:rI})}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:m.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 h={...r};delete h.file,l={method:m.PATCH,url:`${this.url}/${c}/`,payload:h,blockers:[c],blocks:[c]}}else l=new Promise((h,p)=>{this.client.files.uploadFileToS3(r.file_sha1).then(([A])=>{h({method:m.POST,url:`${this.url}/`,payload:{...r,...A},blockers:[c],blocks:[c]})}).catch(p)});const d=Promise.resolve(l).then(h=>this.enqueueRequest(h));return d.then(h=>{this.dispatch(n(h))}),this.dispatch(nI),this.dispatch(iI(null)),this.dispatch(sI(!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:O(m.DELETE,this.name,!1),method:m.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 pb extends at{constructor(){super(...arguments);y(this,"name","Project");y(this,"url","/projects");y(this,"actions",{addOne:pI,addMany:yI,setOne:mI,setMany:hI,updateOne:fI,updateMany:AI,deleteOne:SI,deleteMany:TI,initialize:oI});y(this,"selectors",{selectById:PI,selectByIds:FI})}async add(e){const{addOne:n}=this.actions,a=await this.performRequest({method:m.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:m.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(m.DELETE,this.name,!1),method:m.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 Ab extends v{constructor(){super(...arguments);y(this,"name","Team Membership");y(this,"url","/team-memberships");y(this,"actions",{addOne:MI,addMany:RI,setOne:wI,setMany:EI,updateOne:vI,updateMany:VI,deleteOne:zI,deleteMany:BI,initialize:_I});y(this,"selectors",{selectById:DI,selectByIds:CI})}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(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(l),blockers:[e.team],blocks:[l.uuid]});return u.then(h=>{this.dispatch(c(h))}).catch(()=>{this.dispatch(r(l.uuid))}),[l,u]}bulkAdd(e){var h;const{store:n}=this.client,{addMany:a,setMany:c,deleteMany:r}=this.actions,l=((h=n.getState().userReducer.currentUser)==null?void 0:h.id)??null,u=e.map(p=>M({...p,created_by:l}));this.dispatch(a(u));const d=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{team_memberships:u.map(p=>V(p))},blockers:u.map(p=>p.team),blocks:u.map(p=>p.uuid)});return d.then(p=>{this.dispatch(c(p))}).catch(()=>{this.dispatch(r(u.map(p=>p.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:O(m.DELETE,this.name,!1),method:m.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 fb extends v{constructor(){super(...arguments);y(this,"name","Team");y(this,"url","/teams");y(this,"actions",{addOne:LI,addMany:kI,setOne:NI,setMany:GI,updateOne:HI,updateMany:WI,deleteOne:KI,deleteMany:YI,initialize:UI});y(this,"selectors",{selectById:JI,selectByIds:XI})}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(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(l),blockers:[],blocks:[l.uuid]});return u.then(h=>{this.dispatch(c(h))}).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:O(m.PATCH,this.name,!1),method:m.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(e)(l);if(!u)throw new Error(`Expected team with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.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);y(this,"name","User");y(this,"url","/user");y(this,"actions",{addOne:Tn,addMany:vS,setOne:ES,setMany:wS,updateOne:zS,updateMany:VS,deleteOne:In,deleteMany:BS,initialize:RS});y(this,"selectors",{selectById:jt,selectByIds:DS})}async list(e,n){const{organizationUuid:a,...c}=e,r=a?`/organizations/${a}${this.url}s/`:`/${this.url}`;return this.performRequest({method:m.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:h,queryParams:p,attachmentHash:A,isExternalUrl:f,isAuthNeeded:I,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={[m.GET]:()=>F?st.get(P.toString()).responseType("blob"):st.get(P.toString()),[m.POST]:()=>{const q=st.post(P.toString());return b(q)},[m.PATCH]:()=>{const q=st.patch(P.toString());return b(q)},[m.PUT]:()=>{const q=st.put(P.toString());return b(q)},[m.DELETE]:()=>{const q=st.delete(P.toString());return b(q)}}[h];let z=B();if(a==null||a.addEventListener("abort",()=>{console.debug("aborting request:",s),z.abort()}),I&&c){const q=n.auth.getAuthHeader();z=z.set("Authorization",q)}d&&(z=z.set(d));try{return await z.query(p)}catch(q){const j=pO(q),MO=j==null?void 0:j.status;if(c&&MO===401)return await n.auth.handleUnauthorized(z,j),z.query(p);throw new U({response:j,innerError:q,discard:qn.includes(MO)})}}class Tb{constructor(s){y(this,"store");this.store=s}_performRequest(s,e,n,a){const c=new kt,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 kt,c={...s,BASE_URL:e,serviceName:n},r=this.store.dispatch(pT(c)),l=d=>{if(d)a.resolve(d.body);else{const h=new U({message:"Could not get a response from the server.",response:d,discard:!0});a.reject(h)}},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(){y(this,"graph");y(this,"requestAttemptCounter");this.graph=new jO.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 AO;function fO(t){AO=t}function dt(){return AO}let SO;function TO(t){SO=t}function IO(){return SO}let Ln=null;function tt(){const t=dt();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=ct._fromOutbox(s);return Ln=e,e}const Ib=(t,s)=>{const e=new s(t);return TO(e),fO(t),e};class Ob{constructor(s){y(this,"_all");y(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 kn{constructor(){y(this,"next");this.next=null}then(s){return new Ob(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=IO();if(!n)throw new Error("Client SDK not set");return hO(s,n)}}}class OO extends kn{async run(s){return super.run(s)}}class PO extends kn{async run(s){return super.run(s)}}const FO=new OO().then(new PO).compile();function gO(t){var s;return(s=FO[0])==null?void 0:s.run(t)}var bO=(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))(bO||{});i.ALL_MIDDLEWARE=FO,i.APIError=U,i.ATTACHMENT_MODEL_DEFAULT_PAGE_SIZE=iO,i.AgentService=ag,i.AssetAttachmentService=cg,i.AssetProcedureService=hg,i.AssetProcedureStepFieldValuesAttachmentService=Ag,i.AssetProcedureStepFieldValuesService=fg,i.AssetProcedureStepFieldsAttachmentService=yg,i.AssetProcedureStepFieldsService=pg,i.AssetProcedureStepService=Sg,i.AssetProcedureTypeAttachmentService=dg,i.AssetProcedureTypeFieldValuesAttachmentService=lg,i.AssetProcedureTypeFieldValuesService=og,i.AssetProcedureTypeFieldsAttachmentService=rg,i.AssetProcedureTypeFieldsService=ug,i.AssetProcedureTypeService=mg,i.AssetService=Tg,i.AssetStageCompletionService=Ig,i.AssetStageService=Og,i.AssetStatusType=Zn,i.AssetTypeAttachmentService=Pg,i.AssetTypeFieldValuesAttachmentService=bg,i.AssetTypeFieldValuesService=_g,i.AssetTypeFieldsAttachmentService=Fg,i.AssetTypeFieldsService=gg,i.AssetTypeIdentifierService=Mg,i.AssetTypeIdentifierValueService=Rg,i.AssetTypeService=wg,i.AssetTypeStatusService=Eg,i.AttachmentModel=Jn,i.BaseApiService=et,i.BaseModelApiService=at,i.BaseOfflineAttachmentModelService=Xe,i.BaseOfflineModelApiService=v,i.BaseSDK=Tb,i.COMMON_AUTO_FIELDS=ia,i.CategoryService=vg,i.DEFAULT_ISSUE_PRIORITY=qO,i.DEFAULT_PAGE_SIZE=sO,i.DISCARD_HTTP_STATUSES=qn,i.DeferredPromise=kt,i.DocumentAttachmentService=Vg,i.DocumentService=zg,i.EMPTY_ARRAY=Wn,i.EMPTY_OBJECT=Kn,i.EmailDomainsService=Bg,i.EmailVerificationService=jg,i.FileService=Dg,i.FormIdentifierService=Cg,i.FormIdentifierValueService=$g,i.FormRevisionAttachmentService=Ug,i.FormRevisionService=Lg,i.FormService=kg,i.FormSubmissionAttachmentService=Ng,i.FormSubmissionService=Gg,i.GeoImageService=Hg,i.HttpMethod=m,i.IssueAssociationService=Wg,i.IssueAttachmentService=Kg,i.IssueCommentAttachmentService=Yg,i.IssueCommentService=Zg,i.IssuePriority=Lt,i.IssueService=Jg,i.IssueStatusType=Xn,i.IssueTypeAttachmentService=Xg,i.IssueTypeFieldValuesAttachmentService=eb,i.IssueTypeFieldValuesService=tb,i.IssueTypeFieldsAttachmentService=Qg,i.IssueTypeFieldsService=xg,i.IssueTypeIdentifierService=sb,i.IssueTypeIdentifierValueService=ib,i.IssueTypeService=nb,i.IssueTypeStatusService=ab,i.IssueUpdateChange=$,i.IssueUpdateService=cb,i.JWTService=ub,i.MAX_SERVICE_BATCH_SIZE=k,i.OUTBOX_RETRY_DELAY=Qn,i.OfflineAnalyticsMiddleware=OO,i.OfflineMiddleware=kn,i.OrganizationAccessLevel=Yn,i.OrganizationAccessService=lb,i.OrganizationService=ob,i.OutboxCoordinator=ct,i.ProjectAccessService=hb,i.ProjectAttachmentService=mb,i.ProjectFileService=yb,i.ProjectService=pb,i.RESET_ORGANIZATION_STATE=w,i.RESET_PROJECT_STATE=C,i.RESET_STATE=_,i.RateLimitingMiddleware=PO,i.SelectorBuilder=dP,i.TeamMembershipService=Ab,i.TeamService=fb,i.UNKNOWN_ERROR_MESSAGE=nt,i.UserService=Sb,i.VERSION_REDUCER_KEY=rt,i.VerificationCodeType=bO,i._setLatestRetryTime=fT,i.addAsset=zr,i.addAssetAttachment=Sa,i.addAssetAttachments=Xt,i.addAssetProcedure=Wc,i.addAssetProcedureStep=Or,i.addAssetProcedureStepFieldValues=ar,i.addAssetProcedureStepFieldValuesAttachment=Wd,i.addAssetProcedureStepFieldValuesAttachments=Is,i.addAssetProcedureStepFieldValuesMany=cr,i.addAssetProcedureStepFields=zd,i.addAssetProcedureStepFieldsAttachment=Td,i.addAssetProcedureStepFieldsAttachments=Id,i.addAssetProcedureStepFieldsMany=Bd,i.addAssetProcedureSteps=Pr,i.addAssetProcedureType=ad,i.addAssetProcedureTypeAttachment=va,i.addAssetProcedureTypeAttachments=Va,i.addAssetProcedureTypeFieldValues=Vc,i.addAssetProcedureTypeFieldValuesAttachment=Tc,i.addAssetProcedureTypeFieldValuesAttachments=cs,i.addAssetProcedureTypeFieldValuesMany=zc,i.addAssetProcedureTypeFields=ac,i.addAssetProcedureTypeFieldsAttachment=Ha,i.addAssetProcedureTypeFieldsAttachments=Wa,i.addAssetProcedureTypeFieldsMany=cc,i.addAssetProcedureTypes=cd,i.addAssetProcedures=os,i.addAssetStage=ru,i.addAssetStageCompletion=Hr,i.addAssetStageCompletions=Wr,i.addAssetStages=uu,i.addAssetType=lo,i.addAssetTypeAttachment=Tu,i.addAssetTypeAttachments=qs,i.addAssetTypeFieldValues=Tl,i.addAssetTypeFieldValuesAttachment=cl,i.addAssetTypeFieldValuesAttachments=Ns,i.addAssetTypeFieldValuesMany=Il,i.addAssetTypeFields=Wu,i.addAssetTypeFieldsAttachment=Vu,i.addAssetTypeFieldsAttachments=zu,i.addAssetTypeFieldsMany=Ku,i.addAssetTypeIdentifier=zl,i.addAssetTypeIdentifierValue=Kl,i.addAssetTypeIdentifierValues=Yl,i.addAssetTypeIdentifiers=Bl,i.addAssetTypeStatus=Po,i.addAssetTypeStatuses=Fo,i.addAssetTypes=oo,i.addAssets=Ms,i.addCategories=Uo,i.addCategory=$o,i.addConversation=ha,i.addConversations=rP,i.addDocument=hh,i.addDocumentAttachment=Qo,i.addDocumentAttachments=xo,i.addDocuments=mh,i.addEmailDomain=_h,i.addEmailDomains=Mh,i.addForm=Nm,i.addFormIdentifier=Hh,i.addFormIdentifierValue=am,i.addFormIdentifierValues=cm,i.addFormIdentifiers=Wh,i.addFormRevision=pi,i.addFormRevisionAttachment=Tm,i.addFormRevisionAttachments=Im,i.addFormRevisions=Ai,i.addFormSubmission=fy,i.addFormSubmissionAttachment=iy,i.addFormSubmissionAttachments=Fi,i.addFormSubmissions=wi,i.addForms=Gm,i.addGeoImage=Ey,i.addGeoImages=vy,i.addIssue=Np,i.addIssueAssociation=Wy,i.addIssueAssociations=wt,i.addIssueAttachment=ip,i.addIssueAttachments=qi,i.addIssueComment=Ep,i.addIssueCommentAttachment=Ap,i.addIssueCommentAttachments=fp,i.addIssueComments=vp,i.addIssueType=Wf,i.addIssueTypeAttachment=sA,i.addIssueTypeAttachments=iA,i.addIssueTypeFieldValues=EA,i.addIssueTypeFieldValuesAttachment=af,i.addIssueTypeFieldValuesAttachments=xi,i.addIssueTypeFieldValuesMany=vA,i.addIssueTypeFields=GA,i.addIssueTypeFieldsAttachment=AA,i.addIssueTypeFieldsAttachments=fA,i.addIssueTypeFieldsMany=HA,i.addIssueTypeIdentifier=Sf,i.addIssueTypeIdentifierValue=Vf,i.addIssueTypeIdentifierValues=zf,i.addIssueTypeIdentifiers=Tf,i.addIssueTypeStatus=cS,i.addIssueTypeStatuses=dS,i.addIssueTypes=Kf,i.addIssueUpdate=hn,i.addIssueUpdates=mn,i.addIssues=Gi,i.addOrganization=iT,i.addOrganizationAccess=US,i.addOrganizationAccesses=LS,i.addOrganizations=sT,i.addProject=pI,i.addProjectAccess=OT,i.addProjectAccesses=PT,i.addProjectAttachment=BT,i.addProjectAttachments=jT,i.addProjectFile=JT,i.addProjectFiles=XT,i.addProjects=yI,i.addTeam=LI,i.addTeamMembership=MI,i.addTeamMemberships=RI,i.addTeams=kI,i.addUser=Tn,i.addUsers=vS,i.agentsReducer=pa,i.agentsSlice=Yt,i.areArraysEqual=LO,i.assetAttachmentReducer=Ra,i.assetAttachmentSlice=Jt,i.assetProcedureReducer=Qc,i.assetProcedureSlice=ls,i.assetProcedureStepFieldValuesAttachmentReducer=sr,i.assetProcedureStepFieldValuesAttachmentSlice=Ts,i.assetProcedureStepFieldValuesReducer=Ar,i.assetProcedureStepFieldValuesSlice=Fs,i.assetProcedureStepFieldsAttachmentReducer=Ed,i.assetProcedureStepFieldsAttachmentSlice=ps,i.assetProcedureStepFieldsReducer=Nd,i.assetProcedureStepFieldsSlice=fs,i.assetProcedureStepReducer=Mr,i.assetProcedureStepSlice=gs,i.assetProcedureTypeAttachmentReducer=$a,i.assetProcedureTypeAttachmentSlice=es,i.assetProcedureTypeFieldValuesAttachmentReducer=bc,i.assetProcedureTypeFieldValuesAttachmentSlice=as,i.assetProcedureTypeFieldValuesReducer=Uc,i.assetProcedureTypeFieldValuesSlice=us,i.assetProcedureTypeFieldsAttachmentReducer=xa,i.assetProcedureTypeFieldsAttachmentSlice=ss,i.assetProcedureTypeFieldsReducer=mc,i.assetProcedureTypeFieldsSlice=ns,i.assetProcedureTypeReducer=md,i.assetProcedureTypeSlice=ms,i.assetReducer=kr,i.assetSlice=_s,i.assetStageCompletionReducer=xr,i.assetStageCompletionSlice=vs,i.assetStageReducer=yu,i.assetStageSlice=Vs,i.assetTypeAttachmentReducer=wu,i.assetTypeAttachmentSlice=js,i.assetTypeFieldValuesAttachmentReducer=Al,i.assetTypeFieldValuesAttachmentSlice=ks,i.assetTypeFieldValuesReducer=El,i.assetTypeFieldValuesSlice=Ws,i.assetTypeFieldsAttachmentReducer=Nu,i.assetTypeFieldsAttachmentSlice=$s,i.assetTypeFieldsReducer=il,i.assetTypeFieldsSlice=Ls,i.assetTypeIdentifierReducer=Gl,i.assetTypeIdentifierSlice=Ks,i.assetTypeIdentifierValueReducer=no,i.assetTypeIdentifierValueSlice=Zs,i.assetTypeReducer=To,i.assetTypeSlice=Js,i.assetTypeStatusReducer=zo,i.assetTypeStatusSlice=Qs,i.assetTypeStatusSortFn=ca,i.authReducer=qo,i.authSlice=gt,i.baseReducer=GF,i.baseReducers=jn,i.blobToBase64=JO,i.categoryReducer=Zo,i.categorySlice=ei,i.clearTokens=WP,i.constructUploadedFilePayloads=ZO,i.createModelAdapter=R,i.createOfflineAction=mT,i.createPayload=V,i.createSelectionAdapter=DO,i.deleteAsset=qr,i.deleteAssetAttachment=Fa,i.deleteAssetAttachments=Qt,i.deleteAssetProcedure=Zc,i.deleteAssetProcedureStep=br,i.deleteAssetProcedureStepFieldValues=or,i.deleteAssetProcedureStepFieldValuesAttachment=Xd,i.deleteAssetProcedureStepFieldValuesAttachments=Os,i.deleteAssetProcedureStepFieldValuesMany=hr,i.deleteAssetProcedureStepFields=$d,i.deleteAssetProcedureStepFieldsAttachment=bd,i.deleteAssetProcedureStepFieldsAttachments=_d,i.deleteAssetProcedureStepFieldsMany=Ud,i.deleteAssetProcedureSteps=_r,i.deleteAssetProcedureType=ud,i.deleteAssetProcedureTypeAttachment=Da,i.deleteAssetProcedureTypeAttachments=Ca,i.deleteAssetProcedureTypeFieldValues=Cc,i.deleteAssetProcedureTypeFieldValuesAttachment=gc,i.deleteAssetProcedureTypeFieldValuesAttachments=ds,i.deleteAssetProcedureTypeFieldValuesMany=$c,i.deleteAssetProcedureTypeFields=oc,i.deleteAssetProcedureTypeFieldsAttachment=Xa,i.deleteAssetProcedureTypeFieldsAttachments=Qa,i.deleteAssetProcedureTypeFieldsMany=hc,i.deleteAssetProcedureTypes=ld,i.deleteAssetProcedures=hs,i.deleteAssetStage=hu,i.deleteAssetStageCompletion=Xr,i.deleteAssetStageCompletions=Qr,i.deleteAssetStages=mu,i.deleteAssetType=yo,i.deleteAssetTypeAttachment=gu,i.deleteAssetTypeAttachments=Ds,i.deleteAssetTypeFieldValues=bl,i.deleteAssetTypeFieldValuesAttachment=ol,i.deleteAssetTypeFieldValuesAttachments=Gs,i.deleteAssetTypeFieldValuesMany=_l,i.deleteAssetTypeFields=Qu,i.deleteAssetTypeFieldsAttachment=Cu,i.deleteAssetTypeFieldsAttachments=$u,i.deleteAssetTypeFieldsMany=xu,i.deleteAssetTypeIdentifier=$l,i.deleteAssetTypeIdentifierValue=xl,i.deleteAssetTypeIdentifierValues=eo,i.deleteAssetTypeIdentifiers=Ul,i.deleteAssetTypeStatus=Ro,i.deleteAssetTypeStatuses=wo,i.deleteAssetTypes=po,i.deleteAssets=Rs,i.deleteCategories=Wo,i.deleteCategory=Ho,i.deleteConversation=oP,i.deleteConversations=hP,i.deleteDocument=Sh,i.deleteDocumentAttachment=nh,i.deleteDocumentAttachments=ah,i.deleteDocuments=Th,i.deleteEmailDomain=Vh,i.deleteEmailDomains=zh,i.deleteForm=Zm,i.deleteFormIdentifier=Xh,i.deleteFormIdentifierValue=om,i.deleteFormIdentifierValues=hm,i.deleteFormIdentifiers=Qh,i.deleteFormRevision=fi,i.deleteFormRevisionAttachment=bm,i.deleteFormRevisionAttachments=_m,i.deleteFormRevisions=Si,i.deleteFormSubmission=Iy,i.deleteFormSubmissionAttachment=ry,i.deleteFormSubmissionAttachments=gi,i.deleteFormSubmissions=Ei,i.deleteForms=Jm,i.deleteGeoImage=By,i.deleteGeoImages=jy,i.deleteIssue=Yp,i.deleteIssueAssociation=Ky,i.deleteIssueAssociations=Et,i.deleteIssueAttachment=rp,i.deleteIssueAttachments=Di,i.deleteIssueComment=qp,i.deleteIssueCommentAttachment=Pp,i.deleteIssueCommentAttachments=Fp,i.deleteIssueComments=Dp,i.deleteIssueType=Qf,i.deleteIssueTypeAttachment=rA,i.deleteIssueTypeAttachments=uA,i.deleteIssueTypeFieldValues=qA,i.deleteIssueTypeFieldValuesAttachment=lf,i.deleteIssueTypeFieldValuesAttachments=en,i.deleteIssueTypeFieldValuesMany=DA,i.deleteIssueTypeFields=JA,i.deleteIssueTypeFieldsAttachment=PA,i.deleteIssueTypeFieldsAttachments=FA,i.deleteIssueTypeFieldsMany=XA,i.deleteIssueTypeIdentifier=gf,i.deleteIssueTypeIdentifierValue=Cf,i.deleteIssueTypeIdentifierValues=$f,i.deleteIssueTypeIdentifiers=bf,i.deleteIssueTypeStatus=hS,i.deleteIssueTypeStatuses=mS,i.deleteIssueTypes=xf,i.deleteIssueUpdate=yn,i.deleteIssueUpdates=pn,i.deleteIssues=Hi,i.deleteOrganization=cT,i.deleteOrganizationAccess=WS,i.deleteOrganizationAccesses=KS,i.deleteOrganizations=dT,i.deleteProject=SI,i.deleteProjectAccess=MT,i.deleteProjectAccesses=RT,i.deleteProjectAttachment=UT,i.deleteProjectAttachments=LT,i.deleteProjectFile=eI,i.deleteProjectFiles=tI,i.deleteProjects=TI,i.deleteTeam=KI,i.deleteTeamMembership=zI,i.deleteTeamMemberships=BI,i.deleteTeams=YI,i.deleteUser=In,i.deleteUsers=BS,i.dequeue=oO,i.discard=mO,i.documentAttachmentReducer=uh,i.documentAttachmentSlice=ii,i.documentSlice=ai,i.documentsReducer=Ih,i.downloadFile=XO,i.downloadInMemoryFile=YO,i.emailDomainsReducer=Dh,i.emailDomainsSlice=di,i.emailRegex=nP,i.enqueue=lO,i.enqueueRequest=pT,i.extractResponseFromError=pO,i.fallbackToEmptyArray=T,i.fallbackToEmptyObject=pt,i.fileReducer=kh,i.fileSlice=ui,i.fileToBlob=ta,i.formIdentifierReducer=sm,i.formIdentifierSlice=li,i.formIdentifierValueReducer=Am,i.formIdentifierValueSlice=hi,i.formReducer=Xm,i.formRevisionAttachmentReducer=Em,i.formRevisionAttachmentSlice=mi,i.formRevisionReducer=Um,i.formRevisionsSlice=yi,i.formSlice=Ii,i.formSubmissionAttachmentReducer=hy,i.formSubmissionAttachmentSlice=Pi,i.formSubmissionReducer=by,i.formSubmissionSlice=Ri,i.geoImageReducer=$y,i.geoImageSlice=Vi,i.getAssetProcedureStepSubTree=aa,i.getAssetProcedureStepTrees=aP,i.getClientSDK=IO,i.getClientStore=dt,i.getDocumentSubTree=ua,i.getDocumentTrees=cP,i.getFileIdentifier=KO,i.getFileS3Key=Wt,i.getLocalDateString=xn,i.getLocalRelativeDateString=HO,i.getOutboxCoordinator=tt,i.getRenamedFile=ea,i.getRequestDescription=O,i.hashFile=it,i.initSDK=Ib,i.initializeAssetAttachments=fa,i.initializeAssetProcedureStepFieldValues=nr,i.initializeAssetProcedureStepFieldValuesAttachments=Hd,i.initializeAssetProcedureStepFields=Vd,i.initializeAssetProcedureStepFieldsAttachments=Sd,i.initializeAssetProcedureSteps=Sr,i.initializeAssetProcedureTypeAttachments=Ea,i.initializeAssetProcedureTypeFieldValues=vc,i.initializeAssetProcedureTypeFieldValuesAttachments=Sc,i.initializeAssetProcedureTypeFields=nc,i.initializeAssetProcedureTypeFieldsAttachments=Ga,i.initializeAssetProcedureTypes=nd,i.initializeAssetProcedures=Hc,i.initializeAssetStageCompletions=Gr,i.initializeAssetStages=au,i.initializeAssetTypeAttachments=Su,i.initializeAssetTypeFieldValues=Sl,i.initializeAssetTypeFieldValuesAttachments=al,i.initializeAssetTypeFields=Hu,i.initializeAssetTypeFieldsAttachments=vu,i.initializeAssetTypeIdentifierValues=Wl,i.initializeAssetTypeIdentifiers=Vl,i.initializeAssetTypeStatuses=Oo,i.initializeAssetTypes=co,i.initializeAssets=Vr,i.initializeCategories=Co,i.initializeConversations=oa,i.initializeDocumentAttachments=Xo,i.initializeDocuments=oh,i.initializeEmailDomains=bh,i.initializeFormIdentifierValues=nm,i.initializeFormIdentifiers=Gh,i.initializeFormRevisionAttachments=Sm,i.initializeFormRevisions=Vm,i.initializeFormSubmissionAttachments=sy,i.initializeFormSubmissions=yy,i.initializeForms=km,i.initializeGeoImages=My,i.initializeIssueAssociations=Ly,i.initializeIssueAttachments=sp,i.initializeIssueCommentAttachments=pp,i.initializeIssueComments=wp,i.initializeIssueTypeAttachments=tA,i.initializeIssueTypeFieldValues=wA,i.initializeIssueTypeFieldValuesAttachments=nf,i.initializeIssueTypeFields=NA,i.initializeIssueTypeFieldsAttachments=pA,i.initializeIssueTypeIdentifierValues=vf,i.initializeIssueTypeIdentifiers=ff,i.initializeIssueTypeStatuses=aS,i.initializeIssueTypes=Hf,i.initializeIssueUpdates=SS,i.initializeIssues=kp,i.initializeOrganizationAccesses=$S,i.initializeOrganizations=xS,i.initializeProjectAccesses=IT,i.initializeProjectAttachments=zT,i.initializeProjectFiles=KT,i.initializeProjects=oI,i.initializeTeamMemberships=_I,i.initializeTeams=UI,i.initializeUsers=RS,i.isToday=GO,i.issueAssociationReducer=ep,i.issueAssociationSlice=Bi,i.issueAttachmentReducer=mp,i.issueAttachmentSlice=ji,i.issueCommentAttachmentReducer=Mp,i.issueCommentAttachmentSlice=$i,i.issueCommentReducer=Up,i.issueCommentSlice=Li,i.issueReducer=xp,i.issueSlice=Ni,i.issueTypeAttachmentReducer=mA,i.issueTypeAttachmentSlice=Wi,i.issueTypeFieldValuesAttachmentReducer=pf,i.issueTypeFieldValuesAttachmentSlice=Qi,i.issueTypeFieldValuesReducer=LA,i.issueTypeFieldValuesSlice=Ji,i.issueTypeFieldsAttachmentReducer=MA,i.issueTypeFieldsAttachmentSlice=Yi,i.issueTypeFieldsReducer=tf,i.issueTypeFieldsSlice=Xi,i.issueTypeIdentifierReducer=wf,i.issueTypeIdentifierSlice=sn,i.issueTypeIdentifierValueReducer=Nf,i.issueTypeIdentifierValueSlice=an,i.issueTypeReducer=iS,i.issueTypeSlice=cn,i.issueTypeStatusReducer=AS,i.issueTypeStatusSlice=rn,i.issueTypeStatusSortFn=da,i.issueUpdateReducer=_S,i.issueUpdateSlice=on,i.logOnlyOnce=QO,i.markAsDeleted=AT,i.markForDeletion=RF,i.memoize=Gt,i.organizationAccessReducer=YS,i.organizationAccessSlice=Pn,i.organizationReducer=hT,i.organizationSlice=Fn,i.outboxReducer=ST,i.outboxSlice=gn,i.overmapEnhancer=xF,i.overmapReducer=HF,i.overmapReducers=tO,i.performRequest=Un,i.performRequestFromAction=hO,i.projectAccessReducer=wT,i.projectAccessSlice=bn,i.projectAttachmentReducer=HT,i.projectAttachmentSlice=Mn,i.projectFileReducer=uI,i.projectFileSlice=wn,i.projectReducer=II,i.projectSlice=En,i.rehydratedReducer=gI,i.rehydratedSlice=vn,i.restructureSelectorWithArgs=S,i.runMiddleware=gO,i.saveActiveProjectFileBounds=nI,i.selectAccessToken=KP,i.selectAccessesByUserOfProject=EF,i.selectAccessibleProjects=jF,i.selectActiveOrganizationAccess=gF,i.selectActiveProjectFileId=zF,i.selectAllDocumentAttachments=ni,i.selectAssetAttachmentById=ba,i.selectAssetAttachmentMapping=ga,i.selectAssetAttachments=xt,i.selectAssetAttachmentsByIds=_a,i.selectAssetById=Ur,i.selectAssetProcedureById=td,i.selectAssetProcedureStepById=Rr,i.selectAssetProcedureStepFieldValues=ut,i.selectAssetProcedureStepFieldValuesAttachmentById=xd,i.selectAssetProcedureStepFieldValuesAttachments=Ps,i.selectAssetProcedureStepFieldValuesAttachmentsByIds=er,i.selectAssetProcedureStepFieldValuesAttachmentsMapping=Qd,i.selectAssetProcedureStepFieldValuesById=yr,i.selectAssetProcedureStepFieldValuesByIds=pr,i.selectAssetProcedureStepFieldValuesMapping=mr,i.selectAssetProcedureStepFieldValuesOfAsset=MP,i.selectAssetProcedureStepFieldValuesOfAssetProcedure=RP,i.selectAssetProcedureStepFieldValuesOfAssetProcedureStep=wP,i.selectAssetProcedureStepFields=It,i.selectAssetProcedureStepFieldsAttachmentById=Rd,i.selectAssetProcedureStepFieldsAttachments=As,i.selectAssetProcedureStepFieldsAttachmentsByIds=wd,i.selectAssetProcedureStepFieldsAttachmentsMapping=Md,i.selectAssetProcedureStepFieldsById=Ld,i.selectAssetProcedureStepFieldsByIds=kd,i.selectAssetProcedureStepFieldsMapping=Ss,i.selectAssetProcedureStepFieldsOfAssetProcedureStep=gP,i.selectAssetProcedureStepMapping=Ot,i.selectAssetProcedureSteps=bs,i.selectAssetProcedureStepsByIds=wr,i.selectAssetProcedureStepsMappingOfAssetProcedureType=EP,i.selectAssetProcedureStepsOfAssetProcedureType=vP,i.selectAssetProcedureTypeAttachmentById=La,i.selectAssetProcedureTypeAttachmentMapping=Ua,i.selectAssetProcedureTypeAttachments=ts,i.selectAssetProcedureTypeAttachmentsByIds=ka,i.selectAssetProcedureTypeById=pd,i.selectAssetProcedureTypeFieldValues=St,i.selectAssetProcedureTypeFieldValuesAttachmentById=Mc,i.selectAssetProcedureTypeFieldValuesAttachments=rs,i.selectAssetProcedureTypeFieldValuesAttachmentsByIds=Rc,i.selectAssetProcedureTypeFieldValuesAttachmentsMapping=_c,i.selectAssetProcedureTypeFieldValuesById=kc,i.selectAssetProcedureTypeFieldValuesByIds=Nc,i.selectAssetProcedureTypeFieldValuesMapping=Lc,i.selectAssetProcedureTypeFieldValuesOfAsset=TP,i.selectAssetProcedureTypeFields=ft,i.selectAssetProcedureTypeFieldsAttachmentById=tc,i.selectAssetProcedureTypeFieldsAttachments=is,i.selectAssetProcedureTypeFieldsAttachmentsByIds=sc,i.selectAssetProcedureTypeFieldsAttachmentsMapping=ec,i.selectAssetProcedureTypeFieldsById=pc,i.selectAssetProcedureTypeFieldsByIds=Ac,i.selectAssetProcedureTypeFieldsMapping=yc,i.selectAssetProcedureTypeFieldsOfAssetProcedureType=fP,i.selectAssetProcedureTypes=ys,i.selectAssetProcedureTypesByIds=Ad,i.selectAssetProcedureTypesMapping=yd,i.selectAssetProcedureTypesOfOrganization=PP,i.selectAssetProcedures=Tt,i.selectAssetProceduresByIds=sd,i.selectAssetProceduresMapping=xc,i.selectAssetProceduresOfAssetProcedureType=ed,i.selectAssetProceduresOfAssetType=OP,i.selectAssetStageById=pu,i.selectAssetStageCompletionById=su,i.selectAssetStageCompletionMapping=eu,i.selectAssetStageCompletions=tu,i.selectAssetStageCompletionsByIds=iu,i.selectAssetStages=Bs,i.selectAssetStagesByIds=Au,i.selectAssetStagesMappingOfAssetProcedureType=zP,i.selectAssetStagesOfAssetProcedureType=BP,i.selectAssetTypeAttachmentById=_u,i.selectAssetTypeAttachmentMapping=bu,i.selectAssetTypeAttachments=Cs,i.selectAssetTypeAttachmentsByIds=Mu,i.selectAssetTypeById=fo,i.selectAssetTypeFieldValues=Pt,i.selectAssetTypeFieldValuesAttachmentById=ml,i.selectAssetTypeFieldValuesAttachments=Hs,i.selectAssetTypeFieldValuesAttachmentsByIds=yl,i.selectAssetTypeFieldValuesAttachmentsMapping=hl,i.selectAssetTypeFieldValuesById=Rl,i.selectAssetTypeFieldValuesByIds=wl,i.selectAssetTypeFieldValuesMapping=Ml,i.selectAssetTypeFieldValuesOfAsset=CP,i.selectAssetTypeFields=lt,i.selectAssetTypeFieldsAttachmentById=Lu,i.selectAssetTypeFieldsAttachments=Us,i.selectAssetTypeFieldsAttachmentsByIds=ku,i.selectAssetTypeFieldsAttachmentsMapping=Uu,i.selectAssetTypeFieldsById=tl,i.selectAssetTypeFieldsByIds=sl,i.selectAssetTypeFieldsMapping=el,i.selectAssetTypeFieldsOfAssetType=qP,i.selectAssetTypeIdentifierById=kl,i.selectAssetTypeIdentifierMapping=Ll,i.selectAssetTypeIdentifierValueById=so,i.selectAssetTypeIdentifierValueMapping=to,i.selectAssetTypeIdentifierValues=Ft,i.selectAssetTypeIdentifierValuesByIds=io,i.selectAssetTypeIdentifierValuesOfAsset=LP,i.selectAssetTypeIdentifierValuesOfIdentifier=kP,i.selectAssetTypeIdentifiers=Ys,i.selectAssetTypeIdentifiersByIds=Nl,i.selectAssetTypeIdentifiersOfAssetType=UP,i.selectAssetTypeStatusById=vo,i.selectAssetTypeStatusMapping=Eo,i.selectAssetTypeStatuses=xs,i.selectAssetTypeStatusesByIds=Vo,i.selectAssetTypeStatusesOfAssetType=GP,i.selectAssetTypeValuesOfAssetType=$P,i.selectAssetTypes=Xs,i.selectAssetTypesByIds=So,i.selectAssetTypesMapping=Ao,i.selectAssetTypesOfOrganization=NP,i.selectAssets=ws,i.selectAssetsByIds=Lr,i.selectAssetsMapping=$r,i.selectAssetsOfAssetType=Es,i.selectAttachmentsOfAsset=Ma,i.selectAttachmentsOfAssetProcedureStepFieldValues=tr,i.selectAttachmentsOfAssetProcedureStepFields=FP,i.selectAttachmentsOfAssetProcedureType=pP,i.selectAttachmentsOfAssetProcedureTypeFieldValues=wc,i.selectAttachmentsOfAssetProcedureTypeFields=AP,i.selectAttachmentsOfAssetType=Ru,i.selectAttachmentsOfAssetTypeFieldValues=pl,i.selectAttachmentsOfAssetTypeFields=jP,i.selectAttachmentsOfDocument=JP,i.selectAttachmentsOfFormRevision=nF,i.selectAttachmentsOfFormSubmission=oy,i.selectAttachmentsOfIssue=lp,i.selectAttachmentsOfIssueComment=rF,i.selectAttachmentsOfIssueType=oF,i.selectAttachmentsOfIssueTypeFieldValues=yf,i.selectAttachmentsOfIssueTypeFields=hF,i.selectAttachmentsOfProject=VF,i.selectCategories=ti,i.selectCategoriesByIds=Yo,i.selectCategoriesOfProject=ZP,i.selectCategoryById=si,i.selectCategoryMapping=Ko,i.selectCommentsOfIssue=uF,i.selectConversation=yP,i.selectConversationMapping=Zt,i.selectConversations=mP,i.selectCurrentUser=qS,i.selectDeletedRequests=_F,i.selectDescendantsOfAssetProcedureStep=Er,i.selectDescendantsOfDocument=Fh,i.selectDocumentAttachmentById=dh,i.selectDocumentAttachmentMapping=ch,i.selectDocumentAttachmentsByIds=rh,i.selectDocumentById=Oh,i.selectDocuments=bt,i.selectDocumentsByIds=Ph,i.selectDocumentsMapping=ci,i.selectEmailDomainById=jh,i.selectEmailDomains=ri,i.selectEmailDomainsAsMapping=Bh,i.selectEmailDomainsByIds=qh,i.selectEmailDomainsOfOrganization=xP,i.selectFieldValuesOfAssetProcedure=IP,i.selectFormById=xm,i.selectFormIdentifierById=em,i.selectFormIdentifierMapping=xh,i.selectFormIdentifierValueById=ym,i.selectFormIdentifierValueMapping=mm,i.selectFormIdentifierValues=_t,i.selectFormIdentifierValuesByIds=pm,i.selectFormIdentifierValuesOfFormSubmission=sF,i.selectFormIdentifierValuesOfIdentifier=iF,i.selectFormIdentifiers=oi,i.selectFormIdentifiersByIds=tm,i.selectFormIdentifiersOfForm=tF,i.selectFormMapping=Qm,i.selectFormRevisionAttachmentById=Rm,i.selectFormRevisionAttachments=Mm,i.selectFormRevisionAttachmentsByIds=wm,i.selectFormRevisionAttachmentsMapping=Mt,i.selectFormRevisionById=Dm,i.selectFormRevisionMapping=Ti,i.selectFormRevisions=Rt,i.selectFormRevisionsByIds=Cm,i.selectFormRevisionsOfForm=$m,i.selectFormSubmissionAttachemntsByIds=Mi,i.selectFormSubmissionAttachmentById=uy,i.selectFormSubmissionAttachments=_i,i.selectFormSubmissionAttachmentsByIds=ly,i.selectFormSubmissionAttachmentsMapping=bi,i.selectFormSubmissionById=Py,i.selectFormSubmissions=Oy,i.selectFormSubmissionsByIds=Fy,i.selectFormSubmissionsMapping=vi,i.selectFormSubmissionsOfForm=gy,i.selectForms=Oi,i.selectFormsByIds=ey,i.selectFormsOfOrganization=cF,i.selectGeoImageById=Dy,i.selectGeoImageMapping=qy,i.selectGeoImages=zi,i.selectGeoImagesByIds=Cy,i.selectGeoImagesOfProject=dF,i.selectIsImportingProjectFile=BF,i.selectIsLoggedIn=YP,i.selectIssueAssociationById=Zy,i.selectIssueAssociationMapping=ot,i.selectIssueAssociations=Yy,i.selectIssueAssociationsByIds=Jy,i.selectIssueAssociationsOfAsset=xy,i.selectIssueAssociationsOfIssue=Qy,i.selectIssueAssociationsToIssue=Xy,i.selectIssueAttachmentById=op,i.selectIssueAttachmentMapping=up,i.selectIssueAttachments=Ci,i.selectIssueAttachmentsByIds=hp,i.selectIssueById=Jp,i.selectIssueCommentAttachmentById=bp,i.selectIssueCommentAttachmentMapping=gp,i.selectIssueCommentAttachments=Ui,i.selectIssueCommentAttachmentsByIds=_p,i.selectIssueCommentById=Cp,i.selectIssueCommentMapping=ki,i.selectIssueCommentsByIds=$p,i.selectIssueMapping=Zp,i.selectIssueTypeAttachmentById=oA,i.selectIssueTypeAttachmentMapping=lA,i.selectIssueTypeAttachments=Ki,i.selectIssueTypeAttachmentsByIds=hA,i.selectIssueTypeById=tS,i.selectIssueTypeFieldValues=Vt,i.selectIssueTypeFieldValuesAttachmentById=hf,i.selectIssueTypeFieldValuesAttachments=tn,i.selectIssueTypeFieldValuesAttachmentsByIds=mf,i.selectIssueTypeFieldValuesAttachmentsMapping=of,i.selectIssueTypeFieldValuesById=$A,i.selectIssueTypeFieldValuesByIds=UA,i.selectIssueTypeFieldValuesMapping=CA,i.selectIssueTypeFieldValuesOfIssue=mF,i.selectIssueTypeFields=ht,i.selectIssueTypeFieldsAttachmentById=bA,i.selectIssueTypeFieldsAttachments=Zi,i.selectIssueTypeFieldsAttachmentsByIds=_A,i.selectIssueTypeFieldsAttachmentsMapping=gA,i.selectIssueTypeFieldsById=xA,i.selectIssueTypeFieldsByIds=ef,i.selectIssueTypeFieldsMapping=QA,i.selectIssueTypeFieldsOfIssueType=yF,i.selectIssueTypeIdentifierById=Mf,i.selectIssueTypeIdentifierMapping=_f,i.selectIssueTypeIdentifierValueById=Lf,i.selectIssueTypeIdentifierValueMapping=Uf,i.selectIssueTypeIdentifierValues=zt,i.selectIssueTypeIdentifierValuesByIds=kf,i.selectIssueTypeIdentifierValuesOfIdentifier=TF,i.selectIssueTypeIdentifierValuesOfIssue=SF,i.selectIssueTypeIdentifiers=nn,i.selectIssueTypeIdentifiersByIds=Rf,i.selectIssueTypeIdentifiersOfIssueType=fF,i.selectIssueTypeMapping=eS,i.selectIssueTypeStatusById=ln,i.selectIssueTypeStatusMapping=yS,i.selectIssueTypeStatuses=un,i.selectIssueTypeStatusesByIds=pS,i.selectIssueTypeStatusesOfIssueType=OF,i.selectIssueTypeValuesOfIssueType=AF,i.selectIssueTypes=dn,i.selectIssueTypesByIds=sS,i.selectIssueTypesOfOrganization=IF,i.selectIssueUpdateById=FS,i.selectIssueUpdateMapping=An,i.selectIssueUpdates=fn,i.selectIssueUpdatesByIds=gS,i.selectIssueUpdatesOfIssue=bS,i.selectIssues=vt,i.selectIssuesByIds=Xp,i.selectIssuesOfIssueType=Qp,i.selectIssuesOfProject=lF,i.selectLatestAssetProcedureStepFieldsOfAssetProcedureStep=bP,i.selectLatestAssetProcedureTypeFieldsOfAssetProcedureType=SP,i.selectLatestAssetTypeFieldsOfAssetType=DP,i.selectLatestFieldsByAssetProcedureStep=_P,i.selectLatestFormRevisionOfForm=aF,i.selectLatestIssueTypeFieldsOfIssueType=pF,i.selectLatestRetryTime=MF,i.selectMembershipsByUserOfTeam=UF,i.selectNumberOfAssetsOfAssetType=VP,i.selectOrganizationAccessById=ZS,i.selectOrganizationAccessMapping=qt,i.selectOrganizationAccessUserMapping=XS,i.selectOrganizationAccessesByIds=JS,i.selectOrganizationById=lT,i.selectOrganizationDocuments=QP,i.selectOrganizations=uT,i.selectOrganizationsByIds=oT,i.selectOrganizationsMapping=rT,i.selectProjectAccessById=ET,i.selectProjectAccessMapping=_n,i.selectProjectAccesses=mt,i.selectProjectAccessesByIds=vT,i.selectProjectAccessesOfProject=wF,i.selectProjectAttachmentById=NT,i.selectProjectAttachmentMapping=kT,i.selectProjectAttachments=Rn,i.selectProjectAttachmentsByIds=GT,i.selectProjectById=PI,i.selectProjectDocuments=XP,i.selectProjectFileById=dI,i.selectProjectFileMapping=aI,i.selectProjectFiles=cI,i.selectProjectFilesByIds=rI,i.selectProjectMapping=OI,i.selectProjects=Dt,i.selectProjectsByIds=FI,i.selectProjectsOfOrganization=qF,i.selectRehydrated=$F,i.selectStageMapping=zs,i.selectTeamById=JI,i.selectTeamMembershipById=DI,i.selectTeamMemberships=Ct,i.selectTeamMembershipsByIds=CI,i.selectTeamMembershipsMapping=qI,i.selectTeams=Bn,i.selectTeamsByIds=XI,i.selectTeamsMapping=ZI,i.selectTeamsOfOrganization=kF,i.selectUploadUrl=Lh,i.selectUserById=jt,i.selectUsers=Bt,i.selectUsersByIds=DS,i.selectUsersMapping=On,i.selectUsersOfOrganization=bF,i.selectUsersOfProject=vF,i.selectUsersOfTeam=LF,i.setActiveProjectFileId=iI,i.setAsset=Dr,i.setAssetAttachment=Ta,i.setAssetAttachments=Ia,i.setAssetProcedure=Jc,i.setAssetProcedureStep=Tr,i.setAssetProcedureStepFieldValues=dr,i.setAssetProcedureStepFieldValuesAttachment=Kd,i.setAssetProcedureStepFieldValuesAttachments=Yd,i.setAssetProcedureStepFieldValuesMany=rr,i.setAssetProcedureStepFields=jd,i.setAssetProcedureStepFieldsAttachment=Od,i.setAssetProcedureStepFieldsAttachments=Pd,i.setAssetProcedureStepFieldsMany=qd,i.setAssetProcedureSteps=Ir,i.setAssetProcedureType=od,i.setAssetProcedureTypeAttachment=za,i.setAssetProcedureTypeAttachments=Ba,i.setAssetProcedureTypeFieldValues=Bc,i.setAssetProcedureTypeFieldValuesAttachment=Ic,i.setAssetProcedureTypeFieldValuesAttachments=Oc,i.setAssetProcedureTypeFieldValuesMany=jc,i.setAssetProcedureTypeFields=dc,i.setAssetProcedureTypeFieldsAttachment=Ka,i.setAssetProcedureTypeFieldsAttachments=Ya,i.setAssetProcedureTypeFieldsMany=rc,i.setAssetProcedureTypes=hd,i.setAssetProcedures=Xc,i.setAssetStage=cu,i.setAssetStageCompletion=Kr,i.setAssetStageCompletions=Yr,i.setAssetStages=du,i.setAssetType=ro,i.setAssetTypeAttachment=Iu,i.setAssetTypeAttachments=Ou,i.setAssetTypeFieldValues=Ol,i.setAssetTypeFieldValuesAttachment=dl,i.setAssetTypeFieldValuesAttachments=rl,i.setAssetTypeFieldValuesMany=Pl,i.setAssetTypeFields=Yu,i.setAssetTypeFieldsAttachment=Bu,i.setAssetTypeFieldsAttachments=ju,i.setAssetTypeFieldsMany=Zu,i.setAssetTypeIdentifier=jl,i.setAssetTypeIdentifierValue=Zl,i.setAssetTypeIdentifierValues=Jl,i.setAssetTypeIdentifiers=ql,i.setAssetTypeStatus=go,i.setAssetTypeStatuses=bo,i.setAssetTypes=uo,i.setAssets=Cr,i.setCategories=ko,i.setCategory=Lo,i.setClientSDK=TO,i.setClientStore=fO,i.setConversation=ma,i.setConversations=uP,i.setCurrentUser=PF,i.setDocument=yh,i.setDocumentAttachment=eh,i.setDocumentAttachments=th,i.setDocuments=ph,i.setEmailDomain=Rh,i.setEmailDomains=wh,i.setForm=Hm,i.setFormIdentifier=Kh,i.setFormIdentifierValue=dm,i.setFormIdentifierValues=rm,i.setFormIdentifiers=Yh,i.setFormRevision=zm,i.setFormRevisionAttachment=Om,i.setFormRevisionAttachments=Pm,i.setFormRevisions=Bm,i.setFormSubmission=py,i.setFormSubmissionAttachment=ny,i.setFormSubmissionAttachments=ay,i.setFormSubmissions=Ay,i.setForms=Wm,i.setGeoImage=Ry,i.setGeoImages=wy,i.setIsImportingProjectFile=sI,i.setIssue=Gp,i.setIssueAssociation=Ny,i.setIssueAssociations=ky,i.setIssueAttachment=np,i.setIssueAttachments=ap,i.setIssueComment=Vp,i.setIssueCommentAttachment=Sp,i.setIssueCommentAttachments=Tp,i.setIssueComments=zp,i.setIssueType=Yf,i.setIssueTypeAttachment=nA,i.setIssueTypeAttachments=aA,i.setIssueTypeFieldValues=VA,i.setIssueTypeFieldValuesAttachment=cf,i.setIssueTypeFieldValuesAttachments=df,i.setIssueTypeFieldValuesMany=zA,i.setIssueTypeFields=WA,i.setIssueTypeFieldsAttachment=SA,i.setIssueTypeFieldsAttachments=TA,i.setIssueTypeFieldsMany=KA,i.setIssueTypeIdentifier=If,i.setIssueTypeIdentifierValue=Bf,i.setIssueTypeIdentifierValues=jf,i.setIssueTypeIdentifiers=Of,i.setIssueTypeStatus=rS,i.setIssueTypeStatuses=uS,i.setIssueTypes=Zf,i.setIssueUpdate=TS,i.setIssueUpdates=IS,i.setIssues=Hp,i.setLoggedIn=jo,i.setOrganization=tT,i.setOrganizationAccess=kS,i.setOrganizationAccesses=NS,i.setOrganizations=eT,i.setProfilePicture=FF,i.setProject=mI,i.setProjectAccess=FT,i.setProjectAccesses=gT,i.setProjectAttachment=qT,i.setProjectAttachments=DT,i.setProjectFile=YT,i.setProjectFiles=ZT,i.setProjects=hI,i.setRehydrated=CF,i.setTeam=NI,i.setTeamMembership=wI,i.setTeamMemberships=EI,i.setTeams=GI,i.setTokens=HP,i.setUploadUrl=Uh,i.setUser=ES,i.setUsers=wS,i.shallowEqual=UO,i.slugify=sP,i.spacesToDashesLower=tP,i.teamMembershipReducer=jI,i.teamMembershipSlice=Vn,i.teamReducer=QI,i.teamSlice=zn,i.toFileNameSafeString=eP,i.toUuidArray=D,i.toUuidIdRecord=xO,i.truncate=iP,i.updateAsset=Br,i.updateAssetAttachment=Oa,i.updateAssetAttachments=Pa,i.updateAssetProcedure=Kc,i.updateAssetProcedureStep=Fr,i.updateAssetProcedureStepFieldValues=ur,i.updateAssetProcedureStepFieldValuesAttachment=Zd,i.updateAssetProcedureStepFieldValuesAttachments=Jd,i.updateAssetProcedureStepFieldValuesMany=lr,i.updateAssetProcedureStepFields=Dd,i.updateAssetProcedureStepFieldsAttachment=Fd,i.updateAssetProcedureStepFieldsAttachments=gd,i.updateAssetProcedureStepFieldsMany=Cd,i.updateAssetProcedureSteps=gr,i.updateAssetProcedureType=dd,i.updateAssetProcedureTypeAttachment=ja,i.updateAssetProcedureTypeAttachments=qa,i.updateAssetProcedureTypeFieldValues=qc,i.updateAssetProcedureTypeFieldValuesAttachment=Pc,i.updateAssetProcedureTypeFieldValuesAttachments=Fc,i.updateAssetProcedureTypeFieldValuesMany=Dc,i.updateAssetProcedureTypeFields=uc,i.updateAssetProcedureTypeFieldsAttachment=Za,i.updateAssetProcedureTypeFieldsAttachments=Ja,i.updateAssetProcedureTypeFieldsMany=lc,i.updateAssetProcedureTypes=rd,i.updateAssetProcedures=Yc,i.updateAssetStage=lu,i.updateAssetStageCompletion=Zr,i.updateAssetStageCompletions=Jr,i.updateAssetStages=ou,i.updateAssetType=ho,i.updateAssetTypeAttachment=Pu,i.updateAssetTypeAttachments=Fu,i.updateAssetTypeFieldValues=Fl,i.updateAssetTypeFieldValuesAttachment=ul,i.updateAssetTypeFieldValuesAttachments=ll,i.updateAssetTypeFieldValuesMany=gl,i.updateAssetTypeFields=Ju,i.updateAssetTypeFieldsAttachment=qu,i.updateAssetTypeFieldsAttachments=Du,i.updateAssetTypeFieldsMany=Xu,i.updateAssetTypeIdentifier=Dl,i.updateAssetTypeIdentifierValue=Xl,i.updateAssetTypeIdentifierValues=Ql,i.updateAssetTypeIdentifiers=Cl,i.updateAssetTypeStatus=_o,i.updateAssetTypeStatuses=Mo,i.updateAssetTypes=mo,i.updateAssets=jr,i.updateCategories=Go,i.updateCategory=No,i.updateConversation=ya,i.updateConversations=lP,i.updateDocument=Ah,i.updateDocumentAttachment=sh,i.updateDocumentAttachments=ih,i.updateDocuments=fh,i.updateEmailDomain=Eh,i.updateEmailDomains=vh,i.updateForm=Km,i.updateFormIdentifier=Zh,i.updateFormIdentifierValue=um,i.updateFormIdentifierValues=lm,i.updateFormIdentifiers=Jh,i.updateFormRevision=jm,i.updateFormRevisionAttachment=Fm,i.updateFormRevisionAttachments=gm,i.updateFormRevisions=qm,i.updateFormSubmission=Sy,i.updateFormSubmissionAttachment=cy,i.updateFormSubmissionAttachments=dy,i.updateFormSubmissions=Ty,i.updateForms=Ym,i.updateGeoImage=Vy,i.updateGeoImages=zy,i.updateIssue=Wp,i.updateIssueAssociation=Gy,i.updateIssueAssociations=Hy,i.updateIssueAttachment=cp,i.updateIssueAttachments=dp,i.updateIssueComment=Bp,i.updateIssueCommentAttachment=Ip,i.updateIssueCommentAttachments=Op,i.updateIssueComments=jp,i.updateIssueType=Jf,i.updateIssueTypeAttachment=cA,i.updateIssueTypeAttachments=dA,i.updateIssueTypeFieldValues=BA,i.updateIssueTypeFieldValuesAttachment=rf,i.updateIssueTypeFieldValuesAttachments=uf,i.updateIssueTypeFieldValuesMany=jA,i.updateIssueTypeFields=YA,i.updateIssueTypeFieldsAttachment=IA,i.updateIssueTypeFieldsAttachments=OA,i.updateIssueTypeFieldsMany=ZA,i.updateIssueTypeIdentifier=Pf,i.updateIssueTypeIdentifierValue=qf,i.updateIssueTypeIdentifierValues=Df,i.updateIssueTypeIdentifiers=Ff,i.updateIssueTypeStatus=lS,i.updateIssueTypeStatuses=oS,i.updateIssueTypes=Xf,i.updateIssueUpdate=OS,i.updateIssueUpdates=PS,i.updateIssues=Kp,i.updateOrganization=aT,i.updateOrganizationAccess=GS,i.updateOrganizationAccesses=HS,i.updateOrganizations=nT,i.updateProject=fI,i.updateProjectAccess=bT,i.updateProjectAccesses=_T,i.updateProjectAttachment=CT,i.updateProjectAttachments=$T,i.updateProjectFile=QT,i.updateProjectFiles=xT,i.updateProjects=AI,i.updateTeam=HI,i.updateTeamMembership=vI,i.updateTeamMemberships=VI,i.updateTeams=WI,i.updateUser=zS,i.updateUsers=VS,i.useSelectorBuilder=CO,i.useSelectorFactory=$O,i.userReducer=jS,i.userSlice=Sn,i.uuidObj=M,i.uuidObjSortFn=Kt,i.uuidSortFn=At,i.versioningReducer=eO,i.versioningSlice=xI,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
14
+ external URLs and therefore not prepended with VITE_API_URL.`;throw new Error(f)}const p=d.type.split("/")[1];if(!p)throw new Error("File has no extension");const A=a??h+"."+p;if(d=xn(d,A),!d.name)throw new Error("Failed to set file's name");await this.addCache(d,h),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:m.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 Cg extends v{constructor(){super(...arguments);y(this,"name","Form Identifier");y(this,"url","/form-identifiers");y(this,"actions",{addOne:Hh,addMany:Wh,setOne:Kh,setMany:Yh,updateOne:Zh,updateMany:Jh,deleteOne:Xh,deleteMany:Qh,initialize:Gh});y(this,"selectors",{selectById:em,selectByIds:tm})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.form],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}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:O(m.PATCH,this.name,!1),method:m.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:O(m.DELETE,this.name,!1),method:m.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 $g extends v{constructor(){super(...arguments);y(this,"name","Form Identifier Value");y(this,"url","/form-identifier-values");y(this,"actions",{addOne:am,addMany:cm,setOne:dm,setMany:rm,updateOne:um,updateMany:lm,deleteOne:om,deleteMany:hm,initialize:nm});y(this,"selectors",{selectById:ym,selectByIds:pm})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[e.form_submission,e.form_identifier],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}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:O(m.PATCH,this.name,!1),method:m.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:O(m.DELETE,this.name,!1),method:m.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 Ug extends v{constructor(){super(...arguments);y(this,"name","Form Revision Attachment");y(this,"url","/form-revision-attachments");y(this,"actions",{addOne:Tm,addMany:Im,setOne:Om,setMany:Pm,updateOne:Fm,updateMany:gm,deleteOne:bm,deleteMany:_m,initialize:Sm});y(this,"selectors",{selectById:Rm,selectByIds:wm})}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=[],h=[];for(const f of e){const{revisionUuid:I,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:I,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:I};h.push(E)}this.dispatch(n(d));const p=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:h,files:Object.values(u)},blockers:d.map(f=>f.form_revision),blocks:d.map(f=>f.uuid)});return p.then(f=>{this.client.files.processPresignedUrls(f.presigned_urls),this.dispatch(a(f.attachments))}).catch(()=>{this.dispatch(c(d.map(f=>f.uuid)))}),[d,p.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);y(this,"name","Form Revision");y(this,"url","/form-revisions");y(this,"actions",{addOne:yi,addMany:pi,setOne:zm,setMany:Bm,updateOne:jm,updateMany:qm,deleteOne:Ai,deleteMany:fi,initialize:Vm});y(this,"selectors",{selectById:Dm,selectByIds:Cm})}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(),h=M({...e,created_by:u,submitted_at:d});this.dispatch(a(h));const p=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(h),blockers:[e.form],blocks:[h.uuid]});return p.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(h.uuid))}),[h,p]}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 kg extends v{constructor(){super(...arguments);y(this,"name","Form");y(this,"url","/forms");y(this,"actions",{addOne:Nm,addMany:Gm,setOne:Hm,setMany:Wm,updateOne:Km,updateMany:Ym,deleteOne:Zm,deleteMany:Jm,initialize:km});y(this,"selectors",{selectById:xm,selectByIds:ey})}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}),h=M({...n,form:d.uuid,submitted_at:l,created_by:u});this.dispatch(c(d)),this.dispatch(yi(h));const p=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:{...V(d),initial_revision:{uuid:h.uuid,submitted_at:h.submitted_at,title:h.title,description:h.description,fields:h.fields}},blockers:[],blocks:[d.uuid,h.uuid]});return p.catch(f=>{throw this.dispatch(r(d.uuid)),this.dispatch(Ai(h.uuid)),f}),[d,h,p]}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=gy(e)(l),h=$m(e)(l);this.dispatch(a(e)),this.dispatch(wi(D(d))),this.dispatch(fi(D(h)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(p){throw this.dispatch(c(u)),this.dispatch(pi(h)),this.dispatch(Ri(d)),p}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class Ng extends v{constructor(){super(...arguments);y(this,"name","Form Submission Attachment");y(this,"url","/form-submission-attachments");y(this,"actions",{addOne:iy,addMany:Pi,setOne:ny,setMany:ay,updateOne:cy,updateMany:dy,deleteOne:ry,deleteMany:Fi,initialize:sy});y(this,"selectors",{selectById:uy,selectByIds:ly})}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=[],h=[];for(const f of e){const{submissionUuid:I,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:I,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:I};h.push(E)}this.dispatch(n(d));const p=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:h,files:Object.values(u)},blockers:d.map(f=>f.form_submission),blocks:d.map(f=>f.uuid)});return p.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,p.then(({attachments:f})=>f)]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,r=n.getState(),l=_i(e)(r);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!0),method:m.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 Gg extends v{constructor(){super(...arguments);y(this,"name","Form Submission");y(this,"url","/form-submissions");y(this,"actions",{addOne:fy,addMany:Ri,setOne:py,setMany:Ay,updateOne:Sy,updateMany:Ty,deleteOne:Iy,deleteMany:wi,initialize:yy});y(this,"selectors",{selectById:Py,selectByIds:Fy})}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(),h=M({...e,created_by:u,submitted_at:d}),p=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(h),blockers:[e.form_revision],blocks:[h.uuid]});return this.dispatch(a(h)),p.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(h.uuid))}),[h,p]}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:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${u.uuid}/`,payload:e,blockers:[u.uuid],blocks:[u.uuid]});return d.then(h=>{this.dispatch(a(h))}).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=oy(e)(l);this.dispatch(a(e)),this.dispatch(Fi(D(d)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(u)),this.dispatch(Pi(d)),h}}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 Hg extends v{constructor(){super(...arguments);y(this,"name","Geo Image");y(this,"url","/geo-images");y(this,"actions",{addOne:Ey,addMany:vy,setOne:Ry,setMany:wy,updateOne:Vy,updateMany:zy,deleteOne:By,deleteMany:jy,initialize:My});y(this,"selectors",{selectById:Dy,selectByIds:Cy})}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(),h=((F=n.getState().userReducer.currentUser)==null?void 0:F.id)??null,p=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:h});this.dispatch(a(f));const I=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.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:[p],blockers:[p]});return I.then(P=>{this.client.files.processPresignedUrls(P.presigned_urls),this.dispatch(c(P.geo_image))}).catch(()=>{this.dispatch(r(f.uuid))}),[f,I.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,h=[],p=[],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});h.push(B),p.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(h));const I=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:u,project:n,geo_images:A,files:Object.values(f)},blocks:[n],blockers:p});return I.then(P=>{this.client.files.processPresignedUrls(P.presigned_urls),this.dispatch(r(P.geo_images))}).catch(()=>{this.dispatch(l(p))}),[h,I.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(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:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return d.then(h=>{this.dispatch(a(h))}).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:O(m.DELETE,this.name,!1),method:m.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.list({queryParams:{project:e}},n);return this.dispatch(a(c)),c}}class Wg extends v{constructor(){super(...arguments);y(this,"name","Issue Association");y(this,"url","/issue-associations");y(this,"actions",{addOne:Wy,addMany:Et,setOne:Ny,setMany:ky,updateOne:Gy,updateMany:Hy,deleteOne:Ky,deleteMany:vt,initialize:Ly});y(this,"selectors",{selectById:Zy,selectByIds:Jy})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=new Date().toISOString(),u=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,d=M({...e,submitted_at:l,created_by:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[e.associated_issue,...e.issue?[e.issue]:[],...e.asset?[e.asset]:[]],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}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:O(m.DELETE,this.name,!1),method:m.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 Kg extends Xe{constructor(){super(...arguments);y(this,"name","Issue Attachment");y(this,"url","/issue-attachments");y(this,"actions",{addOne:ip,addMany:ji,setOne:np,setMany:ap,updateOne:cp,updateMany:dp,deleteOne:rp,deleteMany:qi,initialize:sp});y(this,"selectors",{selectById:op,selectByIds:hp})}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 Yg extends Xe{constructor(){super(...arguments);y(this,"name","Issue Comment Attachment");y(this,"url","/issue-comment-attachments");y(this,"actions",{addOne:Ap,addMany:fp,setOne:Sp,setMany:Tp,updateOne:Ip,updateMany:Op,deleteOne:Pp,deleteMany:Fp,initialize:pp});y(this,"selectors",{selectById:bp,selectByIds:_p})}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 Zg extends v{constructor(){super(...arguments);y(this,"name","Issue Comment");y(this,"url","/issue-comments");y(this,"actions",{addOne:Ep,addMany:vp,setOne:Vp,setMany:zp,updateOne:Bp,updateMany:jp,deleteOne:qp,deleteMany:Dp,initialize:wp});y(this,"selectors",{selectById:Cp,selectByIds:$p})}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(m.POST,this.name,!1),method:m.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(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:O(m.PATCH,this.name,!1),method:m.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:O(m.DELETE,this.name,!1),method:m.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 Jg extends v{constructor(){super(...arguments);y(this,"name","Issue");y(this,"url","/issues");y(this,"actions",{addOne:Np,addMany:Ni,setOne:Gp,setMany:Hp,updateOne:Wp,updateMany:Kp,deleteOne:Yp,deleteMany:Gi,initialize:kp});y(this,"selectors",{selectById:Jp,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,h=M({...e,submitted_at:u,created_by:d});this.dispatch(a(h));const p=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(h),blockers:[h.project,h.issue_type,...h.category?[h.category]:[]],blocks:[h.uuid]});return p.then(f=>{this.dispatch(c(f))}).catch(f=>{throw this.dispatch(r(h.uuid)),f}),[h,p]}update(e){var p;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[$.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],I=un(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 $.CATEGORY:{const f=e[A];if(f===null)u[A]=null;else{const I=ti(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 $.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=M({created_by:((p=c.userReducer.currentUser)==null?void 0:p.id)??null,submitted_at:new Date().toISOString(),issue:r.uuid,changes:u});this.dispatch(on(d));const h=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return h.then(A=>{this.dispatch(n(A))}).catch(()=>{this.dispatch(n(r)),this.dispatch(mn(d.uuid))}),[l,h]}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(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 h=Qe(e,Math.min(n??e.length,k)),p=[];let A=null;for(const f of h){const I=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(m.PATCH,this.name,!0),method:m.PATCH,url:`${this.url}/bulk/`,payload:{payloads:f},blockers:F.concat(P).concat(g).concat(A?[A]:[]),blocks:F.concat([I])});p.push(b),A=I}return Promise.all(p).then(f=>{this.dispatch(c(f.flat()))}).catch(()=>{this.dispatch(c(u))}),[d,p]}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=lp(e)(l),h=bS(e)(l),p={};for(const f of Xy(e)(l))p[f.uuid]=f;for(const f of Qy(e)(l))p[f.uuid]=f;const A=Object.values(p);this.dispatch(a(e)),this.dispatch(qi(D(d))),this.dispatch(yn(D(h))),this.dispatch(vt(D(A)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(f){throw this.dispatch(c(u)),this.dispatch(ji(d)),this.dispatch(hn(h)),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 Xg extends Xe{constructor(){super(...arguments);y(this,"name","Issue Type Attachment");y(this,"url","/issue-type-attachments");y(this,"actions",{addOne:sA,addMany:iA,setOne:nA,setMany:aA,updateOne:cA,updateMany:dA,deleteOne:rA,deleteMany:uA,initialize:tA});y(this,"selectors",{selectById:oA,selectByIds:hA})}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 Qg extends v{constructor(){super(...arguments);y(this,"name","Issue Type Fields Attachment");y(this,"url","/issue-type-fields-attachments");y(this,"actions",{addOne:AA,addMany:fA,setOne:SA,setMany:TA,updateOne:IA,updateMany:OA,deleteOne:PA,deleteMany:FA,initialize:pA});y(this,"selectors",{selectById:bA,selectByIds:_A})}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=[],h=[];for(const f of e){const{fieldsRevisionUuid:I,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:I,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:I};h.push(E)}this.dispatch(n(d));const p=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:h,files:Object.values(u)},blockers:d.map(f=>f.fields_revision),blocks:d.map(f=>f.uuid)});return p.then(f=>{this.client.files.processPresignedUrls(f.presigned_urls),this.dispatch(a(f.attachments))}).catch(()=>{this.dispatch(c(d.map(f=>f.uuid)))}),[d,p.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 xg extends v{constructor(){super(...arguments);y(this,"name","Issue Type Fields");y(this,"url","/issue-type-fields");y(this,"actions",{addOne:GA,addMany:HA,setOne:WA,setMany:KA,updateOne:YA,updateMany:ZA,deleteOne:JA,deleteMany:XA,initialize:NA});y(this,"selectors",{selectById:xA,selectByIds:ef})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.issue_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(r(d.uuid)),A}),[d,h]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class eb extends v{constructor(){super(...arguments);y(this,"name","Issue Type Field Values Attachment");y(this,"url","/issue-type-field-values-attachments");y(this,"actions",{addOne:af,addMany:Qi,setOne:cf,setMany:df,updateOne:rf,updateMany:uf,deleteOne:lf,deleteMany:xi,initialize:nf});y(this,"selectors",{selectById:hf,selectByIds:mf})}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=[],h=[];for(const f of e){const{fieldValuesUuid:I,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:I,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:I};h.push(E)}this.dispatch(n(d));const p=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:h,files:Object.values(u)},blockers:d.map(f=>f.field_values),blocks:d.map(f=>f.uuid)});return p.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,p.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:O(m.DELETE,this.name,!0),method:m.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 tb extends v{constructor(){super(...arguments);y(this,"name","Issue Type Field Values");y(this,"url","/issue-type-field-values");y(this,"actions",{addOne:EA,addMany:vA,setOne:VA,setMany:zA,updateOne:BA,updateMany:jA,deleteOne:qA,deleteMany:DA,initialize:wA});y(this,"selectors",{selectById:$A,selectByIds:UA})}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(),h=M({...e,created_by:u,submitted_at:d}),p=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(h),blockers:[e.issue,e.fields_revision],blocks:[h.uuid]});return this.dispatch(a(h)),p.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(h.uuid))}),[h,p]}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:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[u.uuid,u.fields_revision,u.issue],blocks:[u.uuid]});return d.then(h=>{this.dispatch(a(h))}).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=yf(e)(l);this.dispatch(a(e)),this.dispatch(xi(D(d)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(u)),this.dispatch(Qi(d)),h}}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 sb extends v{constructor(){super(...arguments);y(this,"name","Issue Type Identifier");y(this,"url","/issue-type-identifiers");y(this,"actions",{addOne:Sf,addMany:Tf,setOne:If,setMany:Of,updateOne:Pf,updateMany:Ff,deleteOne:gf,deleteMany:bf,initialize:ff});y(this,"selectors",{selectById:Mf,selectByIds:Rf})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.issue_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}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:O(m.PATCH,this.name,!1),method:m.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:O(m.DELETE,this.name,!1),method:m.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 ib extends v{constructor(){super(...arguments);y(this,"name","Issue Type Identifier Value");y(this,"url","/issue-type-identifier-values");y(this,"actions",{addOne:Vf,addMany:zf,setOne:Bf,setMany:jf,updateOne:qf,updateMany:Df,deleteOne:Cf,deleteMany:$f,initialize:vf});y(this,"selectors",{selectById:Lf,selectByIds:kf})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[e.issue,e.issue_type_identifier],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}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:O(m.PATCH,this.name,!1),method:m.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:O(m.DELETE,this.name,!1),method:m.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 nb extends v{constructor(){super(...arguments);y(this,"name","Issue Type");y(this,"url","/issue-types");y(this,"actions",{addOne:Wf,addMany:Kf,setOne:Yf,setMany:Zf,updateOne:Jf,updateMany:Xf,deleteOne:Qf,deleteMany:xf,initialize:Hf});y(this,"selectors",{selectById:tS,selectByIds:sS})}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(),h=M({...e,submitted_at:d,created_by:u});this.dispatch(a(h));const p=this.enqueueRequest({method:m.POST,url:`${this.url}/`,payload:V(h),blockers:[],blocks:[h.uuid]});return p.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(h.uuid))}),[h,p]}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:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(h=>{this.dispatch(a(h))}).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=Qp(e)(l);this.dispatch(a(e)),this.dispatch(Gi(D(d)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(u)),this.dispatch(Ni(d)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class ab extends v{constructor(){super(...arguments);y(this,"name","Issue Type Status");y(this,"url","/issue-type-statuses");y(this,"actions",{addOne:cS,addMany:dS,setOne:rS,setMany:uS,updateOne:lS,updateMany:oS,deleteOne:hS,deleteMany:mS,initialize:aS});y(this,"selectors",{selectById:un,selectByIds:pS})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[e.issue_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}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:O(m.PATCH,this.name,!1),method:m.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:O(m.DELETE,this.name,!1),method:m.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 cb extends v{constructor(){super(...arguments);y(this,"name","Issue Update");y(this,"url","/issue-updates");y(this,"actions",{addOne:on,addMany:hn,setOne:TS,setMany:IS,updateOne:OS,updateMany:PS,deleteOne:mn,deleteMany:yn,initialize:SS});y(this,"selectors",{selectById:FS,selectByIds:gS})}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 db=1800;function rb(t){if(!t.access)throw new Error("Missing access token");if(!t.refresh)throw new Error("Missing refresh token");return{accessToken:t.access,refreshToken:t.refresh}}class ub extends ng{constructor(){super(...arguments);y(this,"_getRenewedTokens",async e=>{const n=this.performRequest({method:m.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(jo(!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=BO(e).exp??n}catch{a=n}return a-n<db}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:m.POST,url:this.initTokensUrl,payload:e,isAuthNeeded:!1,checkAuth:!1}).then(a=>{this.setTokens(rb(a))})}}class lb extends at{constructor(){super(...arguments);y(this,"name","Organization Access");y(this,"url","/organization-accesses");y(this,"actions",{addOne:US,addMany:LS,setOne:kS,setMany:NS,updateOne:GS,updateMany:HS,deleteOne:WS,deleteMany:KS,initialize:$S});y(this,"selectors",{selectById:ZS,selectByIds:JS})}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:O(m.PATCH,this.name,!1),method:m.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(Tn(u.user));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${u.uuid}/`,blockers:[u.uuid],blocks:[]})}catch(h){throw this.dispatch(c(u)),this.dispatch(Sn(d)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class ob extends at{constructor(){super(...arguments);y(this,"name","Organization");y(this,"url","/organizations");y(this,"actions",{addOne:iT,addMany:sT,setOne:tT,setMany:eT,updateOne:aT,updateMany:nT,deleteOne:cT,deleteMany:dT,initialize:xS});y(this,"selectors",{selectById:lT,selectByIds:oT})}async add(e){const{addOne:n}=this.actions,a=await this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.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(m.PATCH,this.name,!1),method:m.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(m.POST,this.name,!1),method:m.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 hb extends v{constructor(){super(...arguments);y(this,"name","Project Access");y(this,"url","/project-accesses");y(this,"actions",{addOne:OT,addMany:PT,setOne:FT,setMany:gT,updateOne:bT,updateMany:_T,deleteOne:MT,deleteMany:RT,initialize:IT});y(this,"selectors",{selectById:ET,selectByIds:vT})}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(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(l),blockers:[l.organization_access,l.project],blocks:[l.uuid]});return u.then(h=>{this.dispatch(c(h))}).catch(h=>{throw this.dispatch(r(l.uuid)),h}),[l,u]}bulkAdd(e){var h;const{store:n}=this.client,{addMany:a,deleteMany:c,updateMany:r}=this.actions,l=((h=n.getState().userReducer.currentUser)==null?void 0:h.id)??null,u=e.map(p=>M({...p,created_by:l}));this.dispatch(a(u));const d=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{project_accesses:u.map(p=>V(p))},blockers:u.flatMap(p=>[p.project,p.organization_access]),blocks:u.map(p=>p.uuid)});return d.then(p=>{this.dispatch(r(p))}).catch(p=>{throw this.dispatch(c(u.map(A=>A.uuid))),p}),[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:O(m.PATCH,this.name,!1),method:m.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:O(m.DELETE,this.name,!1),method:m.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 mb extends Xe{constructor(){super(...arguments);y(this,"name","Project Attachment");y(this,"url","/project-attachments");y(this,"actions",{addOne:BT,addMany:jT,setOne:qT,setMany:DT,updateOne:CT,updateMany:$T,deleteOne:UT,deleteMany:LT,initialize:zT});y(this,"selectors",{selectById:NT,selectByIds:GT})}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 yb extends v{constructor(){super(...arguments);y(this,"name","Project File");y(this,"url","/project-files");y(this,"actions",{addOne:JT,addMany:XT,setOne:YT,setMany:ZT,updateOne:QT,updateMany:xT,deleteOne:eI,deleteMany:tI,initialize:KT});y(this,"selectors",{selectById:dI,selectByIds:rI})}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:m.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 h={...r};delete h.file,l={method:m.PATCH,url:`${this.url}/${c}/`,payload:h,blockers:[c],blocks:[c]}}else l=new Promise((h,p)=>{this.client.files.uploadFileToS3(r.file_sha1).then(([A])=>{h({method:m.POST,url:`${this.url}/`,payload:{...r,...A},blockers:[c],blocks:[c]})}).catch(p)});const d=Promise.resolve(l).then(h=>this.enqueueRequest(h));return d.then(h=>{this.dispatch(n(h))}),this.dispatch(nI),this.dispatch(iI(null)),this.dispatch(sI(!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:O(m.DELETE,this.name,!1),method:m.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 pb extends at{constructor(){super(...arguments);y(this,"name","Project");y(this,"url","/projects");y(this,"actions",{addOne:pI,addMany:yI,setOne:mI,setMany:hI,updateOne:fI,updateMany:AI,deleteOne:SI,deleteMany:TI,initialize:oI});y(this,"selectors",{selectById:PI,selectByIds:FI})}async add(e){const{addOne:n}=this.actions,a=await this.performRequest({method:m.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:m.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(m.DELETE,this.name,!1),method:m.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 Ab extends v{constructor(){super(...arguments);y(this,"name","Team Membership");y(this,"url","/team-memberships");y(this,"actions",{addOne:MI,addMany:RI,setOne:wI,setMany:EI,updateOne:vI,updateMany:VI,deleteOne:zI,deleteMany:BI,initialize:_I});y(this,"selectors",{selectById:DI,selectByIds:CI})}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(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(l),blockers:[e.team],blocks:[l.uuid]});return u.then(h=>{this.dispatch(c(h))}).catch(()=>{this.dispatch(r(l.uuid))}),[l,u]}bulkAdd(e){var h;const{store:n}=this.client,{addMany:a,setMany:c,deleteMany:r}=this.actions,l=((h=n.getState().userReducer.currentUser)==null?void 0:h.id)??null,u=e.map(p=>M({...p,created_by:l}));this.dispatch(a(u));const d=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{team_memberships:u.map(p=>V(p))},blockers:u.map(p=>p.team),blocks:u.map(p=>p.uuid)});return d.then(p=>{this.dispatch(c(p))}).catch(()=>{this.dispatch(r(u.map(p=>p.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:O(m.DELETE,this.name,!1),method:m.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 fb extends v{constructor(){super(...arguments);y(this,"name","Team");y(this,"url","/teams");y(this,"actions",{addOne:LI,addMany:kI,setOne:NI,setMany:GI,updateOne:HI,updateMany:WI,deleteOne:KI,deleteMany:YI,initialize:UI});y(this,"selectors",{selectById:JI,selectByIds:XI})}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(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(l),blockers:[],blocks:[l.uuid]});return u.then(h=>{this.dispatch(c(h))}).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:O(m.PATCH,this.name,!1),method:m.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(e)(l);if(!u)throw new Error(`Expected team with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.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);y(this,"name","User");y(this,"url","/user");y(this,"actions",{addOne:Sn,addMany:vS,setOne:ES,setMany:wS,updateOne:zS,updateMany:VS,deleteOne:Tn,deleteMany:BS,initialize:RS});y(this,"selectors",{selectById:qt,selectByIds:DS})}async list(e,n){const{organizationUuid:a,...c}=e,r=a?`/organizations/${a}${this.url}s/`:`/${this.url}`;return this.performRequest({method:m.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 $n(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:h,queryParams:p,attachmentHash:A,isExternalUrl:f,isAuthNeeded:I,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={[m.GET]:()=>F?st.get(P.toString()).responseType("blob"):st.get(P.toString()),[m.POST]:()=>{const q=st.post(P.toString());return b(q)},[m.PATCH]:()=>{const q=st.patch(P.toString());return b(q)},[m.PUT]:()=>{const q=st.put(P.toString());return b(q)},[m.DELETE]:()=>{const q=st.delete(P.toString());return b(q)}}[h];let z=B();if(a==null||a.addEventListener("abort",()=>{console.debug("aborting request:",s),z.abort()}),I&&c){const q=n.auth.getAuthHeader();z=z.set("Authorization",q)}d&&(z=z.set(d));try{return await z.query(p)}catch(q){const j=pO(q),MO=j==null?void 0:j.status;if(c&&MO===401)return await n.auth.handleUnauthorized(z,j),z.query(p);throw new U({response:j,innerError:q,discard:jn.includes(MO)})}}class Tb{constructor(s){y(this,"store");this.store=s}_performRequest(s,e,n,a){const c=new Nt,r={...e,uuid:e.uuid??xe.v4()};return $n(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 Nt,c={...s,BASE_URL:e,serviceName:n},r=this.store.dispatch(pT(c)),l=d=>{if(d)a.resolve(d.body);else{const h=new U({message:"Could not get a response from the server.",response:d,discard:!0});a.reject(h)}},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(){y(this,"graph");y(this,"requestAttemptCounter");this.graph=new jO.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 AO;function fO(t){AO=t}function dt(){return AO}let SO;function TO(t){SO=t}function IO(){return SO}let Un=null;function tt(){const t=dt();if(!t)return console.warn("Client store not set; cannot get outbox coordinator yet."),null;if(Un)return Un;const s=t.getState().offline.outbox,e=ct._fromOutbox(s);return Un=e,e}const Ib=(t,s)=>{const e=new s(t);return TO(e),fO(t),e};class Ob{constructor(s){y(this,"_all");y(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(){y(this,"next");this.next=null}then(s){return new Ob(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=IO();if(!n)throw new Error("Client SDK not set");return hO(s,n)}}}class OO extends Ln{async run(s){return super.run(s)}}class PO extends Ln{async run(s){return super.run(s)}}const FO=new OO().then(new PO).compile();function gO(t){var s;return(s=FO[0])==null?void 0:s.run(t)}var bO=(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))(bO||{});i.ALL_MIDDLEWARE=FO,i.APIError=U,i.ATTACHMENT_MODEL_DEFAULT_PAGE_SIZE=iO,i.AgentService=ag,i.AssetAttachmentService=cg,i.AssetProcedureService=hg,i.AssetProcedureStepFieldValuesAttachmentService=Ag,i.AssetProcedureStepFieldValuesService=fg,i.AssetProcedureStepFieldsAttachmentService=yg,i.AssetProcedureStepFieldsService=pg,i.AssetProcedureStepService=Sg,i.AssetProcedureTypeAttachmentService=dg,i.AssetProcedureTypeFieldValuesAttachmentService=lg,i.AssetProcedureTypeFieldValuesService=og,i.AssetProcedureTypeFieldsAttachmentService=rg,i.AssetProcedureTypeFieldsService=ug,i.AssetProcedureTypeService=mg,i.AssetService=Tg,i.AssetStageCompletionService=Ig,i.AssetStageService=Og,i.AssetStatusType=Yn,i.AssetTypeAttachmentService=Pg,i.AssetTypeFieldValuesAttachmentService=bg,i.AssetTypeFieldValuesService=_g,i.AssetTypeFieldsAttachmentService=Fg,i.AssetTypeFieldsService=gg,i.AssetTypeIdentifierService=Mg,i.AssetTypeIdentifierValueService=Rg,i.AssetTypeService=wg,i.AssetTypeStatusService=Eg,i.AttachmentModel=Zn,i.BaseApiService=et,i.BaseModelApiService=at,i.BaseOfflineAttachmentModelService=Xe,i.BaseOfflineModelApiService=v,i.BaseSDK=Tb,i.COMMON_AUTO_FIELDS=sa,i.CategoryService=vg,i.DEFAULT_ISSUE_PRIORITY=qO,i.DEFAULT_PAGE_SIZE=sO,i.DISCARD_HTTP_STATUSES=jn,i.DeferredPromise=Nt,i.DocumentAttachmentService=Vg,i.DocumentService=zg,i.EMPTY_ARRAY=Hn,i.EMPTY_OBJECT=Wn,i.EmailDomainsService=Bg,i.EmailVerificationService=jg,i.FileService=Dg,i.FormIdentifierService=Cg,i.FormIdentifierValueService=$g,i.FormRevisionAttachmentService=Ug,i.FormRevisionService=Lg,i.FormService=kg,i.FormSubmissionAttachmentService=Ng,i.FormSubmissionService=Gg,i.GeoImageService=Hg,i.HttpMethod=m,i.IssueAssociationService=Wg,i.IssueAttachmentService=Kg,i.IssueCommentAttachmentService=Yg,i.IssueCommentService=Zg,i.IssuePriority=kt,i.IssueService=Jg,i.IssueStatusType=Jn,i.IssueTypeAttachmentService=Xg,i.IssueTypeFieldValuesAttachmentService=eb,i.IssueTypeFieldValuesService=tb,i.IssueTypeFieldsAttachmentService=Qg,i.IssueTypeFieldsService=xg,i.IssueTypeIdentifierService=sb,i.IssueTypeIdentifierValueService=ib,i.IssueTypeService=nb,i.IssueTypeStatusService=ab,i.IssueUpdateChange=$,i.IssueUpdateService=cb,i.JWTService=ub,i.MAX_SERVICE_BATCH_SIZE=k,i.OUTBOX_RETRY_DELAY=Xn,i.OfflineAnalyticsMiddleware=OO,i.OfflineMiddleware=Ln,i.OrganizationAccessLevel=Kn,i.OrganizationAccessService=lb,i.OrganizationService=ob,i.OutboxCoordinator=ct,i.ProjectAccessService=hb,i.ProjectAttachmentService=mb,i.ProjectFileService=yb,i.ProjectService=pb,i.RESET_ORGANIZATION_STATE=w,i.RESET_PROJECT_STATE=C,i.RESET_STATE=_,i.RateLimitingMiddleware=PO,i.SelectorBuilder=dP,i.TeamMembershipService=Ab,i.TeamService=fb,i.UNKNOWN_ERROR_MESSAGE=nt,i.UserService=Sb,i.VERSION_REDUCER_KEY=rt,i.VerificationCodeType=bO,i._setLatestRetryTime=fT,i.addAsset=Vr,i.addAssetAttachment=fa,i.addAssetAttachments=Qt,i.addAssetProcedure=Hc,i.addAssetProcedureStep=Ir,i.addAssetProcedureStepFieldValues=nr,i.addAssetProcedureStepFieldValuesAttachment=Hd,i.addAssetProcedureStepFieldValuesAttachments=Os,i.addAssetProcedureStepFieldValuesMany=ar,i.addAssetProcedureStepFields=Vd,i.addAssetProcedureStepFieldsAttachment=Sd,i.addAssetProcedureStepFieldsAttachments=Td,i.addAssetProcedureStepFieldsMany=zd,i.addAssetProcedureSteps=Or,i.addAssetProcedureType=nd,i.addAssetProcedureTypeAttachment=Ea,i.addAssetProcedureTypeAttachments=va,i.addAssetProcedureTypeFieldValues=vc,i.addAssetProcedureTypeFieldValuesAttachment=Sc,i.addAssetProcedureTypeFieldValuesAttachments=ds,i.addAssetProcedureTypeFieldValuesMany=Vc,i.addAssetProcedureTypeFields=nc,i.addAssetProcedureTypeFieldsAttachment=Ga,i.addAssetProcedureTypeFieldsAttachments=Ha,i.addAssetProcedureTypeFieldsMany=ac,i.addAssetProcedureTypes=ad,i.addAssetProcedures=hs,i.addAssetStage=ru,i.addAssetStageCompletion=Hr,i.addAssetStageCompletions=Wr,i.addAssetStages=uu,i.addAssetType=lo,i.addAssetTypeAttachment=Tu,i.addAssetTypeAttachments=js,i.addAssetTypeFieldValues=Tl,i.addAssetTypeFieldValuesAttachment=cl,i.addAssetTypeFieldValuesAttachments=ks,i.addAssetTypeFieldValuesMany=Il,i.addAssetTypeFields=Wu,i.addAssetTypeFieldsAttachment=Vu,i.addAssetTypeFieldsAttachments=zu,i.addAssetTypeFieldsMany=Ku,i.addAssetTypeIdentifier=zl,i.addAssetTypeIdentifierValue=Kl,i.addAssetTypeIdentifierValues=Yl,i.addAssetTypeIdentifiers=Bl,i.addAssetTypeStatus=Po,i.addAssetTypeStatuses=Fo,i.addAssetTypes=oo,i.addAssets=Rs,i.addCategories=Uo,i.addCategory=$o,i.addConversation=oa,i.addConversations=rP,i.addDocument=hh,i.addDocumentAttachment=Qo,i.addDocumentAttachments=xo,i.addDocuments=mh,i.addEmailDomain=_h,i.addEmailDomains=Mh,i.addForm=Nm,i.addFormIdentifier=Hh,i.addFormIdentifierValue=am,i.addFormIdentifierValues=cm,i.addFormIdentifiers=Wh,i.addFormRevision=yi,i.addFormRevisionAttachment=Tm,i.addFormRevisionAttachments=Im,i.addFormRevisions=pi,i.addFormSubmission=fy,i.addFormSubmissionAttachment=iy,i.addFormSubmissionAttachments=Pi,i.addFormSubmissions=Ri,i.addForms=Gm,i.addGeoImage=Ey,i.addGeoImages=vy,i.addIssue=Np,i.addIssueAssociation=Wy,i.addIssueAssociations=Et,i.addIssueAttachment=ip,i.addIssueAttachments=ji,i.addIssueComment=Ep,i.addIssueCommentAttachment=Ap,i.addIssueCommentAttachments=fp,i.addIssueComments=vp,i.addIssueType=Wf,i.addIssueTypeAttachment=sA,i.addIssueTypeAttachments=iA,i.addIssueTypeFieldValues=EA,i.addIssueTypeFieldValuesAttachment=af,i.addIssueTypeFieldValuesAttachments=Qi,i.addIssueTypeFieldValuesMany=vA,i.addIssueTypeFields=GA,i.addIssueTypeFieldsAttachment=AA,i.addIssueTypeFieldsAttachments=fA,i.addIssueTypeFieldsMany=HA,i.addIssueTypeIdentifier=Sf,i.addIssueTypeIdentifierValue=Vf,i.addIssueTypeIdentifierValues=zf,i.addIssueTypeIdentifiers=Tf,i.addIssueTypeStatus=cS,i.addIssueTypeStatuses=dS,i.addIssueTypes=Kf,i.addIssueUpdate=on,i.addIssueUpdates=hn,i.addIssues=Ni,i.addOrganization=iT,i.addOrganizationAccess=US,i.addOrganizationAccesses=LS,i.addOrganizations=sT,i.addProject=pI,i.addProjectAccess=OT,i.addProjectAccesses=PT,i.addProjectAttachment=BT,i.addProjectAttachments=jT,i.addProjectFile=JT,i.addProjectFiles=XT,i.addProjects=yI,i.addTeam=LI,i.addTeamMembership=MI,i.addTeamMemberships=RI,i.addTeams=kI,i.addUser=Sn,i.addUsers=vS,i.agentsReducer=ya,i.agentsSlice=Zt,i.areArraysEqual=LO,i.assetAttachmentReducer=Ma,i.assetAttachmentSlice=Xt,i.assetProcedureReducer=Xc,i.assetProcedureSlice=os,i.assetProcedureStepFieldValuesAttachmentReducer=tr,i.assetProcedureStepFieldValuesAttachmentSlice=Is,i.assetProcedureStepFieldValuesReducer=pr,i.assetProcedureStepFieldValuesSlice=gs,i.assetProcedureStepFieldsAttachmentReducer=wd,i.assetProcedureStepFieldsAttachmentSlice=As,i.assetProcedureStepFieldsReducer=kd,i.assetProcedureStepFieldsSlice=Ss,i.assetProcedureStepReducer=_r,i.assetProcedureStepSlice=bs,i.assetProcedureTypeAttachmentReducer=Ca,i.assetProcedureTypeAttachmentSlice=ts,i.assetProcedureTypeFieldValuesAttachmentReducer=gc,i.assetProcedureTypeFieldValuesAttachmentSlice=cs,i.assetProcedureTypeFieldValuesReducer=$c,i.assetProcedureTypeFieldValuesSlice=ls,i.assetProcedureTypeFieldsAttachmentReducer=Qa,i.assetProcedureTypeFieldsAttachmentSlice=is,i.assetProcedureTypeFieldsReducer=hc,i.assetProcedureTypeFieldsSlice=as,i.assetProcedureTypeReducer=hd,i.assetProcedureTypeSlice=ys,i.assetReducer=kr,i.assetSlice=Ms,i.assetStageCompletionReducer=xr,i.assetStageCompletionSlice=Es,i.assetStageReducer=yu,i.assetStageSlice=vs,i.assetTypeAttachmentReducer=wu,i.assetTypeAttachmentSlice=Bs,i.assetTypeFieldValuesAttachmentReducer=Al,i.assetTypeFieldValuesAttachmentSlice=Ls,i.assetTypeFieldValuesReducer=El,i.assetTypeFieldValuesSlice=Hs,i.assetTypeFieldsAttachmentReducer=Nu,i.assetTypeFieldsAttachmentSlice=Cs,i.assetTypeFieldsReducer=il,i.assetTypeFieldsSlice=Us,i.assetTypeIdentifierReducer=Gl,i.assetTypeIdentifierSlice=Ws,i.assetTypeIdentifierValueReducer=no,i.assetTypeIdentifierValueSlice=Ys,i.assetTypeReducer=To,i.assetTypeSlice=Zs,i.assetTypeStatusReducer=zo,i.assetTypeStatusSlice=Xs,i.assetTypeStatusSortFn=aa,i.authReducer=qo,i.authSlice=bt,i.baseReducer=GF,i.baseReducers=Bn,i.blobToBase64=JO,i.categoryReducer=Zo,i.categorySlice=xs,i.clearTokens=WP,i.constructUploadedFilePayloads=ZO,i.createModelAdapter=R,i.createOfflineAction=mT,i.createPayload=V,i.createSelectionAdapter=DO,i.deleteAsset=jr,i.deleteAssetAttachment=Pa,i.deleteAssetAttachments=xt,i.deleteAssetProcedure=Yc,i.deleteAssetProcedureStep=gr,i.deleteAssetProcedureStepFieldValues=lr,i.deleteAssetProcedureStepFieldValuesAttachment=Jd,i.deleteAssetProcedureStepFieldValuesAttachments=Ps,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=rs,i.deleteAssetProcedureTypeFieldValuesMany=Cc,i.deleteAssetProcedureTypeFields=lc,i.deleteAssetProcedureTypeFieldsAttachment=Ja,i.deleteAssetProcedureTypeFieldsAttachments=Xa,i.deleteAssetProcedureTypeFieldsMany=oc,i.deleteAssetProcedureTypes=ud,i.deleteAssetProcedures=ms,i.deleteAssetStage=hu,i.deleteAssetStageCompletion=Xr,i.deleteAssetStageCompletions=Qr,i.deleteAssetStages=mu,i.deleteAssetType=yo,i.deleteAssetTypeAttachment=gu,i.deleteAssetTypeAttachments=qs,i.deleteAssetTypeFieldValues=bl,i.deleteAssetTypeFieldValuesAttachment=ol,i.deleteAssetTypeFieldValuesAttachments=Ns,i.deleteAssetTypeFieldValuesMany=_l,i.deleteAssetTypeFields=Qu,i.deleteAssetTypeFieldsAttachment=Cu,i.deleteAssetTypeFieldsAttachments=$u,i.deleteAssetTypeFieldsMany=xu,i.deleteAssetTypeIdentifier=$l,i.deleteAssetTypeIdentifierValue=xl,i.deleteAssetTypeIdentifierValues=eo,i.deleteAssetTypeIdentifiers=Ul,i.deleteAssetTypeStatus=Ro,i.deleteAssetTypeStatuses=wo,i.deleteAssetTypes=po,i.deleteAssets=ws,i.deleteCategories=Wo,i.deleteCategory=Ho,i.deleteConversation=oP,i.deleteConversations=hP,i.deleteDocument=Sh,i.deleteDocumentAttachment=nh,i.deleteDocumentAttachments=ah,i.deleteDocuments=Th,i.deleteEmailDomain=Vh,i.deleteEmailDomains=zh,i.deleteForm=Zm,i.deleteFormIdentifier=Xh,i.deleteFormIdentifierValue=om,i.deleteFormIdentifierValues=hm,i.deleteFormIdentifiers=Qh,i.deleteFormRevision=Ai,i.deleteFormRevisionAttachment=bm,i.deleteFormRevisionAttachments=_m,i.deleteFormRevisions=fi,i.deleteFormSubmission=Iy,i.deleteFormSubmissionAttachment=ry,i.deleteFormSubmissionAttachments=Fi,i.deleteFormSubmissions=wi,i.deleteForms=Jm,i.deleteGeoImage=By,i.deleteGeoImages=jy,i.deleteIssue=Yp,i.deleteIssueAssociation=Ky,i.deleteIssueAssociations=vt,i.deleteIssueAttachment=rp,i.deleteIssueAttachments=qi,i.deleteIssueComment=qp,i.deleteIssueCommentAttachment=Pp,i.deleteIssueCommentAttachments=Fp,i.deleteIssueComments=Dp,i.deleteIssueType=Qf,i.deleteIssueTypeAttachment=rA,i.deleteIssueTypeAttachments=uA,i.deleteIssueTypeFieldValues=qA,i.deleteIssueTypeFieldValuesAttachment=lf,i.deleteIssueTypeFieldValuesAttachments=xi,i.deleteIssueTypeFieldValuesMany=DA,i.deleteIssueTypeFields=JA,i.deleteIssueTypeFieldsAttachment=PA,i.deleteIssueTypeFieldsAttachments=FA,i.deleteIssueTypeFieldsMany=XA,i.deleteIssueTypeIdentifier=gf,i.deleteIssueTypeIdentifierValue=Cf,i.deleteIssueTypeIdentifierValues=$f,i.deleteIssueTypeIdentifiers=bf,i.deleteIssueTypeStatus=hS,i.deleteIssueTypeStatuses=mS,i.deleteIssueTypes=xf,i.deleteIssueUpdate=mn,i.deleteIssueUpdates=yn,i.deleteIssues=Gi,i.deleteOrganization=cT,i.deleteOrganizationAccess=WS,i.deleteOrganizationAccesses=KS,i.deleteOrganizations=dT,i.deleteProject=SI,i.deleteProjectAccess=MT,i.deleteProjectAccesses=RT,i.deleteProjectAttachment=UT,i.deleteProjectAttachments=LT,i.deleteProjectFile=eI,i.deleteProjectFiles=tI,i.deleteProjects=TI,i.deleteTeam=KI,i.deleteTeamMembership=zI,i.deleteTeamMemberships=BI,i.deleteTeams=YI,i.deleteUser=Tn,i.deleteUsers=BS,i.dequeue=oO,i.discard=mO,i.documentAttachmentReducer=uh,i.documentAttachmentSlice=si,i.documentSlice=ni,i.documentsReducer=Ih,i.downloadFile=XO,i.downloadInMemoryFile=YO,i.emailDomainsReducer=Dh,i.emailDomainsSlice=ci,i.emailRegex=nP,i.enqueue=lO,i.enqueueRequest=pT,i.extractResponseFromError=pO,i.fallbackToEmptyArray=T,i.fallbackToEmptyObject=pt,i.fileReducer=kh,i.fileSlice=ri,i.fileToBlob=ea,i.formIdentifierReducer=sm,i.formIdentifierSlice=ui,i.formIdentifierValueReducer=Am,i.formIdentifierValueSlice=oi,i.formReducer=Xm,i.formRevisionAttachmentReducer=Em,i.formRevisionAttachmentSlice=hi,i.formRevisionReducer=Um,i.formRevisionsSlice=mi,i.formSlice=Ti,i.formSubmissionAttachmentReducer=hy,i.formSubmissionAttachmentSlice=Oi,i.formSubmissionReducer=by,i.formSubmissionSlice=Mi,i.geoImageReducer=$y,i.geoImageSlice=vi,i.getAssetProcedureStepSubTree=na,i.getAssetProcedureStepTrees=aP,i.getClientSDK=IO,i.getClientStore=dt,i.getDocumentSubTree=ra,i.getDocumentTrees=cP,i.getFileIdentifier=KO,i.getFileS3Key=Kt,i.getLocalDateString=Qn,i.getLocalRelativeDateString=HO,i.getOutboxCoordinator=tt,i.getRenamedFile=xn,i.getRequestDescription=O,i.hashFile=it,i.initSDK=Ib,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=Gr,i.initializeAssetStages=au,i.initializeAssetTypeAttachments=Su,i.initializeAssetTypeFieldValues=Sl,i.initializeAssetTypeFieldValuesAttachments=al,i.initializeAssetTypeFields=Hu,i.initializeAssetTypeFieldsAttachments=vu,i.initializeAssetTypeIdentifierValues=Wl,i.initializeAssetTypeIdentifiers=Vl,i.initializeAssetTypeStatuses=Oo,i.initializeAssetTypes=co,i.initializeAssets=vr,i.initializeCategories=Co,i.initializeConversations=la,i.initializeDocumentAttachments=Xo,i.initializeDocuments=oh,i.initializeEmailDomains=bh,i.initializeFormIdentifierValues=nm,i.initializeFormIdentifiers=Gh,i.initializeFormRevisionAttachments=Sm,i.initializeFormRevisions=Vm,i.initializeFormSubmissionAttachments=sy,i.initializeFormSubmissions=yy,i.initializeForms=km,i.initializeGeoImages=My,i.initializeIssueAssociations=Ly,i.initializeIssueAttachments=sp,i.initializeIssueCommentAttachments=pp,i.initializeIssueComments=wp,i.initializeIssueTypeAttachments=tA,i.initializeIssueTypeFieldValues=wA,i.initializeIssueTypeFieldValuesAttachments=nf,i.initializeIssueTypeFields=NA,i.initializeIssueTypeFieldsAttachments=pA,i.initializeIssueTypeIdentifierValues=vf,i.initializeIssueTypeIdentifiers=ff,i.initializeIssueTypeStatuses=aS,i.initializeIssueTypes=Hf,i.initializeIssueUpdates=SS,i.initializeIssues=kp,i.initializeOrganizationAccesses=$S,i.initializeOrganizations=xS,i.initializeProjectAccesses=IT,i.initializeProjectAttachments=zT,i.initializeProjectFiles=KT,i.initializeProjects=oI,i.initializeTeamMemberships=_I,i.initializeTeams=UI,i.initializeUsers=RS,i.isToday=GO,i.issueAssociationReducer=ep,i.issueAssociationSlice=zi,i.issueAttachmentReducer=mp,i.issueAttachmentSlice=Bi,i.issueCommentAttachmentReducer=Mp,i.issueCommentAttachmentSlice=Ci,i.issueCommentReducer=Up,i.issueCommentSlice=Ui,i.issueReducer=xp,i.issueSlice=ki,i.issueTypeAttachmentReducer=mA,i.issueTypeAttachmentSlice=Hi,i.issueTypeFieldValuesAttachmentReducer=pf,i.issueTypeFieldValuesAttachmentSlice=Xi,i.issueTypeFieldValuesReducer=LA,i.issueTypeFieldValuesSlice=Zi,i.issueTypeFieldsAttachmentReducer=MA,i.issueTypeFieldsAttachmentSlice=Ki,i.issueTypeFieldsReducer=tf,i.issueTypeFieldsSlice=Ji,i.issueTypeIdentifierReducer=wf,i.issueTypeIdentifierSlice=tn,i.issueTypeIdentifierValueReducer=Nf,i.issueTypeIdentifierValueSlice=nn,i.issueTypeReducer=iS,i.issueTypeSlice=an,i.issueTypeStatusReducer=AS,i.issueTypeStatusSlice=dn,i.issueTypeStatusSortFn=ca,i.issueUpdateReducer=_S,i.issueUpdateSlice=ln,i.logOnlyOnce=QO,i.markAsDeleted=AT,i.markForDeletion=RF,i.memoize=Ht,i.organizationAccessReducer=YS,i.organizationAccessSlice=On,i.organizationReducer=hT,i.organizationSlice=Pn,i.outboxReducer=ST,i.outboxSlice=Fn,i.overmapEnhancer=xF,i.overmapReducer=HF,i.overmapReducers=tO,i.performRequest=$n,i.performRequestFromAction=hO,i.projectAccessReducer=wT,i.projectAccessSlice=gn,i.projectAttachmentReducer=HT,i.projectAttachmentSlice=_n,i.projectFileReducer=uI,i.projectFileSlice=Rn,i.projectReducer=II,i.projectSlice=wn,i.rehydratedReducer=gI,i.rehydratedSlice=En,i.restructureSelectorWithArgs=S,i.runMiddleware=gO,i.saveActiveProjectFileBounds=nI,i.selectAccessToken=KP,i.selectAccessesByUserOfProject=EF,i.selectAccessibleProjects=jF,i.selectActiveOrganizationAccess=gF,i.selectActiveProjectFileId=zF,i.selectAllDocumentAttachments=ii,i.selectAssetAttachmentById=ga,i.selectAssetAttachmentMapping=Fa,i.selectAssetAttachments=es,i.selectAssetAttachmentsByIds=ba,i.selectAssetById=Ur,i.selectAssetProcedureById=ed,i.selectAssetProcedureStepById=Mr,i.selectAssetProcedureStepFieldValues=ut,i.selectAssetProcedureStepFieldValuesAttachmentById=Qd,i.selectAssetProcedureStepFieldValuesAttachments=Fs,i.selectAssetProcedureStepFieldValuesAttachmentsByIds=xd,i.selectAssetProcedureStepFieldValuesAttachmentsMapping=Xd,i.selectAssetProcedureStepFieldValuesById=mr,i.selectAssetProcedureStepFieldValuesByIds=yr,i.selectAssetProcedureStepFieldValuesMapping=hr,i.selectAssetProcedureStepFieldValuesOfAsset=MP,i.selectAssetProcedureStepFieldValuesOfAssetProcedure=RP,i.selectAssetProcedureStepFieldValuesOfAssetProcedureStep=wP,i.selectAssetProcedureStepFields=It,i.selectAssetProcedureStepFieldsAttachmentById=Md,i.selectAssetProcedureStepFieldsAttachments=fs,i.selectAssetProcedureStepFieldsAttachmentsByIds=Rd,i.selectAssetProcedureStepFieldsAttachmentsMapping=_d,i.selectAssetProcedureStepFieldsById=Ud,i.selectAssetProcedureStepFieldsByIds=Ld,i.selectAssetProcedureStepFieldsMapping=Ts,i.selectAssetProcedureStepFieldsOfAssetProcedureStep=gP,i.selectAssetProcedureStepMapping=Ot,i.selectAssetProcedureSteps=_s,i.selectAssetProcedureStepsByIds=Rr,i.selectAssetProcedureStepsMappingOfAssetProcedureType=EP,i.selectAssetProcedureStepsOfAssetProcedureType=vP,i.selectAssetProcedureTypeAttachmentById=Ua,i.selectAssetProcedureTypeAttachmentMapping=$a,i.selectAssetProcedureTypeAttachments=ss,i.selectAssetProcedureTypeAttachmentsByIds=La,i.selectAssetProcedureTypeById=yd,i.selectAssetProcedureTypeFieldValues=St,i.selectAssetProcedureTypeFieldValuesAttachmentById=_c,i.selectAssetProcedureTypeFieldValuesAttachments=us,i.selectAssetProcedureTypeFieldValuesAttachmentsByIds=Mc,i.selectAssetProcedureTypeFieldValuesAttachmentsMapping=bc,i.selectAssetProcedureTypeFieldValuesById=Lc,i.selectAssetProcedureTypeFieldValuesByIds=kc,i.selectAssetProcedureTypeFieldValuesMapping=Uc,i.selectAssetProcedureTypeFieldValuesOfAsset=TP,i.selectAssetProcedureTypeFields=ft,i.selectAssetProcedureTypeFieldsAttachmentById=ec,i.selectAssetProcedureTypeFieldsAttachments=ns,i.selectAssetProcedureTypeFieldsAttachmentsByIds=tc,i.selectAssetProcedureTypeFieldsAttachmentsMapping=xa,i.selectAssetProcedureTypeFieldsById=yc,i.selectAssetProcedureTypeFieldsByIds=pc,i.selectAssetProcedureTypeFieldsMapping=mc,i.selectAssetProcedureTypeFieldsOfAssetProcedureType=fP,i.selectAssetProcedureTypes=ps,i.selectAssetProcedureTypesByIds=pd,i.selectAssetProcedureTypesMapping=md,i.selectAssetProcedureTypesOfOrganization=PP,i.selectAssetProcedures=Tt,i.selectAssetProceduresByIds=td,i.selectAssetProceduresMapping=Qc,i.selectAssetProceduresOfAssetProcedureType=xc,i.selectAssetProceduresOfAssetType=OP,i.selectAssetStageById=pu,i.selectAssetStageCompletionById=su,i.selectAssetStageCompletionMapping=eu,i.selectAssetStageCompletions=tu,i.selectAssetStageCompletionsByIds=iu,i.selectAssetStages=zs,i.selectAssetStagesByIds=Au,i.selectAssetStagesMappingOfAssetProcedureType=zP,i.selectAssetStagesOfAssetProcedureType=BP,i.selectAssetTypeAttachmentById=_u,i.selectAssetTypeAttachmentMapping=bu,i.selectAssetTypeAttachments=Ds,i.selectAssetTypeAttachmentsByIds=Mu,i.selectAssetTypeById=fo,i.selectAssetTypeFieldValues=Ft,i.selectAssetTypeFieldValuesAttachmentById=ml,i.selectAssetTypeFieldValuesAttachments=Gs,i.selectAssetTypeFieldValuesAttachmentsByIds=yl,i.selectAssetTypeFieldValuesAttachmentsMapping=hl,i.selectAssetTypeFieldValuesById=Rl,i.selectAssetTypeFieldValuesByIds=wl,i.selectAssetTypeFieldValuesMapping=Ml,i.selectAssetTypeFieldValuesOfAsset=CP,i.selectAssetTypeFields=lt,i.selectAssetTypeFieldsAttachmentById=Lu,i.selectAssetTypeFieldsAttachments=$s,i.selectAssetTypeFieldsAttachmentsByIds=ku,i.selectAssetTypeFieldsAttachmentsMapping=Uu,i.selectAssetTypeFieldsById=tl,i.selectAssetTypeFieldsByIds=sl,i.selectAssetTypeFieldsMapping=el,i.selectAssetTypeFieldsOfAssetType=qP,i.selectAssetTypeIdentifierById=kl,i.selectAssetTypeIdentifierMapping=Ll,i.selectAssetTypeIdentifierValueById=so,i.selectAssetTypeIdentifierValueMapping=to,i.selectAssetTypeIdentifierValues=gt,i.selectAssetTypeIdentifierValuesByIds=io,i.selectAssetTypeIdentifierValuesOfAsset=LP,i.selectAssetTypeIdentifierValuesOfIdentifier=kP,i.selectAssetTypeIdentifiers=Ks,i.selectAssetTypeIdentifiersByIds=Nl,i.selectAssetTypeIdentifiersOfAssetType=UP,i.selectAssetTypeStatusById=vo,i.selectAssetTypeStatusMapping=Eo,i.selectAssetTypeStatuses=Qs,i.selectAssetTypeStatusesByIds=Vo,i.selectAssetTypeStatusesOfAssetType=GP,i.selectAssetTypeValuesOfAssetType=$P,i.selectAssetTypes=Js,i.selectAssetTypesByIds=So,i.selectAssetTypesMapping=Ao,i.selectAssetTypesOfOrganization=NP,i.selectAssets=Pt,i.selectAssetsByIds=Lr,i.selectAssetsMapping=Cr,i.selectAssetsOfAssetType=$r,i.selectAssetsOfProject=VP,i.selectAttachmentsOfAsset=_a,i.selectAttachmentsOfAssetProcedureStepFieldValues=er,i.selectAttachmentsOfAssetProcedureStepFields=FP,i.selectAttachmentsOfAssetProcedureType=pP,i.selectAttachmentsOfAssetProcedureTypeFieldValues=Rc,i.selectAttachmentsOfAssetProcedureTypeFields=AP,i.selectAttachmentsOfAssetType=Ru,i.selectAttachmentsOfAssetTypeFieldValues=pl,i.selectAttachmentsOfAssetTypeFields=jP,i.selectAttachmentsOfDocument=JP,i.selectAttachmentsOfFormRevision=nF,i.selectAttachmentsOfFormSubmission=oy,i.selectAttachmentsOfIssue=lp,i.selectAttachmentsOfIssueComment=rF,i.selectAttachmentsOfIssueType=oF,i.selectAttachmentsOfIssueTypeFieldValues=yf,i.selectAttachmentsOfIssueTypeFields=hF,i.selectAttachmentsOfProject=VF,i.selectCategories=ei,i.selectCategoriesByIds=Yo,i.selectCategoriesOfProject=ZP,i.selectCategoryById=ti,i.selectCategoryMapping=Ko,i.selectCommentsOfIssue=uF,i.selectConversation=yP,i.selectConversationMapping=Jt,i.selectConversations=mP,i.selectCurrentUser=qS,i.selectDeletedRequests=_F,i.selectDescendantsOfAssetProcedureStep=wr,i.selectDescendantsOfDocument=Fh,i.selectDocumentAttachmentById=dh,i.selectDocumentAttachmentMapping=ch,i.selectDocumentAttachmentsByIds=rh,i.selectDocumentById=Oh,i.selectDocuments=_t,i.selectDocumentsByIds=Ph,i.selectDocumentsMapping=ai,i.selectEmailDomainById=jh,i.selectEmailDomains=di,i.selectEmailDomainsAsMapping=Bh,i.selectEmailDomainsByIds=qh,i.selectEmailDomainsOfOrganization=xP,i.selectFieldValuesOfAssetProcedure=IP,i.selectFormById=xm,i.selectFormIdentifierById=em,i.selectFormIdentifierMapping=xh,i.selectFormIdentifierValueById=ym,i.selectFormIdentifierValueMapping=mm,i.selectFormIdentifierValues=Mt,i.selectFormIdentifierValuesByIds=pm,i.selectFormIdentifierValuesOfFormSubmission=sF,i.selectFormIdentifierValuesOfIdentifier=iF,i.selectFormIdentifiers=li,i.selectFormIdentifiersByIds=tm,i.selectFormIdentifiersOfForm=tF,i.selectFormMapping=Qm,i.selectFormRevisionAttachmentById=Rm,i.selectFormRevisionAttachments=Mm,i.selectFormRevisionAttachmentsByIds=wm,i.selectFormRevisionAttachmentsMapping=Rt,i.selectFormRevisionById=Dm,i.selectFormRevisionMapping=Si,i.selectFormRevisions=wt,i.selectFormRevisionsByIds=Cm,i.selectFormRevisionsOfForm=$m,i.selectFormSubmissionAttachemntsByIds=_i,i.selectFormSubmissionAttachmentById=uy,i.selectFormSubmissionAttachments=bi,i.selectFormSubmissionAttachmentsByIds=ly,i.selectFormSubmissionAttachmentsMapping=gi,i.selectFormSubmissionById=Py,i.selectFormSubmissions=Oy,i.selectFormSubmissionsByIds=Fy,i.selectFormSubmissionsMapping=Ei,i.selectFormSubmissionsOfForm=gy,i.selectForms=Ii,i.selectFormsByIds=ey,i.selectFormsOfOrganization=cF,i.selectGeoImageById=Dy,i.selectGeoImageMapping=qy,i.selectGeoImages=Vi,i.selectGeoImagesByIds=Cy,i.selectGeoImagesOfProject=dF,i.selectIsImportingProjectFile=BF,i.selectIsLoggedIn=YP,i.selectIssueAssociationById=Zy,i.selectIssueAssociationMapping=ot,i.selectIssueAssociations=Yy,i.selectIssueAssociationsByIds=Jy,i.selectIssueAssociationsOfAsset=xy,i.selectIssueAssociationsOfIssue=Qy,i.selectIssueAssociationsToIssue=Xy,i.selectIssueAttachmentById=op,i.selectIssueAttachmentMapping=up,i.selectIssueAttachments=Di,i.selectIssueAttachmentsByIds=hp,i.selectIssueById=Jp,i.selectIssueCommentAttachmentById=bp,i.selectIssueCommentAttachmentMapping=gp,i.selectIssueCommentAttachments=$i,i.selectIssueCommentAttachmentsByIds=_p,i.selectIssueCommentById=Cp,i.selectIssueCommentMapping=Li,i.selectIssueCommentsByIds=$p,i.selectIssueMapping=Zp,i.selectIssueTypeAttachmentById=oA,i.selectIssueTypeAttachmentMapping=lA,i.selectIssueTypeAttachments=Wi,i.selectIssueTypeAttachmentsByIds=hA,i.selectIssueTypeById=tS,i.selectIssueTypeFieldValues=zt,i.selectIssueTypeFieldValuesAttachmentById=hf,i.selectIssueTypeFieldValuesAttachments=en,i.selectIssueTypeFieldValuesAttachmentsByIds=mf,i.selectIssueTypeFieldValuesAttachmentsMapping=of,i.selectIssueTypeFieldValuesById=$A,i.selectIssueTypeFieldValuesByIds=UA,i.selectIssueTypeFieldValuesMapping=CA,i.selectIssueTypeFieldValuesOfIssue=mF,i.selectIssueTypeFields=ht,i.selectIssueTypeFieldsAttachmentById=bA,i.selectIssueTypeFieldsAttachments=Yi,i.selectIssueTypeFieldsAttachmentsByIds=_A,i.selectIssueTypeFieldsAttachmentsMapping=gA,i.selectIssueTypeFieldsById=xA,i.selectIssueTypeFieldsByIds=ef,i.selectIssueTypeFieldsMapping=QA,i.selectIssueTypeFieldsOfIssueType=yF,i.selectIssueTypeIdentifierById=Mf,i.selectIssueTypeIdentifierMapping=_f,i.selectIssueTypeIdentifierValueById=Lf,i.selectIssueTypeIdentifierValueMapping=Uf,i.selectIssueTypeIdentifierValues=Bt,i.selectIssueTypeIdentifierValuesByIds=kf,i.selectIssueTypeIdentifierValuesOfIdentifier=TF,i.selectIssueTypeIdentifierValuesOfIssue=SF,i.selectIssueTypeIdentifiers=sn,i.selectIssueTypeIdentifiersByIds=Rf,i.selectIssueTypeIdentifiersOfIssueType=fF,i.selectIssueTypeMapping=eS,i.selectIssueTypeStatusById=un,i.selectIssueTypeStatusMapping=yS,i.selectIssueTypeStatuses=rn,i.selectIssueTypeStatusesByIds=pS,i.selectIssueTypeStatusesOfIssueType=OF,i.selectIssueTypeValuesOfIssueType=AF,i.selectIssueTypes=cn,i.selectIssueTypesByIds=sS,i.selectIssueTypesOfOrganization=IF,i.selectIssueUpdateById=FS,i.selectIssueUpdateMapping=pn,i.selectIssueUpdates=An,i.selectIssueUpdatesByIds=gS,i.selectIssueUpdatesOfIssue=bS,i.selectIssues=Vt,i.selectIssuesByIds=Xp,i.selectIssuesOfIssueType=Qp,i.selectIssuesOfProject=lF,i.selectLatestAssetProcedureStepFieldsOfAssetProcedureStep=bP,i.selectLatestAssetProcedureTypeFieldsOfAssetProcedureType=SP,i.selectLatestAssetTypeFieldsOfAssetType=DP,i.selectLatestFieldsByAssetProcedureStep=_P,i.selectLatestFormRevisionOfForm=aF,i.selectLatestIssueTypeFieldsOfIssueType=pF,i.selectLatestRetryTime=MF,i.selectMembershipsByUserOfTeam=UF,i.selectOrganizationAccessById=ZS,i.selectOrganizationAccessMapping=Dt,i.selectOrganizationAccessUserMapping=XS,i.selectOrganizationAccessesByIds=JS,i.selectOrganizationById=lT,i.selectOrganizationDocuments=QP,i.selectOrganizations=uT,i.selectOrganizationsByIds=oT,i.selectOrganizationsMapping=rT,i.selectProjectAccessById=ET,i.selectProjectAccessMapping=bn,i.selectProjectAccesses=mt,i.selectProjectAccessesByIds=vT,i.selectProjectAccessesOfProject=wF,i.selectProjectAttachmentById=NT,i.selectProjectAttachmentMapping=kT,i.selectProjectAttachments=Mn,i.selectProjectAttachmentsByIds=GT,i.selectProjectById=PI,i.selectProjectDocuments=XP,i.selectProjectFileById=dI,i.selectProjectFileMapping=aI,i.selectProjectFiles=cI,i.selectProjectFilesByIds=rI,i.selectProjectMapping=OI,i.selectProjects=Ct,i.selectProjectsByIds=FI,i.selectProjectsOfOrganization=qF,i.selectRehydrated=$F,i.selectStageMapping=Vs,i.selectTeamById=JI,i.selectTeamMembershipById=DI,i.selectTeamMemberships=$t,i.selectTeamMembershipsByIds=CI,i.selectTeamMembershipsMapping=qI,i.selectTeams=zn,i.selectTeamsByIds=XI,i.selectTeamsMapping=ZI,i.selectTeamsOfOrganization=kF,i.selectUploadUrl=Lh,i.selectUserById=qt,i.selectUsers=jt,i.selectUsersByIds=DS,i.selectUsersMapping=In,i.selectUsersOfOrganization=bF,i.selectUsersOfProject=vF,i.selectUsersOfTeam=LF,i.setActiveProjectFileId=iI,i.setAsset=qr,i.setAssetAttachment=Sa,i.setAssetAttachments=Ta,i.setAssetProcedure=Zc,i.setAssetProcedureStep=Sr,i.setAssetProcedureStepFieldValues=cr,i.setAssetProcedureStepFieldValuesAttachment=Wd,i.setAssetProcedureStepFieldValuesAttachments=Kd,i.setAssetProcedureStepFieldValuesMany=dr,i.setAssetProcedureStepFields=Bd,i.setAssetProcedureStepFieldsAttachment=Id,i.setAssetProcedureStepFieldsAttachments=Od,i.setAssetProcedureStepFieldsMany=jd,i.setAssetProcedureSteps=Tr,i.setAssetProcedureType=ld,i.setAssetProcedureTypeAttachment=Va,i.setAssetProcedureTypeAttachments=za,i.setAssetProcedureTypeFieldValues=zc,i.setAssetProcedureTypeFieldValuesAttachment=Tc,i.setAssetProcedureTypeFieldValuesAttachments=Ic,i.setAssetProcedureTypeFieldValuesMany=Bc,i.setAssetProcedureTypeFields=cc,i.setAssetProcedureTypeFieldsAttachment=Wa,i.setAssetProcedureTypeFieldsAttachments=Ka,i.setAssetProcedureTypeFieldsMany=dc,i.setAssetProcedureTypes=od,i.setAssetProcedures=Jc,i.setAssetStage=cu,i.setAssetStageCompletion=Kr,i.setAssetStageCompletions=Yr,i.setAssetStages=du,i.setAssetType=ro,i.setAssetTypeAttachment=Iu,i.setAssetTypeAttachments=Ou,i.setAssetTypeFieldValues=Ol,i.setAssetTypeFieldValuesAttachment=dl,i.setAssetTypeFieldValuesAttachments=rl,i.setAssetTypeFieldValuesMany=Pl,i.setAssetTypeFields=Yu,i.setAssetTypeFieldsAttachment=Bu,i.setAssetTypeFieldsAttachments=ju,i.setAssetTypeFieldsMany=Zu,i.setAssetTypeIdentifier=jl,i.setAssetTypeIdentifierValue=Zl,i.setAssetTypeIdentifierValues=Jl,i.setAssetTypeIdentifiers=ql,i.setAssetTypeStatus=go,i.setAssetTypeStatuses=bo,i.setAssetTypes=uo,i.setAssets=Dr,i.setCategories=ko,i.setCategory=Lo,i.setClientSDK=TO,i.setClientStore=fO,i.setConversation=ha,i.setConversations=uP,i.setCurrentUser=PF,i.setDocument=yh,i.setDocumentAttachment=eh,i.setDocumentAttachments=th,i.setDocuments=ph,i.setEmailDomain=Rh,i.setEmailDomains=wh,i.setForm=Hm,i.setFormIdentifier=Kh,i.setFormIdentifierValue=dm,i.setFormIdentifierValues=rm,i.setFormIdentifiers=Yh,i.setFormRevision=zm,i.setFormRevisionAttachment=Om,i.setFormRevisionAttachments=Pm,i.setFormRevisions=Bm,i.setFormSubmission=py,i.setFormSubmissionAttachment=ny,i.setFormSubmissionAttachments=ay,i.setFormSubmissions=Ay,i.setForms=Wm,i.setGeoImage=Ry,i.setGeoImages=wy,i.setIsImportingProjectFile=sI,i.setIssue=Gp,i.setIssueAssociation=Ny,i.setIssueAssociations=ky,i.setIssueAttachment=np,i.setIssueAttachments=ap,i.setIssueComment=Vp,i.setIssueCommentAttachment=Sp,i.setIssueCommentAttachments=Tp,i.setIssueComments=zp,i.setIssueType=Yf,i.setIssueTypeAttachment=nA,i.setIssueTypeAttachments=aA,i.setIssueTypeFieldValues=VA,i.setIssueTypeFieldValuesAttachment=cf,i.setIssueTypeFieldValuesAttachments=df,i.setIssueTypeFieldValuesMany=zA,i.setIssueTypeFields=WA,i.setIssueTypeFieldsAttachment=SA,i.setIssueTypeFieldsAttachments=TA,i.setIssueTypeFieldsMany=KA,i.setIssueTypeIdentifier=If,i.setIssueTypeIdentifierValue=Bf,i.setIssueTypeIdentifierValues=jf,i.setIssueTypeIdentifiers=Of,i.setIssueTypeStatus=rS,i.setIssueTypeStatuses=uS,i.setIssueTypes=Zf,i.setIssueUpdate=TS,i.setIssueUpdates=IS,i.setIssues=Hp,i.setLoggedIn=jo,i.setOrganization=tT,i.setOrganizationAccess=kS,i.setOrganizationAccesses=NS,i.setOrganizations=eT,i.setProfilePicture=FF,i.setProject=mI,i.setProjectAccess=FT,i.setProjectAccesses=gT,i.setProjectAttachment=qT,i.setProjectAttachments=DT,i.setProjectFile=YT,i.setProjectFiles=ZT,i.setProjects=hI,i.setRehydrated=CF,i.setTeam=NI,i.setTeamMembership=wI,i.setTeamMemberships=EI,i.setTeams=GI,i.setTokens=HP,i.setUploadUrl=Uh,i.setUser=ES,i.setUsers=wS,i.shallowEqual=UO,i.slugify=sP,i.spacesToDashesLower=tP,i.teamMembershipReducer=jI,i.teamMembershipSlice=vn,i.teamReducer=QI,i.teamSlice=Vn,i.toFileNameSafeString=eP,i.toUuidArray=D,i.toUuidIdRecord=xO,i.truncate=iP,i.updateAsset=zr,i.updateAssetAttachment=Ia,i.updateAssetAttachments=Oa,i.updateAssetProcedure=Wc,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=Kc,i.updateAssetStage=lu,i.updateAssetStageCompletion=Zr,i.updateAssetStageCompletions=Jr,i.updateAssetStages=ou,i.updateAssetType=ho,i.updateAssetTypeAttachment=Pu,i.updateAssetTypeAttachments=Fu,i.updateAssetTypeFieldValues=Fl,i.updateAssetTypeFieldValuesAttachment=ul,i.updateAssetTypeFieldValuesAttachments=ll,i.updateAssetTypeFieldValuesMany=gl,i.updateAssetTypeFields=Ju,i.updateAssetTypeFieldsAttachment=qu,i.updateAssetTypeFieldsAttachments=Du,i.updateAssetTypeFieldsMany=Xu,i.updateAssetTypeIdentifier=Dl,i.updateAssetTypeIdentifierValue=Xl,i.updateAssetTypeIdentifierValues=Ql,i.updateAssetTypeIdentifiers=Cl,i.updateAssetTypeStatus=_o,i.updateAssetTypeStatuses=Mo,i.updateAssetTypes=mo,i.updateAssets=Br,i.updateCategories=Go,i.updateCategory=No,i.updateConversation=ma,i.updateConversations=lP,i.updateDocument=Ah,i.updateDocumentAttachment=sh,i.updateDocumentAttachments=ih,i.updateDocuments=fh,i.updateEmailDomain=Eh,i.updateEmailDomains=vh,i.updateForm=Km,i.updateFormIdentifier=Zh,i.updateFormIdentifierValue=um,i.updateFormIdentifierValues=lm,i.updateFormIdentifiers=Jh,i.updateFormRevision=jm,i.updateFormRevisionAttachment=Fm,i.updateFormRevisionAttachments=gm,i.updateFormRevisions=qm,i.updateFormSubmission=Sy,i.updateFormSubmissionAttachment=cy,i.updateFormSubmissionAttachments=dy,i.updateFormSubmissions=Ty,i.updateForms=Ym,i.updateGeoImage=Vy,i.updateGeoImages=zy,i.updateIssue=Wp,i.updateIssueAssociation=Gy,i.updateIssueAssociations=Hy,i.updateIssueAttachment=cp,i.updateIssueAttachments=dp,i.updateIssueComment=Bp,i.updateIssueCommentAttachment=Ip,i.updateIssueCommentAttachments=Op,i.updateIssueComments=jp,i.updateIssueType=Jf,i.updateIssueTypeAttachment=cA,i.updateIssueTypeAttachments=dA,i.updateIssueTypeFieldValues=BA,i.updateIssueTypeFieldValuesAttachment=rf,i.updateIssueTypeFieldValuesAttachments=uf,i.updateIssueTypeFieldValuesMany=jA,i.updateIssueTypeFields=YA,i.updateIssueTypeFieldsAttachment=IA,i.updateIssueTypeFieldsAttachments=OA,i.updateIssueTypeFieldsMany=ZA,i.updateIssueTypeIdentifier=Pf,i.updateIssueTypeIdentifierValue=qf,i.updateIssueTypeIdentifierValues=Df,i.updateIssueTypeIdentifiers=Ff,i.updateIssueTypeStatus=lS,i.updateIssueTypeStatuses=oS,i.updateIssueTypes=Xf,i.updateIssueUpdate=OS,i.updateIssueUpdates=PS,i.updateIssues=Kp,i.updateOrganization=aT,i.updateOrganizationAccess=GS,i.updateOrganizationAccesses=HS,i.updateOrganizations=nT,i.updateProject=fI,i.updateProjectAccess=bT,i.updateProjectAccesses=_T,i.updateProjectAttachment=CT,i.updateProjectAttachments=$T,i.updateProjectFile=QT,i.updateProjectFiles=xT,i.updateProjects=AI,i.updateTeam=HI,i.updateTeamMembership=vI,i.updateTeamMemberships=VI,i.updateTeams=WI,i.updateUser=zS,i.updateUsers=VS,i.useSelectorBuilder=CO,i.useSelectorFactory=$O,i.userReducer=jS,i.userSlice=fn,i.uuidObj=M,i.uuidObjSortFn=Yt,i.uuidSortFn=At,i.versioningReducer=eO,i.versioningSlice=xI,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});