import{T as t,S as s,d as e}from"./p-4f99fb23.js";import{R as c}from"./p-8a308033.js";class i extends t{static decode(t){const e=Object.assign(Object.create(i.prototype),t);return e.space=s.decode(e.space),e}}var n,a,o;!function(t){t.comparison="comparison",t.conditionalComparison="conditionalComparison"}(n||(n={})),function(t){t.number="number",t.range="range",t.singleChoice="single-choice",t.multipleChoice="multipleChoice",t.text="text"}(a||(a={})),function(t){t.eq="eq",t.ne="ne",t.lt="lt",t.lte="lte",t.gt="gt",t.gte="gte",t.in="in",t.contain="contain",t.ncontain="ncontain",t.similar="similar",t.different="different"}(o||(o={}));class r{constructor(t,s){this.comparisons=t,this.type=s}static decode(t){return Object.assign(Object.create(r.prototype),t)}isValid(){return this.type!==n.comparison||1===this.comparisons.length&&!!this.comparisons[0].firstField&&!!this.comparisons[0].secondField&&!!this.comparisons[0].comparison}}const d=(t,s)=>t.fields.find((t=>t.type===c.type&&t.id===s)).otherCollection,l=(t,s)=>t.selection?t.selection[s]:void 0,u=(t,s)=>{let e;return Object.keys(t.selection||{}).forEach((c=>{j.decode(t.selection[c]).roleNameToSelect===s&&(e=t.selection[c])})),e};class b extends t{static decode(t){const c=Object.assign(Object.create(b.prototype),t);return c.fields=e(c.fields),c.space=s.decode(c.space),Object.keys(c.selection||{}).forEach((t=>{c.selection[t]=j.decode(c.selection[t])})),c.structure&&(c.structure=i.decode(c.structure)),c.actionPermissions=c.actionPermissions||{},c}}class j{static decode(t){var s;const e=Object.assign(Object.create(j.prototype),t);return e.rules=null===(s=e.rules)||void 0===s?void 0:s.map((t=>r.decode(t))),e}isActive(){return"active"===this.status}}export{o as C,i as M,b as P,r as R,n as a,l as b,u as c,d as g}