import{R as t}from"./p-22a0eb5c.js";import{T as e,S as s,d as c}from"./p-7c81e200.js";class i extends e{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,e){this.comparisons=t,this.type=e}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=(e,s)=>e.fields.find((e=>e.type===t.type&&e.id===s)).otherCollection,l=(t,e)=>t.selection?t.selection[e]:void 0,u=(t,e)=>{let s;return Object.keys(t.selection||{}).forEach((c=>{j.decode(t.selection[c]).roleNameToSelect===e&&(s=t.selection[c])})),s};class b extends e{static decode(t){const e=Object.assign(Object.create(b.prototype),t);return e.fields=c(e.fields),e.space=s.decode(e.space),Object.keys(e.selection||{}).forEach((t=>{e.selection[t]=j.decode(e.selection[t])})),e.structure&&(e.structure=i.decode(e.structure)),e.actionPermissions=e.actionPermissions||{},e}}class j{static decode(t){var e;const s=Object.assign(Object.create(j.prototype),t);return s.rules=null===(e=s.rules)||void 0===e?void 0:e.map((t=>r.decode(t))),s}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}