From 9541b29ebfde37fdc32d5daf87c28be7b1b48d63 Mon Sep 17 00:00:00 2001 From: Steve Ipatov Date: Tue, 22 Sep 2015 01:34:08 +0300 Subject: [PATCH 01/10] some minor bugs fixed --- lingvodoc/__init__.py | 2 +- lingvodoc/static/js/create-dictionary.js | 2 +- lingvodoc/static/js/edit-dictionary.js | 2 +- lingvodoc/static/js/home.js | 2 +- lingvodoc/static/js/lingvodoc.js | 2 +- lingvodoc/static/js/user-upload.js | 2 +- lingvodoc/templates/create_dictionary.pt | 6 +- lingvodoc/templates/home.pt | 35 +++++- lingvodoc/views.py | 6 +- webui/Gruntfile.js | 4 +- webui/src/js/create_dictionary.js | 16 +-- webui/src/js/edit_dictionary.js | 23 +++- webui/src/js/home.js | 138 +++++++++++++++++++++++ webui/src/js/user_upload.js | 3 + webui/src/sass/lingvodoc.scss | 2 + webui/src/templates/create_dictionary.pt | 6 +- webui/src/templates/home.pt | 35 +++++- 17 files changed, 251 insertions(+), 35 deletions(-) diff --git a/lingvodoc/__init__.py b/lingvodoc/__init__.py index 93cae709b..c04807573 100755 --- a/lingvodoc/__init__.py +++ b/lingvodoc/__init__.py @@ -88,7 +88,7 @@ def configure_routes(config): config.add_route('users', '/users') # web-view - config.add_route(name='new_dictionary', pattern='/dashboard/create_dictionary') + config.add_route(name='new_dictionary', pattern='/create_dictionary') # web-view config.add_route(name='edit_dictionary_properties', pattern='/dictionary/{client_id}/{object_id}/edit') diff --git a/lingvodoc/static/js/create-dictionary.js b/lingvodoc/static/js/create-dictionary.js index ed6bd5164..1f4406255 100644 --- a/lingvodoc/static/js/create-dictionary.js +++ b/lingvodoc/static/js/create-dictionary.js @@ -23,4 +23,4 @@ self.dropdownMenu.replaceWith(newEl);self.dropdownMenu=newEl}dropdownService.clo }this.source=pattern;function matchDetails(m,isSearch){var id,regexp,segment,type,cfg,arrayMode;id=m[2]||m[3];cfg=config.params[id];segment=pattern.substring(last,m.index);regexp=isSearch?m[4]:m[4]||(m[1]=="*"?".*":null);type=$$UMFP.type(regexp||"string")||inherit($$UMFP.type("string"),{pattern:new RegExp(regexp,config.caseInsensitive?"i":undefined)});return{id:id,regexp:regexp,segment:segment,type:type,cfg:cfg}}var p,param,segment;while(m=placeholder.exec(pattern)){p=matchDetails(m,false);if(p.segment.indexOf("?")>=0)break;param=addParameter(p.id,p.type,p.cfg,"path");compiled+=quoteRegExp(p.segment,param.type.pattern.source,param.squash,param.isOptional);segments.push(p.segment);last=placeholder.lastIndex}segment=pattern.substring(last);var i=segment.indexOf("?");if(i>=0){var search=this.sourceSearch=segment.substring(i);segment=segment.substring(0,i);this.sourcePath=pattern.substring(0,last+i);if(search.length>0){last=0;while(m=searchPlaceholder.exec(search)){p=matchDetails(m,true);param=addParameter(p.id,p.type,p.cfg,"search");last=placeholder.lastIndex}}}else{this.sourcePath=pattern;this.sourceSearch=""}compiled+=quoteRegExp(segment)+(config.strict===false?"/?":"")+"$";segments.push(segment);this.regexp=new RegExp(compiled,config.caseInsensitive?"i":undefined);this.prefix=segments[0];this.$$paramNames=paramNames}UrlMatcher.prototype.concat=function(pattern,config){var defaultConfig={caseInsensitive:$$UMFP.caseInsensitive(),strict:$$UMFP.strictMode(),squash:$$UMFP.defaultSquashPolicy()};return new UrlMatcher(this.sourcePath+pattern+this.sourceSearch,extend(defaultConfig,config),this)};UrlMatcher.prototype.toString=function(){return this.source};UrlMatcher.prototype.exec=function(path,searchParams){var m=this.regexp.exec(path);if(!m)return null;searchParams=searchParams||{};var paramNames=this.parameters(),nTotal=paramNames.length,nPath=this.segments.length-1,values={},i,j,cfg,paramName;if(nPath!==m.length-1)throw new Error("Unbalanced capture group in route '"+this.source+"'");function decodePathArray(string){function reverseString(str){return str.split("").reverse().join("")}function unquoteDashes(str){return str.replace(/\\-/g,"-")}var split=reverseString(string).split(/-(?!\\)/);var allReversed=map(split,reverseString);return map(allReversed,unquoteDashes).reverse()}for(i=0;i=0)throw new Error("State must have a valid name");if(states.hasOwnProperty(name))throw new Error("State '"+name+"'' is already defined");var parentName=name.indexOf(".")!==-1?name.substring(0,name.lastIndexOf(".")):isString(state.parent)?state.parent:isObject(state.parent)&&isString(state.parent.name)?state.parent.name:"";if(parentName&&!states[parentName]){return queueState(parentName,state.self)}for(var key in stateBuilder){if(isFunction(stateBuilder[key]))state[key]=stateBuilder[key](state,stateBuilder.$delegates[key])}states[name]=state;if(!state[abstractKey]&&state.url){$urlRouterProvider.when(state.url,["$match","$stateParams",function($match,$stateParams){if($state.$current.navigable!=state||!equalForKeys($match,$stateParams)){$state.transitionTo(state,$match,{inherit:true,location:false})}}])}flushQueuedChildren(name);return state}function isGlob(text){return text.indexOf("*")>-1}function doesStateMatchGlob(glob){var globSegments=glob.split("."),segments=$state.$current.name.split(".");for(var i=0,l=globSegments.length;i=keep;l--){exiting=fromPath[l];if(exiting.self.onExit){$injector.invoke(exiting.self.onExit,exiting.self,exiting.locals.globals)}exiting.locals=null}for(l=keep;l=0?name:name+"@"+(inherited?inherited.state.name:"")}angular.module("ui.router.state").directive("uiView",$ViewDirective);angular.module("ui.router.state").directive("uiView",$ViewDirectiveFill);function parseStateRef(ref,current){var preparsed=ref.match(/^\s*({[^}]*})\s*$/),parsed;if(preparsed)ref=current+"("+preparsed[1]+")";parsed=ref.replace(/\n/g," ").match(/^([^(]+?)\s*(\((.*)\))?$/);if(!parsed||parsed.length!==4)throw new Error("Invalid state ref '"+ref+"'");return{state:parsed[1],paramExpr:parsed[3]||null}}function stateContext(el){var stateData=el.parent().inheritedData("$uiView");if(stateData&&stateData.state&&stateData.state.name){return stateData.state}}$StateRefDirective.$inject=["$state","$timeout"];function $StateRefDirective($state,$timeout){var allowedOptions=["location","inherit","reload","absolute"];return{restrict:"A",require:["?^uiSrefActive","?^uiSrefActiveEq"],link:function(scope,element,attrs,uiSrefActive){var ref=parseStateRef(attrs.uiSref,$state.current.name);var params=null,url=null,base=stateContext(element)||$state.$current;var hrefKind=Object.prototype.toString.call(element.prop("href"))==="[object SVGAnimatedString]"?"xlink:href":"href";var newHref=null,isAnchor=element.prop("tagName").toUpperCase()==="A";var isForm=element[0].nodeName==="FORM";var attr=isForm?"action":hrefKind,nav=true;var options={relative:base,inherit:true};var optionsOverride=scope.$eval(attrs.uiSrefOpts)||{};angular.forEach(allowedOptions,function(option){if(option in optionsOverride){options[option]=optionsOverride[option]}});var update=function(newVal){if(newVal)params=angular.copy(newVal);if(!nav)return;newHref=$state.href(ref.state,params,options);var activeDirective=uiSrefActive[1]||uiSrefActive[0];if(activeDirective){activeDirective.$$addStateInfo(ref.state,params)}if(newHref===null){nav=false;return false}attrs.$set(attr,newHref)};if(ref.paramExpr){scope.$watch(ref.paramExpr,function(newVal,oldVal){if(newVal!==params)update(newVal)},true);params=angular.copy(scope.$eval(ref.paramExpr))}update();if(isForm)return;element.bind("click",function(e){var button=e.which||e.button;if(!(button>1||e.ctrlKey||e.metaKey||e.shiftKey||element.attr("target"))){var transition=$timeout(function(){$state.go(ref.state,params,options)});e.preventDefault();var ignorePreventDefaultCount=isAnchor&&!newHref?1:0;e.preventDefault=function(){if(ignorePreventDefaultCount--<=0)$timeout.cancel(transition)}}})}}}$StateRefActiveDirective.$inject=["$state","$stateParams","$interpolate"];function $StateRefActiveDirective($state,$stateParams,$interpolate){return{restrict:"A",controller:["$scope","$element","$attrs",function($scope,$element,$attrs){var states=[],activeClass;activeClass=$interpolate($attrs.uiSrefActiveEq||$attrs.uiSrefActive||"",false)($scope);this.$$addStateInfo=function(newState,newParams){var state=$state.get(newState,stateContext($element));states.push({state:state||{name:newState},params:newParams});update()};$scope.$on("$stateChangeSuccess",update);function update(){if(anyMatch()){$element.addClass(activeClass)}else{$element.removeClass(activeClass)}}function anyMatch(){for(var i=0;i0){className+=i>0?" ":"";className+=isPrefix?fix+klass:klass+fix}});return className}function removeFromArray(arr,val){var index=arr.indexOf(val);if(val>=0){arr.splice(index,1)}}function stripCommentsFromElement(element){if(element instanceof jqLite){switch(element.length){case 0:return[];break;case 1:if(element[0].nodeType===ELEMENT_NODE){return element}break;default:return jqLite(extractElementNode(element));break}}if(element.nodeType===ELEMENT_NODE){return jqLite(element)}}function extractElementNode(element){if(!element[0])return element;for(var i=0;i=0){val=parseMaxTime(val)}if(val===0){val=null}styles[actualStyleName]=val}});return styles}function parseMaxTime(str){var maxValue=0;var values=str.split(/\s*,\s*/);forEach(values,function(value){if(value.charAt(value.length-1)=="s"){value=value.substring(0,value.length-1)}value=parseFloat(value)||0;maxValue=maxValue?Math.max(value,maxValue):value});return maxValue}function truthyTimingValue(val){return val===0||val!=null}function getCssTransitionDurationStyle(duration,applyOnlyDuration){var style=TRANSITION_PROP;var value=duration+"s";if(applyOnlyDuration){style+=DURATION_KEY}else{value+=" linear all"}return[style,value]}function createLocalCacheLookup(){var cache=Object.create(null);return{flush:function(){cache=Object.create(null)},count:function(key){var entry=cache[key];return entry?entry.total:0},get:function(key){var entry=cache[key];return entry&&entry.value},put:function(key,value){if(!cache[key]){cache[key]={total:1,value:value}}else{cache[key].total++}}}}var $AnimateCssProvider=["$animateProvider",function($animateProvider){var gcsLookup=createLocalCacheLookup();var gcsStaggerLookup=createLocalCacheLookup();this.$get=["$window","$$jqLite","$$AnimateRunner","$timeout","$$forceReflow","$sniffer","$$rAFScheduler","$animate",function($window,$$jqLite,$$AnimateRunner,$timeout,$$forceReflow,$sniffer,$$rAFScheduler,$animate){var applyAnimationClasses=applyAnimationClassesFactory($$jqLite);var parentCounter=0;function gcsHashFn(node,extraClasses){var KEY="$$ngAnimateParentKey";var parentNode=node.parentNode;var parentID=parentNode[KEY]||(parentNode[KEY]=++parentCounter);return parentID+"-"+node.getAttribute("class")+"-"+extraClasses}function computeCachedCssStyles(node,className,cacheKey,properties){var timings=gcsLookup.get(cacheKey);if(!timings){timings=computeCssStyles($window,node,properties);if(timings.animationIterationCount==="infinite"){timings.animationIterationCount=1}}gcsLookup.put(cacheKey,timings);return timings}function computeCachedCssStaggerStyles(node,className,cacheKey,properties){var stagger;if(gcsLookup.count(cacheKey)>0){stagger=gcsStaggerLookup.get(cacheKey);if(!stagger){var staggerClassName=pendClasses(className,"-stagger");$$jqLite.addClass(node,staggerClassName);stagger=computeCssStyles($window,node,properties);stagger.animationDuration=Math.max(stagger.animationDuration,0);stagger.transitionDuration=Math.max(stagger.transitionDuration,0);$$jqLite.removeClass(node,staggerClassName);gcsStaggerLookup.put(cacheKey,stagger)}}return stagger||{}}var cancelLastRAFRequest;var rafWaitQueue=[];function waitUntilQuiet(callback){rafWaitQueue.push(callback);$$rAFScheduler.waitUntilQuiet(function(){gcsLookup.flush();gcsStaggerLookup.flush();var pageWidth=$$forceReflow();for(var i=0;i0;var containsKeyframeAnimation=(options.keyframeStyle||"").length>0;if(!containsKeyframeAnimation&&!hasToStyles&&!preparationClasses){return closeAndReturnNoopAnimator()}var cacheKey,stagger;if(options.stagger>0){var staggerVal=parseFloat(options.stagger);stagger={transitionDelay:staggerVal,animationDelay:staggerVal,transitionDuration:0,animationDuration:0}}else{cacheKey=gcsHashFn(node,fullClassName);stagger=computeCachedCssStaggerStyles(node,preparationClasses,cacheKey,DETECT_STAGGER_CSS_PROPERTIES)}if(!options.$$skipPreparationClasses){$$jqLite.addClass(element,preparationClasses)}var applyOnlyDuration;if(options.transitionStyle){var transitionStyle=[TRANSITION_PROP,options.transitionStyle];applyInlineStyle(node,transitionStyle);temporaryStyles.push(transitionStyle)}if(options.duration>=0){applyOnlyDuration=node.style[TRANSITION_PROP].length>0;var durationStyle=getCssTransitionDurationStyle(options.duration,applyOnlyDuration);applyInlineStyle(node,durationStyle);temporaryStyles.push(durationStyle)}if(options.keyframeStyle){var keyframeStyle=[ANIMATION_PROP,options.keyframeStyle];applyInlineStyle(node,keyframeStyle);temporaryStyles.push(keyframeStyle)}var itemIndex=stagger?options.staggerIndex>=0?options.staggerIndex:gcsLookup.count(cacheKey):0;var isFirst=itemIndex===0;if(isFirst&&!options.skipBlocking){blockTransitions(node,SAFE_FAST_FORWARD_DURATION_VALUE)}var timings=computeTimings(node,fullClassName,cacheKey);var relativeDelay=timings.maxDelay;maxDelay=Math.max(relativeDelay,0);maxDuration=timings.maxDuration;var flags={};flags.hasTransitions=timings.transitionDuration>0;flags.hasAnimations=timings.animationDuration>0;flags.hasTransitionAll=flags.hasTransitions&&timings.transitionProperty=="all";flags.applyTransitionDuration=hasToStyles&&(flags.hasTransitions&&!flags.hasTransitionAll||flags.hasAnimations&&!flags.hasTransitions);flags.applyAnimationDuration=options.duration&&flags.hasAnimations;flags.applyTransitionDelay=truthyTimingValue(options.delay)&&(flags.applyTransitionDuration||flags.hasTransitions);flags.applyAnimationDelay=truthyTimingValue(options.delay)&&flags.hasAnimations;flags.recalculateTimingStyles=addRemoveClassName.length>0;if(flags.applyTransitionDuration||flags.applyAnimationDuration){maxDuration=options.duration?parseFloat(options.duration):maxDuration;if(flags.applyTransitionDuration){flags.hasTransitions=true;timings.transitionDuration=maxDuration;applyOnlyDuration=node.style[TRANSITION_PROP+PROPERTY_KEY].length>0;temporaryStyles.push(getCssTransitionDurationStyle(maxDuration,applyOnlyDuration))}if(flags.applyAnimationDuration){flags.hasAnimations=true;timings.animationDuration=maxDuration;temporaryStyles.push(getCssKeyframeDurationStyle(maxDuration))}}if(maxDuration===0&&!flags.recalculateTimingStyles){return closeAndReturnNoopAnimator()}if(options.delay!=null){var delayStyle=parseFloat(options.delay);if(flags.applyTransitionDelay){temporaryStyles.push(getCssDelayStyle(delayStyle))}if(flags.applyAnimationDelay){temporaryStyles.push(getCssDelayStyle(delayStyle,true))}}if(options.duration==null&&timings.transitionDuration>0){flags.recalculateTimingStyles=flags.recalculateTimingStyles||isFirst}maxDelayTime=maxDelay*ONE_SECOND;maxDurationTime=maxDuration*ONE_SECOND;if(!options.skipBlocking){flags.blockTransition=timings.transitionDuration>0;flags.blockKeyframeAnimation=timings.animationDuration>0&&stagger.animationDelay>0&&stagger.animationDuration===0}applyAnimationFromStyles(element,options);if(flags.blockTransition||flags.blockKeyframeAnimation){applyBlocking(maxDuration)}else if(!options.skipBlocking){blockTransitions(node,false)}return{$$willAnimate:true,end:endFn,start:function(){if(animationClosed)return;runnerHost={end:endFn,cancel:cancelFn,resume:null,pause:null};runner=new $$AnimateRunner(runnerHost);waitUntilQuiet(start);return runner}};function endFn(){close()}function cancelFn(){close(true)}function close(rejected){if(animationClosed||animationCompleted&&animationPaused)return;animationClosed=true;animationPaused=false;if(!options.$$skipPreparationClasses){$$jqLite.removeClass(element,preparationClasses)}$$jqLite.removeClass(element,activeClasses);blockKeyframeAnimations(node,false);blockTransitions(node,false);forEach(temporaryStyles,function(entry){node.style[entry[0]]=""});applyAnimationClasses(element,options);applyAnimationStyles(element,options);if(options.onDone){options.onDone()}if(runner){runner.complete(!rejected)}}function applyBlocking(duration){if(flags.blockTransition){blockTransitions(node,duration)}if(flags.blockKeyframeAnimation){blockKeyframeAnimations(node,!!duration)}}function closeAndReturnNoopAnimator(){runner=new $$AnimateRunner({end:endFn,cancel:cancelFn});waitUntilQuiet(noop);close();return{$$willAnimate:false,start:function(){return runner},end:endFn}}function start(){if(animationClosed)return;if(!node.parentNode){close();return}var startTime,events=[];var playPause=function(playAnimation){if(!animationCompleted){animationPaused=!playAnimation;if(timings.animationDuration){var value=blockKeyframeAnimations(node,animationPaused);animationPaused?temporaryStyles.push(value):removeFromArray(temporaryStyles,value)}}else if(animationPaused&&playAnimation){animationPaused=false;close()}};var maxStagger=itemIndex>0&&(timings.transitionDuration&&stagger.transitionDuration===0||timings.animationDuration&&stagger.animationDuration===0)&&Math.max(stagger.animationDelay,stagger.transitionDelay);if(maxStagger){$timeout(triggerAnimationStart,Math.floor(maxStagger*itemIndex*ONE_SECOND),false)}else{triggerAnimationStart()}runnerHost.resume=function(){playPause(true)};runnerHost.pause=function(){playPause(false)};function triggerAnimationStart(){if(animationClosed)return;applyBlocking(false);forEach(temporaryStyles,function(entry){var key=entry[0];var value=entry[1];node.style[key]=value});applyAnimationClasses(element,options);$$jqLite.addClass(element,activeClasses);if(flags.recalculateTimingStyles){fullClassName=node.className+" "+preparationClasses;cacheKey=gcsHashFn(node,fullClassName);timings=computeTimings(node,fullClassName,cacheKey);relativeDelay=timings.maxDelay;maxDelay=Math.max(relativeDelay,0);maxDuration=timings.maxDuration;if(maxDuration===0){close();return}flags.hasTransitions=timings.transitionDuration>0;flags.hasAnimations=timings.animationDuration>0}if(flags.applyAnimationDelay){relativeDelay=typeof options.delay!=="boolean"&&truthyTimingValue(options.delay)?parseFloat(options.delay):relativeDelay;maxDelay=Math.max(relativeDelay,0);timings.animationDelay=relativeDelay;delayStyle=getCssDelayStyle(relativeDelay,true);temporaryStyles.push(delayStyle);node.style[delayStyle[0]]=delayStyle[1]}maxDelayTime=maxDelay*ONE_SECOND;maxDurationTime=maxDuration*ONE_SECOND;if(options.easing){var easeProp,easeVal=options.easing;if(flags.hasTransitions){easeProp=TRANSITION_PROP+TIMING_KEY;temporaryStyles.push([easeProp,easeVal]);node.style[easeProp]=easeVal}if(flags.hasAnimations){easeProp=ANIMATION_PROP+TIMING_KEY;temporaryStyles.push([easeProp,easeVal]);node.style[easeProp]=easeVal}}if(timings.transitionDuration){events.push(TRANSITIONEND_EVENT)}if(timings.animationDuration){events.push(ANIMATIONEND_EVENT)}startTime=Date.now();var timerTime=maxDelayTime+CLOSING_TIME_BUFFER*maxDurationTime;var endTime=startTime+timerTime;var animationsData=element.data(ANIMATE_TIMER_KEY)||[];var setupFallbackTimer=true;if(animationsData.length){var currentTimerData=animationsData[0];setupFallbackTimer=endTime>currentTimerData.expectedEndTime;if(setupFallbackTimer){$timeout.cancel(currentTimerData.timer)}else{animationsData.push(close)}}if(setupFallbackTimer){var timer=$timeout(onAnimationExpired,timerTime,false);animationsData[0]={timer:timer,expectedEndTime:endTime};animationsData.push(close);element.data(ANIMATE_TIMER_KEY,animationsData)}element.on(events.join(" "),onAnimationProgress);applyAnimationToStyles(element,options)}function onAnimationExpired(){var animationsData=element.data(ANIMATE_TIMER_KEY);if(animationsData){for(var i=1;i=maxDelayTime&&elapsedTime>=maxDuration){animationCompleted=true;close()}}}}}]}];var $$AnimateCssDriverProvider=["$$animationProvider",function($$animationProvider){ $$animationProvider.drivers.push("$$animateCssDriver");var NG_ANIMATE_SHIM_CLASS_NAME="ng-animate-shim";var NG_ANIMATE_ANCHOR_CLASS_NAME="ng-anchor";var NG_OUT_ANCHOR_CLASS_NAME="ng-anchor-out";var NG_IN_ANCHOR_CLASS_NAME="ng-anchor-in";this.$get=["$animateCss","$rootScope","$$AnimateRunner","$rootElement","$$body","$sniffer","$$jqLite",function($animateCss,$rootScope,$$AnimateRunner,$rootElement,$$body,$sniffer,$$jqLite){if(!$sniffer.animations&&!$sniffer.transitions)return noop;var bodyNode=getDomNode($$body);var rootNode=getDomNode($rootElement);var rootBodyElement=jqLite(bodyNode.parentNode===rootNode?bodyNode:rootNode);var applyAnimationClasses=applyAnimationClassesFactory($$jqLite);return function initDriverFn(animationDetails){return animationDetails.from&&animationDetails.to?prepareFromToAnchorAnimation(animationDetails.from,animationDetails.to,animationDetails.classes,animationDetails.anchors):prepareRegularAnimation(animationDetails)};function filterCssClasses(classes){return classes.replace(/\bng-\S+\b/g,"")}function getUniqueValues(a,b){if(isString(a))a=a.split(" ");if(isString(b))b=b.split(" ");return a.filter(function(val){return b.indexOf(val)===-1}).join(" ")}function prepareAnchoredAnimation(classes,outAnchor,inAnchor){var clone=jqLite(getDomNode(outAnchor).cloneNode(true));var startingClasses=filterCssClasses(getClassVal(clone));outAnchor.addClass(NG_ANIMATE_SHIM_CLASS_NAME);inAnchor.addClass(NG_ANIMATE_SHIM_CLASS_NAME);clone.addClass(NG_ANIMATE_ANCHOR_CLASS_NAME);rootBodyElement.append(clone);var animatorIn,animatorOut=prepareOutAnimation();if(!animatorOut){animatorIn=prepareInAnimation();if(!animatorIn){return end()}}var startingAnimator=animatorOut||animatorIn;return{start:function(){var runner;var currentAnimation=startingAnimator.start();currentAnimation.done(function(){currentAnimation=null;if(!animatorIn){animatorIn=prepareInAnimation();if(animatorIn){currentAnimation=animatorIn.start();currentAnimation.done(function(){currentAnimation=null;end();runner.complete()});return currentAnimation}}end();runner.complete()});runner=new $$AnimateRunner({end:endFn,cancel:endFn});return runner;function endFn(){if(currentAnimation){currentAnimation.end()}}}};function calculateAnchorStyles(anchor){var styles={};var coords=getDomNode(anchor).getBoundingClientRect();forEach(["width","height","top","left"],function(key){var value=coords[key];switch(key){case"top":value+=bodyNode.scrollTop;break;case"left":value+=bodyNode.scrollLeft;break}styles[key]=Math.floor(value)+"px"});return styles}function prepareOutAnimation(){var animator=$animateCss(clone,{addClass:NG_OUT_ANCHOR_CLASS_NAME,delay:true,from:calculateAnchorStyles(outAnchor)});return animator.$$willAnimate?animator:null}function getClassVal(element){return element.attr("class")||""}function prepareInAnimation(){var endingClasses=filterCssClasses(getClassVal(inAnchor));var toAdd=getUniqueValues(endingClasses,startingClasses);var toRemove=getUniqueValues(startingClasses,endingClasses);var animator=$animateCss(clone,{to:calculateAnchorStyles(inAnchor),addClass:NG_IN_ANCHOR_CLASS_NAME+" "+toAdd,removeClass:NG_OUT_ANCHOR_CLASS_NAME+" "+toRemove,delay:true});return animator.$$willAnimate?animator:null}function end(){clone.remove();outAnchor.removeClass(NG_ANIMATE_SHIM_CLASS_NAME);inAnchor.removeClass(NG_ANIMATE_SHIM_CLASS_NAME)}}function prepareFromToAnchorAnimation(from,to,classes,anchors){var fromAnimation=prepareRegularAnimation(from,noop);var toAnimation=prepareRegularAnimation(to,noop);var anchorAnimations=[];forEach(anchors,function(anchor){var outElement=anchor["out"];var inElement=anchor["in"];var animator=prepareAnchoredAnimation(classes,outElement,inElement);if(animator){anchorAnimations.push(animator)}});if(!fromAnimation&&!toAnimation&&anchorAnimations.length===0)return;return{start:function(){var animationRunners=[];if(fromAnimation){animationRunners.push(fromAnimation.start())}if(toAnimation){animationRunners.push(toAnimation.start())}forEach(anchorAnimations,function(animation){animationRunners.push(animation.start())});var runner=new $$AnimateRunner({end:endFn,cancel:endFn});$$AnimateRunner.all(animationRunners,function(status){runner.complete(status)});return runner;function endFn(){forEach(animationRunners,function(runner){runner.end()})}}}}function prepareRegularAnimation(animationDetails){var element=animationDetails.element;var options=animationDetails.options||{};if(animationDetails.structural){options.event=animationDetails.event;options.structural=true;options.applyClassesEarly=true;if(animationDetails.event==="leave"){options.onDone=options.domOperation}}if(options.preparationClasses){options.event=concatWithSpace(options.event,options.preparationClasses)}var animator=$animateCss(element,options);return animator.$$willAnimate?animator:null}}]}];var $$AnimateJsProvider=["$animateProvider",function($animateProvider){this.$get=["$injector","$$AnimateRunner","$$jqLite",function($injector,$$AnimateRunner,$$jqLite){var applyAnimationClasses=applyAnimationClassesFactory($$jqLite);return function(element,event,classes,options){if(arguments.length===3&&isObject(classes)){options=classes;classes=null}options=prepareAnimationOptions(options);if(!classes){classes=element.attr("class")||"";if(options.addClass){classes+=" "+options.addClass}if(options.removeClass){classes+=" "+options.removeClass}}var classesToAdd=options.addClass;var classesToRemove=options.removeClass;var animations=lookupAnimations(classes);var before,after;if(animations.length){var afterFn,beforeFn;if(event=="leave"){beforeFn="leave";afterFn="afterLeave"}else{beforeFn="before"+event.charAt(0).toUpperCase()+event.substr(1);afterFn=event}if(event!=="enter"&&event!=="move"){before=packageAnimations(element,event,options,animations,beforeFn)}after=packageAnimations(element,event,options,animations,afterFn)}if(!before&&!after)return;function applyOptions(){options.domOperation();applyAnimationClasses(element,options)}return{start:function(){var closeActiveAnimations;var chain=[];if(before){chain.push(function(fn){closeActiveAnimations=before(fn)})}if(chain.length){chain.push(function(fn){applyOptions();fn(true)})}else{applyOptions()}if(after){chain.push(function(fn){closeActiveAnimations=after(fn)})}var animationClosed=false;var runner=new $$AnimateRunner({end:function(){endAnimations()},cancel:function(){endAnimations(true)}});$$AnimateRunner.chain(chain,onComplete);return runner;function onComplete(success){animationClosed=true;applyOptions();applyAnimationStyles(element,options);runner.complete(success)}function endAnimations(cancelled){if(!animationClosed){(closeActiveAnimations||noop)(cancelled);onComplete(cancelled)}}}};function executeAnimationFn(fn,element,event,options,onDone){var args;switch(event){case"animate":args=[element,options.from,options.to,onDone];break;case"setClass":args=[element,classesToAdd,classesToRemove,onDone];break;case"addClass":args=[element,classesToAdd,onDone];break;case"removeClass":args=[element,classesToRemove,onDone];break;default:args=[element,onDone];break}args.push(options);var value=fn.apply(fn,args);if(value){if(isFunction(value.start)){value=value.start()}if(value instanceof $$AnimateRunner){value.done(onDone)}else if(isFunction(value)){return value}}return noop}function groupEventedAnimations(element,event,options,animations,fnName){var operations=[];forEach(animations,function(ani){var animation=ani[fnName];if(!animation)return;operations.push(function(){var runner;var endProgressCb;var resolved=false;var onAnimationComplete=function(rejected){if(!resolved){resolved=true;(endProgressCb||noop)(rejected);runner.complete(!rejected)}};runner=new $$AnimateRunner({end:function(){onAnimationComplete()},cancel:function(){onAnimationComplete(true)}});endProgressCb=executeAnimationFn(animation,element,event,options,function(result){var cancelled=result===false;onAnimationComplete(cancelled)});return runner})});return operations}function packageAnimations(element,event,options,animations,fnName){var operations=groupEventedAnimations(element,event,options,animations,fnName);if(operations.length===0){var a,b;if(fnName==="beforeSetClass"){a=groupEventedAnimations(element,"removeClass",options,animations,"beforeRemoveClass");b=groupEventedAnimations(element,"addClass",options,animations,"beforeAddClass")}else if(fnName==="setClass"){a=groupEventedAnimations(element,"removeClass",options,animations,"removeClass");b=groupEventedAnimations(element,"addClass",options,animations,"addClass")}if(a){operations=operations.concat(a)}if(b){operations=operations.concat(b)}}if(operations.length===0)return;return function startAnimation(callback){var runners=[];if(operations.length){forEach(operations,function(animateFn){runners.push(animateFn())})}runners.length?$$AnimateRunner.all(runners,callback):callback();return function endFn(reject){forEach(runners,function(runner){reject?runner.cancel():runner.end()})}}}};function lookupAnimations(classes){classes=isArray(classes)?classes:classes.split(" ");var matches=[],flagMap={};for(var i=0;i0;var b=(options.removeClass||"").length>0;return and?a&&b:a||b}rules.join.push(function(element,newAnimation,currentAnimation){return!newAnimation.structural&&hasAnimationClasses(newAnimation.options)});rules.skip.push(function(element,newAnimation,currentAnimation){return!newAnimation.structural&&!hasAnimationClasses(newAnimation.options)});rules.skip.push(function(element,newAnimation,currentAnimation){return currentAnimation.event=="leave"&&newAnimation.structural});rules.skip.push(function(element,newAnimation,currentAnimation){return currentAnimation.structural&¤tAnimation.state===RUNNING_STATE&&!newAnimation.structural});rules.cancel.push(function(element,newAnimation,currentAnimation){return currentAnimation.structural&&newAnimation.structural});rules.cancel.push(function(element,newAnimation,currentAnimation){return currentAnimation.state===RUNNING_STATE&&newAnimation.structural});rules.cancel.push(function(element,newAnimation,currentAnimation){var nO=newAnimation.options;var cO=currentAnimation.options;return nO.addClass&&nO.addClass===cO.removeClass||nO.removeClass&&nO.removeClass===cO.addClass});this.$get=["$$rAF","$rootScope","$rootElement","$document","$$body","$$HashMap","$$animation","$$AnimateRunner","$templateRequest","$$jqLite","$$forceReflow",function($$rAF,$rootScope,$rootElement,$document,$$body,$$HashMap,$$animation,$$AnimateRunner,$templateRequest,$$jqLite,$$forceReflow){var activeAnimationsLookup=new $$HashMap;var disabledElementsLookup=new $$HashMap;var animationsEnabled=null;var deregisterWatch=$rootScope.$watch(function(){return $templateRequest.totalPendingRequests===0},function(isEmpty){if(!isEmpty)return;deregisterWatch();$rootScope.$$postDigest(function(){$rootScope.$$postDigest(function(){if(animationsEnabled===null){animationsEnabled=true}})})});var callbackRegistry={};var classNameFilter=$animateProvider.classNameFilter();var isAnimatableClassName=!classNameFilter?function(){return true}:function(className){return classNameFilter.test(className)};var applyAnimationClasses=applyAnimationClassesFactory($$jqLite);function normalizeAnimationOptions(element,options){return mergeAnimationOptions(element,options,{})}function findCallbacks(element,event){var targetNode=getDomNode(element);var matches=[];var entries=callbackRegistry[event];if(entries){forEach(entries,function(entry){if(entry.node.contains(targetNode)){matches.push(entry.callback)}})}return matches}function triggerCallback(event,element,phase,data){$$rAF(function(){forEach(findCallbacks(element,event),function(callback){callback(element,phase,data)})})}return{on:function(event,container,callback){var node=extractElementNode(container);callbackRegistry[event]=callbackRegistry[event]||[];callbackRegistry[event].push({node:node,callback:callback})},off:function(event,container,callback){var entries=callbackRegistry[event];if(!entries)return;callbackRegistry[event]=arguments.length===1?null:filterFromRegistry(entries,container,callback);function filterFromRegistry(list,matchContainer,matchCallback){var containerNode=extractElementNode(matchContainer);return list.filter(function(entry){var isMatch=entry.node===containerNode&&(!matchCallback||entry.callback===matchCallback);return!isMatch})}},pin:function(element,parentElement){assertArg(isElement(element),"element","not an element");assertArg(isElement(parentElement),"parentElement","not an element");element.data(NG_ANIMATE_PIN_DATA,parentElement)},push:function(element,event,options,domOperation){options=options||{};options.domOperation=domOperation;return queueAnimation(element,event,options)},enabled:function(element,bool){var argCount=arguments.length;if(argCount===0){bool=!!animationsEnabled}else{var hasElement=isElement(element);if(!hasElement){bool=animationsEnabled=!!element}else{var node=getDomNode(element);var recordExists=disabledElementsLookup.get(node);if(argCount===1){bool=!recordExists}else{bool=!!bool;if(!bool){disabledElementsLookup.put(node,true)}else if(recordExists){disabledElementsLookup.remove(node)}}}}return bool}};function queueAnimation(element,event,options){var node,parent;element=stripCommentsFromElement(element);if(element){node=getDomNode(element);parent=element.parent()}options=prepareAnimationOptions(options);var runner=new $$AnimateRunner;if(isArray(options.addClass)){options.addClass=options.addClass.join(" ")}if(options.addClass&&!isString(options.addClass)){options.addClass=null}if(isArray(options.removeClass)){options.removeClass=options.removeClass.join(" ")}if(options.removeClass&&!isString(options.removeClass)){options.removeClass=null}if(options.from&&!isObject(options.from)){options.from=null}if(options.to&&!isObject(options.to)){options.to=null}if(!node){close();return runner}var className=[node.className,options.addClass,options.removeClass].join(" ");if(!isAnimatableClassName(className)){close();return runner}var isStructural=["enter","move","leave"].indexOf(event)>=0;var skipAnimations=!animationsEnabled||disabledElementsLookup.get(node);var existingAnimation=!skipAnimations&&activeAnimationsLookup.get(node)||{};var hasExistingAnimation=!!existingAnimation.state;if(!skipAnimations&&(!hasExistingAnimation||existingAnimation.state!=PRE_DIGEST_STATE)){skipAnimations=!areAnimationsAllowed(element,parent,event)}if(skipAnimations){close();return runner}if(isStructural){closeChildAnimations(element)}var newAnimation={structural:isStructural,element:element,event:event,close:close,options:options,runner:runner};if(hasExistingAnimation){var skipAnimationFlag=isAllowed("skip",element,newAnimation,existingAnimation);if(skipAnimationFlag){if(existingAnimation.state===RUNNING_STATE){close();return runner}else{mergeAnimationOptions(element,existingAnimation.options,options);return existingAnimation.runner}}var cancelAnimationFlag=isAllowed("cancel",element,newAnimation,existingAnimation);if(cancelAnimationFlag){if(existingAnimation.state===RUNNING_STATE){existingAnimation.runner.end()}else if(existingAnimation.structural){existingAnimation.close()}else{mergeAnimationOptions(element,existingAnimation.options,newAnimation.options);return existingAnimation.runner}}else{var joinAnimationFlag=isAllowed("join",element,newAnimation,existingAnimation);if(joinAnimationFlag){if(existingAnimation.state===RUNNING_STATE){normalizeAnimationOptions(element,options)}else{applyGeneratedPreparationClasses(element,isStructural?event:null,options);event=newAnimation.event=existingAnimation.event;options=mergeAnimationOptions(element,existingAnimation.options,newAnimation.options);return existingAnimation.runner}}}}else{normalizeAnimationOptions(element,options)}var isValidAnimation=newAnimation.structural;if(!isValidAnimation){isValidAnimation=newAnimation.event==="animate"&&Object.keys(newAnimation.options.to||{}).length>0||hasAnimationClasses(newAnimation.options)}if(!isValidAnimation){close();clearElementAnimationState(element);return runner}var counter=(existingAnimation.counter||0)+1;newAnimation.counter=counter;markElementAnimationState(element,PRE_DIGEST_STATE,newAnimation);$rootScope.$$postDigest(function(){var animationDetails=activeAnimationsLookup.get(node);var animationCancelled=!animationDetails;animationDetails=animationDetails||{};var parentElement=element.parent()||[];var isValidAnimation=parentElement.length>0&&(animationDetails.event==="animate"||animationDetails.structural||hasAnimationClasses(animationDetails.options));if(animationCancelled||animationDetails.counter!==counter||!isValidAnimation){if(animationCancelled){applyAnimationClasses(element,options);applyAnimationStyles(element,options)}if(animationCancelled||isStructural&&animationDetails.event!==event){options.domOperation();runner.end()}if(!isValidAnimation){clearElementAnimationState(element)}return}event=!animationDetails.structural&&hasAnimationClasses(animationDetails.options,true)?"setClass":animationDetails.event;markElementAnimationState(element,RUNNING_STATE);var realRunner=$$animation(element,event,animationDetails.options);realRunner.done(function(status){close(!status);var animationDetails=activeAnimationsLookup.get(node);if(animationDetails&&animationDetails.counter===counter){clearElementAnimationState(getDomNode(element))}notifyProgress(runner,event,"close",{})});runner.setHost(realRunner);notifyProgress(runner,event,"start",{})});return runner;function notifyProgress(runner,event,phase,data){triggerCallback(event,element,phase,data);runner.progress(event,phase,data)}function close(reject){clearGeneratedClasses(element,options);applyAnimationClasses(element,options);applyAnimationStyles(element,options);options.domOperation();runner.complete(!reject)}}function closeChildAnimations(element){var node=getDomNode(element);var children=node.querySelectorAll("["+NG_ANIMATE_ATTR_NAME+"]");forEach(children,function(child){var state=parseInt(child.getAttribute(NG_ANIMATE_ATTR_NAME));var animationDetails=activeAnimationsLookup.get(child);switch(state){case RUNNING_STATE:animationDetails.runner.end();case PRE_DIGEST_STATE:if(animationDetails){activeAnimationsLookup.remove(child)}break}})}function clearElementAnimationState(element){var node=getDomNode(element);node.removeAttribute(NG_ANIMATE_ATTR_NAME);activeAnimationsLookup.remove(node)}function isMatchingElement(nodeOrElmA,nodeOrElmB){return getDomNode(nodeOrElmA)===getDomNode(nodeOrElmB)}function areAnimationsAllowed(element,parentElement,event){var bodyElementDetected=isMatchingElement(element,$$body)||element[0].nodeName==="HTML";var rootElementDetected=isMatchingElement(element,$rootElement);var parentAnimationDetected=false;var animateChildren;var parentHost=element.data(NG_ANIMATE_PIN_DATA);if(parentHost){parentElement=parentHost}while(parentElement&&parentElement.length){if(!rootElementDetected){rootElementDetected=isMatchingElement(parentElement,$rootElement)}var parentNode=parentElement[0];if(parentNode.nodeType!==ELEMENT_NODE){break}var details=activeAnimationsLookup.get(parentNode)||{};if(!parentAnimationDetected){parentAnimationDetected=details.structural||disabledElementsLookup.get(parentNode)}if(isUndefined(animateChildren)||animateChildren===true){var value=parentElement.data(NG_ANIMATE_CHILDREN_DATA);if(isDefined(value)){animateChildren=value}}if(parentAnimationDetected&&animateChildren===false)break;if(!rootElementDetected){rootElementDetected=isMatchingElement(parentElement,$rootElement);if(!rootElementDetected){parentHost=parentElement.data(NG_ANIMATE_PIN_DATA);if(parentHost){parentElement=parentHost}}}if(!bodyElementDetected){bodyElementDetected=isMatchingElement(parentElement,$$body)}parentElement=parentElement.parent()}var allowAnimation=!parentAnimationDetected||animateChildren;return allowAnimation&&rootElementDetected&&bodyElementDetected}function markElementAnimationState(element,state,details){details=details||{};details.state=state;var node=getDomNode(element);node.setAttribute(NG_ANIMATE_ATTR_NAME,state);var oldValue=activeAnimationsLookup.get(node);var newValue=oldValue?extend(oldValue,details):details;activeAnimationsLookup.put(node,newValue)}}]}];var $$AnimateAsyncRunFactory=["$$rAF",function($$rAF){var waitQueue=[];function waitForTick(fn){waitQueue.push(fn);if(waitQueue.length>1)return;$$rAF(function(){for(var i=0;i=0;var runner=new $$AnimateRunner({end:function(){close()},cancel:function(){close(true)}});if(!drivers.length){close();return runner}setRunner(element,runner);var classes=mergeClasses(element.attr("class"),mergeClasses(options.addClass,options.removeClass));var tempClasses=options.tempClasses;if(tempClasses){classes+=" "+tempClasses;options.tempClasses=null}animationQueue.push({element:element,classes:classes,event:event,structural:isStructural,options:options,beforeStart:beforeStart,close:close});element.on("$destroy",handleDestroyedElement);if(animationQueue.length>1)return runner;$rootScope.$$postDigest(function(){var animations=[];forEach(animationQueue,function(entry){if(getRunner(entry.element)){animations.push(entry)}else{entry.close()}});animationQueue.length=0;var groupedAnimations=groupAnimations(animations);var toBeSortedAnimations=[];forEach(groupedAnimations,function(animationEntry){toBeSortedAnimations.push({domNode:getDomNode(animationEntry.from?animationEntry.from.element:animationEntry.element),fn:function triggerAnimationStart(){animationEntry.beforeStart();var startAnimationFn,closeFn=animationEntry.close;var targetElement=animationEntry.anchors?animationEntry.from.element||animationEntry.to.element:animationEntry.element;if(getRunner(targetElement)){var operation=invokeFirstDriver(animationEntry);if(operation){startAnimationFn=operation.start}}if(!startAnimationFn){closeFn()}else{var animationRunner=startAnimationFn();animationRunner.done(function(status){closeFn(!status)});updateAnimationRunners(animationEntry,animationRunner)}}})});$$rAFScheduler(sortAnimations(toBeSortedAnimations))});return runner;function getAnchorNodes(node){var SELECTOR="["+NG_ANIMATE_REF_ATTR+"]";var items=node.hasAttribute(NG_ANIMATE_REF_ATTR)?[node]:node.querySelectorAll(SELECTOR);var anchors=[];forEach(items,function(node){var attr=node.getAttribute(NG_ANIMATE_REF_ATTR);if(attr&&attr.length){anchors.push(node)}});return anchors}function groupAnimations(animations){var preparedAnimations=[];var refLookup={};forEach(animations,function(animation,index){var element=animation.element;var node=getDomNode(element);var event=animation.event;var enterOrMove=["enter","move"].indexOf(event)>=0;var anchorNodes=animation.structural?getAnchorNodes(node):[];if(anchorNodes.length){var direction=enterOrMove?"to":"from";forEach(anchorNodes,function(anchor){var key=anchor.getAttribute(NG_ANIMATE_REF_ATTR);refLookup[key]=refLookup[key]||{};refLookup[key][direction]={animationID:index,element:jqLite(anchor)}})}else{preparedAnimations.push(animation)}});var usedIndicesLookup={};var anchorGroups={};forEach(refLookup,function(operations,key){var from=operations.from;var to=operations.to;if(!from||!to){var index=from?from.animationID:to.animationID;var indexKey=index.toString();if(!usedIndicesLookup[indexKey]){usedIndicesLookup[indexKey]=true;preparedAnimations.push(animations[index])}return}var fromAnimation=animations[from.animationID];var toAnimation=animations[to.animationID];var lookupKey=from.animationID.toString();if(!anchorGroups[lookupKey]){var group=anchorGroups[lookupKey]={structural:true,beforeStart:function(){fromAnimation.beforeStart();toAnimation.beforeStart()},close:function(){fromAnimation.close();toAnimation.close()},classes:cssClassesIntersection(fromAnimation.classes,toAnimation.classes),from:fromAnimation,to:toAnimation,anchors:[]};if(group.classes.length){preparedAnimations.push(group)}else{preparedAnimations.push(fromAnimation);preparedAnimations.push(toAnimation)}}anchorGroups[lookupKey].anchors.push({out:from.element,"in":to.element})});return preparedAnimations}function cssClassesIntersection(a,b){a=a.split(" ");b=b.split(" ");var matches=[];for(var i=0;i=0;i--){var driverName=drivers[i];if(!$injector.has(driverName))continue;var factory=$injector.get(driverName);var driver=factory(animationDetails);if(driver){return driver}}}function beforeStart(){element.addClass(NG_ANIMATE_CLASSNAME);if(tempClasses){$$jqLite.addClass(element,tempClasses)}}function updateAnimationRunners(animation,newRunner){if(animation.from&&animation.to){update(animation.from.element);update(animation.to.element)}else{update(animation.element)}function update(element){getRunner(element).setHost(newRunner)}}function handleDestroyedElement(){var runner=getRunner(element);if(runner&&(event!=="leave"||!options.$$domOperationFired)){runner.end()}}function close(rejected){element.off("$destroy",handleDestroyedElement);removeRunner(element);applyAnimationClasses(element,options);applyAnimationStyles(element,options);options.domOperation();if(tempClasses){$$jqLite.removeClass(element,tempClasses)}element.removeClass(NG_ANIMATE_CLASSNAME);runner.complete(!rejected)}}}]}];angular.module("ngAnimate",[]).provider("$$body",$$BodyProvider).directive("ngAnimateChildren",$$AnimateChildrenDirective).factory("$$rAFScheduler",$$rAFSchedulerFactory).factory("$$AnimateRunner",$$AnimateRunnerFactory).factory("$$animateAsyncRun",$$AnimateAsyncRunFactory).provider("$$animateQueue",$$AnimateQueueProvider).provider("$$animation",$$AnimationProvider).provider("$animateCss",$AnimateCssProvider).provider("$$animateCssDriver",$$AnimateCssDriverProvider).provider("$$animateJs",$$AnimateJsProvider).provider("$$animateJsDriver",$$AnimateJsDriverProvider); -})(window,window.angular);var app=angular.module("autocomplete",[]);app.directive("autocomplete",function(){var index=-1;return{restrict:"E",scope:{searchParam:"=ngModel",suggestions:"=data",onType:"=onType",onSelect:"=onSelect",autocompleteRequired:"="},controller:["$scope",function($scope){$scope.selectedIndex=-1;$scope.initLock=true;$scope.setIndex=function(i){$scope.selectedIndex=parseInt(i)};this.setIndex=function(i){$scope.setIndex(i);$scope.$apply()};$scope.getIndex=function(i){return $scope.selectedIndex};var watching=true;$scope.completing=false;$scope.$watch("searchParam",function(newValue,oldValue){if(oldValue===newValue||!oldValue&&$scope.initLock){return}if(watching&&typeof $scope.searchParam!=="undefined"&&$scope.searchParam!==null){$scope.completing=true;$scope.searchFilter=$scope.searchParam;$scope.selectedIndex=-1}if($scope.onType)$scope.onType($scope.searchParam)});this.preSelect=function(suggestion){watching=false;$scope.$apply();watching=true};$scope.preSelect=this.preSelect;this.preSelectOff=function(){watching=true};$scope.preSelectOff=this.preSelectOff;$scope.select=function(suggestion){if(suggestion){$scope.searchParam=suggestion;$scope.searchFilter=suggestion;if($scope.onSelect)$scope.onSelect(suggestion)}watching=false;$scope.completing=false;setTimeout(function(){watching=true},1e3);$scope.setIndex(-1)}}],link:function(scope,element,attrs){setTimeout(function(){scope.initLock=false;scope.$apply()},250);var attr="";scope.attrs={placeholder:"start typing...","class":"",id:"",inputclass:"",inputid:""};for(var a in attrs){attr=a.replace("attr","").toLowerCase();if(a.indexOf("attr")===0){scope.attrs[attr]=attrs[a]}}if(attrs.clickActivation){element[0].onclick=function(e){if(!scope.searchParam){setTimeout(function(){scope.completing=true;scope.$apply()},200)}}}var key={left:37,up:38,right:39,down:40,enter:13,esc:27,tab:9};document.addEventListener("keydown",function(e){var keycode=e.keyCode||e.which;switch(keycode){case key.esc:scope.select();scope.setIndex(-1);scope.$apply();e.preventDefault()}},true);document.addEventListener("blur",function(e){setTimeout(function(){scope.select();scope.setIndex(-1);scope.$apply()},150)},true);element[0].addEventListener("keydown",function(e){var keycode=e.keyCode||e.which;var l=angular.element(this).find("li").length;if(!scope.completing||l==0)return;switch(keycode){case key.up:index=scope.getIndex()-1;if(index<-1){index=l-1}else if(index>=l){index=-1;scope.setIndex(index);scope.preSelectOff();break}scope.setIndex(index);if(index!==-1)scope.preSelect(angular.element(angular.element(this).find("li")[index]).text());scope.$apply();break;case key.down:index=scope.getIndex()+1;if(index<-1){index=l-1}else if(index>=l){index=-1;scope.setIndex(index);scope.preSelectOff();scope.$apply();break}scope.setIndex(index);if(index!==-1)scope.preSelect(angular.element(angular.element(this).find("li")[index]).text());break;case key.left:break;case key.right:case key.enter:case key.tab:index=scope.getIndex();if(index!==-1){scope.select(angular.element(angular.element(this).find("li")[index]).text());if(keycode==key.enter){e.preventDefault()}}else{if(keycode==key.enter){scope.select()}}scope.setIndex(-1);scope.$apply();break;case key.esc:scope.select();scope.setIndex(-1);scope.$apply();e.preventDefault();break;default:return}})},template:'
'}});app.filter("highlight",["$sce",function($sce){return function(input,searchParam){if(typeof input==="function")return"";if(searchParam){var words="("+searchParam.split(/\ /).join(" |")+"|"+searchParam.split(/\ /).join("|")+")",exp=new RegExp(words,"gi");if(words.length){input=input.replace(exp,'$1')}}return $sce.trustAsHtml(input)}}]);app.directive("suggestion",function(){return{restrict:"A",require:"^autocomplete",link:function(scope,element,attrs,autoCtrl){element.bind("mouseenter",function(){autoCtrl.preSelect(attrs.val);autoCtrl.setIndex(attrs.index)});element.bind("mouseleave",function(){autoCtrl.preSelectOff()})}}});var app=angular.module("CreateDictionaryModule",["ui.router","ngAnimate","ui.bootstrap","autocomplete"]);app.config(function($stateProvider,$urlRouterProvider){$stateProvider.state("create",{url:"/create",templateUrl:"createDictionary.html",controller:"CreateDictionaryController"}).state("create.step1",{url:"/step1",templateUrl:"createDictionaryStep1.html"}).state("create.step2",{url:"/step2",templateUrl:"createDictionaryStep2.html"}).state("create.step3",{url:"/step3",templateUrl:"createDictionaryStep3.html"});$urlRouterProvider.otherwise("/create/step1")});app.controller("CreateDictionaryController",["$scope","$http","$modal","$interval","$state","$log",function($scope,$http,$modal,$interval,$state,$log){var clientId=$("#clientId").data("lingvodoc");var userId=$("#userId").data("lingvodoc");var languagesUrl=$("#languagesUrl").data("lingvodoc");var createLanguageUrl=$("#createLanguageUrl").data("lingvodoc");var createDictionaryUrl=$("#createDictionaryUrl").data("lingvodoc");var allPerspectivesUrl=$("#allPerspectivesUrl").data("lingvodoc");var perspectiveFieldsUrl="/dictionary";var listBlobsUrl=$("#listBlobsUrl").data("lingvodoc");$scope.wizard={mode:"create",importedDictionaryId:-1};$scope.users=[];$scope.userLogins=[];$scope.uploadedDictionaries=[];var wrapPerspective=function(perspective){if(typeof perspective.fields=="undefined"){return}for(var i=0;i0){var childLangs=flatLanguages(language.contains);flat=flat.concat(childLangs)}}return flat};var getLanguageById=function(id){if(typeof id=="string"){var ids=id.split("_");for(var i=0;i<$scope.languages.length;i++){if($scope.languages[i].client_id==ids[0]&&$scope.languages[i].object_id==ids[1])$log.info($scope.languages[i]);return $scope.languages[i]}$log.info("no found!")}$log.info("no found id!")};$scope.languages=[];$scope.perspectives=[];$scope.dictionaryData={languageId:-1,perspectiveName:"",perspectiveId:-1};$scope.perspective={fields:[]};$scope.getLanguageId=function(language){if(language){return language.client_id+"_"+language.object_id}};$scope.newLanguage=function(){var modalInstance=$modal.open({animation:true,templateUrl:"createLanguageModal.html",controller:"CreateLanguageController",size:"lg"});modalInstance.result.then(function(languageObj){$http.post(createLanguageUrl,languageObj).success(function(data,status,headers,config){loadLanguages()}).error(function(data,status,headers,config){alert("Failed to save language!")})},function(){$log.info("Modal dismissed at: "+new Date)})};$scope.addField=function(){$scope.perspective.fields.push({entity_type:"",data_type:"text",status:"enabled"})};$scope.enableGroup=function(fieldIndex){if(typeof $scope.perspective.fields[fieldIndex].group==="undefined"){$scope.perspective.fields[fieldIndex].group=""}else{delete $scope.perspective.fields[fieldIndex].group}};$scope.enableLinkedField=function(fieldIndex){if(typeof $scope.perspective.fields[fieldIndex].contains==="undefined"){$scope.perspective.fields[fieldIndex].contains=[{entity_type:"",data_type:"markup",status:"enabled"}]}else{delete $scope.perspective.fields[fieldIndex].contains}};$scope.createDictionary=function(){var language=getLanguageById($scope.dictionaryData.languageId);if(!$scope.dictionaryData.name&&$scope.wizard.mode=="create"||typeof $scope.wizard.importedDictionaryId!="string"&&$scope.wizard.mode=="import"||!language){return}if($scope.wizard.mode=="create"){var dictionaryObj={parent_client_id:language.client_id,parent_object_id:language.object_id,name:$scope.dictionaryData.name,translation:$scope.dictionaryData.name};$http.post(createDictionaryUrl,dictionaryObj).success(function(data,status,headers,config){if(data.object_id&&data.client_id){$scope.dictionaryData.dictionary_client_id=data.client_id;$scope.dictionaryData.dictionary_object_id=data.object_id;$state.go("create.step2")}else{alert("Failed to create dictionary!")}}).error(function(data,status,headers,config){alert("Failed to create dictionary!")})}if($scope.wizard.mode=="import"){if(typeof $scope.wizard.importedDictionaryId=="string"){var ids=$scope.wizard.importedDictionaryId.split("_");var url=$("#convertUrl").data("lingvodoc");var convertObject={blob_client_id:parseInt(ids[0]),blob_object_id:parseInt(ids[1]),parent_client_id:language.client_id,parent_object_id:language.object_id};$http.post(url,convertObject).success(function(data,status,headers,config){alert(data.status)}).error(function(data,status,headers,config){})}}};$scope.createPerspective=function(){if(!$scope.dictionaryData.perspectiveName){return}var createPerspectiveUrl="/dictionary/"+encodeURIComponent($scope.dictionaryData.dictionary_client_id)+"/"+encodeURIComponent($scope.dictionaryData.dictionary_object_id)+"/"+"perspective";var perspectiveObj={name:$scope.dictionaryData.perspectiveName,translation:$scope.dictionaryData.perspectiveName};$http.post(createPerspectiveUrl,perspectiveObj).success(function(data,status,headers,config){if(data.object_id&&data.client_id){$scope.dictionaryData.perspective_client_id=data.client_id;$scope.dictionaryData.perspective_object_id=data.object_id;var setFieldsUrl="/dictionary/"+encodeURIComponent($scope.dictionaryData.dictionary_client_id)+"/"+encodeURIComponent($scope.dictionaryData.dictionary_object_id)+"/perspective/"+encodeURIComponent($scope.dictionaryData.perspective_client_id)+"/"+encodeURIComponent($scope.dictionaryData.perspective_object_id)+"/fields";$http.post(setFieldsUrl,exportPerpective($scope.perspective)).success(function(data,status,headers,config){$state.go("create.step3")}).error(function(data,status,headers,config){alert("Failed to create perspective!")})}else{alert("Failed to create perspective!")}}).error(function(data,status,headers,config){alert("Failed to create perspective!")})};$scope.searchUsers=function(query){var promise=$http.get("/users?search="+encodeURIComponent(query)).then(function(response){return response.data});promise.then(function(data){var userLogins=[];if(data.users){for(var i=0;i0){var childLangs=flatLanguages(language.contains);flat=flat.concat(childLangs)}}return flat};$scope.getLanguageId=function(language){if(language){return language.client_id+"_"+language.object_id}};$scope.ok=function(){if(!$scope.translation){return}var languageObj={translation:$scope.translation,translation_string:$scope.translation};if($scope.parentLanguageId!="-1"){var parentLanguage=getLanguageById($scope.parentLanguageId);if(parentLanguage){languageObj["parent_client_id"]=parentLanguage.client_id;languageObj["parent_object_id"]=parentLanguage.object_id}}$modalInstance.close(languageObj)};$scope.cancel=function(){$modalInstance.dismiss("cancel")};$http.get(languagesUrl).success(function(data,status,headers,config){$scope.languages=flatLanguages(data.languages)}).error(function(data,status,headers,config){})}]); \ No newline at end of file +})(window,window.angular);var app=angular.module("autocomplete",[]);app.directive("autocomplete",function(){var index=-1;return{restrict:"E",scope:{searchParam:"=ngModel",suggestions:"=data",onType:"=onType",onSelect:"=onSelect",autocompleteRequired:"="},controller:["$scope",function($scope){$scope.selectedIndex=-1;$scope.initLock=true;$scope.setIndex=function(i){$scope.selectedIndex=parseInt(i)};this.setIndex=function(i){$scope.setIndex(i);$scope.$apply()};$scope.getIndex=function(i){return $scope.selectedIndex};var watching=true;$scope.completing=false;$scope.$watch("searchParam",function(newValue,oldValue){if(oldValue===newValue||!oldValue&&$scope.initLock){return}if(watching&&typeof $scope.searchParam!=="undefined"&&$scope.searchParam!==null){$scope.completing=true;$scope.searchFilter=$scope.searchParam;$scope.selectedIndex=-1}if($scope.onType)$scope.onType($scope.searchParam)});this.preSelect=function(suggestion){watching=false;$scope.$apply();watching=true};$scope.preSelect=this.preSelect;this.preSelectOff=function(){watching=true};$scope.preSelectOff=this.preSelectOff;$scope.select=function(suggestion){if(suggestion){$scope.searchParam=suggestion;$scope.searchFilter=suggestion;if($scope.onSelect)$scope.onSelect(suggestion)}watching=false;$scope.completing=false;setTimeout(function(){watching=true},1e3);$scope.setIndex(-1)}}],link:function(scope,element,attrs){setTimeout(function(){scope.initLock=false;scope.$apply()},250);var attr="";scope.attrs={placeholder:"start typing...","class":"",id:"",inputclass:"",inputid:""};for(var a in attrs){attr=a.replace("attr","").toLowerCase();if(a.indexOf("attr")===0){scope.attrs[attr]=attrs[a]}}if(attrs.clickActivation){element[0].onclick=function(e){if(!scope.searchParam){setTimeout(function(){scope.completing=true;scope.$apply()},200)}}}var key={left:37,up:38,right:39,down:40,enter:13,esc:27,tab:9};document.addEventListener("keydown",function(e){var keycode=e.keyCode||e.which;switch(keycode){case key.esc:scope.select();scope.setIndex(-1);scope.$apply();e.preventDefault()}},true);document.addEventListener("blur",function(e){setTimeout(function(){scope.select();scope.setIndex(-1);scope.$apply()},150)},true);element[0].addEventListener("keydown",function(e){var keycode=e.keyCode||e.which;var l=angular.element(this).find("li").length;if(!scope.completing||l==0)return;switch(keycode){case key.up:index=scope.getIndex()-1;if(index<-1){index=l-1}else if(index>=l){index=-1;scope.setIndex(index);scope.preSelectOff();break}scope.setIndex(index);if(index!==-1)scope.preSelect(angular.element(angular.element(this).find("li")[index]).text());scope.$apply();break;case key.down:index=scope.getIndex()+1;if(index<-1){index=l-1}else if(index>=l){index=-1;scope.setIndex(index);scope.preSelectOff();scope.$apply();break}scope.setIndex(index);if(index!==-1)scope.preSelect(angular.element(angular.element(this).find("li")[index]).text());break;case key.left:break;case key.right:case key.enter:case key.tab:index=scope.getIndex();if(index!==-1){scope.select(angular.element(angular.element(this).find("li")[index]).text());if(keycode==key.enter){e.preventDefault()}}else{if(keycode==key.enter){scope.select()}}scope.setIndex(-1);scope.$apply();break;case key.esc:scope.select();scope.setIndex(-1);scope.$apply();e.preventDefault();break;default:return}})},template:'
'}});app.filter("highlight",["$sce",function($sce){return function(input,searchParam){if(typeof input==="function")return"";if(searchParam){var words="("+searchParam.split(/\ /).join(" |")+"|"+searchParam.split(/\ /).join("|")+")",exp=new RegExp(words,"gi");if(words.length){input=input.replace(exp,'$1')}}return $sce.trustAsHtml(input)}}]);app.directive("suggestion",function(){return{restrict:"A",require:"^autocomplete",link:function(scope,element,attrs,autoCtrl){element.bind("mouseenter",function(){autoCtrl.preSelect(attrs.val);autoCtrl.setIndex(attrs.index)});element.bind("mouseleave",function(){autoCtrl.preSelectOff()})}}});var app=angular.module("CreateDictionaryModule",["ui.router","ngAnimate","ui.bootstrap","autocomplete"]);app.config(function($stateProvider,$urlRouterProvider){$stateProvider.state("create",{url:"/create",templateUrl:"createDictionary.html",controller:"CreateDictionaryController"}).state("create.step1",{url:"/step1",templateUrl:"createDictionaryStep1.html"}).state("create.step2",{url:"/step2",templateUrl:"createDictionaryStep2.html"}).state("create.step3",{url:"/step3",templateUrl:"createDictionaryStep3.html"});$urlRouterProvider.otherwise("/create/step1")});app.controller("CreateDictionaryController",["$scope","$http","$modal","$interval","$state","$location","$log",function($scope,$http,$modal,$interval,$state,$location,$log){var clientId=$("#clientId").data("lingvodoc");var userId=$("#userId").data("lingvodoc");var languagesUrl=$("#languagesUrl").data("lingvodoc");var createLanguageUrl=$("#createLanguageUrl").data("lingvodoc");var createDictionaryUrl=$("#createDictionaryUrl").data("lingvodoc");var allPerspectivesUrl=$("#allPerspectivesUrl").data("lingvodoc");var perspectiveFieldsUrl="/dictionary";var listBlobsUrl=$("#listBlobsUrl").data("lingvodoc");$scope.wizard={mode:"create",importedDictionaryId:-1};$scope.users=[];$scope.userLogins=[];$scope.uploadedDictionaries=[];var wrapPerspective=function(perspective){if(typeof perspective.fields=="undefined"){return}for(var i=0;i0){var childLangs=flatLanguages(language.contains);flat=flat.concat(childLangs)}}return flat};var getLanguageById=function(id){if(typeof id=="string"){var ids=id.split("_");for(var i=0;i<$scope.languages.length;i++){if($scope.languages[i].client_id==ids[0]&&$scope.languages[i].object_id==ids[1])return $scope.languages[i]}}};$scope.languages=[];$scope.perspectives=[];$scope.dictionaryData={languageId:-1,perspectiveName:"",perspectiveId:-1};$scope.perspective={fields:[]};$scope.getLanguageId=function(language){if(language){return language.client_id+"_"+language.object_id}};$scope.newLanguage=function(){var modalInstance=$modal.open({animation:true,templateUrl:"createLanguageModal.html",controller:"CreateLanguageController",size:"lg"});modalInstance.result.then(function(languageObj){$http.post(createLanguageUrl,languageObj).success(function(data,status,headers,config){loadLanguages()}).error(function(data,status,headers,config){alert("Failed to save language!")})},function(){})};$scope.addField=function(){$scope.perspective.fields.push({entity_type:"",data_type:"text",status:"enabled"})};$scope.enableGroup=function(fieldIndex){if(typeof $scope.perspective.fields[fieldIndex].group==="undefined"){$scope.perspective.fields[fieldIndex].group=""}else{delete $scope.perspective.fields[fieldIndex].group}};$scope.enableLinkedField=function(fieldIndex){if(typeof $scope.perspective.fields[fieldIndex].contains==="undefined"){$scope.perspective.fields[fieldIndex].contains=[{entity_type:"",data_type:"markup",status:"enabled"}]}else{delete $scope.perspective.fields[fieldIndex].contains}};$scope.createDictionary=function(){var language=getLanguageById($scope.dictionaryData.languageId);if(!$scope.dictionaryData.name&&$scope.wizard.mode=="create"||typeof $scope.wizard.importedDictionaryId!="string"&&$scope.wizard.mode=="import"||!language){return}if($scope.wizard.mode=="create"){var dictionaryObj={parent_client_id:language.client_id,parent_object_id:language.object_id,name:$scope.dictionaryData.name,translation:$scope.dictionaryData.name};$http.post(createDictionaryUrl,dictionaryObj).success(function(data,status,headers,config){if(data.object_id&&data.client_id){$scope.dictionaryData.dictionary_client_id=data.client_id;$scope.dictionaryData.dictionary_object_id=data.object_id;$state.go("create.step2")}else{alert("Failed to create dictionary!")}}).error(function(data,status,headers,config){alert("Failed to create dictionary!")})}if($scope.wizard.mode=="import"){if(typeof $scope.wizard.importedDictionaryId=="string"){var ids=$scope.wizard.importedDictionaryId.split("_");var url=$("#convertUrl").data("lingvodoc");var convertObject={blob_client_id:parseInt(ids[0]),blob_object_id:parseInt(ids[1]),parent_client_id:language.client_id,parent_object_id:language.object_id};$http.post(url,convertObject).success(function(data,status,headers,config){alert(data.status)}).error(function(data,status,headers,config){})}}};$scope.createPerspective=function(){if(!$scope.dictionaryData.perspectiveName){return}var createPerspectiveUrl="/dictionary/"+encodeURIComponent($scope.dictionaryData.dictionary_client_id)+"/"+encodeURIComponent($scope.dictionaryData.dictionary_object_id)+"/"+"perspective";var perspectiveObj={name:$scope.dictionaryData.perspectiveName,translation:$scope.dictionaryData.perspectiveName};$http.post(createPerspectiveUrl,perspectiveObj).success(function(data,status,headers,config){if(data.object_id&&data.client_id){$scope.dictionaryData.perspective_client_id=data.client_id;$scope.dictionaryData.perspective_object_id=data.object_id;var setFieldsUrl="/dictionary/"+encodeURIComponent($scope.dictionaryData.dictionary_client_id)+"/"+encodeURIComponent($scope.dictionaryData.dictionary_object_id)+"/perspective/"+encodeURIComponent($scope.dictionaryData.perspective_client_id)+"/"+encodeURIComponent($scope.dictionaryData.perspective_object_id)+"/fields";$http.post(setFieldsUrl,exportPerpective($scope.perspective)).success(function(data,status,headers,config){window.location="/dashboard"}).error(function(data,status,headers,config){alert("Failed to create perspective!")})}else{alert("Failed to create perspective!")}}).error(function(data,status,headers,config){alert("Failed to create perspective!")})};$scope.searchUsers=function(query){var promise=$http.get("/users?search="+encodeURIComponent(query)).then(function(response){return response.data});promise.then(function(data){var userLogins=[];if(data.users){for(var i=0;i0){var childLangs=flatLanguages(language.contains);flat=flat.concat(childLangs)}}return flat};$scope.getLanguageId=function(language){if(language){return language.client_id+"_"+language.object_id}};$scope.ok=function(){if(!$scope.translation){return}var languageObj={translation:$scope.translation,translation_string:$scope.translation};if($scope.parentLanguageId!="-1"){var parentLanguage=getLanguageById($scope.parentLanguageId);if(parentLanguage){languageObj["parent_client_id"]=parentLanguage.client_id;languageObj["parent_object_id"]=parentLanguage.object_id}}$modalInstance.close(languageObj)};$scope.cancel=function(){$modalInstance.dismiss("cancel")};$http.get(languagesUrl).success(function(data,status,headers,config){$scope.languages=flatLanguages(data.languages)}).error(function(data,status,headers,config){})}]); \ No newline at end of file diff --git a/lingvodoc/static/js/edit-dictionary.js b/lingvodoc/static/js/edit-dictionary.js index c32383d17..8142366ca 100644 --- a/lingvodoc/static/js/edit-dictionary.js +++ b/lingvodoc/static/js/edit-dictionary.js @@ -21,4 +21,4 @@ self.dropdownMenu.replaceWith(newEl);self.dropdownMenu=newEl}dropdownService.clo }}).directive("popover",["$tooltip",function($tooltip){return $tooltip("popover","popover","click")}]);angular.module("ui.bootstrap.progressbar",[]).constant("progressConfig",{animate:true,max:100}).value("$progressSuppressWarning",false).controller("ProgressController",["$scope","$attrs","progressConfig",function($scope,$attrs,progressConfig){var self=this,animate=angular.isDefined($attrs.animate)?$scope.$parent.$eval($attrs.animate):progressConfig.animate;this.bars=[];$scope.max=angular.isDefined($scope.max)?$scope.max:progressConfig.max;this.addBar=function(bar,element){if(!animate){element.css({transition:"none"})}this.bars.push(bar);bar.max=$scope.max;bar.$watch("value",function(value){bar.recalculatePercentage()});bar.recalculatePercentage=function(){bar.percent=+(100*bar.value/bar.max).toFixed(2);var totalPercentage=self.bars.reduce(function(total,bar){return total+bar.percent},0);if(totalPercentage>100){bar.percent-=totalPercentage-100}};bar.$on("$destroy",function(){element=null;self.removeBar(bar)})};this.removeBar=function(bar){this.bars.splice(this.bars.indexOf(bar),1)};$scope.$watch("max",function(max){self.bars.forEach(function(bar){bar.max=$scope.max;bar.recalculatePercentage()})})}]).directive("uibProgress",function(){return{restrict:"EA",replace:true,transclude:true,controller:"ProgressController",require:"uibProgress",scope:{max:"=?"},templateUrl:"template/progressbar/progress.html"}}).directive("progress",["$log","$progressSuppressWarning",function($log,$progressSuppressWarning){return{restrict:"EA",replace:true,transclude:true,controller:"ProgressController",require:"progress",scope:{max:"=?"},templateUrl:"template/progressbar/progress.html",link:function(){if($progressSuppressWarning){$log.warn("progress is now deprecated. Use uib-progress instead")}}}}]).directive("uibBar",function(){return{restrict:"EA",replace:true,transclude:true,require:"^uibProgress",scope:{value:"=",type:"@"},templateUrl:"template/progressbar/bar.html",link:function(scope,element,attrs,progressCtrl){progressCtrl.addBar(scope,element)}}}).directive("bar",["$log","$progressSuppressWarning",function($log,$progressSuppressWarning){return{restrict:"EA",replace:true,transclude:true,require:"^progress",scope:{value:"=",type:"@"},templateUrl:"template/progressbar/bar.html",link:function(scope,element,attrs,progressCtrl){if($progressSuppressWarning){$log.warn("bar is now deprecated. Use uib-bar instead")}progressCtrl.addBar(scope,element)}}}]).directive("progressbar",function(){return{restrict:"EA",replace:true,transclude:true,controller:"ProgressController",scope:{value:"=",max:"=?",type:"@"},templateUrl:"template/progressbar/progressbar.html",link:function(scope,element,attrs,progressCtrl){progressCtrl.addBar(scope,angular.element(element.children()[0]))}}});angular.module("ui.bootstrap.rating",[]).constant("ratingConfig",{max:5,stateOn:null,stateOff:null,titles:["one","two","three","four","five"]}).controller("RatingController",["$scope","$attrs","ratingConfig",function($scope,$attrs,ratingConfig){var ngModelCtrl={$setViewValue:angular.noop};this.init=function(ngModelCtrl_){ngModelCtrl=ngModelCtrl_;ngModelCtrl.$render=this.render;ngModelCtrl.$formatters.push(function(value){if(angular.isNumber(value)&&value<<0!==value){value=Math.round(value)}return value});this.stateOn=angular.isDefined($attrs.stateOn)?$scope.$parent.$eval($attrs.stateOn):ratingConfig.stateOn;this.stateOff=angular.isDefined($attrs.stateOff)?$scope.$parent.$eval($attrs.stateOff):ratingConfig.stateOff;var tmpTitles=angular.isDefined($attrs.titles)?$scope.$parent.$eval($attrs.titles):ratingConfig.titles;this.titles=angular.isArray(tmpTitles)&&tmpTitles.length>0?tmpTitles:ratingConfig.titles;var ratingStates=angular.isDefined($attrs.ratingStates)?$scope.$parent.$eval($attrs.ratingStates):new Array(angular.isDefined($attrs.max)?$scope.$parent.$eval($attrs.max):ratingConfig.max);$scope.range=this.buildTemplateObjects(ratingStates)};this.buildTemplateObjects=function(states){for(var i=0,n=states.length;i=this.titles.length){return index+1}else{return this.titles[index]}};$scope.rate=function(value){if(!$scope.readonly&&value>=0&&value<=$scope.range.length){ngModelCtrl.$setViewValue(ngModelCtrl.$viewValue===value?0:value);ngModelCtrl.$render()}};$scope.enter=function(value){if(!$scope.readonly){$scope.value=value}$scope.onHover({value:value})};$scope.reset=function(){$scope.value=ngModelCtrl.$viewValue;$scope.onLeave()};$scope.onKeydown=function(evt){if(/(37|38|39|40)/.test(evt.which)){evt.preventDefault();evt.stopPropagation();$scope.rate($scope.value+(evt.which===38||evt.which===39?1:-1))}};this.render=function(){$scope.value=ngModelCtrl.$viewValue}}]).directive("rating",function(){return{restrict:"EA",require:["rating","ngModel"],scope:{readonly:"=?",onHover:"&",onLeave:"&"},controller:"RatingController",templateUrl:"template/rating/rating.html",replace:true,link:function(scope,element,attrs,ctrls){var ratingCtrl=ctrls[0],ngModelCtrl=ctrls[1];ratingCtrl.init(ngModelCtrl)}}});angular.module("ui.bootstrap.tabs",[]).controller("TabsetController",["$scope",function TabsetCtrl($scope){var ctrl=this,tabs=ctrl.tabs=$scope.tabs=[];ctrl.select=function(selectedTab){angular.forEach(tabs,function(tab){if(tab.active&&tab!==selectedTab){tab.active=false;tab.onDeselect();selectedTab.selectCalled=false}});selectedTab.active=true;if(!selectedTab.selectCalled){selectedTab.onSelect();selectedTab.selectCalled=true}};ctrl.addTab=function addTab(tab){tabs.push(tab);if(tabs.length===1&&tab.active!==false){tab.active=true}else if(tab.active){ctrl.select(tab)}else{tab.active=false}};ctrl.removeTab=function removeTab(tab){var index=tabs.indexOf(tab);if(tab.active&&tabs.length>1&&!destroyed){var newActiveIndex=index==tabs.length-1?index-1:index+1;ctrl.select(tabs[newActiveIndex])}tabs.splice(index,1)};var destroyed;$scope.$on("$destroy",function(){destroyed=true})}]).directive("tabset",function(){return{restrict:"EA",transclude:true,replace:true,scope:{type:"@"},controller:"TabsetController",templateUrl:"template/tabs/tabset.html",link:function(scope,element,attrs){scope.vertical=angular.isDefined(attrs.vertical)?scope.$parent.$eval(attrs.vertical):false;scope.justified=angular.isDefined(attrs.justified)?scope.$parent.$eval(attrs.justified):false}}}).directive("tab",["$parse","$log",function($parse,$log){return{require:"^tabset",restrict:"EA",replace:true,templateUrl:"template/tabs/tab.html",transclude:true,scope:{active:"=?",heading:"@",onSelect:"&select",onDeselect:"&deselect"},controller:function(){},link:function(scope,elm,attrs,tabsetCtrl,transclude){scope.$watch("active",function(active){if(active){tabsetCtrl.select(scope)}});scope.disabled=false;if(attrs.disable){scope.$parent.$watch($parse(attrs.disable),function(value){scope.disabled=!!value})}if(attrs.disabled){$log.warn('Use of "disabled" attribute has been deprecated, please use "disable"');scope.$parent.$watch($parse(attrs.disabled),function(value){scope.disabled=!!value})}scope.select=function(){if(!scope.disabled){scope.active=true}};tabsetCtrl.addTab(scope);scope.$on("$destroy",function(){tabsetCtrl.removeTab(scope)});scope.$transcludeFn=transclude}}}]).directive("tabHeadingTransclude",function(){return{restrict:"A",require:"^tab",link:function(scope,elm,attrs,tabCtrl){scope.$watch("headingElement",function updateHeadingElement(heading){if(heading){elm.html("");elm.append(heading)}})}}}).directive("tabContentTransclude",function(){return{restrict:"A",require:"^tabset",link:function(scope,elm,attrs){var tab=scope.$eval(attrs.tabContentTransclude);tab.$transcludeFn(tab.$parent,function(contents){angular.forEach(contents,function(node){if(isTabHeading(node)){tab.headingElement=node}else{elm.append(node)}})})}};function isTabHeading(node){return node.tagName&&(node.hasAttribute("tab-heading")||node.hasAttribute("data-tab-heading")||node.hasAttribute("x-tab-heading")||node.tagName.toLowerCase()==="tab-heading"||node.tagName.toLowerCase()==="data-tab-heading"||node.tagName.toLowerCase()==="x-tab-heading")}});angular.module("ui.bootstrap.timepicker",[]).constant("timepickerConfig",{hourStep:1,minuteStep:1,showMeridian:true,meridians:null,readonlyInput:false,mousewheel:true,arrowkeys:true,showSpinners:true}).controller("TimepickerController",["$scope","$attrs","$parse","$log","$locale","timepickerConfig",function($scope,$attrs,$parse,$log,$locale,timepickerConfig){var selected=new Date,ngModelCtrl={$setViewValue:angular.noop},meridians=angular.isDefined($attrs.meridians)?$scope.$parent.$eval($attrs.meridians):timepickerConfig.meridians||$locale.DATETIME_FORMATS.AMPMS;this.init=function(ngModelCtrl_,inputs){ngModelCtrl=ngModelCtrl_;ngModelCtrl.$render=this.render;ngModelCtrl.$formatters.unshift(function(modelValue){return modelValue?new Date(modelValue):null});var hoursInputEl=inputs.eq(0),minutesInputEl=inputs.eq(1);var mousewheel=angular.isDefined($attrs.mousewheel)?$scope.$parent.$eval($attrs.mousewheel):timepickerConfig.mousewheel;if(mousewheel){this.setupMousewheelEvents(hoursInputEl,minutesInputEl)}var arrowkeys=angular.isDefined($attrs.arrowkeys)?$scope.$parent.$eval($attrs.arrowkeys):timepickerConfig.arrowkeys;if(arrowkeys){this.setupArrowkeyEvents(hoursInputEl,minutesInputEl)}$scope.readonlyInput=angular.isDefined($attrs.readonlyInput)?$scope.$parent.$eval($attrs.readonlyInput):timepickerConfig.readonlyInput;this.setupInputEvents(hoursInputEl,minutesInputEl)};var hourStep=timepickerConfig.hourStep;if($attrs.hourStep){$scope.$parent.$watch($parse($attrs.hourStep),function(value){hourStep=parseInt(value,10)})}var minuteStep=timepickerConfig.minuteStep;if($attrs.minuteStep){$scope.$parent.$watch($parse($attrs.minuteStep),function(value){minuteStep=parseInt(value,10)})}var min;$scope.$parent.$watch($parse($attrs.min),function(value){var dt=new Date(value);min=isNaN(dt)?undefined:dt});var max;$scope.$parent.$watch($parse($attrs.max),function(value){var dt=new Date(value);max=isNaN(dt)?undefined:dt});$scope.noIncrementHours=function(){var incrementedSelected=addMinutes(selected,hourStep*60);return incrementedSelected>max||incrementedSelectedselected&&decrementedSelected>max};$scope.noIncrementMinutes=function(){var incrementedSelected=addMinutes(selected,minuteStep);return incrementedSelected>max||incrementedSelectedselected&&decrementedSelected>max};$scope.noToggleMeridian=function(){if(selected.getHours()<13){return addMinutes(selected,12*60)>max}else{return addMinutes(selected,-12*60)0&&hours<13:hours>=0&&hours<24;if(!valid){return undefined}if($scope.showMeridian){if(hours===12){hours=0}if($scope.meridian===meridians[1]){hours=hours+12}}return hours}function getMinutesFromTemplate(){var minutes=parseInt($scope.minutes,10);return minutes>=0&&minutes<60?minutes:undefined}function pad(value){return angular.isDefined(value)&&value.toString().length<2?"0"+value:value.toString()}this.setupMousewheelEvents=function(hoursInputEl,minutesInputEl){var isScrollingUp=function(e){if(e.originalEvent){e=e.originalEvent}var delta=e.wheelDelta?e.wheelDelta:-e.deltaY;return e.detail||delta>0};hoursInputEl.bind("mousewheel wheel",function(e){$scope.$apply(isScrollingUp(e)?$scope.incrementHours():$scope.decrementHours());e.preventDefault()});minutesInputEl.bind("mousewheel wheel",function(e){$scope.$apply(isScrollingUp(e)?$scope.incrementMinutes():$scope.decrementMinutes());e.preventDefault()})};this.setupArrowkeyEvents=function(hoursInputEl,minutesInputEl){hoursInputEl.bind("keydown",function(e){if(e.which===38){e.preventDefault();$scope.incrementHours();$scope.$apply()}else if(e.which===40){e.preventDefault();$scope.decrementHours();$scope.$apply()}});minutesInputEl.bind("keydown",function(e){if(e.which===38){e.preventDefault();$scope.incrementMinutes();$scope.$apply()}else if(e.which===40){e.preventDefault();$scope.decrementMinutes();$scope.$apply()}})};this.setupInputEvents=function(hoursInputEl,minutesInputEl){if($scope.readonlyInput){$scope.updateHours=angular.noop;$scope.updateMinutes=angular.noop;return}var invalidate=function(invalidHours,invalidMinutes){ngModelCtrl.$setViewValue(null);ngModelCtrl.$setValidity("time",false);if(angular.isDefined(invalidHours)){$scope.invalidHours=invalidHours}if(angular.isDefined(invalidMinutes)){$scope.invalidMinutes=invalidMinutes}};$scope.updateHours=function(){var hours=getHoursFromTemplate(),minutes=getMinutesFromTemplate();if(angular.isDefined(hours)&&angular.isDefined(minutes)){selected.setHours(hours);if(selectedmax){invalidate(true)}else{refresh("h")}}else{invalidate(true)}};hoursInputEl.bind("blur",function(e){if(!$scope.invalidHours&&$scope.hours<10){$scope.$apply(function(){$scope.hours=pad($scope.hours)})}});$scope.updateMinutes=function(){var minutes=getMinutesFromTemplate(),hours=getHoursFromTemplate();if(angular.isDefined(minutes)&&angular.isDefined(hours)){selected.setMinutes(minutes);if(selectedmax){invalidate(undefined,true)}else{refresh("m")}}else{invalidate(undefined,true)}};minutesInputEl.bind("blur",function(e){if(!$scope.invalidMinutes&&$scope.minutes<10){$scope.$apply(function(){$scope.minutes=pad($scope.minutes)})}})};this.render=function(){var date=ngModelCtrl.$viewValue;if(isNaN(date)){ngModelCtrl.$setValidity("time",false);$log.error('Timepicker directive: "ng-model" value must be a Date object, a number of milliseconds since 01.01.1970 or a string representing an RFC2822 or ISO 8601 date.')}else{if(date){selected=date}if(selectedmax){ngModelCtrl.$setValidity("time",false);$scope.invalidHours=true;$scope.invalidMinutes=true}else{makeValid()}updateTemplate()}};function refresh(keyboardChange){makeValid();ngModelCtrl.$setViewValue(new Date(selected));updateTemplate(keyboardChange)}function makeValid(){ngModelCtrl.$setValidity("time",true);$scope.invalidHours=false;$scope.invalidMinutes=false}function updateTemplate(keyboardChange){var hours=selected.getHours(),minutes=selected.getMinutes();if($scope.showMeridian){hours=hours===0||hours===12?12:hours%12}$scope.hours=keyboardChange==="h"?hours:pad(hours);if(keyboardChange!=="m"){$scope.minutes=pad(minutes)}$scope.meridian=selected.getHours()<12?meridians[0]:meridians[1]}function addMinutes(date,minutes){var dt=new Date(date.getTime()+minutes*6e4);var newDate=new Date(date);newDate.setHours(dt.getHours(),dt.getMinutes());return newDate}function addMinutesToSelected(minutes){selected=addMinutes(selected,minutes);refresh()}$scope.showSpinners=angular.isDefined($attrs.showSpinners)?$scope.$parent.$eval($attrs.showSpinners):timepickerConfig.showSpinners;$scope.incrementHours=function(){if(!$scope.noIncrementHours()){addMinutesToSelected(hourStep*60)}};$scope.decrementHours=function(){if(!$scope.noDecrementHours()){addMinutesToSelected(-hourStep*60)}};$scope.incrementMinutes=function(){if(!$scope.noIncrementMinutes()){addMinutesToSelected(minuteStep)}};$scope.decrementMinutes=function(){if(!$scope.noDecrementMinutes()){addMinutesToSelected(-minuteStep)}};$scope.toggleMeridian=function(){if(!$scope.noToggleMeridian()){addMinutesToSelected(12*60*(selected.getHours()<12?1:-1))}}}]).directive("timepicker",function(){return{restrict:"EA",require:["timepicker","?^ngModel"],controller:"TimepickerController",controllerAs:"timepicker",replace:true,scope:{},templateUrl:function(element,attrs){return attrs.templateUrl||"template/timepicker/timepicker.html"},link:function(scope,element,attrs,ctrls){var timepickerCtrl=ctrls[0],ngModelCtrl=ctrls[1];if(ngModelCtrl){timepickerCtrl.init(ngModelCtrl,element.find("input"))}}}});angular.module("ui.bootstrap.transition",[]).value("$transitionSuppressDeprecated",false).factory("$transition",["$q","$timeout","$rootScope","$log","$transitionSuppressDeprecated",function($q,$timeout,$rootScope,$log,$transitionSuppressDeprecated){if(!$transitionSuppressDeprecated){$log.warn("$transition is now deprecated. Use $animate from ngAnimate instead.")}var $transition=function(element,trigger,options){options=options||{};var deferred=$q.defer();var endEventName=$transition[options.animation?"animationEndEventName":"transitionEndEventName"];var transitionEndHandler=function(event){$rootScope.$apply(function(){element.unbind(endEventName,transitionEndHandler);deferred.resolve(element)})};if(endEventName){element.bind(endEventName,transitionEndHandler)}$timeout(function(){if(angular.isString(trigger)){element.addClass(trigger)}else if(angular.isFunction(trigger)){trigger(element)}else if(angular.isObject(trigger)){element.css(trigger)}if(!endEventName){deferred.resolve(element)}});deferred.promise.cancel=function(){if(endEventName){element.unbind(endEventName,transitionEndHandler)}deferred.reject("Transition cancelled")};return deferred.promise};var transElement=document.createElement("trans");var transitionEndEventNames={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",transition:"transitionend"};var animationEndEventNames={WebkitTransition:"webkitAnimationEnd",MozTransition:"animationend",OTransition:"oAnimationEnd",transition:"animationend"};function findEndEventName(endEventNames){for(var name in endEventNames){if(transElement.style[name]!==undefined){return endEventNames[name]}}}$transition.transitionEndEventName=findEndEventName(transitionEndEventNames);$transition.animationEndEventName=findEndEventName(animationEndEventNames);return $transition}]);angular.module("ui.bootstrap.typeahead",["ui.bootstrap.position"]).factory("typeaheadParser",["$parse",function($parse){var TYPEAHEAD_REGEXP=/^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w\d]*))\s+in\s+([\s\S]+?)$/;return{parse:function(input){var match=input.match(TYPEAHEAD_REGEXP);if(!match){throw new Error('Expected typeahead specification in form of "_modelValue_ (as _label_)? for _item_ in _collection_"'+' but got "'+input+'".')}return{itemName:match[3],source:$parse(match[4]),viewMapper:$parse(match[2]||match[1]),modelMapper:$parse(match[1])}}}}]).directive("typeahead",["$compile","$parse","$q","$timeout","$document","$window","$rootScope","$position","typeaheadParser",function($compile,$parse,$q,$timeout,$document,$window,$rootScope,$position,typeaheadParser){var HOT_KEYS=[9,13,27,38,40];var eventDebounceTime=200;return{require:["ngModel","^?ngModelOptions"],link:function(originalScope,element,attrs,ctrls){var modelCtrl=ctrls[0];var ngModelOptions=ctrls[1];var minLength=originalScope.$eval(attrs.typeaheadMinLength);if(!minLength&&minLength!==0){minLength=1}var waitTime=originalScope.$eval(attrs.typeaheadWaitMs)||0;var isEditable=originalScope.$eval(attrs.typeaheadEditable)!==false;var isLoadingSetter=$parse(attrs.typeaheadLoading).assign||angular.noop;var onSelectCallback=$parse(attrs.typeaheadOnSelect);var isSelectOnBlur=angular.isDefined(attrs.typeaheadSelectOnBlur)?originalScope.$eval(attrs.typeaheadSelectOnBlur):false;var isNoResultsSetter=$parse(attrs.typeaheadNoResults).assign||angular.noop;var inputFormatter=attrs.typeaheadInputFormatter?$parse(attrs.typeaheadInputFormatter):undefined;var appendToBody=attrs.typeaheadAppendToBody?originalScope.$eval(attrs.typeaheadAppendToBody):false;var focusFirst=originalScope.$eval(attrs.typeaheadFocusFirst)!==false;var selectOnExact=attrs.typeaheadSelectOnExact?originalScope.$eval(attrs.typeaheadSelectOnExact):false;var parsedModel=$parse(attrs.ngModel);var invokeModelSetter=$parse(attrs.ngModel+"($$$p)");var $setModelValue=function(scope,newValue){if(angular.isFunction(parsedModel(originalScope))&&ngModelOptions&&ngModelOptions.$options&&ngModelOptions.$options.getterSetter){return invokeModelSetter(scope,{$$$p:newValue})}else{return parsedModel.assign(scope,newValue)}};var parserResult=typeaheadParser.parse(attrs.typeahead);var hasFocus;var selected;var scope=originalScope.$new();var offDestroy=originalScope.$on("$destroy",function(){scope.$destroy()});scope.$on("$destroy",offDestroy);var popupId="typeahead-"+scope.$id+"-"+Math.floor(Math.random()*1e4);element.attr({"aria-autocomplete":"list","aria-expanded":false,"aria-owns":popupId});var popUpEl=angular.element("
");popUpEl.attr({id:popupId,matches:"matches",active:"activeIdx",select:"select(activeIdx)","move-in-progress":"moveInProgress",query:"query",position:"position"});if(angular.isDefined(attrs.typeaheadTemplateUrl)){popUpEl.attr("template-url",attrs.typeaheadTemplateUrl)}if(angular.isDefined(attrs.typeaheadPopupTemplateUrl)){popUpEl.attr("popup-template-url",attrs.typeaheadPopupTemplateUrl)}var resetMatches=function(){scope.matches=[];scope.activeIdx=-1;element.attr("aria-expanded",false)};var getMatchId=function(index){return popupId+"-option-"+index};scope.$watch("activeIdx",function(index){if(index<0){element.removeAttr("aria-activedescendant")}else{element.attr("aria-activedescendant",getMatchId(index))}});var inputIsExactMatch=function(inputValue,index){if(scope.matches.length>index&&inputValue){return inputValue.toUpperCase()===scope.matches[index].label.toUpperCase()}return false};var getMatchesAsync=function(inputValue){var locals={$viewValue:inputValue};isLoadingSetter(originalScope,true);isNoResultsSetter(originalScope,false);$q.when(parserResult.source(originalScope,locals)).then(function(matches){var onCurrentRequest=inputValue===modelCtrl.$viewValue;if(onCurrentRequest&&hasFocus){if(matches&&matches.length>0){scope.activeIdx=focusFirst?0:-1;isNoResultsSetter(originalScope,false);scope.matches.length=0;for(var i=0;i=minLength){if(waitTime>0){cancelPreviousTimeout();scheduleSearchWithTimeout(inputValue)}else{getMatchesAsync(inputValue)}}else{isLoadingSetter(originalScope,false);cancelPreviousTimeout();resetMatches()}if(isEditable){return inputValue}else{if(!inputValue){modelCtrl.$setValidity("editable",true);return null}else{modelCtrl.$setValidity("editable",false);return undefined}}});modelCtrl.$formatters.push(function(modelValue){var candidateViewValue,emptyViewValue;var locals={};if(!isEditable){modelCtrl.$setValidity("editable",true)}if(inputFormatter){locals.$model=modelValue;return inputFormatter(originalScope,locals)}else{locals[parserResult.itemName]=modelValue;candidateViewValue=parserResult.viewMapper(originalScope,locals);locals[parserResult.itemName]=undefined;emptyViewValue=parserResult.viewMapper(originalScope,locals);return candidateViewValue!==emptyViewValue?candidateViewValue:modelValue}});scope.select=function(activeIdx){var locals={};var model,item;selected=true;locals[parserResult.itemName]=item=scope.matches[activeIdx].model;model=parserResult.modelMapper(originalScope,locals);$setModelValue(originalScope,model);modelCtrl.$setValidity("editable",true);modelCtrl.$setValidity("parse",true);onSelectCallback(originalScope,{$item:item,$model:model,$label:parserResult.viewMapper(originalScope,locals)});resetMatches();if(scope.$eval(attrs.typeaheadFocusOnSelect)!==false){$timeout(function(){element[0].focus()},0,false)}};element.bind("keydown",function(evt){if(scope.matches.length===0||HOT_KEYS.indexOf(evt.which)===-1){return}if(scope.activeIdx===-1&&(evt.which===9||evt.which===13)){resetMatches();scope.$digest();return}evt.preventDefault();if(evt.which===40){scope.activeIdx=(scope.activeIdx+1)%scope.matches.length;scope.$digest()}else if(evt.which===38){scope.activeIdx=(scope.activeIdx>0?scope.activeIdx:scope.matches.length)-1;scope.$digest()}else if(evt.which===13||evt.which===9){scope.$apply(function(){scope.select(scope.activeIdx)})}else if(evt.which===27){evt.stopPropagation();resetMatches();scope.$digest()}});element.bind("blur",function(){if(isSelectOnBlur&&scope.matches.length&&scope.activeIdx!==-1&&!selected){selected=true;scope.$apply(function(){scope.select(scope.activeIdx)})}hasFocus=false;selected=false});var dismissClickHandler=function(evt){if(element[0]!==evt.target&&evt.which!==3&&scope.matches.length!==0){resetMatches();if(!$rootScope.$$phase){scope.$digest()}}};$document.bind("click",dismissClickHandler);originalScope.$on("$destroy",function(){$document.unbind("click",dismissClickHandler);if(appendToBody){$popup.remove()}popUpEl.remove()});var $popup=$compile(popUpEl)(scope);if(appendToBody){$document.find("body").append($popup)}else{element.after($popup)}}}}]).directive("typeaheadPopup",function(){return{restrict:"EA",scope:{matches:"=",query:"=",active:"=",position:"&",moveInProgress:"=",select:"&"},replace:true,templateUrl:function(element,attrs){return attrs.popupTemplateUrl||"template/typeahead/typeahead-popup.html"},link:function(scope,element,attrs){scope.templateUrl=attrs.templateUrl;scope.isOpen=function(){return scope.matches.length>0};scope.isActive=function(matchIdx){return scope.active==matchIdx};scope.selectActive=function(matchIdx){scope.active=matchIdx};scope.selectMatch=function(activeIdx){scope.select({activeIdx:activeIdx})}}}}).directive("typeaheadMatch",["$templateRequest","$compile","$parse",function($templateRequest,$compile,$parse){return{restrict:"EA",scope:{index:"=",match:"=",query:"="},link:function(scope,element,attrs){var tplUrl=$parse(attrs.templateUrl)(scope.$parent)||"template/typeahead/typeahead-match.html";$templateRequest(tplUrl).then(function(tplContent){$compile(tplContent.trim())(scope,function(clonedElement){element.replaceWith(clonedElement)})})}}}]).filter("typeaheadHighlight",["$sce","$injector","$log",function($sce,$injector,$log){var isSanitizePresent;isSanitizePresent=$injector.has("$sanitize");function escapeRegexp(queryToEscape){return queryToEscape.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")}function containsHtml(matchItem){return/<.*>/g.test(matchItem)}return function(matchItem,query){if(!isSanitizePresent&&containsHtml(matchItem)){$log.warn("Unsafe use of typeahead please use ngSanitize")}matchItem=query?(""+matchItem).replace(new RegExp(escapeRegexp(query),"gi"),"$&"):matchItem;if(!isSanitizePresent){matchItem=$sce.trustAsHtml(matchItem)}return matchItem}}]);angular.module("template/accordion/accordion-group.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/accordion/accordion-group.html","
\n"+'
\n'+'

\n'+' {{heading}}\n'+"

\n"+"
\n"+'
\n'+'
\n'+"
\n"+"
\n"+"")}]);angular.module("template/accordion/accordion.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/accordion/accordion.html",'
')}]);angular.module("template/alert/alert.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/alert/alert.html","
\n"+' \n"+"
\n"+"
\n"+"")}]);angular.module("template/carousel/carousel.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/carousel/carousel.html",'\n"+"")}]);angular.module("template/carousel/slide.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/carousel/slide.html",'
\n'+"")}]);angular.module("template/datepicker/datepicker.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/datepicker/datepicker.html",'
\n'+' \n'+' \n'+' \n'+"
")}]);angular.module("template/datepicker/day.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/datepicker/day.html",'\n'+" \n"+" \n"+' \n'+' \n'+' \n'+" \n"+" \n"+' \n'+' \n'+" \n"+" \n"+" \n"+' \n'+' \n'+' \n"+" \n"+" \n"+"
{{::label.abbr}}
{{ weekNumbers[$index] }}\n'+' \n'+"
\n"+""); }]);angular.module("template/datepicker/month.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/datepicker/month.html",'\n'+" \n"+" \n"+' \n'+' \n'+' \n'+" \n"+" \n"+" \n"+' \n'+' \n"+" \n"+" \n"+"
\n'+' \n'+"
\n"+"")}]);angular.module("template/datepicker/popup.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/datepicker/popup.html",'\n"+"")}]);angular.module("template/datepicker/year.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/datepicker/year.html",'\n'+" \n"+" \n"+' \n'+' \n'+' \n'+" \n"+" \n"+" \n"+' \n'+' \n"+" \n"+" \n"+"
\n'+' \n'+"
\n"+"")}]);angular.module("template/modal/backdrop.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/modal/backdrop.html",'\n"+"")}]);angular.module("template/modal/window.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/modal/window.html",'\n"+"")}]);angular.module("template/pagination/pager.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/pagination/pager.html",'\n"+"")}]);angular.module("template/pagination/pagination.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/pagination/pagination.html",'\n"+"")}]);angular.module("template/tooltip/tooltip-html-popup.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/tooltip/tooltip-html-popup.html",'
\n'+'
\n'+'
\n'+"
\n"+"")}]);angular.module("template/tooltip/tooltip-html-unsafe-popup.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/tooltip/tooltip-html-unsafe-popup.html",'
\n'+'
\n'+'
\n'+"
\n"+"")}]);angular.module("template/tooltip/tooltip-popup.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/tooltip/tooltip-popup.html",'
\n'+'
\n'+'
\n'+"
\n"+"")}]);angular.module("template/tooltip/tooltip-template-popup.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/tooltip/tooltip-template-popup.html",'
\n'+'
\n'+'
\n'+"
\n"+"")}]);angular.module("template/popover/popover-html.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/popover/popover-html.html",'
\n'+'
\n'+"\n"+'
\n'+'

\n'+'
\n'+"
\n"+"
\n"+"")}]);angular.module("template/popover/popover-template.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/popover/popover-template.html",'
\n'+'
\n'+"\n"+'
\n'+'

\n'+'
\n'+"
\n"+"
\n"+"")}]);angular.module("template/popover/popover.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/popover/popover.html",'
\n'+'
\n'+"\n"+'
\n'+'

\n'+'
\n'+"
\n"+"
\n"+"")}]);angular.module("template/progressbar/bar.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/progressbar/bar.html",'
\n'+"")}]);angular.module("template/progressbar/progress.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/progressbar/progress.html",'
')}]);angular.module("template/progressbar/progressbar.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/progressbar/progressbar.html",'
\n'+'
\n'+"
\n"+"")}]);angular.module("template/rating/rating.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/rating/rating.html",'\n'+" ({{ $index < value ? '*' : ' ' }})\n"+' \n'+"\n"+"")}]);angular.module("template/tabs/tab.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/tabs/tab.html",'
  • \n'+' {{heading}}\n'+"
  • \n"+"")}]);angular.module("template/tabs/tabset.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/tabs/tabset.html","
    \n"+"
      \n"+'
      \n'+'
      \n'+"
      \n"+"
      \n"+"
      \n"+"")}]);angular.module("template/timepicker/timepicker.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/timepicker/timepicker.html","\n"+" \n"+' \n'+' \n'+" \n"+' \n'+' \n'+" \n"+" \n"+' \n"+" \n"+' \n"+' \n'+" \n"+' \n'+' \n'+" \n"+' \n'+' \n'+" \n"+" \n"+"
       
      \n'+' \n'+" :\n'+' \n'+"
       
      \n"+"")}]);angular.module("template/typeahead/typeahead-match.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/typeahead/typeahead-match.html",'\n'+"")}]);angular.module("template/typeahead/typeahead-popup.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/typeahead/typeahead-popup.html",'\n"+"")}]);!angular.$$csp()&&angular.element(document).find("head").prepend('');"use strict";var WaveSurfer={defaultParams:{height:128,waveColor:"#999",progressColor:"#555",cursorColor:"#333",cursorWidth:1,skipLength:2,minPxPerSec:20,pixelRatio:window.devicePixelRatio,fillParent:!0,scrollParent:!1,hideScrollbar:!1,normalize:!1,audioContext:null,container:null,dragSelection:!0,loopSelection:!0,audioRate:1,interact:!0,splitChannels:!1,renderer:"Canvas",backend:"WebAudio",mediaType:"audio"},init:function(a){if(this.params=WaveSurfer.util.extend({},this.defaultParams,a),this.container="string"==typeof a.container?document.querySelector(this.params.container):this.params.container,!this.container)throw new Error("Container element not found");if("undefined"==typeof this.params.mediaContainer?this.mediaContainer=this.container:"string"==typeof this.params.mediaContainer?this.mediaContainer=document.querySelector(this.params.mediaContainer):this.mediaContainer=this.params.mediaContainer,!this.mediaContainer)throw new Error("Media Container element not found");this.savedVolume=0,this.isMuted=!1,this.tmpEvents=[],this.createDrawer(),this.createBackend()},createDrawer:function(){var a=this;this.drawer=Object.create(WaveSurfer.Drawer[this.params.renderer]),this.drawer.init(this.container,this.params),this.drawer.on("redraw",function(){a.drawBuffer(),a.drawer.progress(a.backend.getPlayedPercents())}),this.drawer.on("click",function(b,c){setTimeout(function(){a.seekTo(c)},0)}),this.drawer.on("scroll",function(b){a.fireEvent("scroll",b)})},createBackend:function(){var a=this;this.backend&&this.backend.destroy(),"AudioElement"==this.params.backend&&(this.params.backend="MediaElement"),"WebAudio"!=this.params.backend||WaveSurfer.WebAudio.supportsWebAudio()||(this.params.backend="MediaElement"),this.backend=Object.create(WaveSurfer[this.params.backend]),this.backend.init(this.params),this.backend.on("finish",function(){a.fireEvent("finish")}),this.backend.on("play",function(){a.fireEvent("play")}),this.backend.on("pause",function(){a.fireEvent("pause")}),this.backend.on("audioprocess",function(b){a.drawer.progress(a.backend.getPlayedPercents()),a.fireEvent("audioprocess",b)})},getDuration:function(){return this.backend.getDuration()},getCurrentTime:function(){return this.backend.getCurrentTime()},play:function(a,b){this.backend.play(a,b)},pause:function(){this.backend.pause()},playPause:function(){this.backend.isPaused()?this.play():this.pause()},isPlaying:function(){return!this.backend.isPaused()},skipBackward:function(a){this.skip(-a||-this.params.skipLength)},skipForward:function(a){this.skip(a||this.params.skipLength)},skip:function(a){var b=this.getCurrentTime()||0,c=this.getDuration()||1;b=Math.max(0,Math.min(c,b+(a||0))),this.seekAndCenter(b/c)},seekAndCenter:function(a){this.seekTo(a),this.drawer.recenter(a)},seekTo:function(a){var b=this.backend.isPaused(),c=this.params.scrollParent;b&&(this.params.scrollParent=!1),this.backend.seekTo(a*this.getDuration()),this.drawer.progress(this.backend.getPlayedPercents()),b||(this.backend.pause(),this.backend.play()),this.params.scrollParent=c,this.fireEvent("seek",a)},stop:function(){this.pause(),this.seekTo(0),this.drawer.progress(0)},setVolume:function(a){this.backend.setVolume(a)},setPlaybackRate:function(a){this.backend.setPlaybackRate(a)},toggleMute:function(){this.isMuted?(this.backend.setVolume(this.savedVolume),this.isMuted=!1):(this.savedVolume=this.backend.getVolume(),this.backend.setVolume(0),this.isMuted=!0)},toggleScroll:function(){this.params.scrollParent=!this.params.scrollParent,this.drawBuffer()},toggleInteraction:function(){this.params.interact=!this.params.interact},drawBuffer:function(){var a=Math.round(this.getDuration()*this.params.minPxPerSec*this.params.pixelRatio),b=this.drawer.getWidth(),c=a;this.params.fillParent&&(!this.params.scrollParent||b>a)&&(c=b);var d=this.backend.getPeaks(c);this.drawer.drawPeaks(d,c),this.fireEvent("redraw",d,c)},zoom:function(a){this.params.minPxPerSec=a,this.params.scrollParent=!0,this.drawBuffer(),this.seekAndCenter(this.getCurrentTime()/this.getDuration())},loadArrayBuffer:function(a){this.decodeArrayBuffer(a,function(a){this.loadDecodedBuffer(a)}.bind(this))},loadDecodedBuffer:function(a){this.backend.load(a),this.drawBuffer(),this.fireEvent("ready")},loadBlob:function(a){var b=this,c=new FileReader;c.addEventListener("progress",function(a){b.onProgress(a)}),c.addEventListener("load",function(a){b.loadArrayBuffer(a.target.result)}),c.addEventListener("error",function(){b.fireEvent("error","Error reading file")}),c.readAsArrayBuffer(a),this.empty()},load:function(a,b){switch(this.params.backend){case"WebAudio":return this.loadBuffer(a);case"MediaElement":return this.loadMediaElement(a,b)}},loadBuffer:function(a){return this.empty(),this.getArrayBuffer(a,this.loadArrayBuffer.bind(this))},loadMediaElement:function(a,b){this.empty(),this.backend.load(a,this.mediaContainer,b),this.tmpEvents.push(this.backend.once("canplay",function(){this.drawBuffer(),this.fireEvent("ready")}.bind(this)),this.backend.once("error",function(a){this.fireEvent("error",a)}.bind(this))),!b&&this.backend.supportsWebAudio()&&this.getArrayBuffer(a,function(a){this.decodeArrayBuffer(a,function(a){this.backend.buffer=a,this.drawBuffer()}.bind(this))}.bind(this))},decodeArrayBuffer:function(a,b){this.backend.decodeArrayBuffer(a,this.fireEvent.bind(this,"decoded"),this.fireEvent.bind(this,"error","Error decoding audiobuffer")),this.tmpEvents.push(this.once("decoded",b))},getArrayBuffer:function(a,b){var c=this,d=WaveSurfer.util.ajax({url:a,responseType:"arraybuffer"});return this.tmpEvents.push(d.on("progress",function(a){c.onProgress(a)}),d.on("success",b),d.on("error",function(a){c.fireEvent("error","XHR error: "+a.target.statusText)})),d},onProgress:function(a){if(a.lengthComputable)var b=a.loaded/a.total;else b=a.loaded/(a.loaded+1e6);this.fireEvent("loading",Math.round(100*b),a.target)},exportPCM:function(a,b,c){a=a||1024,b=b||1e4,c=c||!1;var d=this.backend.getPeaks(a,b),e=[].map.call(d,function(a){return Math.round(a*b)/b}),f=JSON.stringify(e);return c||window.open("data:application/json;charset=utf-8,"+encodeURIComponent(f)),f},clearTmpEvents:function(){this.tmpEvents.forEach(function(a){a.un()})},empty:function(){this.backend.isPaused()||(this.stop(),this.backend.disconnectSource()),this.clearTmpEvents(),this.drawer.progress(0),this.drawer.setWidth(0),this.drawer.drawPeaks({length:this.drawer.getWidth()},0)},destroy:function(){this.fireEvent("destroy"),this.clearTmpEvents(),this.unAll(),this.backend.destroy(),this.drawer.destroy()}};WaveSurfer.create=function(a){var b=Object.create(WaveSurfer);return b.init(a),b},WaveSurfer.util={extend:function(a){var b=Array.prototype.slice.call(arguments,1);return b.forEach(function(b){Object.keys(b).forEach(function(c){a[c]=b[c]})}),a},getId:function(){return"wavesurfer_"+Math.random().toString(32).substring(2)},ajax:function(a){var b=Object.create(WaveSurfer.Observer),c=new XMLHttpRequest,d=!1;return c.open(a.method||"GET",a.url,!0),c.responseType=a.responseType||"json",c.addEventListener("progress",function(a){b.fireEvent("progress",a),a.lengthComputable&&a.loaded==a.total&&(d=!0)}),c.addEventListener("load",function(a){d||b.fireEvent("progress",a),b.fireEvent("load",a),200==c.status||206==c.status?b.fireEvent("success",c.response,a):b.fireEvent("error",a)}),c.addEventListener("error",function(a){b.fireEvent("error",a)}),c.send(),b.xhr=c,b}},WaveSurfer.Observer={on:function(a,b){this.handlers||(this.handlers={});var c=this.handlers[a];return c||(c=this.handlers[a]=[]),c.push(b),{name:a,callback:b,un:this.un.bind(this,a,b)}},un:function(a,b){if(this.handlers){var c=this.handlers[a];if(c)if(b)for(var d=c.length-1;d>=0;d--)c[d]==b&&c.splice(d,1);else c.length=0}},unAll:function(){this.handlers=null},once:function(a,b){var c=this,d=function(){b.apply(this,arguments),setTimeout(function(){c.un(a,d)},0)};return this.on(a,d)},fireEvent:function(a){if(this.handlers){var b=this.handlers[a],c=Array.prototype.slice.call(arguments,1);b&&b.forEach(function(a){a.apply(null,c)})}}},WaveSurfer.util.extend(WaveSurfer,WaveSurfer.Observer),WaveSurfer.WebAudio={scriptBufferSize:256,PLAYING_STATE:0,PAUSED_STATE:1,FINISHED_STATE:2,supportsWebAudio:function(){return!(!window.AudioContext&&!window.webkitAudioContext)},getAudioContext:function(){return WaveSurfer.WebAudio.audioContext||(WaveSurfer.WebAudio.audioContext=new(window.AudioContext||window.webkitAudioContext)),WaveSurfer.WebAudio.audioContext},getOfflineAudioContext:function(a){return WaveSurfer.WebAudio.offlineAudioContext||(WaveSurfer.WebAudio.offlineAudioContext=new(window.OfflineAudioContext||window.webkitOfflineAudioContext)(1,2,a)),WaveSurfer.WebAudio.offlineAudioContext},init:function(a){this.params=a,this.ac=a.audioContext||this.getAudioContext(),this.lastPlay=this.ac.currentTime,this.startPosition=0,this.scheduledPause=null,this.states=[Object.create(WaveSurfer.WebAudio.state.playing),Object.create(WaveSurfer.WebAudio.state.paused),Object.create(WaveSurfer.WebAudio.state.finished)],this.createVolumeNode(),this.createScriptNode(),this.createAnalyserNode(),this.setState(this.PAUSED_STATE),this.setPlaybackRate(this.params.audioRate)},disconnectFilters:function(){this.filters&&(this.filters.forEach(function(a){a&&a.disconnect()}),this.filters=null,this.analyser.connect(this.gainNode))},setState:function(a){this.state!==this.states[a]&&(this.state=this.states[a],this.state.init.call(this))},setFilter:function(){this.setFilters([].slice.call(arguments))},setFilters:function(a){this.disconnectFilters(),a&&a.length&&(this.filters=a,this.analyser.disconnect(),a.reduce(function(a,b){return a.connect(b),b},this.analyser).connect(this.gainNode))},createScriptNode:function(){this.ac.createScriptProcessor?this.scriptNode=this.ac.createScriptProcessor(this.scriptBufferSize):this.scriptNode=this.ac.createJavaScriptNode(this.scriptBufferSize),this.scriptNode.connect(this.ac.destination)},addOnAudioProcess:function(){var a=this;this.scriptNode.onaudioprocess=function(){var b=a.getCurrentTime();b>=a.getDuration()?(a.setState(a.FINISHED_STATE),a.fireEvent("pause")):b>=a.scheduledPause?(a.setState(a.PAUSED_STATE),a.fireEvent("pause")):a.state===a.states[a.PLAYING_STATE]&&a.fireEvent("audioprocess",b)}},removeOnAudioProcess:function(){this.scriptNode.onaudioprocess=null},createAnalyserNode:function(){this.analyser=this.ac.createAnalyser(),this.analyser.connect(this.gainNode)},createVolumeNode:function(){this.ac.createGain?this.gainNode=this.ac.createGain():this.gainNode=this.ac.createGainNode(),this.gainNode.connect(this.ac.destination)},setVolume:function(a){this.gainNode.gain.value=a},getVolume:function(){return this.gainNode.gain.value},decodeArrayBuffer:function(a,b,c){this.offlineAc||(this.offlineAc=this.getOfflineAudioContext(this.ac?this.ac.sampleRate:44100)),this.offlineAc.decodeAudioData(a,function(a){b(a)}.bind(this),c)},getPeaks:function(a){for(var b=this.buffer.length/a,c=~~(b/10)||1,d=this.buffer.numberOfChannels,e=[],f=[],g=0;d>g;g++)for(var h=e[g]=[],i=this.buffer.getChannelData(g),j=0;a>j;j++){for(var k=~~(j*b),l=~~(k+b),m=i[0],n=i[0],o=k;l>o;o+=c){var p=i[o];p>n&&(n=p),m>p&&(m=p)}h[2*j]=n,h[2*j+1]=m,(0==g||n>f[2*j])&&(f[2*j]=n),(0==g||m=this.getDuration()&&(a=0)),null==b&&(b=this.getDuration()),this.startPosition=a,this.lastPlay=this.ac.currentTime,this.state===this.states[this.FINISHED_STATE]&&this.setState(this.PAUSED_STATE),{start:a,end:b}},getPlayedTime:function(){return(this.ac.currentTime-this.lastPlay)*this.playbackRate},play:function(a,b){this.createSource();var c=this.seekTo(a,b);a=c.start,b=c.end,this.scheduledPause=b,this.source.start(0,a,b-a),this.setState(this.PLAYING_STATE),this.fireEvent("play")},pause:function(){this.scheduledPause=null,this.startPosition+=this.getPlayedTime(),this.source&&this.source.stop(0),this.setState(this.PAUSED_STATE),this.fireEvent("pause")},getCurrentTime:function(){return this.state.getCurrentTime.call(this)},setPlaybackRate:function(a){a=a||1,this.isPaused()?this.playbackRate=a:(this.pause(),this.playbackRate=a,this.play())}},WaveSurfer.WebAudio.state={},WaveSurfer.WebAudio.state.playing={init:function(){this.addOnAudioProcess()},getPlayedPercents:function(){var a=this.getDuration();return this.getCurrentTime()/a||0},getCurrentTime:function(){return this.startPosition+this.getPlayedTime()}},WaveSurfer.WebAudio.state.paused={init:function(){this.removeOnAudioProcess()},getPlayedPercents:function(){var a=this.getDuration();return this.getCurrentTime()/a||0},getCurrentTime:function(){return this.startPosition}},WaveSurfer.WebAudio.state.finished={init:function(){this.removeOnAudioProcess(),this.fireEvent("finish")},getPlayedPercents:function(){return 1},getCurrentTime:function(){return this.getDuration()}},WaveSurfer.util.extend(WaveSurfer.WebAudio,WaveSurfer.Observer),WaveSurfer.MediaElement=Object.create(WaveSurfer.WebAudio),WaveSurfer.util.extend(WaveSurfer.MediaElement,{init:function(a){this.params=a,this.media={currentTime:0,duration:0,paused:!0,playbackRate:1,play:function(){},pause:function(){}},this.mediaType=a.mediaType.toLowerCase(),this.elementPosition=a.elementPosition},load:function(a,b,c){var d=this,e=document.createElement(this.mediaType);e.controls=!1,e.autoplay=!1,e.preload="auto",e.src=a,e.addEventListener("error",function(){d.fireEvent("error","Error loading media element")}),e.addEventListener("canplay",function(){d.fireEvent("canplay")}),e.addEventListener("ended",function(){d.fireEvent("finish")}),e.addEventListener("timeupdate",function(){d.fireEvent("audioprocess",d.getCurrentTime())});var f=b.querySelector(this.mediaType);f&&b.removeChild(f),b.appendChild(e),this.media=e,this.peaks=c,this.onPlayEnd=null,this.buffer=null,this.setPlaybackRate(this.playbackRate)},isPaused:function(){return!this.media||this.media.paused},getDuration:function(){var a=this.media.duration;return a>=1/0&&(a=this.media.seekable.end()),a},getCurrentTime:function(){return this.media&&this.media.currentTime},getPlayedPercents:function(){return this.getCurrentTime()/this.getDuration()||0},setPlaybackRate:function(a){this.playbackRate=a||1,this.media.playbackRate=this.playbackRate},seekTo:function(a){null!=a&&(this.media.currentTime=a),this.clearPlayEnd()},play:function(a,b){this.seekTo(a),this.media.play(),b&&this.setPlayEnd(b),this.fireEvent("play")},pause:function(){this.media&&this.media.pause(),this.clearPlayEnd(),this.fireEvent("pause")},setPlayEnd:function(a){var b=this;this.onPlayEnd=function(c){c>=a&&(b.pause(),b.seekTo(a))},this.on("audioprocess",this.onPlayEnd)},clearPlayEnd:function(){this.onPlayEnd&&(this.un("audioprocess",this.onPlayEnd),this.onPlayEnd=null)},getPeaks:function(a){return this.buffer?WaveSurfer.WebAudio.getPeaks.call(this,a):this.peaks||[]},getVolume:function(){return this.media.volume},setVolume:function(a){this.media.volume=a},destroy:function(){this.pause(),this.unAll(),this.media&&this.media.parentNode&&this.media.parentNode.removeChild(this.media),this.media=null}}),WaveSurfer.AudioElement=WaveSurfer.MediaElement,WaveSurfer.Drawer={init:function(a,b){this.container=a,this.params=b,this.width=0,this.height=b.height*this.params.pixelRatio,this.lastPos=0,this.createWrapper(),this.createElements()},createWrapper:function(){ this.wrapper=this.container.appendChild(document.createElement("wave")),this.style(this.wrapper,{display:"block",position:"relative",userSelect:"none",webkitUserSelect:"none",height:this.params.height+"px"}),(this.params.fillParent||this.params.scrollParent)&&this.style(this.wrapper,{width:"100%",overflowX:this.params.hideScrollbar?"hidden":"auto",overflowY:"hidden"}),this.setupWrapperEvents()},handleEvent:function(a){a.preventDefault();var b=this.wrapper.getBoundingClientRect();return(a.clientX-b.left+this.wrapper.scrollLeft)/this.wrapper.scrollWidth||0},setupWrapperEvents:function(){var a=this;this.wrapper.addEventListener("click",function(b){var c=a.wrapper.offsetHeight-a.wrapper.clientHeight;if(0!=c){var d=a.wrapper.getBoundingClientRect();if(b.clientY>=d.bottom-c)return}a.params.interact&&a.fireEvent("click",b,a.handleEvent(b))}),this.wrapper.addEventListener("scroll",function(b){a.fireEvent("scroll",b)})},drawPeaks:function(a,b){this.resetScroll(),this.setWidth(b),this.params.barWidth?this.drawBars(a):this.drawWave(a)},style:function(a,b){return Object.keys(b).forEach(function(c){a.style[c]!==b[c]&&(a.style[c]=b[c])}),a},resetScroll:function(){null!==this.wrapper&&(this.wrapper.scrollLeft=0)},recenter:function(a){var b=this.wrapper.scrollWidth*a;this.recenterOnPosition(b,!0)},recenterOnPosition:function(a,b){var c=this.wrapper.scrollLeft,d=~~(this.wrapper.clientWidth/2),e=a-d,f=e-c,g=this.wrapper.scrollWidth-this.wrapper.clientWidth;if(0!=g){if(!b&&f>=-d&&d>f){var h=5;f=Math.max(-h,Math.min(h,f)),e=c+f}e=Math.max(0,Math.min(g,e)),e!=c&&(this.wrapper.scrollLeft=e)}},getWidth:function(){return Math.round(this.container.clientWidth*this.params.pixelRatio)},setWidth:function(a){a!=this.width&&(this.width=a,this.params.fillParent||this.params.scrollParent?this.style(this.wrapper,{width:""}):this.style(this.wrapper,{width:~~(this.width/this.params.pixelRatio)+"px"}),this.updateSize())},setHeight:function(a){a!=this.height&&(this.height=a,this.style(this.wrapper,{height:~~(this.height/this.params.pixelRatio)+"px"}),this.updateSize())},progress:function(a){var b=1/this.params.pixelRatio,c=Math.round(a*this.width)*b;if(c=b){if(this.lastPos=c,this.params.scrollParent){var d=~~(this.wrapper.scrollWidth*a);this.recenterOnPosition(d)}this.updateProgress(a)}},destroy:function(){this.unAll(),this.wrapper&&(this.container.removeChild(this.wrapper),this.wrapper=null)},createElements:function(){},updateSize:function(){},drawWave:function(a,b){},clearWave:function(){},updateProgress:function(a){}},WaveSurfer.util.extend(WaveSurfer.Drawer,WaveSurfer.Observer),WaveSurfer.Drawer.Canvas=Object.create(WaveSurfer.Drawer),WaveSurfer.util.extend(WaveSurfer.Drawer.Canvas,{createElements:function(){var a=this.wrapper.appendChild(this.style(document.createElement("canvas"),{position:"absolute",zIndex:1,left:0,top:0,bottom:0}));if(this.waveCc=a.getContext("2d"),this.progressWave=this.wrapper.appendChild(this.style(document.createElement("wave"),{position:"absolute",zIndex:2,left:0,top:0,bottom:0,overflow:"hidden",width:"0",display:"none",boxSizing:"border-box",borderRightStyle:"solid",borderRightWidth:this.params.cursorWidth+"px",borderRightColor:this.params.cursorColor})),this.params.waveColor!=this.params.progressColor){var b=this.progressWave.appendChild(document.createElement("canvas"));this.progressCc=b.getContext("2d")}},updateSize:function(){var a=Math.round(this.width/this.params.pixelRatio);this.waveCc.canvas.width=this.width,this.waveCc.canvas.height=this.height,this.style(this.waveCc.canvas,{width:a+"px"}),this.style(this.progressWave,{display:"block"}),this.progressCc&&(this.progressCc.canvas.width=this.width,this.progressCc.canvas.height=this.height,this.style(this.progressCc.canvas,{width:a+"px"})),this.clearWave()},clearWave:function(){this.waveCc.clearRect(0,0,this.width,this.height),this.progressCc&&this.progressCc.clearRect(0,0,this.width,this.height)},drawBars:function(a,b){if(a[0]instanceof Array){var c=a;if(this.params.splitChannels)return this.setHeight(c.length*this.params.height*this.params.pixelRatio),void c.forEach(this.drawBars,this);a=c[0]}var d=.5/this.params.pixelRatio,e=this.width,f=this.params.height*this.params.pixelRatio,g=f*b||0,h=f/2,i=~~(a.length/2),j=this.params.barWidth*this.params.pixelRatio,k=Math.max(this.params.pixelRatio,~~(j/2)),l=j+k,m=1;if(this.params.normalize){var n,o;o=Math.max.apply(Math,a),n=Math.min.apply(Math,a),m=o,-n>m&&(m=-n)}var p=i/e;this.waveCc.fillStyle=this.params.waveColor,this.progressCc&&(this.progressCc.fillStyle=this.params.progressColor),[this.waveCc,this.progressCc].forEach(function(b){if(b)if(this.params.reflection)for(var c=0;e>c;c+=l){var f=Math.round(a[2*c*p]/m*h);b.fillRect(c+d,h-f+g,j+d,2*f)}else{for(var c=0;e>c;c+=l){var f=Math.round(a[2*c*p]/m*h);b.fillRect(c+d,h-f+g,j+d,f)}for(var c=0;e>c;c+=l){var f=Math.round(a[2*c*p+1]/m*h);b.fillRect(c+d,h-f+g,j+d,f)}}},this)},drawWave:function(a,b){if(a[0]instanceof Array){var c=a;if(this.params.splitChannels)return this.setHeight(c.length*this.params.height*this.params.pixelRatio),void c.forEach(this.drawWave,this);a=c[0]}var d=.5/this.params.pixelRatio,e=this.params.height*this.params.pixelRatio,f=e*b||0,g=e/2,h=~~(a.length/2),i=1;this.params.fillParent&&this.width!=h&&(i=this.width/h);var j=1;if(this.params.normalize){var k,l;l=Math.max.apply(Math,a),k=Math.min.apply(Math,a),j=l,-k>j&&(j=-k)}this.waveCc.fillStyle=this.params.waveColor,this.progressCc&&(this.progressCc.fillStyle=this.params.progressColor),[this.waveCc,this.progressCc].forEach(function(b){if(b){b.beginPath(),b.moveTo(d,g+f);for(var c=0;h>c;c++){var e=Math.round(a[2*c]/j*g);b.lineTo(c*i+d,g-e+f)}for(var c=h-1;c>=0;c--){var e=Math.round(a[2*c+1]/j*g);b.lineTo(c*i+d,g-e+f)}b.closePath(),b.fill(),b.fillRect(0,g+f-d,this.width,d)}},this)},updateProgress:function(a){var b=Math.round(this.width*a)/this.params.pixelRatio;this.style(this.progressWave,{width:b+"px"})}});"use strict";var elan=function(){var elan={};var _forEach=Array.prototype.forEach;var _map=Array.prototype.map;elan.TimeSlot=function(id,value){this.id=id;this.value=value};elan.Annotation=function(id,value,timeslotRef1,timeslotRef2){this.id=id;this.value=value;this.timeslotRef1=timeslotRef1;this.timeslotRef2=timeslotRef2};elan.Tier=function(id,linguisticTypeRef,defaultLocale,annotations){this.id=id;this.defaultLocale=defaultLocale;this.linguisticTypeRef=linguisticTypeRef;this.annotations=annotations};elan.Document=function(){this.mediaFile="";this.mediaUrl="";this.mediaType="";this.timeslots=[];this.tiers=[];this.lastUsedTierId=0;this.lastUsedAnnoationId=0;this.lastUsedTimeSlotId=0;var timeslotExists=function(ts,list){for(var i=0;ib.value){return 1}if(a.value0&&pageNumber<=$scope.pageCount){$scope.pageIndex=pageNumber;loadEntries()}};$scope.range=function(min,max,step){step=step||1;var input=[];for(var i=min;i<=max;i+=step){input.push(i)}return input};$scope.enableInput=function(clientId,objectId,entityType){if(!$scope.isInputEnabled(clientId,objectId,entityType)){enabledInputs.push({clientId:clientId,objectId:objectId,entityType:entityType})}else{$scope.disableInput(clientId,objectId,entityType)}};$scope.isInputEnabled=function(clientId,objectId,entityType){for(var i=0;i=0){enabledInputs.splice(removeIndex,1)}};$scope.addedByUser=function(entry){return entry.client_id==$("#clientId").data("lingvodoc")};$scope.addNewLexicalEntry=function(){var createLexicalEntryUrl=$("#createLexicalEntryUrl").data("lingvodoc");$http.post(createLexicalEntryUrl).success(function(data,status,headers,config){$scope.lexicalEntries.unshift({client_id:data.client_id,object_id:data.object_id,contains:[]})}).error(function(data,status,headers,config){alert("Failed to create lexical entry!")})};$scope.saveTextValue=function(entry,field,event,parent){if(event.target.value){$scope.saveValue(entry,field,new model.TextValue(event.target.value),parent)}};$scope.saveSoundValue=function(entry,field,fileName,fileType,fileContent,parent){var value=new model.SoundValue(fileName,fileType,fileContent);$scope.saveValue(entry,field,value,parent)};$scope.saveImageValue=function(entry,field,fileName,fileType,fileContent,parent){var value=new model.ImageValue(fileName,fileType,fileContent);$scope.saveValue(entry,field,value,parent)};$scope.saveMarkupValue=function(entry,field,fileName,fileType,fileContent,parent){var value=new model.MarkupValue(fileName,fileType,fileContent);$scope.saveValue(entry,field,value,parent)};$scope.editGroup=function(entry,field,values){var modalInstance=$modal.open({animation:true,templateUrl:"editGroupModal.html",controller:"editGroupController",size:"lg",resolve:{groupParams:function(){return{entry:entry,field:field,values:values}}}});modalInstance.result.then(function(value){},function(){})};$scope.editGroupingTag=function(entry,field,values){var modalInstance=$modal.open({animation:true,templateUrl:"editGroupingTagModal.html",controller:"editGroupingTagController",size:"lg",resolve:{groupParams:function(){return{clientId:entry.client_id,objectId:entry.object_id,fields:$scope.fields}}}});modalInstance.result.then(function(value){},function(){})};$scope.saveValue=function(entry,field,value,parent){var url;if(field.level){switch(field.level){case"leveloneentity":url="/dictionary/"+encodeURIComponent(dictionaryClientId)+"/"+encodeURIComponent(dictionaryObjectId)+"/perspective/"+encodeURIComponent(perspectiveClientId)+"/"+encodeURIComponent(perspectiveId)+"/lexical_entry/"+encodeURIComponent(entry.client_id)+"/"+encodeURIComponent(entry.object_id)+"/leveloneentity";break;case"leveltwoentity":if(parent.client_id&&parent.object_id){url="/dictionary/"+encodeURIComponent(dictionaryClientId)+"/"+encodeURIComponent(dictionaryObjectId)+"/perspective/"+encodeURIComponent(perspectiveClientId)+"/"+encodeURIComponent(perspectiveId)+"/lexical_entry/"+encodeURIComponent(entry.client_id)+"/"+encodeURIComponent(entry.object_id)+"/leveloneentity/"+encodeURIComponent(parent.client_id)+"/"+encodeURIComponent(parent.object_id)+"/leveltwoentity"}else{$log.error("Attempting to create Level2 entry with no Level1 entry.");return}break;case"groupingentity":return;break}var entryObject=value.export();entryObject["entity_type"]=field.entity_type;entryObject["locale_id"]=1;entryObject["metadata"]={};$http.post(url,entryObject).success(function(data,status,headers,config){if(data.client_id&&data.object_id){entryObject.client_id=data.client_id;entryObject.object_id=data.object_id;var getSavedEntityUrl="/leveloneentity/"+data.client_id+"/"+data.object_id;$http.get(getSavedEntityUrl).success(function(data,status,headers,config){for(var i=0;i<$scope.lexicalEntries.length;i++){if($scope.lexicalEntries[i].object_id==entry.object_id&&$scope.lexicalEntries[i].client_id==entry.client_id){$scope.lexicalEntries[i].contains.push(data);break}}$scope.disableInput(entry.client_id,entry.object_id,field.entity_type)}).error(function(data,status,headers,config){})}}).error(function(data,status,headers,config){})}};$scope.removeValue=function(entry,field,fieldValue,parent){var url;if(field.level){switch(field.level){case"leveloneentity":url="/dictionary/"+encodeURIComponent(dictionaryClientId)+"/"+encodeURIComponent(dictionaryObjectId)+"/perspective/"+encodeURIComponent(perspectiveClientId)+"/"+encodeURIComponent(perspectiveId)+"/lexical_entry/"+encodeURIComponent(entry.client_id)+"/"+encodeURIComponent(entry.object_id)+"/leveloneentity/"+encodeURIComponent(fieldValue.client_id)+"/"+encodeURIComponent(fieldValue.object_id);break;case"leveltwoentity":if(parentClientId&&parentObjectId){url="/dictionary/"+encodeURIComponent(dictionaryClientId)+"/"+encodeURIComponent(dictionaryObjectId)+"/perspective/"+encodeURIComponent(perspectiveClientId)+"/"+encodeURIComponent(perspectiveId)+"/lexical_entry/"+encodeURIComponent(fieldValue.client_id)+"/"+encodeURIComponent(fieldValue.object_id)+"/leveloneentity/"+encodeURIComponent(parent.client_id)+"/"+encodeURIComponent(parent.object_id)+"/leveltwoentity/"+encodeURIComponent(fieldValue.client_id)+"/"+encodeURIComponent(fieldValue.object_id)}else{$log.error("Attempting to delete Level2 entry with no Level1 entry.");return}break;case"groupingentity":return;break}$http.delete(url).success(function(data,status,headers,config){for(var i=0;i<$scope.lexicalEntries.length;i++){if($scope.lexicalEntries[i].object_id==entry.object_id&&$scope.lexicalEntries[i].client_id==entry.client_id){var lexicalEntry=$scope.lexicalEntries[i];for(var j=0;j=0?"&":"?")+encodeURIComponent(key)+"="+encodeURIComponent(value)};var perspectiveToDictionaryFields=function(perspective){var fields=[];for(var i=0;i=0){enabledInputs.splice(removeIndex,1)}};$scope.saveTextValue=function(entry,field,event,parent){if(event.target.value){$scope.saveValue(entry,field,new model.TextValue(event.target.value),parent)}};$scope.saveSoundValue=function(entry,field,fileName,fileType,fileContent,parent){var value=new model.SoundValue(fileName,fileType,fileContent);$scope.saveValue(entry,field,value,parent)};$scope.saveImageValue=function(entry,field,fileName,fileType,fileContent,parent){var value=new model.ImageValue(fileName,fileType,fileContent);$scope.saveValue(entry,field,value,parent)};$scope.saveMarkupValue=function(entry,field,fileName,fileType,fileContent,parent){var value=new model.MarkupValue(fileName,fileType,fileContent);$scope.saveValue(entry,field,value,parent); -};$scope.addedByUser=function(entry){return entry.client_id==$("#clientId").data("lingvodoc")};$scope.saveValue=function(entry,field,value,parent){var url;if(field.level){switch(field.level){case"leveloneentity":url="/dictionary/"+encodeURIComponent(dictionaryClientId)+"/"+encodeURIComponent(dictionaryObjectId)+"/perspective/"+encodeURIComponent(perspectiveClientId)+"/"+encodeURIComponent(perspectiveId)+"/lexical_entry/"+encodeURIComponent($scope.parentEntry.client_id)+"/"+encodeURIComponent($scope.parentEntry.object_id)+"/leveloneentity";break;case"leveltwoentity":if(parent.client_id&&parent.object_id){url="/dictionary/"+encodeURIComponent(dictionaryClientId)+"/"+encodeURIComponent(dictionaryObjectId)+"/perspective/"+encodeURIComponent(perspectiveClientId)+"/"+encodeURIComponent(perspectiveId)+"/lexical_entry/"+encodeURIComponent($scope.parentEntry.client_id)+"/"+encodeURIComponent($scope.parentEntry.object_id)+"/leveloneentity/"+encodeURIComponent(parent.client_id)+"/"+encodeURIComponent(parent.object_id)+"/leveltwoentity"}else{$log.error("Attempting to create Level2 entry with no Level1 entry.");return}break;case"groupingentity":return;break}var entryObject=value.export();entryObject["entity_type"]=field.entity_type;entryObject["locale_id"]=1;entryObject["additional_metadata"]={row_id:entry.row_id,client_id:entry.client_id};$http.post(url,entryObject).success(function(data,status,headers,config){if(data.client_id&&data.object_id){entryObject.client_id=data.client_id;entryObject.object_id=data.object_id;var getSavedEntityUrl="/leveloneentity/"+data.client_id+"/"+data.object_id;$http.get(getSavedEntityUrl).success(function(data,status,headers,config){for(var i=0;i<$scope.entries.length;i++){if($scope.entries[i].row_id==entry.row_id&&$scope.entries[i].client_id==entry.client_id){$scope.entries[i].contains.push(data);break}}$scope.disableInput(entry.client_id,entry.object_id,field.entity_type)}).error(function(data,status,headers,config){})}}).error(function(data,status,headers,config){})}};$scope.removeValue=function(entry,field,fieldValue,parent){var url;if(field.level){switch(field.level){case"leveloneentity":url="/dictionary/"+encodeURIComponent(dictionaryClientId)+"/"+encodeURIComponent(dictionaryObjectId)+"/perspective/"+encodeURIComponent(perspectiveClientId)+"/"+encodeURIComponent(perspectiveId)+"/lexical_entry/"+encodeURIComponent(entry.client_id)+"/"+encodeURIComponent(entry.object_id)+"/leveloneentity/"+encodeURIComponent(fieldValue.client_id)+"/"+encodeURIComponent(fieldValue.object_id);break;case"leveltwoentity":if(parentClientId&&parentObjectId){url="/dictionary/"+encodeURIComponent(dictionaryClientId)+"/"+encodeURIComponent(dictionaryObjectId)+"/perspective/"+encodeURIComponent(perspectiveClientId)+"/"+encodeURIComponent(perspectiveId)+"/lexical_entry/"+encodeURIComponent(fieldValue.client_id)+"/"+encodeURIComponent(fieldValue.object_id)+"/leveloneentity/"+encodeURIComponent(parent.client_id)+"/"+encodeURIComponent(parent.object_id)+"/leveltwoentity/"+encodeURIComponent(fieldValue.client_id)+"/"+encodeURIComponent(fieldValue.object_id)}else{$log.error("Attempting to delete Level2 entry with no Level1 entry.");return}break;case"groupingentity":return;break}$http.delete(url).success(function(data,status,headers,config){for(var i=0;i<$scope.entries.length;i++){if($scope.entries[i].row_id==entry.row_id&&$scope.entries[i].client_id==entry.client_id){var lexicalEntry=$scope.entries[i];for(var j=0;j-1){format=format.split("");regex[index]="("+data.regex+")";format[index]="$";for(var i=index+1,n=index+code.length;i28){return date===29&&(year%4===0&&year%100!==0||year%400===0)}if(month===3||month===5||month===8||month===10){return date<31}return true}}]);angular.module("ui.bootstrap.position",[]).factory("$position",["$document","$window",function($document,$window){function getStyle(el,cssprop){if(el.currentStyle){return el.currentStyle[cssprop]}else if($window.getComputedStyle){return $window.getComputedStyle(el)[cssprop]}return el.style[cssprop]}function isStaticPositioned(element){return(getStyle(element,"position")||"static")==="static"}var parentOffsetEl=function(element){var docDomEl=$document[0];var offsetParent=element.offsetParent||docDomEl;while(offsetParent&&offsetParent!==docDomEl&&isStaticPositioned(offsetParent)){offsetParent=offsetParent.offsetParent}return offsetParent||docDomEl};return{position:function(element){var elBCR=this.offset(element);var offsetParentBCR={top:0,left:0};var offsetParentEl=parentOffsetEl(element[0]);if(offsetParentEl!=$document[0]){offsetParentBCR=this.offset(angular.element(offsetParentEl));offsetParentBCR.top+=offsetParentEl.clientTop-offsetParentEl.scrollTop;offsetParentBCR.left+=offsetParentEl.clientLeft-offsetParentEl.scrollLeft}var boundingClientRect=element[0].getBoundingClientRect();return{width:boundingClientRect.width||element.prop("offsetWidth"),height:boundingClientRect.height||element.prop("offsetHeight"),top:elBCR.top-offsetParentBCR.top,left:elBCR.left-offsetParentBCR.left}},offset:function(element){var boundingClientRect=element[0].getBoundingClientRect();return{width:boundingClientRect.width||element.prop("offsetWidth"),height:boundingClientRect.height||element.prop("offsetHeight"),top:boundingClientRect.top+($window.pageYOffset||$document[0].documentElement.scrollTop),left:boundingClientRect.left+($window.pageXOffset||$document[0].documentElement.scrollLeft)}},positionElements:function(hostEl,targetEl,positionStr,appendToBody){var positionStrParts=positionStr.split("-");var pos0=positionStrParts[0],pos1=positionStrParts[1]||"center";var hostElPos,targetElWidth,targetElHeight,targetElPos;hostElPos=appendToBody?this.offset(hostEl):this.position(hostEl);targetElWidth=targetEl.prop("offsetWidth");targetElHeight=targetEl.prop("offsetHeight");var shiftWidth={center:function(){return hostElPos.left+hostElPos.width/2-targetElWidth/2},left:function(){return hostElPos.left},right:function(){return hostElPos.left+hostElPos.width}};var shiftHeight={center:function(){return hostElPos.top+hostElPos.height/2-targetElHeight/2},top:function(){return hostElPos.top},bottom:function(){return hostElPos.top+hostElPos.height}};switch(pos0){case"right":targetElPos={top:shiftHeight[pos1](),left:shiftWidth[pos0]()};break;case"left":targetElPos={top:shiftHeight[pos1](),left:hostElPos.left-targetElWidth};break;case"bottom":targetElPos={top:shiftHeight[pos0](),left:shiftWidth[pos1]()};break;default:targetElPos={top:hostElPos.top-targetElHeight,left:shiftWidth[pos1]()};break}return targetElPos}}}]);angular.module("ui.bootstrap.datepicker",["ui.bootstrap.dateparser","ui.bootstrap.position"]).value("$datepickerSuppressError",false).constant("datepickerConfig",{formatDay:"dd",formatMonth:"MMMM",formatYear:"yyyy",formatDayHeader:"EEE",formatDayTitle:"MMMM yyyy",formatMonthTitle:"yyyy",datepickerMode:"day",minMode:"day",maxMode:"year",showWeeks:true,startingDay:0,yearRange:20,minDate:null,maxDate:null,shortcutPropagation:false}).controller("DatepickerController",["$scope","$attrs","$parse","$interpolate","$log","dateFilter","datepickerConfig","$datepickerSuppressError",function($scope,$attrs,$parse,$interpolate,$log,dateFilter,datepickerConfig,$datepickerSuppressError){var self=this,ngModelCtrl={$setViewValue:angular.noop};this.modes=["day","month","year"];angular.forEach(["formatDay","formatMonth","formatYear","formatDayHeader","formatDayTitle","formatMonthTitle","showWeeks","startingDay","yearRange","shortcutPropagation"],function(key,index){self[key]=angular.isDefined($attrs[key])?index<6?$interpolate($attrs[key])($scope.$parent):$scope.$parent.$eval($attrs[key]):datepickerConfig[key]});angular.forEach(["minDate","maxDate"],function(key){if($attrs[key]){$scope.$parent.$watch($parse($attrs[key]),function(value){self[key]=value?new Date(value):null;self.refreshView()})}else{self[key]=datepickerConfig[key]?new Date(datepickerConfig[key]):null}});angular.forEach(["minMode","maxMode"],function(key){if($attrs[key]){$scope.$parent.$watch($parse($attrs[key]),function(value){self[key]=angular.isDefined(value)?value:$attrs[key];$scope[key]=self[key];if(key=="minMode"&&self.modes.indexOf($scope.datepickerMode)self.modes.indexOf(self[key])){$scope.datepickerMode=self[key]}})}else{self[key]=datepickerConfig[key]||null;$scope[key]=self[key]}});$scope.datepickerMode=$scope.datepickerMode||datepickerConfig.datepickerMode;$scope.uniqueId="datepicker-"+$scope.$id+"-"+Math.floor(Math.random()*1e4);if(angular.isDefined($attrs.initDate)){this.activeDate=$scope.$parent.$eval($attrs.initDate)||new Date;$scope.$parent.$watch($attrs.initDate,function(initDate){if(initDate&&(ngModelCtrl.$isEmpty(ngModelCtrl.$modelValue)||ngModelCtrl.$invalid)){self.activeDate=initDate;self.refreshView()}})}else{this.activeDate=new Date}$scope.isActive=function(dateObject){if(self.compare(dateObject.date,self.activeDate)===0){$scope.activeDateId=dateObject.uid;return true}return false};this.init=function(ngModelCtrl_){ngModelCtrl=ngModelCtrl_;ngModelCtrl.$render=function(){self.render()}};this.render=function(){if(ngModelCtrl.$viewValue){var date=new Date(ngModelCtrl.$viewValue),isValid=!isNaN(date);if(isValid){this.activeDate=date}else if(!$datepickerSuppressError){$log.error('Datepicker directive: "ng-model" value must be a Date object, a number of milliseconds since 01.01.1970 or a string representing an RFC2822 or ISO 8601 date.')}}this.refreshView()};this.refreshView=function(){if(this.element){this._refreshView();var date=ngModelCtrl.$viewValue?new Date(ngModelCtrl.$viewValue):null;ngModelCtrl.$setValidity("dateDisabled",!date||this.element&&!this.isDisabled(date))}};this.createDateObject=function(date,format){var model=ngModelCtrl.$viewValue?new Date(ngModelCtrl.$viewValue):null;return{date:date,label:dateFilter(date,format),selected:model&&this.compare(date,model)===0,disabled:this.isDisabled(date),current:this.compare(date,new Date)===0,customClass:this.customClass(date)}};this.isDisabled=function(date){return this.minDate&&this.compare(date,this.minDate)<0||this.maxDate&&this.compare(date,this.maxDate)>0||$attrs.dateDisabled&&$scope.dateDisabled({date:date,mode:$scope.datepickerMode})};this.customClass=function(date){return $scope.customClass({date:date,mode:$scope.datepickerMode})};this.split=function(arr,size){var arrays=[];while(arr.length>0){arrays.push(arr.splice(0,size))}return arrays};this.fixTimeZone=function(date){var hours=date.getHours();date.setHours(hours===23?hours+2:0)};$scope.select=function(date){if($scope.datepickerMode===self.minMode){var dt=ngModelCtrl.$viewValue?new Date(ngModelCtrl.$viewValue):new Date(0,0,0,0,0,0,0);dt.setFullYear(date.getFullYear(),date.getMonth(),date.getDate());ngModelCtrl.$setViewValue(dt);ngModelCtrl.$render()}else{self.activeDate=date;$scope.datepickerMode=self.modes[self.modes.indexOf($scope.datepickerMode)-1]}};$scope.move=function(direction){var year=self.activeDate.getFullYear()+direction*(self.step.years||0),month=self.activeDate.getMonth()+direction*(self.step.months||0);self.activeDate.setFullYear(year,month,1);self.refreshView()};$scope.toggleMode=function(direction){direction=direction||1;if($scope.datepickerMode===self.maxMode&&direction===1||$scope.datepickerMode===self.minMode&&direction===-1){return}$scope.datepickerMode=self.modes[self.modes.indexOf($scope.datepickerMode)+direction]};$scope.keys={13:"enter",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down"};var focusElement=function(){self.element[0].focus()};$scope.$on("datepicker.focus",focusElement);$scope.keydown=function(evt){var key=$scope.keys[evt.which];if(!key||evt.shiftKey||evt.altKey){return}evt.preventDefault();if(!self.shortcutPropagation){evt.stopPropagation()}if(key==="enter"||key==="space"){if(self.isDisabled(self.activeDate)){return}$scope.select(self.activeDate);focusElement()}else if(evt.ctrlKey&&(key==="up"||key==="down")){$scope.toggleMode(key==="up"?1:-1);focusElement()}else{self.handleKeyDown(key,evt);self.refreshView()}}}]).directive("datepicker",function(){return{restrict:"EA",replace:true,templateUrl:function(element,attrs){return attrs.templateUrl||"template/datepicker/datepicker.html"},scope:{datepickerMode:"=?",dateDisabled:"&",customClass:"&",shortcutPropagation:"&?"},require:["datepicker","^ngModel"],controller:"DatepickerController",controllerAs:"datepicker",link:function(scope,element,attrs,ctrls){var datepickerCtrl=ctrls[0],ngModelCtrl=ctrls[1];datepickerCtrl.init(ngModelCtrl)}}}).directive("daypicker",["dateFilter",function(dateFilter){return{restrict:"EA",replace:true,templateUrl:"template/datepicker/day.html",require:"^datepicker",link:function(scope,element,attrs,ctrl){scope.showWeeks=ctrl.showWeeks;ctrl.step={months:1};ctrl.element=element;var DAYS_IN_MONTH=[31,28,31,30,31,30,31,31,30,31,30,31];function getDaysInMonth(year,month){return month===1&&year%4===0&&(year%100!==0||year%400===0)?29:DAYS_IN_MONTH[month]}function getDates(startDate,n){var dates=new Array(n),current=new Date(startDate),i=0,date;while(i0?7-difference:-difference,firstDate=new Date(firstDayOfMonth);if(numDisplayedFromPreviousMonth>0){firstDate.setDate(-numDisplayedFromPreviousMonth+1)}var days=getDates(firstDate,42);for(var i=0;i<42;i++){days[i]=angular.extend(ctrl.createDateObject(days[i],ctrl.formatDay),{secondary:days[i].getMonth()!==month,uid:scope.uniqueId+"-"+i})}scope.labels=new Array(7);for(var j=0;j<7;j++){scope.labels[j]={abbr:dateFilter(days[j].date,ctrl.formatDayHeader),full:dateFilter(days[j].date,"EEEE")}}scope.title=dateFilter(ctrl.activeDate,ctrl.formatDayTitle);scope.rows=ctrl.split(days,7);if(scope.showWeeks){scope.weekNumbers=[];var thursdayIndex=(4+7-ctrl.startingDay)%7,numWeeks=scope.rows.length;for(var curWeek=0;curWeek0};scope.compare=function(date1,date2){return new Date(date1.getFullYear(),date1.getMonth(),date1.getDate())-new Date(date2.getFullYear(),date2.getMonth(),date2.getDate())};var isHtml5DateInput=false;if(datepickerPopupConfig.html5Types[attrs.type]){dateFormat=datepickerPopupConfig.html5Types[attrs.type];isHtml5DateInput=true}else{dateFormat=attrs.datepickerPopup||datepickerPopupConfig.datepickerPopup;attrs.$observe("datepickerPopup",function(value,oldValue){var newDateFormat=value||datepickerPopupConfig.datepickerPopup;if(newDateFormat!==dateFormat){dateFormat=newDateFormat;ngModel.$modelValue=null;if(!dateFormat){throw new Error("datepickerPopup must have a date format specified.")}}})}if(!dateFormat){throw new Error("datepickerPopup must have a date format specified.")}if(isHtml5DateInput&&attrs.datepickerPopup){throw new Error("HTML5 date input types do not support custom formats.")}var popupEl=angular.element("
      ");popupEl.attr({"ng-model":"date","ng-change":"dateSelection(date)","template-url":datepickerPopupTemplateUrl});function cameltoDash(string){return string.replace(/([A-Z])/g,function($1){return"-"+$1.toLowerCase()})}var datepickerEl=angular.element(popupEl.children()[0]);datepickerEl.attr("template-url",datepickerTemplateUrl);if(isHtml5DateInput){if(attrs.type==="month"){datepickerEl.attr("datepicker-mode",'"month"');datepickerEl.attr("min-mode","month")}}if(attrs.datepickerOptions){var options=scope.$parent.$eval(attrs.datepickerOptions);if(options&&options.initDate){scope.initDate=options.initDate;datepickerEl.attr("init-date","initDate");delete options.initDate}angular.forEach(options,function(value,option){datepickerEl.attr(cameltoDash(option),value)})}scope.watchData={};angular.forEach(["minMode","maxMode","minDate","maxDate","datepickerMode","initDate","shortcutPropagation"],function(key){if(attrs[key]){var getAttribute=$parse(attrs[key]);scope.$parent.$watch(getAttribute,function(value){scope.watchData[key]=value;if(key==="minDate"||key==="maxDate"){cache[key]=new Date(value)}});datepickerEl.attr(cameltoDash(key),"watchData."+key);if(key==="datepickerMode"){var setAttribute=getAttribute.assign;scope.$watch("watchData."+key,function(value,oldvalue){if(angular.isFunction(setAttribute)&&value!==oldvalue){setAttribute(scope.$parent,value)}})}}});if(attrs.dateDisabled){datepickerEl.attr("date-disabled","dateDisabled({ date: date, mode: mode })")}if(attrs.showWeeks){datepickerEl.attr("show-weeks",attrs.showWeeks)}if(attrs.customClass){datepickerEl.attr("custom-class","customClass({ date: date, mode: mode })")}function parseDate(viewValue){if(angular.isNumber(viewValue)){viewValue=new Date(viewValue)}if(!viewValue){return null}else if(angular.isDate(viewValue)&&!isNaN(viewValue)){return viewValue}else if(angular.isString(viewValue)){var date=dateParser.parse(viewValue,dateFormat,scope.date);if(isNaN(date)){return undefined}else{return date}}else{return undefined}}function validator(modelValue,viewValue){var value=modelValue||viewValue;if(!attrs.ngRequired&&!value){return true}if(angular.isNumber(value)){value=new Date(value)}if(!value){return true}else if(angular.isDate(value)&&!isNaN(value)){return true}else if(angular.isString(value)){var date=dateParser.parse(value,dateFormat);return!isNaN(date)}else{return false}}if(!isHtml5DateInput){ngModel.$$parserName="date";ngModel.$validators.date=validator;ngModel.$parsers.unshift(parseDate);ngModel.$formatters.push(function(value){scope.date=value;return ngModel.$isEmpty(value)?value:dateFilter(value,dateFormat)})}else{ngModel.$formatters.push(function(value){scope.date=value;return value})}scope.dateSelection=function(dt){if(angular.isDefined(dt)){scope.date=dt}var date=scope.date?dateFilter(scope.date,dateFormat):null;element.val(date);ngModel.$setViewValue(date);if(closeOnDateSelection){scope.isOpen=false;element[0].focus()}};ngModel.$viewChangeListeners.push(function(){scope.date=dateParser.parse(ngModel.$viewValue,dateFormat,scope.date)});var documentClickBind=function(event){if(scope.isOpen&&!(element[0].contains(event.target)||popupEl[0].contains(event.target))){scope.$apply(function(){scope.isOpen=false})}};var inputKeydownBind=function(evt){if(evt.which===27&&scope.isOpen){evt.preventDefault();evt.stopPropagation();scope.$apply(function(){scope.isOpen=false});element[0].focus()}else if(evt.which===40&&!scope.isOpen){evt.preventDefault();evt.stopPropagation();scope.$apply(function(){scope.isOpen=true})}};element.bind("keydown",inputKeydownBind);scope.keydown=function(evt){if(evt.which===27){scope.isOpen=false;element[0].focus()}};scope.$watch("isOpen",function(value){if(value){scope.position=appendToBody?$position.offset(element):$position.position(element);scope.position.top=scope.position.top+element.prop("offsetHeight");$timeout(function(){if(onOpenFocus){scope.$broadcast("datepicker.focus")}$document.bind("click",documentClickBind)},0,false)}else{$document.unbind("click",documentClickBind)}});scope.select=function(date){if(date==="today"){var today=new Date;if(angular.isDate(scope.date)){date=new Date(scope.date);date.setFullYear(today.getFullYear(),today.getMonth(),today.getDate())}else{date=new Date(today.setHours(0,0,0,0))}}scope.dateSelection(date)};scope.close=function(){scope.isOpen=false;element[0].focus()};var $popup=$compile(popupEl)(scope);popupEl.remove();if(appendToBody){$document.find("body").append($popup)}else{element.after($popup)}scope.$on("$destroy",function(){if(scope.isOpen===true){if(!$rootScope.$$phase){scope.$apply(function(){scope.isOpen=false})}}$popup.remove();element.unbind("keydown",inputKeydownBind);$document.unbind("click",documentClickBind)})}}}]).directive("datepickerPopupWrap",function(){return{restrict:"EA",replace:true,transclude:true,templateUrl:function(element,attrs){return attrs.templateUrl||"template/datepicker/popup.html"}}});angular.module("ui.bootstrap.dropdown",["ui.bootstrap.position"]).constant("dropdownConfig",{openClass:"open"}).service("dropdownService",["$document","$rootScope",function($document,$rootScope){var openScope=null;this.open=function(dropdownScope){if(!openScope){$document.bind("click",closeDropdown);$document.bind("keydown",keybindFilter)}if(openScope&&openScope!==dropdownScope){openScope.isOpen=false}openScope=dropdownScope};this.close=function(dropdownScope){if(openScope===dropdownScope){openScope=null;$document.unbind("click",closeDropdown);$document.unbind("keydown",keybindFilter)}};var closeDropdown=function(evt){if(!openScope){return}if(evt&&openScope.getAutoClose()==="disabled"){return}var toggleElement=openScope.getToggleElement();if(evt&&toggleElement&&toggleElement[0].contains(evt.target)){return}var dropdownElement=openScope.getDropdownElement();if(evt&&openScope.getAutoClose()==="outsideClick"&&dropdownElement&&dropdownElement[0].contains(evt.target)){return}openScope.isOpen=false;if(!$rootScope.$$phase){openScope.$apply()}};var keybindFilter=function(evt){if(evt.which===27){openScope.focusToggleElement();closeDropdown()}else if(openScope.isKeynavEnabled()&&/(38|40)/.test(evt.which)&&openScope.isOpen){evt.preventDefault();evt.stopPropagation();openScope.focusDropdownEntry(evt.which)}}}]).controller("DropdownController",["$scope","$attrs","$parse","dropdownConfig","dropdownService","$animate","$position","$document","$compile","$templateRequest",function($scope,$attrs,$parse,dropdownConfig,dropdownService,$animate,$position,$document,$compile,$templateRequest){var self=this,scope=$scope.$new(),templateScope,openClass=dropdownConfig.openClass,getIsOpen,setIsOpen=angular.noop,toggleInvoker=$attrs.onToggle?$parse($attrs.onToggle):angular.noop,appendToBody=false,keynavEnabled=false,selectedOption=null,body=$document.find("body");this.init=function(element){self.$element=element;if($attrs.isOpen){getIsOpen=$parse($attrs.isOpen);setIsOpen=getIsOpen.assign;$scope.$watch(getIsOpen,function(value){scope.isOpen=!!value})}appendToBody=angular.isDefined($attrs.dropdownAppendToBody);keynavEnabled=angular.isDefined($attrs.keyboardNav);if(appendToBody&&self.dropdownMenu){body.append(self.dropdownMenu);body.addClass("dropdown");element.on("$destroy",function handleDestroyEvent(){self.dropdownMenu.remove()})}};this.toggle=function(open){return scope.isOpen=arguments.length?!!open:!scope.isOpen};this.isOpen=function(){return scope.isOpen};scope.getToggleElement=function(){return self.toggleElement};scope.getAutoClose=function(){return $attrs.autoClose||"always"};scope.getElement=function(){return self.$element};scope.isKeynavEnabled=function(){return keynavEnabled};scope.focusDropdownEntry=function(keyCode){var elems=self.dropdownMenu?angular.element(self.dropdownMenu).find("a"):angular.element(self.$element).find("ul").eq(0).find("a");switch(keyCode){case 40:{if(!angular.isNumber(self.selectedOption)){self.selectedOption=0}else{self.selectedOption=self.selectedOption===elems.length-1?self.selectedOption:self.selectedOption+1}break}case 38:{if(!angular.isNumber(self.selectedOption)){self.selectedOption=elems.length-1}else{self.selectedOption=self.selectedOption===0?0:self.selectedOption-1}break}}elems[self.selectedOption].focus()};scope.getDropdownElement=function(){return self.dropdownMenu};scope.focusToggleElement=function(){if(self.toggleElement){self.toggleElement[0].focus()}};scope.$watch("isOpen",function(isOpen,wasOpen){if(appendToBody&&self.dropdownMenu){var pos=$position.positionElements(self.$element,self.dropdownMenu,"bottom-left",true);var css={top:pos.top+"px",display:isOpen?"block":"none"};var rightalign=self.dropdownMenu.hasClass("dropdown-menu-right");if(!rightalign){css.left=pos.left+"px";css.right="auto"}else{css.left="auto";css.right=window.innerWidth-(pos.left+self.$element.prop("offsetWidth"))+"px"}self.dropdownMenu.css(css)}var openContainer=appendToBody?body:self.$element;$animate[isOpen?"addClass":"removeClass"](openContainer,openClass).then(function(){if(angular.isDefined(isOpen)&&isOpen!==wasOpen){toggleInvoker($scope,{open:!!isOpen})}});if(isOpen){if(self.dropdownMenuTemplateUrl){$templateRequest(self.dropdownMenuTemplateUrl).then(function(tplContent){templateScope=scope.$new();$compile(tplContent.trim())(templateScope,function(dropdownElement){var newEl=dropdownElement;self.dropdownMenu.replaceWith(newEl);self.dropdownMenu=newEl})})}scope.focusToggleElement();dropdownService.open(scope)}else{if(self.dropdownMenuTemplateUrl){if(templateScope){templateScope.$destroy()}var newEl=angular.element(''); self.dropdownMenu.replaceWith(newEl);self.dropdownMenu=newEl}dropdownService.close(scope);self.selectedOption=null}if(angular.isFunction(setIsOpen)){setIsOpen($scope,isOpen)}});$scope.$on("$locationChangeSuccess",function(){if(scope.getAutoClose()!=="disabled"){scope.isOpen=false}});var offDestroy=$scope.$on("$destroy",function(){scope.$destroy()});scope.$on("$destroy",offDestroy)}]).directive("dropdown",function(){return{controller:"DropdownController",link:function(scope,element,attrs,dropdownCtrl){dropdownCtrl.init(element);element.addClass("dropdown")}}}).directive("dropdownMenu",function(){return{restrict:"AC",require:"?^dropdown",link:function(scope,element,attrs,dropdownCtrl){if(!dropdownCtrl){return}var tplUrl=attrs.templateUrl;if(tplUrl){dropdownCtrl.dropdownMenuTemplateUrl=tplUrl}if(!dropdownCtrl.dropdownMenu){dropdownCtrl.dropdownMenu=element}}}}).directive("keyboardNav",function(){return{restrict:"A",require:"?^dropdown",link:function(scope,element,attrs,dropdownCtrl){element.bind("keydown",function(e){if([38,40].indexOf(e.which)!==-1){e.preventDefault();e.stopPropagation();var elems=dropdownCtrl.dropdownMenu.find("a");switch(e.which){case 40:{if(!angular.isNumber(dropdownCtrl.selectedOption)){dropdownCtrl.selectedOption=0}else{dropdownCtrl.selectedOption=dropdownCtrl.selectedOption===elems.length-1?dropdownCtrl.selectedOption:dropdownCtrl.selectedOption+1}break}case 38:{if(!angular.isNumber(dropdownCtrl.selectedOption)){dropdownCtrl.selectedOption=elems.length-1}else{dropdownCtrl.selectedOption=dropdownCtrl.selectedOption===0?0:dropdownCtrl.selectedOption-1}break}}elems[dropdownCtrl.selectedOption].focus()}})}}}).directive("dropdownToggle",function(){return{require:"?^dropdown",link:function(scope,element,attrs,dropdownCtrl){if(!dropdownCtrl){return}element.addClass("dropdown-toggle");dropdownCtrl.toggleElement=element;var toggleDropdown=function(event){event.preventDefault();if(!element.hasClass("disabled")&&!attrs.disabled){scope.$apply(function(){dropdownCtrl.toggle()})}};element.bind("click",toggleDropdown);element.attr({"aria-haspopup":true,"aria-expanded":false});scope.$watch(dropdownCtrl.isOpen,function(isOpen){element.attr("aria-expanded",!!isOpen)});scope.$on("$destroy",function(){element.unbind("click",toggleDropdown)})}}});angular.module("ui.bootstrap.modal",[]).factory("$$stackedMap",function(){return{createNew:function(){var stack=[];return{add:function(key,value){stack.push({key:key,value:value})},get:function(key){for(var i=0;i=0&&!backdropDomEl){backdropScope=$rootScope.$new(true);backdropScope.index=currBackdropIndex;var angularBackgroundDomEl=angular.element('
      ');angularBackgroundDomEl.attr("backdrop-class",modal.backdropClass);if(modal.animation){angularBackgroundDomEl.attr("modal-animation","true")}backdropDomEl=$compile(angularBackgroundDomEl)(backdropScope);body.append(backdropDomEl)}var angularDomEl=angular.element('
      ');angularDomEl.attr({"template-url":modal.windowTemplateUrl,"window-class":modal.windowClass,size:modal.size,index:openedWindows.length()-1,animate:"animate"}).html(modal.content);if(modal.animation){angularDomEl.attr("modal-animation","true")}var modalDomEl=$compile(angularDomEl)(modal.scope);openedWindows.top().value.modalDomEl=modalDomEl;openedWindows.top().value.modalOpener=modalOpener;body.append(modalDomEl);body.addClass(modalBodyClass);$modalStack.clearFocusListCache()};function broadcastClosing(modalWindow,resultOrReason,closing){return!modalWindow.value.modalScope.$broadcast("modal.closing",resultOrReason,closing).defaultPrevented}$modalStack.close=function(modalInstance,result){var modalWindow=openedWindows.get(modalInstance);if(modalWindow&&broadcastClosing(modalWindow,result,true)){modalWindow.value.modalScope.$$uibDestructionScheduled=true;modalWindow.value.deferred.resolve(result);removeModalWindow(modalInstance,modalWindow.value.modalOpener);return true}return!modalWindow};$modalStack.dismiss=function(modalInstance,reason){var modalWindow=openedWindows.get(modalInstance);if(modalWindow&&broadcastClosing(modalWindow,reason,false)){modalWindow.value.modalScope.$$uibDestructionScheduled=true;modalWindow.value.deferred.reject(reason);removeModalWindow(modalInstance,modalWindow.value.modalOpener);return true}return!modalWindow};$modalStack.dismissAll=function(reason){var topModal=this.getTop();while(topModal&&this.dismiss(topModal.key,reason)){topModal=this.getTop()}};$modalStack.getTop=function(){return openedWindows.top()};$modalStack.modalRendered=function(modalInstance){var modalWindow=openedWindows.get(modalInstance);if(modalWindow){modalWindow.value.renderDeferred.resolve()}};$modalStack.focusFirstFocusableElement=function(){if(focusableElementList.length>0){focusableElementList[0].focus();return true}return false};$modalStack.focusLastFocusableElement=function(){if(focusableElementList.length>0){focusableElementList[focusableElementList.length-1].focus();return true}return false};$modalStack.isFocusInFirstItem=function(evt){if(focusableElementList.length>0){return(evt.target||evt.srcElement)==focusableElementList[0]}return false};$modalStack.isFocusInLastItem=function(evt){if(focusableElementList.length>0){return(evt.target||evt.srcElement)==focusableElementList[focusableElementList.length-1]}return false};$modalStack.clearFocusListCache=function(){focusableElementList=[];focusIndex=0};$modalStack.loadFocusElementList=function(modalWindow){if(focusableElementList===undefined||!focusableElementList.length0){if(modalWindow){var modalDomE1=modalWindow.value.modalDomEl;if(modalDomE1&&modalDomE1.length){focusableElementList=modalDomE1[0].querySelectorAll(tababbleSelector)}}}};return $modalStack}]).provider("$modal",function(){var $modalProvider={options:{animation:true,backdrop:true,keyboard:true},$get:["$injector","$rootScope","$q","$templateRequest","$controller","$modalStack",function($injector,$rootScope,$q,$templateRequest,$controller,$modalStack){var $modal={};function getTemplatePromise(options){return options.template?$q.when(options.template):$templateRequest(angular.isFunction(options.templateUrl)?options.templateUrl():options.templateUrl)}function getResolvePromises(resolves){var promisesArr=[];angular.forEach(resolves,function(value){if(angular.isFunction(value)||angular.isArray(value)){promisesArr.push($q.when($injector.invoke(value)))}else if(angular.isString(value)){promisesArr.push($q.when($injector.get(value)))}else{promisesArr.push($q.when(value))}});return promisesArr}var promiseChain=null;$modal.getPromiseChain=function(){return promiseChain};$modal.open=function(modalOptions){var modalResultDeferred=$q.defer();var modalOpenedDeferred=$q.defer();var modalRenderDeferred=$q.defer();var modalInstance={result:modalResultDeferred.promise,opened:modalOpenedDeferred.promise,rendered:modalRenderDeferred.promise,close:function(result){return $modalStack.close(modalInstance,result)},dismiss:function(reason){return $modalStack.dismiss(modalInstance,reason)}};modalOptions=angular.extend({},$modalProvider.options,modalOptions);modalOptions.resolve=modalOptions.resolve||{};if(!modalOptions.template&&!modalOptions.templateUrl){throw new Error("One of template or templateUrl options is required.")}var templateAndResolvePromise=$q.all([getTemplatePromise(modalOptions)].concat(getResolvePromises(modalOptions.resolve)));var samePromise;samePromise=promiseChain=$q.all([promiseChain]).then(function(){return templateAndResolvePromise},function(){return templateAndResolvePromise}).then(function resolveSuccess(tplAndVars){var modalScope=(modalOptions.scope||$rootScope).$new();modalScope.$close=modalInstance.close;modalScope.$dismiss=modalInstance.dismiss;modalScope.$on("$destroy",function(){if(!modalScope.$$uibDestructionScheduled){modalScope.$dismiss("$uibUnscheduledDestruction")}});var ctrlInstance,ctrlLocals={};var resolveIter=1;if(modalOptions.controller){ctrlLocals.$scope=modalScope;ctrlLocals.$modalInstance=modalInstance;angular.forEach(modalOptions.resolve,function(value,key){ctrlLocals[key]=tplAndVars[resolveIter++]});ctrlInstance=$controller(modalOptions.controller,ctrlLocals);if(modalOptions.controllerAs){if(modalOptions.bindToController){angular.extend(ctrlInstance,modalScope)}modalScope[modalOptions.controllerAs]=ctrlInstance}}$modalStack.open(modalInstance,{scope:modalScope,deferred:modalResultDeferred,renderDeferred:modalRenderDeferred,content:tplAndVars[0],animation:modalOptions.animation,backdrop:modalOptions.backdrop,keyboard:modalOptions.keyboard,backdropClass:modalOptions.backdropClass,windowClass:modalOptions.windowClass,windowTemplateUrl:modalOptions.windowTemplateUrl,size:modalOptions.size,openedClass:modalOptions.openedClass});modalOpenedDeferred.resolve(true)},function resolveError(reason){modalOpenedDeferred.reject(reason);modalResultDeferred.reject(reason)}).finally(function(){if(promiseChain===samePromise){promiseChain=null}});return modalInstance};return $modal}]};return $modalProvider});angular.module("ui.bootstrap.pagination",[]).controller("PaginationController",["$scope","$attrs","$parse",function($scope,$attrs,$parse){var self=this,ngModelCtrl={$setViewValue:angular.noop},setNumPages=$attrs.numPages?$parse($attrs.numPages).assign:angular.noop;this.init=function(ngModelCtrl_,config){ngModelCtrl=ngModelCtrl_;this.config=config;ngModelCtrl.$render=function(){self.render()};if($attrs.itemsPerPage){$scope.$parent.$watch($parse($attrs.itemsPerPage),function(value){self.itemsPerPage=parseInt(value,10);$scope.totalPages=self.calculateTotalPages()})}else{this.itemsPerPage=config.itemsPerPage}$scope.$watch("totalItems",function(){$scope.totalPages=self.calculateTotalPages()});$scope.$watch("totalPages",function(value){setNumPages($scope.$parent,value);if($scope.page>value){$scope.selectPage(value)}else{ngModelCtrl.$render()}})};this.calculateTotalPages=function(){var totalPages=this.itemsPerPage<1?1:Math.ceil($scope.totalItems/this.itemsPerPage);return Math.max(totalPages||0,1)};this.render=function(){$scope.page=parseInt(ngModelCtrl.$viewValue,10)||1};$scope.selectPage=function(page,evt){if(evt){evt.preventDefault()}var clickAllowed=!$scope.ngDisabled||!evt;if(clickAllowed&&$scope.page!==page&&page>0&&page<=$scope.totalPages){if(evt&&evt.target){evt.target.blur()}ngModelCtrl.$setViewValue(page);ngModelCtrl.$render()}};$scope.getText=function(key){return $scope[key+"Text"]||self.config[key+"Text"]};$scope.noPrevious=function(){return $scope.page===1};$scope.noNext=function(){return $scope.page===$scope.totalPages}}]).constant("paginationConfig",{itemsPerPage:10,boundaryLinks:false,directionLinks:true,firstText:"First",previousText:"Previous",nextText:"Next",lastText:"Last",rotate:true}).directive("pagination",["$parse","paginationConfig",function($parse,paginationConfig){return{restrict:"EA",scope:{totalItems:"=",firstText:"@",previousText:"@",nextText:"@",lastText:"@",ngDisabled:"="},require:["pagination","?ngModel"],controller:"PaginationController",controllerAs:"pagination",templateUrl:function(element,attrs){return attrs.templateUrl||"template/pagination/pagination.html"},replace:true,link:function(scope,element,attrs,ctrls){var paginationCtrl=ctrls[0],ngModelCtrl=ctrls[1];if(!ngModelCtrl){return}var maxSize=angular.isDefined(attrs.maxSize)?scope.$parent.$eval(attrs.maxSize):paginationConfig.maxSize,rotate=angular.isDefined(attrs.rotate)?scope.$parent.$eval(attrs.rotate):paginationConfig.rotate;scope.boundaryLinks=angular.isDefined(attrs.boundaryLinks)?scope.$parent.$eval(attrs.boundaryLinks):paginationConfig.boundaryLinks;scope.directionLinks=angular.isDefined(attrs.directionLinks)?scope.$parent.$eval(attrs.directionLinks):paginationConfig.directionLinks;paginationCtrl.init(ngModelCtrl,paginationConfig);if(attrs.maxSize){scope.$parent.$watch($parse(attrs.maxSize),function(value){maxSize=parseInt(value,10);paginationCtrl.render()})}function makePage(number,text,isActive){return{number:number,text:text,active:isActive}}function getPages(currentPage,totalPages){var pages=[];var startPage=1,endPage=totalPages;var isMaxSized=angular.isDefined(maxSize)&&maxSizetotalPages){endPage=totalPages;startPage=endPage-maxSize+1}}else{startPage=(Math.ceil(currentPage/maxSize)-1)*maxSize+1;endPage=Math.min(startPage+maxSize-1,totalPages)}}for(var number=startPage;number<=endPage;number++){var page=makePage(number,number,number===currentPage);pages.push(page)}if(isMaxSized&&!rotate){if(startPage>1){var previousPageSet=makePage(startPage-1,"...",false);pages.unshift(previousPageSet)}if(endPage0&&scope.page<=scope.totalPages){scope.pages=getPages(scope.page,scope.totalPages)}}}}}]).constant("pagerConfig",{itemsPerPage:10,previousText:"« Previous",nextText:"Next »",align:true}).directive("pager",["pagerConfig",function(pagerConfig){return{restrict:"EA",scope:{totalItems:"=",previousText:"@",nextText:"@",ngDisabled:"="},require:["pager","?ngModel"],controller:"PaginationController",controllerAs:"pagination",templateUrl:function(element,attrs){return attrs.templateUrl||"template/pagination/pager.html"},replace:true,link:function(scope,element,attrs,ctrls){var paginationCtrl=ctrls[0],ngModelCtrl=ctrls[1];if(!ngModelCtrl){return}scope.align=angular.isDefined(attrs.align)?scope.$parent.$eval(attrs.align):pagerConfig.align;paginationCtrl.init(ngModelCtrl,pagerConfig)}}}]);angular.module("ui.bootstrap.tooltip",["ui.bootstrap.position","ui.bootstrap.bindHtml"]).provider("$tooltip",function(){var defaultOptions={placement:"top",animation:true,popupDelay:0,useContentExp:false};var triggerMap={mouseenter:"mouseleave",click:"click",focus:"blur",none:""};var globalOptions={};this.options=function(value){angular.extend(globalOptions,value)};this.setTriggers=function setTriggers(triggers){angular.extend(triggerMap,triggers)};function snake_case(name){var regexp=/[A-Z]/g;var separator="-";return name.replace(regexp,function(letter,pos){return(pos?separator:"")+letter.toLowerCase()})}this.$get=["$window","$compile","$timeout","$document","$position","$interpolate","$rootScope","$parse",function($window,$compile,$timeout,$document,$position,$interpolate,$rootScope,$parse){return function $tooltip(type,prefix,defaultTriggerShow,options){options=angular.extend({},defaultOptions,globalOptions,options);function getTriggers(trigger){var show=(trigger||options.trigger||defaultTriggerShow).split(" ");var hide=show.map(function(trigger){return triggerMap[trigger]||trigger});return{show:show,hide:hide}}var directiveName=snake_case(type);var startSym=$interpolate.startSymbol();var endSym=$interpolate.endSymbol();var template="
      "+"
      ";return{restrict:"EA",compile:function(tElem,tAttrs){var tooltipLinker=$compile(template);return function link(scope,element,attrs,tooltipCtrl){var tooltip;var tooltipLinkedScope;var transitionTimeout;var popupTimeout;var positionTimeout;var appendToBody=angular.isDefined(options.appendToBody)?options.appendToBody:false;var triggers=getTriggers(undefined);var hasEnableExp=angular.isDefined(attrs[prefix+"Enable"]);var ttScope=scope.$new(true);var repositionScheduled=false;var isOpenExp=angular.isDefined(attrs[prefix+"IsOpen"])?$parse(attrs[prefix+"IsOpen"]):false;var positionTooltip=function(){if(!tooltip){return}if(!positionTimeout){positionTimeout=$timeout(function(){tooltip.css({top:0,left:0,width:"auto",height:"auto"});var ttBox=$position.position(tooltip);var ttCss=$position.positionElements(element,tooltip,ttScope.placement,appendToBody);ttCss.top+="px";ttCss.left+="px";ttCss.width=ttBox.width+"px";ttCss.height=ttBox.height+"px";tooltip.css(ttCss);positionTimeout=null},0,false)}};ttScope.origScope=scope;ttScope.isOpen=false;function toggleTooltipBind(){if(!ttScope.isOpen){showTooltipBind()}else{hideTooltipBind()}}function showTooltipBind(){if(hasEnableExp&&!scope.$eval(attrs[prefix+"Enable"])){return}prepareTooltip();if(ttScope.popupDelay){if(!popupTimeout){popupTimeout=$timeout(show,ttScope.popupDelay,false)}}else{show()}}function hideTooltipBind(){hide();if(!$rootScope.$$phase){$rootScope.$digest()}}function show(){popupTimeout=null;if(transitionTimeout){$timeout.cancel(transitionTimeout);transitionTimeout=null}if(!(options.useContentExp?ttScope.contentExp():ttScope.content)){return angular.noop}createTooltip();ttScope.isOpen=true;if(isOpenExp){isOpenExp.assign(ttScope.origScope,ttScope.isOpen)}if(!$rootScope.$$phase){ttScope.$apply()}tooltip.css({display:"block"});positionTooltip()}function hide(){ttScope.isOpen=false;if(isOpenExp){isOpenExp.assign(ttScope.origScope,ttScope.isOpen)}$timeout.cancel(popupTimeout);popupTimeout=null;$timeout.cancel(positionTimeout);positionTimeout=null;if(ttScope.animation){if(!transitionTimeout){transitionTimeout=$timeout(removeTooltip,500)}}else{removeTooltip()}}function createTooltip(){if(tooltip){removeTooltip()}tooltipLinkedScope=ttScope.$new();tooltip=tooltipLinker(tooltipLinkedScope,function(tooltip){if(appendToBody){$document.find("body").append(tooltip)}else{element.after(tooltip)}});if(options.useContentExp){tooltipLinkedScope.$watch("contentExp()",function(val){if(!val&&ttScope.isOpen){hide()}});tooltipLinkedScope.$watch(function(){if(!repositionScheduled){repositionScheduled=true;tooltipLinkedScope.$$postDigest(function(){repositionScheduled=false;if(ttScope.isOpen){positionTooltip()}})}})}}function removeTooltip(){transitionTimeout=null;if(tooltip){tooltip.remove();tooltip=null}if(tooltipLinkedScope){tooltipLinkedScope.$destroy();tooltipLinkedScope=null}}function prepareTooltip(){prepPopupClass();prepPlacement();prepPopupDelay()}ttScope.contentExp=function(){return scope.$eval(attrs[type])};if(!options.useContentExp){attrs.$observe(type,function(val){ttScope.content=val;if(!val&&ttScope.isOpen){hide()}else{positionTooltip()}})}attrs.$observe("disabled",function(val){if(popupTimeout&&val){$timeout.cancel(popupTimeout);popupTimeout=null}if(val&&ttScope.isOpen){hide()}});attrs.$observe(prefix+"Title",function(val){ttScope.title=val;positionTooltip()});attrs.$observe(prefix+"Placement",function(){if(ttScope.isOpen){prepPlacement();positionTooltip()}});if(isOpenExp){scope.$watch(isOpenExp,function(val){if(val!==ttScope.isOpen){toggleTooltipBind()}})}function prepPopupClass(){ttScope.popupClass=attrs[prefix+"Class"]}function prepPlacement(){var val=attrs[prefix+"Placement"];ttScope.placement=angular.isDefined(val)?val:options.placement}function prepPopupDelay(){var val=attrs[prefix+"PopupDelay"];var delay=parseInt(val,10);ttScope.popupDelay=!isNaN(delay)?delay:options.popupDelay}var unregisterTriggers=function(){triggers.show.forEach(function(trigger){element.unbind(trigger,showTooltipBind)});triggers.hide.forEach(function(trigger){element.unbind(trigger,hideTooltipBind)})};function prepTriggers(){var val=attrs[prefix+"Trigger"];unregisterTriggers();triggers=getTriggers(val);if(triggers.show!=="none"){triggers.show.forEach(function(trigger,idx){if(trigger===triggers.hide[idx]){element[0].addEventListener(trigger,toggleTooltipBind)}else if(trigger){element[0].addEventListener(trigger,showTooltipBind);element[0].addEventListener(triggers.hide[idx],hideTooltipBind)}})}}prepTriggers();var animation=scope.$eval(attrs[prefix+"Animation"]);ttScope.animation=angular.isDefined(animation)?!!animation:options.animation;var appendToBodyVal=scope.$eval(attrs[prefix+"AppendToBody"]);appendToBody=angular.isDefined(appendToBodyVal)?appendToBodyVal:appendToBody;if(appendToBody){scope.$on("$locationChangeSuccess",function closeTooltipOnLocationChangeSuccess(){if(ttScope.isOpen){hide()}})}scope.$on("$destroy",function onDestroyTooltip(){$timeout.cancel(transitionTimeout);$timeout.cancel(popupTimeout);$timeout.cancel(positionTimeout);unregisterTriggers();removeTooltip();ttScope=null})}}}}}]}).directive("tooltipTemplateTransclude",["$animate","$sce","$compile","$templateRequest",function($animate,$sce,$compile,$templateRequest){return{link:function(scope,elem,attrs){var origScope=scope.$eval(attrs.tooltipTemplateTranscludeScope);var changeCounter=0,currentScope,previousElement,currentElement;var cleanupLastIncludeContent=function(){if(previousElement){previousElement.remove();previousElement=null}if(currentScope){currentScope.$destroy();currentScope=null}if(currentElement){$animate.leave(currentElement).then(function(){previousElement=null});previousElement=currentElement;currentElement=null}};scope.$watch($sce.parseAsResourceUrl(attrs.tooltipTemplateTransclude),function(src){var thisChangeId=++changeCounter;if(src){$templateRequest(src,true).then(function(response){if(thisChangeId!==changeCounter){return}var newScope=origScope.$new();var template=response;var clone=$compile(template)(newScope,function(clone){cleanupLastIncludeContent();$animate.enter(clone,elem)});currentScope=newScope;currentElement=clone;currentScope.$emit("$includeContentLoaded",src)},function(){if(thisChangeId===changeCounter){cleanupLastIncludeContent();scope.$emit("$includeContentError",src)}});scope.$emit("$includeContentRequested",src)}else{cleanupLastIncludeContent()}});scope.$on("$destroy",cleanupLastIncludeContent)}}}]).directive("tooltipClasses",function(){return{restrict:"A",link:function(scope,element,attrs){if(scope.placement){element.addClass(scope.placement)}if(scope.popupClass){element.addClass(scope.popupClass)}if(scope.animation()){element.addClass(attrs.tooltipAnimationClass)}}}}).directive("tooltipPopup",function(){return{restrict:"EA",replace:true,scope:{content:"@",placement:"@",popupClass:"@",animation:"&",isOpen:"&"},templateUrl:"template/tooltip/tooltip-popup.html"}}).directive("tooltip",["$tooltip",function($tooltip){return $tooltip("tooltip","tooltip","mouseenter")}]).directive("tooltipTemplatePopup",function(){return{restrict:"EA",replace:true,scope:{contentExp:"&",placement:"@",popupClass:"@",animation:"&",isOpen:"&",originScope:"&"},templateUrl:"template/tooltip/tooltip-template-popup.html"}}).directive("tooltipTemplate",["$tooltip",function($tooltip){return $tooltip("tooltipTemplate","tooltip","mouseenter",{useContentExp:true})}]).directive("tooltipHtmlPopup",function(){return{restrict:"EA",replace:true,scope:{contentExp:"&",placement:"@",popupClass:"@",animation:"&",isOpen:"&"},templateUrl:"template/tooltip/tooltip-html-popup.html"}}).directive("tooltipHtml",["$tooltip",function($tooltip){return $tooltip("tooltipHtml","tooltip","mouseenter",{useContentExp:true})}]).directive("tooltipHtmlUnsafePopup",function(){return{restrict:"EA",replace:true,scope:{content:"@",placement:"@",popupClass:"@",animation:"&",isOpen:"&"},templateUrl:"template/tooltip/tooltip-html-unsafe-popup.html"}}).value("tooltipHtmlUnsafeSuppressDeprecated",false).directive("tooltipHtmlUnsafe",["$tooltip","tooltipHtmlUnsafeSuppressDeprecated","$log",function($tooltip,tooltipHtmlUnsafeSuppressDeprecated,$log){if(!tooltipHtmlUnsafeSuppressDeprecated){$log.warn("tooltip-html-unsafe is now deprecated. Use tooltip-html or tooltip-template instead.")}return $tooltip("tooltipHtmlUnsafe","tooltip","mouseenter")}]);angular.module("ui.bootstrap.popover",["ui.bootstrap.tooltip"]).directive("popoverTemplatePopup",function(){return{restrict:"EA",replace:true,scope:{title:"@",contentExp:"&",placement:"@",popupClass:"@",animation:"&",isOpen:"&",originScope:"&"},templateUrl:"template/popover/popover-template.html"}}).directive("popoverTemplate",["$tooltip",function($tooltip){return $tooltip("popoverTemplate","popover","click",{useContentExp:true})}]).directive("popoverHtmlPopup",function(){return{restrict:"EA",replace:true,scope:{contentExp:"&",title:"@",placement:"@",popupClass:"@",animation:"&",isOpen:"&"},templateUrl:"template/popover/popover-html.html"}}).directive("popoverHtml",["$tooltip",function($tooltip){return $tooltip("popoverHtml","popover","click",{useContentExp:true})}]).directive("popoverPopup",function(){return{restrict:"EA",replace:true,scope:{title:"@",content:"@",placement:"@",popupClass:"@",animation:"&",isOpen:"&"},templateUrl:"template/popover/popover.html" }}).directive("popover",["$tooltip",function($tooltip){return $tooltip("popover","popover","click")}]);angular.module("ui.bootstrap.progressbar",[]).constant("progressConfig",{animate:true,max:100}).value("$progressSuppressWarning",false).controller("ProgressController",["$scope","$attrs","progressConfig",function($scope,$attrs,progressConfig){var self=this,animate=angular.isDefined($attrs.animate)?$scope.$parent.$eval($attrs.animate):progressConfig.animate;this.bars=[];$scope.max=angular.isDefined($scope.max)?$scope.max:progressConfig.max;this.addBar=function(bar,element){if(!animate){element.css({transition:"none"})}this.bars.push(bar);bar.max=$scope.max;bar.$watch("value",function(value){bar.recalculatePercentage()});bar.recalculatePercentage=function(){bar.percent=+(100*bar.value/bar.max).toFixed(2);var totalPercentage=self.bars.reduce(function(total,bar){return total+bar.percent},0);if(totalPercentage>100){bar.percent-=totalPercentage-100}};bar.$on("$destroy",function(){element=null;self.removeBar(bar)})};this.removeBar=function(bar){this.bars.splice(this.bars.indexOf(bar),1)};$scope.$watch("max",function(max){self.bars.forEach(function(bar){bar.max=$scope.max;bar.recalculatePercentage()})})}]).directive("uibProgress",function(){return{restrict:"EA",replace:true,transclude:true,controller:"ProgressController",require:"uibProgress",scope:{max:"=?"},templateUrl:"template/progressbar/progress.html"}}).directive("progress",["$log","$progressSuppressWarning",function($log,$progressSuppressWarning){return{restrict:"EA",replace:true,transclude:true,controller:"ProgressController",require:"progress",scope:{max:"=?"},templateUrl:"template/progressbar/progress.html",link:function(){if($progressSuppressWarning){$log.warn("progress is now deprecated. Use uib-progress instead")}}}}]).directive("uibBar",function(){return{restrict:"EA",replace:true,transclude:true,require:"^uibProgress",scope:{value:"=",type:"@"},templateUrl:"template/progressbar/bar.html",link:function(scope,element,attrs,progressCtrl){progressCtrl.addBar(scope,element)}}}).directive("bar",["$log","$progressSuppressWarning",function($log,$progressSuppressWarning){return{restrict:"EA",replace:true,transclude:true,require:"^progress",scope:{value:"=",type:"@"},templateUrl:"template/progressbar/bar.html",link:function(scope,element,attrs,progressCtrl){if($progressSuppressWarning){$log.warn("bar is now deprecated. Use uib-bar instead")}progressCtrl.addBar(scope,element)}}}]).directive("progressbar",function(){return{restrict:"EA",replace:true,transclude:true,controller:"ProgressController",scope:{value:"=",max:"=?",type:"@"},templateUrl:"template/progressbar/progressbar.html",link:function(scope,element,attrs,progressCtrl){progressCtrl.addBar(scope,angular.element(element.children()[0]))}}});angular.module("ui.bootstrap.rating",[]).constant("ratingConfig",{max:5,stateOn:null,stateOff:null,titles:["one","two","three","four","five"]}).controller("RatingController",["$scope","$attrs","ratingConfig",function($scope,$attrs,ratingConfig){var ngModelCtrl={$setViewValue:angular.noop};this.init=function(ngModelCtrl_){ngModelCtrl=ngModelCtrl_;ngModelCtrl.$render=this.render;ngModelCtrl.$formatters.push(function(value){if(angular.isNumber(value)&&value<<0!==value){value=Math.round(value)}return value});this.stateOn=angular.isDefined($attrs.stateOn)?$scope.$parent.$eval($attrs.stateOn):ratingConfig.stateOn;this.stateOff=angular.isDefined($attrs.stateOff)?$scope.$parent.$eval($attrs.stateOff):ratingConfig.stateOff;var tmpTitles=angular.isDefined($attrs.titles)?$scope.$parent.$eval($attrs.titles):ratingConfig.titles;this.titles=angular.isArray(tmpTitles)&&tmpTitles.length>0?tmpTitles:ratingConfig.titles;var ratingStates=angular.isDefined($attrs.ratingStates)?$scope.$parent.$eval($attrs.ratingStates):new Array(angular.isDefined($attrs.max)?$scope.$parent.$eval($attrs.max):ratingConfig.max);$scope.range=this.buildTemplateObjects(ratingStates)};this.buildTemplateObjects=function(states){for(var i=0,n=states.length;i=this.titles.length){return index+1}else{return this.titles[index]}};$scope.rate=function(value){if(!$scope.readonly&&value>=0&&value<=$scope.range.length){ngModelCtrl.$setViewValue(ngModelCtrl.$viewValue===value?0:value);ngModelCtrl.$render()}};$scope.enter=function(value){if(!$scope.readonly){$scope.value=value}$scope.onHover({value:value})};$scope.reset=function(){$scope.value=ngModelCtrl.$viewValue;$scope.onLeave()};$scope.onKeydown=function(evt){if(/(37|38|39|40)/.test(evt.which)){evt.preventDefault();evt.stopPropagation();$scope.rate($scope.value+(evt.which===38||evt.which===39?1:-1))}};this.render=function(){$scope.value=ngModelCtrl.$viewValue}}]).directive("rating",function(){return{restrict:"EA",require:["rating","ngModel"],scope:{readonly:"=?",onHover:"&",onLeave:"&"},controller:"RatingController",templateUrl:"template/rating/rating.html",replace:true,link:function(scope,element,attrs,ctrls){var ratingCtrl=ctrls[0],ngModelCtrl=ctrls[1];ratingCtrl.init(ngModelCtrl)}}});angular.module("ui.bootstrap.tabs",[]).controller("TabsetController",["$scope",function TabsetCtrl($scope){var ctrl=this,tabs=ctrl.tabs=$scope.tabs=[];ctrl.select=function(selectedTab){angular.forEach(tabs,function(tab){if(tab.active&&tab!==selectedTab){tab.active=false;tab.onDeselect();selectedTab.selectCalled=false}});selectedTab.active=true;if(!selectedTab.selectCalled){selectedTab.onSelect();selectedTab.selectCalled=true}};ctrl.addTab=function addTab(tab){tabs.push(tab);if(tabs.length===1&&tab.active!==false){tab.active=true}else if(tab.active){ctrl.select(tab)}else{tab.active=false}};ctrl.removeTab=function removeTab(tab){var index=tabs.indexOf(tab);if(tab.active&&tabs.length>1&&!destroyed){var newActiveIndex=index==tabs.length-1?index-1:index+1;ctrl.select(tabs[newActiveIndex])}tabs.splice(index,1)};var destroyed;$scope.$on("$destroy",function(){destroyed=true})}]).directive("tabset",function(){return{restrict:"EA",transclude:true,replace:true,scope:{type:"@"},controller:"TabsetController",templateUrl:"template/tabs/tabset.html",link:function(scope,element,attrs){scope.vertical=angular.isDefined(attrs.vertical)?scope.$parent.$eval(attrs.vertical):false;scope.justified=angular.isDefined(attrs.justified)?scope.$parent.$eval(attrs.justified):false}}}).directive("tab",["$parse","$log",function($parse,$log){return{require:"^tabset",restrict:"EA",replace:true,templateUrl:"template/tabs/tab.html",transclude:true,scope:{active:"=?",heading:"@",onSelect:"&select",onDeselect:"&deselect"},controller:function(){},link:function(scope,elm,attrs,tabsetCtrl,transclude){scope.$watch("active",function(active){if(active){tabsetCtrl.select(scope)}});scope.disabled=false;if(attrs.disable){scope.$parent.$watch($parse(attrs.disable),function(value){scope.disabled=!!value})}if(attrs.disabled){$log.warn('Use of "disabled" attribute has been deprecated, please use "disable"');scope.$parent.$watch($parse(attrs.disabled),function(value){scope.disabled=!!value})}scope.select=function(){if(!scope.disabled){scope.active=true}};tabsetCtrl.addTab(scope);scope.$on("$destroy",function(){tabsetCtrl.removeTab(scope)});scope.$transcludeFn=transclude}}}]).directive("tabHeadingTransclude",function(){return{restrict:"A",require:"^tab",link:function(scope,elm,attrs,tabCtrl){scope.$watch("headingElement",function updateHeadingElement(heading){if(heading){elm.html("");elm.append(heading)}})}}}).directive("tabContentTransclude",function(){return{restrict:"A",require:"^tabset",link:function(scope,elm,attrs){var tab=scope.$eval(attrs.tabContentTransclude);tab.$transcludeFn(tab.$parent,function(contents){angular.forEach(contents,function(node){if(isTabHeading(node)){tab.headingElement=node}else{elm.append(node)}})})}};function isTabHeading(node){return node.tagName&&(node.hasAttribute("tab-heading")||node.hasAttribute("data-tab-heading")||node.hasAttribute("x-tab-heading")||node.tagName.toLowerCase()==="tab-heading"||node.tagName.toLowerCase()==="data-tab-heading"||node.tagName.toLowerCase()==="x-tab-heading")}});angular.module("ui.bootstrap.timepicker",[]).constant("timepickerConfig",{hourStep:1,minuteStep:1,showMeridian:true,meridians:null,readonlyInput:false,mousewheel:true,arrowkeys:true,showSpinners:true}).controller("TimepickerController",["$scope","$attrs","$parse","$log","$locale","timepickerConfig",function($scope,$attrs,$parse,$log,$locale,timepickerConfig){var selected=new Date,ngModelCtrl={$setViewValue:angular.noop},meridians=angular.isDefined($attrs.meridians)?$scope.$parent.$eval($attrs.meridians):timepickerConfig.meridians||$locale.DATETIME_FORMATS.AMPMS;this.init=function(ngModelCtrl_,inputs){ngModelCtrl=ngModelCtrl_;ngModelCtrl.$render=this.render;ngModelCtrl.$formatters.unshift(function(modelValue){return modelValue?new Date(modelValue):null});var hoursInputEl=inputs.eq(0),minutesInputEl=inputs.eq(1);var mousewheel=angular.isDefined($attrs.mousewheel)?$scope.$parent.$eval($attrs.mousewheel):timepickerConfig.mousewheel;if(mousewheel){this.setupMousewheelEvents(hoursInputEl,minutesInputEl)}var arrowkeys=angular.isDefined($attrs.arrowkeys)?$scope.$parent.$eval($attrs.arrowkeys):timepickerConfig.arrowkeys;if(arrowkeys){this.setupArrowkeyEvents(hoursInputEl,minutesInputEl)}$scope.readonlyInput=angular.isDefined($attrs.readonlyInput)?$scope.$parent.$eval($attrs.readonlyInput):timepickerConfig.readonlyInput;this.setupInputEvents(hoursInputEl,minutesInputEl)};var hourStep=timepickerConfig.hourStep;if($attrs.hourStep){$scope.$parent.$watch($parse($attrs.hourStep),function(value){hourStep=parseInt(value,10)})}var minuteStep=timepickerConfig.minuteStep;if($attrs.minuteStep){$scope.$parent.$watch($parse($attrs.minuteStep),function(value){minuteStep=parseInt(value,10)})}var min;$scope.$parent.$watch($parse($attrs.min),function(value){var dt=new Date(value);min=isNaN(dt)?undefined:dt});var max;$scope.$parent.$watch($parse($attrs.max),function(value){var dt=new Date(value);max=isNaN(dt)?undefined:dt});$scope.noIncrementHours=function(){var incrementedSelected=addMinutes(selected,hourStep*60);return incrementedSelected>max||incrementedSelectedselected&&decrementedSelected>max};$scope.noIncrementMinutes=function(){var incrementedSelected=addMinutes(selected,minuteStep);return incrementedSelected>max||incrementedSelectedselected&&decrementedSelected>max};$scope.noToggleMeridian=function(){if(selected.getHours()<13){return addMinutes(selected,12*60)>max}else{return addMinutes(selected,-12*60)0&&hours<13:hours>=0&&hours<24;if(!valid){return undefined}if($scope.showMeridian){if(hours===12){hours=0}if($scope.meridian===meridians[1]){hours=hours+12}}return hours}function getMinutesFromTemplate(){var minutes=parseInt($scope.minutes,10);return minutes>=0&&minutes<60?minutes:undefined}function pad(value){return angular.isDefined(value)&&value.toString().length<2?"0"+value:value.toString()}this.setupMousewheelEvents=function(hoursInputEl,minutesInputEl){var isScrollingUp=function(e){if(e.originalEvent){e=e.originalEvent}var delta=e.wheelDelta?e.wheelDelta:-e.deltaY;return e.detail||delta>0};hoursInputEl.bind("mousewheel wheel",function(e){$scope.$apply(isScrollingUp(e)?$scope.incrementHours():$scope.decrementHours());e.preventDefault()});minutesInputEl.bind("mousewheel wheel",function(e){$scope.$apply(isScrollingUp(e)?$scope.incrementMinutes():$scope.decrementMinutes());e.preventDefault()})};this.setupArrowkeyEvents=function(hoursInputEl,minutesInputEl){hoursInputEl.bind("keydown",function(e){if(e.which===38){e.preventDefault();$scope.incrementHours();$scope.$apply()}else if(e.which===40){e.preventDefault();$scope.decrementHours();$scope.$apply()}});minutesInputEl.bind("keydown",function(e){if(e.which===38){e.preventDefault();$scope.incrementMinutes();$scope.$apply()}else if(e.which===40){e.preventDefault();$scope.decrementMinutes();$scope.$apply()}})};this.setupInputEvents=function(hoursInputEl,minutesInputEl){if($scope.readonlyInput){$scope.updateHours=angular.noop;$scope.updateMinutes=angular.noop;return}var invalidate=function(invalidHours,invalidMinutes){ngModelCtrl.$setViewValue(null);ngModelCtrl.$setValidity("time",false);if(angular.isDefined(invalidHours)){$scope.invalidHours=invalidHours}if(angular.isDefined(invalidMinutes)){$scope.invalidMinutes=invalidMinutes}};$scope.updateHours=function(){var hours=getHoursFromTemplate(),minutes=getMinutesFromTemplate();if(angular.isDefined(hours)&&angular.isDefined(minutes)){selected.setHours(hours);if(selectedmax){invalidate(true)}else{refresh("h")}}else{invalidate(true)}};hoursInputEl.bind("blur",function(e){if(!$scope.invalidHours&&$scope.hours<10){$scope.$apply(function(){$scope.hours=pad($scope.hours)})}});$scope.updateMinutes=function(){var minutes=getMinutesFromTemplate(),hours=getHoursFromTemplate();if(angular.isDefined(minutes)&&angular.isDefined(hours)){selected.setMinutes(minutes);if(selectedmax){invalidate(undefined,true)}else{refresh("m")}}else{invalidate(undefined,true)}};minutesInputEl.bind("blur",function(e){if(!$scope.invalidMinutes&&$scope.minutes<10){$scope.$apply(function(){$scope.minutes=pad($scope.minutes)})}})};this.render=function(){var date=ngModelCtrl.$viewValue;if(isNaN(date)){ngModelCtrl.$setValidity("time",false);$log.error('Timepicker directive: "ng-model" value must be a Date object, a number of milliseconds since 01.01.1970 or a string representing an RFC2822 or ISO 8601 date.')}else{if(date){selected=date}if(selectedmax){ngModelCtrl.$setValidity("time",false);$scope.invalidHours=true;$scope.invalidMinutes=true}else{makeValid()}updateTemplate()}};function refresh(keyboardChange){makeValid();ngModelCtrl.$setViewValue(new Date(selected));updateTemplate(keyboardChange)}function makeValid(){ngModelCtrl.$setValidity("time",true);$scope.invalidHours=false;$scope.invalidMinutes=false}function updateTemplate(keyboardChange){var hours=selected.getHours(),minutes=selected.getMinutes();if($scope.showMeridian){hours=hours===0||hours===12?12:hours%12}$scope.hours=keyboardChange==="h"?hours:pad(hours);if(keyboardChange!=="m"){$scope.minutes=pad(minutes)}$scope.meridian=selected.getHours()<12?meridians[0]:meridians[1]}function addMinutes(date,minutes){var dt=new Date(date.getTime()+minutes*6e4);var newDate=new Date(date);newDate.setHours(dt.getHours(),dt.getMinutes());return newDate}function addMinutesToSelected(minutes){selected=addMinutes(selected,minutes);refresh()}$scope.showSpinners=angular.isDefined($attrs.showSpinners)?$scope.$parent.$eval($attrs.showSpinners):timepickerConfig.showSpinners;$scope.incrementHours=function(){if(!$scope.noIncrementHours()){addMinutesToSelected(hourStep*60)}};$scope.decrementHours=function(){if(!$scope.noDecrementHours()){addMinutesToSelected(-hourStep*60)}};$scope.incrementMinutes=function(){if(!$scope.noIncrementMinutes()){addMinutesToSelected(minuteStep)}};$scope.decrementMinutes=function(){if(!$scope.noDecrementMinutes()){addMinutesToSelected(-minuteStep)}};$scope.toggleMeridian=function(){if(!$scope.noToggleMeridian()){addMinutesToSelected(12*60*(selected.getHours()<12?1:-1))}}}]).directive("timepicker",function(){return{restrict:"EA",require:["timepicker","?^ngModel"],controller:"TimepickerController",controllerAs:"timepicker",replace:true,scope:{},templateUrl:function(element,attrs){return attrs.templateUrl||"template/timepicker/timepicker.html"},link:function(scope,element,attrs,ctrls){var timepickerCtrl=ctrls[0],ngModelCtrl=ctrls[1];if(ngModelCtrl){timepickerCtrl.init(ngModelCtrl,element.find("input"))}}}});angular.module("ui.bootstrap.transition",[]).value("$transitionSuppressDeprecated",false).factory("$transition",["$q","$timeout","$rootScope","$log","$transitionSuppressDeprecated",function($q,$timeout,$rootScope,$log,$transitionSuppressDeprecated){if(!$transitionSuppressDeprecated){$log.warn("$transition is now deprecated. Use $animate from ngAnimate instead.")}var $transition=function(element,trigger,options){options=options||{};var deferred=$q.defer();var endEventName=$transition[options.animation?"animationEndEventName":"transitionEndEventName"];var transitionEndHandler=function(event){$rootScope.$apply(function(){element.unbind(endEventName,transitionEndHandler);deferred.resolve(element)})};if(endEventName){element.bind(endEventName,transitionEndHandler)}$timeout(function(){if(angular.isString(trigger)){element.addClass(trigger)}else if(angular.isFunction(trigger)){trigger(element)}else if(angular.isObject(trigger)){element.css(trigger)}if(!endEventName){deferred.resolve(element)}});deferred.promise.cancel=function(){if(endEventName){element.unbind(endEventName,transitionEndHandler)}deferred.reject("Transition cancelled")};return deferred.promise};var transElement=document.createElement("trans");var transitionEndEventNames={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",transition:"transitionend"};var animationEndEventNames={WebkitTransition:"webkitAnimationEnd",MozTransition:"animationend",OTransition:"oAnimationEnd",transition:"animationend"};function findEndEventName(endEventNames){for(var name in endEventNames){if(transElement.style[name]!==undefined){return endEventNames[name]}}}$transition.transitionEndEventName=findEndEventName(transitionEndEventNames);$transition.animationEndEventName=findEndEventName(animationEndEventNames);return $transition}]);angular.module("ui.bootstrap.typeahead",["ui.bootstrap.position"]).factory("typeaheadParser",["$parse",function($parse){var TYPEAHEAD_REGEXP=/^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w\d]*))\s+in\s+([\s\S]+?)$/;return{parse:function(input){var match=input.match(TYPEAHEAD_REGEXP);if(!match){throw new Error('Expected typeahead specification in form of "_modelValue_ (as _label_)? for _item_ in _collection_"'+' but got "'+input+'".')}return{itemName:match[3],source:$parse(match[4]),viewMapper:$parse(match[2]||match[1]),modelMapper:$parse(match[1])}}}}]).directive("typeahead",["$compile","$parse","$q","$timeout","$document","$window","$rootScope","$position","typeaheadParser",function($compile,$parse,$q,$timeout,$document,$window,$rootScope,$position,typeaheadParser){var HOT_KEYS=[9,13,27,38,40];var eventDebounceTime=200;return{require:["ngModel","^?ngModelOptions"],link:function(originalScope,element,attrs,ctrls){var modelCtrl=ctrls[0];var ngModelOptions=ctrls[1];var minLength=originalScope.$eval(attrs.typeaheadMinLength);if(!minLength&&minLength!==0){minLength=1}var waitTime=originalScope.$eval(attrs.typeaheadWaitMs)||0;var isEditable=originalScope.$eval(attrs.typeaheadEditable)!==false;var isLoadingSetter=$parse(attrs.typeaheadLoading).assign||angular.noop;var onSelectCallback=$parse(attrs.typeaheadOnSelect);var isSelectOnBlur=angular.isDefined(attrs.typeaheadSelectOnBlur)?originalScope.$eval(attrs.typeaheadSelectOnBlur):false;var isNoResultsSetter=$parse(attrs.typeaheadNoResults).assign||angular.noop;var inputFormatter=attrs.typeaheadInputFormatter?$parse(attrs.typeaheadInputFormatter):undefined;var appendToBody=attrs.typeaheadAppendToBody?originalScope.$eval(attrs.typeaheadAppendToBody):false;var focusFirst=originalScope.$eval(attrs.typeaheadFocusFirst)!==false;var selectOnExact=attrs.typeaheadSelectOnExact?originalScope.$eval(attrs.typeaheadSelectOnExact):false;var parsedModel=$parse(attrs.ngModel);var invokeModelSetter=$parse(attrs.ngModel+"($$$p)");var $setModelValue=function(scope,newValue){if(angular.isFunction(parsedModel(originalScope))&&ngModelOptions&&ngModelOptions.$options&&ngModelOptions.$options.getterSetter){return invokeModelSetter(scope,{$$$p:newValue})}else{return parsedModel.assign(scope,newValue)}};var parserResult=typeaheadParser.parse(attrs.typeahead);var hasFocus;var selected;var scope=originalScope.$new();var offDestroy=originalScope.$on("$destroy",function(){scope.$destroy()});scope.$on("$destroy",offDestroy);var popupId="typeahead-"+scope.$id+"-"+Math.floor(Math.random()*1e4);element.attr({"aria-autocomplete":"list","aria-expanded":false,"aria-owns":popupId});var popUpEl=angular.element("
      ");popUpEl.attr({id:popupId,matches:"matches",active:"activeIdx",select:"select(activeIdx)","move-in-progress":"moveInProgress",query:"query",position:"position"});if(angular.isDefined(attrs.typeaheadTemplateUrl)){popUpEl.attr("template-url",attrs.typeaheadTemplateUrl)}if(angular.isDefined(attrs.typeaheadPopupTemplateUrl)){popUpEl.attr("popup-template-url",attrs.typeaheadPopupTemplateUrl)}var resetMatches=function(){scope.matches=[];scope.activeIdx=-1;element.attr("aria-expanded",false)};var getMatchId=function(index){return popupId+"-option-"+index};scope.$watch("activeIdx",function(index){if(index<0){element.removeAttr("aria-activedescendant")}else{element.attr("aria-activedescendant",getMatchId(index))}});var inputIsExactMatch=function(inputValue,index){if(scope.matches.length>index&&inputValue){return inputValue.toUpperCase()===scope.matches[index].label.toUpperCase()}return false};var getMatchesAsync=function(inputValue){var locals={$viewValue:inputValue};isLoadingSetter(originalScope,true);isNoResultsSetter(originalScope,false);$q.when(parserResult.source(originalScope,locals)).then(function(matches){var onCurrentRequest=inputValue===modelCtrl.$viewValue;if(onCurrentRequest&&hasFocus){if(matches&&matches.length>0){scope.activeIdx=focusFirst?0:-1;isNoResultsSetter(originalScope,false);scope.matches.length=0;for(var i=0;i=minLength){if(waitTime>0){cancelPreviousTimeout();scheduleSearchWithTimeout(inputValue)}else{getMatchesAsync(inputValue)}}else{isLoadingSetter(originalScope,false);cancelPreviousTimeout();resetMatches()}if(isEditable){return inputValue}else{if(!inputValue){modelCtrl.$setValidity("editable",true);return null}else{modelCtrl.$setValidity("editable",false);return undefined}}});modelCtrl.$formatters.push(function(modelValue){var candidateViewValue,emptyViewValue;var locals={};if(!isEditable){modelCtrl.$setValidity("editable",true)}if(inputFormatter){locals.$model=modelValue;return inputFormatter(originalScope,locals)}else{locals[parserResult.itemName]=modelValue;candidateViewValue=parserResult.viewMapper(originalScope,locals);locals[parserResult.itemName]=undefined;emptyViewValue=parserResult.viewMapper(originalScope,locals);return candidateViewValue!==emptyViewValue?candidateViewValue:modelValue}});scope.select=function(activeIdx){var locals={};var model,item;selected=true;locals[parserResult.itemName]=item=scope.matches[activeIdx].model;model=parserResult.modelMapper(originalScope,locals);$setModelValue(originalScope,model);modelCtrl.$setValidity("editable",true);modelCtrl.$setValidity("parse",true);onSelectCallback(originalScope,{$item:item,$model:model,$label:parserResult.viewMapper(originalScope,locals)});resetMatches();if(scope.$eval(attrs.typeaheadFocusOnSelect)!==false){$timeout(function(){element[0].focus()},0,false)}};element.bind("keydown",function(evt){if(scope.matches.length===0||HOT_KEYS.indexOf(evt.which)===-1){return}if(scope.activeIdx===-1&&(evt.which===9||evt.which===13)){resetMatches();scope.$digest();return}evt.preventDefault();if(evt.which===40){scope.activeIdx=(scope.activeIdx+1)%scope.matches.length;scope.$digest()}else if(evt.which===38){scope.activeIdx=(scope.activeIdx>0?scope.activeIdx:scope.matches.length)-1;scope.$digest()}else if(evt.which===13||evt.which===9){scope.$apply(function(){scope.select(scope.activeIdx)})}else if(evt.which===27){evt.stopPropagation();resetMatches();scope.$digest()}});element.bind("blur",function(){if(isSelectOnBlur&&scope.matches.length&&scope.activeIdx!==-1&&!selected){selected=true;scope.$apply(function(){scope.select(scope.activeIdx)})}hasFocus=false;selected=false});var dismissClickHandler=function(evt){if(element[0]!==evt.target&&evt.which!==3&&scope.matches.length!==0){resetMatches();if(!$rootScope.$$phase){scope.$digest()}}};$document.bind("click",dismissClickHandler);originalScope.$on("$destroy",function(){$document.unbind("click",dismissClickHandler);if(appendToBody){$popup.remove()}popUpEl.remove()});var $popup=$compile(popUpEl)(scope);if(appendToBody){$document.find("body").append($popup)}else{element.after($popup)}}}}]).directive("typeaheadPopup",function(){return{restrict:"EA",scope:{matches:"=",query:"=",active:"=",position:"&",moveInProgress:"=",select:"&"},replace:true,templateUrl:function(element,attrs){return attrs.popupTemplateUrl||"template/typeahead/typeahead-popup.html"},link:function(scope,element,attrs){scope.templateUrl=attrs.templateUrl;scope.isOpen=function(){return scope.matches.length>0};scope.isActive=function(matchIdx){return scope.active==matchIdx};scope.selectActive=function(matchIdx){scope.active=matchIdx};scope.selectMatch=function(activeIdx){scope.select({activeIdx:activeIdx})}}}}).directive("typeaheadMatch",["$templateRequest","$compile","$parse",function($templateRequest,$compile,$parse){return{restrict:"EA",scope:{index:"=",match:"=",query:"="},link:function(scope,element,attrs){var tplUrl=$parse(attrs.templateUrl)(scope.$parent)||"template/typeahead/typeahead-match.html";$templateRequest(tplUrl).then(function(tplContent){$compile(tplContent.trim())(scope,function(clonedElement){element.replaceWith(clonedElement)})})}}}]).filter("typeaheadHighlight",["$sce","$injector","$log",function($sce,$injector,$log){var isSanitizePresent;isSanitizePresent=$injector.has("$sanitize");function escapeRegexp(queryToEscape){return queryToEscape.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")}function containsHtml(matchItem){return/<.*>/g.test(matchItem)}return function(matchItem,query){if(!isSanitizePresent&&containsHtml(matchItem)){$log.warn("Unsafe use of typeahead please use ngSanitize")}matchItem=query?(""+matchItem).replace(new RegExp(escapeRegexp(query),"gi"),"$&"):matchItem;if(!isSanitizePresent){matchItem=$sce.trustAsHtml(matchItem)}return matchItem}}]);angular.module("template/accordion/accordion-group.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/accordion/accordion-group.html","
      \n"+'
      \n'+'

      \n'+' {{heading}}\n'+"

      \n"+"
      \n"+'
      \n'+'
      \n'+"
      \n"+"
      \n"+"")}]);angular.module("template/accordion/accordion.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/accordion/accordion.html",'
      ')}]);angular.module("template/alert/alert.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/alert/alert.html","
      \n"+' \n"+"
      \n"+"
      \n"+"")}]);angular.module("template/carousel/carousel.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/carousel/carousel.html",'\n"+"")}]);angular.module("template/carousel/slide.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/carousel/slide.html",'
      \n'+"")}]);angular.module("template/datepicker/datepicker.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/datepicker/datepicker.html",'
      \n'+' \n'+' \n'+' \n'+"
      ")}]);angular.module("template/datepicker/day.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/datepicker/day.html",'\n'+" \n"+" \n"+' \n'+' \n'+' \n'+" \n"+" \n"+' \n'+' \n'+" \n"+" \n"+" \n"+' \n'+' \n'+' \n"+" \n"+" \n"+"
      {{::label.abbr}}
      {{ weekNumbers[$index] }}\n'+' \n'+"
      \n"+""); -}]);angular.module("template/datepicker/month.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/datepicker/month.html",'\n'+" \n"+" \n"+' \n'+' \n'+' \n'+" \n"+" \n"+" \n"+' \n'+' \n"+" \n"+" \n"+"
      \n'+' \n'+"
      \n"+"")}]);angular.module("template/datepicker/popup.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/datepicker/popup.html",'\n"+"")}]);angular.module("template/datepicker/year.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/datepicker/year.html",'\n'+" \n"+" \n"+' \n'+' \n'+' \n'+" \n"+" \n"+" \n"+' \n'+' \n"+" \n"+" \n"+"
      \n'+' \n'+"
      \n"+"")}]);angular.module("template/modal/backdrop.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/modal/backdrop.html",'\n"+"")}]);angular.module("template/modal/window.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/modal/window.html",'\n"+"")}]);angular.module("template/pagination/pager.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/pagination/pager.html",'\n"+"")}]);angular.module("template/pagination/pagination.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/pagination/pagination.html",'\n"+"")}]);angular.module("template/tooltip/tooltip-html-popup.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/tooltip/tooltip-html-popup.html",'
      \n'+'
      \n'+'
      \n'+"
      \n"+"")}]);angular.module("template/tooltip/tooltip-html-unsafe-popup.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/tooltip/tooltip-html-unsafe-popup.html",'
      \n'+'
      \n'+'
      \n'+"
      \n"+"")}]);angular.module("template/tooltip/tooltip-popup.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/tooltip/tooltip-popup.html",'
      \n'+'
      \n'+'
      \n'+"
      \n"+"")}]);angular.module("template/tooltip/tooltip-template-popup.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/tooltip/tooltip-template-popup.html",'
      \n'+'
      \n'+'
      \n'+"
      \n"+"")}]);angular.module("template/popover/popover-html.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/popover/popover-html.html",'
      \n'+'
      \n'+"\n"+'
      \n'+'

      \n'+'
      \n'+"
      \n"+"
      \n"+"")}]);angular.module("template/popover/popover-template.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/popover/popover-template.html",'
      \n'+'
      \n'+"\n"+'
      \n'+'

      \n'+'
      \n'+"
      \n"+"
      \n"+"")}]);angular.module("template/popover/popover.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/popover/popover.html",'
      \n'+'
      \n'+"\n"+'
      \n'+'

      \n'+'
      \n'+"
      \n"+"
      \n"+"")}]);angular.module("template/progressbar/bar.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/progressbar/bar.html",'
      \n'+"")}]);angular.module("template/progressbar/progress.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/progressbar/progress.html",'
      ')}]);angular.module("template/progressbar/progressbar.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/progressbar/progressbar.html",'
      \n'+'
      \n'+"
      \n"+"")}]);angular.module("template/rating/rating.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/rating/rating.html",'\n'+" ({{ $index < value ? '*' : ' ' }})\n"+' \n'+"\n"+"")}]);angular.module("template/tabs/tab.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/tabs/tab.html",'
    • \n'+' {{heading}}\n'+"
    • \n"+"")}]);angular.module("template/tabs/tabset.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/tabs/tabset.html","
      \n"+"
        \n"+'
        \n'+'
        \n'+"
        \n"+"
        \n"+"
        \n"+"")}]);angular.module("template/timepicker/timepicker.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/timepicker/timepicker.html","\n"+" \n"+' \n'+' \n'+" \n"+' \n'+' \n'+" \n"+" \n"+' \n"+" \n"+' \n"+' \n'+" \n"+' \n'+' \n'+" \n"+' \n'+' \n'+" \n"+" \n"+"
         
        \n'+' \n'+" :\n'+' \n'+"
         
        \n"+"")}]);angular.module("template/typeahead/typeahead-match.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/typeahead/typeahead-match.html",'\n'+"")}]);angular.module("template/typeahead/typeahead-popup.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/typeahead/typeahead-popup.html",'\n"+"")}]);!angular.$$csp()&&angular.element(document).find("head").prepend(''); \ No newline at end of file +}]);angular.module("template/datepicker/month.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/datepicker/month.html",'\n'+" \n"+" \n"+' \n'+' \n'+' \n'+" \n"+" \n"+" \n"+' \n'+' \n"+" \n"+" \n"+"
        \n'+' \n'+"
        \n"+"")}]);angular.module("template/datepicker/popup.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/datepicker/popup.html",'\n"+"")}]);angular.module("template/datepicker/year.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/datepicker/year.html",'\n'+" \n"+" \n"+' \n'+' \n'+' \n'+" \n"+" \n"+" \n"+' \n'+' \n"+" \n"+" \n"+"
        \n'+' \n'+"
        \n"+"")}]);angular.module("template/modal/backdrop.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/modal/backdrop.html",'\n"+"")}]);angular.module("template/modal/window.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/modal/window.html",'\n"+"")}]);angular.module("template/pagination/pager.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/pagination/pager.html",'\n"+"")}]);angular.module("template/pagination/pagination.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/pagination/pagination.html",'\n"+"")}]);angular.module("template/tooltip/tooltip-html-popup.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/tooltip/tooltip-html-popup.html",'
        \n'+'
        \n'+'
        \n'+"
        \n"+"")}]);angular.module("template/tooltip/tooltip-html-unsafe-popup.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/tooltip/tooltip-html-unsafe-popup.html",'
        \n'+'
        \n'+'
        \n'+"
        \n"+"")}]);angular.module("template/tooltip/tooltip-popup.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/tooltip/tooltip-popup.html",'
        \n'+'
        \n'+'
        \n'+"
        \n"+"")}]);angular.module("template/tooltip/tooltip-template-popup.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/tooltip/tooltip-template-popup.html",'
        \n'+'
        \n'+'
        \n'+"
        \n"+"")}]);angular.module("template/popover/popover-html.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/popover/popover-html.html",'
        \n'+'
        \n'+"\n"+'
        \n'+'

        \n'+'
        \n'+"
        \n"+"
        \n"+"")}]);angular.module("template/popover/popover-template.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/popover/popover-template.html",'
        \n'+'
        \n'+"\n"+'
        \n'+'

        \n'+'
        \n'+"
        \n"+"
        \n"+"")}]);angular.module("template/popover/popover.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/popover/popover.html",'
        \n'+'
        \n'+"\n"+'
        \n'+'

        \n'+'
        \n'+"
        \n"+"
        \n"+"")}]);angular.module("template/progressbar/bar.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/progressbar/bar.html",'
        \n'+"")}]);angular.module("template/progressbar/progress.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/progressbar/progress.html",'
        ')}]);angular.module("template/progressbar/progressbar.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/progressbar/progressbar.html",'
        \n'+'
        \n'+"
        \n"+"")}]);angular.module("template/rating/rating.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/rating/rating.html",'\n'+" ({{ $index < value ? '*' : ' ' }})\n"+' \n'+"\n"+"")}]);angular.module("template/tabs/tab.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/tabs/tab.html",'
      • \n'+' {{heading}}\n'+"
      • \n"+"")}]);angular.module("template/tabs/tabset.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/tabs/tabset.html","
        \n"+"
          \n"+'
          \n'+'
          \n'+"
          \n"+"
          \n"+"
          \n"+"")}]);angular.module("template/timepicker/timepicker.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/timepicker/timepicker.html","\n"+" \n"+' \n'+' \n'+" \n"+' \n'+' \n'+" \n"+" \n"+' \n"+" \n"+' \n"+' \n'+" \n"+' \n'+' \n'+" \n"+' \n'+' \n'+" \n"+" \n"+"
           
          \n'+' \n'+" :\n'+' \n'+"
           
          \n"+"")}]);angular.module("template/typeahead/typeahead-match.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/typeahead/typeahead-match.html",'\n'+"")}]);angular.module("template/typeahead/typeahead-popup.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/typeahead/typeahead-popup.html",'\n"+"")}]);!angular.$$csp()&&angular.element(document).find("head").prepend('');"use strict";angular.module("HomeModule",["ui.bootstrap"],function($rootScopeProvider){$rootScopeProvider.digestTtl(1e3)}).controller("HomeController",["$scope","$http","$modal","$q","$log",function($scope,$http,$modal,$q,$log){var languagesUrl=$("#languagesUrl").data("lingvodoc");var dictionariesUrl=$("#dictionariesUrl").data("lingvodoc");var getUserInfoUrl=$("#getUserInfoUrl").data("lingvodoc");var dictionaryQuery={published:true};$scope.languages=[];$scope.dictionaries=[];$scope.groupDictionaries=[];$scope.count=0;var flatLanguages=function(languages){var flat=[];for(var i=0;i0){var childLangs=flatLanguages(language.contains);flat=flat.concat(childLangs)}}return flat};var getLanguage=function(client_id,object_id){for(var i=0;i<$scope.languages.length;i++){if($scope.languages[i].client_id==client_id&&$scope.languages[i].object_id==object_id){return $scope.languages[i]}}};var createGroupDictionaries=function(languages,dictionaries){var group=[];for(var i=0;i=0?name:name+"@"+(inherited?inherited.state.name:"")}angular.module("ui.router.state").directive("uiView",$ViewDirective);angular.module("ui.router.state").directive("uiView",$ViewDirectiveFill);function parseStateRef(ref,current){var preparsed=ref.match(/^\s*({[^}]*})\s*$/),parsed;if(preparsed)ref=current+"("+preparsed[1]+")";parsed=ref.replace(/\n/g," ").match(/^([^(]+?)\s*(\((.*)\))?$/);if(!parsed||parsed.length!==4)throw new Error("Invalid state ref '"+ref+"'");return{state:parsed[1],paramExpr:parsed[3]||null}}function stateContext(el){var stateData=el.parent().inheritedData("$uiView");if(stateData&&stateData.state&&stateData.state.name){return stateData.state}}$StateRefDirective.$inject=["$state","$timeout"];function $StateRefDirective($state,$timeout){var allowedOptions=["location","inherit","reload","absolute"];return{restrict:"A",require:["?^uiSrefActive","?^uiSrefActiveEq"],link:function(scope,element,attrs,uiSrefActive){var ref=parseStateRef(attrs.uiSref,$state.current.name);var params=null,url=null,base=stateContext(element)||$state.$current;var hrefKind=Object.prototype.toString.call(element.prop("href"))==="[object SVGAnimatedString]"?"xlink:href":"href";var newHref=null,isAnchor=element.prop("tagName").toUpperCase()==="A";var isForm=element[0].nodeName==="FORM";var attr=isForm?"action":hrefKind,nav=true;var options={relative:base,inherit:true};var optionsOverride=scope.$eval(attrs.uiSrefOpts)||{};angular.forEach(allowedOptions,function(option){if(option in optionsOverride){options[option]=optionsOverride[option]}});var update=function(newVal){if(newVal)params=angular.copy(newVal);if(!nav)return;newHref=$state.href(ref.state,params,options);var activeDirective=uiSrefActive[1]||uiSrefActive[0];if(activeDirective){activeDirective.$$addStateInfo(ref.state,params)}if(newHref===null){nav=false;return false}attrs.$set(attr,newHref)};if(ref.paramExpr){scope.$watch(ref.paramExpr,function(newVal,oldVal){if(newVal!==params)update(newVal)},true);params=angular.copy(scope.$eval(ref.paramExpr))}update();if(isForm)return;element.bind("click",function(e){var button=e.which||e.button;if(!(button>1||e.ctrlKey||e.metaKey||e.shiftKey||element.attr("target"))){var transition=$timeout(function(){$state.go(ref.state,params,options)});e.preventDefault();var ignorePreventDefaultCount=isAnchor&&!newHref?1:0;e.preventDefault=function(){if(ignorePreventDefaultCount--<=0)$timeout.cancel(transition)}}})}}}$StateRefActiveDirective.$inject=["$state","$stateParams","$interpolate"];function $StateRefActiveDirective($state,$stateParams,$interpolate){return{restrict:"A",controller:["$scope","$element","$attrs",function($scope,$element,$attrs){var states=[],activeClass;activeClass=$interpolate($attrs.uiSrefActiveEq||$attrs.uiSrefActive||"",false)($scope);this.$$addStateInfo=function(newState,newParams){var state=$state.get(newState,stateContext($element));states.push({state:state||{name:newState},params:newParams});update()};$scope.$on("$stateChangeSuccess",update);function update(){if(anyMatch()){$element.addClass(activeClass)}else{$element.removeClass(activeClass)}}function anyMatch(){for(var i=0;i0){className+=i>0?" ":"";className+=isPrefix?fix+klass:klass+fix}});return className}function removeFromArray(arr,val){var index=arr.indexOf(val);if(val>=0){arr.splice(index,1)}}function stripCommentsFromElement(element){if(element instanceof jqLite){switch(element.length){case 0:return[];break;case 1:if(element[0].nodeType===ELEMENT_NODE){return element}break;default:return jqLite(extractElementNode(element));break}}if(element.nodeType===ELEMENT_NODE){return jqLite(element)}}function extractElementNode(element){if(!element[0])return element;for(var i=0;i=0){val=parseMaxTime(val)}if(val===0){val=null}styles[actualStyleName]=val}});return styles}function parseMaxTime(str){var maxValue=0;var values=str.split(/\s*,\s*/);forEach(values,function(value){if(value.charAt(value.length-1)=="s"){value=value.substring(0,value.length-1)}value=parseFloat(value)||0;maxValue=maxValue?Math.max(value,maxValue):value});return maxValue}function truthyTimingValue(val){return val===0||val!=null}function getCssTransitionDurationStyle(duration,applyOnlyDuration){var style=TRANSITION_PROP;var value=duration+"s";if(applyOnlyDuration){style+=DURATION_KEY}else{value+=" linear all"}return[style,value]}function createLocalCacheLookup(){var cache=Object.create(null);return{flush:function(){cache=Object.create(null)},count:function(key){var entry=cache[key];return entry?entry.total:0},get:function(key){var entry=cache[key];return entry&&entry.value},put:function(key,value){if(!cache[key]){cache[key]={total:1,value:value}}else{cache[key].total++}}}}var $AnimateCssProvider=["$animateProvider",function($animateProvider){var gcsLookup=createLocalCacheLookup();var gcsStaggerLookup=createLocalCacheLookup();this.$get=["$window","$$jqLite","$$AnimateRunner","$timeout","$$forceReflow","$sniffer","$$rAFScheduler","$animate",function($window,$$jqLite,$$AnimateRunner,$timeout,$$forceReflow,$sniffer,$$rAFScheduler,$animate){var applyAnimationClasses=applyAnimationClassesFactory($$jqLite);var parentCounter=0;function gcsHashFn(node,extraClasses){var KEY="$$ngAnimateParentKey";var parentNode=node.parentNode;var parentID=parentNode[KEY]||(parentNode[KEY]=++parentCounter);return parentID+"-"+node.getAttribute("class")+"-"+extraClasses}function computeCachedCssStyles(node,className,cacheKey,properties){var timings=gcsLookup.get(cacheKey);if(!timings){timings=computeCssStyles($window,node,properties);if(timings.animationIterationCount==="infinite"){timings.animationIterationCount=1}}gcsLookup.put(cacheKey,timings);return timings}function computeCachedCssStaggerStyles(node,className,cacheKey,properties){var stagger;if(gcsLookup.count(cacheKey)>0){stagger=gcsStaggerLookup.get(cacheKey);if(!stagger){var staggerClassName=pendClasses(className,"-stagger");$$jqLite.addClass(node,staggerClassName);stagger=computeCssStyles($window,node,properties);stagger.animationDuration=Math.max(stagger.animationDuration,0);stagger.transitionDuration=Math.max(stagger.transitionDuration,0);$$jqLite.removeClass(node,staggerClassName);gcsStaggerLookup.put(cacheKey,stagger)}}return stagger||{}}var cancelLastRAFRequest;var rafWaitQueue=[];function waitUntilQuiet(callback){rafWaitQueue.push(callback);$$rAFScheduler.waitUntilQuiet(function(){gcsLookup.flush();gcsStaggerLookup.flush();var pageWidth=$$forceReflow();for(var i=0;i0;var containsKeyframeAnimation=(options.keyframeStyle||"").length>0;if(!containsKeyframeAnimation&&!hasToStyles&&!preparationClasses){return closeAndReturnNoopAnimator()}var cacheKey,stagger;if(options.stagger>0){var staggerVal=parseFloat(options.stagger);stagger={transitionDelay:staggerVal,animationDelay:staggerVal,transitionDuration:0,animationDuration:0}}else{cacheKey=gcsHashFn(node,fullClassName);stagger=computeCachedCssStaggerStyles(node,preparationClasses,cacheKey,DETECT_STAGGER_CSS_PROPERTIES)}if(!options.$$skipPreparationClasses){$$jqLite.addClass(element,preparationClasses)}var applyOnlyDuration;if(options.transitionStyle){var transitionStyle=[TRANSITION_PROP,options.transitionStyle];applyInlineStyle(node,transitionStyle);temporaryStyles.push(transitionStyle)}if(options.duration>=0){applyOnlyDuration=node.style[TRANSITION_PROP].length>0;var durationStyle=getCssTransitionDurationStyle(options.duration,applyOnlyDuration);applyInlineStyle(node,durationStyle);temporaryStyles.push(durationStyle)}if(options.keyframeStyle){var keyframeStyle=[ANIMATION_PROP,options.keyframeStyle];applyInlineStyle(node,keyframeStyle);temporaryStyles.push(keyframeStyle)}var itemIndex=stagger?options.staggerIndex>=0?options.staggerIndex:gcsLookup.count(cacheKey):0;var isFirst=itemIndex===0;if(isFirst&&!options.skipBlocking){blockTransitions(node,SAFE_FAST_FORWARD_DURATION_VALUE)}var timings=computeTimings(node,fullClassName,cacheKey);var relativeDelay=timings.maxDelay;maxDelay=Math.max(relativeDelay,0);maxDuration=timings.maxDuration;var flags={};flags.hasTransitions=timings.transitionDuration>0;flags.hasAnimations=timings.animationDuration>0;flags.hasTransitionAll=flags.hasTransitions&&timings.transitionProperty=="all";flags.applyTransitionDuration=hasToStyles&&(flags.hasTransitions&&!flags.hasTransitionAll||flags.hasAnimations&&!flags.hasTransitions);flags.applyAnimationDuration=options.duration&&flags.hasAnimations;flags.applyTransitionDelay=truthyTimingValue(options.delay)&&(flags.applyTransitionDuration||flags.hasTransitions);flags.applyAnimationDelay=truthyTimingValue(options.delay)&&flags.hasAnimations;flags.recalculateTimingStyles=addRemoveClassName.length>0;if(flags.applyTransitionDuration||flags.applyAnimationDuration){maxDuration=options.duration?parseFloat(options.duration):maxDuration;if(flags.applyTransitionDuration){flags.hasTransitions=true;timings.transitionDuration=maxDuration;applyOnlyDuration=node.style[TRANSITION_PROP+PROPERTY_KEY].length>0;temporaryStyles.push(getCssTransitionDurationStyle(maxDuration,applyOnlyDuration))}if(flags.applyAnimationDuration){flags.hasAnimations=true;timings.animationDuration=maxDuration;temporaryStyles.push(getCssKeyframeDurationStyle(maxDuration))}}if(maxDuration===0&&!flags.recalculateTimingStyles){return closeAndReturnNoopAnimator()}if(options.delay!=null){var delayStyle=parseFloat(options.delay);if(flags.applyTransitionDelay){temporaryStyles.push(getCssDelayStyle(delayStyle))}if(flags.applyAnimationDelay){temporaryStyles.push(getCssDelayStyle(delayStyle,true))}}if(options.duration==null&&timings.transitionDuration>0){flags.recalculateTimingStyles=flags.recalculateTimingStyles||isFirst}maxDelayTime=maxDelay*ONE_SECOND;maxDurationTime=maxDuration*ONE_SECOND;if(!options.skipBlocking){flags.blockTransition=timings.transitionDuration>0;flags.blockKeyframeAnimation=timings.animationDuration>0&&stagger.animationDelay>0&&stagger.animationDuration===0}applyAnimationFromStyles(element,options);if(flags.blockTransition||flags.blockKeyframeAnimation){applyBlocking(maxDuration)}else if(!options.skipBlocking){blockTransitions(node,false)}return{$$willAnimate:true,end:endFn,start:function(){if(animationClosed)return;runnerHost={end:endFn,cancel:cancelFn,resume:null,pause:null};runner=new $$AnimateRunner(runnerHost);waitUntilQuiet(start);return runner}};function endFn(){close()}function cancelFn(){close(true)}function close(rejected){if(animationClosed||animationCompleted&&animationPaused)return;animationClosed=true;animationPaused=false;if(!options.$$skipPreparationClasses){$$jqLite.removeClass(element,preparationClasses)}$$jqLite.removeClass(element,activeClasses);blockKeyframeAnimations(node,false);blockTransitions(node,false);forEach(temporaryStyles,function(entry){node.style[entry[0]]=""});applyAnimationClasses(element,options);applyAnimationStyles(element,options);if(options.onDone){options.onDone()}if(runner){runner.complete(!rejected)}}function applyBlocking(duration){if(flags.blockTransition){blockTransitions(node,duration)}if(flags.blockKeyframeAnimation){blockKeyframeAnimations(node,!!duration)}}function closeAndReturnNoopAnimator(){runner=new $$AnimateRunner({end:endFn,cancel:cancelFn});waitUntilQuiet(noop);close();return{$$willAnimate:false,start:function(){return runner},end:endFn}}function start(){if(animationClosed)return;if(!node.parentNode){close();return}var startTime,events=[];var playPause=function(playAnimation){if(!animationCompleted){animationPaused=!playAnimation;if(timings.animationDuration){var value=blockKeyframeAnimations(node,animationPaused);animationPaused?temporaryStyles.push(value):removeFromArray(temporaryStyles,value)}}else if(animationPaused&&playAnimation){animationPaused=false;close()}};var maxStagger=itemIndex>0&&(timings.transitionDuration&&stagger.transitionDuration===0||timings.animationDuration&&stagger.animationDuration===0)&&Math.max(stagger.animationDelay,stagger.transitionDelay);if(maxStagger){$timeout(triggerAnimationStart,Math.floor(maxStagger*itemIndex*ONE_SECOND),false)}else{triggerAnimationStart()}runnerHost.resume=function(){playPause(true)};runnerHost.pause=function(){playPause(false)};function triggerAnimationStart(){if(animationClosed)return;applyBlocking(false);forEach(temporaryStyles,function(entry){var key=entry[0];var value=entry[1];node.style[key]=value});applyAnimationClasses(element,options);$$jqLite.addClass(element,activeClasses);if(flags.recalculateTimingStyles){fullClassName=node.className+" "+preparationClasses;cacheKey=gcsHashFn(node,fullClassName);timings=computeTimings(node,fullClassName,cacheKey);relativeDelay=timings.maxDelay;maxDelay=Math.max(relativeDelay,0);maxDuration=timings.maxDuration;if(maxDuration===0){close();return}flags.hasTransitions=timings.transitionDuration>0;flags.hasAnimations=timings.animationDuration>0}if(flags.applyAnimationDelay){relativeDelay=typeof options.delay!=="boolean"&&truthyTimingValue(options.delay)?parseFloat(options.delay):relativeDelay;maxDelay=Math.max(relativeDelay,0);timings.animationDelay=relativeDelay;delayStyle=getCssDelayStyle(relativeDelay,true);temporaryStyles.push(delayStyle);node.style[delayStyle[0]]=delayStyle[1]}maxDelayTime=maxDelay*ONE_SECOND;maxDurationTime=maxDuration*ONE_SECOND;if(options.easing){var easeProp,easeVal=options.easing;if(flags.hasTransitions){easeProp=TRANSITION_PROP+TIMING_KEY;temporaryStyles.push([easeProp,easeVal]);node.style[easeProp]=easeVal}if(flags.hasAnimations){easeProp=ANIMATION_PROP+TIMING_KEY;temporaryStyles.push([easeProp,easeVal]);node.style[easeProp]=easeVal}}if(timings.transitionDuration){events.push(TRANSITIONEND_EVENT)}if(timings.animationDuration){events.push(ANIMATIONEND_EVENT)}startTime=Date.now();var timerTime=maxDelayTime+CLOSING_TIME_BUFFER*maxDurationTime;var endTime=startTime+timerTime;var animationsData=element.data(ANIMATE_TIMER_KEY)||[];var setupFallbackTimer=true;if(animationsData.length){var currentTimerData=animationsData[0];setupFallbackTimer=endTime>currentTimerData.expectedEndTime;if(setupFallbackTimer){$timeout.cancel(currentTimerData.timer)}else{animationsData.push(close)}}if(setupFallbackTimer){var timer=$timeout(onAnimationExpired,timerTime,false);animationsData[0]={timer:timer,expectedEndTime:endTime};animationsData.push(close);element.data(ANIMATE_TIMER_KEY,animationsData)}element.on(events.join(" "),onAnimationProgress);applyAnimationToStyles(element,options)}function onAnimationExpired(){var animationsData=element.data(ANIMATE_TIMER_KEY);if(animationsData){for(var i=1;i=maxDelayTime&&elapsedTime>=maxDuration){animationCompleted=true;close()}}}}}]}];var $$AnimateCssDriverProvider=["$$animationProvider",function($$animationProvider){$$animationProvider.drivers.push("$$animateCssDriver");var NG_ANIMATE_SHIM_CLASS_NAME="ng-animate-shim";var NG_ANIMATE_ANCHOR_CLASS_NAME="ng-anchor";var NG_OUT_ANCHOR_CLASS_NAME="ng-anchor-out";var NG_IN_ANCHOR_CLASS_NAME="ng-anchor-in";this.$get=["$animateCss","$rootScope","$$AnimateRunner","$rootElement","$$body","$sniffer","$$jqLite",function($animateCss,$rootScope,$$AnimateRunner,$rootElement,$$body,$sniffer,$$jqLite){if(!$sniffer.animations&&!$sniffer.transitions)return noop;var bodyNode=getDomNode($$body);var rootNode=getDomNode($rootElement);var rootBodyElement=jqLite(bodyNode.parentNode===rootNode?bodyNode:rootNode);var applyAnimationClasses=applyAnimationClassesFactory($$jqLite);return function initDriverFn(animationDetails){return animationDetails.from&&animationDetails.to?prepareFromToAnchorAnimation(animationDetails.from,animationDetails.to,animationDetails.classes,animationDetails.anchors):prepareRegularAnimation(animationDetails)};function filterCssClasses(classes){return classes.replace(/\bng-\S+\b/g,"")}function getUniqueValues(a,b){if(isString(a))a=a.split(" ");if(isString(b))b=b.split(" ");return a.filter(function(val){return b.indexOf(val)===-1}).join(" ")}function prepareAnchoredAnimation(classes,outAnchor,inAnchor){var clone=jqLite(getDomNode(outAnchor).cloneNode(true));var startingClasses=filterCssClasses(getClassVal(clone));outAnchor.addClass(NG_ANIMATE_SHIM_CLASS_NAME);inAnchor.addClass(NG_ANIMATE_SHIM_CLASS_NAME);clone.addClass(NG_ANIMATE_ANCHOR_CLASS_NAME);rootBodyElement.append(clone);var animatorIn,animatorOut=prepareOutAnimation();if(!animatorOut){animatorIn=prepareInAnimation();if(!animatorIn){return end()}}var startingAnimator=animatorOut||animatorIn;return{start:function(){var runner;var currentAnimation=startingAnimator.start();currentAnimation.done(function(){currentAnimation=null;if(!animatorIn){animatorIn=prepareInAnimation();if(animatorIn){currentAnimation=animatorIn.start();currentAnimation.done(function(){currentAnimation=null;end();runner.complete()});return currentAnimation}}end();runner.complete()});runner=new $$AnimateRunner({end:endFn,cancel:endFn});return runner;function endFn(){if(currentAnimation){currentAnimation.end()}}}};function calculateAnchorStyles(anchor){var styles={};var coords=getDomNode(anchor).getBoundingClientRect();forEach(["width","height","top","left"],function(key){var value=coords[key];switch(key){case"top":value+=bodyNode.scrollTop;break;case"left":value+=bodyNode.scrollLeft;break}styles[key]=Math.floor(value)+"px"});return styles; }function prepareOutAnimation(){var animator=$animateCss(clone,{addClass:NG_OUT_ANCHOR_CLASS_NAME,delay:true,from:calculateAnchorStyles(outAnchor)});return animator.$$willAnimate?animator:null}function getClassVal(element){return element.attr("class")||""}function prepareInAnimation(){var endingClasses=filterCssClasses(getClassVal(inAnchor));var toAdd=getUniqueValues(endingClasses,startingClasses);var toRemove=getUniqueValues(startingClasses,endingClasses);var animator=$animateCss(clone,{to:calculateAnchorStyles(inAnchor),addClass:NG_IN_ANCHOR_CLASS_NAME+" "+toAdd,removeClass:NG_OUT_ANCHOR_CLASS_NAME+" "+toRemove,delay:true});return animator.$$willAnimate?animator:null}function end(){clone.remove();outAnchor.removeClass(NG_ANIMATE_SHIM_CLASS_NAME);inAnchor.removeClass(NG_ANIMATE_SHIM_CLASS_NAME)}}function prepareFromToAnchorAnimation(from,to,classes,anchors){var fromAnimation=prepareRegularAnimation(from,noop);var toAnimation=prepareRegularAnimation(to,noop);var anchorAnimations=[];forEach(anchors,function(anchor){var outElement=anchor["out"];var inElement=anchor["in"];var animator=prepareAnchoredAnimation(classes,outElement,inElement);if(animator){anchorAnimations.push(animator)}});if(!fromAnimation&&!toAnimation&&anchorAnimations.length===0)return;return{start:function(){var animationRunners=[];if(fromAnimation){animationRunners.push(fromAnimation.start())}if(toAnimation){animationRunners.push(toAnimation.start())}forEach(anchorAnimations,function(animation){animationRunners.push(animation.start())});var runner=new $$AnimateRunner({end:endFn,cancel:endFn});$$AnimateRunner.all(animationRunners,function(status){runner.complete(status)});return runner;function endFn(){forEach(animationRunners,function(runner){runner.end()})}}}}function prepareRegularAnimation(animationDetails){var element=animationDetails.element;var options=animationDetails.options||{};if(animationDetails.structural){options.event=animationDetails.event;options.structural=true;options.applyClassesEarly=true;if(animationDetails.event==="leave"){options.onDone=options.domOperation}}if(options.preparationClasses){options.event=concatWithSpace(options.event,options.preparationClasses)}var animator=$animateCss(element,options);return animator.$$willAnimate?animator:null}}]}];var $$AnimateJsProvider=["$animateProvider",function($animateProvider){this.$get=["$injector","$$AnimateRunner","$$jqLite",function($injector,$$AnimateRunner,$$jqLite){var applyAnimationClasses=applyAnimationClassesFactory($$jqLite);return function(element,event,classes,options){if(arguments.length===3&&isObject(classes)){options=classes;classes=null}options=prepareAnimationOptions(options);if(!classes){classes=element.attr("class")||"";if(options.addClass){classes+=" "+options.addClass}if(options.removeClass){classes+=" "+options.removeClass}}var classesToAdd=options.addClass;var classesToRemove=options.removeClass;var animations=lookupAnimations(classes);var before,after;if(animations.length){var afterFn,beforeFn;if(event=="leave"){beforeFn="leave";afterFn="afterLeave"}else{beforeFn="before"+event.charAt(0).toUpperCase()+event.substr(1);afterFn=event}if(event!=="enter"&&event!=="move"){before=packageAnimations(element,event,options,animations,beforeFn)}after=packageAnimations(element,event,options,animations,afterFn)}if(!before&&!after)return;function applyOptions(){options.domOperation();applyAnimationClasses(element,options)}return{start:function(){var closeActiveAnimations;var chain=[];if(before){chain.push(function(fn){closeActiveAnimations=before(fn)})}if(chain.length){chain.push(function(fn){applyOptions();fn(true)})}else{applyOptions()}if(after){chain.push(function(fn){closeActiveAnimations=after(fn)})}var animationClosed=false;var runner=new $$AnimateRunner({end:function(){endAnimations()},cancel:function(){endAnimations(true)}});$$AnimateRunner.chain(chain,onComplete);return runner;function onComplete(success){animationClosed=true;applyOptions();applyAnimationStyles(element,options);runner.complete(success)}function endAnimations(cancelled){if(!animationClosed){(closeActiveAnimations||noop)(cancelled);onComplete(cancelled)}}}};function executeAnimationFn(fn,element,event,options,onDone){var args;switch(event){case"animate":args=[element,options.from,options.to,onDone];break;case"setClass":args=[element,classesToAdd,classesToRemove,onDone];break;case"addClass":args=[element,classesToAdd,onDone];break;case"removeClass":args=[element,classesToRemove,onDone];break;default:args=[element,onDone];break}args.push(options);var value=fn.apply(fn,args);if(value){if(isFunction(value.start)){value=value.start()}if(value instanceof $$AnimateRunner){value.done(onDone)}else if(isFunction(value)){return value}}return noop}function groupEventedAnimations(element,event,options,animations,fnName){var operations=[];forEach(animations,function(ani){var animation=ani[fnName];if(!animation)return;operations.push(function(){var runner;var endProgressCb;var resolved=false;var onAnimationComplete=function(rejected){if(!resolved){resolved=true;(endProgressCb||noop)(rejected);runner.complete(!rejected)}};runner=new $$AnimateRunner({end:function(){onAnimationComplete()},cancel:function(){onAnimationComplete(true)}});endProgressCb=executeAnimationFn(animation,element,event,options,function(result){var cancelled=result===false;onAnimationComplete(cancelled)});return runner})});return operations}function packageAnimations(element,event,options,animations,fnName){var operations=groupEventedAnimations(element,event,options,animations,fnName);if(operations.length===0){var a,b;if(fnName==="beforeSetClass"){a=groupEventedAnimations(element,"removeClass",options,animations,"beforeRemoveClass");b=groupEventedAnimations(element,"addClass",options,animations,"beforeAddClass")}else if(fnName==="setClass"){a=groupEventedAnimations(element,"removeClass",options,animations,"removeClass");b=groupEventedAnimations(element,"addClass",options,animations,"addClass")}if(a){operations=operations.concat(a)}if(b){operations=operations.concat(b)}}if(operations.length===0)return;return function startAnimation(callback){var runners=[];if(operations.length){forEach(operations,function(animateFn){runners.push(animateFn())})}runners.length?$$AnimateRunner.all(runners,callback):callback();return function endFn(reject){forEach(runners,function(runner){reject?runner.cancel():runner.end()})}}}};function lookupAnimations(classes){classes=isArray(classes)?classes:classes.split(" ");var matches=[],flagMap={};for(var i=0;i0;var b=(options.removeClass||"").length>0;return and?a&&b:a||b}rules.join.push(function(element,newAnimation,currentAnimation){return!newAnimation.structural&&hasAnimationClasses(newAnimation.options)});rules.skip.push(function(element,newAnimation,currentAnimation){return!newAnimation.structural&&!hasAnimationClasses(newAnimation.options)});rules.skip.push(function(element,newAnimation,currentAnimation){return currentAnimation.event=="leave"&&newAnimation.structural});rules.skip.push(function(element,newAnimation,currentAnimation){return currentAnimation.structural&¤tAnimation.state===RUNNING_STATE&&!newAnimation.structural});rules.cancel.push(function(element,newAnimation,currentAnimation){return currentAnimation.structural&&newAnimation.structural});rules.cancel.push(function(element,newAnimation,currentAnimation){return currentAnimation.state===RUNNING_STATE&&newAnimation.structural});rules.cancel.push(function(element,newAnimation,currentAnimation){var nO=newAnimation.options;var cO=currentAnimation.options;return nO.addClass&&nO.addClass===cO.removeClass||nO.removeClass&&nO.removeClass===cO.addClass});this.$get=["$$rAF","$rootScope","$rootElement","$document","$$body","$$HashMap","$$animation","$$AnimateRunner","$templateRequest","$$jqLite","$$forceReflow",function($$rAF,$rootScope,$rootElement,$document,$$body,$$HashMap,$$animation,$$AnimateRunner,$templateRequest,$$jqLite,$$forceReflow){var activeAnimationsLookup=new $$HashMap;var disabledElementsLookup=new $$HashMap;var animationsEnabled=null;var deregisterWatch=$rootScope.$watch(function(){return $templateRequest.totalPendingRequests===0},function(isEmpty){if(!isEmpty)return;deregisterWatch();$rootScope.$$postDigest(function(){$rootScope.$$postDigest(function(){if(animationsEnabled===null){animationsEnabled=true}})})});var callbackRegistry={};var classNameFilter=$animateProvider.classNameFilter();var isAnimatableClassName=!classNameFilter?function(){return true}:function(className){return classNameFilter.test(className)};var applyAnimationClasses=applyAnimationClassesFactory($$jqLite);function normalizeAnimationOptions(element,options){return mergeAnimationOptions(element,options,{})}function findCallbacks(element,event){var targetNode=getDomNode(element);var matches=[];var entries=callbackRegistry[event];if(entries){forEach(entries,function(entry){if(entry.node.contains(targetNode)){matches.push(entry.callback)}})}return matches}function triggerCallback(event,element,phase,data){$$rAF(function(){forEach(findCallbacks(element,event),function(callback){callback(element,phase,data)})})}return{on:function(event,container,callback){var node=extractElementNode(container);callbackRegistry[event]=callbackRegistry[event]||[];callbackRegistry[event].push({node:node,callback:callback})},off:function(event,container,callback){var entries=callbackRegistry[event];if(!entries)return;callbackRegistry[event]=arguments.length===1?null:filterFromRegistry(entries,container,callback);function filterFromRegistry(list,matchContainer,matchCallback){var containerNode=extractElementNode(matchContainer);return list.filter(function(entry){var isMatch=entry.node===containerNode&&(!matchCallback||entry.callback===matchCallback);return!isMatch})}},pin:function(element,parentElement){assertArg(isElement(element),"element","not an element");assertArg(isElement(parentElement),"parentElement","not an element");element.data(NG_ANIMATE_PIN_DATA,parentElement)},push:function(element,event,options,domOperation){options=options||{};options.domOperation=domOperation;return queueAnimation(element,event,options)},enabled:function(element,bool){var argCount=arguments.length;if(argCount===0){bool=!!animationsEnabled}else{var hasElement=isElement(element);if(!hasElement){bool=animationsEnabled=!!element}else{var node=getDomNode(element);var recordExists=disabledElementsLookup.get(node);if(argCount===1){bool=!recordExists}else{bool=!!bool;if(!bool){disabledElementsLookup.put(node,true)}else if(recordExists){disabledElementsLookup.remove(node)}}}}return bool}};function queueAnimation(element,event,options){var node,parent;element=stripCommentsFromElement(element);if(element){node=getDomNode(element);parent=element.parent()}options=prepareAnimationOptions(options);var runner=new $$AnimateRunner;if(isArray(options.addClass)){options.addClass=options.addClass.join(" ")}if(options.addClass&&!isString(options.addClass)){options.addClass=null}if(isArray(options.removeClass)){options.removeClass=options.removeClass.join(" ")}if(options.removeClass&&!isString(options.removeClass)){options.removeClass=null}if(options.from&&!isObject(options.from)){options.from=null}if(options.to&&!isObject(options.to)){options.to=null}if(!node){close();return runner}var className=[node.className,options.addClass,options.removeClass].join(" ");if(!isAnimatableClassName(className)){close();return runner}var isStructural=["enter","move","leave"].indexOf(event)>=0;var skipAnimations=!animationsEnabled||disabledElementsLookup.get(node);var existingAnimation=!skipAnimations&&activeAnimationsLookup.get(node)||{};var hasExistingAnimation=!!existingAnimation.state;if(!skipAnimations&&(!hasExistingAnimation||existingAnimation.state!=PRE_DIGEST_STATE)){skipAnimations=!areAnimationsAllowed(element,parent,event)}if(skipAnimations){close();return runner}if(isStructural){closeChildAnimations(element)}var newAnimation={structural:isStructural,element:element,event:event,close:close,options:options,runner:runner};if(hasExistingAnimation){var skipAnimationFlag=isAllowed("skip",element,newAnimation,existingAnimation);if(skipAnimationFlag){if(existingAnimation.state===RUNNING_STATE){close();return runner}else{mergeAnimationOptions(element,existingAnimation.options,options);return existingAnimation.runner}}var cancelAnimationFlag=isAllowed("cancel",element,newAnimation,existingAnimation);if(cancelAnimationFlag){if(existingAnimation.state===RUNNING_STATE){existingAnimation.runner.end()}else if(existingAnimation.structural){existingAnimation.close()}else{mergeAnimationOptions(element,existingAnimation.options,newAnimation.options);return existingAnimation.runner}}else{var joinAnimationFlag=isAllowed("join",element,newAnimation,existingAnimation);if(joinAnimationFlag){if(existingAnimation.state===RUNNING_STATE){normalizeAnimationOptions(element,options)}else{applyGeneratedPreparationClasses(element,isStructural?event:null,options);event=newAnimation.event=existingAnimation.event;options=mergeAnimationOptions(element,existingAnimation.options,newAnimation.options);return existingAnimation.runner}}}}else{normalizeAnimationOptions(element,options)}var isValidAnimation=newAnimation.structural;if(!isValidAnimation){isValidAnimation=newAnimation.event==="animate"&&Object.keys(newAnimation.options.to||{}).length>0||hasAnimationClasses(newAnimation.options)}if(!isValidAnimation){close();clearElementAnimationState(element);return runner}var counter=(existingAnimation.counter||0)+1;newAnimation.counter=counter;markElementAnimationState(element,PRE_DIGEST_STATE,newAnimation);$rootScope.$$postDigest(function(){var animationDetails=activeAnimationsLookup.get(node);var animationCancelled=!animationDetails;animationDetails=animationDetails||{};var parentElement=element.parent()||[];var isValidAnimation=parentElement.length>0&&(animationDetails.event==="animate"||animationDetails.structural||hasAnimationClasses(animationDetails.options));if(animationCancelled||animationDetails.counter!==counter||!isValidAnimation){if(animationCancelled){applyAnimationClasses(element,options);applyAnimationStyles(element,options)}if(animationCancelled||isStructural&&animationDetails.event!==event){options.domOperation();runner.end()}if(!isValidAnimation){clearElementAnimationState(element)}return}event=!animationDetails.structural&&hasAnimationClasses(animationDetails.options,true)?"setClass":animationDetails.event;markElementAnimationState(element,RUNNING_STATE);var realRunner=$$animation(element,event,animationDetails.options);realRunner.done(function(status){close(!status);var animationDetails=activeAnimationsLookup.get(node);if(animationDetails&&animationDetails.counter===counter){clearElementAnimationState(getDomNode(element))}notifyProgress(runner,event,"close",{})});runner.setHost(realRunner);notifyProgress(runner,event,"start",{})});return runner;function notifyProgress(runner,event,phase,data){triggerCallback(event,element,phase,data);runner.progress(event,phase,data)}function close(reject){clearGeneratedClasses(element,options);applyAnimationClasses(element,options);applyAnimationStyles(element,options);options.domOperation();runner.complete(!reject)}}function closeChildAnimations(element){var node=getDomNode(element);var children=node.querySelectorAll("["+NG_ANIMATE_ATTR_NAME+"]");forEach(children,function(child){var state=parseInt(child.getAttribute(NG_ANIMATE_ATTR_NAME));var animationDetails=activeAnimationsLookup.get(child);switch(state){case RUNNING_STATE:animationDetails.runner.end();case PRE_DIGEST_STATE:if(animationDetails){activeAnimationsLookup.remove(child)}break}})}function clearElementAnimationState(element){var node=getDomNode(element);node.removeAttribute(NG_ANIMATE_ATTR_NAME);activeAnimationsLookup.remove(node)}function isMatchingElement(nodeOrElmA,nodeOrElmB){return getDomNode(nodeOrElmA)===getDomNode(nodeOrElmB)}function areAnimationsAllowed(element,parentElement,event){var bodyElementDetected=isMatchingElement(element,$$body)||element[0].nodeName==="HTML";var rootElementDetected=isMatchingElement(element,$rootElement);var parentAnimationDetected=false;var animateChildren;var parentHost=element.data(NG_ANIMATE_PIN_DATA);if(parentHost){parentElement=parentHost}while(parentElement&&parentElement.length){if(!rootElementDetected){rootElementDetected=isMatchingElement(parentElement,$rootElement)}var parentNode=parentElement[0];if(parentNode.nodeType!==ELEMENT_NODE){break}var details=activeAnimationsLookup.get(parentNode)||{};if(!parentAnimationDetected){parentAnimationDetected=details.structural||disabledElementsLookup.get(parentNode)}if(isUndefined(animateChildren)||animateChildren===true){var value=parentElement.data(NG_ANIMATE_CHILDREN_DATA);if(isDefined(value)){animateChildren=value}}if(parentAnimationDetected&&animateChildren===false)break;if(!rootElementDetected){rootElementDetected=isMatchingElement(parentElement,$rootElement);if(!rootElementDetected){parentHost=parentElement.data(NG_ANIMATE_PIN_DATA);if(parentHost){parentElement=parentHost}}}if(!bodyElementDetected){bodyElementDetected=isMatchingElement(parentElement,$$body)}parentElement=parentElement.parent()}var allowAnimation=!parentAnimationDetected||animateChildren;return allowAnimation&&rootElementDetected&&bodyElementDetected}function markElementAnimationState(element,state,details){details=details||{};details.state=state;var node=getDomNode(element);node.setAttribute(NG_ANIMATE_ATTR_NAME,state);var oldValue=activeAnimationsLookup.get(node);var newValue=oldValue?extend(oldValue,details):details;activeAnimationsLookup.put(node,newValue)}}]}];var $$AnimateAsyncRunFactory=["$$rAF",function($$rAF){var waitQueue=[];function waitForTick(fn){waitQueue.push(fn);if(waitQueue.length>1)return;$$rAF(function(){for(var i=0;i=0;var runner=new $$AnimateRunner({end:function(){close()},cancel:function(){close(true)}});if(!drivers.length){close();return runner}setRunner(element,runner);var classes=mergeClasses(element.attr("class"),mergeClasses(options.addClass,options.removeClass));var tempClasses=options.tempClasses;if(tempClasses){classes+=" "+tempClasses;options.tempClasses=null}animationQueue.push({element:element,classes:classes,event:event,structural:isStructural,options:options,beforeStart:beforeStart,close:close});element.on("$destroy",handleDestroyedElement);if(animationQueue.length>1)return runner;$rootScope.$$postDigest(function(){var animations=[];forEach(animationQueue,function(entry){if(getRunner(entry.element)){animations.push(entry)}else{entry.close()}});animationQueue.length=0;var groupedAnimations=groupAnimations(animations);var toBeSortedAnimations=[];forEach(groupedAnimations,function(animationEntry){toBeSortedAnimations.push({domNode:getDomNode(animationEntry.from?animationEntry.from.element:animationEntry.element),fn:function triggerAnimationStart(){animationEntry.beforeStart();var startAnimationFn,closeFn=animationEntry.close;var targetElement=animationEntry.anchors?animationEntry.from.element||animationEntry.to.element:animationEntry.element;if(getRunner(targetElement)){var operation=invokeFirstDriver(animationEntry);if(operation){startAnimationFn=operation.start}}if(!startAnimationFn){closeFn()}else{var animationRunner=startAnimationFn();animationRunner.done(function(status){closeFn(!status)});updateAnimationRunners(animationEntry,animationRunner)}}})});$$rAFScheduler(sortAnimations(toBeSortedAnimations))});return runner;function getAnchorNodes(node){var SELECTOR="["+NG_ANIMATE_REF_ATTR+"]";var items=node.hasAttribute(NG_ANIMATE_REF_ATTR)?[node]:node.querySelectorAll(SELECTOR);var anchors=[];forEach(items,function(node){var attr=node.getAttribute(NG_ANIMATE_REF_ATTR);if(attr&&attr.length){anchors.push(node)}});return anchors}function groupAnimations(animations){var preparedAnimations=[];var refLookup={};forEach(animations,function(animation,index){var element=animation.element;var node=getDomNode(element);var event=animation.event;var enterOrMove=["enter","move"].indexOf(event)>=0;var anchorNodes=animation.structural?getAnchorNodes(node):[];if(anchorNodes.length){var direction=enterOrMove?"to":"from";forEach(anchorNodes,function(anchor){var key=anchor.getAttribute(NG_ANIMATE_REF_ATTR);refLookup[key]=refLookup[key]||{};refLookup[key][direction]={animationID:index,element:jqLite(anchor)}})}else{preparedAnimations.push(animation)}});var usedIndicesLookup={};var anchorGroups={};forEach(refLookup,function(operations,key){var from=operations.from;var to=operations.to;if(!from||!to){var index=from?from.animationID:to.animationID;var indexKey=index.toString();if(!usedIndicesLookup[indexKey]){usedIndicesLookup[indexKey]=true;preparedAnimations.push(animations[index])}return}var fromAnimation=animations[from.animationID];var toAnimation=animations[to.animationID];var lookupKey=from.animationID.toString();if(!anchorGroups[lookupKey]){var group=anchorGroups[lookupKey]={structural:true,beforeStart:function(){fromAnimation.beforeStart();toAnimation.beforeStart()},close:function(){fromAnimation.close();toAnimation.close()},classes:cssClassesIntersection(fromAnimation.classes,toAnimation.classes),from:fromAnimation,to:toAnimation,anchors:[]};if(group.classes.length){preparedAnimations.push(group)}else{preparedAnimations.push(fromAnimation);preparedAnimations.push(toAnimation)}}anchorGroups[lookupKey].anchors.push({out:from.element,"in":to.element})});return preparedAnimations}function cssClassesIntersection(a,b){a=a.split(" ");b=b.split(" ");var matches=[];for(var i=0;i=0;i--){var driverName=drivers[i];if(!$injector.has(driverName))continue;var factory=$injector.get(driverName);var driver=factory(animationDetails);if(driver){return driver}}}function beforeStart(){element.addClass(NG_ANIMATE_CLASSNAME);if(tempClasses){$$jqLite.addClass(element,tempClasses)}}function updateAnimationRunners(animation,newRunner){if(animation.from&&animation.to){update(animation.from.element);update(animation.to.element)}else{update(animation.element)}function update(element){getRunner(element).setHost(newRunner)}}function handleDestroyedElement(){var runner=getRunner(element);if(runner&&(event!=="leave"||!options.$$domOperationFired)){runner.end()}}function close(rejected){element.off("$destroy",handleDestroyedElement);removeRunner(element);applyAnimationClasses(element,options);applyAnimationStyles(element,options);options.domOperation();if(tempClasses){$$jqLite.removeClass(element,tempClasses)}element.removeClass(NG_ANIMATE_CLASSNAME);runner.complete(!rejected)}}}]}];angular.module("ngAnimate",[]).provider("$$body",$$BodyProvider).directive("ngAnimateChildren",$$AnimateChildrenDirective).factory("$$rAFScheduler",$$rAFSchedulerFactory).factory("$$AnimateRunner",$$AnimateRunnerFactory).factory("$$animateAsyncRun",$$AnimateAsyncRunFactory).provider("$$animateQueue",$$AnimateQueueProvider).provider("$$animation",$$AnimationProvider).provider("$animateCss",$AnimateCssProvider).provider("$$animateCssDriver",$$AnimateCssDriverProvider).provider("$$animateJs",$$AnimateJsProvider).provider("$$animateJsDriver",$$AnimateJsDriverProvider)})(window,window.angular);var app=angular.module("autocomplete",[]);app.directive("autocomplete",function(){var index=-1;return{restrict:"E",scope:{searchParam:"=ngModel",suggestions:"=data",onType:"=onType",onSelect:"=onSelect",autocompleteRequired:"="},controller:["$scope",function($scope){$scope.selectedIndex=-1;$scope.initLock=true;$scope.setIndex=function(i){$scope.selectedIndex=parseInt(i)};this.setIndex=function(i){$scope.setIndex(i);$scope.$apply()};$scope.getIndex=function(i){return $scope.selectedIndex};var watching=true;$scope.completing=false;$scope.$watch("searchParam",function(newValue,oldValue){if(oldValue===newValue||!oldValue&&$scope.initLock){return}if(watching&&typeof $scope.searchParam!=="undefined"&&$scope.searchParam!==null){$scope.completing=true;$scope.searchFilter=$scope.searchParam;$scope.selectedIndex=-1}if($scope.onType)$scope.onType($scope.searchParam)});this.preSelect=function(suggestion){watching=false;$scope.$apply();watching=true};$scope.preSelect=this.preSelect;this.preSelectOff=function(){watching=true};$scope.preSelectOff=this.preSelectOff;$scope.select=function(suggestion){if(suggestion){$scope.searchParam=suggestion;$scope.searchFilter=suggestion;if($scope.onSelect)$scope.onSelect(suggestion)}watching=false;$scope.completing=false;setTimeout(function(){watching=true},1e3);$scope.setIndex(-1)}}],link:function(scope,element,attrs){setTimeout(function(){scope.initLock=false;scope.$apply()},250);var attr="";scope.attrs={placeholder:"start typing...","class":"",id:"",inputclass:"",inputid:""};for(var a in attrs){attr=a.replace("attr","").toLowerCase();if(a.indexOf("attr")===0){scope.attrs[attr]=attrs[a]}}if(attrs.clickActivation){element[0].onclick=function(e){if(!scope.searchParam){setTimeout(function(){scope.completing=true;scope.$apply()},200)}}}var key={left:37,up:38,right:39,down:40,enter:13,esc:27,tab:9};document.addEventListener("keydown",function(e){var keycode=e.keyCode||e.which;switch(keycode){case key.esc:scope.select();scope.setIndex(-1);scope.$apply();e.preventDefault()}},true);document.addEventListener("blur",function(e){setTimeout(function(){scope.select();scope.setIndex(-1);scope.$apply()},150)},true);element[0].addEventListener("keydown",function(e){var keycode=e.keyCode||e.which;var l=angular.element(this).find("li").length;if(!scope.completing||l==0)return;switch(keycode){case key.up:index=scope.getIndex()-1;if(index<-1){index=l-1}else if(index>=l){index=-1;scope.setIndex(index); scope.preSelectOff();break}scope.setIndex(index);if(index!==-1)scope.preSelect(angular.element(angular.element(this).find("li")[index]).text());scope.$apply();break;case key.down:index=scope.getIndex()+1;if(index<-1){index=l-1}else if(index>=l){index=-1;scope.setIndex(index);scope.preSelectOff();scope.$apply();break}scope.setIndex(index);if(index!==-1)scope.preSelect(angular.element(angular.element(this).find("li")[index]).text());break;case key.left:break;case key.right:case key.enter:case key.tab:index=scope.getIndex();if(index!==-1){scope.select(angular.element(angular.element(this).find("li")[index]).text());if(keycode==key.enter){e.preventDefault()}}else{if(keycode==key.enter){scope.select()}}scope.setIndex(-1);scope.$apply();break;case key.esc:scope.select();scope.setIndex(-1);scope.$apply();e.preventDefault();break;default:return}})},template:'
          '}});app.filter("highlight",["$sce",function($sce){return function(input,searchParam){if(typeof input==="function")return"";if(searchParam){var words="("+searchParam.split(/\ /).join(" |")+"|"+searchParam.split(/\ /).join("|")+")",exp=new RegExp(words,"gi");if(words.length){input=input.replace(exp,'$1')}}return $sce.trustAsHtml(input)}}]);app.directive("suggestion",function(){return{restrict:"A",require:"^autocomplete",link:function(scope,element,attrs,autoCtrl){element.bind("mouseenter",function(){autoCtrl.preSelect(attrs.val);autoCtrl.setIndex(attrs.index)});element.bind("mouseleave",function(){autoCtrl.preSelectOff()})}}});"use strict";var Value=function(lang,content){this.lang=lang;this.content=content};var TextTitle=function(lang,content){Value.call(this,lang,content)};TextTitle.prototype=new Value;var TextComment=function(lang,content){Value.call(this,lang,content)};TextComment.prototype=new Value;var Item=function(lang,content,type){this.type=type;Value.call(this,lang,content)};Item.prototype=new Value;var Translation=function(lang,content){Value.call(this,lang,content)};Translation.prototype=new Value;var DictItem=function(url){this.type="lingvodoc_metaword";this.url=url};var Word=function(items){this.items=items;this.hasDictionaryEntry=function(){for(var i=0;i5)break}}}).error(function(data,status,headers,config){});$scope.showWordInfo=function(word){var modalInstance=$modal.open({animation:true,templateUrl:"wordItemsTtemplate.html",controller:"ShowWordController",size:"lg",resolve:{items:function(){return word.items},title:function(){return word.getTextEntry()}}})};$scope.showMetawordInfo=function(word){if(word.url&&word.paradigm_url&&word.etymology_url){var modalInstance=$modal.open({animation:true,templateUrl:"wordMetawordTemplate.html",controller:"ShowMetawordController",size:"lg",resolve:{metawordUrl:function(){return word.url},etymologyUrl:function(){return word.paradigm_url},paradigmUrl:function(){return word.etymology_url}}})}}}]);app.controller("ShowWordController",["$scope","items","title",function($scope,items,title){$scope.title=title;$scope.items=items}]);app.controller("ShowMetawordController",["$scope","$http","metawordUrl","etymologyUrl","paradigmUrl",function($scope,$http,metawordUrl,etymologyUrl,paradigmUrl){var activeUrl=null;$scope.play=function(url){if(!$scope.wavesurfer){return}activeUrl=url;$scope.wavesurfer.once("ready",function(){$scope.wavesurfer.play();$scope.$apply()});$scope.wavesurfer.load(activeUrl)};$scope.playPause=function(){$scope.wavesurfer.playPause()};$scope.isPlaying=function(url){return url==activeUrl};$scope.isMediaFileAvailable=function(){return activeUrl!=null};$scope.$on("wavesurferInit",function(e,wavesurfer){$scope.wavesurfer=wavesurfer;$scope.wavesurfer.on("play",function(){$scope.paused=false});$scope.wavesurfer.on("pause",function(){$scope.paused=true});$scope.wavesurfer.on("finish",function(){$scope.paused=true;$scope.wavesurfer.seekTo(0);$scope.$apply()})});$http.get(metawordUrl).success(function(data,status,headers,config){if(data.corpus_id&&data.corpus_client_id){$scope.metaword=data}}).error(function(data,status,headers,config){});$http.get(etymologyUrl).success(function(data,status,headers,config){if(data.corpus_id&&data.corpus_client_id){$scope.etymologies=data}}).error(function(data,status,headers,config){});$http.get(paradigmUrl).success(function(data,status,headers,config){if(data.corpus_id&&data.corpus_client_id){$scope.paradigms=data}}).error(function(data,status,headers,config){})}]);"use strict";var model={};model.Value=function(){this.export=function(){return{}}};model.TextValue=function(content){this.content=content;this.export=function(){return{content:content,data_type:"text"}}};model.TextValue.prototype=new model.Value;model.SoundValue=function(name,mime,content){this.name=name;this.mime=mime;this.content=content;this.export=function(){return{content:content,filename:name,data_type:"sound"}}};model.SoundValue.prototype=new model.Value;model.ImageValue=function(name,mime,content){this.name=name;this.mime=mime;this.content=content;this.export=function(){return{content:content,filename:name,data_type:"image"}}};model.ImageValue.prototype=new model.Value;model.MarkupValue=function(name,mime,content){this.name=name;this.mime=mime;this.content=content;this.export=function(){return{content:content,filename:name,data_type:"markup"}}};model.MarkupValue.prototype=new model.Value;var app=angular.module("EditDictionaryModule",["ui.bootstrap"]);app.directive("wavesurfer",function(){return{restrict:"E",link:function($scope,$element,$attrs){$element.css("display","block");var options=angular.extend({container:$element[0]},$attrs);var wavesurfer=WaveSurfer.create(options);if($attrs.url){wavesurfer.load($attrs.url,$attrs.data||null)}$scope.$emit("wavesurferInit",wavesurfer)}}});app.directive("onReadFile",function($parse){return{restrict:"A",scope:false,link:function(scope,element,attrs){var fn=$parse(attrs.onReadFile);element.on("change",function(onChangeEvent){var reader=new FileReader;var file=(onChangeEvent.srcElement||onChangeEvent.target).files[0];reader.onload=function(onLoadEvent){scope.$apply(function(){var b64file=btoa(onLoadEvent.target.result);fn(scope,{$fileName:file.name,$fileType:file.type,$fileContent:b64file})})};reader.readAsBinaryString(file)})}}});app.controller("EditDictionaryController",["$scope","$http","$modal","$log","$timeout",function($scope,$http,$modal,$log,$timeout){var currentClientId=$("#clientId").data("lingvodoc");var dictionaryClientId=$("#dictionaryClientId").data("lingvodoc");var dictionaryObjectId=$("#dictionaryObjectId").data("lingvodoc");var perspectiveClientId=$("#perspectiveClientId").data("lingvodoc");var perspectiveId=$("#perspectiveId").data("lingvodoc");WaveSurferController.call(this,$scope);$scope.perspective={fields:[]};$scope.fields=[];$scope.lexicalEntries=[];$scope.dictionaryMatrix=[];$scope.pageIndex=1;$scope.pageSize=50;$scope.pageCount=1;var enabledInputs=[];$scope.getFieldValues=function(entry,field){var value;var values=[];if(entry&&entry.contains){if(field.isGroup){for(var fieldIndex=0;fieldIndex0&&pageNumber<=$scope.pageCount){$scope.pageIndex=pageNumber;loadEntries()}};$scope.range=function(min,max,step){step=step||1;var input=[];for(var i=min;i<=max;i+=step){input.push(i)}return input};$scope.enableInput=function(clientId,objectId,entityType){if(!$scope.isInputEnabled(clientId,objectId,entityType)){enabledInputs.push({clientId:clientId,objectId:objectId,entityType:entityType})}else{$scope.disableInput(clientId,objectId,entityType)}};$scope.isInputEnabled=function(clientId,objectId,entityType){for(var i=0;i=0){enabledInputs.splice(removeIndex,1)}};$scope.addedByUser=function(entry){return entry.client_id==$("#clientId").data("lingvodoc")};$scope.addNewLexicalEntry=function(){var createLexicalEntryUrl=$("#createLexicalEntryUrl").data("lingvodoc");$http.post(createLexicalEntryUrl).success(function(data,status,headers,config){$scope.lexicalEntries.unshift({client_id:data.client_id,object_id:data.object_id,contains:[]})}).error(function(data,status,headers,config){alert("Failed to create lexical entry!")})};$scope.saveTextValue=function(entry,field,event,parent){if(event.target.value){$scope.saveValue(entry,field,new model.TextValue(event.target.value),parent)}};$scope.saveSoundValue=function(entry,field,fileName,fileType,fileContent,parent){var value=new model.SoundValue(fileName,fileType,fileContent);$scope.saveValue(entry,field,value,parent)};$scope.saveImageValue=function(entry,field,fileName,fileType,fileContent,parent){var value=new model.ImageValue(fileName,fileType,fileContent);$scope.saveValue(entry,field,value,parent)};$scope.saveMarkupValue=function(entry,field,fileName,fileType,fileContent,parent){var value=new model.MarkupValue(fileName,fileType,fileContent);$scope.saveValue(entry,field,value,parent)};$scope.editGroup=function(entry,field,values){var modalInstance=$modal.open({animation:true,templateUrl:"editGroupModal.html",controller:"editGroupController",size:"lg",resolve:{groupParams:function(){return{entry:entry,field:field,values:values}}}});modalInstance.result.then(function(value){},function(){})};$scope.editGroupingTag=function(entry,field,values){var modalInstance=$modal.open({animation:true,templateUrl:"editGroupingTagModal.html",controller:"editGroupingTagController",size:"lg",resolve:{groupParams:function(){return{clientId:entry.client_id,objectId:entry.object_id,fields:$scope.fields}}}});modalInstance.result.then(function(value){},function(){})};$scope.saveValue=function(entry,field,value,parent){var url;if(field.level){switch(field.level){case"leveloneentity":url="/dictionary/"+encodeURIComponent(dictionaryClientId)+"/"+encodeURIComponent(dictionaryObjectId)+"/perspective/"+encodeURIComponent(perspectiveClientId)+"/"+encodeURIComponent(perspectiveId)+"/lexical_entry/"+encodeURIComponent(entry.client_id)+"/"+encodeURIComponent(entry.object_id)+"/leveloneentity";break;case"leveltwoentity":if(parent.client_id&&parent.object_id){url="/dictionary/"+encodeURIComponent(dictionaryClientId)+"/"+encodeURIComponent(dictionaryObjectId)+"/perspective/"+encodeURIComponent(perspectiveClientId)+"/"+encodeURIComponent(perspectiveId)+"/lexical_entry/"+encodeURIComponent(entry.client_id)+"/"+encodeURIComponent(entry.object_id)+"/leveloneentity/"+encodeURIComponent(parent.client_id)+"/"+encodeURIComponent(parent.object_id)+"/leveltwoentity"}else{$log.error("Attempting to create Level2 entry with no Level1 entry.");return}break;case"groupingentity":return;break}var entryObject=value.export();entryObject["entity_type"]=field.entity_type;entryObject["locale_id"]=1;entryObject["metadata"]={};$http.post(url,entryObject).success(function(data,status,headers,config){if(data.client_id&&data.object_id){entryObject.client_id=data.client_id;entryObject.object_id=data.object_id;var getSavedEntityUrl="/leveloneentity/"+data.client_id+"/"+data.object_id;$http.get(getSavedEntityUrl).success(function(data,status,headers,config){for(var i=0;i<$scope.lexicalEntries.length;i++){if($scope.lexicalEntries[i].object_id==entry.object_id&&$scope.lexicalEntries[i].client_id==entry.client_id){$scope.lexicalEntries[i].contains.push(data);break}}$scope.disableInput(entry.client_id,entry.object_id,field.entity_type)}).error(function(data,status,headers,config){})}}).error(function(data,status,headers,config){})}};$scope.removeValue=function(entry,field,fieldValue,parent){var url;if(field.level){switch(field.level){case"leveloneentity":url="/dictionary/"+encodeURIComponent(dictionaryClientId)+"/"+encodeURIComponent(dictionaryObjectId)+"/perspective/"+encodeURIComponent(perspectiveClientId)+"/"+encodeURIComponent(perspectiveId)+"/lexical_entry/"+encodeURIComponent(entry.client_id)+"/"+encodeURIComponent(entry.object_id)+"/leveloneentity/"+encodeURIComponent(fieldValue.client_id)+"/"+encodeURIComponent(fieldValue.object_id);break;case"leveltwoentity":if(parentClientId&&parentObjectId){url="/dictionary/"+encodeURIComponent(dictionaryClientId)+"/"+encodeURIComponent(dictionaryObjectId)+"/perspective/"+encodeURIComponent(perspectiveClientId)+"/"+encodeURIComponent(perspectiveId)+"/lexical_entry/"+encodeURIComponent(fieldValue.client_id)+"/"+encodeURIComponent(fieldValue.object_id)+"/leveloneentity/"+encodeURIComponent(parent.client_id)+"/"+encodeURIComponent(parent.object_id)+"/leveltwoentity/"+encodeURIComponent(fieldValue.client_id)+"/"+encodeURIComponent(fieldValue.object_id)}else{$log.error("Attempting to delete Level2 entry with no Level1 entry.");return}break;case"groupingentity":return;break}$http.delete(url).success(function(data,status,headers,config){for(var i=0;i<$scope.lexicalEntries.length;i++){if($scope.lexicalEntries[i].object_id==entry.object_id&&$scope.lexicalEntries[i].client_id==entry.client_id){var lexicalEntry=$scope.lexicalEntries[i];for(var j=0;j=0?"&":"?")+encodeURIComponent(key)+"="+encodeURIComponent(value)};var perspectiveToDictionaryFields=function(perspective){var fields=[];for(var i=0;i=0){enabledInputs.splice(removeIndex,1)}};$scope.saveTextValue=function(entry,field,event,parent){if(event.target.value){$scope.saveValue(entry,field,new model.TextValue(event.target.value),parent)}};$scope.saveSoundValue=function(entry,field,fileName,fileType,fileContent,parent){var value=new model.SoundValue(fileName,fileType,fileContent);$scope.saveValue(entry,field,value,parent)};$scope.saveImageValue=function(entry,field,fileName,fileType,fileContent,parent){var value=new model.ImageValue(fileName,fileType,fileContent);$scope.saveValue(entry,field,value,parent)};$scope.saveMarkupValue=function(entry,field,fileName,fileType,fileContent,parent){var value=new model.MarkupValue(fileName,fileType,fileContent);$scope.saveValue(entry,field,value,parent)};$scope.addedByUser=function(entry){return entry.client_id==$("#clientId").data("lingvodoc")};$scope.saveValue=function(entry,field,value,parent){var url;if(field.level){switch(field.level){case"leveloneentity":url="/dictionary/"+encodeURIComponent(dictionaryClientId)+"/"+encodeURIComponent(dictionaryObjectId)+"/perspective/"+encodeURIComponent(perspectiveClientId)+"/"+encodeURIComponent(perspectiveId)+"/lexical_entry/"+encodeURIComponent($scope.parentEntry.client_id)+"/"+encodeURIComponent($scope.parentEntry.object_id)+"/leveloneentity";break;case"leveltwoentity":if(parent.client_id&&parent.object_id){url="/dictionary/"+encodeURIComponent(dictionaryClientId)+"/"+encodeURIComponent(dictionaryObjectId)+"/perspective/"+encodeURIComponent(perspectiveClientId)+"/"+encodeURIComponent(perspectiveId)+"/lexical_entry/"+encodeURIComponent($scope.parentEntry.client_id)+"/"+encodeURIComponent($scope.parentEntry.object_id)+"/leveloneentity/"+encodeURIComponent(parent.client_id)+"/"+encodeURIComponent(parent.object_id)+"/leveltwoentity"}else{$log.error("Attempting to create Level2 entry with no Level1 entry.");return}break;case"groupingentity":return;break}var entryObject=value.export();entryObject["entity_type"]=field.entity_type;entryObject["locale_id"]=1;entryObject["additional_metadata"]={row_id:entry.row_id,client_id:entry.client_id};$http.post(url,entryObject).success(function(data,status,headers,config){if(data.client_id&&data.object_id){entryObject.client_id=data.client_id;entryObject.object_id=data.object_id;var getSavedEntityUrl="/leveloneentity/"+data.client_id+"/"+data.object_id;$http.get(getSavedEntityUrl).success(function(data,status,headers,config){for(var i=0;i<$scope.entries.length;i++){if($scope.entries[i].row_id==entry.row_id&&$scope.entries[i].client_id==entry.client_id){$scope.entries[i].contains.push(data);break}}$scope.disableInput(entry.client_id,entry.object_id,field.entity_type)}).error(function(data,status,headers,config){})}}).error(function(data,status,headers,config){})}};$scope.removeValue=function(entry,field,fieldValue,parent){var url;if(field.level){switch(field.level){case"leveloneentity":url="/dictionary/"+encodeURIComponent(dictionaryClientId)+"/"+encodeURIComponent(dictionaryObjectId)+"/perspective/"+encodeURIComponent(perspectiveClientId)+"/"+encodeURIComponent(perspectiveId)+"/lexical_entry/"+encodeURIComponent(entry.client_id)+"/"+encodeURIComponent(entry.object_id)+"/leveloneentity/"+encodeURIComponent(fieldValue.client_id)+"/"+encodeURIComponent(fieldValue.object_id);break;case"leveltwoentity":if(parentClientId&&parentObjectId){url="/dictionary/"+encodeURIComponent(dictionaryClientId)+"/"+encodeURIComponent(dictionaryObjectId)+"/perspective/"+encodeURIComponent(perspectiveClientId)+"/"+encodeURIComponent(perspectiveId)+"/lexical_entry/"+encodeURIComponent(fieldValue.client_id)+"/"+encodeURIComponent(fieldValue.object_id)+"/leveloneentity/"+encodeURIComponent(parent.client_id)+"/"+encodeURIComponent(parent.object_id)+"/leveltwoentity/"+encodeURIComponent(fieldValue.client_id)+"/"+encodeURIComponent(fieldValue.object_id)}else{$log.error("Attempting to delete Level2 entry with no Level1 entry.");return}break;case"groupingentity":return;break}$http.delete(url).success(function(data,status,headers,config){for(var i=0;i<$scope.entries.length;i++){if($scope.entries[i].row_id==entry.row_id&&$scope.entries[i].client_id==entry.client_id){var lexicalEntry=$scope.entries[i];for(var j=0;j0&&pageNumber<=$scope.pageCount){$scope.pageIndex=pageNumber;loadEntries()}};$scope.range=function(min,max,step){step=step||1;var input=[];for(var i=min;i<=max;i+=step){input.push(i)}return input};$scope.viewGroup=function(entry,field,values){var modalInstance=$modal.open({animation:true,templateUrl:"viewGroupModal.html",controller:"viewGroupController",size:"lg",resolve:{groupParams:function(){return{entry:entry,field:field,values:values}}}});modalInstance.result.then(function(value){},function(){})};$scope.viewGroupingTag=function(entry,field,values){var modalInstance=$modal.open({animation:true,templateUrl:"viewGroupingTagModal.html",controller:"viewGroupingTagController",size:"lg",resolve:{groupParams:function(){return{clientId:entry.client_id,objectId:entry.object_id,fields:$scope.fields}}}});modalInstance.result.then(function(value){},function(){})};$scope.$watch("lexicalEntries",function(updatedEntries){var getFieldValues=function(entry,field){var value;var values=[];if(entry&&entry.contains){if(field.isGroup){for(var fieldIndex=0;fieldIndex=0?"&":"?")+encodeURIComponent(key)+"="+encodeURIComponent(value)};var perspectiveToDictionaryFields=function(perspective){var fields=[];for(var i=0;i0){var childLangs=flatLanguages(language.contains);flat=flat.concat(childLangs)}}return flat};var getLanguageById=function(id){if(typeof id=="string"){var ids=id.split("_");for(var i=0;i<$scope.languages.length;i++){if($scope.languages[i].client_id==ids[0]&&$scope.languages[i].object_id==ids[1])$log.info($scope.languages[i]);return $scope.languages[i]}$log.info("no found!")}$log.info("no found id!")};$scope.languages=[];$scope.perspectives=[];$scope.dictionaryData={languageId:-1,perspectiveName:"",perspectiveId:-1};$scope.perspective={fields:[]};$scope.getLanguageId=function(language){if(language){return language.client_id+"_"+language.object_id}};$scope.newLanguage=function(){var modalInstance=$modal.open({animation:true,templateUrl:"createLanguageModal.html",controller:"CreateLanguageController",size:"lg"});modalInstance.result.then(function(languageObj){$http.post(createLanguageUrl,languageObj).success(function(data,status,headers,config){loadLanguages()}).error(function(data,status,headers,config){alert("Failed to save language!")})},function(){$log.info("Modal dismissed at: "+new Date)})};$scope.addField=function(){$scope.perspective.fields.push({entity_type:"",data_type:"text",status:"enabled"})};$scope.enableGroup=function(fieldIndex){if(typeof $scope.perspective.fields[fieldIndex].group==="undefined"){$scope.perspective.fields[fieldIndex].group=""}else{delete $scope.perspective.fields[fieldIndex].group}};$scope.enableLinkedField=function(fieldIndex){if(typeof $scope.perspective.fields[fieldIndex].contains==="undefined"){$scope.perspective.fields[fieldIndex].contains=[{entity_type:"",data_type:"markup",status:"enabled"}]}else{delete $scope.perspective.fields[fieldIndex].contains}};$scope.createDictionary=function(){var language=getLanguageById($scope.dictionaryData.languageId);if(!$scope.dictionaryData.name&&$scope.wizard.mode=="create"||typeof $scope.wizard.importedDictionaryId!="string"&&$scope.wizard.mode=="import"||!language){return}if($scope.wizard.mode=="create"){var dictionaryObj={parent_client_id:language.client_id,parent_object_id:language.object_id,name:$scope.dictionaryData.name,translation:$scope.dictionaryData.name};$http.post(createDictionaryUrl,dictionaryObj).success(function(data,status,headers,config){if(data.object_id&&data.client_id){$scope.dictionaryData.dictionary_client_id=data.client_id;$scope.dictionaryData.dictionary_object_id=data.object_id;$state.go("create.step2")}else{alert("Failed to create dictionary!")}}).error(function(data,status,headers,config){alert("Failed to create dictionary!")})}if($scope.wizard.mode=="import"){if(typeof $scope.wizard.importedDictionaryId=="string"){var ids=$scope.wizard.importedDictionaryId.split("_");var url=$("#convertUrl").data("lingvodoc");var convertObject={blob_client_id:parseInt(ids[0]),blob_object_id:parseInt(ids[1]),parent_client_id:language.client_id,parent_object_id:language.object_id};$http.post(url,convertObject).success(function(data,status,headers,config){alert(data.status)}).error(function(data,status,headers,config){})}}};$scope.createPerspective=function(){if(!$scope.dictionaryData.perspectiveName){return}var createPerspectiveUrl="/dictionary/"+encodeURIComponent($scope.dictionaryData.dictionary_client_id)+"/"+encodeURIComponent($scope.dictionaryData.dictionary_object_id)+"/"+"perspective";var perspectiveObj={name:$scope.dictionaryData.perspectiveName,translation:$scope.dictionaryData.perspectiveName};$http.post(createPerspectiveUrl,perspectiveObj).success(function(data,status,headers,config){if(data.object_id&&data.client_id){$scope.dictionaryData.perspective_client_id=data.client_id;$scope.dictionaryData.perspective_object_id=data.object_id;var setFieldsUrl="/dictionary/"+encodeURIComponent($scope.dictionaryData.dictionary_client_id)+"/"+encodeURIComponent($scope.dictionaryData.dictionary_object_id)+"/perspective/"+encodeURIComponent($scope.dictionaryData.perspective_client_id)+"/"+encodeURIComponent($scope.dictionaryData.perspective_object_id)+"/fields";$http.post(setFieldsUrl,exportPerpective($scope.perspective)).success(function(data,status,headers,config){$state.go("create.step3")}).error(function(data,status,headers,config){alert("Failed to create perspective!")})}else{alert("Failed to create perspective!")}}).error(function(data,status,headers,config){alert("Failed to create perspective!")})};$scope.searchUsers=function(query){var promise=$http.get("/users?search="+encodeURIComponent(query)).then(function(response){return response.data});promise.then(function(data){var userLogins=[];if(data.users){for(var i=0;i0){var childLangs=flatLanguages(language.contains);flat=flat.concat(childLangs)}}return flat};$scope.getLanguageId=function(language){if(language){return language.client_id+"_"+language.object_id}};$scope.ok=function(){if(!$scope.translation){return}var languageObj={translation:$scope.translation,translation_string:$scope.translation};if($scope.parentLanguageId!="-1"){var parentLanguage=getLanguageById($scope.parentLanguageId);if(parentLanguage){languageObj["parent_client_id"]=parentLanguage.client_id;languageObj["parent_object_id"]=parentLanguage.object_id}}$modalInstance.close(languageObj)};$scope.cancel=function(){$modalInstance.dismiss("cancel")};$http.get(languagesUrl).success(function(data,status,headers,config){$scope.languages=flatLanguages(data.languages)}).error(function(data,status,headers,config){})}]); \ No newline at end of file +if(value.entity_type==subField.entity_type){values.push(value)}}}}else{for(var i=0;i0&&pageNumber<=$scope.pageCount){$scope.pageIndex=pageNumber;loadEntries()}};$scope.range=function(min,max,step){step=step||1;var input=[];for(var i=min;i<=max;i+=step){input.push(i)}return input};$scope.viewGroup=function(entry,field,values){var modalInstance=$modal.open({animation:true,templateUrl:"viewGroupModal.html",controller:"viewGroupController",size:"lg",resolve:{groupParams:function(){return{entry:entry,field:field,values:values}}}});modalInstance.result.then(function(value){},function(){})};$scope.viewGroupingTag=function(entry,field,values){var modalInstance=$modal.open({animation:true,templateUrl:"viewGroupingTagModal.html",controller:"viewGroupingTagController",size:"lg",resolve:{groupParams:function(){return{clientId:entry.client_id,objectId:entry.object_id,fields:$scope.fields}}}});modalInstance.result.then(function(value){},function(){})};$scope.$watch("lexicalEntries",function(updatedEntries){var getFieldValues=function(entry,field){var value;var values=[];if(entry&&entry.contains){if(field.isGroup){for(var fieldIndex=0;fieldIndex=0?"&":"?")+encodeURIComponent(key)+"="+encodeURIComponent(value)};var perspectiveToDictionaryFields=function(perspective){var fields=[];for(var i=0;i0){var childLangs=flatLanguages(language.contains);flat=flat.concat(childLangs)}}return flat};var getLanguageById=function(id){if(typeof id=="string"){var ids=id.split("_");for(var i=0;i<$scope.languages.length;i++){if($scope.languages[i].client_id==ids[0]&&$scope.languages[i].object_id==ids[1])return $scope.languages[i]}}};$scope.languages=[];$scope.perspectives=[];$scope.dictionaryData={languageId:-1,perspectiveName:"",perspectiveId:-1};$scope.perspective={fields:[]};$scope.getLanguageId=function(language){if(language){return language.client_id+"_"+language.object_id}};$scope.newLanguage=function(){var modalInstance=$modal.open({animation:true,templateUrl:"createLanguageModal.html",controller:"CreateLanguageController",size:"lg"});modalInstance.result.then(function(languageObj){$http.post(createLanguageUrl,languageObj).success(function(data,status,headers,config){loadLanguages()}).error(function(data,status,headers,config){alert("Failed to save language!")})},function(){})};$scope.addField=function(){$scope.perspective.fields.push({entity_type:"",data_type:"text",status:"enabled"})};$scope.enableGroup=function(fieldIndex){if(typeof $scope.perspective.fields[fieldIndex].group==="undefined"){$scope.perspective.fields[fieldIndex].group=""}else{delete $scope.perspective.fields[fieldIndex].group}};$scope.enableLinkedField=function(fieldIndex){if(typeof $scope.perspective.fields[fieldIndex].contains==="undefined"){$scope.perspective.fields[fieldIndex].contains=[{entity_type:"",data_type:"markup",status:"enabled"}]}else{delete $scope.perspective.fields[fieldIndex].contains}};$scope.createDictionary=function(){var language=getLanguageById($scope.dictionaryData.languageId);if(!$scope.dictionaryData.name&&$scope.wizard.mode=="create"||typeof $scope.wizard.importedDictionaryId!="string"&&$scope.wizard.mode=="import"||!language){return}if($scope.wizard.mode=="create"){var dictionaryObj={parent_client_id:language.client_id,parent_object_id:language.object_id,name:$scope.dictionaryData.name,translation:$scope.dictionaryData.name};$http.post(createDictionaryUrl,dictionaryObj).success(function(data,status,headers,config){if(data.object_id&&data.client_id){$scope.dictionaryData.dictionary_client_id=data.client_id;$scope.dictionaryData.dictionary_object_id=data.object_id;$state.go("create.step2")}else{alert("Failed to create dictionary!")}}).error(function(data,status,headers,config){alert("Failed to create dictionary!")})}if($scope.wizard.mode=="import"){if(typeof $scope.wizard.importedDictionaryId=="string"){var ids=$scope.wizard.importedDictionaryId.split("_");var url=$("#convertUrl").data("lingvodoc");var convertObject={blob_client_id:parseInt(ids[0]),blob_object_id:parseInt(ids[1]),parent_client_id:language.client_id,parent_object_id:language.object_id};$http.post(url,convertObject).success(function(data,status,headers,config){alert(data.status)}).error(function(data,status,headers,config){})}}};$scope.createPerspective=function(){if(!$scope.dictionaryData.perspectiveName){return}var createPerspectiveUrl="/dictionary/"+encodeURIComponent($scope.dictionaryData.dictionary_client_id)+"/"+encodeURIComponent($scope.dictionaryData.dictionary_object_id)+"/"+"perspective";var perspectiveObj={name:$scope.dictionaryData.perspectiveName,translation:$scope.dictionaryData.perspectiveName};$http.post(createPerspectiveUrl,perspectiveObj).success(function(data,status,headers,config){if(data.object_id&&data.client_id){$scope.dictionaryData.perspective_client_id=data.client_id;$scope.dictionaryData.perspective_object_id=data.object_id;var setFieldsUrl="/dictionary/"+encodeURIComponent($scope.dictionaryData.dictionary_client_id)+"/"+encodeURIComponent($scope.dictionaryData.dictionary_object_id)+"/perspective/"+encodeURIComponent($scope.dictionaryData.perspective_client_id)+"/"+encodeURIComponent($scope.dictionaryData.perspective_object_id)+"/fields";$http.post(setFieldsUrl,exportPerpective($scope.perspective)).success(function(data,status,headers,config){window.location="/dashboard"}).error(function(data,status,headers,config){alert("Failed to create perspective!")})}else{alert("Failed to create perspective!")}}).error(function(data,status,headers,config){alert("Failed to create perspective!")})};$scope.searchUsers=function(query){var promise=$http.get("/users?search="+encodeURIComponent(query)).then(function(response){return response.data});promise.then(function(data){var userLogins=[];if(data.users){for(var i=0;i0){var childLangs=flatLanguages(language.contains);flat=flat.concat(childLangs)}}return flat};$scope.getLanguageId=function(language){if(language){return language.client_id+"_"+language.object_id}};$scope.ok=function(){if(!$scope.translation){return}var languageObj={translation:$scope.translation,translation_string:$scope.translation};if($scope.parentLanguageId!="-1"){var parentLanguage=getLanguageById($scope.parentLanguageId);if(parentLanguage){languageObj["parent_client_id"]=parentLanguage.client_id;languageObj["parent_object_id"]=parentLanguage.object_id}}$modalInstance.close(languageObj)};$scope.cancel=function(){$modalInstance.dismiss("cancel")};$http.get(languagesUrl).success(function(data,status,headers,config){$scope.languages=flatLanguages(data.languages)}).error(function(data,status,headers,config){})}]); \ No newline at end of file diff --git a/lingvodoc/static/js/user-upload.js b/lingvodoc/static/js/user-upload.js index 0e6694510..ebbdf31eb 100644 --- a/lingvodoc/static/js/user-upload.js +++ b/lingvodoc/static/js/user-upload.js @@ -20,4 +20,4 @@ carouselCtrl.addSlide(scope,element);scope.$on("$destroy",function(){carouselCtr self.dropdownMenu.replaceWith(newEl);self.dropdownMenu=newEl}dropdownService.close(scope);self.selectedOption=null}if(angular.isFunction(setIsOpen)){setIsOpen($scope,isOpen)}});$scope.$on("$locationChangeSuccess",function(){if(scope.getAutoClose()!=="disabled"){scope.isOpen=false}});var offDestroy=$scope.$on("$destroy",function(){scope.$destroy()});scope.$on("$destroy",offDestroy)}]).directive("dropdown",function(){return{controller:"DropdownController",link:function(scope,element,attrs,dropdownCtrl){dropdownCtrl.init(element);element.addClass("dropdown")}}}).directive("dropdownMenu",function(){return{restrict:"AC",require:"?^dropdown",link:function(scope,element,attrs,dropdownCtrl){if(!dropdownCtrl){return}var tplUrl=attrs.templateUrl;if(tplUrl){dropdownCtrl.dropdownMenuTemplateUrl=tplUrl}if(!dropdownCtrl.dropdownMenu){dropdownCtrl.dropdownMenu=element}}}}).directive("keyboardNav",function(){return{restrict:"A",require:"?^dropdown",link:function(scope,element,attrs,dropdownCtrl){element.bind("keydown",function(e){if([38,40].indexOf(e.which)!==-1){e.preventDefault();e.stopPropagation();var elems=dropdownCtrl.dropdownMenu.find("a");switch(e.which){case 40:{if(!angular.isNumber(dropdownCtrl.selectedOption)){dropdownCtrl.selectedOption=0}else{dropdownCtrl.selectedOption=dropdownCtrl.selectedOption===elems.length-1?dropdownCtrl.selectedOption:dropdownCtrl.selectedOption+1}break}case 38:{if(!angular.isNumber(dropdownCtrl.selectedOption)){dropdownCtrl.selectedOption=elems.length-1}else{dropdownCtrl.selectedOption=dropdownCtrl.selectedOption===0?0:dropdownCtrl.selectedOption-1}break}}elems[dropdownCtrl.selectedOption].focus()}})}}}).directive("dropdownToggle",function(){return{require:"?^dropdown",link:function(scope,element,attrs,dropdownCtrl){if(!dropdownCtrl){return}element.addClass("dropdown-toggle");dropdownCtrl.toggleElement=element;var toggleDropdown=function(event){event.preventDefault();if(!element.hasClass("disabled")&&!attrs.disabled){scope.$apply(function(){dropdownCtrl.toggle()})}};element.bind("click",toggleDropdown);element.attr({"aria-haspopup":true,"aria-expanded":false});scope.$watch(dropdownCtrl.isOpen,function(isOpen){element.attr("aria-expanded",!!isOpen)});scope.$on("$destroy",function(){element.unbind("click",toggleDropdown)})}}});angular.module("ui.bootstrap.modal",[]).factory("$$stackedMap",function(){return{createNew:function(){var stack=[];return{add:function(key,value){stack.push({key:key,value:value})},get:function(key){for(var i=0;i=0&&!backdropDomEl){backdropScope=$rootScope.$new(true);backdropScope.index=currBackdropIndex;var angularBackgroundDomEl=angular.element('
          ');angularBackgroundDomEl.attr("backdrop-class",modal.backdropClass);if(modal.animation){angularBackgroundDomEl.attr("modal-animation","true")}backdropDomEl=$compile(angularBackgroundDomEl)(backdropScope);body.append(backdropDomEl)}var angularDomEl=angular.element('
          ');angularDomEl.attr({"template-url":modal.windowTemplateUrl,"window-class":modal.windowClass,size:modal.size,index:openedWindows.length()-1,animate:"animate"}).html(modal.content);if(modal.animation){angularDomEl.attr("modal-animation","true")}var modalDomEl=$compile(angularDomEl)(modal.scope);openedWindows.top().value.modalDomEl=modalDomEl;openedWindows.top().value.modalOpener=modalOpener;body.append(modalDomEl);body.addClass(modalBodyClass);$modalStack.clearFocusListCache()};function broadcastClosing(modalWindow,resultOrReason,closing){return!modalWindow.value.modalScope.$broadcast("modal.closing",resultOrReason,closing).defaultPrevented}$modalStack.close=function(modalInstance,result){var modalWindow=openedWindows.get(modalInstance);if(modalWindow&&broadcastClosing(modalWindow,result,true)){modalWindow.value.modalScope.$$uibDestructionScheduled=true;modalWindow.value.deferred.resolve(result);removeModalWindow(modalInstance,modalWindow.value.modalOpener);return true}return!modalWindow};$modalStack.dismiss=function(modalInstance,reason){var modalWindow=openedWindows.get(modalInstance);if(modalWindow&&broadcastClosing(modalWindow,reason,false)){modalWindow.value.modalScope.$$uibDestructionScheduled=true;modalWindow.value.deferred.reject(reason);removeModalWindow(modalInstance,modalWindow.value.modalOpener);return true}return!modalWindow};$modalStack.dismissAll=function(reason){var topModal=this.getTop();while(topModal&&this.dismiss(topModal.key,reason)){topModal=this.getTop()}};$modalStack.getTop=function(){return openedWindows.top()};$modalStack.modalRendered=function(modalInstance){var modalWindow=openedWindows.get(modalInstance);if(modalWindow){modalWindow.value.renderDeferred.resolve()}};$modalStack.focusFirstFocusableElement=function(){if(focusableElementList.length>0){focusableElementList[0].focus();return true}return false};$modalStack.focusLastFocusableElement=function(){if(focusableElementList.length>0){focusableElementList[focusableElementList.length-1].focus();return true}return false};$modalStack.isFocusInFirstItem=function(evt){if(focusableElementList.length>0){return(evt.target||evt.srcElement)==focusableElementList[0]}return false};$modalStack.isFocusInLastItem=function(evt){if(focusableElementList.length>0){return(evt.target||evt.srcElement)==focusableElementList[focusableElementList.length-1]}return false};$modalStack.clearFocusListCache=function(){focusableElementList=[];focusIndex=0};$modalStack.loadFocusElementList=function(modalWindow){if(focusableElementList===undefined||!focusableElementList.length0){if(modalWindow){var modalDomE1=modalWindow.value.modalDomEl;if(modalDomE1&&modalDomE1.length){focusableElementList=modalDomE1[0].querySelectorAll(tababbleSelector)}}}};return $modalStack}]).provider("$modal",function(){var $modalProvider={options:{animation:true,backdrop:true,keyboard:true},$get:["$injector","$rootScope","$q","$templateRequest","$controller","$modalStack",function($injector,$rootScope,$q,$templateRequest,$controller,$modalStack){var $modal={};function getTemplatePromise(options){return options.template?$q.when(options.template):$templateRequest(angular.isFunction(options.templateUrl)?options.templateUrl():options.templateUrl)}function getResolvePromises(resolves){var promisesArr=[];angular.forEach(resolves,function(value){if(angular.isFunction(value)||angular.isArray(value)){promisesArr.push($q.when($injector.invoke(value)))}else if(angular.isString(value)){promisesArr.push($q.when($injector.get(value)))}else{promisesArr.push($q.when(value))}});return promisesArr}var promiseChain=null;$modal.getPromiseChain=function(){return promiseChain};$modal.open=function(modalOptions){var modalResultDeferred=$q.defer();var modalOpenedDeferred=$q.defer();var modalRenderDeferred=$q.defer();var modalInstance={result:modalResultDeferred.promise,opened:modalOpenedDeferred.promise,rendered:modalRenderDeferred.promise,close:function(result){return $modalStack.close(modalInstance,result)},dismiss:function(reason){return $modalStack.dismiss(modalInstance,reason)}};modalOptions=angular.extend({},$modalProvider.options,modalOptions);modalOptions.resolve=modalOptions.resolve||{};if(!modalOptions.template&&!modalOptions.templateUrl){throw new Error("One of template or templateUrl options is required.")}var templateAndResolvePromise=$q.all([getTemplatePromise(modalOptions)].concat(getResolvePromises(modalOptions.resolve)));var samePromise;samePromise=promiseChain=$q.all([promiseChain]).then(function(){return templateAndResolvePromise},function(){return templateAndResolvePromise}).then(function resolveSuccess(tplAndVars){var modalScope=(modalOptions.scope||$rootScope).$new();modalScope.$close=modalInstance.close;modalScope.$dismiss=modalInstance.dismiss;modalScope.$on("$destroy",function(){if(!modalScope.$$uibDestructionScheduled){modalScope.$dismiss("$uibUnscheduledDestruction")}});var ctrlInstance,ctrlLocals={};var resolveIter=1;if(modalOptions.controller){ctrlLocals.$scope=modalScope;ctrlLocals.$modalInstance=modalInstance;angular.forEach(modalOptions.resolve,function(value,key){ctrlLocals[key]=tplAndVars[resolveIter++]});ctrlInstance=$controller(modalOptions.controller,ctrlLocals);if(modalOptions.controllerAs){if(modalOptions.bindToController){angular.extend(ctrlInstance,modalScope)}modalScope[modalOptions.controllerAs]=ctrlInstance}}$modalStack.open(modalInstance,{scope:modalScope,deferred:modalResultDeferred,renderDeferred:modalRenderDeferred,content:tplAndVars[0],animation:modalOptions.animation,backdrop:modalOptions.backdrop,keyboard:modalOptions.keyboard,backdropClass:modalOptions.backdropClass,windowClass:modalOptions.windowClass,windowTemplateUrl:modalOptions.windowTemplateUrl,size:modalOptions.size,openedClass:modalOptions.openedClass});modalOpenedDeferred.resolve(true)},function resolveError(reason){modalOpenedDeferred.reject(reason);modalResultDeferred.reject(reason)}).finally(function(){if(promiseChain===samePromise){promiseChain=null}});return modalInstance};return $modal}]};return $modalProvider});angular.module("ui.bootstrap.pagination",[]).controller("PaginationController",["$scope","$attrs","$parse",function($scope,$attrs,$parse){var self=this,ngModelCtrl={$setViewValue:angular.noop},setNumPages=$attrs.numPages?$parse($attrs.numPages).assign:angular.noop;this.init=function(ngModelCtrl_,config){ngModelCtrl=ngModelCtrl_;this.config=config;ngModelCtrl.$render=function(){self.render()};if($attrs.itemsPerPage){$scope.$parent.$watch($parse($attrs.itemsPerPage),function(value){self.itemsPerPage=parseInt(value,10);$scope.totalPages=self.calculateTotalPages()})}else{this.itemsPerPage=config.itemsPerPage}$scope.$watch("totalItems",function(){$scope.totalPages=self.calculateTotalPages()});$scope.$watch("totalPages",function(value){setNumPages($scope.$parent,value);if($scope.page>value){$scope.selectPage(value)}else{ngModelCtrl.$render()}})};this.calculateTotalPages=function(){var totalPages=this.itemsPerPage<1?1:Math.ceil($scope.totalItems/this.itemsPerPage);return Math.max(totalPages||0,1)};this.render=function(){$scope.page=parseInt(ngModelCtrl.$viewValue,10)||1};$scope.selectPage=function(page,evt){if(evt){evt.preventDefault()}var clickAllowed=!$scope.ngDisabled||!evt;if(clickAllowed&&$scope.page!==page&&page>0&&page<=$scope.totalPages){if(evt&&evt.target){evt.target.blur()}ngModelCtrl.$setViewValue(page);ngModelCtrl.$render()}};$scope.getText=function(key){return $scope[key+"Text"]||self.config[key+"Text"]};$scope.noPrevious=function(){return $scope.page===1};$scope.noNext=function(){return $scope.page===$scope.totalPages}}]).constant("paginationConfig",{itemsPerPage:10,boundaryLinks:false,directionLinks:true,firstText:"First",previousText:"Previous",nextText:"Next",lastText:"Last",rotate:true}).directive("pagination",["$parse","paginationConfig",function($parse,paginationConfig){return{restrict:"EA",scope:{totalItems:"=",firstText:"@",previousText:"@",nextText:"@",lastText:"@",ngDisabled:"="},require:["pagination","?ngModel"],controller:"PaginationController",controllerAs:"pagination",templateUrl:function(element,attrs){return attrs.templateUrl||"template/pagination/pagination.html"},replace:true,link:function(scope,element,attrs,ctrls){var paginationCtrl=ctrls[0],ngModelCtrl=ctrls[1];if(!ngModelCtrl){return}var maxSize=angular.isDefined(attrs.maxSize)?scope.$parent.$eval(attrs.maxSize):paginationConfig.maxSize,rotate=angular.isDefined(attrs.rotate)?scope.$parent.$eval(attrs.rotate):paginationConfig.rotate;scope.boundaryLinks=angular.isDefined(attrs.boundaryLinks)?scope.$parent.$eval(attrs.boundaryLinks):paginationConfig.boundaryLinks;scope.directionLinks=angular.isDefined(attrs.directionLinks)?scope.$parent.$eval(attrs.directionLinks):paginationConfig.directionLinks;paginationCtrl.init(ngModelCtrl,paginationConfig);if(attrs.maxSize){scope.$parent.$watch($parse(attrs.maxSize),function(value){maxSize=parseInt(value,10);paginationCtrl.render()})}function makePage(number,text,isActive){return{number:number,text:text,active:isActive}}function getPages(currentPage,totalPages){var pages=[];var startPage=1,endPage=totalPages;var isMaxSized=angular.isDefined(maxSize)&&maxSizetotalPages){endPage=totalPages;startPage=endPage-maxSize+1}}else{startPage=(Math.ceil(currentPage/maxSize)-1)*maxSize+1;endPage=Math.min(startPage+maxSize-1,totalPages)}}for(var number=startPage;number<=endPage;number++){var page=makePage(number,number,number===currentPage);pages.push(page)}if(isMaxSized&&!rotate){if(startPage>1){var previousPageSet=makePage(startPage-1,"...",false);pages.unshift(previousPageSet)}if(endPage0&&scope.page<=scope.totalPages){scope.pages=getPages(scope.page,scope.totalPages)}}}}}]).constant("pagerConfig",{itemsPerPage:10,previousText:"« Previous",nextText:"Next »",align:true}).directive("pager",["pagerConfig",function(pagerConfig){return{restrict:"EA",scope:{totalItems:"=",previousText:"@",nextText:"@",ngDisabled:"="},require:["pager","?ngModel"],controller:"PaginationController",controllerAs:"pagination",templateUrl:function(element,attrs){return attrs.templateUrl||"template/pagination/pager.html"},replace:true,link:function(scope,element,attrs,ctrls){var paginationCtrl=ctrls[0],ngModelCtrl=ctrls[1];if(!ngModelCtrl){return}scope.align=angular.isDefined(attrs.align)?scope.$parent.$eval(attrs.align):pagerConfig.align;paginationCtrl.init(ngModelCtrl,pagerConfig)}}}]);angular.module("ui.bootstrap.tooltip",["ui.bootstrap.position","ui.bootstrap.bindHtml"]).provider("$tooltip",function(){var defaultOptions={placement:"top",animation:true,popupDelay:0,useContentExp:false};var triggerMap={mouseenter:"mouseleave",click:"click",focus:"blur",none:""};var globalOptions={};this.options=function(value){angular.extend(globalOptions,value)};this.setTriggers=function setTriggers(triggers){angular.extend(triggerMap,triggers)};function snake_case(name){var regexp=/[A-Z]/g;var separator="-";return name.replace(regexp,function(letter,pos){return(pos?separator:"")+letter.toLowerCase()})}this.$get=["$window","$compile","$timeout","$document","$position","$interpolate","$rootScope","$parse",function($window,$compile,$timeout,$document,$position,$interpolate,$rootScope,$parse){return function $tooltip(type,prefix,defaultTriggerShow,options){options=angular.extend({},defaultOptions,globalOptions,options);function getTriggers(trigger){var show=(trigger||options.trigger||defaultTriggerShow).split(" ");var hide=show.map(function(trigger){return triggerMap[trigger]||trigger});return{show:show,hide:hide}}var directiveName=snake_case(type);var startSym=$interpolate.startSymbol();var endSym=$interpolate.endSymbol();var template="
          "+"
          ";return{restrict:"EA",compile:function(tElem,tAttrs){var tooltipLinker=$compile(template);return function link(scope,element,attrs,tooltipCtrl){var tooltip;var tooltipLinkedScope;var transitionTimeout;var popupTimeout;var positionTimeout;var appendToBody=angular.isDefined(options.appendToBody)?options.appendToBody:false;var triggers=getTriggers(undefined);var hasEnableExp=angular.isDefined(attrs[prefix+"Enable"]);var ttScope=scope.$new(true);var repositionScheduled=false;var isOpenExp=angular.isDefined(attrs[prefix+"IsOpen"])?$parse(attrs[prefix+"IsOpen"]):false;var positionTooltip=function(){if(!tooltip){return}if(!positionTimeout){positionTimeout=$timeout(function(){tooltip.css({top:0,left:0,width:"auto",height:"auto"});var ttBox=$position.position(tooltip);var ttCss=$position.positionElements(element,tooltip,ttScope.placement,appendToBody);ttCss.top+="px";ttCss.left+="px";ttCss.width=ttBox.width+"px";ttCss.height=ttBox.height+"px";tooltip.css(ttCss);positionTimeout=null},0,false)}};ttScope.origScope=scope;ttScope.isOpen=false;function toggleTooltipBind(){if(!ttScope.isOpen){showTooltipBind()}else{hideTooltipBind()}}function showTooltipBind(){if(hasEnableExp&&!scope.$eval(attrs[prefix+"Enable"])){return}prepareTooltip();if(ttScope.popupDelay){if(!popupTimeout){popupTimeout=$timeout(show,ttScope.popupDelay,false)}}else{show()}}function hideTooltipBind(){hide();if(!$rootScope.$$phase){$rootScope.$digest()}}function show(){popupTimeout=null;if(transitionTimeout){$timeout.cancel(transitionTimeout);transitionTimeout=null}if(!(options.useContentExp?ttScope.contentExp():ttScope.content)){return angular.noop}createTooltip();ttScope.isOpen=true;if(isOpenExp){isOpenExp.assign(ttScope.origScope,ttScope.isOpen)}if(!$rootScope.$$phase){ttScope.$apply()}tooltip.css({display:"block"});positionTooltip()}function hide(){ttScope.isOpen=false;if(isOpenExp){isOpenExp.assign(ttScope.origScope,ttScope.isOpen)}$timeout.cancel(popupTimeout);popupTimeout=null;$timeout.cancel(positionTimeout);positionTimeout=null;if(ttScope.animation){if(!transitionTimeout){transitionTimeout=$timeout(removeTooltip,500)}}else{removeTooltip()}}function createTooltip(){if(tooltip){removeTooltip()}tooltipLinkedScope=ttScope.$new();tooltip=tooltipLinker(tooltipLinkedScope,function(tooltip){if(appendToBody){$document.find("body").append(tooltip)}else{element.after(tooltip)}});if(options.useContentExp){tooltipLinkedScope.$watch("contentExp()",function(val){if(!val&&ttScope.isOpen){hide()}});tooltipLinkedScope.$watch(function(){if(!repositionScheduled){repositionScheduled=true;tooltipLinkedScope.$$postDigest(function(){repositionScheduled=false;if(ttScope.isOpen){positionTooltip()}})}})}}function removeTooltip(){transitionTimeout=null;if(tooltip){tooltip.remove();tooltip=null}if(tooltipLinkedScope){tooltipLinkedScope.$destroy();tooltipLinkedScope=null}}function prepareTooltip(){prepPopupClass();prepPlacement();prepPopupDelay()}ttScope.contentExp=function(){return scope.$eval(attrs[type])};if(!options.useContentExp){attrs.$observe(type,function(val){ttScope.content=val;if(!val&&ttScope.isOpen){hide()}else{positionTooltip()}})}attrs.$observe("disabled",function(val){if(popupTimeout&&val){$timeout.cancel(popupTimeout);popupTimeout=null}if(val&&ttScope.isOpen){hide()}});attrs.$observe(prefix+"Title",function(val){ttScope.title=val;positionTooltip()});attrs.$observe(prefix+"Placement",function(){if(ttScope.isOpen){prepPlacement();positionTooltip()}});if(isOpenExp){scope.$watch(isOpenExp,function(val){if(val!==ttScope.isOpen){toggleTooltipBind()}})}function prepPopupClass(){ttScope.popupClass=attrs[prefix+"Class"]}function prepPlacement(){var val=attrs[prefix+"Placement"];ttScope.placement=angular.isDefined(val)?val:options.placement}function prepPopupDelay(){var val=attrs[prefix+"PopupDelay"];var delay=parseInt(val,10);ttScope.popupDelay=!isNaN(delay)?delay:options.popupDelay}var unregisterTriggers=function(){triggers.show.forEach(function(trigger){element.unbind(trigger,showTooltipBind)});triggers.hide.forEach(function(trigger){element.unbind(trigger,hideTooltipBind)})};function prepTriggers(){var val=attrs[prefix+"Trigger"];unregisterTriggers();triggers=getTriggers(val);if(triggers.show!=="none"){triggers.show.forEach(function(trigger,idx){if(trigger===triggers.hide[idx]){element[0].addEventListener(trigger,toggleTooltipBind)}else if(trigger){element[0].addEventListener(trigger,showTooltipBind);element[0].addEventListener(triggers.hide[idx],hideTooltipBind)}})}}prepTriggers();var animation=scope.$eval(attrs[prefix+"Animation"]);ttScope.animation=angular.isDefined(animation)?!!animation:options.animation;var appendToBodyVal=scope.$eval(attrs[prefix+"AppendToBody"]);appendToBody=angular.isDefined(appendToBodyVal)?appendToBodyVal:appendToBody;if(appendToBody){scope.$on("$locationChangeSuccess",function closeTooltipOnLocationChangeSuccess(){if(ttScope.isOpen){hide()}})}scope.$on("$destroy",function onDestroyTooltip(){$timeout.cancel(transitionTimeout);$timeout.cancel(popupTimeout);$timeout.cancel(positionTimeout);unregisterTriggers();removeTooltip();ttScope=null})}}}}}]}).directive("tooltipTemplateTransclude",["$animate","$sce","$compile","$templateRequest",function($animate,$sce,$compile,$templateRequest){return{link:function(scope,elem,attrs){var origScope=scope.$eval(attrs.tooltipTemplateTranscludeScope);var changeCounter=0,currentScope,previousElement,currentElement;var cleanupLastIncludeContent=function(){if(previousElement){previousElement.remove();previousElement=null}if(currentScope){currentScope.$destroy();currentScope=null}if(currentElement){$animate.leave(currentElement).then(function(){previousElement=null});previousElement=currentElement;currentElement=null}};scope.$watch($sce.parseAsResourceUrl(attrs.tooltipTemplateTransclude),function(src){var thisChangeId=++changeCounter;if(src){$templateRequest(src,true).then(function(response){if(thisChangeId!==changeCounter){return}var newScope=origScope.$new();var template=response;var clone=$compile(template)(newScope,function(clone){cleanupLastIncludeContent();$animate.enter(clone,elem)});currentScope=newScope;currentElement=clone;currentScope.$emit("$includeContentLoaded",src)},function(){if(thisChangeId===changeCounter){cleanupLastIncludeContent();scope.$emit("$includeContentError",src)}});scope.$emit("$includeContentRequested",src)}else{cleanupLastIncludeContent()}});scope.$on("$destroy",cleanupLastIncludeContent)}}}]).directive("tooltipClasses",function(){return{restrict:"A",link:function(scope,element,attrs){if(scope.placement){element.addClass(scope.placement)}if(scope.popupClass){element.addClass(scope.popupClass)}if(scope.animation()){element.addClass(attrs.tooltipAnimationClass)}}}}).directive("tooltipPopup",function(){return{restrict:"EA",replace:true,scope:{content:"@",placement:"@",popupClass:"@",animation:"&",isOpen:"&"},templateUrl:"template/tooltip/tooltip-popup.html"}}).directive("tooltip",["$tooltip",function($tooltip){return $tooltip("tooltip","tooltip","mouseenter")}]).directive("tooltipTemplatePopup",function(){return{restrict:"EA",replace:true,scope:{contentExp:"&",placement:"@",popupClass:"@",animation:"&",isOpen:"&",originScope:"&"},templateUrl:"template/tooltip/tooltip-template-popup.html"}}).directive("tooltipTemplate",["$tooltip",function($tooltip){return $tooltip("tooltipTemplate","tooltip","mouseenter",{useContentExp:true})}]).directive("tooltipHtmlPopup",function(){return{restrict:"EA",replace:true,scope:{contentExp:"&",placement:"@",popupClass:"@",animation:"&",isOpen:"&"},templateUrl:"template/tooltip/tooltip-html-popup.html"}}).directive("tooltipHtml",["$tooltip",function($tooltip){return $tooltip("tooltipHtml","tooltip","mouseenter",{useContentExp:true})}]).directive("tooltipHtmlUnsafePopup",function(){return{restrict:"EA",replace:true,scope:{content:"@",placement:"@",popupClass:"@",animation:"&",isOpen:"&"},templateUrl:"template/tooltip/tooltip-html-unsafe-popup.html"}}).value("tooltipHtmlUnsafeSuppressDeprecated",false).directive("tooltipHtmlUnsafe",["$tooltip","tooltipHtmlUnsafeSuppressDeprecated","$log",function($tooltip,tooltipHtmlUnsafeSuppressDeprecated,$log){if(!tooltipHtmlUnsafeSuppressDeprecated){$log.warn("tooltip-html-unsafe is now deprecated. Use tooltip-html or tooltip-template instead.")}return $tooltip("tooltipHtmlUnsafe","tooltip","mouseenter")}]);angular.module("ui.bootstrap.popover",["ui.bootstrap.tooltip"]).directive("popoverTemplatePopup",function(){return{restrict:"EA",replace:true,scope:{title:"@",contentExp:"&",placement:"@",popupClass:"@",animation:"&",isOpen:"&",originScope:"&"},templateUrl:"template/popover/popover-template.html"}}).directive("popoverTemplate",["$tooltip",function($tooltip){return $tooltip("popoverTemplate","popover","click",{useContentExp:true})}]).directive("popoverHtmlPopup",function(){return{restrict:"EA",replace:true,scope:{contentExp:"&",title:"@",placement:"@",popupClass:"@",animation:"&",isOpen:"&"},templateUrl:"template/popover/popover-html.html"}}).directive("popoverHtml",["$tooltip",function($tooltip){return $tooltip("popoverHtml","popover","click",{useContentExp:true})}]).directive("popoverPopup",function(){return{restrict:"EA",replace:true,scope:{title:"@",content:"@",placement:"@",popupClass:"@",animation:"&",isOpen:"&"},templateUrl:"template/popover/popover.html" }}).directive("popover",["$tooltip",function($tooltip){return $tooltip("popover","popover","click")}]);angular.module("ui.bootstrap.progressbar",[]).constant("progressConfig",{animate:true,max:100}).value("$progressSuppressWarning",false).controller("ProgressController",["$scope","$attrs","progressConfig",function($scope,$attrs,progressConfig){var self=this,animate=angular.isDefined($attrs.animate)?$scope.$parent.$eval($attrs.animate):progressConfig.animate;this.bars=[];$scope.max=angular.isDefined($scope.max)?$scope.max:progressConfig.max;this.addBar=function(bar,element){if(!animate){element.css({transition:"none"})}this.bars.push(bar);bar.max=$scope.max;bar.$watch("value",function(value){bar.recalculatePercentage()});bar.recalculatePercentage=function(){bar.percent=+(100*bar.value/bar.max).toFixed(2);var totalPercentage=self.bars.reduce(function(total,bar){return total+bar.percent},0);if(totalPercentage>100){bar.percent-=totalPercentage-100}};bar.$on("$destroy",function(){element=null;self.removeBar(bar)})};this.removeBar=function(bar){this.bars.splice(this.bars.indexOf(bar),1)};$scope.$watch("max",function(max){self.bars.forEach(function(bar){bar.max=$scope.max;bar.recalculatePercentage()})})}]).directive("uibProgress",function(){return{restrict:"EA",replace:true,transclude:true,controller:"ProgressController",require:"uibProgress",scope:{max:"=?"},templateUrl:"template/progressbar/progress.html"}}).directive("progress",["$log","$progressSuppressWarning",function($log,$progressSuppressWarning){return{restrict:"EA",replace:true,transclude:true,controller:"ProgressController",require:"progress",scope:{max:"=?"},templateUrl:"template/progressbar/progress.html",link:function(){if($progressSuppressWarning){$log.warn("progress is now deprecated. Use uib-progress instead")}}}}]).directive("uibBar",function(){return{restrict:"EA",replace:true,transclude:true,require:"^uibProgress",scope:{value:"=",type:"@"},templateUrl:"template/progressbar/bar.html",link:function(scope,element,attrs,progressCtrl){progressCtrl.addBar(scope,element)}}}).directive("bar",["$log","$progressSuppressWarning",function($log,$progressSuppressWarning){return{restrict:"EA",replace:true,transclude:true,require:"^progress",scope:{value:"=",type:"@"},templateUrl:"template/progressbar/bar.html",link:function(scope,element,attrs,progressCtrl){if($progressSuppressWarning){$log.warn("bar is now deprecated. Use uib-bar instead")}progressCtrl.addBar(scope,element)}}}]).directive("progressbar",function(){return{restrict:"EA",replace:true,transclude:true,controller:"ProgressController",scope:{value:"=",max:"=?",type:"@"},templateUrl:"template/progressbar/progressbar.html",link:function(scope,element,attrs,progressCtrl){progressCtrl.addBar(scope,angular.element(element.children()[0]))}}});angular.module("ui.bootstrap.rating",[]).constant("ratingConfig",{max:5,stateOn:null,stateOff:null,titles:["one","two","three","four","five"]}).controller("RatingController",["$scope","$attrs","ratingConfig",function($scope,$attrs,ratingConfig){var ngModelCtrl={$setViewValue:angular.noop};this.init=function(ngModelCtrl_){ngModelCtrl=ngModelCtrl_;ngModelCtrl.$render=this.render;ngModelCtrl.$formatters.push(function(value){if(angular.isNumber(value)&&value<<0!==value){value=Math.round(value)}return value});this.stateOn=angular.isDefined($attrs.stateOn)?$scope.$parent.$eval($attrs.stateOn):ratingConfig.stateOn;this.stateOff=angular.isDefined($attrs.stateOff)?$scope.$parent.$eval($attrs.stateOff):ratingConfig.stateOff;var tmpTitles=angular.isDefined($attrs.titles)?$scope.$parent.$eval($attrs.titles):ratingConfig.titles;this.titles=angular.isArray(tmpTitles)&&tmpTitles.length>0?tmpTitles:ratingConfig.titles;var ratingStates=angular.isDefined($attrs.ratingStates)?$scope.$parent.$eval($attrs.ratingStates):new Array(angular.isDefined($attrs.max)?$scope.$parent.$eval($attrs.max):ratingConfig.max);$scope.range=this.buildTemplateObjects(ratingStates)};this.buildTemplateObjects=function(states){for(var i=0,n=states.length;i=this.titles.length){return index+1}else{return this.titles[index]}};$scope.rate=function(value){if(!$scope.readonly&&value>=0&&value<=$scope.range.length){ngModelCtrl.$setViewValue(ngModelCtrl.$viewValue===value?0:value);ngModelCtrl.$render()}};$scope.enter=function(value){if(!$scope.readonly){$scope.value=value}$scope.onHover({value:value})};$scope.reset=function(){$scope.value=ngModelCtrl.$viewValue;$scope.onLeave()};$scope.onKeydown=function(evt){if(/(37|38|39|40)/.test(evt.which)){evt.preventDefault();evt.stopPropagation();$scope.rate($scope.value+(evt.which===38||evt.which===39?1:-1))}};this.render=function(){$scope.value=ngModelCtrl.$viewValue}}]).directive("rating",function(){return{restrict:"EA",require:["rating","ngModel"],scope:{readonly:"=?",onHover:"&",onLeave:"&"},controller:"RatingController",templateUrl:"template/rating/rating.html",replace:true,link:function(scope,element,attrs,ctrls){var ratingCtrl=ctrls[0],ngModelCtrl=ctrls[1];ratingCtrl.init(ngModelCtrl)}}});angular.module("ui.bootstrap.tabs",[]).controller("TabsetController",["$scope",function TabsetCtrl($scope){var ctrl=this,tabs=ctrl.tabs=$scope.tabs=[];ctrl.select=function(selectedTab){angular.forEach(tabs,function(tab){if(tab.active&&tab!==selectedTab){tab.active=false;tab.onDeselect();selectedTab.selectCalled=false}});selectedTab.active=true;if(!selectedTab.selectCalled){selectedTab.onSelect();selectedTab.selectCalled=true}};ctrl.addTab=function addTab(tab){tabs.push(tab);if(tabs.length===1&&tab.active!==false){tab.active=true}else if(tab.active){ctrl.select(tab)}else{tab.active=false}};ctrl.removeTab=function removeTab(tab){var index=tabs.indexOf(tab);if(tab.active&&tabs.length>1&&!destroyed){var newActiveIndex=index==tabs.length-1?index-1:index+1;ctrl.select(tabs[newActiveIndex])}tabs.splice(index,1)};var destroyed;$scope.$on("$destroy",function(){destroyed=true})}]).directive("tabset",function(){return{restrict:"EA",transclude:true,replace:true,scope:{type:"@"},controller:"TabsetController",templateUrl:"template/tabs/tabset.html",link:function(scope,element,attrs){scope.vertical=angular.isDefined(attrs.vertical)?scope.$parent.$eval(attrs.vertical):false;scope.justified=angular.isDefined(attrs.justified)?scope.$parent.$eval(attrs.justified):false}}}).directive("tab",["$parse","$log",function($parse,$log){return{require:"^tabset",restrict:"EA",replace:true,templateUrl:"template/tabs/tab.html",transclude:true,scope:{active:"=?",heading:"@",onSelect:"&select",onDeselect:"&deselect"},controller:function(){},link:function(scope,elm,attrs,tabsetCtrl,transclude){scope.$watch("active",function(active){if(active){tabsetCtrl.select(scope)}});scope.disabled=false;if(attrs.disable){scope.$parent.$watch($parse(attrs.disable),function(value){scope.disabled=!!value})}if(attrs.disabled){$log.warn('Use of "disabled" attribute has been deprecated, please use "disable"');scope.$parent.$watch($parse(attrs.disabled),function(value){scope.disabled=!!value})}scope.select=function(){if(!scope.disabled){scope.active=true}};tabsetCtrl.addTab(scope);scope.$on("$destroy",function(){tabsetCtrl.removeTab(scope)});scope.$transcludeFn=transclude}}}]).directive("tabHeadingTransclude",function(){return{restrict:"A",require:"^tab",link:function(scope,elm,attrs,tabCtrl){scope.$watch("headingElement",function updateHeadingElement(heading){if(heading){elm.html("");elm.append(heading)}})}}}).directive("tabContentTransclude",function(){return{restrict:"A",require:"^tabset",link:function(scope,elm,attrs){var tab=scope.$eval(attrs.tabContentTransclude);tab.$transcludeFn(tab.$parent,function(contents){angular.forEach(contents,function(node){if(isTabHeading(node)){tab.headingElement=node}else{elm.append(node)}})})}};function isTabHeading(node){return node.tagName&&(node.hasAttribute("tab-heading")||node.hasAttribute("data-tab-heading")||node.hasAttribute("x-tab-heading")||node.tagName.toLowerCase()==="tab-heading"||node.tagName.toLowerCase()==="data-tab-heading"||node.tagName.toLowerCase()==="x-tab-heading")}});angular.module("ui.bootstrap.timepicker",[]).constant("timepickerConfig",{hourStep:1,minuteStep:1,showMeridian:true,meridians:null,readonlyInput:false,mousewheel:true,arrowkeys:true,showSpinners:true}).controller("TimepickerController",["$scope","$attrs","$parse","$log","$locale","timepickerConfig",function($scope,$attrs,$parse,$log,$locale,timepickerConfig){var selected=new Date,ngModelCtrl={$setViewValue:angular.noop},meridians=angular.isDefined($attrs.meridians)?$scope.$parent.$eval($attrs.meridians):timepickerConfig.meridians||$locale.DATETIME_FORMATS.AMPMS;this.init=function(ngModelCtrl_,inputs){ngModelCtrl=ngModelCtrl_;ngModelCtrl.$render=this.render;ngModelCtrl.$formatters.unshift(function(modelValue){return modelValue?new Date(modelValue):null});var hoursInputEl=inputs.eq(0),minutesInputEl=inputs.eq(1);var mousewheel=angular.isDefined($attrs.mousewheel)?$scope.$parent.$eval($attrs.mousewheel):timepickerConfig.mousewheel;if(mousewheel){this.setupMousewheelEvents(hoursInputEl,minutesInputEl)}var arrowkeys=angular.isDefined($attrs.arrowkeys)?$scope.$parent.$eval($attrs.arrowkeys):timepickerConfig.arrowkeys;if(arrowkeys){this.setupArrowkeyEvents(hoursInputEl,minutesInputEl)}$scope.readonlyInput=angular.isDefined($attrs.readonlyInput)?$scope.$parent.$eval($attrs.readonlyInput):timepickerConfig.readonlyInput;this.setupInputEvents(hoursInputEl,minutesInputEl)};var hourStep=timepickerConfig.hourStep;if($attrs.hourStep){$scope.$parent.$watch($parse($attrs.hourStep),function(value){hourStep=parseInt(value,10)})}var minuteStep=timepickerConfig.minuteStep;if($attrs.minuteStep){$scope.$parent.$watch($parse($attrs.minuteStep),function(value){minuteStep=parseInt(value,10)})}var min;$scope.$parent.$watch($parse($attrs.min),function(value){var dt=new Date(value);min=isNaN(dt)?undefined:dt});var max;$scope.$parent.$watch($parse($attrs.max),function(value){var dt=new Date(value);max=isNaN(dt)?undefined:dt});$scope.noIncrementHours=function(){var incrementedSelected=addMinutes(selected,hourStep*60);return incrementedSelected>max||incrementedSelectedselected&&decrementedSelected>max};$scope.noIncrementMinutes=function(){var incrementedSelected=addMinutes(selected,minuteStep);return incrementedSelected>max||incrementedSelectedselected&&decrementedSelected>max};$scope.noToggleMeridian=function(){if(selected.getHours()<13){return addMinutes(selected,12*60)>max}else{return addMinutes(selected,-12*60)0&&hours<13:hours>=0&&hours<24;if(!valid){return undefined}if($scope.showMeridian){if(hours===12){hours=0}if($scope.meridian===meridians[1]){hours=hours+12}}return hours}function getMinutesFromTemplate(){var minutes=parseInt($scope.minutes,10);return minutes>=0&&minutes<60?minutes:undefined}function pad(value){return angular.isDefined(value)&&value.toString().length<2?"0"+value:value.toString()}this.setupMousewheelEvents=function(hoursInputEl,minutesInputEl){var isScrollingUp=function(e){if(e.originalEvent){e=e.originalEvent}var delta=e.wheelDelta?e.wheelDelta:-e.deltaY;return e.detail||delta>0};hoursInputEl.bind("mousewheel wheel",function(e){$scope.$apply(isScrollingUp(e)?$scope.incrementHours():$scope.decrementHours());e.preventDefault()});minutesInputEl.bind("mousewheel wheel",function(e){$scope.$apply(isScrollingUp(e)?$scope.incrementMinutes():$scope.decrementMinutes());e.preventDefault()})};this.setupArrowkeyEvents=function(hoursInputEl,minutesInputEl){hoursInputEl.bind("keydown",function(e){if(e.which===38){e.preventDefault();$scope.incrementHours();$scope.$apply()}else if(e.which===40){e.preventDefault();$scope.decrementHours();$scope.$apply()}});minutesInputEl.bind("keydown",function(e){if(e.which===38){e.preventDefault();$scope.incrementMinutes();$scope.$apply()}else if(e.which===40){e.preventDefault();$scope.decrementMinutes();$scope.$apply()}})};this.setupInputEvents=function(hoursInputEl,minutesInputEl){if($scope.readonlyInput){$scope.updateHours=angular.noop;$scope.updateMinutes=angular.noop;return}var invalidate=function(invalidHours,invalidMinutes){ngModelCtrl.$setViewValue(null);ngModelCtrl.$setValidity("time",false);if(angular.isDefined(invalidHours)){$scope.invalidHours=invalidHours}if(angular.isDefined(invalidMinutes)){$scope.invalidMinutes=invalidMinutes}};$scope.updateHours=function(){var hours=getHoursFromTemplate(),minutes=getMinutesFromTemplate();if(angular.isDefined(hours)&&angular.isDefined(minutes)){selected.setHours(hours);if(selectedmax){invalidate(true)}else{refresh("h")}}else{invalidate(true)}};hoursInputEl.bind("blur",function(e){if(!$scope.invalidHours&&$scope.hours<10){$scope.$apply(function(){$scope.hours=pad($scope.hours)})}});$scope.updateMinutes=function(){var minutes=getMinutesFromTemplate(),hours=getHoursFromTemplate();if(angular.isDefined(minutes)&&angular.isDefined(hours)){selected.setMinutes(minutes);if(selectedmax){invalidate(undefined,true)}else{refresh("m")}}else{invalidate(undefined,true)}};minutesInputEl.bind("blur",function(e){if(!$scope.invalidMinutes&&$scope.minutes<10){$scope.$apply(function(){$scope.minutes=pad($scope.minutes)})}})};this.render=function(){var date=ngModelCtrl.$viewValue;if(isNaN(date)){ngModelCtrl.$setValidity("time",false);$log.error('Timepicker directive: "ng-model" value must be a Date object, a number of milliseconds since 01.01.1970 or a string representing an RFC2822 or ISO 8601 date.')}else{if(date){selected=date}if(selectedmax){ngModelCtrl.$setValidity("time",false);$scope.invalidHours=true;$scope.invalidMinutes=true}else{makeValid()}updateTemplate()}};function refresh(keyboardChange){makeValid();ngModelCtrl.$setViewValue(new Date(selected));updateTemplate(keyboardChange)}function makeValid(){ngModelCtrl.$setValidity("time",true);$scope.invalidHours=false;$scope.invalidMinutes=false}function updateTemplate(keyboardChange){var hours=selected.getHours(),minutes=selected.getMinutes();if($scope.showMeridian){hours=hours===0||hours===12?12:hours%12}$scope.hours=keyboardChange==="h"?hours:pad(hours);if(keyboardChange!=="m"){$scope.minutes=pad(minutes)}$scope.meridian=selected.getHours()<12?meridians[0]:meridians[1]}function addMinutes(date,minutes){var dt=new Date(date.getTime()+minutes*6e4);var newDate=new Date(date);newDate.setHours(dt.getHours(),dt.getMinutes());return newDate}function addMinutesToSelected(minutes){selected=addMinutes(selected,minutes);refresh()}$scope.showSpinners=angular.isDefined($attrs.showSpinners)?$scope.$parent.$eval($attrs.showSpinners):timepickerConfig.showSpinners;$scope.incrementHours=function(){if(!$scope.noIncrementHours()){addMinutesToSelected(hourStep*60)}};$scope.decrementHours=function(){if(!$scope.noDecrementHours()){addMinutesToSelected(-hourStep*60)}};$scope.incrementMinutes=function(){if(!$scope.noIncrementMinutes()){addMinutesToSelected(minuteStep)}};$scope.decrementMinutes=function(){if(!$scope.noDecrementMinutes()){addMinutesToSelected(-minuteStep)}};$scope.toggleMeridian=function(){if(!$scope.noToggleMeridian()){addMinutesToSelected(12*60*(selected.getHours()<12?1:-1))}}}]).directive("timepicker",function(){return{restrict:"EA",require:["timepicker","?^ngModel"],controller:"TimepickerController",controllerAs:"timepicker",replace:true,scope:{},templateUrl:function(element,attrs){return attrs.templateUrl||"template/timepicker/timepicker.html"},link:function(scope,element,attrs,ctrls){var timepickerCtrl=ctrls[0],ngModelCtrl=ctrls[1];if(ngModelCtrl){timepickerCtrl.init(ngModelCtrl,element.find("input"))}}}});angular.module("ui.bootstrap.transition",[]).value("$transitionSuppressDeprecated",false).factory("$transition",["$q","$timeout","$rootScope","$log","$transitionSuppressDeprecated",function($q,$timeout,$rootScope,$log,$transitionSuppressDeprecated){if(!$transitionSuppressDeprecated){$log.warn("$transition is now deprecated. Use $animate from ngAnimate instead.")}var $transition=function(element,trigger,options){options=options||{};var deferred=$q.defer();var endEventName=$transition[options.animation?"animationEndEventName":"transitionEndEventName"];var transitionEndHandler=function(event){$rootScope.$apply(function(){element.unbind(endEventName,transitionEndHandler);deferred.resolve(element)})};if(endEventName){element.bind(endEventName,transitionEndHandler)}$timeout(function(){if(angular.isString(trigger)){element.addClass(trigger)}else if(angular.isFunction(trigger)){trigger(element)}else if(angular.isObject(trigger)){element.css(trigger)}if(!endEventName){deferred.resolve(element)}});deferred.promise.cancel=function(){if(endEventName){element.unbind(endEventName,transitionEndHandler)}deferred.reject("Transition cancelled")};return deferred.promise};var transElement=document.createElement("trans");var transitionEndEventNames={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",transition:"transitionend"};var animationEndEventNames={WebkitTransition:"webkitAnimationEnd",MozTransition:"animationend",OTransition:"oAnimationEnd",transition:"animationend"};function findEndEventName(endEventNames){for(var name in endEventNames){if(transElement.style[name]!==undefined){return endEventNames[name]}}}$transition.transitionEndEventName=findEndEventName(transitionEndEventNames);$transition.animationEndEventName=findEndEventName(animationEndEventNames);return $transition}]);angular.module("ui.bootstrap.typeahead",["ui.bootstrap.position"]).factory("typeaheadParser",["$parse",function($parse){var TYPEAHEAD_REGEXP=/^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w\d]*))\s+in\s+([\s\S]+?)$/;return{parse:function(input){var match=input.match(TYPEAHEAD_REGEXP);if(!match){throw new Error('Expected typeahead specification in form of "_modelValue_ (as _label_)? for _item_ in _collection_"'+' but got "'+input+'".')}return{itemName:match[3],source:$parse(match[4]),viewMapper:$parse(match[2]||match[1]),modelMapper:$parse(match[1])}}}}]).directive("typeahead",["$compile","$parse","$q","$timeout","$document","$window","$rootScope","$position","typeaheadParser",function($compile,$parse,$q,$timeout,$document,$window,$rootScope,$position,typeaheadParser){var HOT_KEYS=[9,13,27,38,40];var eventDebounceTime=200;return{require:["ngModel","^?ngModelOptions"],link:function(originalScope,element,attrs,ctrls){var modelCtrl=ctrls[0];var ngModelOptions=ctrls[1];var minLength=originalScope.$eval(attrs.typeaheadMinLength);if(!minLength&&minLength!==0){minLength=1}var waitTime=originalScope.$eval(attrs.typeaheadWaitMs)||0;var isEditable=originalScope.$eval(attrs.typeaheadEditable)!==false;var isLoadingSetter=$parse(attrs.typeaheadLoading).assign||angular.noop;var onSelectCallback=$parse(attrs.typeaheadOnSelect);var isSelectOnBlur=angular.isDefined(attrs.typeaheadSelectOnBlur)?originalScope.$eval(attrs.typeaheadSelectOnBlur):false;var isNoResultsSetter=$parse(attrs.typeaheadNoResults).assign||angular.noop;var inputFormatter=attrs.typeaheadInputFormatter?$parse(attrs.typeaheadInputFormatter):undefined;var appendToBody=attrs.typeaheadAppendToBody?originalScope.$eval(attrs.typeaheadAppendToBody):false;var focusFirst=originalScope.$eval(attrs.typeaheadFocusFirst)!==false;var selectOnExact=attrs.typeaheadSelectOnExact?originalScope.$eval(attrs.typeaheadSelectOnExact):false;var parsedModel=$parse(attrs.ngModel);var invokeModelSetter=$parse(attrs.ngModel+"($$$p)");var $setModelValue=function(scope,newValue){if(angular.isFunction(parsedModel(originalScope))&&ngModelOptions&&ngModelOptions.$options&&ngModelOptions.$options.getterSetter){return invokeModelSetter(scope,{$$$p:newValue})}else{return parsedModel.assign(scope,newValue)}};var parserResult=typeaheadParser.parse(attrs.typeahead);var hasFocus;var selected;var scope=originalScope.$new();var offDestroy=originalScope.$on("$destroy",function(){scope.$destroy()});scope.$on("$destroy",offDestroy);var popupId="typeahead-"+scope.$id+"-"+Math.floor(Math.random()*1e4);element.attr({"aria-autocomplete":"list","aria-expanded":false,"aria-owns":popupId});var popUpEl=angular.element("
          ");popUpEl.attr({id:popupId,matches:"matches",active:"activeIdx",select:"select(activeIdx)","move-in-progress":"moveInProgress",query:"query",position:"position"});if(angular.isDefined(attrs.typeaheadTemplateUrl)){popUpEl.attr("template-url",attrs.typeaheadTemplateUrl)}if(angular.isDefined(attrs.typeaheadPopupTemplateUrl)){popUpEl.attr("popup-template-url",attrs.typeaheadPopupTemplateUrl)}var resetMatches=function(){scope.matches=[];scope.activeIdx=-1;element.attr("aria-expanded",false)};var getMatchId=function(index){return popupId+"-option-"+index};scope.$watch("activeIdx",function(index){if(index<0){element.removeAttr("aria-activedescendant")}else{element.attr("aria-activedescendant",getMatchId(index))}});var inputIsExactMatch=function(inputValue,index){if(scope.matches.length>index&&inputValue){return inputValue.toUpperCase()===scope.matches[index].label.toUpperCase()}return false};var getMatchesAsync=function(inputValue){var locals={$viewValue:inputValue};isLoadingSetter(originalScope,true);isNoResultsSetter(originalScope,false);$q.when(parserResult.source(originalScope,locals)).then(function(matches){var onCurrentRequest=inputValue===modelCtrl.$viewValue;if(onCurrentRequest&&hasFocus){if(matches&&matches.length>0){scope.activeIdx=focusFirst?0:-1;isNoResultsSetter(originalScope,false);scope.matches.length=0;for(var i=0;i=minLength){if(waitTime>0){cancelPreviousTimeout();scheduleSearchWithTimeout(inputValue)}else{getMatchesAsync(inputValue)}}else{isLoadingSetter(originalScope,false);cancelPreviousTimeout();resetMatches()}if(isEditable){return inputValue}else{if(!inputValue){modelCtrl.$setValidity("editable",true);return null}else{modelCtrl.$setValidity("editable",false);return undefined}}});modelCtrl.$formatters.push(function(modelValue){var candidateViewValue,emptyViewValue;var locals={};if(!isEditable){modelCtrl.$setValidity("editable",true)}if(inputFormatter){locals.$model=modelValue;return inputFormatter(originalScope,locals)}else{locals[parserResult.itemName]=modelValue;candidateViewValue=parserResult.viewMapper(originalScope,locals);locals[parserResult.itemName]=undefined;emptyViewValue=parserResult.viewMapper(originalScope,locals);return candidateViewValue!==emptyViewValue?candidateViewValue:modelValue}});scope.select=function(activeIdx){var locals={};var model,item;selected=true;locals[parserResult.itemName]=item=scope.matches[activeIdx].model;model=parserResult.modelMapper(originalScope,locals);$setModelValue(originalScope,model);modelCtrl.$setValidity("editable",true);modelCtrl.$setValidity("parse",true);onSelectCallback(originalScope,{$item:item,$model:model,$label:parserResult.viewMapper(originalScope,locals)});resetMatches();if(scope.$eval(attrs.typeaheadFocusOnSelect)!==false){$timeout(function(){element[0].focus()},0,false)}};element.bind("keydown",function(evt){if(scope.matches.length===0||HOT_KEYS.indexOf(evt.which)===-1){return}if(scope.activeIdx===-1&&(evt.which===9||evt.which===13)){resetMatches();scope.$digest();return}evt.preventDefault();if(evt.which===40){scope.activeIdx=(scope.activeIdx+1)%scope.matches.length;scope.$digest()}else if(evt.which===38){scope.activeIdx=(scope.activeIdx>0?scope.activeIdx:scope.matches.length)-1;scope.$digest()}else if(evt.which===13||evt.which===9){scope.$apply(function(){scope.select(scope.activeIdx)})}else if(evt.which===27){evt.stopPropagation();resetMatches();scope.$digest()}});element.bind("blur",function(){if(isSelectOnBlur&&scope.matches.length&&scope.activeIdx!==-1&&!selected){selected=true;scope.$apply(function(){scope.select(scope.activeIdx)})}hasFocus=false;selected=false});var dismissClickHandler=function(evt){if(element[0]!==evt.target&&evt.which!==3&&scope.matches.length!==0){resetMatches();if(!$rootScope.$$phase){scope.$digest()}}};$document.bind("click",dismissClickHandler);originalScope.$on("$destroy",function(){$document.unbind("click",dismissClickHandler);if(appendToBody){$popup.remove()}popUpEl.remove()});var $popup=$compile(popUpEl)(scope);if(appendToBody){$document.find("body").append($popup)}else{element.after($popup)}}}}]).directive("typeaheadPopup",function(){return{restrict:"EA",scope:{matches:"=",query:"=",active:"=",position:"&",moveInProgress:"=",select:"&"},replace:true,templateUrl:function(element,attrs){return attrs.popupTemplateUrl||"template/typeahead/typeahead-popup.html"},link:function(scope,element,attrs){scope.templateUrl=attrs.templateUrl;scope.isOpen=function(){return scope.matches.length>0};scope.isActive=function(matchIdx){return scope.active==matchIdx};scope.selectActive=function(matchIdx){scope.active=matchIdx};scope.selectMatch=function(activeIdx){scope.select({activeIdx:activeIdx})}}}}).directive("typeaheadMatch",["$templateRequest","$compile","$parse",function($templateRequest,$compile,$parse){return{restrict:"EA",scope:{index:"=",match:"=",query:"="},link:function(scope,element,attrs){var tplUrl=$parse(attrs.templateUrl)(scope.$parent)||"template/typeahead/typeahead-match.html";$templateRequest(tplUrl).then(function(tplContent){$compile(tplContent.trim())(scope,function(clonedElement){element.replaceWith(clonedElement)})})}}}]).filter("typeaheadHighlight",["$sce","$injector","$log",function($sce,$injector,$log){var isSanitizePresent;isSanitizePresent=$injector.has("$sanitize");function escapeRegexp(queryToEscape){return queryToEscape.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")}function containsHtml(matchItem){return/<.*>/g.test(matchItem)}return function(matchItem,query){if(!isSanitizePresent&&containsHtml(matchItem)){$log.warn("Unsafe use of typeahead please use ngSanitize")}matchItem=query?(""+matchItem).replace(new RegExp(escapeRegexp(query),"gi"),"$&"):matchItem;if(!isSanitizePresent){matchItem=$sce.trustAsHtml(matchItem)}return matchItem}}]);angular.module("template/accordion/accordion-group.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/accordion/accordion-group.html","
          \n"+'
          \n'+'

          \n'+' {{heading}}\n'+"

          \n"+"
          \n"+'
          \n'+'
          \n'+"
          \n"+"
          \n"+"")}]);angular.module("template/accordion/accordion.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/accordion/accordion.html",'
          ')}]);angular.module("template/alert/alert.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/alert/alert.html","
          \n"+' \n"+"
          \n"+"
          \n"+"")}]);angular.module("template/carousel/carousel.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/carousel/carousel.html",'\n"+"")}]);angular.module("template/carousel/slide.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/carousel/slide.html",'
          \n'+"")}]);angular.module("template/datepicker/datepicker.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/datepicker/datepicker.html",'
          \n'+' \n'+' \n'+' \n'+"
          ")}]);angular.module("template/datepicker/day.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/datepicker/day.html",'\n'+" \n"+" \n"+' \n'+' \n'+' \n'+" \n"+" \n"+' \n'+' \n'+" \n"+" \n"+" \n"+' \n'+' \n'+' \n"+" \n"+" \n"+"
          {{::label.abbr}}
          {{ weekNumbers[$index] }}\n'+' \n'+"
          \n"+""); }]);angular.module("template/datepicker/month.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/datepicker/month.html",'\n'+" \n"+" \n"+' \n'+' \n'+' \n'+" \n"+" \n"+" \n"+' \n'+' \n"+" \n"+" \n"+"
          \n'+' \n'+"
          \n"+"")}]);angular.module("template/datepicker/popup.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/datepicker/popup.html",'\n"+"")}]);angular.module("template/datepicker/year.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/datepicker/year.html",'\n'+" \n"+" \n"+' \n'+' \n'+' \n'+" \n"+" \n"+" \n"+' \n'+' \n"+" \n"+" \n"+"
          \n'+' \n'+"
          \n"+"")}]);angular.module("template/modal/backdrop.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/modal/backdrop.html",'\n"+"")}]);angular.module("template/modal/window.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/modal/window.html",'\n"+"")}]);angular.module("template/pagination/pager.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/pagination/pager.html",'\n"+"")}]);angular.module("template/pagination/pagination.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/pagination/pagination.html",'\n"+"")}]);angular.module("template/tooltip/tooltip-html-popup.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/tooltip/tooltip-html-popup.html",'
          \n'+'
          \n'+'
          \n'+"
          \n"+"")}]);angular.module("template/tooltip/tooltip-html-unsafe-popup.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/tooltip/tooltip-html-unsafe-popup.html",'
          \n'+'
          \n'+'
          \n'+"
          \n"+"")}]);angular.module("template/tooltip/tooltip-popup.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/tooltip/tooltip-popup.html",'
          \n'+'
          \n'+'
          \n'+"
          \n"+"")}]);angular.module("template/tooltip/tooltip-template-popup.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/tooltip/tooltip-template-popup.html",'
          \n'+'
          \n'+'
          \n'+"
          \n"+"")}]);angular.module("template/popover/popover-html.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/popover/popover-html.html",'
          \n'+'
          \n'+"\n"+'
          \n'+'

          \n'+'
          \n'+"
          \n"+"
          \n"+"")}]);angular.module("template/popover/popover-template.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/popover/popover-template.html",'
          \n'+'
          \n'+"\n"+'
          \n'+'

          \n'+'
          \n'+"
          \n"+"
          \n"+"")}]);angular.module("template/popover/popover.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/popover/popover.html",'
          \n'+'
          \n'+"\n"+'
          \n'+'

          \n'+'
          \n'+"
          \n"+"
          \n"+"")}]);angular.module("template/progressbar/bar.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/progressbar/bar.html",'
          \n'+"")}]);angular.module("template/progressbar/progress.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/progressbar/progress.html",'
          ')}]);angular.module("template/progressbar/progressbar.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/progressbar/progressbar.html",'
          \n'+'
          \n'+"
          \n"+"")}]);angular.module("template/rating/rating.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/rating/rating.html",'\n'+" ({{ $index < value ? '*' : ' ' }})\n"+' \n'+"\n"+"")}]);angular.module("template/tabs/tab.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/tabs/tab.html",'
        • \n'+' {{heading}}\n'+"
        • \n"+"")}]);angular.module("template/tabs/tabset.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/tabs/tabset.html","
          \n"+"
            \n"+'
            \n'+'
            \n'+"
            \n"+"
            \n"+"
            \n"+"")}]);angular.module("template/timepicker/timepicker.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/timepicker/timepicker.html","\n"+" \n"+' \n'+' \n'+" \n"+' \n'+' \n'+" \n"+" \n"+' \n"+" \n"+' \n"+' \n'+" \n"+' \n'+' \n'+" \n"+' \n'+' \n'+" \n"+" \n"+"
             
            \n'+' \n'+" :\n'+' \n'+"
             
            \n"+"")}]);angular.module("template/typeahead/typeahead-match.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/typeahead/typeahead-match.html",'\n'+"")}]);angular.module("template/typeahead/typeahead-popup.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/typeahead/typeahead-popup.html",'\n"+"")}]);!angular.$$csp()&&angular.element(document).find("head").prepend('');"use strict";var WaveSurfer={defaultParams:{height:128,waveColor:"#999",progressColor:"#555",cursorColor:"#333",cursorWidth:1,skipLength:2,minPxPerSec:20,pixelRatio:window.devicePixelRatio,fillParent:!0,scrollParent:!1,hideScrollbar:!1,normalize:!1,audioContext:null,container:null,dragSelection:!0,loopSelection:!0,audioRate:1,interact:!0,splitChannels:!1,renderer:"Canvas",backend:"WebAudio",mediaType:"audio"},init:function(a){if(this.params=WaveSurfer.util.extend({},this.defaultParams,a),this.container="string"==typeof a.container?document.querySelector(this.params.container):this.params.container,!this.container)throw new Error("Container element not found");if("undefined"==typeof this.params.mediaContainer?this.mediaContainer=this.container:"string"==typeof this.params.mediaContainer?this.mediaContainer=document.querySelector(this.params.mediaContainer):this.mediaContainer=this.params.mediaContainer,!this.mediaContainer)throw new Error("Media Container element not found");this.savedVolume=0,this.isMuted=!1,this.tmpEvents=[],this.createDrawer(),this.createBackend()},createDrawer:function(){var a=this;this.drawer=Object.create(WaveSurfer.Drawer[this.params.renderer]),this.drawer.init(this.container,this.params),this.drawer.on("redraw",function(){a.drawBuffer(),a.drawer.progress(a.backend.getPlayedPercents())}),this.drawer.on("click",function(b,c){setTimeout(function(){a.seekTo(c)},0)}),this.drawer.on("scroll",function(b){a.fireEvent("scroll",b)})},createBackend:function(){var a=this;this.backend&&this.backend.destroy(),"AudioElement"==this.params.backend&&(this.params.backend="MediaElement"),"WebAudio"!=this.params.backend||WaveSurfer.WebAudio.supportsWebAudio()||(this.params.backend="MediaElement"),this.backend=Object.create(WaveSurfer[this.params.backend]),this.backend.init(this.params),this.backend.on("finish",function(){a.fireEvent("finish")}),this.backend.on("play",function(){a.fireEvent("play")}),this.backend.on("pause",function(){a.fireEvent("pause")}),this.backend.on("audioprocess",function(b){a.drawer.progress(a.backend.getPlayedPercents()),a.fireEvent("audioprocess",b)})},getDuration:function(){return this.backend.getDuration()},getCurrentTime:function(){return this.backend.getCurrentTime()},play:function(a,b){this.backend.play(a,b)},pause:function(){this.backend.pause()},playPause:function(){this.backend.isPaused()?this.play():this.pause()},isPlaying:function(){return!this.backend.isPaused()},skipBackward:function(a){this.skip(-a||-this.params.skipLength)},skipForward:function(a){this.skip(a||this.params.skipLength)},skip:function(a){var b=this.getCurrentTime()||0,c=this.getDuration()||1;b=Math.max(0,Math.min(c,b+(a||0))),this.seekAndCenter(b/c)},seekAndCenter:function(a){this.seekTo(a),this.drawer.recenter(a)},seekTo:function(a){var b=this.backend.isPaused(),c=this.params.scrollParent;b&&(this.params.scrollParent=!1),this.backend.seekTo(a*this.getDuration()),this.drawer.progress(this.backend.getPlayedPercents()),b||(this.backend.pause(),this.backend.play()),this.params.scrollParent=c,this.fireEvent("seek",a)},stop:function(){this.pause(),this.seekTo(0),this.drawer.progress(0)},setVolume:function(a){this.backend.setVolume(a)},setPlaybackRate:function(a){this.backend.setPlaybackRate(a)},toggleMute:function(){this.isMuted?(this.backend.setVolume(this.savedVolume),this.isMuted=!1):(this.savedVolume=this.backend.getVolume(),this.backend.setVolume(0),this.isMuted=!0)},toggleScroll:function(){this.params.scrollParent=!this.params.scrollParent,this.drawBuffer()},toggleInteraction:function(){this.params.interact=!this.params.interact},drawBuffer:function(){var a=Math.round(this.getDuration()*this.params.minPxPerSec*this.params.pixelRatio),b=this.drawer.getWidth(),c=a;this.params.fillParent&&(!this.params.scrollParent||b>a)&&(c=b);var d=this.backend.getPeaks(c);this.drawer.drawPeaks(d,c),this.fireEvent("redraw",d,c)},zoom:function(a){this.params.minPxPerSec=a,this.params.scrollParent=!0,this.drawBuffer(),this.seekAndCenter(this.getCurrentTime()/this.getDuration())},loadArrayBuffer:function(a){this.decodeArrayBuffer(a,function(a){this.loadDecodedBuffer(a)}.bind(this))},loadDecodedBuffer:function(a){this.backend.load(a),this.drawBuffer(),this.fireEvent("ready")},loadBlob:function(a){var b=this,c=new FileReader;c.addEventListener("progress",function(a){b.onProgress(a)}),c.addEventListener("load",function(a){b.loadArrayBuffer(a.target.result)}),c.addEventListener("error",function(){b.fireEvent("error","Error reading file")}),c.readAsArrayBuffer(a),this.empty()},load:function(a,b){switch(this.params.backend){case"WebAudio":return this.loadBuffer(a);case"MediaElement":return this.loadMediaElement(a,b)}},loadBuffer:function(a){return this.empty(),this.getArrayBuffer(a,this.loadArrayBuffer.bind(this))},loadMediaElement:function(a,b){this.empty(),this.backend.load(a,this.mediaContainer,b),this.tmpEvents.push(this.backend.once("canplay",function(){this.drawBuffer(),this.fireEvent("ready")}.bind(this)),this.backend.once("error",function(a){this.fireEvent("error",a)}.bind(this))),!b&&this.backend.supportsWebAudio()&&this.getArrayBuffer(a,function(a){this.decodeArrayBuffer(a,function(a){this.backend.buffer=a,this.drawBuffer()}.bind(this))}.bind(this))},decodeArrayBuffer:function(a,b){this.backend.decodeArrayBuffer(a,this.fireEvent.bind(this,"decoded"),this.fireEvent.bind(this,"error","Error decoding audiobuffer")),this.tmpEvents.push(this.once("decoded",b))},getArrayBuffer:function(a,b){var c=this,d=WaveSurfer.util.ajax({url:a,responseType:"arraybuffer"});return this.tmpEvents.push(d.on("progress",function(a){c.onProgress(a)}),d.on("success",b),d.on("error",function(a){c.fireEvent("error","XHR error: "+a.target.statusText)})),d},onProgress:function(a){if(a.lengthComputable)var b=a.loaded/a.total;else b=a.loaded/(a.loaded+1e6);this.fireEvent("loading",Math.round(100*b),a.target)},exportPCM:function(a,b,c){a=a||1024,b=b||1e4,c=c||!1;var d=this.backend.getPeaks(a,b),e=[].map.call(d,function(a){return Math.round(a*b)/b}),f=JSON.stringify(e);return c||window.open("data:application/json;charset=utf-8,"+encodeURIComponent(f)),f},clearTmpEvents:function(){this.tmpEvents.forEach(function(a){a.un()})},empty:function(){this.backend.isPaused()||(this.stop(),this.backend.disconnectSource()),this.clearTmpEvents(),this.drawer.progress(0),this.drawer.setWidth(0),this.drawer.drawPeaks({length:this.drawer.getWidth()},0)},destroy:function(){this.fireEvent("destroy"),this.clearTmpEvents(),this.unAll(),this.backend.destroy(),this.drawer.destroy()}};WaveSurfer.create=function(a){var b=Object.create(WaveSurfer);return b.init(a),b},WaveSurfer.util={extend:function(a){var b=Array.prototype.slice.call(arguments,1);return b.forEach(function(b){Object.keys(b).forEach(function(c){a[c]=b[c]})}),a},getId:function(){return"wavesurfer_"+Math.random().toString(32).substring(2)},ajax:function(a){var b=Object.create(WaveSurfer.Observer),c=new XMLHttpRequest,d=!1;return c.open(a.method||"GET",a.url,!0),c.responseType=a.responseType||"json",c.addEventListener("progress",function(a){b.fireEvent("progress",a),a.lengthComputable&&a.loaded==a.total&&(d=!0)}),c.addEventListener("load",function(a){d||b.fireEvent("progress",a),b.fireEvent("load",a),200==c.status||206==c.status?b.fireEvent("success",c.response,a):b.fireEvent("error",a)}),c.addEventListener("error",function(a){b.fireEvent("error",a)}),c.send(),b.xhr=c,b}},WaveSurfer.Observer={on:function(a,b){this.handlers||(this.handlers={});var c=this.handlers[a];return c||(c=this.handlers[a]=[]),c.push(b),{name:a,callback:b,un:this.un.bind(this,a,b)}},un:function(a,b){if(this.handlers){var c=this.handlers[a];if(c)if(b)for(var d=c.length-1;d>=0;d--)c[d]==b&&c.splice(d,1);else c.length=0}},unAll:function(){this.handlers=null},once:function(a,b){var c=this,d=function(){b.apply(this,arguments),setTimeout(function(){c.un(a,d)},0)};return this.on(a,d)},fireEvent:function(a){if(this.handlers){var b=this.handlers[a],c=Array.prototype.slice.call(arguments,1);b&&b.forEach(function(a){a.apply(null,c)})}}},WaveSurfer.util.extend(WaveSurfer,WaveSurfer.Observer),WaveSurfer.WebAudio={scriptBufferSize:256,PLAYING_STATE:0,PAUSED_STATE:1,FINISHED_STATE:2,supportsWebAudio:function(){return!(!window.AudioContext&&!window.webkitAudioContext)},getAudioContext:function(){return WaveSurfer.WebAudio.audioContext||(WaveSurfer.WebAudio.audioContext=new(window.AudioContext||window.webkitAudioContext)),WaveSurfer.WebAudio.audioContext},getOfflineAudioContext:function(a){return WaveSurfer.WebAudio.offlineAudioContext||(WaveSurfer.WebAudio.offlineAudioContext=new(window.OfflineAudioContext||window.webkitOfflineAudioContext)(1,2,a)),WaveSurfer.WebAudio.offlineAudioContext},init:function(a){this.params=a,this.ac=a.audioContext||this.getAudioContext(),this.lastPlay=this.ac.currentTime,this.startPosition=0,this.scheduledPause=null,this.states=[Object.create(WaveSurfer.WebAudio.state.playing),Object.create(WaveSurfer.WebAudio.state.paused),Object.create(WaveSurfer.WebAudio.state.finished)],this.createVolumeNode(),this.createScriptNode(),this.createAnalyserNode(),this.setState(this.PAUSED_STATE),this.setPlaybackRate(this.params.audioRate)},disconnectFilters:function(){this.filters&&(this.filters.forEach(function(a){a&&a.disconnect()}),this.filters=null,this.analyser.connect(this.gainNode))},setState:function(a){this.state!==this.states[a]&&(this.state=this.states[a],this.state.init.call(this))},setFilter:function(){this.setFilters([].slice.call(arguments))},setFilters:function(a){this.disconnectFilters(),a&&a.length&&(this.filters=a,this.analyser.disconnect(),a.reduce(function(a,b){return a.connect(b),b},this.analyser).connect(this.gainNode))},createScriptNode:function(){this.ac.createScriptProcessor?this.scriptNode=this.ac.createScriptProcessor(this.scriptBufferSize):this.scriptNode=this.ac.createJavaScriptNode(this.scriptBufferSize),this.scriptNode.connect(this.ac.destination)},addOnAudioProcess:function(){var a=this;this.scriptNode.onaudioprocess=function(){var b=a.getCurrentTime();b>=a.getDuration()?(a.setState(a.FINISHED_STATE),a.fireEvent("pause")):b>=a.scheduledPause?(a.setState(a.PAUSED_STATE),a.fireEvent("pause")):a.state===a.states[a.PLAYING_STATE]&&a.fireEvent("audioprocess",b)}},removeOnAudioProcess:function(){this.scriptNode.onaudioprocess=null},createAnalyserNode:function(){this.analyser=this.ac.createAnalyser(),this.analyser.connect(this.gainNode)},createVolumeNode:function(){this.ac.createGain?this.gainNode=this.ac.createGain():this.gainNode=this.ac.createGainNode(),this.gainNode.connect(this.ac.destination)},setVolume:function(a){this.gainNode.gain.value=a},getVolume:function(){return this.gainNode.gain.value},decodeArrayBuffer:function(a,b,c){this.offlineAc||(this.offlineAc=this.getOfflineAudioContext(this.ac?this.ac.sampleRate:44100)),this.offlineAc.decodeAudioData(a,function(a){b(a)}.bind(this),c)},getPeaks:function(a){for(var b=this.buffer.length/a,c=~~(b/10)||1,d=this.buffer.numberOfChannels,e=[],f=[],g=0;d>g;g++)for(var h=e[g]=[],i=this.buffer.getChannelData(g),j=0;a>j;j++){for(var k=~~(j*b),l=~~(k+b),m=i[0],n=i[0],o=k;l>o;o+=c){var p=i[o];p>n&&(n=p),m>p&&(m=p)}h[2*j]=n,h[2*j+1]=m,(0==g||n>f[2*j])&&(f[2*j]=n),(0==g||m=this.getDuration()&&(a=0)),null==b&&(b=this.getDuration()),this.startPosition=a,this.lastPlay=this.ac.currentTime,this.state===this.states[this.FINISHED_STATE]&&this.setState(this.PAUSED_STATE),{start:a,end:b}},getPlayedTime:function(){return(this.ac.currentTime-this.lastPlay)*this.playbackRate},play:function(a,b){this.createSource();var c=this.seekTo(a,b);a=c.start,b=c.end,this.scheduledPause=b,this.source.start(0,a,b-a),this.setState(this.PLAYING_STATE),this.fireEvent("play")},pause:function(){this.scheduledPause=null,this.startPosition+=this.getPlayedTime(),this.source&&this.source.stop(0),this.setState(this.PAUSED_STATE),this.fireEvent("pause")},getCurrentTime:function(){return this.state.getCurrentTime.call(this)},setPlaybackRate:function(a){a=a||1,this.isPaused()?this.playbackRate=a:(this.pause(),this.playbackRate=a,this.play())}},WaveSurfer.WebAudio.state={},WaveSurfer.WebAudio.state.playing={init:function(){this.addOnAudioProcess()},getPlayedPercents:function(){var a=this.getDuration();return this.getCurrentTime()/a||0},getCurrentTime:function(){return this.startPosition+this.getPlayedTime()}},WaveSurfer.WebAudio.state.paused={init:function(){this.removeOnAudioProcess()},getPlayedPercents:function(){var a=this.getDuration();return this.getCurrentTime()/a||0},getCurrentTime:function(){return this.startPosition}},WaveSurfer.WebAudio.state.finished={init:function(){this.removeOnAudioProcess(),this.fireEvent("finish")},getPlayedPercents:function(){return 1},getCurrentTime:function(){return this.getDuration()}},WaveSurfer.util.extend(WaveSurfer.WebAudio,WaveSurfer.Observer),WaveSurfer.MediaElement=Object.create(WaveSurfer.WebAudio),WaveSurfer.util.extend(WaveSurfer.MediaElement,{init:function(a){this.params=a,this.media={currentTime:0,duration:0,paused:!0,playbackRate:1,play:function(){},pause:function(){}},this.mediaType=a.mediaType.toLowerCase(),this.elementPosition=a.elementPosition},load:function(a,b,c){var d=this,e=document.createElement(this.mediaType);e.controls=!1,e.autoplay=!1,e.preload="auto",e.src=a,e.addEventListener("error",function(){d.fireEvent("error","Error loading media element")}),e.addEventListener("canplay",function(){d.fireEvent("canplay")}),e.addEventListener("ended",function(){d.fireEvent("finish")}),e.addEventListener("timeupdate",function(){d.fireEvent("audioprocess",d.getCurrentTime())});var f=b.querySelector(this.mediaType);f&&b.removeChild(f),b.appendChild(e),this.media=e,this.peaks=c,this.onPlayEnd=null,this.buffer=null,this.setPlaybackRate(this.playbackRate)},isPaused:function(){return!this.media||this.media.paused},getDuration:function(){var a=this.media.duration;return a>=1/0&&(a=this.media.seekable.end()),a},getCurrentTime:function(){return this.media&&this.media.currentTime},getPlayedPercents:function(){return this.getCurrentTime()/this.getDuration()||0},setPlaybackRate:function(a){this.playbackRate=a||1,this.media.playbackRate=this.playbackRate},seekTo:function(a){null!=a&&(this.media.currentTime=a),this.clearPlayEnd()},play:function(a,b){this.seekTo(a),this.media.play(),b&&this.setPlayEnd(b),this.fireEvent("play")},pause:function(){this.media&&this.media.pause(),this.clearPlayEnd(),this.fireEvent("pause")},setPlayEnd:function(a){var b=this;this.onPlayEnd=function(c){c>=a&&(b.pause(),b.seekTo(a))},this.on("audioprocess",this.onPlayEnd)},clearPlayEnd:function(){this.onPlayEnd&&(this.un("audioprocess",this.onPlayEnd),this.onPlayEnd=null)},getPeaks:function(a){return this.buffer?WaveSurfer.WebAudio.getPeaks.call(this,a):this.peaks||[]},getVolume:function(){return this.media.volume},setVolume:function(a){this.media.volume=a},destroy:function(){this.pause(),this.unAll(),this.media&&this.media.parentNode&&this.media.parentNode.removeChild(this.media),this.media=null}}),WaveSurfer.AudioElement=WaveSurfer.MediaElement,WaveSurfer.Drawer={init:function(a,b){this.container=a,this.params=b,this.width=0,this.height=b.height*this.params.pixelRatio,this.lastPos=0,this.createWrapper(),this.createElements()},createWrapper:function(){ -this.wrapper=this.container.appendChild(document.createElement("wave")),this.style(this.wrapper,{display:"block",position:"relative",userSelect:"none",webkitUserSelect:"none",height:this.params.height+"px"}),(this.params.fillParent||this.params.scrollParent)&&this.style(this.wrapper,{width:"100%",overflowX:this.params.hideScrollbar?"hidden":"auto",overflowY:"hidden"}),this.setupWrapperEvents()},handleEvent:function(a){a.preventDefault();var b=this.wrapper.getBoundingClientRect();return(a.clientX-b.left+this.wrapper.scrollLeft)/this.wrapper.scrollWidth||0},setupWrapperEvents:function(){var a=this;this.wrapper.addEventListener("click",function(b){var c=a.wrapper.offsetHeight-a.wrapper.clientHeight;if(0!=c){var d=a.wrapper.getBoundingClientRect();if(b.clientY>=d.bottom-c)return}a.params.interact&&a.fireEvent("click",b,a.handleEvent(b))}),this.wrapper.addEventListener("scroll",function(b){a.fireEvent("scroll",b)})},drawPeaks:function(a,b){this.resetScroll(),this.setWidth(b),this.params.barWidth?this.drawBars(a):this.drawWave(a)},style:function(a,b){return Object.keys(b).forEach(function(c){a.style[c]!==b[c]&&(a.style[c]=b[c])}),a},resetScroll:function(){null!==this.wrapper&&(this.wrapper.scrollLeft=0)},recenter:function(a){var b=this.wrapper.scrollWidth*a;this.recenterOnPosition(b,!0)},recenterOnPosition:function(a,b){var c=this.wrapper.scrollLeft,d=~~(this.wrapper.clientWidth/2),e=a-d,f=e-c,g=this.wrapper.scrollWidth-this.wrapper.clientWidth;if(0!=g){if(!b&&f>=-d&&d>f){var h=5;f=Math.max(-h,Math.min(h,f)),e=c+f}e=Math.max(0,Math.min(g,e)),e!=c&&(this.wrapper.scrollLeft=e)}},getWidth:function(){return Math.round(this.container.clientWidth*this.params.pixelRatio)},setWidth:function(a){a!=this.width&&(this.width=a,this.params.fillParent||this.params.scrollParent?this.style(this.wrapper,{width:""}):this.style(this.wrapper,{width:~~(this.width/this.params.pixelRatio)+"px"}),this.updateSize())},setHeight:function(a){a!=this.height&&(this.height=a,this.style(this.wrapper,{height:~~(this.height/this.params.pixelRatio)+"px"}),this.updateSize())},progress:function(a){var b=1/this.params.pixelRatio,c=Math.round(a*this.width)*b;if(c=b){if(this.lastPos=c,this.params.scrollParent){var d=~~(this.wrapper.scrollWidth*a);this.recenterOnPosition(d)}this.updateProgress(a)}},destroy:function(){this.unAll(),this.wrapper&&(this.container.removeChild(this.wrapper),this.wrapper=null)},createElements:function(){},updateSize:function(){},drawWave:function(a,b){},clearWave:function(){},updateProgress:function(a){}},WaveSurfer.util.extend(WaveSurfer.Drawer,WaveSurfer.Observer),WaveSurfer.Drawer.Canvas=Object.create(WaveSurfer.Drawer),WaveSurfer.util.extend(WaveSurfer.Drawer.Canvas,{createElements:function(){var a=this.wrapper.appendChild(this.style(document.createElement("canvas"),{position:"absolute",zIndex:1,left:0,top:0,bottom:0}));if(this.waveCc=a.getContext("2d"),this.progressWave=this.wrapper.appendChild(this.style(document.createElement("wave"),{position:"absolute",zIndex:2,left:0,top:0,bottom:0,overflow:"hidden",width:"0",display:"none",boxSizing:"border-box",borderRightStyle:"solid",borderRightWidth:this.params.cursorWidth+"px",borderRightColor:this.params.cursorColor})),this.params.waveColor!=this.params.progressColor){var b=this.progressWave.appendChild(document.createElement("canvas"));this.progressCc=b.getContext("2d")}},updateSize:function(){var a=Math.round(this.width/this.params.pixelRatio);this.waveCc.canvas.width=this.width,this.waveCc.canvas.height=this.height,this.style(this.waveCc.canvas,{width:a+"px"}),this.style(this.progressWave,{display:"block"}),this.progressCc&&(this.progressCc.canvas.width=this.width,this.progressCc.canvas.height=this.height,this.style(this.progressCc.canvas,{width:a+"px"})),this.clearWave()},clearWave:function(){this.waveCc.clearRect(0,0,this.width,this.height),this.progressCc&&this.progressCc.clearRect(0,0,this.width,this.height)},drawBars:function(a,b){if(a[0]instanceof Array){var c=a;if(this.params.splitChannels)return this.setHeight(c.length*this.params.height*this.params.pixelRatio),void c.forEach(this.drawBars,this);a=c[0]}var d=.5/this.params.pixelRatio,e=this.width,f=this.params.height*this.params.pixelRatio,g=f*b||0,h=f/2,i=~~(a.length/2),j=this.params.barWidth*this.params.pixelRatio,k=Math.max(this.params.pixelRatio,~~(j/2)),l=j+k,m=1;if(this.params.normalize){var n,o;o=Math.max.apply(Math,a),n=Math.min.apply(Math,a),m=o,-n>m&&(m=-n)}var p=i/e;this.waveCc.fillStyle=this.params.waveColor,this.progressCc&&(this.progressCc.fillStyle=this.params.progressColor),[this.waveCc,this.progressCc].forEach(function(b){if(b)if(this.params.reflection)for(var c=0;e>c;c+=l){var f=Math.round(a[2*c*p]/m*h);b.fillRect(c+d,h-f+g,j+d,2*f)}else{for(var c=0;e>c;c+=l){var f=Math.round(a[2*c*p]/m*h);b.fillRect(c+d,h-f+g,j+d,f)}for(var c=0;e>c;c+=l){var f=Math.round(a[2*c*p+1]/m*h);b.fillRect(c+d,h-f+g,j+d,f)}}},this)},drawWave:function(a,b){if(a[0]instanceof Array){var c=a;if(this.params.splitChannels)return this.setHeight(c.length*this.params.height*this.params.pixelRatio),void c.forEach(this.drawWave,this);a=c[0]}var d=.5/this.params.pixelRatio,e=this.params.height*this.params.pixelRatio,f=e*b||0,g=e/2,h=~~(a.length/2),i=1;this.params.fillParent&&this.width!=h&&(i=this.width/h);var j=1;if(this.params.normalize){var k,l;l=Math.max.apply(Math,a),k=Math.min.apply(Math,a),j=l,-k>j&&(j=-k)}this.waveCc.fillStyle=this.params.waveColor,this.progressCc&&(this.progressCc.fillStyle=this.params.progressColor),[this.waveCc,this.progressCc].forEach(function(b){if(b){b.beginPath(),b.moveTo(d,g+f);for(var c=0;h>c;c++){var e=Math.round(a[2*c]/j*g);b.lineTo(c*i+d,g-e+f)}for(var c=h-1;c>=0;c--){var e=Math.round(a[2*c+1]/j*g);b.lineTo(c*i+d,g-e+f)}b.closePath(),b.fill(),b.fillRect(0,g+f-d,this.width,d)}},this)},updateProgress:function(a){var b=Math.round(this.width*a)/this.params.pixelRatio;this.style(this.progressWave,{width:b+"px"})}});"use strict";angular.module("UserUploadModule",["ui.bootstrap"]).directive("onReadFile",function($parse){return{restrict:"A",scope:false,link:function(scope,element,attrs){var fn=$parse(attrs.onReadFile);element.on("change",function(onChangeEvent){var reader=new FileReader;var file=(onChangeEvent.srcElement||onChangeEvent.target).files[0];scope.$apply(function(){fn(scope,{$file:file})})})}}}).controller("UserUploadController",["$scope","$http","$modal","$log","$timeout",function($scope,$http,$modal,$log,$timeout){var listBlobsUrl=$("#listBlobsUrl").data("lingvodoc");$scope.files=[];$scope.upload=function(file){var fd=new FormData;fd.append("blob",file);fd.append("data_type","dialeqt_dictionary");$http.post("/blob",fd,{transformRequest:angular.identity,headers:{"Content-Type":undefined}}).success(function(){loadBlobs()}).error(function(){})};var loadBlobs=function(){$http.get(listBlobsUrl).success(function(data,status,headers,config){$scope.files=data}).error(function(data,status,headers,config){})};loadBlobs()}]); \ No newline at end of file +this.wrapper=this.container.appendChild(document.createElement("wave")),this.style(this.wrapper,{display:"block",position:"relative",userSelect:"none",webkitUserSelect:"none",height:this.params.height+"px"}),(this.params.fillParent||this.params.scrollParent)&&this.style(this.wrapper,{width:"100%",overflowX:this.params.hideScrollbar?"hidden":"auto",overflowY:"hidden"}),this.setupWrapperEvents()},handleEvent:function(a){a.preventDefault();var b=this.wrapper.getBoundingClientRect();return(a.clientX-b.left+this.wrapper.scrollLeft)/this.wrapper.scrollWidth||0},setupWrapperEvents:function(){var a=this;this.wrapper.addEventListener("click",function(b){var c=a.wrapper.offsetHeight-a.wrapper.clientHeight;if(0!=c){var d=a.wrapper.getBoundingClientRect();if(b.clientY>=d.bottom-c)return}a.params.interact&&a.fireEvent("click",b,a.handleEvent(b))}),this.wrapper.addEventListener("scroll",function(b){a.fireEvent("scroll",b)})},drawPeaks:function(a,b){this.resetScroll(),this.setWidth(b),this.params.barWidth?this.drawBars(a):this.drawWave(a)},style:function(a,b){return Object.keys(b).forEach(function(c){a.style[c]!==b[c]&&(a.style[c]=b[c])}),a},resetScroll:function(){null!==this.wrapper&&(this.wrapper.scrollLeft=0)},recenter:function(a){var b=this.wrapper.scrollWidth*a;this.recenterOnPosition(b,!0)},recenterOnPosition:function(a,b){var c=this.wrapper.scrollLeft,d=~~(this.wrapper.clientWidth/2),e=a-d,f=e-c,g=this.wrapper.scrollWidth-this.wrapper.clientWidth;if(0!=g){if(!b&&f>=-d&&d>f){var h=5;f=Math.max(-h,Math.min(h,f)),e=c+f}e=Math.max(0,Math.min(g,e)),e!=c&&(this.wrapper.scrollLeft=e)}},getWidth:function(){return Math.round(this.container.clientWidth*this.params.pixelRatio)},setWidth:function(a){a!=this.width&&(this.width=a,this.params.fillParent||this.params.scrollParent?this.style(this.wrapper,{width:""}):this.style(this.wrapper,{width:~~(this.width/this.params.pixelRatio)+"px"}),this.updateSize())},setHeight:function(a){a!=this.height&&(this.height=a,this.style(this.wrapper,{height:~~(this.height/this.params.pixelRatio)+"px"}),this.updateSize())},progress:function(a){var b=1/this.params.pixelRatio,c=Math.round(a*this.width)*b;if(c=b){if(this.lastPos=c,this.params.scrollParent){var d=~~(this.wrapper.scrollWidth*a);this.recenterOnPosition(d)}this.updateProgress(a)}},destroy:function(){this.unAll(),this.wrapper&&(this.container.removeChild(this.wrapper),this.wrapper=null)},createElements:function(){},updateSize:function(){},drawWave:function(a,b){},clearWave:function(){},updateProgress:function(a){}},WaveSurfer.util.extend(WaveSurfer.Drawer,WaveSurfer.Observer),WaveSurfer.Drawer.Canvas=Object.create(WaveSurfer.Drawer),WaveSurfer.util.extend(WaveSurfer.Drawer.Canvas,{createElements:function(){var a=this.wrapper.appendChild(this.style(document.createElement("canvas"),{position:"absolute",zIndex:1,left:0,top:0,bottom:0}));if(this.waveCc=a.getContext("2d"),this.progressWave=this.wrapper.appendChild(this.style(document.createElement("wave"),{position:"absolute",zIndex:2,left:0,top:0,bottom:0,overflow:"hidden",width:"0",display:"none",boxSizing:"border-box",borderRightStyle:"solid",borderRightWidth:this.params.cursorWidth+"px",borderRightColor:this.params.cursorColor})),this.params.waveColor!=this.params.progressColor){var b=this.progressWave.appendChild(document.createElement("canvas"));this.progressCc=b.getContext("2d")}},updateSize:function(){var a=Math.round(this.width/this.params.pixelRatio);this.waveCc.canvas.width=this.width,this.waveCc.canvas.height=this.height,this.style(this.waveCc.canvas,{width:a+"px"}),this.style(this.progressWave,{display:"block"}),this.progressCc&&(this.progressCc.canvas.width=this.width,this.progressCc.canvas.height=this.height,this.style(this.progressCc.canvas,{width:a+"px"})),this.clearWave()},clearWave:function(){this.waveCc.clearRect(0,0,this.width,this.height),this.progressCc&&this.progressCc.clearRect(0,0,this.width,this.height)},drawBars:function(a,b){if(a[0]instanceof Array){var c=a;if(this.params.splitChannels)return this.setHeight(c.length*this.params.height*this.params.pixelRatio),void c.forEach(this.drawBars,this);a=c[0]}var d=.5/this.params.pixelRatio,e=this.width,f=this.params.height*this.params.pixelRatio,g=f*b||0,h=f/2,i=~~(a.length/2),j=this.params.barWidth*this.params.pixelRatio,k=Math.max(this.params.pixelRatio,~~(j/2)),l=j+k,m=1;if(this.params.normalize){var n,o;o=Math.max.apply(Math,a),n=Math.min.apply(Math,a),m=o,-n>m&&(m=-n)}var p=i/e;this.waveCc.fillStyle=this.params.waveColor,this.progressCc&&(this.progressCc.fillStyle=this.params.progressColor),[this.waveCc,this.progressCc].forEach(function(b){if(b)if(this.params.reflection)for(var c=0;e>c;c+=l){var f=Math.round(a[2*c*p]/m*h);b.fillRect(c+d,h-f+g,j+d,2*f)}else{for(var c=0;e>c;c+=l){var f=Math.round(a[2*c*p]/m*h);b.fillRect(c+d,h-f+g,j+d,f)}for(var c=0;e>c;c+=l){var f=Math.round(a[2*c*p+1]/m*h);b.fillRect(c+d,h-f+g,j+d,f)}}},this)},drawWave:function(a,b){if(a[0]instanceof Array){var c=a;if(this.params.splitChannels)return this.setHeight(c.length*this.params.height*this.params.pixelRatio),void c.forEach(this.drawWave,this);a=c[0]}var d=.5/this.params.pixelRatio,e=this.params.height*this.params.pixelRatio,f=e*b||0,g=e/2,h=~~(a.length/2),i=1;this.params.fillParent&&this.width!=h&&(i=this.width/h);var j=1;if(this.params.normalize){var k,l;l=Math.max.apply(Math,a),k=Math.min.apply(Math,a),j=l,-k>j&&(j=-k)}this.waveCc.fillStyle=this.params.waveColor,this.progressCc&&(this.progressCc.fillStyle=this.params.progressColor),[this.waveCc,this.progressCc].forEach(function(b){if(b){b.beginPath(),b.moveTo(d,g+f);for(var c=0;h>c;c++){var e=Math.round(a[2*c]/j*g);b.lineTo(c*i+d,g-e+f)}for(var c=h-1;c>=0;c--){var e=Math.round(a[2*c+1]/j*g);b.lineTo(c*i+d,g-e+f)}b.closePath(),b.fill(),b.fillRect(0,g+f-d,this.width,d)}},this)},updateProgress:function(a){var b=Math.round(this.width*a)/this.params.pixelRatio;this.style(this.progressWave,{width:b+"px"})}});(function(){"use strict";angular.module("angular-loading-bar",["cfp.loadingBarInterceptor"]);angular.module("chieffancypants.loadingBar",["cfp.loadingBarInterceptor"]);angular.module("cfp.loadingBarInterceptor",["cfp.loadingBar"]).config(["$httpProvider",function($httpProvider){var interceptor=["$q","$cacheFactory","$timeout","$rootScope","$log","cfpLoadingBar",function($q,$cacheFactory,$timeout,$rootScope,$log,cfpLoadingBar){var reqsTotal=0;var reqsCompleted=0;var latencyThreshold=cfpLoadingBar.latencyThreshold;var startTimeout;function setComplete(){$timeout.cancel(startTimeout);cfpLoadingBar.complete();reqsCompleted=0;reqsTotal=0}function isCached(config){var cache;var defaultCache=$cacheFactory.get("$http");var defaults=$httpProvider.defaults;if((config.cache||defaults.cache)&&config.cache!==false&&(config.method==="GET"||config.method==="JSONP")){cache=angular.isObject(config.cache)?config.cache:angular.isObject(defaults.cache)?defaults.cache:defaultCache}var cached=cache!==undefined?cache.get(config.url)!==undefined:false;if(config.cached!==undefined&&cached!==config.cached){return config.cached}config.cached=cached;return cached}return{request:function(config){if(!config.ignoreLoadingBar&&!isCached(config)){$rootScope.$broadcast("cfpLoadingBar:loading",{url:config.url});if(reqsTotal===0){startTimeout=$timeout(function(){cfpLoadingBar.start()},latencyThreshold)}reqsTotal++;cfpLoadingBar.set(reqsCompleted/reqsTotal)}return config},response:function(response){if(!response||!response.config){$log.error("Broken interceptor detected: Config object not supplied in response:\n https://github.com/chieffancypants/angular-loading-bar/pull/50");return response}if(!response.config.ignoreLoadingBar&&!isCached(response.config)){reqsCompleted++;$rootScope.$broadcast("cfpLoadingBar:loaded",{url:response.config.url,result:response});if(reqsCompleted>=reqsTotal){setComplete()}else{cfpLoadingBar.set(reqsCompleted/reqsTotal)}}return response},responseError:function(rejection){if(!rejection||!rejection.config){$log.error("Broken interceptor detected: Config object not supplied in rejection:\n https://github.com/chieffancypants/angular-loading-bar/pull/50");return $q.reject(rejection)}if(!rejection.config.ignoreLoadingBar&&!isCached(rejection.config)){reqsCompleted++;$rootScope.$broadcast("cfpLoadingBar:loaded",{url:rejection.config.url,result:rejection});if(reqsCompleted>=reqsTotal){setComplete()}else{cfpLoadingBar.set(reqsCompleted/reqsTotal)}}return $q.reject(rejection)}}}];$httpProvider.interceptors.push(interceptor)}]);angular.module("cfp.loadingBar",[]).provider("cfpLoadingBar",function(){this.autoIncrement=true;this.includeSpinner=true;this.includeBar=true;this.latencyThreshold=100;this.startSize=.02;this.parentSelector="body";this.spinnerTemplate='
            ';this.loadingBarTemplate='
            ';this.$get=["$injector","$document","$timeout","$rootScope",function($injector,$document,$timeout,$rootScope){var $animate;var $parentSelector=this.parentSelector,loadingBarContainer=angular.element(this.loadingBarTemplate),loadingBar=loadingBarContainer.find("div").eq(0),spinner=angular.element(this.spinnerTemplate);var incTimeout,completeTimeout,started=false,status=0;var autoIncrement=this.autoIncrement;var includeSpinner=this.includeSpinner;var includeBar=this.includeBar;var startSize=this.startSize;function _start(){if(!$animate){$animate=$injector.get("$animate")}var $parent=$document.find($parentSelector).eq(0);$timeout.cancel(completeTimeout);if(started){return}$rootScope.$broadcast("cfpLoadingBar:started");started=true;if(includeBar){$animate.enter(loadingBarContainer,$parent,angular.element($parent[0].lastChild))}if(includeSpinner){$animate.enter(spinner,$parent,angular.element($parent[0].lastChild))}_set(startSize)}function _set(n){if(!started){return}var pct=n*100+"%";loadingBar.css("width",pct);status=n;if(autoIncrement){$timeout.cancel(incTimeout);incTimeout=$timeout(function(){_inc()},250)}}function _inc(){if(_status()>=1){return}var rnd=0;var stat=_status();if(stat>=0&&stat<.25){rnd=(Math.random()*(5-3+1)+3)/100}else if(stat>=.25&&stat<.65){rnd=Math.random()*3/100}else if(stat>=.65&&stat<.9){rnd=Math.random()*2/100}else if(stat>=.9&&stat<.99){rnd=.005}else{rnd=0}var pct=_status()+rnd;_set(pct)}function _status(){return status}function _completeAnimation(){status=0;started=false}function _complete(){if(!$animate){$animate=$injector.get("$animate")}$rootScope.$broadcast("cfpLoadingBar:completed");_set(1);$timeout.cancel(completeTimeout);completeTimeout=$timeout(function(){var promise=$animate.leave(loadingBarContainer,_completeAnimation);if(promise&&promise.then){promise.then(_completeAnimation)}$animate.leave(spinner)},500)}return{start:_start,set:_set,status:_status,inc:_inc,complete:_complete,autoIncrement:this.autoIncrement,includeSpinner:this.includeSpinner,latencyThreshold:this.latencyThreshold,parentSelector:this.parentSelector,startSize:this.startSize}}]})})();"use strict";angular.module("UserUploadModule",["ui.bootstrap"]).directive("onReadFile",function($parse){return{restrict:"A",scope:false,link:function(scope,element,attrs){var fn=$parse(attrs.onReadFile);element.on("change",function(onChangeEvent){var reader=new FileReader;var file=(onChangeEvent.srcElement||onChangeEvent.target).files[0];scope.$apply(function(){fn(scope,{$file:file})})})}}}).controller("UserUploadController",["$scope","$http","$modal","$log","$timeout",function($scope,$http,$modal,$log,$timeout){var listBlobsUrl=$("#listBlobsUrl").data("lingvodoc");$scope.files=[];$scope.upload=function(file){var fd=new FormData;fd.append("blob",file);fd.append("data_type","dialeqt_dictionary");$http.post("/blob",fd,{transformRequest:angular.identity,headers:{"Content-Type":undefined}}).success(function(){loadBlobs();window.location="/create_dictionary"}).error(function(){})};var loadBlobs=function(){$http.get(listBlobsUrl).success(function(data,status,headers,config){$scope.files=data}).error(function(data,status,headers,config){})};loadBlobs()}]); \ No newline at end of file diff --git a/lingvodoc/templates/create_dictionary.pt b/lingvodoc/templates/create_dictionary.pt index af05ed776..cb8c9728d 100644 --- a/lingvodoc/templates/create_dictionary.pt +++ b/lingvodoc/templates/create_dictionary.pt @@ -118,7 +118,7 @@
            - + (Upload dictionary) @@ -188,7 +188,7 @@ -