/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
import{a as p}from"./KOIDWEP3.js";import{a as n}from"./AJZDBHB6.js";var l=1,f=e=>[{orgid:[e]},{type:{not:["Code Attachment"]}}],u=e=>[{orgId:e}],O={item:f,event:u};function j(e){if(n(e,"schemaVersion")===l)return e;{let t=p(e);return t=d(t),t}}function d(e){if(n(e,"schemaVersion")>1)return e;{let t={schemaVersion:1,title:"Default Catalog",scopes:{item:{targetEntity:"item",filters:[]},event:{targetEntity:"event",filters:[]}},collections:[]},s=n(e,"groups")||[],c=[];Array.isArray(s)&&s.length?c=s:typeof s=="string"&&(c=[s]),c.length&&(t.scopes=Object.entries(t.scopes).reduce((o,r)=>Object.assign(Object.assign({},o),{[r[0]]:Object.assign(Object.assign({},r[1]),{filters:[{predicates:[{group:c}]}]})}),{}));let i=n(e,"orgId");return i&&(t.scopes=Object.entries(t.scopes).reduce((o,r)=>{let a=r[0],g=r[1];return Object.assign(Object.assign({},o),{[a]:Object.assign(Object.assign({},g),{filters:[...g.filters,{operation:"AND",predicates:O[a](i)}]})})},{})),t}}export{j as a};
