System.register(['./reflect-metadata'], function (_export) {
'use strict';
var meta, Metadata;
function ensureDecorators(target) {
var applicator;
if (typeof target.decorators === 'function') {
applicator = target.decorators();
} else {
applicator = target.decorators;
}
Eif (typeof applicator._decorate === 'function') {
delete target.decorators;
applicator._decorate(target);
} else {
throw new Error('The return value of your decorator\'s method was not valid.');
}
}
return {
setters: [function (_reflectMetadata) {
meta = _reflectMetadata['default'];
}],
execute: function () {
/**
* Provides helpers for working with metadata.
*
* @class Metadata
* @static
*/
Metadata = {
resource: 'aurelia:resource',
paramTypes: 'design:paramtypes',
properties: 'design:properties',
get: function get(metadataKey, target, propertyKey) {
Iif (!target) {
return undefined;
}
var result = Metadata.getOwn(metadataKey, target, propertyKey);
return result === undefined ? Metadata.get(metadataKey, Object.getPrototypeOf(target), propertyKey) : result;
},
getOwn: function getOwn(metadataKey, target, propertyKey) {
if (!target) {
return undefined;
}
if (target.hasOwnProperty('decorators')) {
ensureDecorators(target);
}
return Reflect.getOwnMetadata(metadataKey, target, propertyKey);
},
getOrCreateOwn: function getOrCreateOwn(metadataKey, Type, target, propertyKey) {
var result = Metadata.getOwn(metadataKey, target, propertyKey);
if (result === undefined) {
result = new Type();
Reflect.defineMetadata(metadataKey, result, target, propertyKey);
}
return result;
}
};
_export('Metadata', Metadata);
}
};
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9Vc2Vycy9FaXNlbmJlcmdFZmZlY3QvRG9jdW1lbnRzL0dpdEh1Yi9UaGUgRHVyYW5kYWwgUHJvamVjdC9hdXJlbGlhL21ldGFkYXRhL3NyYy9tZXRhZGF0YS5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7WUF5QlcsUUFBUTs7QUF2Qm5CLFdBQVMsZ0JBQWdCLENBQUMsTUFBTSxFQUFDO0FBQy9CLFFBQUksVUFBVSxDQUFDOztBQUVmLFFBQUcsT0FBTyxNQUFNLENBQUMsVUFBVSxLQUFLLFVB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