-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjasper.min.js
1 lines (1 loc) · 19.1 KB
/
jasper.min.js
1
/*! JasperJs https://github.com/jasperjs/jasper-application - v0.5.1 - 2016-04-12 */var jasper;!function(a){var b;!function(a){var b=function(){function a(){}return a.prototype.getComponentControllers=function(a,b){var c,d;return b.require&&angular.isArray(b.require)?(d=a.shift(),c=a,1===c.length&&(c=c[0])):(d=a,c=d),{main:d,controllersToPass:c}},a.prototype.getFactoryOf=function(a){if(angular.isString(a)){var b=this.getter(window,a);if(!b)throw'Constructor defined as "'+a+'" not found';return b}if(angular.isFunction(a))return a;throw"Unknown component definition "+a},a.prototype.snakeCase=function(a){var b=/[A-Z]/g,c="-";return a.replace(b,function(a,b){return(b?c:"")+a.toLowerCase()})},a.prototype.camelCase=function(a){var b=/[A-Z]/g;return a.replace(b,function(a,b){return b?a:a.toLowerCase()})},a.prototype.camelCaseTagName=function(a){return a.indexOf("-")<0?this.camelCase(a):a.replace(/\-(\w)/g,function(a,b){return b.toUpperCase()})},a.prototype.fetchAttributeBindings=function(a,b){var c=[];if(a)for(var d in a)if(a.hasOwnProperty(d)){var e=a[d],f="text";0===e.indexOf("=")&&(f="data",e=e.slice(1,e.length)),c.push({name:d,ctrlName:e,type:f})}return b&&b.forEach(function(a){c.push({name:a,ctrlName:a,type:"event"})}),c},a.prototype.extractAttributeBindings=function(a){if(a.properties||a.events){var b=[];if(a.properties)for(var c=0;c<a.properties.length;c++){var d=a.properties[c],e=this.camelCaseTagName(d);b.push({name:d,ctrlName:e,type:"text"}),b.push({name:"bind-"+d,ctrlName:e,type:"data"})}if(a.events)for(var c=0;c<a.events.length;c++){var f=a.events[c],e=this.camelCaseTagName(f);b.push({name:"on-"+f,ctrlName:e,type:"expr",$$eventEmitter:!0})}return b}return a.attributes||[]},a.prototype.getter=function(a,b){for(var c,d=b.split("."),e=d.length,f=0;e>f;f++)if(c=d[f],a=a[c],!a)return void 0;return a},a}();a.UtilityService=b}(b=a.core||(a.core={}))}(jasper||(jasper={}));var jasper;!function(a){var b;!function(a){var b=function(){function b(b){this.directive=b.directive,this.utility=new a.UtilityService}return b.prototype.register=function(a){this.interceptor&&this.interceptor.onRegister(a);var b=this.createDirectiveFor(a);this.directive(a.name,function(){return b})},b.prototype.setInterceptor=function(a){this.interceptor=a},b.prototype.createDirectiveFor=function(b){var c=this,d={restrict:"E"},e=b.ctrl||b.ctor;if(e){var f=this.utility.getFactoryOf(e);d.controller=a.JasperDirectiveWrapperFactory(f,this.utility.extractAttributeBindings(b),this.utility,!0),d.controllerAs="vm",d.scope={}}else d.scope=this.getScopeDefinition(b);return d.transclude="true"===b.transclude?!0:b.transclude,d.templateUrl=b.templateUrl,d.replace=b.replace,d.templateNamespace=b.templateNamespace,angular.isDefined(b.template)&&(d.template=b.template),d.require=this.getRequirementsForComponent(b,!!d.controller),(d.controller||this.interceptor)&&(d.compile=function(a){return c.interceptor&&c.interceptor.onCompile(d,a,b),{post:function(a,e,f,g,h){var i=c.utility.getComponentControllers(g,d);i.main&&i.main.link&&i.main.link(e[0],i.controllersToPass,h),c.interceptor&&c.interceptor.onMount(d,a,e,b)}}}),d},b.prototype.getScopeDefinition=function(a){var b={};if(!a.attributes)return b;for(var c=0;c<a.attributes.length;c++){var d=a.attributes[c];if(!d.name)throw"Attribute name not specified of: "+JSON.stringify(d);var e="=?",f=d.type||"data";switch(f){case"expr":case"event":e="&";break;case"text":e="@"}var g=this.utility.camelCaseTagName(d.name);b[g]=e}return b},b.prototype.getRequirementsForComponent=function(a,b){if(angular.isDefined(a.require)){var c=[];return b&&c.push(a.name),angular.isArray(a.require)?c=c.concat(a.require):c.push(a.require),c}return b?a.name:void 0},b}();a.HtmlComponentRegistrar=b}(b=a.core||(a.core={}))}(jasper||(jasper={}));var jasper;!function(a){var b;!function(a){var b=function(){function b(b){this.componentRegistar=new a.HtmlComponentRegistrar(b)}return b.prototype.register=function(a){this.componentRegistar.register(a)},b.prototype.$get=function(){return this.componentRegistar},b.$inject=["$compileProvider"],b}();a.ComponentProvider=b}(b=a.core||(a.core={}))}(jasper||(jasper={}));var jasper;!function(a){var b;!function(b){var c=function(){function b(b){this.decoratorRegistar=new a.core.HtmlDecoratorRegistrar(b)}return b.prototype.register=function(a){this.decoratorRegistar.register(a)},b.prototype.$get=function(){return this.decoratorRegistar},b.$inject=["$compileProvider"],b}();b.DecoratorComponentProvider=c}(b=a.core||(a.core={}))}(jasper||(jasper={}));var jasper;!function(a){var b;!function(a){var b=function(){function b(b){this.directive=b.directive,this.utility=new a.UtilityService}return b.prototype.register=function(a){this.interceptor&&this.interceptor.onRegister(a);var b=this.createDirectiveFor(a);this.directive(a.name,function(){return b})},b.prototype.setInterceptor=function(a){this.interceptor=a},b.prototype.createDirectiveFor=function(b){var c=this,d={restrict:"A",scope:!1},e=b.ctrl||b.ctor;if(!e)throw new Error(b.name+" must specify constructor");return d.controller=a.JasperDirectiveWrapperFactory(e,this.utility.extractAttributeBindings(b),this.utility,!1),d.priority=b.priority,d.require=this.getRequirementsForComponent(b),d.compile=function(a){return c.interceptor&&c.interceptor.onCompile(d,a,b),{post:function(a,e,f,g){var h=c.utility.getComponentControllers(g,d),i=f[b.name],j=angular.isDefined(b.eval)?b.eval:!0,k=void 0;angular.isDefined(i)&&(k=j?a.$eval(i):i),h.main.link&&h.main.link(k,e[0],f,h.controllersToPass);var l;h.main.onValueChanged&&f.hasOwnProperty(b.name)&&j&&(l=a.$watch(i,function(a,b){h.main.onValueChanged(a,b)})),l&&e.on("$destroy",function(){l()}),c.interceptor&&c.interceptor.onMount(d,a,e,b)}}},"undefined"!=typeof b.priority&&(d.priority=b.priority),d},b.prototype.getRequirementsForComponent=function(a){if(angular.isDefined(a.require)){var b=[a.name];return angular.isArray(a.require)?b=b.concat(a.require):b.push(a.require),b}return a.name},b.prototype.getComponentControllers=function(a,b){var c,d;return b.require&&angular.isArray(b.require)?(d=a.shift(),c=a,1===c.length&&(c=c[0])):(d=a,c=d),{main:d,controllersToPass:c}},b}();a.HtmlDecoratorRegistrar=b}(b=a.core||(a.core={}))}(jasper||(jasper={}));var jasper;!function(a){var b;!function(a){var b=function(){function b(b){this.filterRegistar=new a.FilterRegistrar(b)}return b.prototype.register=function(a){this.filterRegistar.register(a)},b.prototype.$get=function(){return{}},b.$inject=["$filterProvider"],b}();a.FilterProvider=b}(b=a.core||(a.core={}))}(jasper||(jasper={}));var jasper;!function(a){var b;!function(a){var b=function(){function b(b){this.filter=b.register,this.utility=new a.UtilityService}return b.prototype.register=function(a){if(!a.ctor)throw new Error(a.name+" must specify constructor");var b=this.utility.getFactoryOf(a.ctor);this.filter(a.name,b)},b}();a.FilterRegistrar=b}(b=a.core||(a.core={}))}(jasper||(jasper={}));var jasper;!function(a){var b;!function(b){var c=function(){function b(b){this.serviceRegistar=new a.core.ServiceRegistrar(b)}return b.prototype.register=function(a){this.serviceRegistar.register(a)},b.prototype.$get=function(){return this.serviceRegistar},b.$inject=["$provide"],b}();b.ServiceProvider=c}(b=a.core||(a.core={}))}(jasper||(jasper={}));var jasper;!function(a){var b;!function(a){var b=function(){function b(b){this.provide=b,this.service=b.service,this.utility=new a.UtilityService}return b.prototype.registerFactory=function(a,b){this.provide.factory(a,b)},b.prototype.register=function(a){if(!a.ctor)throw new Error(a.name+" must specify constructor");var b=this.utility.getFactoryOf(a.ctor);this.service(a.name,b)},b}();a.ServiceRegistrar=b}(b=a.core||(a.core={}))}(jasper||(jasper={}));var jasper;!function(a){var b;!function(a){var b=function(){function a(a){this.provide=a}return a.prototype.register=function(a,b){this.provide.value(a,b)},a.prototype.$get=function(){return this},a.$inject=["$provide"],a}();a.ValueProvider=b}(b=a.core||(a.core={}))}(jasper||(jasper={}));var jasper;!function(a){var b;!function(a){var b=function(){function a(a){this.provide=a}return a.prototype.register=function(a,b){this.provide.constant(a,b)},a.prototype.$get=function(){return this},a.$inject=["$provide"],a}();a.ConstantProvider=b}(b=a.core||(a.core={}))}(jasper||(jasper={}));var jasper;!function(a){var b;!function(a){var b=function(){function a(){this.events={}}return a.prototype.subscribe=function(a,b){var c=this;return this.events[a]||(this.events[a]={queue:[]}),this.events[a].queue.push(b),{remove:function(){c.removeSubscription(a,b)}}},a.prototype.broadcast=function(a){for(var b=this,c=[],d=1;d<arguments.length;d++)c[d-1]=arguments[d];if(this.events[a]){var e=this.events[a].queue;e.forEach(function(a){a.apply(b,c)})}},a.prototype.removeSubscription=function(a,b){if(this.events[a])for(var c=this.events[a].queue,d=0;d<c.length;d++)if(c[d]===b){c.splice(d,1);break}},a}();a.GlobalEventsService=b}(b=a.core||(a.core={}))}(jasper||(jasper={}));var jasper;!function(a){var b;!function(a){var b=function(){function a(a){this.fn=a}return a.prototype.next=function(a){this.fn(a?{$event:a}:void 0)},a}();a.EventEmitter=b}(b=a.core||(a.core={}))}(jasper||(jasper={}));var jasper;!function(a){var b;!function(a){var b=function(){function a(){}return a.prototype.$digest=function(){this.ensureScope(),this.$$scope.$digest()},a.prototype.$apply=function(a){this.ensureScope(),this.$$scope.$apply(a)},a.prototype.$on=function(a,b){return this.ensureScope(),this.$$scope.$on(a,b)},a.prototype.$watch=function(a,b,c){return this.ensureScope(),this.$$scope.$watch(a,b,c)},a.prototype.$watchCollection=function(a,b){return this.ensureScope(),this.$$scope.$watchCollection(a,b)},a.prototype.$watchGroup=function(a,b){return this.ensureScope(),this.$$scope.$watchGroup(a,b)},a.prototype.$eval=function(a,b){return this.ensureScope(),this.$$scope.$eval(a,b)},a.prototype.$evalAsync=function(a){return this.ensureScope(),this.$$scope.$evalAsync(a)},a.prototype.ensureScope=function(){if(!this.$$scope)throw"$$scope not initialized"},a}();a.JasperComponent=b}(b=a.core||(a.core={}))}(jasper||(jasper={}));var jasper;!function(a){var b;!function(a){function b(a,b,e,f){var g=["$scope","$element","$attrs","$parse","$interpolate"],h=g.concat(a.$inject||[]),i=d(b,e),j=function(b,d,e,h,j){var k=this;k.$$scope=b;var l=f?b.$parent:b,m=[];if(i.length)for(var n=0;n<i.length;n++)c(k,i[n],l,e,h,j,m);a.apply(k,Array.prototype.slice.call(arguments,g.length,arguments.length)),k.initializeComponent&&k.initializeComponent.call(k);var o=function(){if(m.length)for(var a=0;a<m.length;a++)m[a]();angular.isDefined(k.destroyComponent)&&k.destroyComponent(),m=null,k.$$scope=null};if(f?b.$on("$destroy",function(){return o()}):d.on("$destroy",function(){return o()}),f&&e.hasOwnProperty("#bindTo")){var p=h(e["#bindTo"]);p.assign(l,k),e.hasOwnProperty("#onBound")&&l.$eval(e["#onBound"]),b.$on("$destroy",function(){p.assign(l,void 0)})}return k};return j.prototype=a.prototype,j.$inject=h,j}function c(b,c,d,f,g,h,i){var j,k=c.name,l=c.ctrlName||k,m=function(a){return a!==j&&e(b,l,a),j=a};switch(c.type){case"text":if(!f.hasOwnProperty(k))break;b[l]=j=h(f[k])(d);var n=f.$observe(k,m);i.push(n);break;case"expr":case"event":var o;if(f.hasOwnProperty(k)){var p=null;o=function(a){return p||(p=g(f[k])),p!==angular.noop?p(d,a):void 0}}else o=angular.noop;b[l]=c.$$eventEmitter?new a.EventEmitter(o):o;break;default:if(!f.hasOwnProperty(k))break;b[l]=j=d.$eval(f[k]);var q=d.$watch(g(f[k],m),null);i.push(q)}}function d(a,b){if(!a.length)return a;for(var c=[],d=0;d<a.length;d++)c.push({name:b.camelCaseTagName(a[d].name),ctrlName:a[d].ctrlName,type:a[d].type,$$eventEmitter:a[d].$$eventEmitter});return c}function e(a,b,c){if(c!==a[b]){var d=a[b];a[b]=c;var e=b+"_change";a[e]&&a[e].call(a,c,d)}}a.JasperDirectiveWrapperFactory=b}(b=a.core||(a.core={}))}(jasper||(jasper={})),angular.module("jasperCore",["ng"]).provider("jasperComponent",jasper.core.ComponentProvider).provider("jasperDecorator",jasper.core.DecoratorComponentProvider).provider("jasperService",jasper.core.ServiceProvider).provider("jasperFilter",jasper.core.FilterProvider).provider("jasperValue",jasper.core.ValueProvider).provider("jasperConstant",jasper.core.ConstantProvider).service("$globalEvents",jasper.core.GlobalEventsService);var jasper;!function(a){var b;!function(a){var b=function(){function a(a,b){var c="ng-hide jasper-area-loading",d={priority:1e3,terminal:!0,restrict:"A",compile:function(d){return d.addClass(c),d.removeAttr("data-jasper-module").removeAttr("jasper-area"),{pre:function(d,e,f){var g=f.jasperArea;g.indexOf(",")>0&&(g=g.split(",")),b.loadAreas(g).then(function(){e.removeClass(c),a(e)(d)})}}}};return d}return a.$inject=["$compile","jasperAreasService"],a}();a.JasperAreaDirective=b}(b=a.areas||(a.areas={}))}(jasper||(jasper={}));var jasper;!function(a){var b;!function(a){var b=function(){function a(a){this.name=a,this.defers=[]}return a}(),c=function(){function a(a){this.q=a,this.loadingAreas=[],this.initAreas=[]}return a.prototype.isLoading=function(a){return null!=this.getLoadingAreaByName(a)},a.prototype.startLoading=function(a){if(this.isLoading(a))throw a+" allready loading";var c=new b(a);this.loadingAreas.push(c)},a.prototype.addInitializer=function(a){if(!this.isLoading(a))throw a+" does not loading";var c=this.q.defer(),d=this.getInitDefersByName(a);if(d)d.defers.push(c);else{var e=new b(a);e.defers.push(c),this.initAreas.push(e)}return c.promise},a.prototype.onAreaLoaded=function(a){var b=this.getLoadingAreaByName(a);if(null==b)throw a+" not loading";var c=this.q.defer();return b.defers.push(c),c.promise},a.prototype.notifyOnLoaded=function(a){var b=this.getLoadingAreaByName(a);if(null==b)throw a+" not loading";this.resolveInitializers(a);for(var c=0;c<b.defers.length;c++)b.defers[c].resolve();var d=this.loadingAreas.indexOf(b);d>-1&&this.loadingAreas.splice(d,1)},a.prototype.resolveInitializers=function(a){var b=this.getInitDefersByName(a);b&&b.defers.length&&(b.defers.forEach(function(a){a.resolve()}),b.defers=[])},a.prototype.getLoadingAreaByName=function(a){return this.filterDefersByName(a,this.loadingAreas)},a.prototype.getInitDefersByName=function(a){return this.filterDefersByName(a,this.initAreas)},a.prototype.filterDefersByName=function(a,b){for(var c=0;c<b.length;c++)if(b[c].name===a)return b[c];return null},a}(),d=function(){function b(b,d){this.rootScope=d,this.loadedAreas=[],this.resourceManager=new a.JasperResourcesManager,this.q=b,this.loadiingAreas=new c(this.q)}return b.prototype.configure=function(a){this.config=a},b.prototype.onAreaLoaded=function(a){return this.isAreaLoaded(a)?this.q.when(!0):this.loadAreas(a)},b.prototype.initArea=function(a,b){if(!this.config)return b();var c=this.ensureArea(a);return c.scripts&&c.scripts.length?this.loadiingAreas.addInitializer(a).then(function(){return b()}):b()},b.prototype.loadAreas=function(a,c){var d=this;if(void 0===c&&(c=0),!this.config)throw"Areas not configured";if(angular.isArray(a)){var e=[];return a.forEach(function(a){e.push(d.loadAreas(a))}),this.q.all(e)}var f=this.config[a];if(!f)throw"Config with name '"+a+"' not found";if(c++,c>b.maxDependencyHops)throw"Possible cyclic dependencies found on module: "+a;for(var g=[],h=0;h<f.dependencies.length;h++){var i=f.dependencies[h];g.push(this.loadAreas(i,c))}var j=this.q.defer(),k=function(){d.isAreaLoaded(a)?j.resolve():d.loadiingAreas.isLoading(a)?d.loadiingAreas.onAreaLoaded(a).then(function(){return j.resolve()}):(d.rootScope.$broadcast("jasperAreaLoading",a),d.loadiingAreas.startLoading(a),d.resourceManager.makeAccessible(d.prepareUrls(f.scripts),d.prepareUrls(f.styles),function(){d.rootScope.$broadcast("jasperAreaLoaded",a),d.loadiingAreas.notifyOnLoaded(a),d.loadedAreas.push(a),j.resolve()}))};return g.length?this.q.all(g).then(k):k(),j.promise},b.prototype.ensureArea=function(a){if(!this.config)throw"Areas not configured";var b=this.config[a];if(!b)throw"Area with name '"+a+"' not found";return b},b.prototype.isAreaLoaded=function(a){return this.loadedAreas.indexOf(a)>=0},b.prototype.prepareUrls=function(a){if(!a)return[];for(var b=[],c=0;c<a.length;c++)b.push("/"==a[c].charAt(0)?a[c]:(this.config._rootPath||"")+a[c]);return b},b.$inject=["$q","$rootScope"],b.maxDependencyHops=10,b}();a.JasperAreasService=d}(b=a.areas||(a.areas={}))}(jasper||(jasper={}));var jasper;!function(a){var b;!function(a){var b=function(){function a(){}return a.prototype.buildScripts=function(b){if(!b||0===b.length)return[];for(var c=[],d=0;d<b.length;d++)this.inArray(a.loadedScriptPaths,b[d])||(a.loadedScriptPaths.push(b[d]),c.push(b[d]));return c},a.prototype.inArray=function(a,b){for(var c=0;c<a.length;c++)if(a[c]===b)return!0;return!1},a.prototype.makeAccessible=function(a,b,c){var d=this.buildScripts(a);d.length>0?$script(d,function(){return c()}):c()},a.loadedScriptPaths=[],a}();a.JasperResourcesManager=b}(b=a.areas||(a.areas={}))}(jasper||(jasper={})),angular.module("jasperAreas",["jasperCore"]).service("jasperAreasService",jasper.areas.JasperAreasService).directive("jasperArea",jasper.areas.JasperAreaDirective);var jasper;!function(a){var b;!function(a){var b=function(){function a(a){this.routeProvider=a}return a.prototype.setup=function(a){var b=this;angular.forEach(a.routes,function(a,c){var d={template:a.template};a.template&&(d.template=a.template),a.templateUrl&&(d.template="<div ng-include=\"'"+a.templateUrl+"'\"></div>"),d.caseInsensitiveMatch=!0,angular.isDefined(a.reloadOnSearch)?d.reloadOnSearch=a.reloadOnSearch:d.reloadOnSearch=!1,a.redirectTo&&(d.redirectTo=a.redirectTo),a.area&&(d.resolve={_m:["jasperAreasService",function(b){return b.loadAreas(a.area)}]}),d.prerender=a.prerender,d.name=a.name,b.routeProvider.when(c,d)}),a.defaultRoutePath&&this.routeProvider.otherwise({redirectTo:a.defaultRoutePath})},a.prototype.$get=function(){return this},a.$inject=["$routeProvider"],a}();a.JasperRouteTableProvider=b}(b=a.routing||(a.routing={}))}(jasper||(jasper={})),angular.module("jasperRoutes",["jasperAreas"]).provider("jasperRoute",jasper.routing.JasperRouteTableProvider);var jasper;!function(a){var b=function(){function a(){this.readyQueue=[]}return a.prototype.component=function(a){this.componentProvider.register(a)},a.prototype.decorator=function(a){this.decoratorProvider.register(a)},a.prototype.filter=function(a){this.filtersProvider.register(a)},a.prototype.service=function(a){this.serviceProvider.register(a)},a.prototype.template=function(a,b){this.templateCahce.put(a,b)},a.prototype.value=function(a,b){this.valueProvider.register(a,b)},a.prototype.init=function(a,b,c,d,e,f){this.componentProvider=a,this.decoratorProvider=b,this.serviceProvider=c,this.valueProvider=e,this.filtersProvider=d,this.directive=f},a.prototype.setup=function(a,b){this.areas=b,this.templateCahce=a,this.ready()},a.prototype.ready=function(a){return a?void(this.isReady?a():this.readyQueue.push(a)):(this.readyQueue.forEach(function(a){a()}),this.readyQueue=[],void(this.isReady=!0))},a}();a.JasperStatic=b,window.jsp=new b}(jasper||(jasper={}));var jasper;!function(a){angular.module("jasper",["ng","ngRoute","jasperCore","jasperAreas","jasperRoutes"]).config(["jasperComponentProvider","jasperDecoratorProvider","jasperServiceProvider","jasperFilterProvider","jasperValueProvider","$compileProvider",function(a,b,c,d,e,f){window.jsp.init(a,b,c,d,e,f.directive)}]).run(["jasperAreasService","$templateCache",function(a,b){window.jsp.setup(b,a)}])}(jasper||(jasper={})),window.jasper=jasper;