-
Notifications
You must be signed in to change notification settings - Fork 14
/
fortune-admin.min.js
1 lines (1 loc) · 124 KB
/
fortune-admin.min.js
1
angular.module("templates-main",["/dist/views/directives/attribute.html","/dist/views/directives/description.html","/dist/views/directives/example.html","/dist/views/directives/gui.html","/dist/views/directives/requestResponse.html","/dist/views/directives/response.html","/dist/views/docs.html","/dist/views/directives/faActionCell.html","/dist/views/directives/faActionColumnHeader.html","/dist/views/directives/faActions.html","/dist/views/directives/faAlert.html","/dist/views/directives/faBulkActions.html","/dist/views/directives/faDeleteConfirm.html","/dist/views/directives/faDetails.html","/dist/views/directives/faEditable.html","/dist/views/directives/faGrid.html","/dist/views/directives/faUiGrid.html","/dist/views/directives/uml/canvas.html","/dist/views/resources.html","/dist/views/uml.html","/dist/views/docsCells.html","/dist/views/mynavbar.html","/dist/views/resourcesCells.html","/dist/views/umlCells.html"]),angular.module("/dist/views/directives/attribute.html",[]).run(["$templateCache",function(a){a.put("/dist/views/directives/attribute.html",'<div>\n \x3c!-- string --\x3e\n <div ng-if="value.type == \'String\'">\n <input type="text" ng-model="data[name]" class="form-control" />\n </div>\n\n \x3c!-- date --\x3e\n <div ng-if="value.type == \'Date\' || value == \'Date\'">\n <input type="date" class="form-control" ng-model="data[name]" />\n </div>\n\n \x3c!-- link to another resource --\x3e\n <div ng-if="value.ref">\n link to {{value.ref}}\n </div>\n\n \x3c!-- array of links to another resources --\x3e\n <div ng-if="value[0].ref">\n array of links to {{value[0].ref}}\n </div>\n</div>')}]),angular.module("/dist/views/directives/description.html",[]).run(["$templateCache",function(a){a.put("/dist/views/directives/description.html",'<div class="resource-description">\n <h4><strong>The {{resource.name}} object</strong></h4>\n <h5><strong>Attributes</strong></h5>\n <table>\n <tr ng-repeat="attrName in resource.schema | notSorted" ng-init="attrValue = resource.schema[attrName]">\n <td><strong>{{attrName}}:</strong></td>\n <td>\n {{attrValue.type || attrValue}}\n <p ng-if="attrValue[\'docs:description\']">\n {{attrValue[\'docs:description\']}}\n </p>\n </td>\n </tr>\n </table>\n</div>')}]),angular.module("/dist/views/directives/example.html",[]).run(["$templateCache",function(a){a.put("/dist/views/directives/example.html",'<div class="resource-example">\n <h4>{{ resource.name+\' object example\' | uppercase }}</h4>\n <span>\n {<br/>\n <span ng-repeat="attrName in resource.schema | notSorted" ng-init="attrValue = resource.schema[attrName]">\n   \n <span>"{{attrName}}":</span>\n <span>"{{attrValue[\'docs:example\']}}"</span>\n <span ng-if="!$last">,<br/></span>\n </span>\n <br/>}\n </span>\n</div>')}]),angular.module("/dist/views/directives/gui.html",[]).run(["$templateCache",function(a){a.put("/dist/views/directives/gui.html",'<div class="resource-giu">\n <h4><strong>/{{resource.name}}:</strong> Operations about {{resource.name}} </h4>\n\n \x3c!-- Methods menu --\x3e\n <div class="btn-group">\n <button type="button" class="btn btn-default" ng-repeat="httpMethod in httpMethods"\n ng-class="{\'active\':selectedMethod == httpMethod}"\n ng-click="selectMethod(httpMethod)">\n {{httpMethod | uppercase }}\n </button>\n </div>\n\n <request-response-container resource="resource" method="selectedMethod"></request-response-container>\n</div>')}]),angular.module("/dist/views/directives/requestResponse.html",[]).run(["$templateCache",function(a){a.put("/dist/views/directives/requestResponse.html",'<div class="request col-md-12">\n <h3>Request</h3>\n <div ng-if="method == \'get\'">\n <table class="table" ng-if="ids.length !== 0">\n <tr>\n <td>Parameter</td>\n <td>Value</td>\n <td>Actions</td>\n </tr>\n <tr ng-repeat="id in ids">\n <td>{{PK}}</td>\n <td>{{id}}</td>\n <td>\n <a href ng-click="removeRequestParameter(id)"><span class="glyphicon glyphicon-remove"></span></a>\n </td>\n </tr>\n </table>\n <table class="table">\n <tr>\n <td>{{PK}}</td>\n <td><input type="text" class="form-control" ng-model="id"/></td>\n <td><button type="button" ng-click="addRequestParameter(id)" class="btn btn-default btn-sm">Add {{resource.name}}</button></td>\n </tr>\n <tr ng-if="ids.length == 1">\n <td>Related resource name (one level deep):</td>\n <td><input type="text" class="form-control" ng-model="relatedResource.name"/><td>\n <td></td>\n </tr>\n </table>\n <button type="button" ng-click="sendGETRequest(resource, ids, relatedResource.name)" class="btn btn-default btn-primary">Send request</button>\n </div>\n\n <div ng-if="method == \'post\'" ng-init="data={}">\n <table class="table">\n <tr ng-repeat="attrName in resource.schema | notSorted">\n <td>{{attrName}} <span ng-if="PK == attrName">(primary key)</span></td>\n <td>\n <resource-attribute name="attrName" value="resource.schema[attrName]"></resource-attribute>\n </td>\n </tr>\n </table>\n <button type="button" ng-click="sendPOSTRequest(resource, data)" class="btn btn-default btn-primary">Send request</button>\n </div>\n\n <div ng-if="method == \'delete\'">\n <table class="table">\n <tr>\n <td>{{PK}}</td>\n <td><input type="text" class="form-control" ng-model="id"/></td>\n </tr>\n </table>\n <button type="button" ng-click="sendDELETERequest(resource, id)" class="btn btn-default btn-primary">Send request</button>\n </div>\n\n <response ng-if="response[resource.name][method]" response="response[resource.name][method]"></response>\n</div>')}]),angular.module("/dist/views/directives/response.html",[]).run(["$templateCache",function(a){a.put("/dist/views/directives/response.html",'<div class="response">\n <h3>Response</h3>\n <table class="table">\n <tr>\n <td>Status</td>\n <td>{{response.status}}</td>\n </tr>\n <tr>\n <td>Body</td>\n <td><pre>{{response.body | json}}</pre></td>\n </tr>\n </table>\n</div>')}]),angular.module("/dist/views/docs.html",[]).run(["$templateCache",function(a){a.put("/dist/views/docs.html",'<section id="fortune-admin" ng-class="{wmargin: navbarEnabled}">\n <div ng-if="navbarEnabled">\n <fortune-admin-navbar></fortune-admin-navbar>\n </div>\n <div id="guide" ng-if="resources.length !== 0" ng-class="{ \'stick\': selected !== undefined }">\n <div>\n <div class="list-group">\n <a href class="list-group-item" ng-class="itemClass(resource.name)" ng-repeat="resource in resources"\n ng-click="select(resource.name)">\n {{ resource.name }}\n </a>\n </div>\n </div>\n </div>\n <div id="api-docs" ng-init="selectedMode = \'example\'">\n <ul class="nav nav-tabs" role="tablist">\n <li ng-class="{ \'active\': selectedMode == \'example\' }" ng-click="selectedMode=\'example\'">\n <a href="#">Example</a>\n </li>\n <li ng-class="{ \'active\': selectedMode == \'interaction\' }" ng-click="selectedMode=\'interaction\'">\n <a href="#">Interaction</a>\n </li>\n </ul>\n <div class="tab-content" ng-if="selectedMode == \'example\'">\n <div class="single-resource" id="{{resource.name}}" ng-repeat="resource in resources">\n <resource-description resource="resource"></resource-description>\n <resource-example resource="resource"></resource-example>\n </div>\n </div>\n <div class="tab-content" ng-if="selectedMode == \'interaction\'">\n <div class="single-resource" id="{{resource.name}}" ng-repeat="resource in resources">\n <resource-gui resource="resource"></resource-gui>\n </div>\n </div>\n </div>\n</section>')}]),angular.module("/dist/views/directives/faActionCell.html",[]).run(["$templateCache",function(a){a.put("/dist/views/directives/faActionCell.html",'<div ng-show="!empty" >\n <input type="checkbox" class="fa-ui-grid-checkbox-action" ng-model="item.action_checked">\n</div>')}]),angular.module("/dist/views/directives/faActionColumnHeader.html",[]).run(["$templateCache",function(a){a.put("/dist/views/directives/faActionColumnHeader.html",'<div>\n <div ng-show="enabled" >\n <div>\n <div class="fa-ui-grid-action-icon fa-ui-grid-action-icon-active" ng-class="{\'fa-ui-grid-action-icon-open\': popupIsOpen}"\n id="action-show-link-{{name}}" ng-click="showMenu($event)">\n </div>\n </div>\n <ul class="dropdown-menu" role="menu" ng-style="popupPosition">\n <li ng-repeat="action in actions">\n <a ng-click="actionClick(action)">{{action.title}}</a>\n </li>\n </ul>\n </div>\n\n <div ng-show="!enabled">\n <div class="fa-ui-grid-action-icon">\n </div>\n </div>\n</div>\n')}]),angular.module("/dist/views/directives/faActions.html",[]).run(["$templateCache",function(a){a.put("/dist/views/directives/faActions.html",'<div class="btn-group" dropdown>\n <button ng-if="!options.noBulk" type="button" class="btn" ng-class="{\'btn-success\': isSelected(model), \'btn-default\': !isSelected(model)}" ng-click="toggleSelection(model)">\n <span class="glyphicon glyphicon-unchecked" ng-hide="isSelected(model)"></span>\n <span class="glyphicon glyphicon-ok" ng-show="isSelected(model)"></span>\n </button>\n <button type="button" class="btn btn-danger dropdown-toggle" ng-click="setClickCoords($event, model, data)" dropdown-toggle data-toggle="dropdown" aria-expanded="false">\n <span class="caret"></span>\n <span class="sr-only">Toggle Dropdown</span>\n </button>\n <ul class="dropdown-menu" role="menu" ng-style="popupPosition">\n <li ng-repeat="action in actions | singleActions" ng-class="tempCls = action.getCss(model, data)">\n <a ng-click="tempCls !== \'disabled\' && applySingleAction(actions[action.name], model, data) " >{{action.title || action.name}}</a>\n </li>\n </ul>\n</div>\n\n')}]),angular.module("/dist/views/directives/faAlert.html",[]).run(["$templateCache",function(a){a.put("/dist/views/directives/faAlert.html",'<div class="modal-body" style="text-align:center;">\n <button class="close pull-right" type="button" aria-label="Close" ng-click="close()">\n <span aria-hidden="true">×</span>\n </button>\n <h1>\n {{message.text}}\n </h1>\n <br />\n <br />\n <div>\n <button class="btn btn-primary btn-lg" ng-click="close()">Ok</button>\n <div>\n</div>\n\n')}]),angular.module("/dist/views/directives/faBulkActions.html",[]).run(["$templateCache",function(a){a.put("/dist/views/directives/faBulkActions.html",'<select class="selectpicker" ng-model="actionToRun" ng-options="action as action.title for action in actions | bulkActions">\n <option value="">- {{options.bulkPlaceholder || \'Nothing selected\'}} -</option>\n</select>\n<span class="btn btn-default" ng-disabled="!actionToRun || getSelected().length === 0" ng-click="applyBulkAction(actionToRun, data)">Apply bulk action to selected items</span>\n')}]),angular.module("/dist/views/directives/faDeleteConfirm.html",[]).run(["$templateCache",function(a){a.put("/dist/views/directives/faDeleteConfirm.html",'<div class="modal-body" style="text-align:center;">\n <button class="close pull-right" type="button" aria-label="Close" ng-click="close()">\n <span aria-hidden="true">×</span>\n </button>\n <h1>\n Are you sure you want to delete the ...?\n </h1>\n The operation cannot be undone.\n <br/>\n <br/>\n <div>\n <button class="btn btn-danger btn-lg" ng-click="confirm()">Delete</button>\n <button class="btn btn-default btn-lg" ng-click="close()">Cancel</button>\n <div>\n</div>\n\n')}]),angular.module("/dist/views/directives/faDetails.html",[]).run(["$templateCache",function(a){a.put("/dist/views/directives/faDetails.html",'<div class="modal-body">\n <button class="close pull-right" type="button" aria-label="Close" ng-click="close()">\n <span aria-hidden="true">×</span>\n </button>\n <h1>\n Details\n </h1>\n <pre class="form-control-static">{{model | json}}</pre>\n <div style="text-align : right; margin-top : 10px">\n <button class="btn btn-primary btn-lg" ng-click="close()">Ok</button>\n <div>\n</div>\n\n')}]),angular.module("/dist/views/directives/faEditable.html",[]).run(["$templateCache",function(a){a.put("/dist/views/directives/faEditable.html",'<section>\n <div ng-switch="schemaType">\n <div ng-switch-when="String">\n <a href="#" onaftersave="apply(value)" editable-text="value">{{value || \'Not set.\'}}</a>\n </div>\n <div ng-switch-when="Number">\n <a href="#" onaftersave="apply(value)" editable-number="value">{{value || \'Not set.\'}}</a>\n </div>\n <div ng-switch-when="Date">\n <a href="#" onaftersave="apply(value)" editable-date="value">{{value || \'Not set.\'}}</a>\n </div>\n <div ng-switch-when="Boolean">\n <a href="#" onaftersave="apply(value)" editable-checkbox="value">{{value ? \'Yep\' : \'Nope\'}}</a>\n </div>\n </div>\n</section>')}]),angular.module("/dist/views/directives/faGrid.html",[]).run(["$templateCache",function(a){a.put("/dist/views/directives/faGrid.html",'<div class="fa-grid">\n <table class="table table-bordered">\n <tr>\n <th>\n <div ng-class="{\'column-filter\': _showFilter}">\n <span>ID</span>\n <div ng-show="_showFilter">\n <input type="text" class="form-control" ng-model="idQuery" typeahead="item.id for item in getTypeaheadList({str: $viewValue, name: \'id\', type: type})" typeahead-on-select="applyFilter({item: $item, model: $model, label: $label}, name, type)">\n </div>\n <span class="glyphicon glyphicon-filter" ng-show="!_showFilter" ng-click="_showFilter = !_showFilter"></span>\n <span class="glyphicon glyphicon-remove" ng-show="_showFilter" ng-click="_showFilter = false; idQuery=\'\'; dropFilter(name, idQuery)"></span>\n </div>\n </th>\n <th ng-repeat="(name, type) in currentResource.schema | filterFields:fields" ng-class="{\'column-filter\': showFilter}" ng-init="type = type.type || type">\n <div>\n <span>{{name}}</span>\n <span class="glyphicon glyphicon-filter" ng-show="!showFilter" ng-click="showFilter = !showFilter"></span>\n <span class="glyphicon glyphicon-remove" ng-show="showFilter" ng-click="showFilter = false; taQuery=\'\'; dropFilter(name, taQuery)"></span>\n </div>\n <div ng-switch="type">\n <div ng-switch-when="String" ng-show="showFilter">\n <input type="text" class="form-control" ng-model="taQuery" typeahead="item.{{name}} for item in getTypeaheadList({str: $viewValue, name: name, type: type})" typeahead-on-select="applyFilter({item: $item, model: $model, label: $label}, name, type)">\n </div>\n <div ng-switch-when="Number" ng-show="showFilter">\n <div class="input-group">\n <span class="input-group-addon">From:</span>\n <input type="number" ng-model="Query.start" class="form-control" ng-change="applyFilter(Query, name, type)"/>\n </div>\n <div class="input-group">\n <span class="input-group-addon">To:</span>\n <input class="form-control" type="number" ng-model="Query.end" ng-change="applyFilter(Query, name, type)"/>\n </div>\n </div>\n <div ng-switch-when="Date" ng-show="showFilter">\n <div class="input-group">\n <span class="input-group-addon">From:</span>\n <input type="date" class="form-control" ng-model="Query.start" ng-change="applyFilter(Query, name, type)"/>\n </div>\n <div class="input-group">\n <span class="input-group-addon">To:</span>\n <input type="date" class="form-control" ng-model="Query.end" ng-change="applyFilter(Query, name, type)"/>\n </div>\n </div>\n <div ng-switch-when="Boolean" ng-show="showFilter">\n <div class="btn-group btn-group-sm">\n <button class="btn btn-sm" ng-class="{\'btn-default\': !Query.yep, \'btn-info\': Query.yep}" type="button" ng-click="Query.yep = true; Query.nope=false; applyFilter(true, name, type);">Yep</button>\n <button class="btn btn-sm" ng-class="{\'btn-default\': !Query.nope, \'btn-info\': Query.nope}" type="button" ng-click="Query.yep = false; Query.nope=true; applyFilter(false, name, type);">Nope</button>\n </div>\n </div>\n </div>\n </th>\n <th ng-repeat="(linkName, link) in links">{{resolveFieldName(linkName)}}</th>\n <th>Actions</th>\n </tr>\n <tr ng-repeat="entity in data" ng-hide="entity.deleted">\n <td>{{entity.id}}</td>\n <td ng-repeat="(path, type) in currentResource.schema | filterFields:fields" ng-init="type = type.type || type">\n <fa-editable ng-model="entity[path]" path="path" resource-name="{{currentResource.route}}" resource-id="{{entity.id}}" schema-type="type"></fa-editable>\n </td>\n <td ng-repeat="(linkName, link) in links">\n <div ng-if="linkToMany(linkName)">\n <a ng-href="{{ getSubresourceRoute(\'subresource\', {parent: currentResource.route, id: entity.id, name: link.type, inverse: resolveInverse(linkName)}) }}">Navigate to {{link.type}}</a>\n </div>\n <div ng-if="!linkToMany(linkName)">\n <div ng-init="fname = resolveFieldName(linkName)"></div>\n \x3c!--Initialize links if they do not come from server--\x3e\n <div ng-init="entity.links = entity.links || {}"></div>\n <fa-ref ng-model="entity.links[fname]" ref="currentResource.schema[fname]" resource-name="{{currentResource.route}}" resource-id="{{ entity.id }}"></fa-ref>\n </div>\n </td>\n <td>\n <fa-actions ng-model="entity" data="data" collection-name="currentResource.route"></fa-actions>\n </td>\n </tr>\n</table>\n</div>\n')}]),angular.module("/dist/views/directives/faUiGrid.html",[]).run(["$templateCache",function(a){a.put("/dist/views/directives/faUiGrid.html",'<section>\n <div ng-if="!fvOptions.noBulk && fvOptions.bulkPosition === \'top\'">\n <div class="row bulk-actions">\n <span ng-transclude="additionalInteractionControls"></span>\n <fa-bulk-actions collection-name="currentResource.route" options=\'fvOptions.actions\' data="data"></fa-bulk-actions>\n </div>\n </div>\n <div class="fa-ui-grid" ui-grid="gridOptions" ui-grid-edit></div>\n <div ng-if="!fvOptions.noBulk && fvOptions.bulkPosition !== \'top\'">\n <div class="row bulk-actions">\n <span ng-transclude="additionalInteractionControls"></span>\n <fa-bulk-actions collection-name="currentResource.route" options=\'fvOptions.actions\' data="data"></fa-bulk-actions>\n </div>\n </div>\n</section>\n')}]),angular.module("/dist/views/directives/uml/canvas.html",[]).run(["$templateCache",function(a){a.put("/dist/views/directives/uml/canvas.html",'<div id="umlcanvas">\n</div>')}]),angular.module("/dist/views/resources.html",[]).run(["$templateCache",function(a){a.put("/dist/views/resources.html",'<section id="fortune-admin" ng-class="{wmargin: navbarEnabled}">\n <div ng-if="navbarEnabled">\n <fortune-admin-navbar></fortune-admin-navbar>\n </div>\n <h4 class="text-center">{{ parentResourceName | uppercase }} {{ parentId ? parentId + \' /\' : null}} {{plurResourceName | uppercase}}</h4>\n <fa-grid data="data" links="links" resources="resources" current-resource="currentResource" filter="filter" filter-changed-cb="ResourcesCtrl.filterChangedCb()" get-typeahead-list="getTypeaheadList(str, name, type)" strict-filters="strictFilters"></fa-grid>\n <div class="col-md-3">\n <div ng-hide="PK === \'id\'">\n <label>Enter {{ PK }} for new {{ currentResource.name }}</label>\n <input type="text" ng-model="PrimaryKey" ng-required="true" class="form-control"/>\n </div>\n <button type="button" ng-click="ResourcesCtrl.addRow(PrimaryKey)" class="btn btn-default btn-sm" ng-disabled="PK !== \'id\' && !PrimaryKey">Create new row</button>\n </div>\n</section>\n')}]),angular.module("/dist/views/uml.html",[]).run(["$templateCache",function(a){a.put("/dist/views/uml.html",'<section id="fortune-admin" ng-class="{wmargin: navbarEnabled}">\n <div ng-if="navbarEnabled">\n <fortune-admin-navbar></fortune-admin-navbar>\n </div>\n <section ng-if="resources.length !== 0">\n <div ng-if="render">\n <div resources-canvas resources="resources"></div>\n </div>\n </section>\n</section>')}]),angular.module("/dist/views/docsCells.html",[]).run(["$templateCache",function(a){a.put("/dist/views/docsCells.html","<li><a data-ng-href=\"{{ r('docs_page') }}\">Docs</a></li>")}]),angular.module("/dist/views/mynavbar.html",[]).run(["$templateCache",function(a){a.put("/dist/views/mynavbar.html",'<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation" bs-navbar>\n <div class="container-fluid">\n <div class="navbar-header">\n <a class="navbar-brand" href="#"><b>Fortune Admin</b></a>\n </div>\n <div class="collapse navbar-collapse">\n <ul class="nav navbar-nav">\n <fortune-admin-resources-cells></fortune-admin-resources-cells>\n <fortune-admin-uml-cells></fortune-admin-uml-cells>\n <fortune-admin-docs-cells></fortune-admin-docs-cells>\n </ul>\n </div>\n </div>\n</nav>\n\n')}]),angular.module("/dist/views/resourcesCells.html",[]).run(["$templateCache",function(a){a.put("/dist/views/resourcesCells.html",'<li class="dropdown" dropdown>\n <a href="#" class="dropdown-toggle" dropdown-toggle>Resources <b class="caret"></b></a>\n <ul class="dropdown-menu">\n <li ng-repeat="service in services">\n <a ng-click="service.collapse = !service.collapse; $event.stopPropagation();">{{service.name}}</a>\n <div collapse="service.collapse">\n <div ng-repeat="resource in service.resources | orderBy:\'name\'">\n <a data-ng-href="{{ r(\'resource\', {name: resource.route }) }}">{{ resource.route }}</a>\n </div>\n </div>\n </li>\n </ul>\n</li>')}]),angular.module("/dist/views/umlCells.html",[]).run(["$templateCache",function(a){a.put("/dist/views/umlCells.html","<li><a data-ng-href=\"{{ r('uml_diagram') }}\">UML</a></li>")}]),angular.module("docs.Config",[]).constant("docsConfigConstant",{templateDirectory:"/views/",baseEndpoint:"",apiNamespace:"/api/v1",getApiNamespace:function(){return this.baseEndpoint+this.apiNamespace},mountPoint:"",appVersion:1,viewUrlPrefix:"/dist/views/",templateFileSuffix:".html",prepareViewTemplateUrl:function(a){return this.viewUrlPrefix+a+this.templateFileSuffix},routing:{html5Mode:!0,prefix:""},authToken:""}),function(a){function b(a,b,c,d,e){a.resources=d,a.selected=a.resources.length?a.resources[0].name:void 0,a.select=function(d){a.selected=d;var e=b.hash();b.hash(d),c(),b.hash(e)},a.itemClass=function(b){return a.selected===b?"active":void 0}}a.module("docs.Controllers",["docs.Config"]).controller("DocsCtrl",["$scope","$location","$anchorScroll","resources","docsConfigConstant",b])}(angular),function(a){a.module("docs.Directives",["docs.Config"]).directive("resourceDescription",["docsConfigConstant",function(a){return{restrict:"E",replace:!0,templateUrl:a.prepareViewTemplateUrl("directives/description"),scope:{resource:"="}}}]).directive("resourceExample",["docsConfigConstant",function(a){return{restrict:"E",replace:!0,templateUrl:a.prepareViewTemplateUrl("directives/example"),scope:{resource:"="}}}]).directive("resourceGui",["docsConfigConstant","$http",function(a){return{restrict:"E",replace:!0,templateUrl:a.prepareViewTemplateUrl("directives/gui"),scope:{resource:"="},link:function(a){a.httpMethods=["get","post","put","patch","delete"],a.selectedMethod=a.httpMethods[0],a.selectMethod=function(b){a.selectedMethod=b}}}}]).directive("requestResponseContainer",["docsConfigConstant","$http",function(a,b){return{restrict:"E",replace:!0,templateUrl:a.prepareViewTemplateUrl("directives/requestResponse"),scope:{resource:"=",method:"="},link:function(c){c.PK=c.resource.modelOptions?c.resource.modelOptions.pk||"id":"id",c.ids=[],c.relatedResource={},c.response={},c.addRequestParameter=function(a){a&&-1==c.ids.indexOf(a)&&c.ids.push(a)},c.removeRequestParameter=function(a){var b=c.ids.indexOf(a);c.ids.splice(b,1)},c.sendGETRequest=function(d,e,f){var g={method:c.method,url:a.getApiNamespace()+"/"+d.route};e.length&&(1==e.length&&(g.url+="/"+e[0]),e.length>1&&(g.params={ids:e.join(",")}),f&&(g.url+="/"+f)),b(g).success(function(a,b,e,f){c.response[d.name]=c.response[d.name]||{},c.response[d.name][c.method]={body:a,status:b}}).error(function(a,b,e,f){c.response[d.name]=c.response[d.name]||{},c.response[d.name][c.method]={body:a||"Request failed",status:b}})},c.sendPOSTRequest=function(d,e){var f={method:c.method,url:a.getApiNamespace()+"/"+d.route,headers:{"Content-Type":"application/json"},data:e};b(f).success(function(a,b,e,f){c.response[d.name]=c.response[d.name]||{},c.response[d.name][c.method]={body:a,status:b}}).error(function(a,b,e,f){c.response[d.name]=c.response[d.name]||{},c.response[d.name][c.method]={body:a||"Request failed",status:b}})},c.sendDELETERequest=function(d,e){var f={method:c.method,url:a.getApiNamespace()+"/"+d.route+"/"+e};b(f).success(function(a,b,e,f){c.response[d.name]=c.response[d.name]||{},c.response[d.name][c.method]={body:a,status:b}}).error(function(a,b,e,f){c.response[d.name]=c.response[d.name]||{},c.response[d.name][c.method]={body:a||"Request failed",status:b}})}}}}]).directive("response",["docsConfigConstant",function(a){return{restrict:"E",replace:!0,templateUrl:a.prepareViewTemplateUrl("directives/response"),scope:{response:"="}}}]).directive("resourceAttribute",["docsConfigConstant",function(a){return{restrict:"E",replace:!0,templateUrl:a.prepareViewTemplateUrl("directives/attribute"),scope:{name:"=",value:"="},link:function(a){a.data=a.$parent.data}}}])}(angular),angular.module("docs",["sharedElements","docs.Config","docs.Controllers","docs.Directives"]).provider("docs",["docsConfigConstant",function(a){var b={},c=null,d={when:function(a,c,d){b[a]={url:c,params:d}},install:function(a){for(var d in b){var e=b[d],f=e.url,g=e.params;a.when(f,g)}c&&a.otherwise(c)}};return{setApiHost:function(b){a.baseEndpoint=b},setApiNamespace:function(b){a.apiNamespace=b},html5Mode:function(b,c){a.routing.html5Mode=!!b,a.routing.urlPrefix=c||""},enableNavbar:function(){a.enableNavbar=!0},mountTo:function(b,c){d.when("docs_page",c+"/docs",{templateUrl:a.prepareViewTemplateUrl("docs","docs"),controller:"DocsCtrl as DocsCtrl",resolve:{resources:["$q","$http",function(b,c){var d=b.defer();return c.get(a.baseEndpoint+"/resources").success(function(a){d.resolve(a.resources)}),d.promise}]}}),d.install(b)},$get:["docsConfigConstant",function(a){return{getRoute:function(a){return b[a]},replaceUrlParams:function(a,b){for(var c in b){var d=b[c];a=a.replace(":"+c,d)}return a},routeDefined:function(a){return!!this.getRoute(a)},routePath:function(b,c){var d=this.getRoute(b);return d=d?d.url:null,d&&c&&(d=this.replaceUrlParams(d,c)),a.routing.html5Mode?d:"/#"+a.routing.urlPrefix+d},setApiHost:function(b){a.baseEndpoint=b},setApiNamespace:function(b){a.apiNamespace=b},setAuthToken:function(b){a.authToken=b}}}]}}]).run(["$rootScope","$location","docs","editableOptions","docsConfigConstant",function(a,b,c,d,e){a.docsRoute=function(a,b){return""+c.routePath(a,b)},a.navbarEnabled=e.enableNavbar,d.theme="bs3"}]),function(){window.CONFIG||(window.CONFIG={}),window.CONFIG.fortuneAdmin={templateDirectory:"/views/",baseEndpoint:"",apiNamespace:"/api/v1",getApiNamespace:function(){return this.baseEndpoint+this.apiNamespace},mountPoint:"",appVersion:1,viewUrlPrefix:"/dist/views/",templateFileSuffix:".html",prepareViewTemplateUrl:function(a){return this.viewUrlPrefix+a+this.templateFileSuffix},routing:{html5Mode:!0,prefix:""},authToken:""}}(),angular.module("fortuneAdmin.Controllers",["fortuneAdmin.Services","ui.bootstrap"]).controller("faActionsCtrl",["$scope","$modal","$http","faActionsService",function(a,b,c,d){a.isSelected=function(a){return d.isSelected(a)},a.toggleSelection=function(a){d.toggleSelection(a)},a.actions={delete:{name:"delete",single:!0,bulk:!0,title:"Delete",method:function(d,e,f){b.open({templateUrl:CONFIG.shared.prepareViewTemplateUrl("directives/faDeleteConfirm"),controller:"DeleteConfirmCtrl"}).result.then(function(e){if(e){var g=[];angular.forEach(d,function(a){g.push(a.id)}),c.delete([CONFIG.fortuneAdmin.getApiNamespace(),a.collectionName,g.join(",")].join("/")).then(function(a){for(var c=_.indexBy(d,"id"),e=j=0;e<f.length;)if(c[f[e].id]){if(f.splice(e,1),++j===d.length)break}else e++;b.open({templateUrl:CONFIG.shared.prepareViewTemplateUrl("directives/faAlert"),controller:"AlertCtrl",resolve:{message:function(){return{type:"success",text:"The record removed successfully!"}}}})}).catch(function(a){b.open({templateUrl:CONFIG.shared.prepareViewTemplateUrl("directives/faAlert"),controller:"AlertCtrl",resolve:{message:function(){return{type:"error",text:"Something wrong happened. Please try again later"}}}})})}})}},details:{name:"details",single:!0,bulk:!1,title:"Show Details",method:function(a,c){angular.forEach(a,function(a){b.open({size:"lg",templateUrl:CONFIG.shared.prepareViewTemplateUrl("directives/faDetails"),controller:"DetailsCtrl",resolve:{model:function(){return a}}})})}}},a.options=a.options||{};for(var e in a.options)a.actions[e]&&!1===a.options[e]&&delete a.actions[e];a.applySingleAction=function(a,b,c){a.method([b],!1,c)},a.applyBulkAction=function(b,c){var d=a.getSelected();b.method(d,!0,c)};var f=d.getActions(a.collectionName);angular.forEach(f,function(b){a.actions[b.name]=b}),a.getSelected=function(){return d.getSelectedItems(a.data)}}]).controller("faActionColumnHeaderCtrl",["$scope",function(a){function b(){return _.some(a.$parent.grid.options.data,function(a){return a.action_checked})}function c(){return _.filter(a.$parent.grid.options.data,function(a){return a.action_checked})}var d=this;d.isCheckedItemsExists=b,d.getCheckedItems=c,a.enabled=!1,a.actions=a.$parent.col.grid.options.actions[a.name],a.actionClick=function(a){a&&a.callback&&a.callback(d.getCheckedItems())},a.$watch("$parent.grid.options.data",function(b,c,e){a.enabled=d.isCheckedItemsExists()},!0)}]).controller("faActionCellCtrl",["$scope",function(a){function b(b){var c=e.getColumnDef(a.name);return!(!c||!c.checkEmptyCellCallback)&&c.checkEmptyCellCallback(b)}function c(b){return a.customGetItem?a.customGetItem(a.$parent.grid.options.data||[],b):_.find(a.$parent.grid.options.data,function(a){return b===a.id})}function d(b){return _.find(a.$parent.col.grid.options.columnDefs,function(a){return a.name===b})}var e=this;e.getItem=c,e.isEmpty=b,e.getColumnDef=d,a.$watch("id",function(){a.item=e.getItem(a.id),a.empty=e.isEmpty(a.item)})}]).controller("DetailsCtrl",["$scope","$modalInstance","model",function(a,b,c){a.model=c,a.close=function(){b.close(!0)}}]).controller("AlertCtrl",["$scope","$modalInstance","message",function(a,b,c){a.message=c,a.close=function(){b.close(!0)}}]).controller("DeleteConfirmCtrl",["$scope","$modalInstance",function(a,b){a.close=function(){b.close(!1)},a.confirm=function(){b.close(!0)}}]).controller("ResourcesCtrl",["$scope","$http","$routeParams","fortuneAdmin","resources","data",function(a,b,c,d,e,f){var g={};angular.forEach(e,function(a){a.name!==c.name&&a.route!==c.name||(g=a)});var h=g.route;a.plurResourceName=h,a.currentResource=g,a.resources=e,a.data=f[h],a.links=f.links,a.PK=a.currentResource.modelOptions?a.currentResource.modelOptions.pk||"id":"id",a.parentResourceName=c.parent,a.parentId=c.id,this.addRow=function(d){var e={};if("id"!==a.PK&&(e[a.PK]=d),c.id){var f=c.inverse;angular.isArray(a.currentResource.schema[f])?e[f]=[c.id]:e[f]=c.id}var g={};g[h]=[e],b.post(CONFIG.fortuneAdmin.getApiNamespace()+"/"+h,g).success(function(b){a.data.push(b[h][0])})},this.deleteRow=function(c,d){b.delete(CONFIG.fortuneAdmin.getApiNamespace()+"/"+h+"/"+d).success(function(b,d){a.data.splice(c,1)}).error(function(a,b){console.error(a,b)})},a.filter={},a.strictFilters=d.getStrictFilters();var i=function(a,c,e){var f=d.getStrictFilters(),g={};return f[h]?g["filter["+c+"]"]=a:(g["filter["+c+"][regex]"]=a,g["filter["+c+"][options"]="i"),b.get(CONFIG.fortuneAdmin.getApiNamespace()+"/"+h,{params:g}).then(function(a){console.log(a.data[h]);var b=[],d=[];return angular.forEach(a.data[h],function(a){-1===d.indexOf(a[c])&&(d.push(a[c]),b.push(a))}),b})};a.getTypeaheadList=i,this.filterChangedCb=function(){b.get(CONFIG.fortuneAdmin.getApiNamespace()+"/"+h,{params:a.filter}).success(function(b){a.data=b[h]})}}]).controller("faEditableCtrl",["$scope","$http",function(a,b){a.apply=function(c){var d=[];d.push({op:"replace",path:"/"+a.resourceName+"/0/links/"+a.path,value:c}),b({method:"PATCH",url:CONFIG.fortuneAdmin.getApiNamespace()+"/"+a.resourceName+"/"+a.resourceId,data:d}).catch(function(a,b){console.error(a,b)})}}]),angular.module("fortuneAdmin.Directives",["ui.grid","ui.grid.edit","ui.grid.resizeColumns","ui.grid.pagination","fortuneAdmin.Filters"]).directive("faActions",[function(){return{restrict:"E",templateUrl:CONFIG.fortuneAdmin.prepareViewTemplateUrl("directives/faActions"),controller:"faActionsCtrl",scope:{model:"=ngModel",data:"=",collectionName:"=",options:"="},link:function(a){a.setClickCoords=function(b,c,d){var e=$(b.target).parents("div[class*='ui-grid-row']").eq(0),f=e.parents("div[class*='ui-grid-canvas']").eq(0);a.popupPosition={position:"fixed",top:e.position().top+f.position().top+"px",right:"0px",left:"auto","x-index":100500}}}}}]).directive("faBulkActions",[function(){return{restrict:"E",templateUrl:CONFIG.fortuneAdmin.prepareViewTemplateUrl("directives/faBulkActions"),controller:"faActionsCtrl",scope:{data:"=",collectionName:"=",options:"="}}}]).directive("faActionColumnHeader",[function(){return{restrict:"E",templateUrl:CONFIG.fortuneAdmin.prepareViewTemplateUrl("directives/faActionColumnHeader"),controller:"faActionColumnHeaderCtrl",scope:{name:"@"},link:function(a){a.popupIsOpen=!1,$(document).click(function(b){"action-show-link-"+a.name!=$(b.target).attr("id")&&a.$apply(function(){a.hideMenu()})}),$(document).keyup(function(b){27==b.keyCode&&a.$apply(function(){a.hideMenu()})}),a.showMenu=function(b,c,d){var e=$(".ui-grid-row").eq(0);a.popupIsOpen=!0,a.popupPosition={position:"fixed",top:e.position().top+25+"px",left:"auto",display:"block","min-width":100}},a.hideMenu=function(){a.popupIsOpen=!1,a.popupPosition={display:"none"}}}}}]).directive("faActionCell",[function(){return{restrict:"E",templateUrl:CONFIG.fortuneAdmin.prepareViewTemplateUrl("directives/faActionCell"),controller:"faActionCellCtrl",scope:{id:"@",name:"@",customGetItem:"="}}}]).directive("faGrid",[function(){return{restrict:"E",scope:{data:"=",links:"=",resources:"=",fields:"@",currentResource:"=",filter:"=",filterChangedCb:"&",getTypeaheadList:"&",strictFilters:"="},templateUrl:CONFIG.fortuneAdmin.prepareViewTemplateUrl("directives/faGrid"),link:function(a,b){a.typeaheadList=function(b,c,d){return console.log("calling getTypeaheadList ",b,c,d),a.getTypeaheadList({str:b,name:c,type:d})},a.dropFilter=function(b,c){delete a.filter["filter["+b+"][regex]"],delete a.filter["filter["+b+"][options]"],delete a.filter["filter["+b+"][gte]"],delete a.filter["filter["+b+"][lte]"],delete a.filter["filter["+b+"]"],a.filterChangedCb()},a.getSubresourceRoute=function(a,b){return CONFIG.fortuneAdmin.route(a,b)},a.applyFilter=function(b,c,d){console.log("scope.fields",a.fields);var e=!!a.strictFilters[a.currentResource.route];switch(d){case"String":e?a.filter["filter["+c+"]"]=b.model:(a.filter["filter["+c+"][regex]"]=b.model,a.filter["filter["+c+"][options]"]="i");break;case"Number":case"Date":a.filter["filter["+c+"][gte]"]=b.start,a.filter["filter["+c+"][lte]"]=b.end;break;case"Boolean":a.filter["filter["+c+"]"]=b}a.filterChangedCb()},a.resolveFieldName=function(a){var b=a.split(".");return b[b.length-1]},a.resolveInverse=function(b){var c=this.resolveFieldName(b),d=a.currentResource.schema[c],e="";if(angular.isArray(d))e=d[0].inverse;else{if(!angular.isObject(d))throw new Error("Malformed reference");e=d.inverse}return e},a.linkToMany=function(b){var c=this.resolveFieldName(b),d=a.currentResource.schema[c];return angular.isArray(d)}}}}]).directive("faUiGrid",[function(){return{restrict:"E",transclude:{additionalInteractionControls:"?additionalInteractionControls"},scope:{data:"=",currentResource:"=",columns:"=",options:"=",fvOptions:"="},templateUrl:CONFIG.fortuneAdmin.prepareViewTemplateUrl("directives/faUiGrid"),controller:function(a){a.options=angular.isObject(a.options)?a.options:{},a.fvOptions=a.fvOptions||{},a.fvOptions.actions=a.fvOptions.actions||{},a.gridOptions=angular.extend(a.options,{_fortuneAdminData:{currentResource:a.currentResource,actionsOptions:a.fvOptions.actions}}),a.gridOptions.data=a.data,a.gridOptions.enableCellEdit=!0,a.gridOptions.enableColumnResizing=!0,a.fvOptions.noBulk&&(a.fvOptions.actions.noBulk=!0),a.columns&&(a.gridOptions.columnDefs=angular.copy(a.columns).map(function(b){if(!b.faCellOptions||!b.faCellOptions.type)return b;switch(b.faCellOptions.type){case"checkmark":b.cellTemplate="<div class='fa-ui-grid-default-cell checkmark'"+(b.faCellOptions.tooltip?" title='"+b.faCellOptions.tooltip+"'":"")+"><span>{{COL_FIELD ? '✓' : '✘'}}</span></div>";break;case"streetlight":b.cellTemplate="<div class='fa-ui-grid-default-cell'"+(b.faCellOptions.tooltip?" title='"+b.faCellOptions.tooltip+"'":"")+"><div class='circle {{col.colDef.predicate(COL_FIELD, row)}}'></div></div>";var c=b.faCellOptions.predicate;b.predicate=function(a,b){var d=c(a,b);if(-1===["red","amber","green","grey"].indexOf(d))throw new Error("Unexpected predicate result for streetlight cell. Expected red/amber/green, got "+d);return d};break;case"custom-cell-value":b.cellTemplate="<span class='ui-grid-cell-contents' style='display:inline-block;{{row.entity.additionalStyles}}'"+(b.faCellOptions.tooltip?" title='"+b.faCellOptions.tooltip+"'":"")+">{{col.colDef.predicate( row.entity )}}</span>";var d=b.faCellOptions.predicate;b.predicate=function(a){return d(a)};break;case"action-checkbox":b.cellTemplate='<fa-action-cell id="{{COL_FIELD}}" custom-get-item="col.colDef.customGetItem" name="'+b.name+'"></fa-action-cell>',b.headerCellTemplate='<fa-action-column-header name="'+b.name+'"></fa-action-column-header>',b.enableSorting=!1,b.enableCellEdit=!1,a.gridOptions.actions=a.gridOptions.actions||{},a.gridOptions.actions[b.name]=b.actions;var e=b.faCellOptions.getItem;b.customGetItem=e}return b}),a.fvOptions.ignoreIds||a.gridOptions.columnDefs.unshift({name:"id",enableCellEdit:!1}),a.fvOptions.disableActions||a.gridOptions.columnDefs.push(_.extend({name:" ",enableColumnMenu:!1,enableCellEdit:!1,enableSorting:!1,width:a.fvOptions.noBulk?35:68,cellTemplate:"<fa-actions ng-model='row.entity' options='row.grid.options._fortuneAdminData.actionsOptions' data='row.grid.options.data' collection-name='row.grid.options._fortuneAdminData.currentResource.route'></fa-actions>"},a.fvOptions.actions.colDef||{})))}}}]).directive("faEditable",[function(){return{restrict:"E",replace:!0,scope:{value:"=ngModel",path:"=",schemaType:"=",resourceName:"@",resourceId:"@"},templateUrl:CONFIG.fortuneAdmin.prepareViewTemplateUrl("directives/faEditable"),controller:"faEditableCtrl"}}]).directive("faRef",["$http","$compile",function(a,b){return{restrict:"E",replace:!1,scope:{value:"=ngModel",ref:"=",resourceName:"@",resourceId:"@"},controller:"faEditableCtrl",link:function(c,d){var e,f,g=(c.path=c.ref.ref,c.resources);a.get(CONFIG.fortuneAdmin.baseEndpoint+"/resources",{cache:!0}).success(function(h){g=h.resources,angular.forEach(g,function(a){a.name===c.ref.ref&&(f=a.route,e=a)}),a.get(CONFIG.fortuneAdmin.getApiNamespace()+"/"+f,{cache:!0}).success(function(a){var g=e.modelOptions?e.modelOptions.pk||"id":"id";c.list=a[f];var h=['<a href="#" editable-select="value" ','e-ng-options="item.',g||"id"," as item.",g||"id",' for item in list" ','onaftersave="apply(value)">','{{ value || "Not set." }}',"</a>"],i=b(h.join(""))(c);d.append(i)})})}}}]),angular.module("fortuneAdmin.Filters",[]).filter("singleActions",[function(){return function(a){var b=[];return angular.forEach(a,function(a){a.single&&b.push(a)}),b}}]).filter("bulkActions",[function(){return function(a){var b=[];return angular.forEach(a,function(a){a.bulk&&b.push(a)}),b}}]),angular.module("fortuneAdmin",["templates-main","sharedElements","fortuneAdmin.Controllers","fortuneAdmin.Filters","fortuneAdmin.Directives","fortuneAdmin.Services","fortuneAdmin.Uml"]).provider("fortuneAdmin",function(){var a={},b=null,c={when:function(b,c,d){a[b]={url:c,params:d}},install:function(c){for(var d in a){var e=a[d],f=e.url,g=e.params;c.when(f,g)}b&&c.otherwise(b)}},d=window.CONFIG.fortuneAdmin,e={_strictFilters:null,setStrictFiltering:function(a){this._strictFilters=a},setApiHost:function(a){d.baseEndpoint=a},setApiNamespace:function(a){d.apiNamespace=a},html5Mode:function(a,b){d.routing.html5Mode=!!a,d.routing.urlPrefix=b||""},enableNavbar:function(){d.enableNavbar=!0},mountTo:function(a,b){c.when("uml_diagram",b+"/uml",{templateUrl:d.prepareViewTemplateUrl("uml"),controller:"UmlCtrl as UmlCtrl"}),c.when("resource",b+"/:name",{templateUrl:d.prepareViewTemplateUrl("resources"),controller:"ResourcesCtrl as ResourcesCtrl",resolve:{resources:["$q","$http",function(a,b){var c=a.defer();return b.get(d.baseEndpoint+"/resources").success(function(a){c.resolve(a.resources)}),c.promise}],data:["$q","$http","$route",function(a,b,c){var e=c.current.params.name,f=a.defer();return b.get(d.getApiNamespace()+"/"+e,{params:{limit:20}}).success(function(a){f.resolve(a)}),f.promise}]}}),c.when("subresource",b+"/:parent/:id/:name/refby/:inverse",{templateUrl:d.prepareViewTemplateUrl("resources"),controller:"ResourcesCtrl as ResourcesCtrl",resolve:{resources:["$q","$http",function(a,b){var c=a.defer();return b.get(d.baseEndpoint+"/resources").success(function(a){c.resolve(a.resources)}),c.promise}],data:["$q","$http","$route",function(a,b,c){var e=a.defer(),f=c.current.params.inverse,g=c.current.params.id,h=c.current.params.name,i={};return i["filter["+f+"]"]=g,i.limit=20,b.get(d.getApiNamespace()+"/"+h,{params:i}).success(function(a){e.resolve(a)}),e.promise}]}}),c.install(a)},$get:function(){return{getRoute:function(b){return a[b]},replaceUrlParams:function(a,b){for(var c in b){var d=b[c];a=a.replace(":"+c,d)}return a},routeDefined:function(a){return!!this.getRoute(a)},routePath:function(a,b){var c=this.getRoute(a);return c=c?c.url:null,c&&b&&(c=this.replaceUrlParams(c,b)),d.routing.html5Mode?c:"/#"+d.routing.urlPrefix+c},setApiHost:function(a){d.baseEndpoint=a},setApiNamespace:function(a){d.apiNamespace=a},setAuthToken:function(a){d.authToken=a},getStrictFilters:function(){return angular.copy(e._strictFilters)}}}};return e}).run(["$rootScope","$location","fortuneAdmin","editableOptions",function(a,b,c,d){var e="";a.fortuneAdminRoute=function(a,b){return e+c.routePath(a,b)},CONFIG.fortuneAdmin.route=function(a,b){return e+c.routePath(a,b)},a.navbarEnabled=!!CONFIG.fortuneAdmin.enableNavbar,d.theme="bs3"}]),angular.module("fortuneAdmin.Services.inflectPort",[]).service("Inflect",[function(){var a,b={},c=a={array:{del:function(a,b){var c=a.indexOf(b);return-1!=c?0==c?a.slice(1):a.slice(0,c).concat(a.slice(c+1)):a},first:function(a){return a[0]},last:function(a){return a[a.length-1]}},string:{gsub:function(b,c,d){var e,f,g,h,i,j,k;if(null==c||null==d)return a.string.value(b);for(j="",k=b;k.length>0;)if(f=k.match(c)){if(j+=k.slice(0,f.index),"function"==typeof d)f[1]=f[1]||f[0],j+=d(f);else if(d.match(/\$[1-9]/)){for(h=f,g=a.array.del(f,void 0);g!==h;)h=g,g=a.array.del(g,void 0);for(f[1]=f[1]||f[0],i=d,e=1;e<=9;e++)g[e]&&(i=a.string.gsub(i,new RegExp("\\$"+e),g[e]));j+=i}else j+=d;k=k.slice(f.index+f[0].length)}else j+=k,k="";return j},upcase:function(b){var c=a.string.gsub(b,/_([a-z])/,function(a){return"_"+a[1].toUpperCase()});return c=a.string.gsub(c,/\/([a-z])/,function(a){return"/"+a[1].toUpperCase()}),c[0].toUpperCase()+c.substr(1)},capitalize:function(b,c){var d=b.toLowerCase();return c||(d=a.string.gsub(d,/\s([a-z])/,function(a){return" "+a[1].toUpperCase()})),d[0].toUpperCase()+d.substr(1)},downcase:function(b){var c=a.string.gsub(b,/_([A-Z])/,function(a){return"_"+a[1].toLowerCase()});return c=a.string.gsub(c,/\/([A-Z])/,function(a){return"/"+a[1].toLowerCase()}),c[0].toLowerCase()+c.substr(1)},value:function(a){return a.substr(0)}}},d=function(a){a.plural(/$/,"s"),a.plural(/s$/i,"s"),a.plural(/(ax|test)is$/i,"$1es"),a.plural(/(octop|vir)us$/i,"$1i"),a.plural(/(octop|vir)i$/i,"$1i"),a.plural(/(alias|status)$/i,"$1es"),a.plural(/(bu)s$/i,"$1ses"),a.plural(/(buffal|tomat)o$/i,"$1oes"),a.plural(/([ti])um$/i,"$1a"),a.plural(/([ti])a$/i,"$1a"),a.plural(/sis$/i,"ses"),a.plural(/(?:([^f])fe|([lr])f)$/i,"$1ves"),a.plural(/(hive)$/i,"$1s"),a.plural(/([^aeiouy]|qu)y$/i,"$1ies"),a.plural(/(x|ch|ss|sh)$/i,"$1es"),a.plural(/(matr|vert|ind)(?:ix|ex)$/i,"$1ices"),a.plural(/([m|l])ouse$/i,"$1ice"),a.plural(/([m|l])ice$/i,"$1ice"),a.plural(/^(ox)$/i,"$1en"),a.plural(/^(oxen)$/i,"$1"),a.plural(/(quiz)$/i,"$1zes"),a.singular(/s$/i,""),a.singular(/(n)ews$/i,"$1ews"),a.singular(/([ti])a$/i,"$1um"),a.singular(/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i,"$1sis"),a.singular(/(^analy)ses$/i,"$1sis"),a.singular(/([^f])ves$/i,"$1fe"),a.singular(/(hive)s$/i,"$1"),a.singular(/(tive)s$/i,"$1"),a.singular(/([lr])ves$/i,"$1f"),a.singular(/([^aeiouy]|qu)ies$/i,"$1y"),a.singular(/(s)eries$/i,"$1eries"),a.singular(/(m)ovies$/i,"$1ovie"),a.singular(/(x|ch|ss|sh)es$/i,"$1"),a.singular(/([m|l])ice$/i,"$1ouse"),a.singular(/(bus)es$/i,"$1"),a.singular(/(o)es$/i,"$1"),a.singular(/(shoe)s$/i,"$1"),a.singular(/(cris|ax|test)es$/i,"$1is"),a.singular(/(octop|vir)i$/i,"$1us"),a.singular(/(alias|status)es$/i,"$1"),a.singular(/^(ox)en/i,"$1"),a.singular(/(vert|ind)ices$/i,"$1ex"),a.singular(/(matr)ices$/i,"$1ix"),a.singular(/(quiz)zes$/i,"$1"),a.singular(/(database)s$/i,"$1"),a.irregular("child","children"),a.irregular("person","people"),a.irregular("man","men"),a.irregular("child","children"),a.irregular("sex","sexes"),a.irregular("move","moves"),a.irregular("cow","kine"),a.irregular("zombie","zombies"),a.uncountable(["equipment","information","rice","money","species","series","fish","sheep","jeans"])},e=function(){return this.plurals=[],this.singulars=[],this.uncountables=[],this.humans=[],d(this),this};return e.prototype.plural=function(a,b){"string"==typeof a&&(this.uncountables=c.array.del(this.uncountables,a)),this.uncountables=c.array.del(this.uncountables,b),this.plurals.unshift([a,b])},e.prototype.singular=function(a,b){"string"==typeof a&&(this.uncountables=c.array.del(this.uncountables,a)),this.uncountables=c.array.del(this.uncountables,b),this.singulars.unshift([a,b])},e.prototype.irregular=function(a,b){this.uncountables=c.array.del(this.uncountables,a),this.uncountables=c.array.del(this.uncountables,b),a[0].toUpperCase()==b[0].toUpperCase()?(this.plural(new RegExp("("+a[0]+")"+a.slice(1)+"$","i"),"$1"+b.slice(1)),this.plural(new RegExp("("+b[0]+")"+b.slice(1)+"$","i"),"$1"+b.slice(1)),this.singular(new RegExp("("+b[0]+")"+b.slice(1)+"$","i"),"$1"+a.slice(1))):(this.plural(new RegExp(""+a[0].toUpperCase()+a.slice(1)+"$"),b[0].toUpperCase()+b.slice(1)),this.plural(new RegExp(""+a[0].toLowerCase()+a.slice(1)+"$"),b[0].toLowerCase()+b.slice(1)),this.plural(new RegExp(""+b[0].toUpperCase()+b.slice(1)+"$"),b[0].toUpperCase()+b.slice(1)),this.plural(new RegExp(""+b[0].toLowerCase()+b.slice(1)+"$"),b[0].toLowerCase()+b.slice(1)),this.singular(new RegExp(""+b[0].toUpperCase()+b.slice(1)+"$"),a[0].toUpperCase()+a.slice(1)),this.singular(new RegExp(""+b[0].toLowerCase()+b.slice(1)+"$"),a[0].toLowerCase()+a.slice(1)))},e.prototype.human=function(a,b){this.humans.unshift([a,b])},e.prototype.uncountable=function(a){this.uncountables=this.uncountables.concat(a)},e.prototype.clear=function(a){switch(null==a&&(a="all"),a){case"all":this.plurals=[],this.singulars=[],this.uncountables=[],this.humans=[];default:this[a]=[]}},e.prototype.default=function(){return this.plurals=[],this.singulars=[],this.uncountables=[],this.humans=[],d(this),this},b.inflections=new e,b.inflect=function(a){a(b.inflections)},b.camelize=function(a,b){var d;return null==b&&(b=!0),d=c.string.gsub(a,/\/(.?)/,function(a){return"."+c.string.upcase(a[1])}),d=c.string.gsub(d,/(?:_)(.)/,function(a){return c.string.upcase(a[1])}),b?c.string.upcase(d):c.string.downcase(d)},b.underscore=function(a){var b;return b=c.string.gsub(a,/\./,"/"),b=c.string.gsub(b,/([A-Z]+)([A-Z][a-z])/,"$1_$2"),b=c.string.gsub(b,/([a-z\d])([A-Z])/,"$1_$2"),b=c.string.gsub(b,/-/,"_"),b.toLowerCase()},b.dasherize=function(a){return c.string.gsub(a,/_/,"-")},b.demodulize=function(a){return c.string.gsub(a,/^.*\./,"")},b.foreign_key=function(a,c){return null==c&&(c=!0),b.underscore(b.demodulize(a))+(c?"_id":"id")},b.ordinalize=function(a){var b;if(a=parseInt(a),11==(b=Math.abs(a)%100)||12===b||13===b)return a+"th";switch(Math.abs(a)%10){case 1:return a+"st";case 2:return a+"nd";case 3:return a+"rd";default:return a+"th"}},b.uncountability=function(a){return b.inflections.uncountables.some(function(b,c,d){return null!=a.match(new RegExp("(\\b|_)"+b+"$","i"))})},b.pluralize=function(a){var d,e;if(e=a,""===a||b.uncountability(a))return e;for(var f=0;f<b.inflections.plurals.length&&(d=b.inflections.plurals[f],e=c.string.gsub(e,d[0],d[1]),null==a.match(d[0]));f++);return e},b.singularize=function(a){var d,e;if(d=a,""===a||b.uncountability(a))return d;for(var f=0;f<b.inflections.singulars.length&&(e=b.inflections.singulars[f],d=c.string.gsub(d,e[0],e[1]),!a.match(e[0]));f++);return d},b.humanize=function(a){var d,e;e=a;for(var f=0;f<b.inflections.humans.length;f++)d=b.inflections.humans[f],e=c.string.gsub(e,d[0],d[1]);return e=c.string.gsub(e,/_id$/,""),e=c.string.gsub(e,/_/," "),c.string.capitalize(e,!0)},b.titleize=function(a){var d;return d=b.humanize(b.underscore(a)),d=c.string.gsub(d,/[^a-zA-Z:']/," "),c.string.capitalize(d)},b.tableize=function(a){return b.pluralize(b.underscore(a))},b.classify=function(a){return b.camelize(b.singularize(c.string.gsub(a,/.*\./,"")))},b}]),function(a){function b(a,b){a.resources=[],a.render=!1,b.get(CONFIG.fortuneAdmin.baseEndpoint+"/resources").success(function(b){a.resources=b.resources,a.render=!0})}a.module("fortuneAdmin.Uml.Controllers",[]).controller("UmlCtrl",["$scope","$http",b])}(angular),function(a){a.module("fortuneAdmin.Uml.D3",[]).factory("d3",["$q","$timeout","$rootScope",function(a,b,c){var d=a.defer();return b(function(){c.$apply(function(){d.resolve(window.d3)})}),{load:function(){return d.promise}}}])}(angular),function(a){function b(b,c){return{restrict:"A",templateUrl:CONFIG.fortuneAdmin.prepareViewTemplateUrl("directives/uml/canvas"),scope:{resources:"="},link:function(d,e){function f(){for(var a=c.bottomLine[0],b=0,d=0;d<c.bottomLine.length;d++)c.bottomLine[d]<a&&(a=c.bottomLine[d],b=d);return[b,a]}function h(a,b){return c.positions[a][b]}c.clear(),d.canvas={};var i={},j={},k=0,l=Math.floor(e[0].clientWidth/g.columnWidth),m={};a.forEach(d.resources,function(a){m[a.service]=m[a.service]||[],m[a.service].push(a)}),d.resources=a.copy(m),m={},a.forEach(d.resources,function(b){m=a.copy(b);var c=m[0],d=Object.keys(m[0].schema).length+Object.keys(m[0].actions||{}).length,e=0;a.forEach(m,function(a,b){var f=Object.keys(a.schema).length+Object.keys(a.actions||{}).length;f>d&&(c=a,d=f,e=b)}),b=b.splice(e,1).concat(b),a.forEach(b,function(b,c){var d=b.service||"default";i[d]=i[d]||[],i[d][c]={properties:[],actions:[]},j[d]=j[d]||{},j[d][c]={name:b.name,service:b.service},b.modelOptions&&b.modelOptions.pk&&(j[d][c].pk=b.modelOptions.pk||"id"),a.forEach(b.schema,function(a,b){i[d][c].properties.push({name:b,params:a,pk:j[d][c].pk===b})}),a.forEach(b.actions,function(a,b){i[d][c].actions.push({name:a.name||b,params:a})});var e=function(a,b){return a.name>b.name?1:-1};i[d][c].properties.sort(e),i[d][c].actions.sort(e)})}),d.resources=i,function(){for(var b=0;b<l;b++)c.bottomLine.push(30);a.forEach(i,function(b,d){function e(a,b){var e=a.properties.concat(a.actions),h=e.length*g.fieldHeight+g.headerHeight,i=f(),j={x:i[0]*g.columnWidth,y:i[1],height:h,column:i[0]};c.bottomLine[i[0]]+=h+g.vgap,c.positions[d]=c.positions[d]||[],c.positions[d][b]=j}a.forEach(b,function(a,b){e(a,b)});var h=c.bottomLine[0];a.forEach(c.bottomLine,function(a){a>h&&(h=a)});for(var i=c.bottomLine.length;i>=0;i--)c.bottomLine[i]=h})}();for(var n=0;n<c.bottomLine.length;n++)c.bottomLine[n]>k&&(k=c.bottomLine[n]+100);var o=d3.select(e[0]).append("svg").attr("id","mainCanvas").attr("height",k).style("width","100%"),p=o[0][0].offsetTop,q=o[0][0].clientWidth;c.setBase(p),a.forEach(i,function(b,d){var e=c.positions[d][0];e=e.y+e.height,a.forEach(c.positions[d],function(a){a.y+a.height>e&&(e=a.y+a.height)});var f=o.append("svg").attr("id",d).attr("height",e).style("width","100%"),i=f.selectAll("g").data(b).enter().append("g").attr("height",function(a){return a.actions.concat(a.properties).length*g.fieldHeight}).attr("width",g.fieldWidth).attr("x",0).attr("y",0).attr("fill","#ffffff").append("foreignObject").attr("x",function(a,b){return h(d,b).x+g.vgap}).attr("y",function(a,b){return h(d,b).y}).attr("height",function(a){return(a.actions.length+a.properties.length)*g.fieldHeight+g.headerHeight}).attr("width",g.fieldWidth).append("xhtml:div").attr("class","resource");i.append("xhtml:div").attr("class","header").append("xhtml:h4").attr("class","text-center").text(function(a,b){return j[d][b].name}),i.append("xhtml:div").attr("style","width: 100%").append("xhtml:div").attr("resource-class","").attr("resource",function(a,b){return'resources["'+d+'"]['+b+"]"}),a.forEach(i[0],function(a){c.add("resources",a,a.innerText)}),f.append("rect").attr("width",q-10).attr("x",5).attr("y",i[0][0].offsetTop-10-75).attr("height",e-i[0][0].offsetTop+85).attr("fill","none").attr("stroke","red"),f.append("rect").attr("width",g.fieldWidth).attr("height",g.fieldHeight).attr("x",0).attr("y",i[0][0].offsetTop-20-85).attr("fill","black"),f.append("text").attr("width",g.fieldWidth).attr("height",g.fieldHeight).attr("x",0).attr("y",i[0][0].offsetTop-20-70).attr("fill","white").text(d)}),e.removeAttr("resources-canvas"),b(e)(d)}}}function c(a,b){return{restrict:"A",scope:{resource:"="},link:function(b,c){function d(a,b){var d=0,e=-20,f=a.length*g.fieldHeight;if(f){var h=d3.select(c[0]).append("svg").attr("width",g.fieldWidth).attr("height",f),i="actions"===b?"resource-action":"resource-property",j="actions"===b?"action":"field";h.selectAll("g").data(a).enter().append("g").attr("height",g.fieldHeight).attr("width",g.fieldWidth).attr("fill","#cccccc").append("foreignObject").attr("x",d).attr("y",function(){return e+=g.fieldHeight}).attr("height",g.fieldHeight).attr("width",g.fieldWidth).append("xhtml:div").attr(i,"").attr(j,function(a,c){return"resource."+b+"["+c+"]"}).attr("class","text-center "+b).attr("style","width: 100%"),e+=g.fieldHeight,h.append("line").attr("x1",d).attr("y1",e).attr("x2",d+g.fieldWidth).attr("y2",e).attr("stroke-width",3).attr("stroke","black")}}d(b.resource.properties,"properties"),d(b.resource.actions,"actions"),c.removeAttr("resource-class"),a(c)(b)}}}function d(b,c){return{restrict:"A",scope:{field:"=",isPk:"="},link:function(c,d){var e=!1;a.isArray(c.field.params)?c.field.params[0]&&c.field.params[0].ref&&(e=!0):a.isObject(c.field.params)&&c.field.params.ref&&(e=!0);var f={width:10,height:g.fieldHeight};if(e){var h=d3.select(d[0]).append("svg").attr("width",g.fieldWidth).attr("height",f.height);h.append("foreignObject").attr("width",g.fieldWidth).attr("height",g.fieldHeight).append("xhtml:div").attr("class","field ref").text(c.field.name+" [ref]"),h.append("foreignObject").attr("width",1).attr("height",g.fieldHeight).append("xhtml:div").attr("port-x",function(){return h[0][0].offsetLeft}).attr("port-y",function(){return h[0][0].offsetTop}).attr("resource-link","").attr("link-to-many",function(){return a.isArray(c.field.params)}).attr("link-to",function(){return a.isArray(c.field.params)?"field.params[0]":"field.params"})}else if(c.field.pk)d.addClass("pk"),d.text("PK: "+c.field.name);else if(a.isArray(c.field.params))d.text(c.field.name+" [Arr]");else if(a.isObject(c.field.params))d.text(c.field.name+" [Nested]");else try{d.text(c.field.name+" ["+c.field.params.substr(0,3)+"]")}catch(a){console.log("caugth error: ",a)}d.removeAttr("resource-property"),b(d)(c)}}}function e(a,b){return{restrict:"A",scope:{action:"="},link:function(b,c){g.fieldHeight;c.text(b.action.name+"( )"),c.removeAttr("resource-action"),a(c)(b)}}}function f(b){return{restrict:"A",scope:{linkToMany:"=",linkTo:"=",portX:"@",portY:"@"},link:function(c,d){function e(){return["#FF0020","#FF00CC","#0000FF","#00F9FF","#00FF20","#FFE000"][Math.floor(6*Math.random())]}var f=b.find("resources",c.linkTo.ref);if(f){var h=b.getBaseOffset(),i=parseInt(c.portX),j=parseInt(c.portY)+10,k=!1,l=i-f.right<100;i<=f.left&&(k=!0);var m=[];k?(m.push({x:i+g.fieldWidth,y:j-h}),m.push({x:i+g.fieldWidth+50,y:j-h})):l?(m.push({x:i+g.fieldWidth,y:j-h}),m.push({x:i+g.fieldWidth+50,y:j-h})):(m.push({x:i,y:j-h}),m.push({x:i-50,y:j-h}));var n=Math.floor((f.right-i)/g.columnWidth);if(Math.abs(n)>1)for(var o=Math.floor(i/g.columnWidth),p=o+n,q=k?o+1:o-1;q!==p;){var r=[];a.forEach(b.positions,function(b){a.forEach(b,function(a){a.column==q&&r.push(a)})});var s=r[0],t=Math.abs(j-s.y);a.forEach(r,function(a){Math.abs(j-a.y)<t&&(s=a,t=j-a.y)});var u=s.y+s.height+50*Math.random(),v=s.x,w=50;k?(m.push({x:v-w,y:u}),m.push({x:v+g.columnWidth-w,y:u})):(m.push({x:v+g.columnWidth+w,y:u}),m.push({x:v-w,y:u})),k?q++:q--}k?(m.push({x:f.left-50,y:f.top+10}),m.push({x:f.left,y:f.top+10})):(m.push({x:f.right+50,y:f.top+10}),m.push({x:f.right,y:f.top+10}));var x=d3.svg.line().x(function(a){return a.x}).y(function(a){return a.y}).tension(.95).interpolate("basis"),y=e(),z=d3.select("#mainCanvas").append("path").attr("d",x(m)).attr("stroke",y).attr("stroke-width",2).attr("fill","none").on("mouseover",function(a,b){d3.select(this).attr("stroke","#F00").attr("stroke-width",10)}).on("mouseleave",function(a,b){d3.select(this).attr("stroke",y).attr("stroke-width",2)}),A=d.parent().parent().parent();A.bind("mouseover",function(){z.attr("stroke","#F00").attr("stroke-width",10)}),A.bind("mouseleave",function(){z.attr("stroke",y).attr("stroke-width",2)})}}}}var g={headerHeight:50,fieldHeight:20,fieldWidth:200,columnWidth:300,vgap:50};a.module("fortuneAdmin.Uml.Directives",["fortuneAdmin.Uml.D3","fortuneAdmin.Uml.Services"]).directive("resourcesCanvas",["$compile","UmlElementsRegistry",b]).directive("resourceClass",["$compile","UmlElementsRegistry",c]).directive("resourceProperty",["$compile","UmlElementsRegistry",d]).directive("resourceAction",["$compile","UmlElementsRegistry",e]).directive("resourceLink",["UmlElementsRegistry",f])}(angular),function(a){a.module("fortuneAdmin.Uml",["fortuneAdmin.Uml.Controllers","fortuneAdmin.Uml.Services","fortuneAdmin.Uml.D3","fortuneAdmin.Uml.Directives"])}(angular),function(a){function b(){var b={resources:[],fields:[]},c=0;this.positions={},this.bottomLine=[],this.setBase=function(a){c=a},this.getBaseOffset=function(){return c},this.add=function(a,d,e){e=e.replace(/\n/gi,""),b[a].push({id:e,top:d.offsetTop-c,left:d.offsetLeft,right:d.offsetLeft+d.clientWidth})},this.find=function(c,d){var e=null;return a.forEach(b[c],function(a){a.id===d&&(e=a)}),e},this.remove=function(a,b){},this.clear=function(){b={resources:[],fields:[]},this.positions={},this.bottomLine=[]}}a.module("fortuneAdmin.Uml.Services",[]).service("UmlElementsRegistry",[b])}(angular),angular.module("fortuneAdmin.Services",["fortuneAdmin.Services.inflectPort"]).service("faActionsService",["$rootScope",function(a){var b={},c=[],d=this;this.isSelected=function(a){return-1!==c.indexOf(a.id)},this.toggleSelection=function(a){this.isSelected(a)?c.splice(c.indexOf(a.id),1):c.push(a.id)},this.getSelectedItems=function(a){var b=[];return angular.forEach(a,function(a){d.isSelected(a)&&b.push(a)}),b},this.initialize=function(){c=[]},a.$on("$locationChangeStart",function(){d.initialize()}),this.registerActions=function(a){angular.forEach(a,function(a){angular.isDefined(b[a.name])&&console.warn("Overwriting existing action ",a.name),b[a.name]=a})},this.getActions=function(a){var c=[];return angular.forEach(b,function(b){angular.isUndefined(b.resources)?c.push(b):-1!==b.resources.indexOf(a)&&c.push(b)}),c}}]),function(){window.CONFIG||(window.CONFIG={}),window.CONFIG.shared={templateDirectory:"/views/",baseEndpoint:"",apiNamespace:"/api/v1",getApiNamespace:function(){return this.baseEndpoint+this.apiNamespace},mountPoint:"",appVersion:1,viewUrlPrefix:"/dist/views/",templateFileSuffix:".html",prepareViewTemplateUrl:function(a){return this.viewUrlPrefix+a+this.templateFileSuffix},routing:{html5Mode:!0,prefix:""},authToken:""}}(),angular.module("sharedElements.Directives",[]).directive("fortuneAdminNavbar",[function(){return{restrict:"E",templateUrl:CONFIG.shared.prepareViewTemplateUrl("mynavbar"),replace:!0,transclude:!0,scope:{}}}]).directive("fortuneAdminResourcesCells",["$http","$rootScope",function(a,b){return{restrict:"E",templateUrl:CONFIG.shared.prepareViewTemplateUrl("resourcesCells"),replace:!0,scope:!0,link:function(c){c.r=b.fortuneAdminRoute,c.resources=[],a.get(CONFIG.fortuneAdmin.baseEndpoint+"/resources").success(function(a){c.resources=a.resources,c.services={},angular.forEach(a.resources,function(a){a.service=(a.service||"default-service").split("-").join(" "),c.services[a.service]=c.services[a.service]||{name:a.service,resources:[],collapse:!0},c.services[a.service].resources.push(a)})})}}}]).directive("fortuneAdminUmlCells",["$rootScope",function(a){return{restrict:"E",replace:!0,templateUrl:CONFIG.shared.prepareViewTemplateUrl("umlCells"),scope:!0,link:function(b){b.r=a.fortuneAdminRoute}}}]).directive("fortuneAdminDocsCells",["$rootScope",function(a){return{restrict:"E",replace:!0,templateUrl:CONFIG.shared.prepareViewTemplateUrl("docsCells"),scope:!0,link:function(b){b.r=a.docsRoute}}}]),angular.module("sharedElements.Filters",[]).filter("filterFields",[function(){return function(a,b){"string"==typeof b?b=b.split(","):angular.isArray(b)&&(console.log("filterFields passed Array fields"),b=Object.keys(b));var c={};return angular.forEach(a,function(a,d){b?-1!==b.indexOf(d)&&(c[d]=a):angular.isObject(a)&&a.ref||angular.isArray(a)&&a[0]&&a[0].ref||(c[d]=a)}),c}}]).filter("notSorted",[function(){return function(a){return a?Object.keys(a):[]}}]),angular.module("sharedElements",["ui.bootstrap","xeditable","sharedElements.Directives","sharedElements.Filters"]),angular.module("ui.bootstrap",["ui.bootstrap.collapse","ui.bootstrap.transition","ui.bootstrap.dropdown","ui.bootstrap.typeahead","ui.bootstrap.position","ui.bootstrap.bindHtml","ui.bootstrap.modal"]),angular.module("ui.bootstrap.collapse",["ui.bootstrap.transition"]).directive("collapse",["$transition",function(a){return{link:function(b,c,d){function e(b){function d(){j===e&&(j=void 0)}var e=a(c,b);return j&&j.cancel(),j=e,e.then(d,d),e}function f(){k?(k=!1,g()):(c.removeClass("collapse").addClass("collapsing"),e({height:c[0].scrollHeight+"px"}).then(g))}function g(){c.removeClass("collapsing"),c.addClass("collapse in"),c.css({height:"auto"})}function h(){if(k)k=!1,i(),c.css({height:0});else{c.css({height:c[0].scrollHeight+"px"});c[0].offsetWidth;c.removeClass("collapse in").addClass("collapsing"),e({height:0}).then(i)}}function i(){c.removeClass("collapsing"),c.addClass("collapse")}var j,k=!0;b.$watch(d.collapse,function(a){a?h():f()})}}}]),angular.module("ui.bootstrap.transition",[]).factory("$transition",["$q","$timeout","$rootScope",function(a,b,c){function d(a){for(var b in a)if(void 0!==f.style[b])return a[b]}var e=function(d,f,g){g=g||{};var h=a.defer(),i=e[g.animation?"animationEndEventName":"transitionEndEventName"],j=function(a){c.$apply(function(){d.unbind(i,j),h.resolve(d)})};return i&&d.bind(i,j),b(function(){angular.isString(f)?d.addClass(f):angular.isFunction(f)?f(d):angular.isObject(f)&&d.css(f),i||h.resolve(d)}),h.promise.cancel=function(){i&&d.unbind(i,j),h.reject("Transition cancelled")},h.promise},f=document.createElement("trans"),g={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",transition:"transitionend"},h={WebkitTransition:"webkitAnimationEnd",MozTransition:"animationend",OTransition:"oAnimationEnd",transition:"animationend"};return e.transitionEndEventName=d(g),e.animationEndEventName=d(h),e}]),angular.module("ui.bootstrap.dropdown",[]).constant("dropdownConfig",{openClass:"open"}).service("dropdownService",["$document",function(a){var b=null;this.open=function(e){b||(a.bind("click",c),a.bind("keydown",d)),b&&b!==e&&(b.isOpen=!1),b=e},this.close=function(e){b===e&&(b=null,a.unbind("click",c),a.unbind("keydown",d))};var c=function(a){if(b){var c=b.getToggleElement();a&&c&&c[0].contains(a.target)||b.$apply(function(){b.isOpen=!1})}},d=function(a){27===a.which&&(b.focusToggleElement(),c())}}]).controller("DropdownController",["$scope","$attrs","$parse","dropdownConfig","dropdownService","$animate",function(a,b,c,d,e,f){var g,h=this,i=a.$new(),j=d.openClass,k=angular.noop,l=b.onToggle?c(b.onToggle):angular.noop;this.init=function(d){h.$element=d,b.isOpen&&(g=c(b.isOpen),k=g.assign,a.$watch(g,function(a){i.isOpen=!!a}))},this.toggle=function(a){return i.isOpen=arguments.length?!!a:!i.isOpen},this.isOpen=function(){return i.isOpen},i.getToggleElement=function(){return h.toggleElement},i.focusToggleElement=function(){h.toggleElement&&h.toggleElement[0].focus()},i.$watch("isOpen",function(b,c){f[b?"addClass":"removeClass"](h.$element,j),b?(i.focusToggleElement(),e.open(i)):e.close(i),k(a,b),angular.isDefined(b)&&b!==c&&l(a,{open:!!b})}),a.$on("$locationChangeSuccess",function(){i.isOpen=!1}),a.$on("$destroy",function(){i.$destroy()})}]).directive("dropdown",function(){return{controller:"DropdownController",link:function(a,b,c,d){d.init(b)}}}).directive("dropdownToggle",function(){return{require:"?^dropdown",link:function(a,b,c,d){if(d){d.toggleElement=b;var e=function(e){e.preventDefault(),b.hasClass("disabled")||c.disabled||a.$apply(function(){d.toggle()})};b.bind("click",e),b.attr({"aria-haspopup":!0,"aria-expanded":!1}),a.$watch(d.isOpen,function(a){b.attr("aria-expanded",!!a)}),a.$on("$destroy",function(){b.unbind("click",e)})}}}}),angular.module("ui.bootstrap.typeahead",["ui.bootstrap.position","ui.bootstrap.bindHtml"]).factory("typeaheadParser",["$parse",function(a){var b=/^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w\d]*))\s+in\s+([\s\S]+?)$/;return{parse:function(c){var d=c.match(b);if(!d)throw new Error('Expected typeahead specification in form of "_modelValue_ (as _label_)? for _item_ in _collection_" but got "'+c+'".');return{itemName:d[3],source:a(d[4]),viewMapper:a(d[2]||d[1]),modelMapper:a(d[1])}}}}]).directive("typeahead",["$compile","$parse","$q","$timeout","$document","$position","typeaheadParser",function(a,b,c,d,e,f,g){var h=[9,13,27,38,40];return{require:"ngModel",link:function(i,j,k,l){var m,n=i.$eval(k.typeaheadMinLength)||1,o=i.$eval(k.typeaheadWaitMs)||0,p=!1!==i.$eval(k.typeaheadEditable),q=b(k.typeaheadLoading).assign||angular.noop,r=b(k.typeaheadOnSelect),s=k.typeaheadInputFormatter?b(k.typeaheadInputFormatter):void 0,t=!!k.typeaheadAppendToBody&&i.$eval(k.typeaheadAppendToBody),u=!1!==i.$eval(k.typeaheadFocusFirst),v=b(k.ngModel).assign,w=g.parse(k.typeahead),x=i.$new();i.$on("$destroy",function(){x.$destroy()});var y="typeahead-"+x.$id+"-"+Math.floor(1e4*Math.random());j.attr({"aria-autocomplete":"list","aria-expanded":!1,"aria-owns":y});var z=angular.element("<div typeahead-popup></div>");z.attr({id:y,matches:"matches",active:"activeIdx",select:"select(activeIdx)",query:"query",position:"position"}),angular.isDefined(k.typeaheadTemplateUrl)&&z.attr("template-url",k.typeaheadTemplateUrl);var A=function(){x.matches=[],x.activeIdx=-1,j.attr("aria-expanded",!1)},B=function(a){return y+"-option-"+a};x.$watch("activeIdx",function(a){a<0?j.removeAttr("aria-activedescendant"):j.attr("aria-activedescendant",B(a))});var C=function(a){var b={$viewValue:a};q(i,!0),c.when(w.source(i,b)).then(function(c){var d=a===l.$viewValue;if(d&&m)if(c.length>0){x.activeIdx=u?0:-1,x.matches.length=0;for(var e=0;e<c.length;e++)b[w.itemName]=c[e],x.matches.push({id:B(e),label:w.viewMapper(x,b),model:c[e]});x.query=a,x.position=t?f.offset(j):f.position(j),x.position.top=x.position.top+j.prop("offsetHeight"),j.attr("aria-expanded",!0)}else A();d&&q(i,!1)},function(){A(),q(i,!1)})};A(),x.query=void 0;var D,E=function(a){D=d(function(){C(a)},o)},F=function(){D&&d.cancel(D)};l.$parsers.unshift(function(a){return m=!0,a&&a.length>=n?o>0?(F(),E(a)):C(a):(q(i,!1),F(),A()),p?a:a?void l.$setValidity("editable",!1):(l.$setValidity("editable",!0),a)}),l.$formatters.push(function(a){var b,c,d={};return s?(d.$model=a,s(i,d)):(d[w.itemName]=a,b=w.viewMapper(i,d),d[w.itemName]=void 0,c=w.viewMapper(i,d),b!==c?b:a)}),x.select=function(a){var b,c,e={};e[w.itemName]=c=x.matches[a].model,b=w.modelMapper(i,e),v(i,b),l.$setValidity("editable",!0),r(i,{$item:c,$model:b,$label:w.viewMapper(i,e)}),A(),d(function(){j[0].focus()},0,!1)},j.bind("keydown",function(a){0!==x.matches.length&&-1!==h.indexOf(a.which)&&(-1!=x.activeIdx||13!==a.which&&9!==a.which)&&(a.preventDefault(),40===a.which?(x.activeIdx=(x.activeIdx+1)%x.matches.length,x.$digest()):38===a.which?(x.activeIdx=(x.activeIdx>0?x.activeIdx:x.matches.length)-1,x.$digest()):13===a.which||9===a.which?x.$apply(function(){x.select(x.activeIdx)}):27===a.which&&(a.stopPropagation(),A(),x.$digest()))}),j.bind("blur",function(a){m=!1});var G=function(a){j[0]!==a.target&&(A(),x.$digest())};e.bind("click",G),i.$on("$destroy",function(){e.unbind("click",G),t&&H.remove()});var H=a(z)(x);t?e.find("body").append(H):j.after(H)}}}]).directive("typeaheadPopup",function(){return{restrict:"EA",scope:{matches:"=",query:"=",active:"=",position:"=",select:"&"},replace:!0,templateUrl:"template/typeahead/typeahead-popup.html",link:function(a,b,c){a.templateUrl=c.templateUrl,a.isOpen=function(){return a.matches.length>0},a.isActive=function(b){return a.active==b},a.selectActive=function(b){a.active=b},a.selectMatch=function(b){a.select({activeIdx:b})}}}}).directive("typeaheadMatch",["$http","$templateCache","$compile","$parse",function(a,b,c,d){return{restrict:"EA",scope:{index:"=",match:"=",query:"="},link:function(e,f,g){var h=d(g.templateUrl)(e.$parent)||"template/typeahead/typeahead-match.html";a.get(h,{cache:b}).success(function(a){f.replaceWith(c(a.trim())(e))})}}}]).filter("typeaheadHighlight",function(){function a(a){return a.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")}return function(b,c){return c?(""+b).replace(new RegExp(a(c),"gi"),"<strong>$&</strong>"):b}}),angular.module("ui.bootstrap.position",[]).factory("$position",["$document","$window",function(a,b){function c(a,c){return a.currentStyle?a.currentStyle[c]:b.getComputedStyle?b.getComputedStyle(a)[c]:a.style[c]}function d(a){return"static"===(c(a,"position")||"static")}var e=function(b){for(var c=a[0],e=b.offsetParent||c;e&&e!==c&&d(e);)e=e.offsetParent;return e||c};return{position:function(b){var c=this.offset(b),d={top:0,left:0},f=e(b[0]);f!=a[0]&&(d=this.offset(angular.element(f)),d.top+=f.clientTop-f.scrollTop,d.left+=f.clientLeft-f.scrollLeft);var g=b[0].getBoundingClientRect();return{width:g.width||b.prop("offsetWidth"),height:g.height||b.prop("offsetHeight"),top:c.top-d.top,left:c.left-d.left}},offset:function(c){var d=c[0].getBoundingClientRect();return{width:d.width||c.prop("offsetWidth"),height:d.height||c.prop("offsetHeight"),top:d.top+(b.pageYOffset||a[0].documentElement.scrollTop),left:d.left+(b.pageXOffset||a[0].documentElement.scrollLeft)}},positionElements:function(a,b,c,d){var e,f,g,h,i=c.split("-"),j=i[0],k=i[1]||"center";e=d?this.offset(a):this.position(a),f=b.prop("offsetWidth"),g=b.prop("offsetHeight");var l={center:function(){return e.left+e.width/2-f/2},left:function(){return e.left},right:function(){return e.left+e.width}},m={center:function(){return e.top+e.height/2-g/2},top:function(){return e.top},bottom:function(){return e.top+e.height}};switch(j){case"right":h={top:m[k](),left:l[j]()};break;case"left":h={top:m[k](),left:e.left-f};break;case"bottom":h={top:m[j](),left:l[k]()};break;default:h={top:e.top-g,left:l[k]()}}return h}}}]),angular.module("ui.bootstrap.bindHtml",[]).directive("bindHtmlUnsafe",function(){return function(a,b,c){b.addClass("ng-binding").data("$binding",c.bindHtmlUnsafe),a.$watch(c.bindHtmlUnsafe,function(a){b.html(a||"")})}}),angular.module("ui.bootstrap.modal",["ui.bootstrap.transition"]).factory("$$stackedMap",function(){return{createNew:function(){var a=[];return{add:function(b,c){a.push({key:b,value:c})},get:function(b){for(var c=0;c<a.length;c++)if(b==a[c].key)return a[c]},keys:function(){for(var b=[],c=0;c<a.length;c++)b.push(a[c].key);return b},top:function(){return a[a.length-1]},remove:function(b){for(var c=-1,d=0;d<a.length;d++)if(b==a[d].key){c=d;break}return a.splice(c,1)[0]},removeTop:function(){return a.splice(a.length-1,1)[0]},length:function(){return a.length}}}}}).directive("modalBackdrop",["$timeout",function(a){return{restrict:"EA",replace:!0,templateUrl:"template/modal/backdrop.html",link:function(b,c,d){b.backdropClass=d.backdropClass||"",b.animate=!1,a(function(){b.animate=!0})}}}]).directive("modalWindow",["$modalStack","$timeout",function(a,b){return{restrict:"EA",scope:{index:"@",animate:"="},replace:!0,transclude:!0,templateUrl:function(a,b){return b.templateUrl||"template/modal/window.html"},link:function(c,d,e){d.addClass(e.windowClass||""),c.size=e.size,b(function(){c.animate=!0,d[0].querySelectorAll("[autofocus]").length||d[0].focus()}),c.close=function(b){var c=a.getTop();c&&c.value.backdrop&&"static"!=c.value.backdrop&&b.target===b.currentTarget&&(b.preventDefault(),b.stopPropagation(),a.dismiss(c.key,"backdrop click"))}}}}]).directive("modalTransclude",function(){return{link:function(a,b,c,d,e){e(a.$parent,function(a){b.empty(),b.append(a)})}}}).factory("$modalStack",["$transition","$timeout","$document","$compile","$rootScope","$$stackedMap",function(a,b,c,d,e,f){function g(){for(var a=-1,b=n.keys(),c=0;c<b.length;c++)n.get(b[c]).value.backdrop&&(a=c);return a}function h(a){var b=c.find("body").eq(0),d=n.get(a).value;n.remove(a),j(d.modalDomEl,d.modalScope,300,function(){d.modalScope.$destroy(),b.toggleClass(m,n.length()>0),i()})}function i(){if(k&&-1==g()){var a=l;j(k,l,150,function(){a.$destroy(),a=null}),k=void 0,l=void 0}}function j(c,d,e,f){function g(){g.done||(g.done=!0,c.remove(),f&&f())}d.animate=!1;var h=a.transitionEndEventName;if(h){var i=b(g,e);c.bind(h,function(){b.cancel(i),g(),d.$apply()})}else b(g)}var k,l,m="modal-open",n=f.createNew(),o={};return e.$watch(g,function(a){l&&(l.index=a)}),c.bind("keydown",function(a){var b;27===a.which&&(b=n.top())&&b.value.keyboard&&(a.preventDefault(),e.$apply(function(){o.dismiss(b.key,"escape key press")}))}),o.open=function(a,b){n.add(a,{deferred:b.deferred,modalScope:b.scope,backdrop:b.backdrop,keyboard:b.keyboard});var f=c.find("body").eq(0),h=g();if(h>=0&&!k){l=e.$new(!0),l.index=h;var i=angular.element("<div modal-backdrop></div>");i.attr("backdrop-class",b.backdropClass),k=d(i)(l),f.append(k)}var j=angular.element("<div modal-window></div>");j.attr({"template-url":b.windowTemplateUrl,"window-class":b.windowClass,size:b.size,index:n.length()-1,animate:"animate"}).html(b.content);var o=d(j)(b.scope);n.top().value.modalDomEl=o,f.append(o),f.addClass(m)},o.close=function(a,b){var c=n.get(a);c&&(c.value.deferred.resolve(b),h(a))},o.dismiss=function(a,b){var c=n.get(a);c&&(c.value.deferred.reject(b),h(a))},o.dismissAll=function(a){for(var b=this.getTop();b;)this.dismiss(b.key,a),b=this.getTop()},o.getTop=function(){return n.top()},o}]).provider("$modal",function(){var a={options:{backdrop:!0,keyboard:!0},$get:["$injector","$rootScope","$q","$http","$templateCache","$controller","$modalStack",function(b,c,d,e,f,g,h){function i(a){return a.template?d.when(a.template):e.get(angular.isFunction(a.templateUrl)?a.templateUrl():a.templateUrl,{cache:f}).then(function(a){return a.data})}function j(a){var c=[];return angular.forEach(a,function(a){(angular.isFunction(a)||angular.isArray(a))&&c.push(d.when(b.invoke(a)))}),c}var k={};return k.open=function(b){var e=d.defer(),f=d.defer(),k={result:e.promise,opened:f.promise,close:function(a){h.close(k,a)},dismiss:function(a){h.dismiss(k,a)}};if(b=angular.extend({},a.options,b),b.resolve=b.resolve||{},!b.template&&!b.templateUrl)throw new Error("One of template or templateUrl options is required.");var l=d.all([i(b)].concat(j(b.resolve)));return l.then(function(a){var d=(b.scope||c).$new();d.$close=k.close,d.$dismiss=k.dismiss;var f,i={},j=1;b.controller&&(i.$scope=d,i.$modalInstance=k,angular.forEach(b.resolve,function(b,c){i[c]=a[j++]}),f=g(b.controller,i),b.controllerAs&&(d[b.controllerAs]=f)),h.open(k,{scope:d,deferred:e,content:a[0],backdrop:b.backdrop,keyboard:b.keyboard,backdropClass:b.backdropClass,windowClass:b.windowClass,windowTemplateUrl:b.windowTemplateUrl,size:b.size})},function(a){e.reject(a)}),l.then(function(){f.resolve(!0)},function(){f.reject(!1)}),k},k}]};return a}),angular.module("ui.bootstrap",["ui.bootstrap.collapse","ui.bootstrap.transition","ui.bootstrap.dropdown","ui.bootstrap.typeahead","ui.bootstrap.position","ui.bootstrap.bindHtml","ui.bootstrap.modal"]),angular.module("ui.bootstrap.collapse",["ui.bootstrap.transition"]).directive("collapse",["$transition",function(a){return{link:function(b,c,d){function e(b){function d(){j===e&&(j=void 0)}var e=a(c,b);return j&&j.cancel(),j=e,e.then(d,d),e}function f(){k?(k=!1,g()):(c.removeClass("collapse").addClass("collapsing"),e({height:c[0].scrollHeight+"px"}).then(g))}function g(){c.removeClass("collapsing"),c.addClass("collapse in"),c.css({height:"auto"})}function h(){k?(k=!1,i(),c.css({height:0})):(c.css({height:c[0].scrollHeight+"px"}),c[0].offsetWidth,c.removeClass("collapse in").addClass("collapsing"),e({height:0}).then(i))}function i(){c.removeClass("collapsing"),c.addClass("collapse")}var j,k=!0;b.$watch(d.collapse,function(a){a?h():f()})}}}]),angular.module("ui.bootstrap.transition",[]).factory("$transition",["$q","$timeout","$rootScope",function(a,b,c){function d(a){for(var b in a)if(void 0!==f.style[b])return a[b]}var e=function(d,f,g){g=g||{};var h=a.defer(),i=e[g.animation?"animationEndEventName":"transitionEndEventName"],j=function(){c.$apply(function(){d.unbind(i,j),h.resolve(d)})};return i&&d.bind(i,j),b(function(){angular.isString(f)?d.addClass(f):angular.isFunction(f)?f(d):angular.isObject(f)&&d.css(f),i||h.resolve(d)}),h.promise.cancel=function(){i&&d.unbind(i,j),h.reject("Transition cancelled")},h.promise},f=document.createElement("trans"),g={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",transition:"transitionend"},h={WebkitTransition:"webkitAnimationEnd",MozTransition:"animationend",OTransition:"oAnimationEnd",transition:"animationend"};return e.transitionEndEventName=d(g),e.animationEndEventName=d(h),e}]),angular.module("ui.bootstrap.dropdown",[]).constant("dropdownConfig",{openClass:"open"}).service("dropdownService",["$document",function(a){var b=null;this.open=function(e){b||(a.bind("click",c),a.bind("keydown",d)),b&&b!==e&&(b.isOpen=!1),b=e},this.close=function(e){b===e&&(b=null,a.unbind("click",c),a.unbind("keydown",d))};var c=function(a){if(b){var c=b.getToggleElement();a&&c&&c[0].contains(a.target)||b.$apply(function(){b.isOpen=!1})}},d=function(a){27===a.which&&(b.focusToggleElement(),c())}}]).controller("DropdownController",["$scope","$attrs","$parse","dropdownConfig","dropdownService","$animate",function(a,b,c,d,e,f){var g,h=this,i=a.$new(),j=d.openClass,k=angular.noop,l=b.onToggle?c(b.onToggle):angular.noop;this.init=function(d){h.$element=d,b.isOpen&&(g=c(b.isOpen),k=g.assign,a.$watch(g,function(a){i.isOpen=!!a}))},this.toggle=function(a){return i.isOpen=arguments.length?!!a:!i.isOpen},this.isOpen=function(){return i.isOpen},i.getToggleElement=function(){return h.toggleElement},i.focusToggleElement=function(){h.toggleElement&&h.toggleElement[0].focus()},i.$watch("isOpen",function(b,c){f[b?"addClass":"removeClass"](h.$element,j),b?(i.focusToggleElement(),e.open(i)):e.close(i),k(a,b),angular.isDefined(b)&&b!==c&&l(a,{open:!!b})}),a.$on("$locationChangeSuccess",function(){i.isOpen=!1}),a.$on("$destroy",function(){i.$destroy()})}]).directive("dropdown",function(){return{controller:"DropdownController",link:function(a,b,c,d){d.init(b)}}}).directive("dropdownToggle",function(){return{require:"?^dropdown",link:function(a,b,c,d){if(d){d.toggleElement=b;var e=function(e){e.preventDefault(),b.hasClass("disabled")||c.disabled||a.$apply(function(){d.toggle()})};b.bind("click",e),b.attr({"aria-haspopup":!0,"aria-expanded":!1}),a.$watch(d.isOpen,function(a){b.attr("aria-expanded",!!a)}),a.$on("$destroy",function(){b.unbind("click",e)})}}}}),angular.module("ui.bootstrap.typeahead",["ui.bootstrap.position","ui.bootstrap.bindHtml"]).factory("typeaheadParser",["$parse",function(a){var b=/^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w\d]*))\s+in\s+([\s\S]+?)$/;return{parse:function(c){var d=c.match(b);if(!d)throw new Error('Expected typeahead specification in form of "_modelValue_ (as _label_)? for _item_ in _collection_" but got "'+c+'".');return{itemName:d[3],source:a(d[4]),viewMapper:a(d[2]||d[1]),modelMapper:a(d[1])}}}}]).directive("typeahead",["$compile","$parse","$q","$timeout","$document","$position","typeaheadParser",function(a,b,c,d,e,f,g){var h=[9,13,27,38,40];return{require:"ngModel",link:function(i,j,k,l){var m,n=i.$eval(k.typeaheadMinLength)||1,o=i.$eval(k.typeaheadWaitMs)||0,p=!1!==i.$eval(k.typeaheadEditable),q=b(k.typeaheadLoading).assign||angular.noop,r=b(k.typeaheadOnSelect),s=k.typeaheadInputFormatter?b(k.typeaheadInputFormatter):void 0,t=!!k.typeaheadAppendToBody&&i.$eval(k.typeaheadAppendToBody),u=!1!==i.$eval(k.typeaheadFocusFirst),v=b(k.ngModel).assign,w=g.parse(k.typeahead),x=i.$new();i.$on("$destroy",function(){x.$destroy()});var y="typeahead-"+x.$id+"-"+Math.floor(1e4*Math.random());j.attr({"aria-autocomplete":"list","aria-expanded":!1,"aria-owns":y});var z=angular.element("<div typeahead-popup></div>");z.attr({id:y,matches:"matches",active:"activeIdx",select:"select(activeIdx)",query:"query",position:"position"}),angular.isDefined(k.typeaheadTemplateUrl)&&z.attr("template-url",k.typeaheadTemplateUrl);var A=function(){x.matches=[],x.activeIdx=-1,j.attr("aria-expanded",!1)},B=function(a){return y+"-option-"+a};x.$watch("activeIdx",function(a){0>a?j.removeAttr("aria-activedescendant"):j.attr("aria-activedescendant",B(a))});var C=function(a){var b={$viewValue:a};q(i,!0),c.when(w.source(i,b)).then(function(c){var d=a===l.$viewValue;if(d&&m)if(c.length>0){x.activeIdx=u?0:-1,x.matches.length=0;for(var e=0;e<c.length;e++)b[w.itemName]=c[e],x.matches.push({id:B(e),label:w.viewMapper(x,b),model:c[e]});x.query=a,x.position=t?f.offset(j):f.position(j),x.position.top=x.position.top+j.prop("offsetHeight"),j.attr("aria-expanded",!0)}else A();d&&q(i,!1)},function(){A(),q(i,!1)})};A(),x.query=void 0;var D,E=function(a){D=d(function(){C(a)},o)},F=function(){D&&d.cancel(D)};l.$parsers.unshift(function(a){return m=!0,a&&a.length>=n?o>0?(F(),E(a)):C(a):(q(i,!1),F(),A()),p?a:a?void l.$setValidity("editable",!1):(l.$setValidity("editable",!0),a)}),l.$formatters.push(function(a){var b,c,d={};return s?(d.$model=a,s(i,d)):(d[w.itemName]=a,b=w.viewMapper(i,d),d[w.itemName]=void 0,c=w.viewMapper(i,d),b!==c?b:a)}),x.select=function(a){var b,c,e={};e[w.itemName]=c=x.matches[a].model,b=w.modelMapper(i,e),v(i,b),l.$setValidity("editable",!0),r(i,{$item:c,$model:b,$label:w.viewMapper(i,e)}),A(),d(function(){j[0].focus()},0,!1)},j.bind("keydown",function(a){0!==x.matches.length&&-1!==h.indexOf(a.which)&&(-1!=x.activeIdx||13!==a.which&&9!==a.which)&&(a.preventDefault(),40===a.which?(x.activeIdx=(x.activeIdx+1)%x.matches.length,x.$digest()):38===a.which?(x.activeIdx=(x.activeIdx>0?x.activeIdx:x.matches.length)-1,x.$digest()):13===a.which||9===a.which?x.$apply(function(){x.select(x.activeIdx)}):27===a.which&&(a.stopPropagation(),A(),x.$digest()))}),j.bind("blur",function(){m=!1});var G=function(a){j[0]!==a.target&&(A(),x.$digest())};e.bind("click",G),i.$on("$destroy",function(){e.unbind("click",G),t&&H.remove()});var H=a(z)(x);t?e.find("body").append(H):j.after(H)}}}]).directive("typeaheadPopup",function(){return{restrict:"EA",scope:{matches:"=",query:"=",active:"=",position:"=",select:"&"},replace:!0,templateUrl:"template/typeahead/typeahead-popup.html",link:function(a,b,c){a.templateUrl=c.templateUrl,a.isOpen=function(){return a.matches.length>0},a.isActive=function(b){return a.active==b},a.selectActive=function(b){a.active=b},a.selectMatch=function(b){a.select({activeIdx:b})}}}}).directive("typeaheadMatch",["$http","$templateCache","$compile","$parse",function(a,b,c,d){return{restrict:"EA",scope:{index:"=",match:"=",query:"="},link:function(e,f,g){var h=d(g.templateUrl)(e.$parent)||"template/typeahead/typeahead-match.html";a.get(h,{cache:b}).success(function(a){f.replaceWith(c(a.trim())(e))})}}}]).filter("typeaheadHighlight",function(){function a(a){return a.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")}return function(b,c){return c?(""+b).replace(new RegExp(a(c),"gi"),"<strong>$&</strong>"):b}}),angular.module("ui.bootstrap.position",[]).factory("$position",["$document","$window",function(a,b){function c(a,c){return a.currentStyle?a.currentStyle[c]:b.getComputedStyle?b.getComputedStyle(a)[c]:a.style[c]}function d(a){return"static"===(c(a,"position")||"static")}var e=function(b){for(var c=a[0],e=b.offsetParent||c;e&&e!==c&&d(e);)e=e.offsetParent;return e||c};return{position:function(b){var c=this.offset(b),d={top:0,left:0},f=e(b[0]);f!=a[0]&&(d=this.offset(angular.element(f)),d.top+=f.clientTop-f.scrollTop,d.left+=f.clientLeft-f.scrollLeft);var g=b[0].getBoundingClientRect();return{width:g.width||b.prop("offsetWidth"),height:g.height||b.prop("offsetHeight"),top:c.top-d.top,left:c.left-d.left}},offset:function(c){var d=c[0].getBoundingClientRect();return{width:d.width||c.prop("offsetWidth"),height:d.height||c.prop("offsetHeight"),top:d.top+(b.pageYOffset||a[0].documentElement.scrollTop),left:d.left+(b.pageXOffset||a[0].documentElement.scrollLeft)}},positionElements:function(a,b,c,d){var e,f,g,h,i=c.split("-"),j=i[0],k=i[1]||"center";e=d?this.offset(a):this.position(a),f=b.prop("offsetWidth"),g=b.prop("offsetHeight");var l={center:function(){return e.left+e.width/2-f/2},left:function(){return e.left},right:function(){return e.left+e.width}},m={center:function(){return e.top+e.height/2-g/2},top:function(){return e.top},bottom:function(){return e.top+e.height}};switch(j){case"right":h={top:m[k](),left:l[j]()};break;case"left":h={top:m[k](),left:e.left-f};break;case"bottom":h={top:m[j](),left:l[k]()};break;default:h={top:e.top-g,left:l[k]()}}return h}}}]),angular.module("ui.bootstrap.bindHtml",[]).directive("bindHtmlUnsafe",function(){return function(a,b,c){b.addClass("ng-binding").data("$binding",c.bindHtmlUnsafe),a.$watch(c.bindHtmlUnsafe,function(a){b.html(a||"")})}}),angular.module("ui.bootstrap.modal",["ui.bootstrap.transition"]).factory("$$stackedMap",function(){return{createNew:function(){var a=[];return{add:function(b,c){a.push({key:b,value:c})},get:function(b){for(var c=0;c<a.length;c++)if(b==a[c].key)return a[c]},keys:function(){for(var b=[],c=0;c<a.length;c++)b.push(a[c].key);return b},top:function(){return a[a.length-1]},remove:function(b){for(var c=-1,d=0;d<a.length;d++)if(b==a[d].key){c=d;break}return a.splice(c,1)[0]},removeTop:function(){return a.splice(a.length-1,1)[0]},length:function(){return a.length}}}}}).directive("modalBackdrop",["$timeout",function(a){return{restrict:"EA",replace:!0,templateUrl:"template/modal/backdrop.html",link:function(b,c,d){b.backdropClass=d.backdropClass||"",b.animate=!1,a(function(){b.animate=!0})}}}]).directive("modalWindow",["$modalStack","$timeout",function(a,b){return{restrict:"EA",scope:{index:"@",animate:"="},replace:!0,transclude:!0,templateUrl:function(a,b){return b.templateUrl||"template/modal/window.html"},link:function(c,d,e){d.addClass(e.windowClass||""),c.size=e.size,b(function(){c.animate=!0,d[0].querySelectorAll("[autofocus]").length||d[0].focus()}),c.close=function(b){var c=a.getTop();c&&c.value.backdrop&&"static"!=c.value.backdrop&&b.target===b.currentTarget&&(b.preventDefault(),b.stopPropagation(),a.dismiss(c.key,"backdrop click"))}}}}]).directive("modalTransclude",function(){return{link:function(a,b,c,d,e){e(a.$parent,function(a){b.empty(),b.append(a)})}}}).factory("$modalStack",["$transition","$timeout","$document","$compile","$rootScope","$$stackedMap",function(a,b,c,d,e,f){function g(){for(var a=-1,b=n.keys(),c=0;c<b.length;c++)n.get(b[c]).value.backdrop&&(a=c);return a}function h(a){var b=c.find("body").eq(0),d=n.get(a).value;n.remove(a),j(d.modalDomEl,d.modalScope,300,function(){d.modalScope.$destroy(),b.toggleClass(m,n.length()>0),i()})}function i(){if(k&&-1==g()){var a=l;j(k,l,150,function(){a.$destroy(),a=null}),k=void 0,l=void 0}}function j(c,d,e,f){function g(){g.done||(g.done=!0,c.remove(),f&&f())}d.animate=!1;var h=a.transitionEndEventName;if(h){var i=b(g,e);c.bind(h,function(){b.cancel(i),g(),d.$apply()})}else b(g)}var k,l,m="modal-open",n=f.createNew(),o={};return e.$watch(g,function(a){l&&(l.index=a)}),c.bind("keydown",function(a){var b;27===a.which&&(b=n.top())&&b.value.keyboard&&(a.preventDefault(),e.$apply(function(){o.dismiss(b.key,"escape key press")}))}),o.open=function(a,b){n.add(a,{deferred:b.deferred,modalScope:b.scope,backdrop:b.backdrop,keyboard:b.keyboard});var f=c.find("body").eq(0),h=g();if(h>=0&&!k){l=e.$new(!0),l.index=h;var i=angular.element("<div modal-backdrop></div>");i.attr("backdrop-class",b.backdropClass),k=d(i)(l),f.append(k)}var j=angular.element("<div modal-window></div>");j.attr({"template-url":b.windowTemplateUrl,"window-class":b.windowClass,size:b.size,index:n.length()-1,animate:"animate"}).html(b.content);var o=d(j)(b.scope);n.top().value.modalDomEl=o,f.append(o),f.addClass(m)},o.close=function(a,b){var c=n.get(a);c&&(c.value.deferred.resolve(b),h(a))},o.dismiss=function(a,b){var c=n.get(a);c&&(c.value.deferred.reject(b),h(a))},o.dismissAll=function(a){for(var b=this.getTop();b;)this.dismiss(b.key,a),b=this.getTop()},o.getTop=function(){return n.top()},o}]).provider("$modal",function(){var a={options:{backdrop:!0,keyboard:!0},$get:["$injector","$rootScope","$q","$http","$templateCache","$controller","$modalStack",function(b,c,d,e,f,g,h){function i(a){return a.template?d.when(a.template):e.get(angular.isFunction(a.templateUrl)?a.templateUrl():a.templateUrl,{cache:f}).then(function(a){return a.data})}function j(a){var c=[];return angular.forEach(a,function(a){(angular.isFunction(a)||angular.isArray(a))&&c.push(d.when(b.invoke(a)))}),c}var k={};return k.open=function(b){var e=d.defer(),f=d.defer(),k={result:e.promise,opened:f.promise,close:function(a){h.close(k,a)},dismiss:function(a){h.dismiss(k,a)}};if(b=angular.extend({},a.options,b),b.resolve=b.resolve||{},!b.template&&!b.templateUrl)throw new Error("One of template or templateUrl options is required.");var l=d.all([i(b)].concat(j(b.resolve)));return l.then(function(a){var d=(b.scope||c).$new();d.$close=k.close,d.$dismiss=k.dismiss;var f,i={},j=1;b.controller&&(i.$scope=d,i.$modalInstance=k,angular.forEach(b.resolve,function(b,c){i[c]=a[j++]}),f=g(b.controller,i),b.controllerAs&&(d[b.controllerAs]=f)),h.open(k,{scope:d,deferred:e,content:a[0],backdrop:b.backdrop,keyboard:b.keyboard,backdropClass:b.backdropClass,windowClass:b.windowClass,windowTemplateUrl:b.windowTemplateUrl,size:b.size})},function(a){e.reject(a)}),l.then(function(){f.resolve(!0)},function(){f.reject(!1)}),k},k}]};return a}),angular.module("ui.bootstrap",["ui.bootstrap.tpls","ui.bootstrap.collapse","ui.bootstrap.transition","ui.bootstrap.dropdown","ui.bootstrap.typeahead","ui.bootstrap.position","ui.bootstrap.bindHtml","ui.bootstrap.modal"]),angular.module("ui.bootstrap.tpls",["template/typeahead/typeahead-match.html","template/typeahead/typeahead-popup.html","template/modal/backdrop.html","template/modal/window.html"]),angular.module("ui.bootstrap.collapse",["ui.bootstrap.transition"]).directive("collapse",["$transition",function(a){return{link:function(b,c,d){function e(b){function d(){j===e&&(j=void 0)}var e=a(c,b);return j&&j.cancel(),j=e,e.then(d,d),e}function f(){k?(k=!1,g()):(c.removeClass("collapse").addClass("collapsing"),e({height:c[0].scrollHeight+"px"}).then(g))}function g(){c.removeClass("collapsing"),c.addClass("collapse in"),c.css({height:"auto"})}function h(){if(k)k=!1,i(),c.css({height:0});else{c.css({height:c[0].scrollHeight+"px"});c[0].offsetWidth;c.removeClass("collapse in").addClass("collapsing"),e({height:0}).then(i)}}function i(){c.removeClass("collapsing"),c.addClass("collapse")}var j,k=!0;b.$watch(d.collapse,function(a){a?h():f()})}}}]),angular.module("ui.bootstrap.transition",[]).factory("$transition",["$q","$timeout","$rootScope",function(a,b,c){function d(a){for(var b in a)if(void 0!==f.style[b])return a[b]}var e=function(d,f,g){g=g||{};var h=a.defer(),i=e[g.animation?"animationEndEventName":"transitionEndEventName"],j=function(a){c.$apply(function(){d.unbind(i,j),h.resolve(d)})};return i&&d.bind(i,j),b(function(){angular.isString(f)?d.addClass(f):angular.isFunction(f)?f(d):angular.isObject(f)&&d.css(f),i||h.resolve(d)}),h.promise.cancel=function(){i&&d.unbind(i,j),h.reject("Transition cancelled")},h.promise},f=document.createElement("trans"),g={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",transition:"transitionend"},h={WebkitTransition:"webkitAnimationEnd",MozTransition:"animationend",OTransition:"oAnimationEnd",transition:"animationend"};return e.transitionEndEventName=d(g),e.animationEndEventName=d(h),e}]),angular.module("ui.bootstrap.dropdown",[]).constant("dropdownConfig",{openClass:"open"}).service("dropdownService",["$document",function(a){var b=null;this.open=function(e){b||(a.bind("click",c),a.bind("keydown",d)),b&&b!==e&&(b.isOpen=!1),b=e},this.close=function(e){b===e&&(b=null,a.unbind("click",c),a.unbind("keydown",d))};var c=function(a){if(b){var c=b.getToggleElement();a&&c&&c[0].contains(a.target)||b.$apply(function(){b.isOpen=!1})}},d=function(a){27===a.which&&(b.focusToggleElement(),c())}}]).controller("DropdownController",["$scope","$attrs","$parse","dropdownConfig","dropdownService","$animate",function(a,b,c,d,e,f){var g,h=this,i=a.$new(),j=d.openClass,k=angular.noop,l=b.onToggle?c(b.onToggle):angular.noop;this.init=function(d){h.$element=d,b.isOpen&&(g=c(b.isOpen),k=g.assign,a.$watch(g,function(a){i.isOpen=!!a}))},this.toggle=function(a){return i.isOpen=arguments.length?!!a:!i.isOpen},this.isOpen=function(){return i.isOpen},i.getToggleElement=function(){return h.toggleElement},i.focusToggleElement=function(){h.toggleElement&&h.toggleElement[0].focus()},i.$watch("isOpen",function(b,c){f[b?"addClass":"removeClass"](h.$element,j),b?(i.focusToggleElement(),e.open(i)):e.close(i),k(a,b),angular.isDefined(b)&&b!==c&&l(a,{open:!!b})}),a.$on("$locationChangeSuccess",function(){i.isOpen=!1}),a.$on("$destroy",function(){i.$destroy()})}]).directive("dropdown",function(){return{controller:"DropdownController",link:function(a,b,c,d){d.init(b)}}}).directive("dropdownToggle",function(){return{require:"?^dropdown",link:function(a,b,c,d){if(d){d.toggleElement=b;var e=function(e){e.preventDefault(),b.hasClass("disabled")||c.disabled||a.$apply(function(){d.toggle()})};b.bind("click",e),b.attr({"aria-haspopup":!0,"aria-expanded":!1}),a.$watch(d.isOpen,function(a){b.attr("aria-expanded",!!a)}),a.$on("$destroy",function(){b.unbind("click",e)})}}}}),angular.module("ui.bootstrap.typeahead",["ui.bootstrap.position","ui.bootstrap.bindHtml"]).factory("typeaheadParser",["$parse",function(a){var b=/^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w\d]*))\s+in\s+([\s\S]+?)$/;return{parse:function(c){var d=c.match(b);if(!d)throw new Error('Expected typeahead specification in form of "_modelValue_ (as _label_)? for _item_ in _collection_" but got "'+c+'".');return{itemName:d[3],source:a(d[4]),viewMapper:a(d[2]||d[1]),modelMapper:a(d[1])}}}}]).directive("typeahead",["$compile","$parse","$q","$timeout","$document","$position","typeaheadParser",function(a,b,c,d,e,f,g){var h=[9,13,27,38,40];return{require:"ngModel",link:function(i,j,k,l){var m,n=i.$eval(k.typeaheadMinLength)||1,o=i.$eval(k.typeaheadWaitMs)||0,p=!1!==i.$eval(k.typeaheadEditable),q=b(k.typeaheadLoading).assign||angular.noop,r=b(k.typeaheadOnSelect),s=k.typeaheadInputFormatter?b(k.typeaheadInputFormatter):void 0,t=!!k.typeaheadAppendToBody&&i.$eval(k.typeaheadAppendToBody),u=!1!==i.$eval(k.typeaheadFocusFirst),v=b(k.ngModel).assign,w=g.parse(k.typeahead),x=i.$new();i.$on("$destroy",function(){x.$destroy()});var y="typeahead-"+x.$id+"-"+Math.floor(1e4*Math.random());j.attr({"aria-autocomplete":"list","aria-expanded":!1,"aria-owns":y});var z=angular.element("<div typeahead-popup></div>");z.attr({id:y,matches:"matches",active:"activeIdx",select:"select(activeIdx)",query:"query",position:"position"}),angular.isDefined(k.typeaheadTemplateUrl)&&z.attr("template-url",k.typeaheadTemplateUrl);var A=function(){x.matches=[],x.activeIdx=-1,j.attr("aria-expanded",!1)},B=function(a){return y+"-option-"+a};x.$watch("activeIdx",function(a){a<0?j.removeAttr("aria-activedescendant"):j.attr("aria-activedescendant",B(a))});var C=function(a){var b={$viewValue:a};q(i,!0),c.when(w.source(i,b)).then(function(c){var d=a===l.$viewValue;if(d&&m)if(c.length>0){x.activeIdx=u?0:-1,x.matches.length=0;for(var e=0;e<c.length;e++)b[w.itemName]=c[e],x.matches.push({id:B(e),label:w.viewMapper(x,b),model:c[e]});x.query=a,x.position=t?f.offset(j):f.position(j),x.position.top=x.position.top+j.prop("offsetHeight"),j.attr("aria-expanded",!0)}else A();d&&q(i,!1)},function(){A(),q(i,!1)})};A(),x.query=void 0;var D,E=function(a){D=d(function(){C(a)},o)},F=function(){D&&d.cancel(D)};l.$parsers.unshift(function(a){return m=!0,a&&a.length>=n?o>0?(F(),E(a)):C(a):(q(i,!1),F(),A()),p?a:a?void l.$setValidity("editable",!1):(l.$setValidity("editable",!0),a)}),l.$formatters.push(function(a){var b,c,d={};return s?(d.$model=a,s(i,d)):(d[w.itemName]=a,b=w.viewMapper(i,d),d[w.itemName]=void 0,c=w.viewMapper(i,d),b!==c?b:a)}),x.select=function(a){var b,c,e={};e[w.itemName]=c=x.matches[a].model,b=w.modelMapper(i,e),v(i,b),l.$setValidity("editable",!0),r(i,{$item:c,$model:b,$label:w.viewMapper(i,e)}),A(),d(function(){j[0].focus()},0,!1)},j.bind("keydown",function(a){0!==x.matches.length&&-1!==h.indexOf(a.which)&&(-1!=x.activeIdx||13!==a.which&&9!==a.which)&&(a.preventDefault(),40===a.which?(x.activeIdx=(x.activeIdx+1)%x.matches.length,x.$digest()):38===a.which?(x.activeIdx=(x.activeIdx>0?x.activeIdx:x.matches.length)-1,x.$digest()):13===a.which||9===a.which?x.$apply(function(){x.select(x.activeIdx)}):27===a.which&&(a.stopPropagation(),A(),x.$digest()))}),j.bind("blur",function(a){m=!1});var G=function(a){j[0]!==a.target&&(A(),x.$digest())};e.bind("click",G),i.$on("$destroy",function(){e.unbind("click",G),t&&H.remove()});var H=a(z)(x);t?e.find("body").append(H):j.after(H)}}}]).directive("typeaheadPopup",function(){return{restrict:"EA",scope:{matches:"=",query:"=",active:"=",position:"=",select:"&"},replace:!0,templateUrl:"template/typeahead/typeahead-popup.html",link:function(a,b,c){a.templateUrl=c.templateUrl,a.isOpen=function(){return a.matches.length>0},a.isActive=function(b){return a.active==b},a.selectActive=function(b){a.active=b},a.selectMatch=function(b){a.select({activeIdx:b})}}}}).directive("typeaheadMatch",["$http","$templateCache","$compile","$parse",function(a,b,c,d){return{restrict:"EA",scope:{index:"=",match:"=",query:"="},link:function(e,f,g){var h=d(g.templateUrl)(e.$parent)||"template/typeahead/typeahead-match.html";a.get(h,{cache:b}).success(function(a){f.replaceWith(c(a.trim())(e))})}}}]).filter("typeaheadHighlight",function(){function a(a){return a.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")}return function(b,c){return c?(""+b).replace(new RegExp(a(c),"gi"),"<strong>$&</strong>"):b}}),angular.module("ui.bootstrap.position",[]).factory("$position",["$document","$window",function(a,b){function c(a,c){return a.currentStyle?a.currentStyle[c]:b.getComputedStyle?b.getComputedStyle(a)[c]:a.style[c]}function d(a){return"static"===(c(a,"position")||"static")}var e=function(b){for(var c=a[0],e=b.offsetParent||c;e&&e!==c&&d(e);)e=e.offsetParent;return e||c};return{position:function(b){var c=this.offset(b),d={top:0,left:0},f=e(b[0]);f!=a[0]&&(d=this.offset(angular.element(f)),d.top+=f.clientTop-f.scrollTop,d.left+=f.clientLeft-f.scrollLeft);var g=b[0].getBoundingClientRect();return{width:g.width||b.prop("offsetWidth"),height:g.height||b.prop("offsetHeight"),top:c.top-d.top,left:c.left-d.left}},offset:function(c){var d=c[0].getBoundingClientRect();return{width:d.width||c.prop("offsetWidth"),height:d.height||c.prop("offsetHeight"),top:d.top+(b.pageYOffset||a[0].documentElement.scrollTop),left:d.left+(b.pageXOffset||a[0].documentElement.scrollLeft)}},positionElements:function(a,b,c,d){var e,f,g,h,i=c.split("-"),j=i[0],k=i[1]||"center";e=d?this.offset(a):this.position(a),f=b.prop("offsetWidth"),g=b.prop("offsetHeight");var l={center:function(){return e.left+e.width/2-f/2},left:function(){return e.left},right:function(){return e.left+e.width}},m={center:function(){return e.top+e.height/2-g/2},top:function(){return e.top},bottom:function(){return e.top+e.height}};switch(j){case"right":h={top:m[k](),left:l[j]()};break;case"left":h={top:m[k](),left:e.left-f};break;case"bottom":h={top:m[j](),left:l[k]()};break;default:h={top:e.top-g,left:l[k]()}}return h}}}]),angular.module("ui.bootstrap.bindHtml",[]).directive("bindHtmlUnsafe",function(){return function(a,b,c){b.addClass("ng-binding").data("$binding",c.bindHtmlUnsafe),a.$watch(c.bindHtmlUnsafe,function(a){b.html(a||"")})}}),angular.module("ui.bootstrap.modal",["ui.bootstrap.transition"]).factory("$$stackedMap",function(){return{createNew:function(){var a=[];return{add:function(b,c){a.push({key:b,value:c})},get:function(b){for(var c=0;c<a.length;c++)if(b==a[c].key)return a[c]},keys:function(){for(var b=[],c=0;c<a.length;c++)b.push(a[c].key);return b},top:function(){return a[a.length-1]},remove:function(b){for(var c=-1,d=0;d<a.length;d++)if(b==a[d].key){c=d;break}return a.splice(c,1)[0]},removeTop:function(){return a.splice(a.length-1,1)[0]},length:function(){return a.length}}}}}).directive("modalBackdrop",["$timeout",function(a){return{restrict:"EA",replace:!0,templateUrl:"template/modal/backdrop.html",link:function(b,c,d){b.backdropClass=d.backdropClass||"",b.animate=!1,a(function(){b.animate=!0})}}}]).directive("modalWindow",["$modalStack","$timeout",function(a,b){return{restrict:"EA",scope:{index:"@",animate:"="},replace:!0,transclude:!0,templateUrl:function(a,b){return b.templateUrl||"template/modal/window.html"},link:function(c,d,e){d.addClass(e.windowClass||""),c.size=e.size,b(function(){c.animate=!0,d[0].querySelectorAll("[autofocus]").length||d[0].focus()}),c.close=function(b){var c=a.getTop();c&&c.value.backdrop&&"static"!=c.value.backdrop&&b.target===b.currentTarget&&(b.preventDefault(),b.stopPropagation(),a.dismiss(c.key,"backdrop click"))}}}}]).directive("modalTransclude",function(){return{link:function(a,b,c,d,e){e(a.$parent,function(a){b.empty(),b.append(a)})}}}).factory("$modalStack",["$transition","$timeout","$document","$compile","$rootScope","$$stackedMap",function(a,b,c,d,e,f){function g(){for(var a=-1,b=n.keys(),c=0;c<b.length;c++)n.get(b[c]).value.backdrop&&(a=c);return a}function h(a){var b=c.find("body").eq(0),d=n.get(a).value;n.remove(a),j(d.modalDomEl,d.modalScope,300,function(){d.modalScope.$destroy(),b.toggleClass(m,n.length()>0),i()})}function i(){if(k&&-1==g()){var a=l;j(k,l,150,function(){a.$destroy(),a=null}),k=void 0,l=void 0}}function j(c,d,e,f){function g(){g.done||(g.done=!0,c.remove(),f&&f())}d.animate=!1;var h=a.transitionEndEventName;if(h){var i=b(g,e);c.bind(h,function(){b.cancel(i),g(),d.$apply()})}else b(g)}var k,l,m="modal-open",n=f.createNew(),o={};return e.$watch(g,function(a){l&&(l.index=a)}),c.bind("keydown",function(a){var b;27===a.which&&(b=n.top())&&b.value.keyboard&&(a.preventDefault(),e.$apply(function(){o.dismiss(b.key,"escape key press")}))}),o.open=function(a,b){n.add(a,{deferred:b.deferred,modalScope:b.scope,backdrop:b.backdrop,keyboard:b.keyboard});var f=c.find("body").eq(0),h=g();if(h>=0&&!k){l=e.$new(!0),l.index=h;var i=angular.element("<div modal-backdrop></div>");i.attr("backdrop-class",b.backdropClass),k=d(i)(l),f.append(k)}var j=angular.element("<div modal-window></div>");j.attr({"template-url":b.windowTemplateUrl,"window-class":b.windowClass,size:b.size,index:n.length()-1,animate:"animate"}).html(b.content);var o=d(j)(b.scope);n.top().value.modalDomEl=o,f.append(o),f.addClass(m)},o.close=function(a,b){var c=n.get(a);c&&(c.value.deferred.resolve(b),h(a))},o.dismiss=function(a,b){var c=n.get(a);c&&(c.value.deferred.reject(b),h(a))},o.dismissAll=function(a){for(var b=this.getTop();b;)this.dismiss(b.key,a),b=this.getTop()},o.getTop=function(){return n.top()},o}]).provider("$modal",function(){var a={options:{backdrop:!0,keyboard:!0},$get:["$injector","$rootScope","$q","$http","$templateCache","$controller","$modalStack",function(b,c,d,e,f,g,h){function i(a){return a.template?d.when(a.template):e.get(angular.isFunction(a.templateUrl)?a.templateUrl():a.templateUrl,{cache:f}).then(function(a){return a.data})}function j(a){var c=[];return angular.forEach(a,function(a){(angular.isFunction(a)||angular.isArray(a))&&c.push(d.when(b.invoke(a)))}),c}var k={};return k.open=function(b){var e=d.defer(),f=d.defer(),k={result:e.promise,opened:f.promise,close:function(a){h.close(k,a)},dismiss:function(a){h.dismiss(k,a)}};if(b=angular.extend({},a.options,b),b.resolve=b.resolve||{},!b.template&&!b.templateUrl)throw new Error("One of template or templateUrl options is required.");var l=d.all([i(b)].concat(j(b.resolve)));return l.then(function(a){var d=(b.scope||c).$new();d.$close=k.close,d.$dismiss=k.dismiss;var f,i={},j=1;b.controller&&(i.$scope=d,i.$modalInstance=k,angular.forEach(b.resolve,function(b,c){i[c]=a[j++]}),f=g(b.controller,i),b.controllerAs&&(d[b.controllerAs]=f)),h.open(k,{scope:d,deferred:e,content:a[0],backdrop:b.backdrop,keyboard:b.keyboard,backdropClass:b.backdropClass,windowClass:b.windowClass,windowTemplateUrl:b.windowTemplateUrl,size:b.size})},function(a){e.reject(a)}),l.then(function(){f.resolve(!0)},function(){f.reject(!1)}),k},k}]};return a}),angular.module("template/typeahead/typeahead-match.html",[]).run(["$templateCache",function(a){a.put("template/typeahead/typeahead-match.html",'<a tabindex="-1" bind-html-unsafe="match.label | typeaheadHighlight:query"></a>')}]),angular.module("template/typeahead/typeahead-popup.html",[]).run(["$templateCache",function(a){a.put("template/typeahead/typeahead-popup.html",'<ul class="dropdown-menu" ng-show="isOpen()" ng-style="{top: position.top+\'px\', left: position.left+\'px\'}" style="display: block;" role="listbox" aria-hidden="{{!isOpen()}}">\n <li ng-repeat="match in matches track by $index" ng-class="{active: isActive($index) }" ng-mouseenter="selectActive($index)" ng-click="selectMatch($index)" role="option" id="{{match.id}}">\n <div typeahead-match index="$index" match="match" query="query" template-url="templateUrl"></div>\n </li>\n</ul>\n')}]),angular.module("template/modal/backdrop.html",[]).run(["$templateCache",function(a){a.put("template/modal/backdrop.html",'<div class="modal-backdrop fade {{ backdropClass }}"\n ng-class="{in: animate}"\n ng-style="{\'z-index\': 1040 + (index && 1 || 0) + index*10}"\n></div>\n')}]),angular.module("template/modal/window.html",[]).run(["$templateCache",function(a){a.put("template/modal/window.html",'<div tabindex="-1" role="dialog" class="modal fade" ng-class="{in: animate}" ng-style="{\'z-index\': 1050 + index*10, display: \'block\'}" ng-click="close($event)">\n <div class="modal-dialog" ng-class="{\'modal-sm\': size == \'sm\', \'modal-lg\': size == \'lg\'}"><div class="modal-content" modal-transclude></div></div>\n</div>')}]),angular.module("ui.bootstrap",["ui.bootstrap.tpls","ui.bootstrap.collapse","ui.bootstrap.transition","ui.bootstrap.dropdown","ui.bootstrap.typeahead","ui.bootstrap.position","ui.bootstrap.bindHtml","ui.bootstrap.modal"]),angular.module("ui.bootstrap.tpls",["template/typeahead/typeahead-match.html","template/typeahead/typeahead-popup.html","template/modal/backdrop.html","template/modal/window.html"]),angular.module("ui.bootstrap.collapse",["ui.bootstrap.transition"]).directive("collapse",["$transition",function(a){return{link:function(b,c,d){function e(b){function d(){j===e&&(j=void 0)}var e=a(c,b);return j&&j.cancel(),j=e,e.then(d,d),e}function f(){k?(k=!1,g()):(c.removeClass("collapse").addClass("collapsing"),e({height:c[0].scrollHeight+"px"}).then(g))}function g(){c.removeClass("collapsing"),c.addClass("collapse in"),c.css({height:"auto"})}function h(){k?(k=!1,i(),c.css({height:0})):(c.css({height:c[0].scrollHeight+"px"}),c[0].offsetWidth,c.removeClass("collapse in").addClass("collapsing"),e({height:0}).then(i))}function i(){c.removeClass("collapsing"),c.addClass("collapse")}var j,k=!0;b.$watch(d.collapse,function(a){a?h():f()})}}}]),angular.module("ui.bootstrap.transition",[]).factory("$transition",["$q","$timeout","$rootScope",function(a,b,c){function d(a){for(var b in a)if(void 0!==f.style[b])return a[b]}var e=function(d,f,g){g=g||{};var h=a.defer(),i=e[g.animation?"animationEndEventName":"transitionEndEventName"],j=function(){c.$apply(function(){d.unbind(i,j),h.resolve(d)})};return i&&d.bind(i,j),b(function(){angular.isString(f)?d.addClass(f):angular.isFunction(f)?f(d):angular.isObject(f)&&d.css(f),i||h.resolve(d)}),h.promise.cancel=function(){i&&d.unbind(i,j),h.reject("Transition cancelled")},h.promise},f=document.createElement("trans"),g={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",transition:"transitionend"},h={WebkitTransition:"webkitAnimationEnd",MozTransition:"animationend",OTransition:"oAnimationEnd",transition:"animationend"};return e.transitionEndEventName=d(g),e.animationEndEventName=d(h),e}]),angular.module("ui.bootstrap.dropdown",[]).constant("dropdownConfig",{openClass:"open"}).service("dropdownService",["$document",function(a){var b=null;this.open=function(e){b||(a.bind("click",c),a.bind("keydown",d)),b&&b!==e&&(b.isOpen=!1),b=e},this.close=function(e){b===e&&(b=null,a.unbind("click",c),a.unbind("keydown",d))};var c=function(a){if(b){var c=b.getToggleElement();a&&c&&c[0].contains(a.target)||b.$apply(function(){b.isOpen=!1})}},d=function(a){27===a.which&&(b.focusToggleElement(),c())}}]).controller("DropdownController",["$scope","$attrs","$parse","dropdownConfig","dropdownService","$animate",function(a,b,c,d,e,f){var g,h=this,i=a.$new(),j=d.openClass,k=angular.noop,l=b.onToggle?c(b.onToggle):angular.noop;this.init=function(d){h.$element=d,b.isOpen&&(g=c(b.isOpen),k=g.assign,a.$watch(g,function(a){i.isOpen=!!a}))},this.toggle=function(a){return i.isOpen=arguments.length?!!a:!i.isOpen},this.isOpen=function(){return i.isOpen},i.getToggleElement=function(){return h.toggleElement},i.focusToggleElement=function(){h.toggleElement&&h.toggleElement[0].focus()},i.$watch("isOpen",function(b,c){f[b?"addClass":"removeClass"](h.$element,j),b?(i.focusToggleElement(),e.open(i)):e.close(i),k(a,b),angular.isDefined(b)&&b!==c&&l(a,{open:!!b})}),a.$on("$locationChangeSuccess",function(){i.isOpen=!1}),a.$on("$destroy",function(){i.$destroy()})}]).directive("dropdown",function(){return{controller:"DropdownController",link:function(a,b,c,d){d.init(b)}}}).directive("dropdownToggle",function(){return{require:"?^dropdown",link:function(a,b,c,d){if(d){d.toggleElement=b;var e=function(e){e.preventDefault(),b.hasClass("disabled")||c.disabled||a.$apply(function(){d.toggle()})};b.bind("click",e),b.attr({"aria-haspopup":!0,"aria-expanded":!1}),a.$watch(d.isOpen,function(a){b.attr("aria-expanded",!!a)}),a.$on("$destroy",function(){b.unbind("click",e)})}}}}),angular.module("ui.bootstrap.typeahead",["ui.bootstrap.position","ui.bootstrap.bindHtml"]).factory("typeaheadParser",["$parse",function(a){var b=/^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w\d]*))\s+in\s+([\s\S]+?)$/;return{parse:function(c){var d=c.match(b);if(!d)throw new Error('Expected typeahead specification in form of "_modelValue_ (as _label_)? for _item_ in _collection_" but got "'+c+'".');return{itemName:d[3],source:a(d[4]),viewMapper:a(d[2]||d[1]),modelMapper:a(d[1])}}}}]).directive("typeahead",["$compile","$parse","$q","$timeout","$document","$position","typeaheadParser",function(a,b,c,d,e,f,g){var h=[9,13,27,38,40];return{require:"ngModel",link:function(i,j,k,l){var m,n=i.$eval(k.typeaheadMinLength)||1,o=i.$eval(k.typeaheadWaitMs)||0,p=!1!==i.$eval(k.typeaheadEditable),q=b(k.typeaheadLoading).assign||angular.noop,r=b(k.typeaheadOnSelect),s=k.typeaheadInputFormatter?b(k.typeaheadInputFormatter):void 0,t=!!k.typeaheadAppendToBody&&i.$eval(k.typeaheadAppendToBody),u=!1!==i.$eval(k.typeaheadFocusFirst),v=b(k.ngModel).assign,w=g.parse(k.typeahead),x=i.$new();i.$on("$destroy",function(){x.$destroy()});var y="typeahead-"+x.$id+"-"+Math.floor(1e4*Math.random());j.attr({"aria-autocomplete":"list","aria-expanded":!1,"aria-owns":y});var z=angular.element("<div typeahead-popup></div>");z.attr({id:y,matches:"matches",active:"activeIdx",select:"select(activeIdx)",query:"query",position:"position"}),angular.isDefined(k.typeaheadTemplateUrl)&&z.attr("template-url",k.typeaheadTemplateUrl);var A=function(){x.matches=[],x.activeIdx=-1,j.attr("aria-expanded",!1)},B=function(a){return y+"-option-"+a};x.$watch("activeIdx",function(a){0>a?j.removeAttr("aria-activedescendant"):j.attr("aria-activedescendant",B(a))});var C=function(a){var b={$viewValue:a};q(i,!0),c.when(w.source(i,b)).then(function(c){var d=a===l.$viewValue;if(d&&m)if(c.length>0){x.activeIdx=u?0:-1,x.matches.length=0;for(var e=0;e<c.length;e++)b[w.itemName]=c[e],x.matches.push({id:B(e),label:w.viewMapper(x,b),model:c[e]});x.query=a,x.position=t?f.offset(j):f.position(j),x.position.top=x.position.top+j.prop("offsetHeight"),j.attr("aria-expanded",!0)}else A();d&&q(i,!1)},function(){A(),q(i,!1)})};A(),x.query=void 0;var D,E=function(a){D=d(function(){C(a)},o)},F=function(){D&&d.cancel(D)};l.$parsers.unshift(function(a){return m=!0,a&&a.length>=n?o>0?(F(),E(a)):C(a):(q(i,!1),F(),A()),p?a:a?void l.$setValidity("editable",!1):(l.$setValidity("editable",!0),a)}),l.$formatters.push(function(a){var b,c,d={};return s?(d.$model=a,s(i,d)):(d[w.itemName]=a,b=w.viewMapper(i,d),d[w.itemName]=void 0,c=w.viewMapper(i,d),b!==c?b:a)}),x.select=function(a){var b,c,e={};e[w.itemName]=c=x.matches[a].model,b=w.modelMapper(i,e),v(i,b),l.$setValidity("editable",!0),r(i,{$item:c,$model:b,$label:w.viewMapper(i,e)}),A(),d(function(){j[0].focus()},0,!1)},j.bind("keydown",function(a){0!==x.matches.length&&-1!==h.indexOf(a.which)&&(-1!=x.activeIdx||13!==a.which&&9!==a.which)&&(a.preventDefault(),40===a.which?(x.activeIdx=(x.activeIdx+1)%x.matches.length,x.$digest()):38===a.which?(x.activeIdx=(x.activeIdx>0?x.activeIdx:x.matches.length)-1,x.$digest()):13===a.which||9===a.which?x.$apply(function(){x.select(x.activeIdx)}):27===a.which&&(a.stopPropagation(),A(),x.$digest()))}),j.bind("blur",function(){m=!1});var G=function(a){j[0]!==a.target&&(A(),x.$digest())};e.bind("click",G),i.$on("$destroy",function(){e.unbind("click",G),t&&H.remove()});var H=a(z)(x);t?e.find("body").append(H):j.after(H)}}}]).directive("typeaheadPopup",function(){return{restrict:"EA",scope:{matches:"=",query:"=",active:"=",position:"=",select:"&"},replace:!0,templateUrl:"template/typeahead/typeahead-popup.html",link:function(a,b,c){a.templateUrl=c.templateUrl,a.isOpen=function(){return a.matches.length>0},a.isActive=function(b){return a.active==b},a.selectActive=function(b){a.active=b},a.selectMatch=function(b){a.select({activeIdx:b})}}}}).directive("typeaheadMatch",["$http","$templateCache","$compile","$parse",function(a,b,c,d){return{restrict:"EA",scope:{index:"=",match:"=",query:"="},link:function(e,f,g){var h=d(g.templateUrl)(e.$parent)||"template/typeahead/typeahead-match.html";a.get(h,{cache:b}).success(function(a){f.replaceWith(c(a.trim())(e))})}}}]).filter("typeaheadHighlight",function(){function a(a){return a.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")}return function(b,c){return c?(""+b).replace(new RegExp(a(c),"gi"),"<strong>$&</strong>"):b}}),angular.module("ui.bootstrap.position",[]).factory("$position",["$document","$window",function(a,b){function c(a,c){return a.currentStyle?a.currentStyle[c]:b.getComputedStyle?b.getComputedStyle(a)[c]:a.style[c]}function d(a){return"static"===(c(a,"position")||"static")}var e=function(b){for(var c=a[0],e=b.offsetParent||c;e&&e!==c&&d(e);)e=e.offsetParent;return e||c};return{position:function(b){var c=this.offset(b),d={top:0,left:0},f=e(b[0]);f!=a[0]&&(d=this.offset(angular.element(f)),d.top+=f.clientTop-f.scrollTop,d.left+=f.clientLeft-f.scrollLeft);var g=b[0].getBoundingClientRect();return{width:g.width||b.prop("offsetWidth"),height:g.height||b.prop("offsetHeight"),top:c.top-d.top,left:c.left-d.left}},offset:function(c){var d=c[0].getBoundingClientRect();return{width:d.width||c.prop("offsetWidth"),height:d.height||c.prop("offsetHeight"),top:d.top+(b.pageYOffset||a[0].documentElement.scrollTop),left:d.left+(b.pageXOffset||a[0].documentElement.scrollLeft)}},positionElements:function(a,b,c,d){var e,f,g,h,i=c.split("-"),j=i[0],k=i[1]||"center";e=d?this.offset(a):this.position(a),f=b.prop("offsetWidth"),g=b.prop("offsetHeight");var l={center:function(){return e.left+e.width/2-f/2},left:function(){return e.left},right:function(){return e.left+e.width}},m={center:function(){return e.top+e.height/2-g/2},top:function(){return e.top},bottom:function(){return e.top+e.height}};switch(j){case"right":h={top:m[k](),left:l[j]()};break;case"left":h={top:m[k](),left:e.left-f};break;case"bottom":h={top:m[j](),left:l[k]()};break;default:h={top:e.top-g,left:l[k]()}}return h}}}]),angular.module("ui.bootstrap.bindHtml",[]).directive("bindHtmlUnsafe",function(){return function(a,b,c){b.addClass("ng-binding").data("$binding",c.bindHtmlUnsafe),a.$watch(c.bindHtmlUnsafe,function(a){b.html(a||"")})}}),angular.module("ui.bootstrap.modal",["ui.bootstrap.transition"]).factory("$$stackedMap",function(){return{createNew:function(){var a=[];return{add:function(b,c){a.push({key:b,value:c})},get:function(b){for(var c=0;c<a.length;c++)if(b==a[c].key)return a[c]},keys:function(){for(var b=[],c=0;c<a.length;c++)b.push(a[c].key);return b},top:function(){return a[a.length-1]},remove:function(b){for(var c=-1,d=0;d<a.length;d++)if(b==a[d].key){c=d;break}return a.splice(c,1)[0]},removeTop:function(){return a.splice(a.length-1,1)[0]},length:function(){return a.length}}}}}).directive("modalBackdrop",["$timeout",function(a){return{restrict:"EA",replace:!0,templateUrl:"template/modal/backdrop.html",link:function(b,c,d){b.backdropClass=d.backdropClass||"",b.animate=!1,a(function(){b.animate=!0})}}}]).directive("modalWindow",["$modalStack","$timeout",function(a,b){return{restrict:"EA",scope:{index:"@",animate:"="},replace:!0,transclude:!0,templateUrl:function(a,b){return b.templateUrl||"template/modal/window.html"},link:function(c,d,e){d.addClass(e.windowClass||""),c.size=e.size,b(function(){c.animate=!0,d[0].querySelectorAll("[autofocus]").length||d[0].focus()}),c.close=function(b){var c=a.getTop();c&&c.value.backdrop&&"static"!=c.value.backdrop&&b.target===b.currentTarget&&(b.preventDefault(),b.stopPropagation(),a.dismiss(c.key,"backdrop click"))}}}}]).directive("modalTransclude",function(){return{link:function(a,b,c,d,e){e(a.$parent,function(a){b.empty(),b.append(a)})}}}).factory("$modalStack",["$transition","$timeout","$document","$compile","$rootScope","$$stackedMap",function(a,b,c,d,e,f){function g(){for(var a=-1,b=n.keys(),c=0;c<b.length;c++)n.get(b[c]).value.backdrop&&(a=c);return a}function h(a){var b=c.find("body").eq(0),d=n.get(a).value;n.remove(a),j(d.modalDomEl,d.modalScope,300,function(){d.modalScope.$destroy(),b.toggleClass(m,n.length()>0),i()})}function i(){if(k&&-1==g()){var a=l;j(k,l,150,function(){a.$destroy(),a=null}),k=void 0,l=void 0}}function j(c,d,e,f){function g(){g.done||(g.done=!0,c.remove(),f&&f())}d.animate=!1;var h=a.transitionEndEventName;if(h){var i=b(g,e);c.bind(h,function(){b.cancel(i),g(),d.$apply()})}else b(g)}var k,l,m="modal-open",n=f.createNew(),o={};return e.$watch(g,function(a){l&&(l.index=a)}),c.bind("keydown",function(a){var b;27===a.which&&(b=n.top())&&b.value.keyboard&&(a.preventDefault(),e.$apply(function(){o.dismiss(b.key,"escape key press")}))}),o.open=function(a,b){n.add(a,{deferred:b.deferred,modalScope:b.scope,backdrop:b.backdrop,keyboard:b.keyboard});var f=c.find("body").eq(0),h=g();if(h>=0&&!k){l=e.$new(!0),l.index=h;var i=angular.element("<div modal-backdrop></div>");i.attr("backdrop-class",b.backdropClass),k=d(i)(l),f.append(k)}var j=angular.element("<div modal-window></div>");j.attr({"template-url":b.windowTemplateUrl,"window-class":b.windowClass,size:b.size,index:n.length()-1,animate:"animate"}).html(b.content);var o=d(j)(b.scope);n.top().value.modalDomEl=o,f.append(o),f.addClass(m)},o.close=function(a,b){var c=n.get(a);c&&(c.value.deferred.resolve(b),h(a))},o.dismiss=function(a,b){var c=n.get(a);c&&(c.value.deferred.reject(b),h(a))},o.dismissAll=function(a){for(var b=this.getTop();b;)this.dismiss(b.key,a),b=this.getTop()},o.getTop=function(){return n.top()},o}]).provider("$modal",function(){var a={options:{backdrop:!0,keyboard:!0},$get:["$injector","$rootScope","$q","$http","$templateCache","$controller","$modalStack",function(b,c,d,e,f,g,h){function i(a){return a.template?d.when(a.template):e.get(angular.isFunction(a.templateUrl)?a.templateUrl():a.templateUrl,{cache:f}).then(function(a){return a.data})}function j(a){var c=[];return angular.forEach(a,function(a){(angular.isFunction(a)||angular.isArray(a))&&c.push(d.when(b.invoke(a)))}),c}var k={};return k.open=function(b){var e=d.defer(),f=d.defer(),k={result:e.promise,opened:f.promise,close:function(a){h.close(k,a)},dismiss:function(a){h.dismiss(k,a)}};if(b=angular.extend({},a.options,b),b.resolve=b.resolve||{},!b.template&&!b.templateUrl)throw new Error("One of template or templateUrl options is required.");var l=d.all([i(b)].concat(j(b.resolve)));return l.then(function(a){var d=(b.scope||c).$new();d.$close=k.close,d.$dismiss=k.dismiss;var f,i={},j=1;b.controller&&(i.$scope=d,i.$modalInstance=k,angular.forEach(b.resolve,function(b,c){i[c]=a[j++]}),f=g(b.controller,i),b.controllerAs&&(d[b.controllerAs]=f)),h.open(k,{scope:d,deferred:e,content:a[0],backdrop:b.backdrop,keyboard:b.keyboard,backdropClass:b.backdropClass,windowClass:b.windowClass,windowTemplateUrl:b.windowTemplateUrl,size:b.size})},function(a){e.reject(a)}),l.then(function(){f.resolve(!0)},function(){f.reject(!1)}),k},k}]};return a}),angular.module("template/typeahead/typeahead-match.html",[]).run(["$templateCache",function(a){a.put("template/typeahead/typeahead-match.html",'<a tabindex="-1" bind-html-unsafe="match.label | typeaheadHighlight:query"></a>')}]),angular.module("template/typeahead/typeahead-popup.html",[]).run(["$templateCache",function(a){a.put("template/typeahead/typeahead-popup.html",'<ul class="dropdown-menu" ng-show="isOpen()" ng-style="{top: position.top+\'px\', left: position.left+\'px\'}" style="display: block;" role="listbox" aria-hidden="{{!isOpen()}}">\n <li ng-repeat="match in matches track by $index" ng-class="{active: isActive($index) }" ng-mouseenter="selectActive($index)" ng-click="selectMatch($index)" role="option" id="{{match.id}}">\n <div typeahead-match index="$index" match="match" query="query" template-url="templateUrl"></div>\n </li>\n</ul>\n')}]),angular.module("template/modal/backdrop.html",[]).run(["$templateCache",function(a){a.put("template/modal/backdrop.html",'<div class="modal-backdrop fade {{ backdropClass }}"\n ng-class="{in: animate}"\n ng-style="{\'z-index\': 1040 + (index && 1 || 0) + index*10}"\n></div>\n')}]),angular.module("template/modal/window.html",[]).run(["$templateCache",function(a){a.put("template/modal/window.html",'<div tabindex="-1" role="dialog" class="modal fade" ng-class="{in: animate}" ng-style="{\'z-index\': 1050 + index*10, display: \'block\'}" ng-click="close($event)">\n <div class="modal-dialog" ng-class="{\'modal-sm\': size == \'sm\', \'modal-lg\': size == \'lg\'}"><div class="modal-content" modal-transclude></div></div>\n</div>')}]);