solid-goggles
Version:
Inversion of Control for Javascript
1 lines • 24.6 kB
JavaScript
module.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=19)}([function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.isNull=t.isEmpty=t.isUndefined=t.isBoolean=t.isNumber=t.isString=t.isSymbol=t.isFunction=t.isNullableObject=t.isObject=t.isComposite=t.isPrimitive=t.is=void 0;var i=function(e){return function(t){return r(t)===e}};t.is=i;t.isPrimitive=function(e){return!o(e)&&!a(e)};t.isComposite=function(e){return o(e)||a(e)};var o=function(e){return u(e)&&!v(e)};t.isObject=o;var u=i("object");t.isNullableObject=u;var a=i("function");t.isFunction=a;var c=i("symbol");t.isSymbol=c;var f=i("string");t.isString=f;var l=i("number");t.isNumber=l;var s=i("boolean");t.isBoolean=s;var y=i("undefined");t.isUndefined=y;t.isEmpty=function(e){return v(e)||y(e)};var v=function(e){return null===e};t.isNull=v},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.methods=t.properties=t.parameters=t.factory=t.findImplementation=t.canImplement=void 0;var r=Symbol("canImplement");t.canImplement=r;var i=Symbol("implementation");t.findImplementation=i;var o=Symbol("factory");t.factory=o;var u=Symbol("parameters");t.parameters=u;var a=Symbol("properties");t.properties=a;var c=Symbol("methods");t.methods=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InjectorEmitter=void 0;var r=n(11);function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var u,a=e[Symbol.iterator]();!(r=(u=a.next()).done)&&(n.push(u.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{r||null==a.return||a.return()}finally{if(i)throw o}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function u(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}var a=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var n=Array.isArray(t)?t:t.listeners;this.listeners=[].concat(n||[]).map(function(e){return Object.assign({},e)})}return u(e,null,[{key:"EVERY",get:function(){}},{key:"GET",get:function(){return"get"}},{key:"SET",get:function(){return"set"}},{key:"DELETE",get:function(){return"delete"}},{key:"INSTANTIATE",get:function(){return"instantiate"}}]),u(e,[{key:"onEvery",value:function(t,n){return this.on(e.EVERY,t,n)}},{key:"onGet",value:function(t,n){return this.on(e.GET,t,n)}},{key:"onSet",value:function(t,n){return this.on(e.SET,t,n)}},{key:"onDelete",value:function(t,n){return this.on(e.DELETE,t,n)}},{key:"onInstantiate",value:function(t,n){return this.on(e.INSTANTIATE,t,n)}},{key:"on",value:function(e,t,n){var r=i(this.sortImplementation(t,n),2);return t=r[0],n=r[1],this.listeners.push({event:e,implementation:t,listener:n}),n}},{key:"emitEvery",value:function(t,n){return this.emit(e.EVERY,t,n)}},{key:"emitGet",value:function(t,n){return this.emit(e.GET,t,n)}},{key:"emitSet",value:function(t,n){return this.emit(e.SET,t,n)}},{key:"emitDelete",value:function(t,n){return this.emit(e.DELETE,t,n)}},{key:"emitInstantiate",value:function(t,n){return this.emit(e.INSTANTIATE,t,n)}},{key:"emit",value:function(e,t,n){var o=this,u=i(this.sortImplementation(t,n),2);t=u[0],n=u[1];var a=this.listeners.filter(function(n){var r=n.implementation,i=n.event;return o.isValid(i,e)&&o.isValid(r,t)}).map(function(e){return e.listener});return(0,r.next)(n,a)}},{key:"removeEvery",value:function(t,n){return this.remove(e.EVERY,t,n)}},{key:"removeGet",value:function(t,n){return this.remove(e.GET,t,n)}},{key:"removeSet",value:function(t,n){return this.remove(e.SET,t,n)}},{key:"removeDelete",value:function(t,n){return this.remove(e.DELETE,t,n)}},{key:"removeInstantiate",value:function(t,n){return this.remove(e.INSTANTIATE,t,n)}},{key:"remove",value:function(e,t,n){var r=i(this.sortImplementation(t,n),2);t=r[0],n=r[1];var o=this.listeners;return this.listeners=this.listeners.filter(function(r){var i=r.event,o=r.implementation,u=r.listener;return e!==i||t!==o||n!==u}),o.length===this.listeners.length?void 0:n}},{key:"sortImplementation",value:function(e,t){return[t&&e,t||e]}},{key:"isValid",value:function(t,n){return t===n||t===e.EVERY}}]),e}();t.InjectorEmitter=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Container=void 0;var r=n(12);function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var u,a=e[Symbol.iterator]();!(r=(u=a.next()).done)&&(n.push(u.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{r||null==a.return||a.return()}finally{if(i)throw o}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function u(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}var a=function(){function e(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Map;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.parent=n.parent,e.ENTRY.forEach(function(e){return t[e]=new r}),n.forEach&&n.forEach(function(e){return t.set(e)})}return u(e,[{key:"size",get:function(){return this[e.IMPLEMENTATION].size}}],[{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Array.isArray(e)?e:this.ENTRY.map(function(t){return e[t]})}},{key:"toObject",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return Array.isArray(t)?t.reduce(function(t,n,r){return Object.assign(t,function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}({},e.ENTRY[r],n))},{}):t}},{key:"INTERFACE",get:function(){return"interface"}},{key:"IMPLEMENTATION",get:function(){return"implementation"}},{key:"INSTANCE",get:function(){return"instance"}},{key:"ENTRY",get:function(){return[this.INTERFACE,this.IMPLEMENTATION,this.INSTANCE]}}]),u(e,[{key:"getInterface",value:function(t){return this.get(e.INTERFACE,t)}},{key:"getImplementation",value:function(t){return this.get(e.IMPLEMENTATION,t)}},{key:"getInstance",value:function(t){return this.get(e.INSTANCE,t)}},{key:"setInterface",value:function(t,n){return this.set([n,t])[e.INTERFACE]}},{key:"setImplementation",value:function(t){return this.set([,t])[e.IMPLEMENTATION]}},{key:"setInstance",value:function(t,n){return this.set([,t,n])[e.INSTANCE]}},{key:"deleteInterface",value:function(t){return this.delete(e.INTERFACE,t)}},{key:"deleteImplementation",value:function(t){return this.delete(e.IMPLEMENTATION,t)}},{key:"deleteInstance",value:function(t){return this.delete(e.INSTANCE,t)}},{key:"clearInterfaces",value:function(){return this.clear(e.INTERFACE)}},{key:"clearImplementations",value:function(){return this.clear(e.IMPLEMENTATION)}},{key:"clearInstances",value:function(){return this.clear(e.INSTANCE)}},{key:"get",value:function(t,n){if(this[t].has(n))return n;var r=this[e.INTERFACE].get(n)||this[e.INSTANCE].get(n)||n;return(this[e.IMPLEMENTATION].get(r)||{})[t]||this.getFromParent(t,n)}},{key:"set",value:function(t){var n=i(e.toArray(t),3),r=n[0],o=n[1],u=n[2],a=this[e.IMPLEMENTATION].get(o)||{};return this[e.IMPLEMENTATION].set(o,a),void 0!==r&&this[e.INTERFACE].set(r,o),void 0!==u&&this[e.INSTANCE].set(u,o),Object.assign(a,e.toObject(t))}},{key:"delete",value:function(t,n){var r=this[e.IMPLEMENTATION].get(this.get(e.IMPLEMENTATION,n))||{},i=r[t];return delete r[t],this[t].delete(i)?i:void 0}},{key:"clear",value:function(){for(var t=this,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];r.forEach(function(n){t[n].clear(),t[e.IMPLEMENTATION].forEach(function(e){return delete e[n]})})}},{key:"getFromParent",value:function(e,t){return this.parent&&this.parent.get(e,t)}},{key:"findReturn",value:function(t){var n=this;return(0,r.findReturn)(this[e.IMPLEMENTATION],function(r){var o=i(r,2)[1];return t(e.toArray(o),n)})}},{key:"forEach",value:function(t){var n=this;return this[e.IMPLEMENTATION].forEach(function(r){return t(e.toArray(r),n)})}}]),e}();t.Container=a},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function u(e){return(u=Object.getPrototypeOf||function(e){return e.__proto__})(e)}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e,t,n){return(c="object"===("undefined"==typeof Reflect?"undefined":r(Reflect))&&Reflect.construct||function(e,t,n){var r=[null];return r.push.apply(r,t),a(new(e.bind.apply(e,r)),n.prototype)})(e,t,n)}function f(e){var t="function"==typeof Map?new Map:void 0;return(f=function(e){if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),a(n,a(function(){return c(e,arguments,u(this).constructor)},e))})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.InjectorError=void 0;var l=function(e){var t,n,u;function a(){var e,t,n,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:a.GENERATE_ERROR;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),t=this,e=!(n=(a.__proto__||Object.getPrototypeOf(a)).call(this,c.replace(a.INTERFACE,i.name||i).replace(a.IMPLEMENTATION,u.name||u)))||"object"!==r(n)&&"function"!=typeof n?o(t):n,Object.assign(o(e),{interface:i,implementation:u}),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(a,f(Error)),t=a,u=[{key:"INTERFACE",get:function(){return"{interface}"}},{key:"IMPLEMENTATION",get:function(){return"{implementation}"}},{key:"GENERATE_ERROR",get:function(){return"Could not instantiate interface '{interface}'"}},{key:"LINK_ERROR",get:function(){return"Implementation '{implementation}' is not compatible with '{interface}'"}}],(n=null)&&i(t.prototype,n),u&&i(t,u),a}();t.InjectorError=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.implement=void 0;var r=n(1);t.implement=function(e){return function(t){Object(e||t)[r.findImplementation]=Object(t)[r.findImplementation]=t}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.register=void 0;var r=n(1);t.register=function(e){return function(t){Object(t)[r.findImplementation]=Object(e||t)[r.findImplementation]=e||t}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.connect=void 0;var r=n(1),i=n(0);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var u,a=e[Symbol.iterator]();!(r=(u=a.next()).done)&&(n.push(u.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{r||null==a.return||a.return()}finally{if(i)throw o}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var a=function(e,t,n){if("undefined"!=typeof Reflect&&(0,i.isFunction)(Reflect.getMetadata))return(0,i.isNumber)(n)?(Reflect.getMetadata("design:paramtypes",e,t)||[])[n]:Reflect.getMetadata("design:type",e,t)};t.connect=function(e){return function(t,n,r){return c(t,n,r)(e||a(t,n,r))}};var c=function(e,t,n){return f.find(function(e){return(0,u(e,1)[0])(t,n)})[1](e,t,n)},f=[[function(e,t){return void 0===e&&(0,i.isNumber)(t)},function(e,t,n){return function(t){e[r.parameters]=Object.assign(e[r.parameters]||[],o({},n,t))}}],[function(e,t){return(0,i.isString)(e)&&!(0,i.isNumber)(t)},function(e,t){return function(n){e[r.properties]=Object.assign(e[r.properties]||{},o({},t,n))}}],[function(e,t){return(0,i.isString)(e)&&(0,i.isNumber)(t)},function(e,t,n){return function(i){e[r.methods]=e[r.methods]||{},e[r.methods][t]=Object.assign(e[r.methods][t]||[],o({},n,i))}}]]},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defaultFactory=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return a(e)(e,t)};var r=n(0);function i(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var u,a=e[Symbol.iterator]();!(r=(u=a.next()).done)&&(n.push(u.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{r||null==a.return||a.return()}finally{if(i)throw o}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var u=[,function(e){return e}],a=function(e){return(c.find(function(t){return(0,o(t,1)[0])(e)})||u)[1]},c=[[function(e){return(0,r.isFunction)(e)&&!e.prototype},function(e,t){return e.apply(void 0,i(t))}],[function(e){return(0,r.isFunction)(e)&&e.prototype},function(e,t){return new(Function.prototype.bind.apply(e,[null].concat(i(t))))}],[r.isObject,function(e){return Object.create(e)}]]},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isEquivalent=function(e,t){return function(e,t){return e===t||(n=e,function(e){var t=[];do{t=t.concat(o(e))}while(e=e&&Object.getPrototypeOf(e));return t}(n).filter(function(e){return"constructor"!==e&&(0,r.isFunction)(n[e])})).every(function(n){return function(e,t){return(0,r.isFunction)(e)&&(0,r.isFunction)(t)&&e.length===t.length}(e[n],(t||{})[n])});var n}(i(e),i(t))};var r=n(0);function i(e){return(0,r.isFunction)(e)?e.prototype:e}function o(e){return(0,r.isObject)(e)?Object.getOwnPropertyNames(e):[]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defaultCanImplement=function(e,t){return(0,r.isPrimitive)(e)?e===t:(0,i.isEquivalent)(e,t)};var r=n(0),i=n(9)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.next=function(e,t,n){return function e(t,n,i){if(!n.length)return t;return n[r].apply(n,[t,function(t){return n.shift(),e(t,n,i)}].concat((o=[].concat(i),function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(o)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(o)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}())));var o}(e,[].concat(t||[]),n)};var r=0},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.findReturn=function(e,t){var n=!0,r=!1,i=void 0;try{for(var o,u=e[Symbol.iterator]();!(n=(o=u.next()).done);n=!0){var a=o.value,c=t(a);if(c)return c}}catch(e){r=!0,i=e}finally{try{n||null==u.return||u.return()}finally{if(r)throw i}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.objectMap=void 0;t.objectMap=function(e){return function(t){var n=Object.create(Object.getPrototypeOf(e));for(var r in e)n[r]=t(e[r],r,e);return n}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fill=void 0;t.fill=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e=[].concat(e),t=t.filter(function(e){return void 0!==e});for(var n=0;n<e.length;n++)void 0===e[n]&&(e[n]=t.shift());return e.concat(t)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extend=void 0;var r=n(0);t.extend=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return(0,r.isPrimitive)(e)?e:n.reduce(function(e,t){return(0,r.isPrimitive)(t)?e:Object.assign(e,t)},e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.error=function(e){throw e}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.asFunc=function(e){return(0,r.isFunction)(e)?e:function(){return e}};var r=n(0)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Injector=void 0;var r=n(4),i=n(1),o=n(17),u=n(16),a=n(15),c=n(14),f=n(13),l=n(3),s=n(2);function y(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var u,a=e[Symbol.iterator]();!(r=(u=a.next()).done)&&(n.push(u.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{r||null==a.return||a.return()}finally{if(i)throw o}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function v(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function m(e,t,n){return t&&v(e.prototype,t),n&&v(e,n),e}var p=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l.Container,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:s.InjectorEmitter,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Map;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.baseFactory=t.baseFactory,this.baseCanImplement=t.baseCanImplement,this.emitter=new r(t.emitter,i),this.container=new n(t.container,i),this.factories=new i(t.factories)}return m(e,null,[{key:"of",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return new this({container:t.map(function(e){return[,e]})})}}]),m(e,[{key:"get",value:function(e){return this.tryGet(e)||(0,u.error)(new r.InjectorError(e))}},{key:"set",value:function(e,t){var n=this.findImplementation(e)||e;return t&&this.container.setInstance(n,this.emitter.emitSet(n,t))}},{key:"delete",value:function(e){var t=this.findInstance(e),n=this.container.getImplementation(t);return this.container.deleteInstance(n)&&this.emitter.emitDelete(n,t)}},{key:"tryGet",value:function(e){var t=this.findImplementation(e),n=this.findInstance(t)||this.generate(t);return t&&n&&this.emitter.emitGet(t,n)}},{key:"setImplementation",value:function(e){return e&&this.container.setImplementation(e)}},{key:"link",value:function(e,t){return this.tryLink(e,t)||(0,u.error)(new r.InjectorError(e,t,r.InjectorError.LINK_ERROR))}},{key:"tryLink",value:function(e,t){return e===t?this.setImplementation(t):this.canImplement(e,t)&&this.container.setInterface(t,e)}},{key:"factory",value:function(e,t){return void 0===t?this.baseFactory=e:(this.factories.set(this.setImplementation(e),t),t)}},{key:"onEvery",value:function(e,t){return this.emitter.onEvery(e,t)}},{key:"onGet",value:function(e,t){return this.emitter.onGet(e,t)}},{key:"onSet",value:function(e,t){return this.emitter.onSet(e,t)}},{key:"onDelete",value:function(e,t){return this.emitter.onDelete(e,t)}},{key:"onInstantiate",value:function(e,t){return this.emitter.onInstantiate(e,t)}},{key:"generate",value:function(e){var t=this.findImplementation(e),n=this.set(t,this.instantiate(t));return(0,a.extend)(n,this.properties(n),this.methods(n))}},{key:"instantiate",value:function(e){var t=this.findImplementation(e);return t&&this.emitter.emitInstantiate(t,this.getFactory(t)(t,this.parameters(t),this))}},{key:"methods",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,f.objectMap)((0,o.asFunc)(t[i.methods])(this)||{})(function(n,r){var i=t[r];return function(){for(var r=arguments.length,o=new Array(r),u=0;u<r;u++)o[u]=arguments[u];return i.apply(t,(0,c.fill)([].concat(n).map(function(t){return t&&e.get(t)}))(o))}})}},{key:"properties",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,f.objectMap)((0,o.asFunc)(t[i.properties])(this)||{})(function(t){return e.get(t)})}},{key:"parameters",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[].concat((0,o.asFunc)(t[i.parameters])(this)||[]).map(function(t){return e.get(t)})}},{key:"clear",value:function(){var e=this;return this.container.forEach(function(t){var n=y(t,3)[2];return n&&e.delete(n)}),this}},{key:"findImplementation",value:function(e){var t=this;if(e)return e[i.findImplementation]?this.setImplementation(e[i.findImplementation]):this.container.getImplementation(e)||this.container.findReturn(function(n){var r=y(n,2)[1];return t.tryLink(e,r)&&r})}},{key:"findInterface",value:function(e){return e&&this.container.getInterface(e)}},{key:"findInstance",value:function(e){return e&&this.container.getInstance(e)}},{key:"canImplement",value:function(e,t){return this.getCanImplement(e,t)(e,t,this)}},{key:"getFactory",value:function(e){return this.factories.get(e)||(e||{})[i.factory]||this.baseFactory||this.constructor.baseFactory}},{key:"getCanImplement",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e[i.canImplement]||t[i.canImplement]||this.baseCanImplement||this.constructor.baseCanImplement}}]),e}();t.Injector=p},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(18);Object.keys(r).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return r[e]}})});var i=n(10),o=n(8),u=n(3);Object.keys(u).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return u[e]}})});var a=n(2);Object.keys(a).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return a[e]}})});var c=n(1);Object.keys(c).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return c[e]}})});var f=n(7);Object.keys(f).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return f[e]}})});var l=n(6);Object.keys(l).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return l[e]}})});var s=n(5);Object.keys(s).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return s[e]}})});var y=n(4);Object.keys(y).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return y[e]}})}),r.Injector.baseCanImplement=i.defaultCanImplement,r.Injector.baseFactory=o.defaultFactory}]);