{"version":3,"names":["Annotations","__SystemJSRewritingHack","_export","setters","execute","_recorder_","_src_client_reactive_utils_annotations_js","constructor","_annotations","add","obj","push","has","prop","find","hasOwnProperty","keys","Object","assign","get","getAll","propName","filter","map","squash","defineProperty","set","thisIsVererySecretVariableName","enumerable","configurable"],"sources":["annotations.js"],"sourcesContent":["/**\n *\n * @class Annotations\n * @classdesc Stores and combines multiple plain JavaScript objects for configuration or preferences.\n * @example Usage of the Annotations utility\n * import Annotations from 'src/client/reactive/active-expressions/active-expressions/src/annotations.js';\n *\n * const ann = new Annotations();\n * ann.add({ name: 'Lively4' });\n * ann.add({ name: 'Annotations', color: 'green' });\n *\n * ann.keys(); // ['name', 'color']\n * ann.has('name'); // true\n * ann.get('name'); // 'Lively4'\n * ann.getAll('name'); // ['Lively4', 'Annotations']\n */\nexport default class Annotations {\n  constructor() {\n    this._annotations = [];\n  }\n\n  /**\n   * Stores a new annotation object.\n   * @function Annotations#add\n   * @param {Object} obj - A plain JavaScript object to add as annotation.\n   */\n  add(obj) {\n    this._annotations.push(obj);\n  }\n\n  /**\n   * Checks whether there is some value stored for a given property.\n   * @function Annotations#has\n   * @param {String} prop - The property name we search values for.\n   * @return {Boolean} True, if there is a value for the key, false otherwise.\n   */\n  has(prop) {\n    return !!this._annotations.find(obj => obj.hasOwnProperty(prop));\n  }\n\n  /**\n   * Get all properties for which we have at least one value.\n   * @function Annotations#keys\n   * @return {Array<String>} An array containing all properties for which values are currently defined.\n   */\n  keys() {\n    return Object.keys(Object.assign({}, ...this._annotations));\n  }\n\n  /**\n   * Get a value associated to the given property.\n   * @function Annotations#get\n   * @param {String} prop - The property name we search values for.\n   * @return {any} A value previously added to the property, or undefined if no value was defined previously.\n   */\n  get(prop) {\n    return this.getAll(prop)[0];\n  }\n\n  /**\n   * Get all values associated to the given property.\n   * @function Annotations#getAll\n   * @param {String} propName - The property name we search values for.\n   * @return {Array<any>} An array containing all values associated to the property.\n   */\n  getAll(propName) {\n    return this._annotations\n      .filter(obj => obj.hasOwnProperty(propName))\n      .map(obj => obj[propName]);\n  }\n\n  squash() {\n    return Object.assign({}, ...this._annotations);\n  }\n}\n"],"mappings":";;;MAgBqBA,WAAW,EAAAC,uBAAA;EAAAC,OAAA;EAAA;IAAAC,OAAA;IAAAC,OAAA,WAAAA,CAAA;MAAAH,uBAAA;MAAAI,UAAA,CAAAC,yCAAA,GAAAD,UAAA,CAAAC,yCAAA;MAhBhC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MAfAJ,OAAA,YAgBqBF,WAAW,GAAjB,MAAMA,WAAW,CAAC;QAC/BO,WAAWA,CAAA,EAAG;UACZ,IAAI,CAACC,YAAY,GAAG,EAAE;QACxB;;QAEA;AACF;AACA;AACA;AACA;QACEC,GAAGA,CAACC,GAAG,EAAE;UACP,IAAI,CAACF,YAAY,CAACG,IAAI,CAACD,GAAG,CAAC;QAC7B;;QAEA;AACF;AACA;AACA;AACA;AACA;QACEE,GAAGA,CAACC,IAAI,EAAE;UACR,OAAO,CAAC,CAAC,IAAI,CAACL,YAAY,CAACM,IAAI,CAACJ,GAAG,IAAIA,GAAG,CAACK,cAAc,CAACF,IAAI,CAAC,CAAC;QAClE;;QAEA;AACF;AACA;AACA;AACA;QACEG,IAAIA,CAAA,EAAG;UACL,OAAOC,MAAM,CAACD,IAAI,CAACC,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,CAACV,YAAY,CAAC,CAAC;QAC7D;;QAEA;AACF;AACA;AACA;AACA;AACA;QACEW,GAAGA,CAACN,IAAI,EAAE;UACR,OAAO,IAAI,CAACO,MAAM,CAACP,IAAI,CAAC,CAAC,CAAC,CAAC;QAC7B;;QAEA;AACF;AACA;AACA;AACA;AACA;QACEO,MAAMA,CAACC,QAAQ,EAAE;UACf,OAAO,IAAI,CAACb,YAAY,CACrBc,MAAM,CAACZ,GAAG,IAAIA,GAAG,CAACK,cAAc,CAACM,QAA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