{"version":3,"names":["VivideObject","Annotations","forestToData","forest","map","model","object","dataToForest","data","d","constructor","_data","_properties","_descentStep","properties","descentStep","hasChildren","children","getChildren","length","computeChildren","descentObject","_children"],"sources":["vivideobject.js"],"sourcesContent":["import Annotations from 'src/client/reactive/utils/annotations.js';\n\nexport default class VivideObject {\n  static forestToData(forest) {\n    return forest.map(model => model.object);\n  }\n\n  static dataToForest(data) {\n    return data.map(d => new VivideObject(d));\n  }\n\n  constructor(data) {\n    this._data = data;\n    this._properties = new Annotations();\n    this._descentStep = null;\n  }\n\n  get object() { return this._data; }\n  get data() { return this._data; }\n\n  get properties() {\n    return this._properties;\n  }\n\n  get descentStep() { return this._descentStep; }\n  set descentStep(descentStep) { return this._descentStep = descentStep; }\n\n  async hasChildren() {\n    const children = await this.getChildren();\n\n    return children && children.length > 0;\n  }\n\n  async computeChildren() {\n    if(!this.descentStep) {\n      // #TODO: better: undefined? (to signal the absense of a descent script)\n      return [];\n    }\n\n    const forest = await this.descentStep.descentObject(this.object);\n    return forest;\n  }\n\n  async getChildren() {\n    return this._children = this._children || await this.computeChildren();\n  }\n}\n"],"mappings":";;;mBAEqBA,YAAY;EAAA;EAAA;IAAA;MAF1BC,WAAW;IAAA;IAAA;MAAA;MAAA;MAAA;QAAA;UAAA;QAAA;QAAA;UAAXA,4CAAW;UAAA;QAAA;QAAA;QAAA;MAAA;MAAA,mBAEGD,YAAY,GAAlB,MAAMA,YAAY,CAAC;QAChC,OAAOE,YAAY,CAACC,MAAM,EAAE;UAC1B,OAAOA,MAAM,CAACC,GAAG,CAACC,KAAK,IAAIA,KAAK,CAACC,MAAM,CAAC;QAC1C;QAEA,OAAOC,YAAY,CAACC,IAAI,EAAE;UACxB,OAAOA,IAAI,CAACJ,GAAG,CAACK,CAAC,IAAI,IAAIT,YAAY,CAACS,CAAC,CAAC,CAAC;QAC3C;QAEAC,WAAW,CAACF,IAAI,EAAE;UAChB,IAAI,CAACG,KAAK,GAAGH,IAAI;UACjB,IAAI,CA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