text: "use strict";angular.module("dfApplication",["dfUtility","dfUserManagement","ngResource"]).run([function(){}]).service("dfApplicationData",["$q","$http","INSTANCE_URL","dfObjectService","UserDataService","dfSystemData","$rootScope","$location",function($q,$http,INSTANCE_URL,dfObjectService,UserDataService,dfSystemData,$rootScope,$location){function _getApiData(apis,forceRefresh){var deferred=$q.defer(),promises=apis.map(function(api){return _loadOne(api,forceRefresh)});return $q.all(promises).then(function(response){deferred.resolve(response)},function(response){deferred.reject(response)}),deferred.promise}function _loadOne(api,forceRefresh){var params,options,deferred=$q.defer();return!0===forceRefresh&&delete dfApplicationObj.apis[api],dfApplicationObj.apis.hasOwnProperty(api)?deferred.resolve(dfApplicationObj.apis[api]):(params={},options={url:INSTANCE_URL.url+api},dfSystemData.resource(options).get(params).$promise.then(function(response){dfApplicationObj.apis[api]=response,deferred.resolve(dfApplicationObj.apis[api])},function(error){deferred.reject(error.data)})),deferred.promise}function _getApiDataSync(api,forceRefresh){if(!0===forceRefresh&&delete dfApplicationObj.apis[api],dfApplicationObj.apis.hasOwnProperty(api));else{var xhr,currentUser=UserDataService.getCurrentUser();(xhr=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP")).open("GET",INSTANCE_URL.url+"/system/"+api,!1),xhr.setRequestHeader("X-DreamFactory-API-Key","6498a8ad1beb9d84d63035c5d1120c007fad6de706734db9689f8996707e0f7d"),currentUser&&currentUser.session_token&&xhr.setRequestHeader("X-DreamFactory-Session-Token",currentUser.session_token),xhr.setRequestHeader("Content-Type","application/json"),xhr.send(),4==xhr.readyState&&200==xhr.status&&(dfApplicationObj.apis[api]=angular.fromJson(xhr.responseText))}return dfApplicationObj.apis[api]}function _resetApplicationObj(){dfApplicationObj={apis:{}}}var dfApplicationObj={apis:{}};return{getApplicationObj:function(){return dfApplicationObj},resetApplicationObj:function(){_resetApplicationObj()},getApiDataFromCache:function(api){var result=void 0;return dfApplicationObj.apis.hasOwnProperty(api)&&(result=dfApplicationObj.apis[api].resource?dfApplicationObj.apis[api].resource:dfApplicationObj.apis[api]),result},deleteApiDataFromCache:function(api){dfApplicationObj.apis.hasOwnProperty(api)&&delete dfApplicationObj.apis[api]},getApiData:function(apis,forceRefresh){return _getApiData(apis,forceRefresh)},getApiDataSync:function(api,forceRefresh){return _getApiDataSync(api,forceRefresh)},getQueryParameter:function(key){key=key.replace(/[*+?^$.\[\]{}()|\\\/]/g,"\\$&");var match=window.location.search.match(new RegExp("[?&]"+key+"=([^&]+)(&|$)")),result=match&&decodeURIComponent(match[1].replace(/\+/g," "));return result||""}}}]).service("dfSystemData",["INSTANCE_URL","$resource","dfObjectService",function(INSTANCE_URL,$resource,dfObjectService){return{resource:function(options){options=options||{};var defaults={headers:""},url=(options=dfObjectService.mergeObjects(options,defaults)).url||INSTANCE_URL.url+"/system/:api/:id",queryParams=options.queryParams||{api:"@api",id:"@id"};return $resource(url,queryParams,{get:{method:"GET",headers:options.headers},post:{method:"POST",headers:options.headers},put:{method:"PUT",headers:options.headers},patch:{method:"PATCH",headers:options.headers},delete:{method:"DELETE",headers:options.headers}})}}}]).factory("httpValidSession",["$q","$rootScope","INSTANCE_URL","$injector",function($q,$rootScope,INSTANCE_URL,$injector){var refreshSession=function(reject){var $http=$injector.get("$http"),UserDataService=$injector.get("UserDataService"),user=UserDataService.getCurrentUser(),deferred=$injector.get("$q").defer(),url=user.is_sys_admin?"/system/admin/session":"/user/session";return $http({method:"PUT",url:INSTANCE_URL.url+url}).then(function(result){UserDataService.setCurrentUser(result.data),retry(reject.config,deferred)},function(){newSession(reject,deferred)}),deferred.promise},retry=function(config,deferred){var request={method:config.method,url:config.url};return config.params&&(request.params=config.params),config.data&&(request.data=config.data),config.transformRequest&&(request.transformRequest=config.transformRequest),$injector.get("$http")(request).then(deferred.resolve,deferred.reject),deferred.promise},newSession=function(reject,deferred){return $injector.get("UserDataService").unsetCurrentUser(),deferred=deferred||$injector.get("$q").defer(),$rootScope.$$childHead.openLoginWindow(reject),$rootScope.$on("user:login:success",function(){retry(reject.config,deferred)}),deferred.promise};return{request:function(config){return config},requestError:function(reject){return $q.reject(reject)},response:function(response){return response},responseError:function(reject){return-1===reject.config.url.indexOf("/session")&&$injector.get("UserDataService").getCurrentUser()&&(401===reject.status||reject.data&&reject.data.error&&401===reject.data.error.code||(403===reject.status||reject.data&&reject.data.error&&403===reject.data.error.code)&&reject.data.error.message.indexOf("The token has been blacklisted")>=0)?reject.data.error.message.indexOf("Token has expired")>=0?refreshSession(reject):newSession(reject):$q.reject(reject)}}}]),angular.module("dfUtility",[]).constant("MOD_UTILITY_ASSET_PATH","admin_components/adf-utility/").directive("dfSectionHeader",[function(){return{restrict:"E",scope:{title:"=?"},template:'<div class="df-section-header df-section-all-round"><h4>{{title}}</h4></div>',link:function(scope,elem,attrs){}}}]).directive("dfSectionToolbar",["MOD_UTILITY_ASSET_PATH","$compile","$location","$timeout","$route",function(MOD_UTILITY_ASSET_PATH,$compile,$location,$timeout,$route){return{restrict:"E",scope:!1,transclude:!0,templateUrl:MOD_UTILITY_ASSET_PATH+"views/df-toolbar.html",link:function(scope,elem,attrs){}}}]).directive("dreamfactoryAutoHeight",["$window","$route",function($window){return{restrict:"A",link:function(scope,elem,attrs){scope._getWindow=function(){return $(window)},scope._getDocument=function(){return $(document)},scope._getParent=function(parentStr){switch(parentStr){case"window":return scope._getWindow();case"document":return scope._getDocument();default:return $(parentStr)}},scope._setElementHeight=function(){angular.element(elem).css({height:scope._getParent(attrs.autoHeightParent).height()-200-attrs.autoHeightPadding})},scope._setElementHeight(),angular.element($window).on("resize",function(){scope._setElementHeight()})}}}]).directive("resize",[function($window){return function(scope,element){var w=angular.element($window);scope.getWindowDimensions=function(){return{h:w.height(),w:w.width()}},scope.$watch(scope.getWindowDimensions,function(newValue,oldValue){scope.windowHeight=newValue.h,scope.windowWidth=newValue.w,angular.element(element).css({width:newValue.w-angular.element("sidebar").css("width")+"px"})},!0)}}]).directive("dfFsHeight",["$window","$rootScope",function($window,$rootScope){return function(scope,elem,attrs){var setSize=function(){var _elem=$(elem),winHeight=$(window).height(),winWidth=$(window).width();_elem.is("#swagger")?_elem.attr("height",winHeight-25+"px"):winWidth>=992?$(elem).css({height:winHeight-120}):$(elem).css({height:"auto"})};scope.$on("apidocs:loaded",function(e){setSize()}),$rootScope.$on("$routeChangeSuccess",function(e){setSize()}),$(document).ready(function(){setSize()}),$(window).on("resize",function(){setSize()})}}]).filter("orderAndShowSchema",[function(){return function(items,fields,reverse){var filtered=[];return angular.forEach(fields,function(field){angular.forEach(items,function(item){item.name===field.name&&1==field.active&&filtered.push(item)})}),reverse&&filtered.reverse(),filtered}}]).filter("orderAndShowValue",[function(){return function(items,fields,reverse){var filtered=[];return angular.forEach(fields,function(field){for(var _key in items)_key===field.name&&1==field.active&&filtered.push(items[_key])}),reverse&&filtered.reverse(),filtered}}]).filter("orderObjectBy",[function(){return function(items,field,reverse){function cmp(a,b){return a==b?0:a<b?-1:1}var filtered=[];if(angular.forEach(items,function(item){filtered.push(item)}),0===filtered.length)return filtered;switch(typeof(filtered[0].record?filtered[0].record[field]:filtered[0][field])){case"number":filtered.sort(function(a,b){return a.hasOwnProperty("record")&&b.hasOwnProperty("record")?(a=a.record[field],b=b.record[field]):(a=a[field],b=b[field]),a=null===a||void 0===a?0:a,b=null===b||void 0===b?0:b,cmp(Number(a),Number(b))});break;case"string":filtered.sort(function(a,b){a.hasOwnProperty("record")&&b.hasOwnProperty("record")?(a=a.record[field],b=b.record[field]):(a=a[field],b=b[field]),a=null===a||void 0===a?"":a,b=null===b||void 0===b?"":b;var upA=a.toUpperCase(),upB=b.toUpperCase();return upA<upB?-1:upA>upB?1:0});break;default:filtered.sort(function(a,b){a.hasOwnProperty("record")&&b.hasOwnProperty("record")?(a=a.record[field],b=b.record[field]):(a=a[field],b=b[field]);var upA=a=null===a||void 0===a?"":a,upB=b=null===b||void 0===b?"":b;return upA<upB?-1:upA>upB?1:0})}return reverse&&filtered.reverse(),filtered}}]).directive("dfEmptySearchResult",["MOD_UTILITY_ASSET_PATH","$location",function(MOD_UTILITY_ASSET_PATH,$location){return{restrict:"E",scope:!1,templateUrl:MOD_UTILITY_ASSET_PATH+"views/df-empty-search-result.html",link:function(scope,elem,attrs){$location.search()&&$location.search().filter&&(scope.$parent.filterText=$location.search()&&$location.search().filter?$location.search().filter:null)}}}]).service("dfNotify",[function(){function pnotify(messageOptions){PNotify.removeAll(),PNotify.prototype.options.styling="fontawesome",new PNotify({title:messageOptions.module,type:messageOptions.type,text:messageOptions.message,addclass:"stack_topleft",animation:"fade",animate_speed:"normal",hide:!0,delay:3e3,stack:stack_topleft,mouse_reset:!0})}function parseDreamfactoryError(errorDataObj){var result,error,resource,message;return"[object String]"===Object.prototype.toString.call(errorDataObj)?result=errorDataObj:(result="The server returned an unknown error.",errorDataObj.data&&(error=errorDataObj.data.error)&&((message=error.message)&&(result=message),1e3===error.code&&error.context&&(resource=error.context.resource,error=error.context.error,resource&&error&&(result="",angular.forEach(error,function(index){result&&(result+="\n"),result+=resource[index].message}))))),result}var stack_topleft={dir1:"down",dir2:"right",push:"top",firstpos1:25,firstpos2:25,spacing1:5,spacing2:5};return{success:function(options){pnotify(options)},error:function(options){options.message=parseDreamfactoryError(options.message),pnotify(options)},warn:function(options){pnotify(options)},confirmNoSave:function(){return confirm("Continue without saving?")},confirm:function(msg){return confirm(msg)},clear:function(){PNotify.removeAll()}}}]).directive("dfPopupLogin",["MOD_UTILITY_ASSET_PATH","$compile","$location","UserEventsService",function(MOD_UTILITY_ASSET_PATH,$compile,$location,UserEventsService){return{restrict:"A",scope:!1,link:function(scope,elem,attrs){scope.popupLoginOptions={showTemplate:!0},scope.openLoginWindow=function(errormsg){$("#popup-login-container").html($compile('<div id="df-login-frame" style="overflow: hidden; position: absolute; top:0; z-index:99999; background: rgba(0, 0, 0, .8); width: 100%; height: 100%"><div style="padding-top: 120px;"><dreamfactory-user-login data-in-err-msg="errormsg.data.error.message" data-options="popupLoginOptions"></dreamfactory-user-login></div></div>')(scope))},scope.$on(UserEventsService.login.loginSuccess,function(e,userDataObj){e.stopPropagation(),$("#df-login-frame").remove()}),scope.$on(UserEventsService.login.loginError,function(e,userDataObj){$("#df-login-frame").remove(),$location.url("/logout")})}}}]).directive("dfTopLevelNavStd",["MOD_UTILITY_ASSET_PATH",function(MOD_UTILITY_ASSET_PATH){return{restrict:"E",scope:{options:"=?"},templateUrl:MOD_UTILITY_ASSET_PATH+"views/df-top-level-nav-std.html",link:function(scope,elem,attrs){scope.links=scope.options.links,scope.activeLink=null}}}]).service("dfObjectService",[function(){return{mergeDiff:function(obj1,obj2){for(var key in obj1)obj2.hasOwnProperty(key)||"$"===key.substr(0,1)||(obj2[key]=obj1[key]);return obj2},mergeObjects:function(obj1,obj2){for(var key in obj1)obj2[key]=obj1[key];return obj2},deepMergeObjects:function(obj1,obj2){var self=this;for(var _key in obj1)if(obj2.hasOwnProperty(_key))switch(Object.prototype.toString.call(obj2[_key])){case"[object Object]":obj2[_key]=self.deepMergeObjects(obj1[_key],obj2[_key]);break;case"[object Array]":obj2[_key]=obj1[_key];break;default:obj2[_key]=obj1[_key]}return obj2},compareObjectsAsJson:function(o,p){return angular.toJson(o)===angular.toJson(p)}}}]).service("dfIconService",[function(){return function(){return{login:"fa fa-fw fa-sign-in",user:"fa fa-fw fa-user"}}}]),angular.module("dfTable",["dfUtility"]).constant("DF_TABLE_ASSET_PATH","admin_components/adf-table/").run(["$templateCache",function($templateCache){$templateCache.put("df-input-text.html",'<input type="{{templateData.type}}"  class="form-control" placeholder="{{templateData.placeholder}}" data-ng-model="currentEditRecord[field.name]" data-ng-disabled="!templateData.editable" data-ng-required="field.required">'),$templateCache.put("df-input-ref-text.html",'<input type="{{templateData.type}}"  class="form-control" placeholder="{{templateData.placeholder}}" data-ng-model="currentEditRecord[field.name]" data-ng-disabled="!templateData.editable" data-ng-required="field.required">'),$templateCache.put("df-input-number.html",'<input type="{{templateData.type}}" step="any" class="form-control" placeholder="{{templateData.placeholder}}" data-ng-model="currentEditRecord[field.name]" data-ng-disabled="!templateData.editable" data-ng-required="field.required">'),$templateCache.put("df-input-int.html",'<input type="{{templateData.type}}" step="1" class="form-control" placeholder="{{templateData.placeholder}}" data-ng-model="currentEditRecord[field.name]" data-ng-disabled="!templateData.editable" data-ng-required="field.required">'),$templateCache.put("df-input-textarea.html",'<textarea class="form-control" rows="3" data-ng-model="currentEditRecord[field.name]" data-ng-disabled="!templateData.editable" data-ng-required="field.required"></textarea>'),$templateCache.put("df-input-binary.html","<p>BINARY DATA</p>"),$templateCache.put("df-input-datetime.html","<p>DATETIME</p>"),$templateCache.put("df-input-reference.html",'<div class="well"><df-table data-options="relatedOptions" data-parent-record="currentEditRecord" data-export-field="field"></df-table></div>'),$templateCache.put("df-input-checkbox.html",'<label><input type="checkbox" data-ng-model="currentEditRecord[field.name]" data-ng-checked="currentEditRecord[field.name]" data-ng-required="field.required"></label>'),$templateCache.put("df-input-bool-picklist.html",'<div class="form-group"><select class="form-control" data-ng-model="currentEditRecord[field.name]" data-ng-options="bool.value as bool.name for bool in __dfBools" data-ng-required="field.required"></select></div>'),$templateCache.put("df-input-select.html",'<select class="form-control" data-ng-model="currentEditRecord[field.name]" data-ng-options="obj[overrideFields[templateData.prop].display.value] as obj[overrideFields[templateData.prop].display.label] for obj in overrideFields[templateData.prop].records" data-ng-required="field.required" data-ng-disabled="currentEditRecord[templateData.dependent]"><option value="">-- None --</option></select>'),$templateCache.put("df-input-values-picklist.html",'<div class="row"><div class="col-xs-12 col-md-6"><div class="input-group"><input type="text" class="form-control" data-ng-model="currentEditRecord[field.name]" placeholder="Enter Value or Choose from list" data-ng-required="field.required"><div class="input-group-btn"><button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></button><ul class="dropdown-menu pull-right df-dropdown-height"><li data-ng-click="assignValue(item)" data-ng-repeat="item in data"><a>{{item}}</a></li></ul></div>\x3c!-- /btn-group --\x3e</div>\x3c!-- /input-group --\x3e</div>\x3c!-- /.col-lg-6 --\x3e</div>'),$templateCache.put("df-input-values-only-picklist.html",'<div class="form-group"><select class="form-control" data-ng-model="currentEditRecord[field.name]" data-ng-options="item for item in data" data-ng-required="field.required"></select></div>'),$templateCache.put("df-input-date-time-picker.html",'<div class="form-group col-xs-12">\n <div class="input-group col-sm-6 col-md-4">\n<span class="input-group-btn">\n<button type="button" data-ng-disabled="!templateData.editable" class="btn btn-default btn-small" data-ng-click="open($event)"><i class="fa fa-calendar fa-fw"></i></button><button type="button" class="btn btn-default" data-ng-disabled="!templateData.editable" data-ng-click="setNow()">Now</button>\n</span>\n<input type="text" class="form-control" data-ng-disabled="!templateData.editable" data-datepicker-popup="{{format}}" data-ng-model="dt" data-is-open="opened"  data-date-disabled="disabled(date, mode)" data-ng-required="field.required" data-close-text="Close" /></div>\n<div class="col-sm-6 col-md-2">\n<timepicker style="display: inline-block" data-ng-model="mytime" data-ng-change="changed()" show-meridian="ismeridian"></timepicker>\n</div>\n</div>')}]).filter("typeFilter",[function(){return function(object){var array=[];return angular.forEach(object,function(option){"boolean"!=option.type&&"integer"!=option.type&&"string"!=option.type&&"text"!=option.type&&"float"!=option.type&&"double"!=option.type&&"decimal"!=option.type||array.push(option)}),array}}]).directive("dfTable",["DF_TABLE_ASSET_PATH","$http","$q","$filter","$compile","dfObjectService","dfTableEventService","dfTableCallbacksService",function(DF_TABLE_ASSET_PATH,$http,$q,$filter,$compile,dfObjectService,dfTableEventService,dfTableCallbacksService){return{restrict:"E",scope:{userOptions:"=options",parentRecord:"=?",exportField:"=?"},templateUrl:DF_TABLE_ASSET_PATH+"views/dreamfactory-table.html",link:function(scope,elem,attrs){scope.es=dfTableEventService,scope.defaults={service:"",table:"",url:"",normalizeData:!1,normalizeSchema:!0,autoClose:!0,params:{filter:null,limit:50,offset:0,fields:"*",include_schema:!0,include_count:!0},defaultFields:null,overrideFields:[],extendFieldTypes:[],extendData:[],extendSchema:[],relatedData:[],excludeFields:[],groupFields:[],exportValueOn:!1,allowChildTable:!1,childTableAttachPoint:null,isChildTable:!1},scope.options={},scope.disableTableBtns=!1,scope.record=null,scope.schema=null,scope.overrideFields={},scope.tableFields={onStartTotalActiveFields:0},scope.tableFieldsAll=!1,scope.tableFilterOn=!0,scope.defaultFieldsShown={},scope.numAutoSelectFields=8,scope.selectedAll=!1,scope.filterOn=!1,scope.filter={viewBy:"",prop:"",props:"",type:"",value:null},scope.operators={integer:["<",">","="],boolean:[],string:[],text:[],float:["<",">","="],double:["<",">","="],decimal:["<",">","="]},scope.filterType={operator:null},scope.order={orderBy:"",orderByReverse:!1},scope.filteredRecords=!1,scope.orderedRecords=!1,scope.activeTab=null,scope.activeView="table",scope.pagesArr=[],scope.currentPage={},scope.currentEditRecord=null,scope.extendFieldTypes={},scope.inProgress=!1,scope.count=0,scope._exportValue=null,scope.newRecord=null,scope.relatedExpand=!1,scope.extendedData={},scope.extendedSchema={},scope.excludedFields={},scope.filteredSchema=[],scope.groupedSchema=[],scope.childTableActive=!1,scope.childTableOptions={},scope.childTableParentRecord=null,scope.setTab=function(tabStr){scope._setTab(tabStr)},scope.toggleSelected=function(dataObj){if(scope.childTableActive)return!1;scope._toggleSelected(dataObj)},scope.getPrevious=function(){if(scope._isFirstPage()||scope._isInProgress())return!1;scope._checkForUnsavedRecords(scope.record)?scope._confirmAction("You have Unsaved records.  Continue without saving?",scope._getPrevious):scope._getPrevious()},scope.getNext=function(){if(scope._isLastPage()||scope._isInProgress())return!1;scope._checkForUnsavedRecords(scope.record)?scope._confirmAction("You have Unsaved records.  Continue without saving?",scope._getNext):scope._getNext()},scope.editRecord=function(dataObj){scope._editRecord(dataObj)},scope.createRecord=function(){scope._createRecord()},scope.saveRecords=function(){scope._saveRecords()},scope.revertRecords=function(){scope._revertRecords()},scope.deleteRecords=function(){scope._confirmAction("You are about to delete records. Continue?",scope._deleteRecords)},scope.applyFilter=function(){scope._applyFilter()},scope.removeFilter=function(){scope._removeFilter()},scope.refreshResults=function(){scope._refreshResults()},scope.orderOnSelect=function(fieldObj){scope._orderOnSelect(fieldObj)},scope.setExportValue=function(dataObj){scope._setExportValue(dataObj)},scope.toggleExpandEditor=function(){scope._toggleExpandEditor()},scope.editExportRecord=function(dataObj){scope._editExportRecord(dataObj)},scope.filterRecords=function(){scope._filterRecords()},scope.toggleAllFields=function(){scope._toggleAllFields()},scope.resetAllFields=function(){scope._resetAllFields()},scope.toggleAllRecords=function(){scope._toggleAllRecords()},scope.showChildTable=function(parentRecordObj){scope._showChildTable(parentRecordObj)},scope._addSelectedProp=function(dataObj){dataObj.__dfUI.hasOwnProperty("selected")||(dataObj.__dfUI.selected=!1)},scope._addUnsavedProp=function(dataObj){dataObj.__dfUI.hasOwnProperty("unsaved")||(dataObj.__dfUI.unsaved=!1)},scope._addExportProp=function(dataObj){dataObj.__dfUI.hasOwnProperty("export")||(dataObj.__dfUI.export=!1)},scope._addHideProp=function(dataObj){dataObj.__dfUI.hasOwnProperty("hide")||(dataObj.__dfUI.hide=!1)},scope._addStateProps=function(dataObj){dataObj.hasOwnProperty.__dfUI||(dataObj.__dfUI={}),scope._addSelectedProp(dataObj),scope._addUnsavedProp(dataObj),scope._addExportProp(dataObj),scope._addHideProp(dataObj)},scope._removeStateProps=function(dataObj){dataObj.hasOwnProperty.__dfUI&&delete dataObj.__dfUI},scope._toggleSelectedState=function(dataObj){dataObj.__dfUI.selected=!dataObj.__dfUI.selected},scope._toggleUnsavedState=function(dataObj){dataObj.__dfUI.unsaved=!dataObj.__dfUI.unsaved},scope._setSelectedState=function(dataObj,stateBool){dataObj.__dfUI.selected=stateBool},scope._setUnsavedState=function(dataObj,stateBool){dataObj.__dfUI.unsaved=stateBool},scope._setExportState=function(dataObj,stateBool){dataObj&&(dataObj.__dfUI.export=stateBool)},scope._setHideState=function(dataObj,stateBool){dataObj&&(dataObj.__dfUI.hide=stateBool)},scope._isUnsaved=function(dataObj){return dataObj.__dfUI.unsaved},scope._isSelected=function(dataObj){return dataObj.__dfUI.selected},scope._isExport=function(dataObj){return dataObj.__dfUI.export},scope._checkForUnsavedRecords=function(data){if(!data)return!1;var unsavedRecords=!1,i=0;do{if(i>=data.length)break;data[i].__dfUI.unsaved&&(unsavedRecords=!0),i++}while(0==unsavedRecords);return unsavedRecords},scope._checkForParams=function(){return scope.options.hasOwnProperty("params")?scope.options.params:scope.defaults.params},scope._getRecordsFromServer=function(requestDataObj){var params=scope._checkForParams();return(requestDataObj=requestDataObj||null)&&(params=dfObjectService.mergeObjects(requestDataObj.params,params)),scope.options.relatedData.length>0&&(params.related=scope.options.relatedData.join(",")),$http({method:"GET",url:scope.options.url,params:params})},scope._getRecordsFromData=function(dataObj){var limit=scope._checkForParams().limit,records=[];return dataObj.hasOwnProperty("resource")?records=dataObj.resource:dataObj.hasOwnProperty("data")&&(records=dataObj.data.hasOwnProperty("resource")?dataObj.data.resource:dataObj.data.data.resource),records.length>limit?records.slice(0,limit):records},scope._getMetaFromData=function(dataObj){var meta={};return dataObj.hasOwnProperty("meta")?meta=dataObj.meta:dataObj.hasOwnProperty("data")&&(meta=dataObj.data.hasOwnProperty("meta")?dataObj.data.meta:dataObj.data.data.meta),meta},scope._getSchemaFromData=function(dataObj){return scope._getMetaFromData(dataObj).schema},scope._getCountFromMeta=function(dataObj){var count=scope._getMetaFromData(dataObj).count;return scope._setCount(count),count},scope._setCount=function(countInt){scope.count=countInt},scope._getOptionFromParams=function(keyStr){return scope._checkForParams()[keyStr]},scope._setOptionFromParams=function(keyStr,valueStr){},scope._buildField=function(fieldNameStr){console.log(fieldNameStr)},scope._createRevertCopy=function(dataObj){dataObj.__dfData={},dataObj.__dfData.revert=angular.copy(dataObj),dataObj.__dfData.revert.hasOwnProperty("_exportValue")||(dataObj.__dfData.revert._exportValue={})},scope._getRevertCopy=function(dataObj){return dataObj.__dfData.revert},scope._hasRevertCopy=function(dataObj){return!!dataObj.hasOwnProperty("__dfData")&&!!dataObj.__dfData.hasOwnProperty("revert")},scope._removeRevertCopy=function(dataObj){dataObj.__dfData.revert&&delete dataObj.__dfData.revert},scope._removeAllDFData=function(dataObj){dataObj.__dfData&&delete dataObj.__dfData},scope._removeAllUIData=function(dataObj){delete dataObj.__dfUI},scope._compareObjects=function(dataObj1,dataObj2){for(var key in dataObj1)if("dfUISelected"!==key&&"dfUIUnsaved"!==key&&"__dfUI"!==key&&"__dfData"!=key&&"created_date"!=key&&"last_modified_date"!=key&&"$$hashKey"!==key&&dataObj1[key]!==dataObj2[key])return(null!=dataObj1[key]&&""!=dataObj1[key]||null!=dataObj2[key]&&""!=dataObj2[key])&&!(dataObj1[key]instanceof Array&&dataObj2[key]instanceof Array&&dataObj1[key].length==dataObj2[key].length);return!1},scope._getRecordsWithState=function(recordsDataArr,stateStr,removeDFDataBool,removeUIDataBool){var records=[];return removeDFDataBool=void 0!==removeDFDataBool&&removeDFDataBool,removeUIDataBool=void 0!==removeUIDataBool&&removeUIDataBool,angular.forEach(recordsDataArr,function(_obj){_obj.__dfUI[stateStr]&&(removeDFDataBool&&scope._removeAllDFData(_obj),removeUIDataBool&&scope._removeAllUIData(_obj),records.push(_obj))}),records},scope._saveRecordsToServer=function(recordsDataArr){if(0==recordsDataArr.length){var defer=$q.defer();return defer.reject("No records selected for save."),defer.promise}return $http({method:"PATCH",url:scope.options.url,data:{resource:recordsDataArr}})},scope._deleteRecordsFromServer=function(recordsDataArr){if(0==recordsDataArr.length){var defer=$q.defer();return defer.reject("No records selected for delete."),defer.promise}return $http({method:"DELETE",url:scope.options.url,data:{resource:recordsDataArr}})},scope._isInProgress=function(){return scope.inProgress},scope._setInProgress=function(stateBool){scope.inProgress=stateBool},scope._createNewRecordObj=function(){var newRecord={};return angular.forEach(scope.schema.field,function(_obj){scope.excludedFields.hasOwnProperty(_obj.name)&&scope.excludedFields[_obj.name].fields.create||(newRecord[_obj.name]=_obj.default)}),scope._addStateProps(newRecord),newRecord},scope._setCurrentEditRecord=function(dataObj){scope.currentEditRecord=dataObj},scope._setNewRecordObj=function(){scope.newRecord=scope._createNewRecordObj()},scope._confirmAction=function(_message,_action){confirm(_message)&&_action.call()},scope._filterFormSchema=function(formNameStr){if(0==scope.excludedFields.length)return!1;angular.forEach(scope.schema.field,function(_obj){scope.excludedFields.hasOwnProperty(_obj.name)&&scope.excludedFields[_obj.name].fields[formNameStr]||scope.filteredSchema.push(_obj)})},scope._buildSchemaGroups=function(){if(0==scope.options.groupFields.length)return!1;var _schema=scope.filteredSchema.length>0?scope.filteredSchema:scope.schema.field;angular.forEach(scope.options.groupFields,function(fobj){var group={};group.name=fobj.name,group.fields=[],group.dividers=fobj.dividers,angular.forEach(_schema,function(item){angular.forEach(fobj.fields,function(field,index){item.name===field&&(group.fields[index]=item)})}),scope.groupedSchema.push(group)})},scope._checkForGroupedSchema=function(groupNameStr){0==scope.groupedSchema.length&&scope.groupedSchema.push({name:groupNameStr,fields:scope.schema.field})},scope._clearFilteredSchema=function(){scope.filteredSchema=[]},scope._clearGroupedSchema=function(){scope.groupedSchema=[]},scope._getDefaultFields=function(dataObj){return dataObj.hasOwnProperty("defaultFields")?dataObj.defaultFields:null},scope._removePrivateFields=function(dataObj){dataObj&&angular.forEach(scope.record,function(_obj){for(var _key in _obj)dataObj[_key]&&"private"==dataObj[_key]&&delete _obj[_key]})},scope._setElementActive=function(tabStr){scope.activeTab=tabStr},scope._setDisableTableBtnsState=function(stateBool){scope.disableTableBtns=stateBool},scope._createFieldsObj=function(schemaDataObj){if(scope.tableFields={onStartTotalActiveFields:0},!scope.defaultFieldsShown){var allKeys=Object.keys(schemaDataObj);return allKeys.length<scope.numAutoSelectFields&&(scope.numAutoSelectFields=allKeys.length),angular.forEach(schemaDataObj,function(value,index){if(scope.tableFields.onStartTotalActiveFields<scope.numAutoSelectFields&&index!=allKeys.length)switch(value.name){case"name":case"title":case"fname":case"lname":case"f_name":case"l_name":case"firstname":case"lastname":case"first_name":case"last_name":case"email":case"phone":scope.tableFields[value.name]=value,scope.tableFields[value.name].active=!0,scope.tableFields.onStartTotalActiveFields++;break;default:scope.tableFields[value.name]=value,scope.tableFields[value.name].active=!1}}),scope.tableFields.onStartTotalActiveFields<scope.numAutoSelectFields&&angular.forEach(scope.tableFields,function(_obj){if(scope.tableFields.onStartTotalActiveFields==scope.numAutoSelectFields)return!1;if(0==_obj.active)switch(_obj.type){case"date":case"time":case"datetime":_obj.active=!0,scope.tableFields.onStartTotalActiveFields++}}),scope.tableFields.onStartTotalActiveFields<scope.numAutoSelectFields&&angular.forEach(scope.tableFields,function(_obj){if(scope.tableFields.onStartTotalActiveFields==scope.numAutoSelectFields)return!1;0==_obj.active&&(_obj.active=!0,scope.tableFields.onStartTotalActiveFields++)}),!1}angular.forEach(schemaDataObj,function(value,index){if(scope.defaultFieldsShown.hasOwnProperty(value.name))switch(scope.defaultFieldsShown[value.name]){case!0:scope.tableFields[value.name]=value,scope.tableFields[value.name].active=!0;break;case!1:scope.tableFields[value.name]=value,scope.tableFields[value.name].active=!1;break;case"private":break;default:scope.tableFields[value.name]=value,scope.tableFields[value.name].active=!1}else scope.tableFields[value.name]=value,scope.tableFields[value.name].active=!1}),scope.tableFieldsAll=!1},scope._init=function(data){scope._prepareExtendedData(scope.options),scope._prepareExtendedSchema(scope.options),scope._prepareExcludedFields(scope.options),scope._prepareRecords(data)&&scope._prepareOverrideFields(scope.options),scope._prepareSchema(data),scope._prepareExtendedFieldTypes(scope.options),scope.defaultFieldsShown=scope._getDefaultFields(scope.options),scope._createFieldsObj(scope.schema.field),scope.activeTab=scope.schema.name+"-table",scope._calcPagination(data),scope.pagesArr[0].stopPropagation=!0,scope._setCurrentPage(scope.pagesArr[0])},scope._prepareRecords=function(data){return scope.record=scope._getRecordsFromData(data),scope.record?(scope._removePrivateFields(scope._getDefaultFields(scope.options)),angular.forEach(scope.record,function(_obj){scope._addStateProps(_obj),scope._addExtendedData(_obj),scope.options.exportValueOn&&scope._exportValue&&scope._checkExportValue(_obj)&&(scope._setExportState(_obj,!0),scope._exportValue=_obj)}),scope.options.normalizeData&&(scope.record=scope._normalizeData(scope.record)),!0):(scope.record=null,!1)},scope._checkExportValue=function(dataObj){return dataObj[scope.exportField.ref_field]===scope._exportValue[scope.exportField.ref_field]},scope._prepareSchema=function(data){scope.schema=scope._getSchemaFromData(data),scope.options.normalizeSchema&&scope.record.length>0&&(scope.schema=scope._normalizeSchema(scope.schema,scope.record)),angular.forEach(scope.extendedSchema,function(_obj){scope.schema.field.push(_obj)})},scope._prepareExtendedSchema=function(data){if(null==data.extendSchema)return!1;angular.forEach(data.extendSchema,function(_obj){scope.extendedSchema[_obj.name]={},scope.extendedSchema[_obj.name].name=_obj.name,scope.extendedSchema[_obj.name].type=_obj.type,scope.extendedSchema[_obj.name].label=_obj.label})},scope._prepareOverrideFields=function(data){if(null==data.overrideFields)return!1;angular.forEach(data.overrideFields,function(_obj){scope.overrideFields[_obj.field]={},_obj.hasOwnProperty("record")&&(scope.overrideFields[_obj.field].records=scope._getRecordsFromData(_obj.record)),scope.overrideFields[_obj.field].display=_obj.display})},scope._prepareExtendedFieldTypes=function(data){if(null==data.extendFieldTypes)return!1;angular.forEach(data.extendFieldTypes,function(_obj){scope.extendFieldTypes[_obj.db_type]={};for(var _key in _obj)scope.extendFieldTypes[_obj.db_type][_key]=_obj[_key]})},scope._prepareExtendedData=function(data){if(null==data.extendData)return!1;angular.forEach(data.extendData,function(_obj){scope.extendedData[_obj.name]={},scope.extendedData[_obj.name].name=_obj.name,scope.extendedData[_obj.name].value=_obj.value||null})},scope._addExtendedData=function(dataObj){angular.forEach(scope.extendedData,function(_obj){dataObj[_obj.name]=_obj.value})},scope._setActiveView=function(viewStr){scope.activeView=viewStr},scope._setExportValueToParent=function(dataObj){scope._exportValue=dataObj||null},scope._prepareExcludedFields=function(data){if(null==data.extendSchema)return!1;angular.forEach(data.excludeFields,function(_obj){scope.excludedFields[_obj.name]={},scope.excludedFields[_obj.name].fields=_obj.fields})},scope._calcTotalPages=function(totalCount,numPerPage){return Math.ceil(totalCount/numPerPage)},scope._createPageObj=function(_pageNum){return{number:_pageNum+1,value:_pageNum,offset:_pageNum*scope._getOptionFromParams("limit"),stopPropagation:!1}},scope._createPagesArr=function(_totalCount){scope.pagesArr=[];for(var i=0;i<_totalCount;i++)scope.pagesArr.push(scope._createPageObj(i))},scope._setCurrentPage=function(pageDataObj){scope.currentPage=pageDataObj},scope._getCurrentPage=function(){return!scope.currentPage&&scope.pagesArr.length>0?scope.currentPage=scope.pagesArr[0]:scope.currentPage||scope.pagesArr.length||(scope.pagesArr.push(scope._createPageObj(0)),scope.currentPage=scope.pagesArr[0]),scope.currentPage},scope._isFirstPage=function(){return 0===scope._getCurrentPage().value},scope._isLastPage=function(){return scope.currentPage.value===scope.pagesArr.length-1},scope._previousPage=function(){scope.currentPage=scope.pagesArr[scope.currentPage.value-1]},scope._nextPage=function(){scope.currentPage=scope.pagesArr[scope.currentPage.value+1]},scope._calcPagination=function(newValue){scope.pagesArr=[];var count=scope._getCountFromMeta(newValue);if(0==count)return scope.pagesArr.push(scope._createPageObj(0)),!1;scope._createPagesArr(scope._calcTotalPages(count,scope._getOptionFromParams("limit")))},scope._resetFilter=function(schemaDataObj){if(!schemaDataObj)return!1;scope.filter={viewBy:schemaDataObj.field[0].name||"",prop:schemaDataObj.field[0].name||"",type:schemaDataObj.field[0].type||"",props:schemaDataObj.field[0],value:null}},scope._isFiltered=function(){return scope.filteredRecords},scope._createFilterParams=function(){var param="";switch(scope.filter.prop.type){case"boolean":param=scope.filter.prop.name+" = "+scope.filter.value;break;case"text":case"string":param=scope.filter.prop.name+' like "%'+scope.filter.value+'%"';break;case"integer":case"float":case"double":case"decimal":param=scope.filter.prop.name+" "+scope.filterType.operator+" "+scope.filter.value}return param},scope._unsetFilterInOptions=function(){scope.options.params.hasOwnProperty("filter")&&delete scope.options.params.filter},scope._setFilterInOptions=function(){return!!scope._checkForFilterValue()&&(scope.options.params.hasOwnProperty("filter"),scope.options.params.filter=scope._createFilterParams(),!0)},scope._checkForFilterValue=function(){return!!scope.filter.value},scope._resetOrder=function(schemaDataObj){if(!schemaDataObj)return!1;scope.order={orderBy:schemaDataObj.field[0].name||"",orderByReverse:!1}},scope._isOrdered=function(){return scope.orderedRecords},scope._createOrderParams=function(){var orderStr=scope.order.orderBy+" ";return orderStr+=scope.order.orderByReverse?"DESC":"ASC"},scope._unsetOrderInOptions=function(){scope.options.params.hasOwnProperty("order")&&delete scope.options.params.order},scope._setOrderInOptions=function(){scope.options.params.hasOwnProperty("order"),scope.options.params.order=scope._createOrderParams()},scope._setChildTableActive=function(stateBool){scope.childTableActive=stateBool},scope._setChildTableParentRecord=function(recordObj){scope.childTableParentRecord=recordObj},scope._buildChildTableOptions=function(){scope.childTableOptions={isChildTable:!0,allowChildTable:!1},scope.childTableOptions=dfObjectService.deepMergeObjects(scope.childTableOptions,angular.copy(scope.defaults))},scope._addChildTable=function(){angular.element(scope.options.childTableAttachPoint).append($compile('<df-child-table data-child-options="childTableOptions" data-parent-schema="schema" data-child-table-parent-record="childTableParentRecord"></df-child-table>')(scope))},scope._setTab=function(tabStr){scope._setElementActive(tabStr)},scope._toggleSelected=function(dataObj){scope._toggleSelectedState(dataObj)},scope._normalizeData=function(dataObj){return angular.forEach(dataObj,function(_obj){for(var _key in _obj)null==_obj[_key]&&(_obj[_key]="NULL")}),dataObj},scope._normalizeSchema=function(schemaDataObj,recordsDataArr){var normalizedSchema=[];for(var _key in schemaDataObj.field)recordsDataArr[0].hasOwnProperty(schemaDataObj.field[_key].name)&&normalizedSchema.push(schemaDataObj.field[_key]);return delete schemaDataObj.field,schemaDataObj.field=normalizedSchema,schemaDataObj},scope._getPrevious=function(){scope._previousPage()},scope._getNext=function(){scope._nextPage()},scope._editRecord=function(dataObj){scope._setCurrentEditRecord(dataObj)},scope._saveRecords=function(){scope._setInProgress(!0);var recordsToSave=scope._getRecordsWithState(scope.record,"unsaved",!0);scope._saveRecordsToServer(recordsToSave).then(function(result){angular.forEach(scope.record,function(_obj){scope._isUnsaved(_obj)&&scope._toggleUnsavedState(_obj),scope._isSelected(_obj)&&scope._toggleSelectedState(_obj),scope._hasRevertCopy(_obj)&&scope._removeRevertCopy(_obj)}),scope.$emit(scope.es.alertSuccess,{message:"Records saved."})},function(reject){throw{module:"xxDreamFactory Table Module",type:"error",provider:"dreamfactory",exception:reject}}).finally(function(){scope._setInProgress(!1)},function(){scope._setInProgress(!1)})},scope._revertRecords=function(){angular.forEach(scope.record,function(_obj,_index){scope._isUnsaved(_obj)&&scope._hasRevertCopy(scope.record[_index])&&(scope.record[_index]=scope._getRevertCopy(_obj))}),scope.$emit(scope.es.alertSuccess,{message:"Records reverted."})},scope._deleteRecords=function(){var recordsToDelete=scope._getRecordsWithState(scope.record,"selected");scope._deleteRecordsFromServer(recordsToDelete).then(function(result){var requestDataObj={},curPage=scope._getCurrentPage().value,curOffset=scope._getCurrentPage().offset;scope._isLastPage()&&scope.record.length===scope._getRecordsFromData(result).length&&(curOffset-=scope._getOptionFromParams("limit")),requestDataObj.params=dfObjectService.mergeObjects({offset:curOffset},scope.options.params),scope._getRecordsFromServer(requestDataObj).then(function(_result){scope.$emit(scope.es.alertSuccess,{message:"Records deleted."}),scope._prepareRecords(_result),scope._createPagesArr(scope._calcTotalPages(scope._getCountFromMeta(_result),scope._getOptionFromParams("limit"))),curPage>scope.pagesArr.length-1&&0!==curPage&&(curPage-=1,scope.pagesArr[curPage].stopPropagation=!0),scope._setCurrentPage(scope.pagesArr[curPage])},function(reject){throw{module:"DreamFactory Table Module",type:"error",provider:"dreamfactory",exception:reject}})},function(reject){throw{module:"DreamFactory Table Module",type:"error",provider:"dreamfactory",exception:reject}}).finally(function(){scope._setInProgress(!1)},function(){scope._setInProgress(!1)})},scope._getRecordsWithFilter=function(){var requestDataObj={};requestDataObj.params=dfObjectService.mergeObjects({filter:scope._createFilterParams()},scope.options.params),scope._setInProgress(!0),scope._getRecordsFromServer(requestDataObj).then(function(result){scope._init(dfObjectService.mergeObjects({data:result},scope.options))},function(reject){throw{module:"DreamFactory Table Module",type:"error",provider:"dreamfactory",exception:reject}}).finally(function(){scope._setInProgress(!1)},function(){scope._setInProgress(!1)})},scope._refreshResults=function(checkUnsavedBool){if((checkUnsavedBool=checkUnsavedBool||!0)&&scope._checkForUnsavedRecords(scope.record)&&!confirm("You have Unsaved records.  Continue without saving?"))return!1;var requestDataObj={};requestDataObj.params={offset:0},scope._setInProgress(!0),scope._getRecordsFromServer(requestDataObj).then(function(result){scope._prepareRecords(result),scope._calcPagination(result),scope._setCurrentPage(scope.pagesArr[0])},function(reject){throw{module:"DreamFactory Table Module",type:"error",provider:"dreamfactory",exception:reject}}).finally(function(){scope._setInProgress(!1)},function(){scope._setInProgress(!1)})},scope._applyFilter=function(){if(scope._checkForUnsavedRecords(scope.record)&&!confirm("You have Unsaved records.  Continue without saving?"))return!1;scope._setFilterInOptions()&&(scope.filteredRecords=!0),scope._setOrderInOptions(),scope.orderedRecords=!0;var requestDataObj={};requestDataObj.params={offset:0},scope._setInProgress(!0),scope._getRecordsFromServer(requestDataObj).then(function(result){scope._prepareRecords(result),scope._calcPagination(result),scope._setCurrentPage(scope.pagesArr[0])},function(reject){throw{module:"DreamFactory Table Module",type:"error",provider:"dreamfactory",exception:reject}}).finally(function(){scope._setInProgress(!1)},function(){scope._setInProgress(!1)})},scope._removeFilter=function(){if(scope._checkForUnsavedRecords(scope.record)&&!confirm("You have Unsaved records.  Continue without saving?"))return!1;scope._unsetFilterInOptions(),scope._unsetOrderInOptions(),scope._resetFilter(scope.schema),scope._resetOrder(scope.schema),scope.filteredRecords=!1,scope.orderedRecords=!1;var requestDataObj={};requestDataObj.params={offset:0},scope._setInProgress(!0),scope._getRecordsFromServer(requestDataObj).then(function(result){scope._prepareRecords(result),scope._calcPagination(result),scope._setCurrentPage(scope.pagesArr[0]),scope.filter.prop=scope.schema.field[0]},function(reject){throw{module:"DreamFactory Table Module",type:"error",provider:"dreamfactory",exception:reject}}).finally(function(){scope._setInProgress(!1)},function(){scope._setInProgress(!1)})},scope._orderOnSelect=function(fieldObj){scope.order.orderBy===fieldObj.name?scope.order.orderByReverse=!scope.order.orderByReverse:(scope.order.orderBy=fieldObj.name,scope.order.orderByReverse=!1)},scope._createRecord=function(){scope._setNewRecordObj()},scope._setExportValue=function(dataObj){scope._setExportValueToParent(dataObj)},scope._toggleExpandEditor=function(){scope.relatedExpand=!scope.relatedExpand},scope._editExportRecord=function(dataObj){scope.options.exportValueOn&&scope.parentRecord&&(scope.relatedExpand?scope.relatedExpand&&!scope.currentEditRecord&&scope._setCurrentEditRecord(dataObj):(scope._setCurrentEditRecord(dataObj),scope._toggleExpandEditor()))},scope._filterRecords=function(){scope.filterOn=!scope.filterOn},scope._toggleAllFields=function(){scope.tableFieldsAll=!scope.tableFieldsAll,angular.forEach(scope.tableFields,function(_obj){"[object Object]"===Object.prototype.toString.call(_obj)&&_obj.hasOwnProperty("active")&&(_obj.active=scope.tableFieldsAll)})},scope._resetAllFields=function(){scope._createFieldsObj(scope.schema.field)},scope._toggleAllRecords=function(){scope.selectedAll=!scope.selectedAll,angular.forEach(scope.record,function(_obj){scope._setSelectedState(_obj,scope.selectedAll)})},scope._showChildTable=function(parentRecordObj){if(scope.childTableActive)return!1;scope._setChildTableActive(!0),scope._setChildTableParentRecord(parentRecordObj),scope._buildChildTableOptions(),scope._addChildTable(),scope._setDisableTableBtnsState(!0)};var watchUserOptions=scope.$watchCollection("userOptions",function(newValue,oldValue){if(!newValue)return!1;scope.options=dfObjectService.deepMergeObjects(newValue,scope.defaults),scope._setActiveView("table"),dfTableCallbacksService.reset()}),watchOptions=scope.$watchCollection("options",function(newValue,oldValue){if(!newValue)return!1;if(!newValue.service)return!1;if(scope.options.exportValueOn&&!scope._exportValue&&scope.parentRecord[scope.exportField.name]){var requestDataObj={};requestDataObj.params={filter:scope.exportField.ref_field+" = "+scope.parentRecord[scope.exportField.name]},scope._getRecordsFromServer(requestDataObj).then(function(result){var record=scope._getRecordsFromData(result)[0];scope._addStateProps(record),scope._exportValue=record,scope.options.params.filter&&delete scope.options.params.filter,newValue.data?(scope._init(newValue),scope._resetFilter(scope.schema),scope._resetOrder(scope.schema)):scope._getRecordsFromServer().then(function(_result){scope._init(_result),scope._resetFilter(scope.schema),scope._resetOrder(scope.schema)},function(_reject){throw{module:"DreamFactory Table Module",type:"error",provider:"dreamfactory",exception:_reject}})},function(reject){throw{module:"DreamFactory Table Module",type:"error",provider:"dreamfactory",exception:reject}})}else newValue.data?(scope._init(newValue),scope._resetFilter(scope.schema),scope._resetOrder(scope.schema)):(scope.options.params.offset=newValue.table!==oldValue.table?0:scope.options.params.offset,scope._getRecordsFromServer().then(function(_result){scope._init(_result),scope._resetFilter(scope.schema),scope._resetOrder(scope.schema)},function(_reject){throw{module:"DreamFactory Table Module",type:"error",provider:"dreamfactory",exception:_reject}}))}),watchCurrentPage=scope.$watch("currentPage",function(newValue,oldValue){if(newValue.value==oldValue.value)return!1;if(newValue.stopPropagation)return newValue.stopPropagation=!1,!1;if(scope._checkForUnsavedRecords(scope.record)&&!confirm("You have Unsaved records.  Continue without saving?"))return oldValue.stopPropagation=!0,scope._setCurrentPage(oldValue),!1;var requestDataObj={};requestDataObj.params={offset:newValue.offset},scope._setInProgress(!0),scope._getRecordsFromServer(requestDataObj).then(function(result){scope._prepareRecords(result)},function(reject){throw{module:"DreamFactory Table Module",type:"error",provider:"dreamfactory",exception:reject}}).finally(function(){scope._setInProgress(!1)},function(){scope._setInProgress(!1)})}),watchCurrentEditRecord=scope.$watch("currentEditRecord",function(newValue,oldValue){newValue?(scope._hasRevertCopy(newValue)||scope._createRevertCopy(newValue),scope._filterFormSchema("edit"),scope._buildSchemaGroups(),scope._checkForGroupedSchema("Edit "+scope.schema.name.charAt(0).toUpperCase()+scope.schema.name.slice(1)),scope._setActiveView("edit")):(scope._setActiveView("table"),scope._clearGroupedSchema(),scope._clearFilteredSchema())}),watchCurrentEditRecordState=scope.$watchCollection("currentEditRecord",function(newValue,oldValue){oldValue&&null==newValue&&scope._hasRevertCopy(oldValue)&&(scope._compareObjects(oldValue,oldValue.__dfData.revert)?scope._setUnsavedState(oldValue,!0):scope._setUnsavedState(oldValue,!1))}),watchParentRecord=scope.$watchCollection("parentRecord",function(newValue,oldValue){if(!newValue)return!1;if(!newValue&&!scope._exportValue)return!1;if(null==(!scope._exportValue&&newValue[scope.exportField.name]))return!1;if(!newValue[scope.exportField.name])return scope._exportValue=null,!1;if(!scope._exportValue&&newValue[scope.exportField.name]||scope._exportValue[scope.exportField.ref_field]!==newValue[scope.exportField.name]){var requestDataObj={};return requestDataObj.params={filter:scope.exportField.ref_field+" = "+newValue[scope.exportField.name],offset:0},scope._getRecordsFromServer(requestDataObj).then(function(result){var record=scope._getRecordsFromData(result);if(!record)throw{module:"DreamFactory Table Module",type:"error",provider:"dreamfactory",exception:"Revert related data record not found."};scope._addStateProps(record[0]),scope._exportValue=record[0],scope.options.params.filter&&delete scope.options.params.filter},function(reject){throw{module:"DreamFactory Table Module",type:"error",provider:"dreamfactory",exception:reject}}),!1}}),watchExportValue=scope.$watch("_exportValue",function(newValue,oldValue){if(!newValue&&!oldValue)return!1;if(!newValue&&oldValue){scope._setExportState(oldValue,!1);var found=!1,i=0;if(scope.record)for(;!found&&i<scope.record.length;)null===(record=scope.record[i])[scope.exportField.name]&&(scope._setExportState(scope.record[i],!1),found=!0),i++;return scope.parentRecord[scope.exportField.name]=newValue,!1}if(!oldValue&&newValue){var found=!1,i=0;if(scope.record)for(;!found&&i<scope.record.length;)(record=scope.record[i])[scope.exportField.name]===scope._exportValue[scope.exportField.name]&&(scope._setExportState(scope.record[i],!0),found=!0),i++}if(oldValue&&newValue){scope._setExportState(oldValue,!1);var found=!1,i=0;if(scope.record)for(;!found&&i<scope.record.length;)(record=scope.record[i])[scope.exportField.ref_field]===newValue[scope.exportField.ref_field]&&(scope._setExportState(scope.record[i],!0),found=!0),i++;if(found=!1,i=0,scope.record)for(;!found&&i<scope.record.length;)(record=scope.record[i])[scope.exportField.ref_field]===oldValue[scope.exportField.ref_field]&&(scope._setExportState(scope.record[i],!1),found=!0),i++}if(scope.parentRecord[scope.exportField.name]===newValue[scope.exportField.ref_field])return newValue&&scope._setExportState(newValue,!0),oldValue&&scope._setExportState(oldValue,!1),!1;for(var found=!1,i=0;!found&&i<scope.record.length;){var record=scope.record[i];record[scope.exportField.name]===scope._exportValue[scope.exportField.name]&&(scope._setExportState(scope.record[i],!1),found=!0),i++}scope.parentRecord[scope.exportField.name]=newValue[scope.exportField.ref_field],scope._setExportState(oldValue,!1),scope._setExportState(newValue,!0)}),watchNewRecord=scope.$watch("newRecord",function(newValue,oldValue){newValue?(scope._setActiveView("new"),scope._filterFormSchema("create"),scope._buildSchemaGroups(),scope._checkForGroupedSchema("Create "+scope.schema.name.charAt(0).toUpperCase()+scope.schema.name.slice(1))):(scope._setActiveView("table"),scope._clearGroupedSchema())}),watchChildTableParentRecord=scope.$watch("childTableParentRecord",function(newValue,oldValue){if(!newValue)return!1;angular.forEach(scope.record,function(obj){obj.$$hashKey!=newValue.$$hashKey&&scope._setHideState(obj,!0)})});scope.$watch("filter.prop.type ",function(newValue,oldValue){if(!newValue)return!1;"boolean"===newValue?scope.filter.value="TRUE":"text"===newValue||"string"===newValue?scope.filter.value=null:(scope.filter.value=null,scope.filterType.operator="<")});scope.$on(scope.es.refreshTable,function(e){scope._refreshResults(!1)}),scope.$on(scope.es.closeChildTable,function(e){scope._setChildTableParentRecord(null),angular.forEach(scope.record,function(obj){scope._setHideState(obj,!1)}),scope._setDisableTableBtnsState(!1),scope._setChildTableActive(!1)}),scope.$on("$destroy",function(e){watchUserOptions(),watchOptions(),watchCurrentPage(),watchCurrentEditRecord(),watchCurrentEditRecordState(),watchParentRecord(),watchExportValue(),watchNewRecord(),watchChildTableParentRecord()})}}}]).directive("editRecord",["DF_TABLE_ASSET_PATH","$http","dfObjectService","dfTableEventService","dfTableCallbacksService",function(DF_TABLE_ASSET_PATH,$http,dfObjectService,dfTableEventService,dfTableCallbacksService){return{restrict:"E",scope:!1,templateUrl:DF_TABLE_ASSET_PATH+"views/edit-record.html",link:function(scope,elem,attrs){scope.es=dfTableEventService,scope.closeRecord=function(){scope._closeEdit()},scope.revertRecord=function(){scope._revertRecord()},scope.deleteRecord=function(){scope._deleteRecord()},scope.saveRecord=function(){scope._saveRecord()},scope._closeEdit=function(){scope.currentEditRecord=null},scope._revertRecordData=function(){var recordCopy=scope._getRevertCopy(scope.currentEditRecord);for(var _key in recordCopy)scope.currentEditRecord.hasOwnProperty(_key)&&"__dfData"!==_key&&(scope.currentEditRecord[_key]=angular.copy(recordCopy[_key]))},scope._deleteRecordFromServer=function(recordDataObj){return $http({method:"POST",url:scope.options.url,data:{resource:[recordDataObj]},headers:{"X-HTTP-METHOD":"DELETE"}})},scope._saveRecordToServer=function(recordDataObj){return $http({method:"PATCH",url:scope.options.url,data:{resource:[recordDataObj]}})},scope._revertRecord=function(){scope._revertRecordData(),scope.$emit(scope.es.alertSuccess,{message:"Record reverted."})},scope._deleteRecord=function(){scope._setInProgress(!0),dfTableCallbacksService.run("onDelete","pre",scope.currentEditRecord),scope._deleteRecordFromServer(scope.currentEditRecord).then(function(result){dfTableCallbacksService.run("onDelete","post",result),scope.$emit(scope.es.alertSuccess,{message:"Record deleted."});var requestDataObj={},curPage=scope._getCurrentPage().value,curOffset=scope._getCurrentPage().offset;scope._isLastPage()&&"object"==typeof result&&1===scope.record.length&&(curOffset-=scope._getOptionFromParams("limit")),requestDataObj.params=dfObjectService.mergeObjects({offset:curOffset},scope.options.params),scope._getRecordsFromServer(requestDataObj).then(function(_result){scope._prepareRecords(_result),scope._createPagesArr(scope._calcTotalPages(scope._getCountFromMeta(_result),scope._getOptionFromParams("limit"))),curPage>scope.pagesArr.length-1&&0!==curPage&&(curPage-=1,scope.pagesArr[curPage].stopPropagation=!0),scope._setCurrentPage(scope.pagesArr[curPage]),scope._setCurrentEditRecord(null)},function(reject){throw{module:"DreamFactory Table Module",type:"error",provider:"dreamfactory",exception:reject}})},function(reject){throw{module:"DreamFactory Table Module",type:"error",provider:"dreamfactory",exception:reject}}).finally(function(){scope._setInProgress(!1)},function(){scope._setInProgress(!1)})},scope._saveRecord=function(){scope._setInProgress(!0),dfTableCallbacksService.run("onUpdate","pre",scope.currentEditRecord),scope._saveRecordToServer(scope.currentEditRecord).then(function(result){scope._removeRevertCopy(scope.currentEditRecord),scope._setUnsavedState(scope.currentEditRecord,!1),dfTableCallbacksService.run("onUpdate","pre",result),scope.$emit(scope.es.alertSuccess,{message:"Record saved."}),scope.options.autoClose?scope._closeEdit():scope._createRevertCopy(scope.currentEditRecord)},function(reject){throw{module:"DreamFactory Table Module",type:"error",provider:"dreamfactory",exception:reject}}).finally(function(){scope._setInProgress(!1)},function(){scope._setInProgress(!1)})}}}}]).directive("createRecord",["DF_TABLE_ASSET_PATH","$http","dfTableEventService","dfTableCallbacksService",function(DF_TABLE_ASSET_PATH,$http,dfTableEventService,dfTableCallbacksService){return{restrict:"E",scope:!1,templateUrl:DF_TABLE_ASSET_PATH+"views/create-record.html",link:function(scope,elem,attrs){scope.es=dfTableEventService,scope.closeCreateRecord=function(){scope._closeCreateRecord()},scope.saveNewRecord=function(){scope._saveNewRecord()},scope._setCreateNewRecordNull=function(){scope.newRecord=null},scope._saveNewRecordToServer=function(){return $http({method:"POST",url:scope.options.url,data:{resource:[scope.newRecord]},params:{fields:"*"}})},scope._closeCreateRecord=function(){scope._setCreateNewRecordNull()},scope._saveNewRecord=function(){var dataField,schemaField;for(dataField in scope.newRecord)if(scope.newRecord.hasOwnProperty(dataField)&&null===scope.newRecord[dataField])for(schemaField in scope.tableFields)scope.tableFields.hasOwnProperty(schemaField)&&dataField===schemaField&&scope.tableFields[schemaField].hasOwnProperty("allow_null")&&!scope.tableFields[schemaField].allow_null&&scope.tableFields[schemaField].hasOwnProperty("auto_increment")&&scope.tableFields[schemaField].auto_increment&&delete scope.newRecord[dataField];scope._setInProgress(!0),dfTableCallbacksService.run("onCreate","pre",scope.newRecord),scope._saveNewRecordToServer().then(function(result){dfTableCallbacksService.run("onCreate","post",result),0===scope.record.length?scope._refreshResults():scope.record.length<scope.options.params.limit?(scope._addStateProps(result.data.resource[0]),scope.record.push(result.data.resource[0])):scope.record.length*scope.pagesArr.length<scope.count+1&&scope.pagesArr.push(scope._createPageObj(scope.pagesArr.length)),scope.$emit(scope.es.alertSuccess,{message:"Record created."}),scope._closeCreateRecord()},function(reject){throw{module:"DreamFactory Table Module",type:"error",provider:"dreamfactory",exception:reject}}).finally(function(){scope._setInProgress(!1)},function(){scope._setInProgress(!1)})}}}}]).directive("dreamfactoryBuildField",["$templateCache","$compile","dfObjectService","INSTANCE_URL",function($templateCache,$compile,dfObjectService,INSTANCE_URL){return{restrict:"A",scope:{field:"=?",service:"=?",table:"=?",extendFieldTypes:"=?",overrideFields:"=?",currentEditRecord:"=?",activeView:"=?"},link:function(scope,elem,attrs){if(scope._parseEditable=function(fieldObj){return!fieldObj||!fieldObj.hasOwnProperty("validation")||null==fieldObj.validation||!fieldObj.validation.hasOwnProperty("api_read_only")},scope.defaultFieldTypes={id:{template:"df-input-text.html",placeholder:"Id",type:"text",editable:!1},string:{template:"df-input-text.html",placeholder:"Enter String Value",type:"text",editable:!0},text:{template:"df-input-textarea.html",placeholder:"",type:"textarea",editable:!0},integer:{template:"df-input-int.html",placeholder:"Enter Integer Value",type:"number",editable:!0},boolean:{template:"df-input-checkbox.html",placeholder:"",type:"",editable:!0},binary:{template:"df-input-binary.html",placeholder:"Enter String Value",type:"text",editable:!1},float:{template:"df-input-number.html",placeholder:"Enter Float Value",type:"number",editable:!0},double:{template:"df-input-number.html",placeholder:"Enter Double Value",type:"number",editable:!0},decimal:{template:"df-input-number.html",placeholder:"Enter Decimal Value",type:"number",editable:!0},datetime:{template:"df-input-text.html",placeholder:"",type:"text",editable:!0},date:{template:"df-input-text.html",placeholder:"",type:"text",editable:!0},time:{template:"df-input-text.html",placeholder:"",type:"text",editable:!0},timestamp:{template:"df-input-text.html",placeholder:"",type:"text",editable:!0},reference:{template:"df-input-reference.html",placeholder:"",type:"",editable:!1},user_id:{template:"df-input-text.html",placeholder:"Enter Text Value",type:"text",editable:!1},user_id_on_update:{template:"df-input-text.html",placeholder:"Enter Text Value",type:"text",editable:!1},user_id_on_create:{template:"df-input-text.html",placeholder:"Enter Text Value",type:"text",editable:!1},timestamp_on_update:{template:"df-input-text.html",placeholder:"Enter Text Value",type:"text",editable:!1},timestamp_on_create:{template:"df-input-text.html",placeholder:"Enter Text Value",type:"text",editable:!1}},scope.fieldTypes=dfObjectService.mergeObjects(scope.extendFieldTypes,scope.defaultFieldTypes),scope.overrideFields[scope.field.name])switch(scope.templateData={prop:scope.field.name,template:"",placeholder:scope.overrideFields[scope.field.name].display.type||"",type:scope.overrideFields[scope.field.name].display.type||"text",editable:scope.overrideFields[scope.field.name].editable,field:scope.field||"",dependent:scope.overrideFields[scope.field.name].display.dependent||!1},scope.overrideFields[scope.field.name].display.type){case"select":scope.templateData.template="df-input-select.html";break;case"checkbox":scope.templateData.template="df-input-checkbox.html";break;case"text":case"textarea":scope.templateData.template="df-input-text.html";break;case"custom":scope.templateData.template=scope.overrideFields[scope.field.name].display.template;break;default:scope.templateData.template="df-input-text.html"}else scope.templateData=scope.fieldTypes[scope.field.type],scope.templateData.editable=scope._parseEditable(scope.field);switch(scope.field.type){case"string":scope.field.hasOwnProperty("picklist")&&null!==scope.field.picklist&&scope.field.picklist.length>0&&(scope.field.hasOwnProperty("validation")&&null!==scope.field.validation&&scope.field.validation.hasOwnProperty("picklist")?scope.templateData.template="df-input-values-only-picklist.html":scope.templateData.template="df-input-values-picklist.html",scope.data=scope.field.picklist,scope.assignValue=function(itemStr){scope.currentEditRecord[scope.field.name]=itemStr});break;case"boolean":scope.templateData.template="df-input-bool-picklist.html",scope.__dfBools=[{value:!0,name:"TRUE"},{value:!1,name:"FALSE"}],scope.field.allow_null&&scope.__dfBools.unshift({value:"",name:"NULL"});break;case"reference":scope._parseSystemTableName=function(tableNameStr){return"df_sys_"===tableNameStr.substr(0,"df_sys_".length)?tableNameStr.substr("df_sys_".length):tableNameStr},scope._buildURL=function(serviceNameStr,tableNameStr){return INSTANCE_URL.url+"/"+serviceNameStr+"/_table/"+tableNameStr},scope.relatedOptions={service:scope.service,table:scope._parseSystemTableName(scope.field.ref_table),url:scope._buildURL(scope.service,scope._parseSystemTableName(scope.field.ref_table)),params:{filter:null,limit:10,offset:0,fields:"*",include_schema:!0,include_count:!0},defaultFields:{},exportValueOn:!0},scope.relatedOptions.defaultFields[scope.field.ref_field]=!0}elem.append($compile($templateCache.get(scope.templateData.template))(scope))}}}]).directive("dfChildTable",["DF_TABLE_ASSET_PATH","INSTANCE_URL","dfObjectService","dfTableEventService",function(DF_TABLE_ASSET_PATH,INSTANCE_URL,dfObjectService,dfTableEventService){return{restrict:"E",scope:{childOptions:"=",parentSchema:"=",childTableParentRecord:"="},templateUrl:DF_TABLE_ASSET_PATH+"views/df-child-table.html",link:function(scope,elem,attrs){scope.options={},scope.childRecordsBy="",scope.service=scope.childOptions.service,scope.closeChildTable=function(){scope._closeChildTable()},scope._parseSystemTableName=function(tableNameStr){return"df_sys_"===tableNameStr.substr(0,"df_sys_".length)?tableNameStr.substr("df_sys_".length):tableNameStr},scope._setSystemService=function(tableNameStr){return"df_sys_"===tableNameStr.substr(0,"df_sys_".length)?"system":scope.service},scope._closeChildTable=function(){scope.$emit(dfTableEventService.closeChildTable),angular.element(elem).remove()};var watchChildRecordsBy=scope.$watch("childRecordsBy",function(newValue,oldValue){if(!newValue)return!1;var options={service:scope._setSystemService(newValue.ref_table),table:newValue.ref_table,url:INSTANCE_URL.url+"/"+scope._setSystemService(newValue.ref_table)+"/_table/"+scope._parseSystemTableName(newValue.ref_table),params:{filter:newValue.ref_field+" = "+scope.childTableParentRecord[newValue.field]}};scope.options=dfObjectService.deepMergeObjects(options,scope.childOptions)});scope.$on("$destroy",function(e){watchChildRecordsBy()})}}}]).service("dfTableEventService",[function(){return{alertSuccess:"alert:success",refreshTable:"refresh:table",closeChildTable:"close:childtable"}}]).service("dfTableCallbacksService",[function(){var callbacks={onCreate:{pre:[],post:[]},onDelete:{pre:[],post:[]},onUpdate:{pre:[],post:[]}};return{add:function(actionStr,processStr,method){callbacks[actionStr][processStr].push(method)},run:function(actionStr,processStr,inputRecord){if(0==callbacks[actionStr][processStr].length)return!1;angular.forEach(callbacks[actionStr][processStr],function(value,index){value.call(void 0,inputRecord)})},reset:function(){callbacks={onCreate:{pre:[],post:[]},onDelete:{pre:[],post:[]},onUpdate:{pre:[],post:[]}}}}}]),angular.module("dfServices",["ngRoute","dfUtility"]).constant("MOD_SERVICES_ROUTER_PATH","/services").constant("MOD_SERVICES_ASSET_PATH","admin_components/adf-services/").config(["$routeProvider","MOD_SERVICES_ROUTER_PATH","MOD_SERVICES_ASSET_PATH",function($routeProvider,MOD_SERVICES_ROUTER_PATH,MOD_SERVICES_ASSET_PATH){$routeProvider.when(MOD_SERVICES_ROUTER_PATH,{templateUrl:MOD_SERVICES_ASSET_PATH+"views/main.html",controller:"ServicesCtrl"})}]).run(["$templateCache",function($templateCache){}]).controller("ServicesCtrl",["$rootScope","$scope","$location","dfApplicationData","UserDataService","dfNotify",function($rootScope,$scope,$location,dfApplicationData,UserDataService,dfNotify){$scope.adminApp=dfApplicationData.getQueryParameter("admin_app"),$scope.apiData=null,$scope.services=null,$scope.filteredServices=null,$scope.selectedGroup={name:null},$scope.selectedType={name:null},$scope.searchText={value:null};var details="",user=UserDataService.getCurrentUser();details=user?user.is_sys_admin?"You are logged in as an admin user which allows access to all active services.":"You are logged in as a non-admin user. Your assigned role for the API Docs app will determine which active services you have access to.":"You are not logged in. The default role for the API Docs app will determine which active services you have access to.",$scope.emptySearchResult={title:"There are no active services that match your search criteria!",text:details},$scope.saveAsFile=function(data,filename){if(data){filename||(filename="download.json"),"object"==typeof data&&(data=JSON.stringify(data,void 0,2));var blob=new Blob([data],{type:"text/json"});if(window.navigator&&window.navigator.msSaveOrOpenBlob)window.navigator.msSaveOrOpenBlob(blob,filename);else{var e=document.createEvent("MouseEvents"),a=document.createElement("a");a.download=filename,a.href=window.URL.createObjectURL(blob),a.dataset.downloadurl=["text/json",a.download,a.href].join(":"),e.initEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),a.dispatchEvent(e)}}},$scope.downloadAllServiceDef=function(){$scope.dataLoading=!0;var apis=["/api_docs"];dfApplicationData.getApiData(apis).then(function(response){$scope.saveAsFile(response[0],"all_api_docs.json")},function(error){var messageOptions={module:"Api Error",type:"error",provider:"dreamfactory",message:{data:error}};dfNotify.error(messageOptions)}).finally(function(){$scope.dataLoading=!1})},$scope.downloadSelectedServiceDef=function(){$scope.dataLoading=!0;var apis=["/api_docs/"+$scope.currentEditService.name];dfApplicationData.getApiData(apis).then(function(response){$scope.saveAsFile(response[0],$scope.currentEditService.name+"_api_docs.json")},function(error){var messageOptions={module:"Api Error",type:"error",provider:"dreamfactory",message:{data:error}};dfNotify.error(messageOptions)}).finally(function(){$scope.dataLoading=!1})},$scope.dataLoading=!0,$scope.loadTabData=function(){var apis=[""];dfApplicationData.getApiData(apis).then(function(response){var newApiData={};apis.forEach(function(value,index){newApiData[value]=response[index].resource?response[index].resource:response[index]}),$scope.apiData=newApiData},function(error){var messageOptions={module:"Api Error",type:"error",provider:"dreamfactory",message:{data:error}};dfNotify.error(messageOptions)}).finally(function(){$scope.dataLoading=!1})}()}]).directive("dfManageServices",["$rootScope","MOD_SERVICES_ASSET_PATH","dfApplicationData","dfNotify",function($rootScope,MOD_SERVICES_ASSET_PATH,dfApplicationData,dfNotify){return{restrict:"E",scope:!1,templateUrl:MOD_SERVICES_ASSET_PATH+"views/df-manage-services.html",link:function(scope){var ManagedService=function(record){return{__dfUI:{selected:!1},record:record}};scope.currentEditService=null,scope.fields=[{name:"name",label:"Service Name",active:!0},{name:"label",label:"Label",active:!0},{name:"description",label:"Description",active:!0},{name:"group",label:"Group",active:!0},{name:"type_label",label:"Type",active:!0}],scope.order={orderBy:"name",orderByReverse:!1},scope.editService=function(service){var apis=["/api_docs/"+service.name];dfApplicationData.getApiData(apis).then(function(response){if(Array.isArray(response)&&Array.isArray(response[0].paths)&&0===response[0].paths.length){var messageOptions={module:"Api Error",type:"error",provider:"dreamfactory",message:"The service '"+service.name+"' has no API docs."};dfNotify.error(messageOptions)}else dfNotify.clear(),scope.currentEditService=service},function(error){var messageOptions={module:"Api Error",type:"error",provider:"dreamfactory",message:{data:error}};dfNotify.error(messageOptions)})},scope.orderOnSelect=function(fieldObj){scope.order.orderBy===fieldObj.name?scope.order.orderByReverse=!scope.order.orderByReverse:(scope.order.orderBy=fieldObj.name,scope.order.orderByReverse=!1)},scope.$watch("apiData",function(newValue){if(newValue){var services=[];angular.forEach(scope.apiData[""].services,function(service){"api_docs"!==service.name&&services.push(new ManagedService(service))}),scope.services=services,scope.filteredServices=services;var group,groups={};angular.forEach(scope.apiData[""].service_types,function(service){"API Doc"!==(group=service.group)&&(groups.hasOwnProperty(group)||(groups[group]=[]),groups[group].push({name:service.name,label:service.label}))}),scope.serviceGroups=groups,angular.forEach(scope.services,function(service){angular.forEach(scope.serviceGroups,function(value,key){angular.forEach(value,function(type){service.record.type===type.name&&(service.record.group=key,service.record.type_label=type.label)})})})}}),scope.strcmp=function(s1,s2){return s1.toLowerCase().indexOf(s2.toLowerCase())>=0},scope.applyFilter=function(){scope.services&&(scope.filteredServices=scope.services.filter(function(service){var groupMatch=null===scope.selectedGroup.name||scope.selectedGroup.name===service.record.group,typeMatch=null===scope.selectedType.name||scope.selectedType.name===service.record.type,searchMatchName=!scope.searchText.value||scope.searchText.value&&service.record.name&&scope.strcmp(service.record.name,scope.searchText.value),searchMatchLabel=!scope.searchText.value||scope.searchText.value&&service.record.label&&scope.strcmp(service.record.label,scope.searchText.value),searchMatchDesc=!scope.searchText.value||scope.searchText.value&&service.record.description&&scope.strcmp(service.record.description,scope.searchText.value);return groupMatch&&typeMatch&&(searchMatchName||searchMatchLabel||searchMatchDesc)}))},scope.$watchCollection("selectedGroup",function(newValue){newValue&&(scope.selectedType={name:null},scope.applyFilter())}),scope.$watchCollection("selectedType",function(newValue){newValue&&scope.applyFilter()}),scope.$watchCollection("searchText",function(newValue){newValue&&scope.applyFilter()})}}}]).directive("dfServiceDetails",["MOD_SERVICES_ASSET_PATH",function(MOD_SERVICES_ASSET_PATH){return{restrict:"E",scope:!1,templateUrl:MOD_SERVICES_ASSET_PATH+"views/df-service-details.html",link:function(scope){scope.closeService=function(){scope.$parent.currentEditService=null}}}}]).directive("dfApiDocsLoading",[function(){return{restrict:"E",template:"<div class='col-lg-12' ng-if='dataLoading'><span style='display: block; width: 100%; text-align: center; color: #A0A0A0; font-size: 50px; margin-top: 100px'><i class='fa fa-refresh fa-spin'></i></div>"}}]),angular.module("dfSwaggerUI",["ngRoute","dfUtility"]).constant("MOD_SWAGGER_UI_ROUTER_PATH","/swagger-ui").constant("MOD_SWAGGER_UI_ASSET_PATH","admin_components/adf-swagger-ui/").config(["$routeProvider","MOD_SWAGGER_UI_ROUTER_PATH","MOD_SWAGGER_UI_ASSET_PATH",function($routeProvider,MOD_SWAGGER_UI_ROUTER_PATH,MOD_SWAGGER_UI_ASSET_PATH){$routeProvider.when(MOD_SWAGGER_UI_ROUTER_PATH,{templateUrl:MOD_SWAGGER_UI_ASSET_PATH+"views/main.html",controller:"SwaggerUiCtrl"})}]).run(["$templateCache",function($templateCache){}]).controller("SwaggerUiCtrl",["$scope",function($scope){}]).directive("dfSwagger",["MOD_SWAGGER_UI_ASSET_PATH","INSTANCE_URL","APP_API_KEY","UserDataService",function(MOD_SWAGGER_UI_ASSET_PATH,INSTANCE_URL,APP_API_KEY,UserDataService){return{restrict:"E",scope:{serviceName:"="},templateUrl:MOD_SWAGGER_UI_ASSET_PATH+"views/swagger.html",link:function(scope,elem,attrs){var sessionToken="",user=UserDataService.getCurrentUser();user&&user.session_token&&(sessionToken=user.session_token);SwaggerUIBundle({url:INSTANCE_URL.url+"/api_docs/"+scope.serviceName,requestInterceptor:function(request){var headers=request.headers||{};return headers["X-DreamFactory-API-Key"]=APP_API_KEY,headers["X-DreamFactory-Session-Token"]=sessionToken,request},validatorUrl:null,dom_id:"#swagger-ui",tagsSorter:"alpha",operationsSorter:"alpha",defaultModelRendering:"example",docExpansion:"list",displayOperationId:!1,displayRequestDuration:!1,filter:!1,deepLinking:!1,presets:[SwaggerUIBundle.presets.apis,SwaggerUIStandalonePreset],plugins:[SwaggerUIBundle.plugins.DownloadUrl],layout:"StandaloneLayout"})}}}]),angular.module("dfUserManagement",["ngRoute","ngCookies","dfUtility"]).constant("MODUSRMNGR_ROUTER_PATH","/user-management").constant("MODUSRMNGR_ASSET_PATH","admin_components/adf-user-management/").run(["$cookies","UserDataService","SystemConfigDataService",function($cookies,UserDataService,SystemConfigDataService){var cookie=function(name){name=name.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1");var regex=new RegExp("(?:^|;)\\s?"+name+"=(.*?)(?:;|$)","i"),match=null;return window.opener&&(match=window.opener.document.cookie.match(regex)),null===match&&(match=window.parent.document.cookie.match(regex)),match&&unescape(match[1])}("CurrentUserObj");if(cookie)try{cookie=JSON.parse(cookie),UserDataService.setCurrentUser(cookie),SystemConfigDataService.getSystemConfig()||UserDataService.unsetCurrentUser()}catch(e){UserDataService.unsetCurrentUser()}}]).controller("UserManagementCtrl",["$scope",function($scope){}]).directive("modusrmngrNavigation",["MODUSRMNGR_ASSET_PATH",function(MODUSRMNGR_ASSET_PATH){return{restrict:"E",templateUrl:MODUSRMNGR_ASSET_PATH+"views/navigation.html",link:function(scope,elem,attrs){}}}]).directive("dreamfactoryUserLogin",["MODUSRMNGR_ASSET_PATH","INSTANCE_URL","$http","$location","UserEventsService","UserDataService","_dfObjectService","SystemConfigDataService",function(MODUSRMNGR_ASSET_PATH,INSTANCE_URL,$http,$location,UserEventsService,UserDataService,_dfObjectService,SystemConfigDataService){return{restrict:"E",replace:!0,scope:{options:"=?",inErrorMsg:"=?"},templateUrl:MODUSRMNGR_ASSET_PATH+"views/login.html",link:function(scope,elem,attrs){scope.es=UserEventsService.login;var defaults={showTemplate:!0};scope.options=_dfObjectService.mergeObjects(scope.options,defaults),scope.showTemplate=scope.options.showTemplate,scope.loginFormTitle="Login",scope.loginActive=!0,scope.creds={email:"",password:""},scope.errorMsg=scope.inErrorMsg||"",scope.successMsg="",scope.loginWaiting=!1,scope.showOAuth=!0,scope.loginForm={},scope.adldap=[],scope.loginAttribute="email",scope.systemConfig=SystemConfigDataService.getSystemConfig(),scope.systemConfig&&scope.systemConfig.authentication&&(scope.systemConfig.authentication.hasOwnProperty("adldap")&&(scope.adldap=scope.systemConfig.authentication.adldap),scope.systemConfig.authentication.hasOwnProperty("login_attribute")&&(scope.loginAttribute=scope.systemConfig.authentication.login_attribute)),scope.adldapAvailable=scope.adldap.length>0,scope.selectedService=null,scope.rememberMe=!1,"username"===scope.loginAttribute?scope.userField={icon:"fa-user",text:"Enter Username",type:"text"}:scope.userField={icon:"fa-envelope",text:"Enter Email",type:"email"},scope.rememberLogin=function(checked){scope.rememberMe=checked},scope.useAdLdapService=function(service){scope.selectedService=service,service?(scope.userField={icon:"fa-user",text:"Enter Username",type:"text"},scope.creds={username:"",password:"",service:service}):"username"===scope.loginAttribute?(scope.userField={icon:"fa-user",text:"Enter Username",type:"text"},scope.creds={username:"",password:""}):(scope.userField={icon:"fa-envelope",text:"Enter Email",type:"email"},scope.creds={email:"",password:""})},scope.getQueryParameter=function(key){key=key.replace(/[*+?^$.\[\]{}()|\\\/]/g,"\\$&");var match=window.location.search.match(new RegExp("[?&]"+key+"=([^&]+)(&|$)")),result=match&&decodeURIComponent(match[1].replace(/\+/g," "));return result||""};var token=scope.getQueryParameter("session_token"),oauth_code=scope.getQueryParameter("code"),oauth_state=scope.getQueryParameter("state"),oauth_token=scope.getQueryParameter("oauth_token"),baseUrl=$location.absUrl().split("?")[0];""!==token?(scope.loginWaiting=!0,scope.showOAuth=!1,scope.loginDirect=!0,$http.get(INSTANCE_URL.url+"/user/session?session_token="+token).then(function(result){UserDataService.setCurrentUser(result.data),scope.$emit(scope.es.loginSuccess,result.data),scope.loginDirect=!1},function(result){window.location.href=baseUrl+"#/login",scope.loginDirect=!1})):(oauth_code&&oauth_state||oauth_token)&&(scope.loginWaiting=!0,scope.showOAuth=!1,$http.post(INSTANCE_URL.url+"/user/session?oauth_callback=true&"+location.search.substring(1)).then(function(result){UserDataService.setCurrentUser(result.data),scope.$emit(scope.es.loginSuccess,result.data)})),scope.login=function(credsDataObj){scope.selectedService?(credsDataObj.username=$("#df-login-email").val(),credsDataObj.password=$("#df-login-password").val(),credsDataObj.service=scope.selectedService):"username"===scope.loginAttribute?(credsDataObj.username=$("#df-login-email").val(),credsDataObj.password=$("#df-login-password").val()):""!==credsDataObj.email&&""!==credsDataObj.password||(credsDataObj.email=$("#df-login-email").val(),credsDataObj.password=$("#df-login-password").val()),credsDataObj.remember_me=scope.rememberMe,scope._login(credsDataObj)},scope.forgotPassword=function(){scope._forgotPassword()},scope.skipLogin=function(){scope._skipLogin()},scope.showLoginForm=function(){scope._toggleForms()},scope.dismissError=function(){scope.errorMsg=""},scope.dismissSuccess=function(){scope.successMsg=""},scope._loginRequest=function(credsDataObj,admin){return admin?$http.post(INSTANCE_URL.url+"/system/admin/session",credsDataObj):$http.post(INSTANCE_URL.url+"/user/session",credsDataObj)},scope._toggleFormsState=function(){scope.loginActive=!scope.loginActive,scope.resetPasswordActive=!scope.resetPasswordActive},scope._login=function(credsDataObj){scope.loginWaiting=!0,scope._loginRequest(credsDataObj,!1).then(function(result){UserDataService.setCurrentUser(result.data),scope.$emit(scope.es.loginSuccess,result.data),scope.$root.$emit(scope.es.loginSuccess,result.data)},function(reject){"401"!=reject.status&&"404"!=reject.status||scope.selectedService?(scope.errorMsg=reject.data.error.message,scope.$emit(scope.es.loginError,reject)):(scope.loginWaiting=!0,scope._loginRequest(credsDataObj,!0).then(function(result){UserDataService.setCurrentUser(result.data),scope.$emit(scope.es.loginSuccess,result.data),scope.$root.$emit(scope.es.loginSuccess,result.data)},function(reject){scope.errorMsg=reject.data.error.message,scope.$emit(scope.es.loginError,reject)}).finally(function(){scope.loginWaiting=!1}))}).finally(function(){scope.loginWaiting=!1})},scope._toggleForms=function(){scope._toggleFormsState()},scope._forgotPassword=function(){scope.$broadcast(UserEventsService.password.passwordResetRequest,{email:scope.creds.email})},scope._skipLogin=function(){$location.url("/services")};scope.$watch("options",function(newValue,oldValue){newValue&&newValue.hasOwnProperty("showTemplate")&&(scope.showTemplate=newValue.showTemplate)},!0);scope.$on(scope.es.loginRequest,function(e,userDataObj){scope._login(userDataObj)})}}}]).directive("dreamfactoryForgotPwordEmail",["MODUSRMNGR_ASSET_PATH","INSTANCE_URL","$http","UserEventsService","SystemConfigDataService",function(MODUSRMNGR_ASSET_PATH,INSTANCE_URL,$http,UserEventsService,SystemConfigDataService){return{restrict:"E",replace:!0,scope:!1,templateUrl:MODUSRMNGR_ASSET_PATH+"views/fp-email-conf.html",link:function(scope,elem,attrs){scope.es=UserEventsService.password,scope.emailForm=!0,scope.emailError=!1,scope.securityQuestionForm=!1,scope.hidePasswordField=!1,scope.allowForeverSessions=!1,scope.loginAttribute="email",scope.systemConfig=SystemConfigDataService.getSystemConfig(),scope.systemConfig&&scope.systemConfig.authentication&&(scope.systemConfig.authentication.hasOwnProperty("allow_forever_sessions")&&(scope.allowForeverSessions=scope.systemConfig.authentication.allow_forever_sessions),scope.systemConfig.authentication.hasOwnProperty("login_attribute")&&(scope.loginAttribute=scope.systemConfig.authentication.login_attribute)),scope.resetByEmail=!0,scope.resetByUsername=!1,"username"===scope.loginAttribute&&(scope.resetByEmail=!1,scope.resetByUsername=!0),scope.sq={email:null,username:null,security_question:null,security_answer:null,new_password:null,verify_password:null},scope.identical=!0,scope.requestWaiting=!1,scope.questionWaiting=!1,scope.requestPasswordReset=function(emailDataObj){scope._requestPasswordReset(emailDataObj)},scope.securityQuestionSubmit=function(reset){scope.identical?scope._verifyPasswordLength(reset)?scope._securityQuestionSubmit(reset):scope.errorMsg="Password must be at least 5 characters.":scope.errorMsg="Passwords do not match."},scope.verifyPassword=function(user){scope._verifyPassword(user)},scope._resetPasswordRequest=function(requestDataObj,admin){return admin?$http.post(INSTANCE_URL.url+"/system/admin/password?reset=true",requestDataObj):$http.post(INSTANCE_URL.url+"/user/password?reset=true",requestDataObj)},scope._resetPasswordSQ=function(requestDataObj,admin){return admin?$http.post(INSTANCE_URL.url+"/system/admin/password?login=false",requestDataObj):$http.post(INSTANCE_URL.url+"/user/password?login=false",requestDataObj)},scope._verifyPassword=function(userDataObj){scope.identical=userDataObj.new_password===userDataObj.verify_password},scope._verifyPasswordLength=function(credsDataObj){return credsDataObj.new_password.length>=5},scope._requestPasswordReset=function(requestDataObj){requestDataObj.reset=!0,scope.requestWaiting=!0,scope._resetPasswordRequest(requestDataObj,!1).then(function(result){result.data.hasOwnProperty("security_question")?(scope.emailForm=!1,scope.securityQuestionForm=!0,scope.sq.email=requestDataObj.email,scope.sq.username=requestDataObj.username?requestDataObj.username:null,scope.sq.security_question=result.data.security_question):(scope.successMsg="A password reset email has been sent to the user's email address.",scope.$emit(scope.es.passwordResetRequestSuccess,requestDataObj.email))},function(reject){"401"==reject.status||"404"==reject.status?scope._resetPasswordRequest(requestDataObj,!0).then(function(result){result.data.hasOwnProperty("security_question")?(scope.emailForm=!1,scope.securityQuestionForm=!0,scope.sq.email=requestDataObj.email,scope.sq.security_question=result.data.security_question):(scope.successMsg="A password reset email has been sent to the user's email address.",scope.$emit(scope.es.passwordResetRequestSuccess,requestDataObj.email))},function(reject){scope.errorMsg=reject.data.error.message}).finally(function(){scope.requestWaiting=!1}):scope.errorMsg=reject.data.error.message}).finally(function(){scope.requestWaiting=!1})},scope._securityQuestionSubmit=function(reset){scope.questionWaiting=!0,scope._resetPasswordSQ(reset,!1).then(function(result){var userCredsObj={email:reset.email,username:reset.username?reset.username:null,password:reset.new_password};scope.$emit(UserEventsService.password.passwordSetSuccess,userCredsObj)},function(reject){"401"==reject.status||"404"==reject.status?scope._resetPasswordSQ(reset,!0).then(function(result){var userCredsObj={email:reset.email,password:reset.new_password};scope.$emit(UserEventsService.password.passwordSetSuccess,userCredsObj)},function(reject){scope.questionWaiting=!1,scope.errorMsg=reject.data.error.message,scope.$emit(UserEventsService.password.passwordSetError)}).finally(function(){}):(scope.questionWaiting=!1,scope.errorMsg=reject.data.error.message,scope.$emit(UserEventsService.password.passwordSetError))}).finally(function(){})},scope.$on(UserEventsService.password.passwordResetRequest,function(e,resetDataObj){scope._toggleForms()})}}}]).directive("dreamfactoryForgotPwordQuestion",["MODUSRMNGR_ASSET_PATH",function(MODUSRMNGR_ASSET_PATH){return{restrict:"E",scope:!1,templateUrl:MODUSRMNGR_ASSET_PATH+"views/fp-security-question.html",link:function(scope,elem,attrs){}}}]).directive("dreamfactoryPasswordReset",["MODUSRMNGR_ASSET_PATH","INSTANCE_URL","$http","UserEventsService","_dfObjectService","dfNotify","$location","SystemConfigDataService",function(MODUSRMNGR_ASSET_PATH,INSTANCE_URL,$http,UserEventsService,_dfObjectService,dfNotify,$location,SystemConfigDataService){return{restrict:"E",scope:{options:"=?",inErrorMsg:"=?"},templateUrl:MODUSRMNGR_ASSET_PATH+"views/password-reset.html",link:function(scope,elem,attrs){scope.es=UserEventsService.password;var defaults={showTemplate:!0,login:!1};scope.options=_dfObjectService.mergeObjects(scope.options,defaults),scope.showTemplate=scope.options.showTemplate,scope.identical=!0,scope.successMsg="",scope.errorMsg="",scope.loginAttribute="email",scope.systemConfig=SystemConfigDataService.getSystemConfig(),scope.systemConfig&&scope.systemConfig.authentication&&scope.systemConfig.authentication.hasOwnProperty("login_attribute")&&(scope.loginAttribute=scope.systemConfig.authentication.login_attribute),scope.resetByEmail=!0,scope.resetByUsername=!1,"username"===scope.loginAttribute&&(scope.resetByEmail=!1,scope.resetByUsername=!0),scope.resetWaiting=!1,scope.user={};var UrlParams=$location.search();Object.keys(UrlParams).forEach(function(key,index){scope.user[key]=UrlParams[key]});var isAdmin="1"==scope.user.admin;scope.dismissError=function(){scope.errorMsg=""},scope.dismissSuccess=function(){scope.successMsg=""},scope.resetPassword=function(credsDataObj){scope.identical?scope._verifyPasswordLength(credsDataObj)?scope._resetPassword(credsDataObj):scope.errorMsg="Password must be at least 5 characters.":scope.errorMsg="Passwords do not match."},scope.verifyPassword=function(user){scope._verifyPassword(user)},scope._setPasswordRequest=function(requestDataObj,admin){var url=INSTANCE_URL.url+"/system/admin/password";return admin||(url=INSTANCE_URL.url+"/user/password"),$http({url:url,method:"POST",params:{login:scope.options.login},data:requestDataObj})},scope._verifyPassword=function(userDataObj){scope.identical=userDataObj.new_password===userDataObj.verify_password},scope._verifyPasswordLength=function(credsDataObj){return credsDataObj.new_password.length>=5},scope._resetPassword=function(credsDataObj){scope.resetWaiting=!0;var requestDataObj={email:credsDataObj.email,username:credsDataObj.username?credsDataObj.username:null,code:credsDataObj.code,new_password:credsDataObj.new_password};scope._setPasswordRequest(requestDataObj,isAdmin).then(function(result){var userCredsObj={email:credsDataObj.email,username:credsDataObj.username?credsDataObj.username:null,password:credsDataObj.new_password};scope.$emit(scope.es.passwordSetSuccess,userCredsObj),scope.showTemplate=!1},function(reject){"401"==reject.status||"404"==reject.status?scope._setPasswordRequest(requestDataObj,!0).then(function(result){var userCredsObj={email:credsDataObj.email,password:credsDataObj.new_password};scope.$emit(scope.es.passwordSetSuccess,userCredsObj),scope.showTemplate=!1},function(reject){scope.errorMsg=reject.data.error.message,scope.$emit(scope.es.passwordSetError),scope.resetWaiting=!1}).finally(function(){scope.resetWaiting=!1}):(scope.errorMsg=reject.data.error.message,scope.$emit(scope.es.passwordSetError),scope.resetWaiting=!1)}).finally(function(){scope.resetWaiting=!1})};var watchInErrorMsg=scope.$watch("inErrorMsg",function(n,o){scope.confirmWaiting=!1,scope.errorMsg=n});scope.$on(scope.es.passwordSetRequest,function(e,credsDataObj){scope._resetPassword(credsDataObj)}),scope.$on("$destroy",function(e){watchInErrorMsg()})}}}]).directive("dreamfactoryUserLogout",["INSTANCE_URL","$http","UserEventsService","UserDataService",function(INSTANCE_URL,$http,UserEventsService,UserDataService){return{restrict:"E",scope:{},link:function(scope,elem,attrs){scope.es=UserEventsService.logout,scope._logoutRequest=function(admin){var url=UserDataService.getCurrentUser().is_sys_admin?"/system/admin/session":"/user/session";return $http.delete(INSTANCE_URL.url+url)},scope._logout=function(){scope._logoutRequest(!1).then(function(){UserDataService.unsetCurrentUser(),scope.$emit(scope.es.logoutSuccess,!1)},function(reject){if("401"!=reject.status&&"401"!=reject.data.error.code)throw{module:"DreamFactory User Management",type:"error",provider:"dreamfactory",exception:reject};UserDataService.unsetCurrentUser(),scope.$emit(scope.es.logoutSuccess,!1)})},scope.$on(scope.es.logoutRequest,function(e){scope._logout()}),scope._logout()}}}]).directive("dreamfactoryRegisterUser",["MODUSRMNGR_ASSET_PATH","INSTANCE_URL","$http","$rootScope","$location","UserEventsService","_dfObjectService","dfXHRHelper","SystemConfigDataService",function(MODUSRMNGR_ASSET_PATH,INSTANCE_URL,$http,$rootScope,$location,UserEventsService,_dfObjectService,dfXHRHelper,SystemConfigDataService){return{restrict:"E",templateUrl:MODUSRMNGR_ASSET_PATH+"views/register.html",scope:{options:"=?"},link:function(scope,elem,attrs){scope.es=UserEventsService.register;var defaults={showTemplate:!0,login:!1};scope.options=_dfObjectService.mergeObjects(scope.options,defaults),scope.showTemplate=scope.options.showTemplate,scope.identical=!0,scope.errorMsg="",scope.loginAttribute="email",scope.systemConfig=SystemConfigDataService.getSystemConfig(),scope.systemConfig&&scope.systemConfig.authentication&&scope.systemConfig.authentication.hasOwnProperty("login_attribute")&&(scope.loginAttribute=scope.systemConfig.authentication.login_attribute),scope.user={};var UrlParams=$location.search();Object.keys(UrlParams).forEach(function(key,index){scope.user[key]=UrlParams[key]}),scope.dismissError=function(){scope.errorMsg=""},scope.register=function(registerDataObj){scope._register(registerDataObj)},scope.verifyPassword=function(user){scope._verifyPassword(user)},scope._registerRequest=function(registerDataObj){return $http({url:INSTANCE_URL.url+"/user/register",method:"POST",params:{login:scope.options.login},data:registerDataObj})},scope._getSystemConfig=function(){return $http.get(INSTANCE_URL.url+"/system/environment")},scope._register=function(registerDataObj){1==scope.identical?(scope._runRegister=function(registerDataObj){scope._registerRequest(registerDataObj).then(function(result){if(null==scope.options.confirmationRequired){var userCredsObj={email:registerDataObj.email,password:registerDataObj.new_password};scope.$emit(scope.es.registerSuccess,userCredsObj)}else scope.$emit(scope.es.registerConfirmation,result.data)},function(reject){var msg="Validation failed. ",context=reject.data.error.context;null==context?reject.data&&reject.data.error&&reject.data.error.message&&(msg+=reject.data.error.message):angular.forEach(context,function(value,key){msg=msg+key+": "+value+" "},msg),scope.errorMsg=msg})},null==scope.options.confirmationRequired?scope._getSystemConfig().then(function(result){var systemConfigDataObj=result.data;scope.options.confirmationRequired=systemConfigDataObj.authentication.open_reg_email_service_id,scope._runRegister(registerDataObj)},function(reject){throw{module:"DreamFactory User Management",type:"error",provider:"dreamfactory",exception:reject}}):scope._runRegister(registerDataObj)):scope.errorMsg="Password and confirm password do not match."},scope._verifyPassword=function(userDataObj){scope.identical=userDataObj.new_password===userDataObj.verify_password},scope.$watchCollection("options",function(newValue,oldValue){if(!newValue.hasOwnProperty("confirmationRequired")){var config=dfXHRHelper.get({url:"system/environment"});scope.options.confirmationRequired=!(!config.authentication.allow_open_registration||!config.authentication.open_reg_email_service_id)||null}}),scope.$on(scope.es.registerRequest,function(e,registerDataObj){scope._register(registerDataObj)})}}}]).directive("dreamfactoryUserProfile",["MODUSRMNGR_ASSET_PATH","_dfObjectService","UserDataService","UserEventsService",function(MODUSRMNGR_ASSET_PATH,_dfObjectService,UserDataService,UserEventsService){return{restrict:"E",replace:!0,templateUrl:MODUSRMNGR_ASSET_PATH+"views/edit-profile.html",scope:{options:"=?"},link:function(scope,elem,attrs){scope.es=UserEventsService.profile;var defaults={showTemplate:!0};scope.options=_dfObjectService.mergeObjects(scope.options,defaults)}}}]).directive("dreamfactoryRemoteAuthProviders",["MODUSRMNGR_ASSET_PATH","SystemConfigDataService","INSTANCE_URL",function(MODUSRMNGR_ASSET_PATH,SystemConfigDataService,INSTANCE_URL){return{restrict:"E",replace:!0,templateUrl:MODUSRMNGR_ASSET_PATH+"views/remote-auth-providers.html",scope:!1,link:function(scope,elem,attrs){scope.url=INSTANCE_URL.url,scope.oauths=[],scope.systemConfig=SystemConfigDataService.getSystemConfig(),scope.systemConfig&&scope.systemConfig.authentication&&scope.systemConfig.authentication.hasOwnProperty("oauth")&&(scope.oauths=scope.systemConfig.authentication.oauth),scope.remoteAuthLogin=function(providerData){window.top.location.href=scope.url+"/"+providerData}}}}]).directive("dreamfactorySamlAuthProviders",["MODUSRMNGR_ASSET_PATH","SystemConfigDataService","INSTANCE_URL",function(MODUSRMNGR_ASSET_PATH,SystemConfigDataService,INSTANCE_URL){return{restrict:"E",replace:!0,templateUrl:MODUSRMNGR_ASSET_PATH+"views/saml-auth-providers.html",scope:!1,link:function(scope,elem,attrs){scope.url=INSTANCE_URL.url,scope.samls=[],scope.systemConfig=SystemConfigDataService.getSystemConfig(),scope.systemConfig&&scope.systemConfig.authentication&&scope.systemConfig.authentication.hasOwnProperty("saml")&&(scope.samls=scope.systemConfig.authentication.saml),scope.samlAuthLogin=function(providerData){window.top.location.href=scope.url+"/"+providerData}}}}]).directive("dreamfactoryConfirmUser",["MODUSRMNGR_ASSET_PATH","INSTANCE_URL","$location","$http","_dfObjectService","UserDataService","UserEventsService","SystemConfigDataService",function(MODUSRMNGR_ASSET_PATH,INSTANCE_URL,$location,$http,_dfObjectService,UserDataService,UserEventsService,SystemConfigDataService){return{restrict:"E",replace:!0,templateUrl:MODUSRMNGR_ASSET_PATH+"views/confirmation-code.html",scope:{options:"=?",inErrorMsg:"=?",inviteType:"=?"},link:function(scope,elem,attrs){var defaults={showTemplate:!0,title:"User Confirmation"};scope.options=_dfObjectService.mergeObjects(scope.options,defaults),scope.showTemplate=scope.options.showTemplate,scope.identical=!0,scope.errorMsg="",scope.successMsg="",scope.confirmWaiting=!1,scope.submitLabel="Confirm "+scope.inviteType.charAt(0).toUpperCase()+scope.inviteType.slice(1),scope.loginAttribute="email",scope.systemConfig=SystemConfigDataService.getSystemConfig(),scope.systemConfig&&scope.systemConfig.authentication&&scope.systemConfig.authentication.hasOwnProperty("login_attribute")&&(scope.loginAttribute=scope.systemConfig.authentication.login_attribute),scope.useEmail=!0,scope.useUsername=!1,"username"===scope.loginAttribute&&(scope.useEmail=!1,scope.useUsername=!0),scope.user={};var UrlParams=$location.search();Object.keys(UrlParams).forEach(function(key,index){scope.user[key]=UrlParams[key]}),scope.dismissError=function(){scope.errorMsg=""},scope.dismissSuccess=function(){scope.successMsg=""},scope.confirm=function(userConfirmObj){scope.identical?scope._verifyPasswordLength(userConfirmObj)?scope._confirm(userConfirmObj):scope.errorMsg="Password must be at least 5 characters.":scope.errorMsg="Passwords do not match."},scope.verifyPassword=function(user){scope._verifyPassword(user)},scope._verifyPassword=function(userDataObj){scope.identical=userDataObj.new_password===userDataObj.verify_password},scope._verifyPasswordLength=function(user){return user.new_password.length>=5},scope._confirmUserToServer=function(requestDataObj){var api="user"===scope.inviteType?"user/password":"system/admin/password";return $http({url:INSTANCE_URL.url+"/"+api,method:"POST",params:{login:!1},data:requestDataObj})},scope._confirm=function(userConfirmObj){scope.confirmWaiting=!0;var requestDataObj=userConfirmObj;scope._confirmUserToServer(requestDataObj).then(function(result){var userCreds={email:requestDataObj.email,username:requestDataObj.username?requestDataObj.username:null,password:requestDataObj.new_password};scope.$emit(UserEventsService.confirm.confirmationSuccess,userCreds)},function(reject){scope.errorMsg=reject.data.error.message,scope.$emit(UserEventsService.confirm.confirmationError),scope.confirmWaiting=!1}).finally(function(){})};var watchInErrorMsg=scope.$watch("inErrorMsg",function(n,o){scope.confirmWaiting=!1,scope.errorMsg=n});scope.$on("$destroy",function(e){watchInErrorMsg()}),scope.$on(UserEventsService.confirm.confirmationRequest,function(e,confirmationObj){scope._confirm(confirmationObj)})}}}]).directive("dreamfactoryWaiting",["MODUSRMNGR_ASSET_PATH",function(MODUSRMNGR_ASSET_PATH){return{restrict:"E",scope:{show:"=?"},replace:!1,templateUrl:MODUSRMNGR_ASSET_PATH+"views/dreamfactory-waiting.html",link:function(scope,elem,attrs){function size(){h=el.parent(".panel-body").outerHeight(),w=el.parent(".panel-body").outerWidth(),t=el.parent(".panel-body").position().top,l=el.parent(".panel-body").position().left,container.css({height:h+"px",width:w+"px",position:"absolute",left:l,top:t}),container.children(".df-spinner").css({position:"absolute",top:(h-110)/2,left:(w-70)/2})}var el=$(elem),container=el.children(),h=el.parent(".panel-body").outerHeight(),w=el.parent(".panel-body").outerWidth(),t=el.position().top+parseInt(el.parent().css("padding-top"))+"px",l=el.position().left+parseInt(el.parent().css("padding-left"))+"px";scope._showWaiting=function(){size(),container.fadeIn("fast")},scope._hideWaiting=function(){container.hide()},scope.$watch("show",function(n,o){n?scope._showWaiting():scope._hideWaiting()}),$(window).on("resize load",function(){size()})}}}]).service("UserEventsService",[function(){return{login:{loginRequest:"user:login:request",loginSuccess:"user:login:success",loginError:"user:login:error"},logout:{logoutRequest:"user:logout:request",logoutSuccess:"user:logout:success",logoutError:"user:logout:error"},register:{registerRequest:"user:register:request",registerSuccess:"user:register:success",registerError:"user:register:error",registerConfirmation:"user:register:confirmation"},password:{passwordResetRequest:"user:passwordreset:request",passwordResetRequestSuccess:"user:passwordreset:requestsuccess",passwordSetRequest:"user:passwordset:request",passwordSetSuccess:"user:passwordset:success",passwordSetError:"user:passwordset:error"},profile:{},confirm:{confirmationSuccess:"user:confirmation:success",confirmationError:"user:confirmation:error",confirmationRequest:"user:confirmation:request"}}}]).service("UserDataService",["$cookies","$http",function($cookies,$http){function _getCurrentUser(){return currentUser}function _setCurrentUser(userDataObj){delete userDataObj.session_id,$cookies.putObject("CurrentUserObj",userDataObj),$http.defaults.headers.common["X-DreamFactory-Session-Token"]=userDataObj.session_token,currentUser=userDataObj}function _unsetCurrentUser(){$cookies.remove("CurrentUserObj"),delete $http.defaults.headers.common["X-DreamFactory-Session-Token"],currentUser=!1}var currentUser=!1;return{getCurrentUser:function(){return _getCurrentUser()},setCurrentUser:function(userDataObj){_setCurrentUser(userDataObj)},unsetCurrentUser:function(){_unsetCurrentUser()}}}]).service("_dfObjectService",[function(){return{self:this,mergeObjects:function(obj1,obj2){for(var key in obj1)obj2[key]=obj1[key];return obj2},deepMergeObjects:function(obj1,obj2){var self=this;for(var _key in obj1)obj2.hasOwnProperty(_key)&&("object"==typeof obj2[_key]?obj2[_key]=self.deepMergeObjects(obj1[_key],obj2[_key]):obj2[_key]=obj1[_key]);return obj2}}}]).service("dfXHRHelper",["INSTANCE_URL","APP_API_KEY","UserDataService",function(INSTANCE_URL,APP_API_KEY,UserDataService){function _isEmpty(obj){if(null==obj)return!0;if(obj.length>0)return!1;if(0===obj.length)return!0;for(var key in obj)if(hasOwnProperty.call(obj,key))return!1;return!0}function _setHeaders(_xhrObj,_headersDataObj){_xhrObj.setRequestHeader("X-DreamFactory-API-Key",APP_API_KEY);var currentUser=UserDataService.getCurrentUser();currentUser&&currentUser.session_tpken&&xhrObj.setRequestHeader("X-DreamFactory-Session-Token",currentUser.session_token);for(var _key in _headersDataObj)_xhrObj.setRequestHeader(_key,_headersDataObj[_key])}function _setParams(_paramsDataObj){var params="";if(!_isEmpty(_paramsDataObj)){params="?";for(var _key in _paramsDataObj)params+=_key+"="+_paramsDataObj[_key]+"&"}return""!==params&&(params=params.substring(0,params.length-1),encodeURI(params)),params}function _makeRequest(_method,_url,_async,_params,_headers,_mimeType){var xhr;xhr=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");var params=_setParams(_params);return xhr.open(_method,INSTANCE_URL.url+"/"+_url+params,_async),_setHeaders(xhr,_headers),xhr.overrideMimeType(_mimeType),xhr.send(),4==xhr.readyState&&200==xhr.status?angular.fromJson(xhr.responseText):xhr.status}function _get(optionsDataObj){if(!optionsDataObj.url||""===optionsDataObj.url)throw{module:"DreamFactory System Config Module",type:"error",provider:"dreamfactory",exception:"XHRHelper Request Failure: No URL provided"};var defaults={method:"GET",url:"",async:!1,params:{},headers:{},mimeType:"application/json"};for(var _key in defaults)optionsDataObj.hasOwnProperty(_key)&&(defaults[_key]=optionsDataObj[_key]);return _makeRequest(defaults.method,defaults.url,defaults.async,defaults.params,defaults.headers,defaults.mimeType)}return{get:function(requestOptions){return _get(requestOptions)}}}]),angular.module("dfSystemConfig",["ngRoute","dfUtility","dfApplication"]).constant("MODSYSCONFIG_ROUTER_PATH","/config").constant("MODSYSCONFIG_ASSET_PATH","admin_components/adf-system-config/").config(["$routeProvider","MODSYSCONFIG_ROUTER_PATH","MODSYSCONFIG_ASSET_PATH",function($routeProvider,MODSYSCONFIG_ROUTER_PATH,MODSYSCONFIG_ASSET_PATH){$routeProvider.when(MODSYSCONFIG_ROUTER_PATH,{templateUrl:MODSYSCONFIG_ASSET_PATH+"views/main.html",controller:"SystemConfigurationCtrl",resolve:{checkUser:["checkUserService",function(checkUserService){return checkUserService.checkUser()}]}})}]).run([function(){}]).controller("SystemConfigurationCtrl",["$scope","dfApplicationData","SystemConfigEventsService","SystemConfigDataService","dfObjectService","dfNotify","UserDataService",function($scope,dfApplicationData,SystemConfigEventsService,SystemConfigDataService,dfObjectService,dfNotify,UserDataService){var currentUser=UserDataService.getCurrentUser();$scope.isSysAdmin=currentUser&&currentUser.is_sys_admin,$scope.$parent.title="Config",$scope.es=SystemConfigEventsService.systemConfigController,$scope.buildLinks=function(checkData){var links=[];return checkData&&!$scope.apiData.environment||links.push({name:"system-info",label:"System Info",path:"system-info",active:0===links.length}),checkData&&!$scope.apiData.cache||links.push({name:"cache",label:"Cache",path:"cache",active:0===links.length}),checkData&&!$scope.apiData.cors||links.push({name:"cors",label:"CORS",path:"cors",active:0===links.length}),checkData&&!$scope.apiData.email_template||links.push({name:"email-templates",label:"Email Templates",path:"email-templates",active:0===links.length}),checkData&&!$scope.apiData.lookup||links.push({name:"global-lookup-keys",label:"Global Lookup Keys",path:"global-lookup-keys",active:0===links.length}),checkData&&!$scope.apiData.custom||links.push({name:"live-chat",label:"Live Chat",path:"live-chat",active:0===links.length}),links},$scope.links=$scope.buildLinks(!1),$scope.$emit("sidebar-nav:view:reset"),$scope.$on("$locationChangeStart",function(e){$scope.hasOwnProperty("systemConfig")&&(dfObjectService.compareObjectsAsJson($scope.systemConfig.record,$scope.systemConfig.recordCopy)||dfNotify.confirmNoSave()||e.preventDefault())}),$scope.dfLargeHelp={systemInfo:{title:"System Info Overview",text:"Displays current system information."},cacheConfig:{title:"Cache Overview",text:"Flush system-wide cache or per-service caches. Use the cache clearing buttons below to refresh any changes made to your system configuration values."},corsConfig:{title:"CORS Overview",text:"Enter allowed hosts and HTTP verbs. You can enter * for all hosts. Use the * option for development to enable application code running locally on your computer to communicate directly with your DreamFactory instance."},emailTemplates:{title:"Email Templates Overview",text:"Create and edit email templates for User Registration, User Invite, Password Reset, and your custom email services."},globalLookupKeys:{title:"Global Lookup Keys Overview",text:'An administrator can create any number of "key value" pairs attached to DreamFactory. The key values are automatically substituted on the server. For example, you can use Lookup Keys in Email Templates, as parameters in external REST Services, and in the username and password fields to connect to a SQL or NoSQL database. Mark any Lookup Key as private to securely encrypt the key value on the server and hide it in the user interface.<span style="color: red;">  Note that Lookup Keys for REST service configuration and credentials must be private.</span>'},chatConfig:{title:"Live Chat",text:"Enable or disable live chat with the DreamFactory product support team. This setting applies to all admin users on this DreamFactory instance."}},$scope.apiData={},$scope.loadTabData=function(){var apis=["cache","environment","cors","lookup","email_template","custom"];angular.forEach(apis,function(api){dfApplicationData.getApiData([api]).then(function(response){$scope.apiData[api]=response[0].resource?response[0].resource:response[0]},function(error){}).finally(function(){$scope.links=$scope.buildLinks(!0),$scope.$emit("sidebar-nav:view:reset")})})},$scope.loadTabData()}]).directive("dreamfactorySystemInfo",["MODSYSCONFIG_ASSET_PATH",function(MODSYSCONFIG_ASSET_PATH){return{restrict:"E",scope:!1,templateUrl:MODSYSCONFIG_ASSET_PATH+"views/system-info.html",link:function(scope,elem,attrs){scope.upgrade=function(){window.top.location="http://wiki.dreamfactory.com/"};var watchEnvironment=scope.$watchCollection("apiData.environment",function(newValue,oldValue){newValue&&(scope.systemEnv=newValue)});scope.$on("$destroy",function(e){watchEnvironment()})}}}]).directive("dreamfactoryCacheConfig",["MODSYSCONFIG_ASSET_PATH","INSTANCE_URL","$http","dfNotify",function(MODSYSCONFIG_ASSET_PATH,INSTANCE_URL,$http,dfNotify){return{restrict:"E",scope:!1,templateUrl:MODSYSCONFIG_ASSET_PATH+"views/cache-config.html",link:function(scope,elem,attrs){scope.flushSystemCache=function(){$http.delete(INSTANCE_URL.url+"/system/cache").success(function(){var messageOptions={module:"Cache",type:"success",provider:"dreamfactory",message:"System-wide cache flushed."};dfNotify.success(messageOptions)}).error(function(error){var messageOptions={module:"Api Error",type:"error",provider:"dreamfactory",message:error};dfNotify.error(messageOptions)})},scope.flushServiceCache=function(index){$http.delete(INSTANCE_URL.url+"/system/cache/"+scope.apiData.cache[index].name).success(function(){var messageOptions={module:"Cache",type:"success",provider:"dreamfactory",message:scope.apiData.cache[index].label+" service cache flushed."};dfNotify.success(messageOptions)}).error(function(error){var messageOptions={module:"Api Error",type:"error",provider:"dreamfactory",message:error};dfNotify.error(messageOptions)})}}}}]).directive("dreamfactoryCorsConfig",["MODSYSCONFIG_ASSET_PATH","dfApplicationData","dfNotify",function(MODSYSCONFIG_ASSET_PATH,dfApplicationData,dfNotify){return{restrict:"E",scope:!1,templateUrl:MODSYSCONFIG_ASSET_PATH+"views/cors-config.html",link:function(scope,elem,attrs){var CorsEntry=function(corsEntryData){var _new={id:null,path:"NEW",description:null,origin:"*",header:"*",exposed_header:null,max_age:0,method:[],supports_credentials:!1,enabled:!1};return corsEntryData=corsEntryData||_new,{__dfUI:{newHost:null===corsEntryData.id,tempId:Math.floor(1e5*Math.random())},record:angular.copy(corsEntryData),recordCopy:angular.copy(corsEntryData)}};scope.corsEntries=null,scope.selectedCorsEntry=null,scope.addCorsEntry=function(){scope._addCorsEntry()},scope.deleteCorsEntry=function(){dfNotify.confirm("Delete "+scope.selectedCorsEntry.record.path+"?")&&scope._deleteCorsEntry()},scope.saveCorsEntry=function(){var template=scope.selectedCorsEntry;if(null==template){messageOptions={module:"CORS",type:"warn",provider:"dreamfactory",message:"No host selected."};return dfNotify.warn(messageOptions),void angular.element("#select-cors-host").focus()}if(null===template.record.id){if("NEW"===template.record.path){messageOptions={module:"CORS",type:"warn",provider:"dreamfactory",message:"Entries should have a unique path pattern.  Please rename your entry to something other than the default 'new' name."};return void dfNotify.warn(messageOptions)}if(void 0===template.record.path){var messageOptions={module:"CORS",type:"error",provider:"dreamfactory",message:"Path is a required field."};return void dfNotify.error(messageOptions)}scope._saveCorsEntry(template)}else scope._updateCorsEntry(template)},scope._addCorsEntry=function(){scope.corsEntries.push(new CorsEntry),scope.selectedCorsEntry=scope.corsEntries[scope.corsEntries.length-1]},scope._deleteCorsEntry=function(){if(scope.selectedCorsEntry.__dfUI.newHost){for(var i=0;i<scope.corsEntries.length;){if(scope.corsEntries[i].__dfUI.tempId===scope.selectedCorsEntry.__dfUI.tempId){scope.corsEntries.splice(i,1);break}i++}var messageOptions={module:"CORS",type:"success",provider:"dreamfactory",message:"CORS entry deleted successfully."};return dfNotify.success(messageOptions),void(scope.selectedCorsEntry=null)}var requestDataObj={params:{fields:"*"},data:scope.selectedCorsEntry.record};dfApplicationData.deleteApiData("cors",requestDataObj).$promise.then(function(result){var messageOptions={module:"CORS",type:"success",provider:"dreamfactory",message:"CORS entry deleted successfully."};dfNotify.success(messageOptions),scope.selectedCorsEntry=null},function(reject){var messageOptions={module:"Api Error",type:"error",provider:"dreamfactory",message:reject};dfNotify.error(messageOptions)})},scope._saveCorsEntry=function(template){var requestDataObj={params:{fields:"*"},data:template.record};dfApplicationData.saveApiData("cors",requestDataObj).$promise.then(function(result){var messageOptions={module:"CORS",type:"success",provider:"dreamfactory",message:"CORS entry created successfully."};dfNotify.success(messageOptions);for(var i=0;i<scope.corsEntries.length;){if(scope.corsEntries[i].record.path===result.path){var _newHost=new CorsEntry(result);scope.corsEntries[i]=_newHost,scope.selectedCorsEntry=_newHost}i++}},function(reject){var messageOptions={module:"Api Error",type:"error",provider:"dreamfactory",message:reject};dfNotify.error(messageOptions)})},scope._updateCorsEntry=function(template){var requestDataObj={params:{fields:"*"},data:template.record};dfApplicationData.updateApiData("cors",requestDataObj).$promise.then(function(result){var messageOptions={module:"CORS",type:"success",provider:"dreamfactory",message:"CORS entry updated successfully."};dfNotify.success(messageOptions)},function(reject){var messageOptions={module:"Api Error",type:"error",provider:"dreamfactory",message:reject};dfNotify.error(messageOptions)})},scope.helpTextCors={description:{title:"Description",text:"Enter a description for this entry."},path:{title:"Path",text:"Enter an absolute path or a pattern to match against incoming requests. Example: * allows any path, api/v2/* will allow any path with api/v2/ prefix. Path is matched by most accurate, i.e. api/v2/system/environment will match api/v2/* before *."},origins:{title:"Origin (Access-Control-Allow-Origin)",text:"Enter a comma-delimited list of origins that you would like to allow for this path. Enter * for allowing any origin."},headers:{title:"Headers (Access-Control-Allow-Headers)",text:"Enter a comma-delimited list of allowed headers. Enter * to allow any header."},exposed_headers:{title:"Exposed Headers (Access-Control-Expose-Headers)",text:"Enter a comma-delimited list of headers to expose."},max_age:{title:"Max Age (Access-Control-Max-Age)",text:"Enter max age. This indicates how long (in seconds) the results of a pre-flight request can be cached. Enter 0 for no caching."},methods:{title:"Methods (Access-Control-Allow-Methods)",text:"Select HTTP verbs/methods that are allowed."}};var watchCorsEntries=scope.$watchCollection("apiData.cors",function(newValue,oldValue){newValue&&(scope.corsEntries=[],angular.forEach(newValue,function(cors){scope.corsEntries.push(new CorsEntry(cors))}))});scope.$on("$destroy",function(e){watchCorsEntries()})}}}]).directive("dreamfactoryEmailTemplates",["MODSYSCONFIG_ASSET_PATH","dfApplicationData","dfNotify",function(MODSYSCONFIG_ASSET_PATH,dfApplicationData,dfNotify){return{restrict:"E",scope:!1,templateUrl:MODSYSCONFIG_ASSET_PATH+"views/email-templates.html",link:function(scope,elem,attrs){var EmailTemplate=function(emailTemplateData){var _new={bcc:null,body_html:null,body_text:null,cc:null,defaults:[],description:null,from_email:null,from_name:null,id:null,name:"NEW EMAIL TEMPLATE",replay_to_email:null,replay_to_name:null,subject:null,to:null};return emailTemplateData=emailTemplateData||_new,{__dfUI:{newTemplate:null===emailTemplateData.id,tempId:Math.floor(1e5*Math.random())},record:angular.copy(emailTemplateData),recordCopy:angular.copy(emailTemplateData)}};scope.emailTemplates=null,scope.selectedEmailTemplate=null,scope.addEmailTemplate=function(){scope._addEmailTemplate()},scope.deleteEmailTemplate=function(){dfNotify.confirm("Delete "+scope.selectedEmailTemplate.record.name+"?")&&scope._deleteEmailTemplate()},scope.saveEmailTemplate=function(){var template=scope.selectedEmailTemplate;if(null==template){messageOptions={module:"Email Templates",type:"warn",provider:"dreamfactory",message:"No email template selected."};return dfNotify.warn(messageOptions),void angular.element("#select-email-template").focus()}if(null===template.record.id){if("NEW EMAIL TEMPLATE"===template.record.name){messageOptions={module:"Email Templates",type:"warn",provider:"dreamfactory",message:"Email templates should have a unique name.  Please rename your email template to something other than the default 'new' template name."};return void dfNotify.warn(messageOptions)}if(void 0===template.record.name){var messageOptions={module:"Email Templates",type:"error",provider:"dreamfactory",message:"Template Name is a required field."};return void dfNotify.error(messageOptions)}scope._saveEmailTemplate(template)}else scope._updateEmailTemplate(template)},scope._addEmailTemplate=function(){scope.emailTemplates.push(new EmailTemplate),scope.selectedEmailTemplate=scope.emailTemplates[scope.emailTemplates.length-1]},scope._deleteEmailTemplate=function(){if(scope.selectedEmailTemplate.__dfUI.newTemplate){for(var i=0;i<scope.emailTemplates.length;){if(scope.emailTemplates[i].__dfUI.tempId===scope.selectedEmailTemplate.__dfUI.tempId){scope.emailTemplates.splice(i,1);break}i++}var messageOptions={module:"Email Templates",type:"success",provider:"dreamfactory",message:"Email template deleted successfully."};return dfNotify.success(messageOptions),void(scope.selectedEmailTemplate=null)}var requestDataObj={params:{fields:"*"},data:scope.selectedEmailTemplate.record};dfApplicationData.deleteApiData("email_template",requestDataObj).$promise.then(function(result){var messageOptions={module:"Email Templates",type:"success",provider:"dreamfactory",message:"Email template deleted successfully."};dfNotify.success(messageOptions),scope.selectedEmailTemplate=null},function(reject){var messageOptions={module:"Api Error",type:"error",provider:"dreamfactory",message:reject};dfNotify.error(messageOptions)})},scope._saveEmailTemplate=function(template){var requestDataObj={params:{fields:"*"},data:template.record};dfApplicationData.saveApiData("email_template",requestDataObj).$promise.then(function(result){var messageOptions={module:"Email Templates",type:"success",provider:"dreamfactory",message:"Email template created successfully."};dfNotify.success(messageOptions);for(var i=0;i<scope.emailTemplates.length;){if(scope.emailTemplates[i].record.name===result.name){var _newTemplate=new EmailTemplate(result);scope.emailTemplates[i]=_newTemplate,scope.selectedEmailTemplate=_newTemplate}i++}},function(reject){var messageOptions={module:"Api Error",type:"error",provider:"dreamfactory",message:reject};dfNotify.error(messageOptions)})},scope._updateEmailTemplate=function(template){var requestDataObj={params:{fields:"*"},data:template.record};dfApplicationData.updateApiData("email_template",requestDataObj).$promise.then(function(result){var messageOptions={module:"Email Templates",type:"success",provider:"dreamfactory",message:"Email template updated successfully."};dfNotify.success(messageOptions)},function(reject){var messageOptions={module:"Api Error",type:"error",provider:"dreamfactory",message:reject};dfNotify.error(messageOptions)})},scope.helpText={recipient:{title:"Recipient",text:"Enter recipient address. Enter multiple addresses separated by comma."},cc:{title:"Cc",text:"Enter cc address. Enter multiple addresses separated by comma."},bcc:{title:"Bcc",text:"Enter bcc address. Enter multiple addresses separated by comma."},reply_to_name:{title:"Reply to Name",text:"Enter reply to name."},reply_to_email:{title:"Reply to Email",text:"Enter reply to email."}};var watchEmailTemplates=scope.$watchCollection("apiData.email_template",function(newValue,oldValue){newValue&&(scope.emailTemplates=[],angular.forEach(newValue,function(email){scope.emailTemplates.push(new EmailTemplate(email))}))});scope.$on("$destroy",function(e){watchEmailTemplates()})}}}]).directive("dreamfactoryGlobalLookupKeys",["MODSYSCONFIG_ASSET_PATH","dfApplicationData","dfNotify",function(MODSYSCONFIG_ASSET_PATH,dfApplicationData,dfNotify){return{restrict:"E",scope:!1,templateUrl:MODSYSCONFIG_ASSET_PATH+"views/global-lookup-keys.html",link:function(scope,elem,attrs){var Lookup=function(lookupKeyData){var _new={id:null,name:"NEW",value:null};return lookupKeyData=lookupKeyData||_new,{__dfUI:{newLookup:null===lookupKeyData.id,tempId:Math.floor(1e5*Math.random())},record:angular.copy(lookupKeyData),recordCopy:angular.copy(lookupKeyData)}};scope.globalLookups=null,scope.selectedLookup=null,scope.addLookup=function(){scope._addLookup()},scope.deleteLookup=function(){dfNotify.confirm("Delete "+scope.selectedLookup.record.name+"?")&&scope._deleteLookup()},scope.saveLookup=function(){var lookup=scope.selectedLookup;if(null==lookup){messageOptions={module:"Global Lookup Keys",type:"warn",provider:"dreamfactory",message:"No lookup key selected."};return dfNotify.warn(messageOptions),void angular.element("#select-global-lookup").focus()}if(null===lookup.record.id){if("NEW"===lookup.record.name){messageOptions={module:"Global Lookup Keys",type:"warn",provider:"dreamfactory",message:"Lookup keys should have a unique name.  Please rename your key to something other than the default 'new' key name."};return void dfNotify.warn(messageOptions)}if(void 0===lookup.record.name){var messageOptions={module:"Global Lookup Keys",type:"error",provider:"dreamfactory",message:"Lookup keys should have a unique name.  Please name your key."};return void dfNotify.error(messageOptions)}scope._saveLookup(lookup)}else scope._updateLookup(lookup)},scope._addLookup=function(){scope.globalLookups.push(new Lookup),scope.selectedLookup=scope.globalLookups[scope.globalLookups.length-1]},scope._deleteLookup=function(){if(scope.selectedLookup.__dfUI.newLookup){for(var i=0;i<scope.globalLookups.length;){if(scope.globalLookups[i].__dfUI.tempId===scope.selectedLookup.__dfUI.tempId){scope.globalLookups.splice(i,1);break}i++}var messageOptions={module:"Global Lookup Keys",type:"success",provider:"dreamfactory",message:"Lookup key deleted successfully."};return dfNotify.success(messageOptions),void(scope.selectedLookup=null)}var requestDataObj={params:{fields:"*"},data:scope.selectedLookup.record};dfApplicationData.deleteApiData("lookup",requestDataObj).$promise.then(function(result){var messageOptions={module:"Global Lookup Keys",type:"success",provider:"dreamfactory",message:"Lookup key deleted successfully."};dfNotify.success(messageOptions),scope.selectedLookup=null},function(reject){var messageOptions={module:"Api Error",type:"error",provider:"dreamfactory",message:reject};dfNotify.error(messageOptions)})},scope._saveLookup=function(lookup){var requestDataObj={params:{fields:"*"},data:lookup.record};dfApplicationData.saveApiData("lookup",requestDataObj).$promise.then(function(result){var messageOptions={module:"Global Lookup Keys",type:"success",provider:"dreamfactory",message:"Lookup key created successfully."};dfNotify.success(messageOptions);for(var i=0;i<scope.globalLookups.length;){if(scope.globalLookups[i].record.name===result.name){var _newLookup=new Lookup(result);scope.globalLookups[i]=_newLookup,scope.selectedLookup=_newLookup}i++}},function(reject){var messageOptions={module:"Api Error",type:"error",provider:"dreamfactory",message:reject};dfNotify.error(messageOptions)})},scope._updateLookup=function(lookup){var requestDataObj={params:{fields:"*"},data:lookup.record};dfApplicationData.updateApiData("lookup",requestDataObj).$promise.then(function(result){var messageOptions={module:"Global Lookup Keys",type:"success",provider:"dreamfactory",message:"Lookup key updated successfully."};dfNotify.success(messageOptions)},function(reject){var messageOptions={module:"Api Error",type:"error",provider:"dreamfactory",message:reject};dfNotify.error(messageOptions)})};var watchGlobalLookupKeys=scope.$watchCollection("apiData.lookup",function(newValue,oldValue){newValue&&(scope.globalLookups=[],angular.forEach(newValue,function(lookup){scope.globalLookups.push(new Lookup(lookup))}))});scope.$on("$destroy",function(e){watchGlobalLookupKeys()})}}}]).directive("dreamfactoryLiveChatConfig",["MODSYSCONFIG_ASSET_PATH","INSTANCE_URL","$http","dfApplicationData","dfNotify",function(MODSYSCONFIG_ASSET_PATH,INSTANCE_URL,$http,dfApplicationData,dfNotify){return{restrict:"E",scope:!1,templateUrl:MODSYSCONFIG_ASSET_PATH+"views/live-chat-config.html",link:function(scope,elem,attrs){scope.saveChatConfig=function(){var func,data;func=scope.hasChatConfig?$http.put:$http.post,data={name:"chat",value:scope.chatEnabled},func(INSTANCE_URL.url+"/system/custom",{resource:[data]}).then(function(){scope.hasChatConfig=!0;var messageOptions={module:"Live Chat",type:"success",provider:"dreamfactory",message:"Live chat config updated."};dfNotify.success(messageOptions)},function(reject){var messageOptions={module:"Api Error",type:"error",provider:"dreamfactory",message:reject};dfNotify.error(messageOptions)}).finally(function(){Comm100API.showChat(scope.chatEnabled),dfApplicationData.deleteApiDataFromCache("custom")})};var watchCustom=scope.$watchCollection("apiData.custom",function(newValue,oldValue){if(newValue){var chatEnabled=!0,custom=newValue.filter(function(obj){return"chat"===obj.name});custom.length>0&&(chatEnabled=Boolean(custom[0].value)),scope.hasChatConfig=custom.length>0,scope.chatEnabled=chatEnabled}});scope.$on("$destroy",function(e){watchCustom()})}}}]).service("SystemConfigEventsService",[function(){return{systemConfigController:{updateSystemConfigRequest:"update:systemconfig:request",updateSystemConfigSuccess:"update:systemconfig:success",updateSystemConfigError:"update:systemconfig:error"}}}]).service("SystemConfigDataService",["dfApplicationData",function(dfApplicationData){return{getSystemConfig:function(){return dfApplicationData.getApiDataSync("environment")}}}]),angular.module("dreamfactoryApidocsApp",["ngAnimate","ngCookies","ngResource","ngRoute","ngSanitize","ngTouch","dfUtility","dfSystemConfig","dfUserManagement","dfServices","dfSwaggerUI"]).constant("APP_VERSION","1.2.0").constant("INSTANCE_BASE_URL","").constant("INSTANCE_API_PREFIX","/api/v2").service("INSTANCE_URL",["INSTANCE_BASE_URL","INSTANCE_API_PREFIX",function(INSTANCE_BASE_URL,INSTANCE_API_PREFIX){this.url=INSTANCE_BASE_URL+INSTANCE_API_PREFIX}]).constant("APP_API_KEY","36fda24fe5588fa4285ac6c6c2fdfbdb6b6bc9834699774c9bf777f706d05a88").config(["$httpProvider","APP_API_KEY",function($httpProvider,APP_API_KEY){$httpProvider.defaults.headers.common["X-Dreamfactory-API-Key"]=APP_API_KEY}]).config(["$routeProvider","$httpProvider","$locationProvider",function($routeProvider,$httpProvider,$locationProvider){$locationProvider.hashPrefix(""),$routeProvider.when("/login",{controller:"LoginCtrl",templateUrl:"views/login.html",resolve:{checkLoginRoute:["$q","UserDataService","$location",function($q,UserDataService,$location){var deferred=$q.defer(),currentUser=UserDataService.getCurrentUser();return currentUser&&currentUser.session_token?($location.url("/services"),deferred.reject()):deferred.resolve(),deferred.promise}]}}).when("/logout",{controller:"LogoutCtrl",templateUrl:"views/logout.html"}).otherwise({controller:"LoginCtrl",templateUrl:"views/login.html",resolve:{checkOtherRoute:["$q","UserDataService","$location",function($q,UserDataService,$location){var deferred=$q.defer(),currentUser=UserDataService.getCurrentUser();return currentUser&&currentUser.session_token?$location.url("/services"):$location.url("/login"),deferred.reject(),deferred.promise}]}}),$httpProvider.interceptors.push("httpValidSession")}]).config(["$provide",function($provide){$provide.decorator("$exceptionHandler",["$delegate","$injector",function($delegate,$injector){return function(exception){if("string"==typeof exception){var prefix="Possibly unhandled rejection: ";0===exception.indexOf(prefix)&&(exception=angular.fromJson(exception.slice(prefix.length)))}if(!exception.provider||"dreamfactory"!==exception.provider)return $delegate(exception);$injector.invoke(["dfNotify",function(dfNotify){var messageOptions={module:exception.module,type:exception.type,provider:exception.provider,message:exception.exception};dfNotify.error(messageOptions)}])}}])}]),angular.module("dreamfactoryApidocsApp").controller("MainCtrl",["$scope","dfApplicationData","$location","UserDataService","dfIconService","$animate",function($scope,dfApplicationData,$location,UserDataService,dfIconService,$animate){$animate.enabled(!1),$scope.title="DreamFactory API Docs",$scope.adminApp=dfApplicationData.getQueryParameter("admin_app"),$scope.adminApp?$scope.$parent.bodyStyle={"padding-top":"0px"}:$scope.$parent.bodyStyle={"padding-top":"50px"},$scope.currentUser=UserDataService.getCurrentUser(),$scope.topLevelLinks=[{path:"#/login",target:null,label:"Login",name:"login",icon:dfIconService().login,show:!1},{path:null,target:null,label:UserDataService.getCurrentUser().name,name:"user",icon:dfIconService().user,show:!1,subLinks:[{path:"#/logout",target:null,label:"Logout",name:"logout",icon:null,show:!1}]}],$scope.topLevelNavOptions={links:$scope.topLevelLinks},$scope._setActiveLinks=function(linksArr,activeLinksArr){var found,i;angular.forEach(linksArr,function(link){for(found=!1,i=0;i<activeLinksArr.length;i++)if(link.name===activeLinksArr[i]){found=!0;break}link.show=found})},$scope.setTopLevelLinkValue=function(linkName,linkProp,value){for(var i=0;i<$scope.topLevelLinks.length;i++)if($scope.topLevelLinks[i].name===linkName){$scope.topLevelLinks[i][linkProp]=value;break}},$scope.$watch("currentUser",function(newValue,oldValue){var links=[];angular.equals(newValue,oldValue)||dfApplicationData.resetApplicationObj(),newValue?(links.push("user"),$scope.setTopLevelLinkValue("user","label",newValue.name)):links.push("login"),$scope._setActiveLinks($scope.topLevelLinks,links)})}]).controller("LoginCtrl",["$scope","$window","$location","$timeout","UserDataService","UserEventsService","SystemConfigDataService","dfNotify",function($scope,$window,$location,$timeout,UserDataService,UserEventsService,SystemConfigDataService,dfNotify){$scope.loginOptions={showTemplate:!0},$scope.$on(UserEventsService.password.passwordSetSuccess,function(e,userCredsObj){var messageOptions={module:"Users",type:"success",provider:"dreamfactory",message:"Password reset successful."};dfNotify.success(messageOptions),$scope.$broadcast(UserEventsService.login.loginRequest,userCredsObj)}),$scope.$on(UserEventsService.login.loginError,function(e){e.stopPropagation()}),$scope.$on(UserEventsService.login.loginSuccess,function(e,userDataObj){$scope.$parent.currentUser=userDataObj;var queryString=location.search.substring(1);$scope.loginOptions.showTemplate=!1,$timeout(function(){if(queryString){var uri=$location.absUrl().split("?");$window.location.href=uri[0]+"#/services"}else $location.url("/services")},250)})}]).controller("LogoutCtrl",["$scope","$location","UserEventsService",function($scope,$location,UserEventsService){$scope.$on(UserEventsService.logout.logoutSuccess,function(e,userDataObj){$scope.$parent.currentUser=userDataObj,$location.url("/login")})}]),Array.of||(Array.of=function(){return Array.prototype.slice.call(arguments)}),Array.prototype.copyWithin||(Array.prototype.copyWithin=function(target,start){if(null==this)throw new TypeError("this is null or not defined");var O=Object(this),len=O.length>>>0,relativeTarget=target>>0,to=relativeTarget<0?Math.max(len+relativeTarget,0):Math.min(relativeTarget,len),relativeStart=start>>0,from=relativeStart<0?Math.max(len+relativeStart,0):Math.min(relativeStart,len),end=arguments[2],relativeEnd=void 0===end?len:end>>0,final=relativeEnd<0?Math.max(len+relativeEnd,0):Math.min(relativeEnd,len),count=Math.min(final-from,len-to),direction=1;for(from<to&&to<from+count&&(direction=-1,from+=count-1,to+=count-1);count>0;)from in O?O[to]=O[from]:delete O[to],from+=direction,to+=direction,count--;return O}),Array.prototype.every||(Array.prototype.every=function(callbackfn,thisArg){var T,k;if(null==this)throw new TypeError("this is null or not defined");var O=Object(this),len=O.length>>>0;if("function"!=typeof callbackfn)throw new TypeError;for(arguments.length>1&&(T=thisArg),k=0;k<len;){var kValue;if(k in O&&(kValue=O[k],!callbackfn.call(T,kValue,k,O)))return!1;k++}return!0}),Array.prototype.fill||Object.defineProperty(Array.prototype,"fill",{value:function(value){if(null==this)throw new TypeError("this is null or not defined");for(var O=Object(this),len=O.length>>>0,relativeStart=arguments[1]>>0,k=relativeStart<0?Math.max(len+relativeStart,0):Math.min(relativeStart,len),end=arguments[2],relativeEnd=void 0===end?len:end>>0,final=relativeEnd<0?Math.max(len+relativeEnd,0):Math.min(relativeEnd,len);k<final;)O[k]=value,k++;return O}}),Array.prototype.filter||(Array.prototype.filter=function(fun){if(void 0===this||null===this)throw new TypeError;var t=Object(this),len=t.length>>>0;if("function"!=typeof fun)throw new TypeError;for(var res=[],thisArg=arguments.length>=2?arguments[1]:void 0,i=0;i<len;i++)if(i in t){var val=t[i];fun.call(thisArg,val,i,t)&&res.push(val)}return res}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(predicate){if(null==this)throw new TypeError('"this" is null or not defined');var o=Object(this),len=o.length>>>0;if("function"!=typeof predicate)throw new TypeError("predicate must be a function");for(var thisArg=arguments[1],k=0;k<len;){var kValue=o[k];if(predicate.call(thisArg,kValue,k,o))return kValue;k++}}}),Array.prototype.findIndex||Object.defineProperty(Array.prototype,"findIndex",{value:function(predicate){if(null==this)throw new TypeError('"this" is null or not defined');var o=Object(this),len=o.length>>>0;if("function"!=typeof predicate)throw new TypeError("predicate must be a function");for(var thisArg=arguments[1],k=0;k<len;){var kValue=o[k];if(predicate.call(thisArg,kValue,k,o))return k;k++}return-1}}),Array.prototype.forEach||(Array.prototype.forEach=function(callback){var T,k;if(null==this)throw new TypeError("this is null or not defined");var O=Object(this),len=O.length>>>0;if("function"!=typeof callback)throw new TypeError(callback+" is not a function");for(arguments.length>1&&(T=arguments[1]),k=0;k<len;){var kValue;k in O&&(kValue=O[k],callback.call(T,kValue,k,O)),k++}}),Array.prototype.includes||Object.defineProperty(Array.prototype,"includes",{value:function(searchElement,fromIndex){if(null==this)throw new TypeError('"this" is null or not defined');var o=Object(this),len=o.length>>>0;if(0===len)return!1;for(var n=0|fromIndex,k=Math.max(n>=0?n:len-Math.abs(n),0);k<len;){if(o[k]===searchElement)return!0;k++}return!1}}),Array.prototype.indexOf||(Array.prototype.indexOf=function(searchElement,fromIndex){var k;if(null==this)throw new TypeError('"this" is null or not defined');var o=Object(this),len=o.length>>>0;if(0===len)return-1;var n=0|fromIndex;if(n>=len)return-1;for(k=Math.max(n>=0?n:len-Math.abs(n),0);k<len;){if(k in o&&o[k]===searchElement)return k;k++}return-1}),Array.prototype.lastIndexOf||(Array.prototype.lastIndexOf=function(searchElement){if(void 0===this||null===this)throw new TypeError;var n,k,t=Object(this),len=t.length>>>0;if(0===len)return-1;for(n=len-1,arguments.length>1&&((n=Number(arguments[1]))!=n?n=0:0!=n&&n!=1/0&&n!=-1/0&&(n=(n>0||-1)*Math.floor(Math.abs(n)))),k=n>=0?Math.min(n,len-1):len-Math.abs(n);k>=0;k--)if(k in t&&t[k]===searchElement)return k;return-1}),Array.prototype.map||(Array.prototype.map=function(callback){var T,A,k;if(null==this)throw new TypeError("this is null or not defined");var O=Object(this),len=O.length>>>0;if("function"!=typeof callback)throw new TypeError(callback+" is not a function");for(arguments.length>1&&(T=arguments[1]),A=new Array(len),k=0;k<len;){var kValue,mappedValue;k in O&&(kValue=O[k],mappedValue=callback.call(T,kValue,k,O),A[k]=mappedValue),k++}return A}),Array.prototype.reduce||Object.defineProperty(Array.prototype,"reduce",{value:function(callback){if(null===this)throw new TypeError("Array.prototype.reduce called on null or undefined");if("function"!=typeof callback)throw new TypeError(callback+" is not a function");var value,o=Object(this),len=o.length>>>0,k=0;if(2==arguments.length)value=arguments[1];else{for(;k<len&&!(k in o);)k++;if(k>=len)throw new TypeError("Reduce of empty array with no initial value");value=o[k++]}for(;k<len;)k in o&&(value=callback(value,o[k],k,o)),k++;return value}}),"function"!=typeof Array.prototype.reduceRight&&(Array.prototype.reduceRight=function(callback){if(null===this||void 0===this)throw new TypeError("Array.prototype.reduce called on null or undefined");if("function"!=typeof callback)throw new TypeError(callback+" is not a function");var value,t=Object(this),k=(t.length>>>0)-1;if(arguments.length>=2)value=arguments[1];else{for(;k>=0&&!(k in t);)k--;if(k<0)throw new TypeError("Reduce of empty array with no initial value");value=t[k--]}for(;k>=0;k--)k in t&&(value=callback(value,t[k],k,t));return value}),Array.prototype.some||(Array.prototype.some=function(fun){if(null==this)throw new TypeError("Array.prototype.some called on null or undefined");if("function"!=typeof fun)throw new TypeError;for(var t=Object(this),len=t.length>>>0,thisArg=arguments.length>=2?arguments[1]:void 0,i=0;i<len;i++)if(i in t&&fun.call(thisArg,t[i],i,t))return!0;return!1}),Array.prototype.toLocaleString||Object.defineProperty(Array.prototype,"toLocaleString",{value:function(locales,options){if(null==this)throw new TypeError('"this" is null or not defined');var a=Object(this),len=a.length>>>0;if(0===len)return"";for(var firstElement=a[0],r=null==firstElement?"":firstElement.toLocaleString(locales,options),k=1;k<len;){var s=r+",",nextElement=a[k];r=s+(r=null==nextElement?"":nextElement.toLocaleString(locales,options)),k++}return r}}),Function.prototype.bind||(Function.prototype.bind=function(oThis){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var aArgs=Array.prototype.slice.call(arguments,1),fToBind=this,fNOP=function(){},fBound=function(){return fToBind.apply(this instanceof fNOP?this:oThis,aArgs.concat(Array.prototype.slice.call(arguments)))};return this.prototype&&(fNOP.prototype=this.prototype),fBound.prototype=new fNOP,fBound});