/*!build:Wed Mar 12 2025 13:35:49 GMT+1100 (Australian Eastern Daylight Time)*/ define("text!shared/widgets/adjodal/mytax16/actions.html",[],function(){return'
\r\n \r\n \r\n \r\n\r\n \r\n   \r\n \r\n \r\n \r\n \r\n opens in new window\r\n \r\n \r\n \r\n \r\n \r\n   \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n
'}),define("text!shared/widgets/adjodal/mytax16/defaultActions.html",[],function(){return"\r\n \r\n \r\n \r\n \r\n \r\n \r\n"}),define("text!shared/widgets/adjodal/mytax16/delete.html",[],function(){return''}),define("text!shared/widgets/calculatorHelpSidebar/mytax16/classic.html",[],function(){return'\r\n'}),define("text!shared/widgets/calculatorHelpSidebar/mytax16/classicCdn.html",[],function(){return'\r\n'}),define("text!shared/widgets/calculatorHelpSidebar/mytax16/sticky.html",[],function(){return'
\r\n \r\n \r\n \r\n
\r\n \r\n
\r\n \r\n \r\n
\r\n \r\n
\r\n \r\n \r\n \r\n
\r\n\r\n '}),define("text!shared/widgets/accordion/mytax16.html",[],function(){return'
\r\n
\r\n
\r\n\r\n
\r\n
\r\n
\r\n'}),define("text!shared/widgets/accordionPanel/mytax16.html",[],function(){return'
\r\n
\r\n \r\n
\r\n\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
'}),define("text!shared/widgets/adjodal/mytax16.html",[],function(){return'
\r\n
\r\n
\r\n
\r\n

\r\n \r\n \r\n \r\n \r\n

\r\n \r\n
\r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n \r\n \r\n

\r\n \r\n
\r\n
\r\n\r\n\r\n
\r\n\r\n'}),define("text!shared/widgets/alert/mytax16.html",[],function(){return'
\r\n
\r\n \r\n
\r\n
\r\n \r\n
\r\n \r\n
\r\n
\r\n \r\n
\r\n \r\n
\r\n
\r\n \r\n

\r\n \r\n
\r\n
\r\n \r\n

\r\n \r\n
\r\n
\r\n \r\n

\r\n \r\n
\r\n
\r\n \r\n
\r\n \r\n
\r\n
\r\n \r\n
\r\n \r\n
\r\n

\r\n
    \r\n \r\n
  • \r\n \r\n
\r\n
\r\n
\r\n
\r\n '}),define("text!shared/widgets/bottomNav/mytax16.html",[],function(){return"
\r\n
\r\n \r\n \r\n \r\n \r\n
\r\n
"}),define("text!shared/widgets/calculatePanel/mytax16.html",[],function(){return'
\r\n \r\n
\r\n
\r\n
\r\n
\r\n

\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n \r\n
\r\n'}),define("text!shared/widgets/calculatorHelpSidebar/mytax16.html",[],function(){return"
\r\n\r\n
"}),define("text!shared/widgets/checkBox/mytax16.html",[],function(){return'
\r\n \r\n \r\n
\r\n
\r\n
\r\n
'}),define("text!shared/widgets/checkBoxGroup/mytax16.html",[],function(){return"
\r\n
\r\n \r\n \r\n *\r\n \r\n \r\n
\r\n
\r\n
\r\n \r\n \r\n\r\n
\r\n
\r\n
\r\n
\r\n\r\n "}),define("text!shared/widgets/currency/mytax16.html",[],function(){return'
\r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n'}),define("text!shared/widgets/dropDownList/mytax16.html",[],function(){return'
\r\n \r\n
\r\n
\r\n\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n
'}),define("text!shared/widgets/fieldContainer/mytax16.html",[],function(){return'
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n \r\n
\r\n \r\n\r\n
\r\n\r\n '}),define("text!shared/widgets/fieldError/mytax16.html",[],function(){return'
\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n\r\n '}),define("text!shared/widgets/help/mytax16.html",[],function(){return'
\r\n \r\n
\r\n\r\n '}),define("text!shared/widgets/horizontalRadio/mytax16.html",[],function(){return'
\r\n \r\n
\r\n
\r\n \r\n \r\n \r\n \r\n \r\n *\r\n \r\n \r\n \r\n \r\n \r\n
\r\n
\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n\r\n
\r\n
\r\n\r\n
\r\n
\r\n\r\n'}),define("text!shared/widgets/loadingBar/mytax16.html",[],function(){return'
\r\n
\r\n
\r\n
\r\n Loading\r\n
\r\n
\r\n
\r\n
'}),define("text!shared/widgets/modal/mytax16.html",[],function(){return'\r\n'}),define("text!shared/widgets/pageError/mytax16.html",[],function(){return'
\r\n
\r\n\r\n

The following errors need to be fixed before you can proceed:

\r\n \r\n Start of errors\r\n The following errors need to be fixed before you can proceed\r\n \r\n \r\n End of error list\r\n
\r\n
\r\n\r\n '}),define("text!shared/widgets/pagination/mytax16.html",[],function(){return'
\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n \r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
'}),define("text!shared/widgets/printButton/mytax16.html",[],function(){return'
\r\n \r\n
\r\n'}),define("text!shared/widgets/progressBar/mytax16.html",[],function(){return'
\r\n \r\n
\r\n
\r\n
\r\n \r\n
\r\n\r\n'}),define("text!shared/widgets/readMore/mytax16.html",[],function(){return'
\r\n \r\n
\r\n
\r\n
\r\n
\r\n

\r\n
\r\n

\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n
\r\n \r\n
'}),define("text!shared/widgets/reveal/mytax16.html",[],function(){return'
\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
'}),define("text!shared/widgets/textArea/mytax16.html",[],function(){return'
\r\n \r\n
\r\n \r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n \r\n
\r\n'}),define("text!shared/widgets/textBox/mytax16.html",[],function(){return'
\r\n \r\n
\r\n \r\n \r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n \r\n
'}),define("text!shared/widgets/toggle/mytax16.html",[],function(){return"
\r\n \r\n
\r\n \r\n \r\n \r\n
\r\n
\r\n"}),define("text!shared/widgets/utilityToolbar/mytax16.html",[],function(){return'
\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n
'}),define("text!shared/widgets/verticalQuestionGroups/mytax16.html",[],function(){return"
\r\n
\r\n\r\n "}),define("text!shared/widgets/verticalRadio/mytax16.html",[],function(){return'
\r\n \r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n\r\n'}),define("text!shared/views/mytax16/feedback.html",[],function(){return'
\r\n

Provide feedback

\r\n

We would appreciate your feedback Link opens in new window on your experience. It should take you around one minute to complete and will help us improve our service.

\r\n
\r\n'}),define("text!shared/views/mytax16/fieldErrorCollection.html",[],function(){return'
\r\n
\r\n
'}),define("text!shared/views/mytax16/fieldLevelHelp.html",[],function(){return"
\r\n
\r\n

\r\n All fields marked with * are mandatory.\r\n

\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n\r\n
\r\n "}),define("text!shared/views/mytax16/questions.html",[],function(){return'
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n \r\n

\r\n \r\n All fields marked with * are mandatory\r\n \r\n

\r\n \r\n\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n \r\n
\r\n \r\n
\r\n '}),define("text!shared/views/mytax16/reportFooter.html",[],function(){return'\r\n
'}),define("text!shared/views/mytax16/shell.html",[],function(){return'\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n'}),define("shared/services/logger",["require","durandal/system"],function(e){"use strict";function i(e,t,i,s){var o=0;e&&(o|=r.logLevels.ERROR),t&&(o|=r.logLevels.WARNING),i&&(o|=r.logLevels.INFO),s&&(o|=r.logLevels.DEBUG),n.level=o}function s(e){return(n.level^e)!==0}function o(e,t,n){if(!e)throw new Error("Logger.logError: called with empty message");if(!t)throw new Error("Logger.logError: called with empty source");if(!s(r.logLevels.ERROR))return;l(e,t,n,r.logLevels.ERROR)}function u(e,t,n){if(!e)throw new Error("Logger.logWarning: called with empty message");if(!t)throw new Error("Logger.logWarning: called with empty source");if(!s(r.logLevels.WARNING))return;l(e,t,n,r.logLevels.WARNING)}function a(e,t,n){if(!e)throw new Error("Logger.logInfo: called with empty message");if(!t)throw new Error("Logger.logInfo: called with empty source");if(!s(r.logLevels.INFO))return;l(e,t,n,r.logLevels.INFO)}function f(e,t,n){if(!e)throw new Error("Logger.logDebug: called with empty message");if(!t)throw new Error("Logger.logDebug: called with empty source");if(!s(r.logLevels.DEBUG))return;l(e,t,n,r.logLevels.DEBUG)}function l(e,n,r,i){n=n?"["+n+"] ":"";if(r)t.log(n,e,r);else if(t.debug())try{var s="background: #222; color: #fff";console.log("%c "+n+e,s)}catch(o){t.log(n,e)}}function c(e){a(e,"tools-calculators")}var t=e("durandal/system"),n={level:0},r={logLevels:{ERROR:1,WARNING:2,INFO:4,DEBUG:8},setLogLevel:i,logError:o,logWarning:u,logInfo:a,logDebug:f,"-private":n,log:c};return r}),define("shared/data/HtmlStorage",["plugins/router","shared/services/logger"],function(e,t){function i(e,t,r){var i={value:t,timestamp:(new Date).getTime()};r=="memory"?this.inMemoryStorage.setItem(n+"_"+e,JSON.stringify(i)):r=="cookies"?this.cookieExpiryTime!==""?this.cookieStorage.setItem(n+"_"+e,JSON.stringify(i),this.cookieExpiryTime):this.cookieStorage.setItem(n+"_"+e,JSON.stringify(i)):this.storageSupportList[r]?window[r].setItem(n+"_"+e,JSON.stringify(i)):this.inMemoryStorage.setItem(n+"_"+e,JSON.stringify(i))}function s(e,r){var i;r=="memory"?i=JSON.parse(this.inMemoryStorage.getItem(n+"_"+e)):r=="cookies"?i=JSON.parse(this.cookieStorage.getItem(n+"_"+e)):this.storageSupportList[r]?i=JSON.parse(window[r].getItem(n+"_"+e)):i=JSON.parse(this.inMemoryStorage.getItem(n+"_"+e));if(typeof i!="undefined"&&i!==null){var s=i.value,o=i.timestamp;return s}return t.log('readFromStorage - key:"'+e+'"key not found for storage type - '+r),null}function o(e,t){var e=n+"_"+e;t=="memory"?this.inMemoryStorage.removeItem(e):t=="cookies"?this.cookieStorage.removeItem(e):this.storageSupportList[t]?window[t].removeItem(e):this.inMemoryStorage.removeItem(e)}function u(e){return o(e,"sessionStorage")}function a(e){return s(e,"sessionStorage")}function f(e,t){i(e,t,"sessionStorage")}function l(e){return o(e,"localStorage")}function c(e){return s(e,"localStorage")}function h(e,t){i(e,t,"localStorage")}function p(e){var n;return e=="sessionStorage"?n=v():e=="localStorage"?n=d():t.logError("HtmlStorage - "+e+" - type not found","HtmlStorage.testType"),n}function d(){try{return Modernizr.localstorage?!0:!1}catch(e){try{window.localStorage.setItem("storageWorks",!0);var t=window.localStorage.getItem("storageWorks")==1;return t}catch(e){return!1}}}function v(){try{return Modernizr.sessionstorage?!0:!1}catch(e){try{window.localStorage.setItem("storageWorks",!0);var t=window.sessionStorage.getItem("storageWorks")==1;return t}catch(e){return!1}}}function m(){try{if(navigator.cookieEnabled)return!0;document.cookie="cookietest=1";var e=document.cookie.indexOf("cookietest=")!=-1;return document.cookie="cookietest=1; expires=Thu, 01-Jan-1970 00:00:01 GMT",e}catch(t){return!1}}function g(e){var r=e.datacontext;if(typeof r=="undefined"){t.log("Cannot find config item - appsettings.datacontext",null,"htmlstorage");return}if(!r.hasOwnProperty("namespace"))throw'Badly formed datacontext config. Must contain "namespace" property';n=r.namespace}function y(){var e=this;e.storage=[],e.setItem=function(e,t){var n,r=this.storage.filter(function(t,r){if(t.key==e)return n=r,t.key==e});n>=0?this.storage[n].value=t:this.storage.push({key:e,value:t})},e.removeItem=function(e,t){var n,r=this.storage.filter(function(t,r){if(t.key==e)return n=r,t.key==e});n>=0&&this.storage.pop(this.storage[n])},e.getItem=function(e){var t=this.storage.filter(function(t,n){return t.key==e});return t.length>0?t[0].value:null}}function b(){var e=this;e.setItem=function(e,t,n){n?document.cookie=e+"="+t+";expires="+n:document.cookie=e+"="+t+";"},e.removeItem=function(e,t){document.cookie=e+"=;expires=Thu, 01-Jan-1970 00:00:01 GMT"},e.getItem=function(e){try{var t=document.cookie.lastIndexOf(e);if(t>=0){var n=document.cookie.substring(document.cookie.lastIndexOf(e),document.cookie.length);return n=n.split(";")[0].split("=")[1],n==""||typeof n=="undefined"?null:n}return null}catch(r){return null}}}var n="",r=function(e){var t=this;g(e),t.writeToStorage=i,t.readFromStorage=s,t.removeFromStorage=o,t.writeToSessionStorage=f,t.readFromSessionStorage=a,t.removeFromSessionStorage=u,t.writeToLocalStorage=h,t.readFromLocalStorage=c,t.removeFromLocalStorage=l,t.supportsLocalStorage=d,t.supportsCookies=m,t.inMemoryStorage=new y,t.cookieExpiryTime="",t.setCookieExpiryTime=function(e){t.cookieExpiryTime=e},t.testType=p,t.storageSupportList={sessionStorage:v(),localStorage:d()}};return r}),define("services/logger",["durandal/system"],function(e){function n(e,t,n,r){i(e,t,n,r,"info")}function r(e,t,n,r){i(e,t,n,r,"error")}function i(t,n,r,i,s){r=r?"["+r+"] ":"",n?e.log(r,t,n):e.log(r,t)}var t={log:n,logError:r};return t}),define("shared/data/questionsManager",["knockout","services/logger"],function(e,t){function r(t){var n;return t.relevant=!1,n=e.mapping.fromJS(t),n.questions=e.observableArray([]),this.questionGroups.push(n),n}function i(t){var n;return n=e.mapping.fromJS(t),n.relevantValue=e.computed(function(){var e=typeof this.relevant=="function"?this.relevant():this.relevant;return this.questiongroup.relevant()&&e?this.value():this.defaultValue()},n),this.questions.push(n),n.questiongroup.questions().push(n),n}function s(){return this.questionGroups()}function o(){return this.questions()}function u(t){var n=e.utils.arrayFilter(this.questionGroups(),function(e){return e.key().toLowerCase().trim()==t.toLowerCase().trim()})[0];return n}function a(t){var n=e.utils.arrayFilter(this.questions(),function(e){return e.key().toLowerCase().trim()==t.toLowerCase().trim()})[0];return n}function f(t){this.questions().forEach(function(n){if(n.ordinal()>t){var r=e.unwrap(n.value);Array.isArray(r)?n.value([]):n.value(n.defaultValue())}})}function l(t,n){this.questions().forEach(function(r){if(r.ordinal()>t&&r.ordinal()t&&r.ordinal()=0?{value:this.getQuestionGroupByKey(e.substr(0,t)).relevant}:this.questionsManager.getQuestionByKey(e)}function f(e){var t=this.getQuestionByKey(e);return t.value}function l(e){var t=this.getQuestionByKey(e);return t.questiongroup.relevant()&&t.relevant()?t.value:t.defaultValue}function c(e){var t=this.getQuestionByKey(e);return t.questiongroup.relevant()&&t.relevant()?!0:!1}function h(e,t,n){return this.questionsManager.addQuestionGroup({key:e,ordinal:t,headingText:n})}function p(t,n,r,i,s,o,u,a,f,l){var c=this,h;t.key?(h=t,f=h.questiongroup):h={key:t,ordinal:n,value:r,defaultValue:i,type:s,refDataKey:o,text:u,explanatory:a,questiongroup:f,relevant:e.observable(!0),printFriendly:l},h.value==""&&(h.type=="collection"||h.type=="collectionViewModel")&&(h.value=[],h.defaultValue=[]);var p=this.questionsManager.addQuestion(h);return w.call(this,p.key(),p.value()),p.value.subscribe(function(e){var t="";c.instanceKey.length>0&&(t="."+c.instanceKey+".");var n=p.questiongroup.key()+t+p.key();c.questionsChanged(p.key())},c),p}function d(e){this.questionsManager.resetSubsequentQuestions(e)}function v(e,t){e==null&&(e=-99999999),t==null&&(t=99999999),this.questionsManager.resetQuestions(e,t)}function m(){return this.questionsManager.getQuestions()}function g(e,t){w.call(this,e,t,"localStorage")}function y(e){var t=E.call(this,e,"localStorage");return t}function b(e,t){w(e,t)}function w(e,t,n){n=n?n:this.htmlStorageType,(new r(this.appconfig)).writeToStorage(e,t,n)}function E(e,t){return t=t?t:this.htmlStorageType,(new r(this.appconfig)).readFromStorage(e,t)}function S(){var e={namespace:this.appconfig.datacontext.namespace,questions:[],lastUpdatedDate:null,dataObjectId:0,routes:[]};return $.each(this.getQuestions(),function(t,n){e.questions.push({key:n.key(),value:n.value()})}),e.uiState=this.uiState,e}function x(){var e={namespace:this.appconfig.datacontext.namespace,questions:[],lastUpdatedDate:null,dataObjectId:0,routes:[]};return $.each(this.getQuestions(),function(t,n){e.questions.push({key:n.key(),value:n.defaultValue()})}),e.uiState={},e}function T(e){e.questions.forEach(function(e,n){try{t.log("dataContext - set data - adding item: "+e.key);var r=this.getQuestionByKey(e.key);r.value(e.value)}catch(i){t.log("dataContext - set data - adding item: "+e.key+", failed")}},this),typeof e.uiState!="undefined"&&(this.uiState=e.uiState)}var s=function(n){this.htmlStorageType="sessionStorage",this.instanceKey="",typeof n.appConfig!="undefined"?(this.appconfig=n.appConfig,this.instanceKey=n.key):this.appconfig=n,t.log("appconfig.datacontext - ",this.appconfig.datacontext.namespace,"datacontext-ctor"),this.addQuestionGroup=h,this.addQuestion=p,this.getQuestionGroups=o,this.getQuestionGroupByKey=u,this.getQuestionByKey=a,this.getQuestionValue=f,this.getQuestionRelevancy=c,this.getQuestionRelevantValue=l,this.getQuestions=m,this.resetSubsequentQuestions=d,this.resetQuestions=v,this.saveQuestionsToStorage=g,this.loadQuestionsFromStorage=y,this.questionsChanged=e.observable(!0),this.questionsChanged.extend({notify:"always"}),this.getData=S,this.setData=T,this.getCleanData=x,this.calculatorItemsLoaded=!1,this.questionsManager=new i,this.uiState={}};return s}),define("shared/refdata/alt",[],function(){return{values:[{key:"AT001",text:"Click the start button to start the application."},{key:"AT002",text:"Click the exit button to take you to the exit screen."},{key:"AT003",text:"Click the next button to take you to the next screen"},{key:"AT004",text:"Return to previous screen"},{key:"AT005",text:""},{key:"AT006",text:"Click the restart button to restart the application"},{key:"AT007",text:"Click this link to go to the ATO homepage"},{key:"AT008",text:"Click this link to view other calculators for individuals"},{key:"AT009",text:"Click this link to view other calculators for tax professionals"},{key:"AT010",text:"Click this link to provide feedback"}]}}),define("shared/refdata/errormsgs",[],function(){return{values:[{key:"EM0001",text:"Please make a selection to continue.",type:"E"},{key:"EM0002",text:"Please enter an amount to continue.",type:"E"},{key:"EM0003",text:"Do not enter non numeric characters eg %, $, -, +, = or blank spaces.",type:"E"},{key:"EM0004",text:"Please enter a number in the range 0 to 99999999.",type:"E"},{key:"EM0005",text:"Please enter a number in the range from {FBT_thres} to 99999999.",type:"E"},{key:"EM0006",text:"Please enter a number in the range 1 to {days_in_yr}",type:"E"},{key:"EM0007",text:"Select an income year",type:"E"},{key:"EM0008",text:"Select yes or no",type:"E"},{key:"EM0009",text:"Enter a number using whole numbers",type:"E"},{key:"EM0010",text:"Select your marital status",type:"E"},{key:"EM0011",text:"Select a FBT year",type:"E"},{key:"EM0012",text:"Enter either 0 or an amount greater than {FBT_thres}",type:"E"},{key:"EM0013",text:"Select an option",type:"E"},{key:"EM0014",text:"Enter at least one amount using whole numbers",type:"E"},{key:"EM0015",text:"Enter a number from 1 to {days_in_yr}",type:"E"},{key:"EM0016",text:"Enter an amount equal or greater than {min_amt}",type:"E"},{key:"EM0017",text:"Enter a number from 1 to {days_in_yr-1}",type:"E"},{key:"EM0018",text:"Enter an amount in whole dollars, cents are not required",type:"E"},{key:"EM0019",text:"Select an entity type",type:"E"},{key:"EM0020",text:"Select an exemption type",type:"E"},{key:"EM0021",text:"Enter a description",type:"E"},{key:"EM0022",text:"Select at least one option",type:"E"},{key:"EM0023",text:"Enter or select a valid date",type:"E"},{key:"EM0024",text:"Enter at least one record",type:"E"},{key:"EM0025",text:"Enter an amount greater than {0}",type:"E"},{key:"EM0026",text:"Select a year equal or later than {0}",type:"E"},{key:"EM0027",text:"Select a year later than {0}",type:"E"},{key:"EM0028",text:"Enter a date after {0}",type:"E"},{key:"EM0029",text:"Enter a number from {0} to {1}",type:"E"},{key:"EM0030",text:"Enter a date before or equal to {0}",type:"E"},{key:"EM0031",text:"Enter a date after or equal to {0}",type:"E"},{key:"EM0032",text:"Enter a date before {0}",type:"E"},{key:"EM0033",text:"Make a selection",type:"E"},{key:"EM0034",text:"Enter using letters and/or numbers",type:"E"},{key:"EM0035",text:"Enter at least one complete record",type:"E"},{key:"EM0036",text:"Enter numbers only",type:"E"},{key:"EM0037",text:"Choose an option",type:"E"},{key:"EM0038",text:"Enter a number in the range {0} to {1}",type:"E"},{key:"EM0039",text:"Enter an amount in dollars and cents",type:"E"},{key:"EM0040",text:"Select a property type",type:"E"},{key:"EM0041",text:"Select a property transaction",type:"E"},{key:"EM0042",text:"Enter a percentage number from 0 to 100",type:"E"},{key:"EM0043",text:"This is a required field",type:"E"},{key:"EM0044",text:"Enter a valid date (dd/mm/yy)",type:"E"},{key:"EM0045",text:"Date of birth cannot be later than the end of the income year",type:"E"},{key:"EM0046",text:"Enter only letters, numbers, space and the following symbols: . / $ ( ) ‘ - , * #",type:"E"},{key:"EM0047",text:"Must be a valid 11-digit ABN",type:"E"},{key:"EM0048",text:"Date must be betweem incomeYearStart to incomeYearEnd",type:"E"},{key:"EM0049",text:"End date cannot be before start date",type:"E"},{key:"EM0050",text:"Number cannot be negative",type:"E"},{key:"EM0051",text:"Field contains a % or & symbol without a following space or has an invalid character(s)",type:"E"},{key:"EM0052",text:"Enter number between 1 and {pageCount}",type:"E"}]}}),define("shared/refdata/href",[],function(){return{values:[{key:"HR101",type:"E",link:"http://www.ato.gov.au/"},{key:"HR102",type:"E",link:"http://www.ato.gov.au/calc_othertaxcalcindividualsindex"},{key:"HR103",type:"E",link:"http://www.ato.gov.au/calc_othertaxcalctaxprofessionalsindex"},{key:"HR104",type:"E",link:"http://www.ato.gov.au/calculatorfeedback"}]}}),define("shared/refdata/postcodeRanges",[],function(){return{values:[["0200","0299"],["0800","7499"],["7800","9799"]]}}),define("shared/refdata/publicHolidayAtoShutdownDay",[],function(){return{values:["23/12/2016","24/12/2016","25/12/2016","26/12/2016","27/12/2016","28/12/2016","29/12/2016","30/12/2016","01/01/2017","02/01/2017","26/01/2017","14/04/2017","17/04/2017","25/04/2017","25/12/2017","26/12/2017","27/12/2017","28/12/2017","29/12/2017","30/12/2017","31/12/2017","01/01/2018","26/01/2018","30/03/2018","02/04/2018","25/04/2018","25/12/2018","26/12/2018","27/12/2018","28/12/2018","29/12/2018","30/12/2018","31/12/2018","01/01/2019","28/01/2019","19/04/2019","22/04/2019","25/04/2019","25/12/2019","26/12/2019","27/12/2019","28/12/2019","29/12/2019","30/12/2019","31/12/2019","01/01/2020","27/01/2020","10/04/2020","13/04/2020","25/04/2020","25/12/2020","26/12/2020","27/12/2020","28/12/2020","29/12/2020","30/12/2020","31/12/2020","01/01/2021","26/01/2021","02/04/2021","05/04/2021","25/04/2021","27/12/2020","28/12/2020","3/01/2022","26/01/2022","15/04/2022","18/04/2022","25/04/2022"]}}),define("shared/services/ClientCdn",["moment","q","jquery"],function(e,t,n){"use strict";function o(e){for(var t in e.cdn)u(e.cdn[t]);for(var n in e.statics)e.statics[n].lookupKeys||(e.statics[n].lookupKeys={code:"code",desc:"desc"}),u(e.statics[n]);s=!0}function u(e,t){e.lookupKeys||(t?e.lookupKeys=t:e.lookupKeys={code:undefined,desc:undefined});for(var n in e.subsets)u(e.subsets[n],e.lookupKeys);return e}function a(t){var n={},i=require("shared/services/validator"),s=r[t.tableName];if(s&&s.rows){var o=t.filters||[];t.subsetName===undefined||t.subsetName!==undefined&&t.sortOn===undefined?n=s.rows:n=s.workerRows;var u=s.columnMap[t.byDate.startDate||"DT_EFFECT"],a=s.columnMap[t.byDate.endDate||"DT_END"];if(t.byDate)switch(t.byDate.type){case v.Current:var f=d();n=n.filter(function(t){var n=e(t[u],"YYYY-MM-DD"),r=e(t[a],"YYYY-MM-DD");return i.compareDateAsMoment(f,"between",n,r)||i.compareDateAsMoment(f,"equals",n)||i.compareDateAsMoment(f,"equals",r)});break;case v.Range:var l=e(t.byDate.StartRange),c=e(t.byDate.EndRange);n=n.filter(function(t){var n=e(t[u],"YYYY-MM-DD"),r=e(t[a],"YYYY-MM-DD");return i.compareDateAsMoment(n,"between",l,c)||i.compareDateAsMoment(n,"equals",l)||i.compareDateAsMoment(n,"equals",c)||i.compareDateAsMoment(r,"between",l,c)||i.compareDateAsMoment(r,"equals",l)||i.compareDateAsMoment(r,"equals",c)})}if(t.sortOn){var h=s.columnMap[t.sortOn];if(t.sortOrder===undefined||t.sortOrder=="ASC")s.columns[h].type==="CHAR"?n=n.sort(function(e,t){return e[h]t[h]?1:0}):s.columns[h].type==="DATE"?n=n.sort(function(n,r){return e(n[s.columnMap[t.sortOn]])-e(r[s.columnMap[t.sortOn]])}):n=n.sort(function(e,n){return parseFloat(e[s.columnMap[t.sortOn]])-parseFloat(n[s.columnMap[t.sortOn]])});else if(t.sortOrder="DESC")s.columns[h].type==="CHAR"?n=n.sort(function(e,t){return e[h]>t[h]?-1:e[h]0)for(var n=0;n-1)&&i.push(m.primeFromCdn(e.cdn[s]));return Q.all(i).then(function(n){for(var i in e.cdn)(typeof t=="undefined"||t.indexOf(i)>-1)&&f(e.cdn[i]);r=[]})},primeFromCdn:function(e){var t=e.tableName,i=window.ato.cdnCodesTablePath;if(t==="TCTGCDDCD"&&e.splitFiles){var s=[];for(var o in e.subsets){var u=e.subsets[o].filters.filter(function(e){return e.col==="CD_TYPE_GCDDCD"});if(u){var a=u[0].val.replace(/[^a-zA-Z0-9]/g,"_"),f=n.getJSON(i+"generic/"+a+".json");s.push(f)}}return Q.all(s).then(function(e){var n=e[0],i=[];c(n,i);var s=[];for(var o=0;oSelect 'Save and continue' to save the record and then continue with the selected activity.
Select 'Back' to stay on this record and make more changes.
",SecondaryButtonText:"Back",PrimaryButtonText:"Save and continue"},dateFormats:{systemDate:"YYYY-MM-DD",systemDateTime:"YYYY-MM-DD HH:mm:ss",displayDate:"DD/MM/YYYY",displayDateTime:"DD/MM/YYYY HH:mm:ss",messageFormatDate:"D MMMM YYYY",serverDateTime:"YYYY-MM-DDTHH:mm:ss",displayFormats:["D/MM/YYYY","DD/MM/YYYY"]},defaultDateFormat:"DD/MM/YYYY"}}),define("shared/services/loader",[],function(){function t(e){this.appConfig=e}function n(e){var t=s(e,this.appConfig.questiongroups);o(e,this.appConfig.questions,t),e.calculatorItemsLoaded=!0}function r(){var e=[],t=!1,n=this.appConfig.screens==undefined?"questiongroups":"screens";for(var r=0;r0:!1}function c(e){return!e||/^\s*$/.test(e)}function h(e){return e?/^\d+\/\d+\/\d+$/.test(e)?t(e,u,!0).isValid():!1:!1}function p(e,t,n){var r=!0;e=String(e),e.length==0&&(r=!1),typeof n=="undefined"?n=!1:n===!0&&(e=F(e));var i=e.replace(/\D+/g,"");return t==1?e[0]=="-"&&(i="-"+i):Number(e)<0&&(r=!1),r&&e!=i&&(r=!1),r&&isNaN(parseInt(e,10))&&(r=!1),r}function d(e,t,n){var r=undefined,i=undefined;return v(e,2,t,r,i,n)}function v(e,t,n,r,i,s){e=String(e);if(typeof i=="undefined")var i=!0;typeof s=="undefined"?s=!1:s===!0&&(e=F(e));if(e){var o=e.split(".");if(typeof o!="undefined"&&o.length>2)return!1;if(i||!i&&o[0]!=="")if(!p(o[0],n))return!1;if(typeof o[1]!="undefined"&&t!==null){if(typeof r!="undefined"&&r!==null){if(o[1].length>r)return!1}else if(typeof t!="undefined"&&t!==null&&o[1].length!==t)return!1;if(!p(o[1])||o.length!==2)return!1}return!0}}function m(e,t,n,r,i,s,o){typeof s=="undefined"&&(s=!1),typeof o=="undefined"&&(o=!1);var s=s,u="integer",a=undefined,f=undefined,l=undefined;return y(e,t,n,r,i,s,u,a,f,l,o)}function g(e,t,n,r,i,s,o,u,a,f){typeof s=="undefined"&&(s=!1),typeof f=="undefined"&&(f=!1);var s=s,l="decimal";return y(e,t,n,r,i,s,l,o,u,a,f)}function y(e,t,r,i,s,o,u,a,f,l,c){var h=!1,d=!1;return typeof i=="undefined"&&(i=!0),typeof s=="undefined"&&(s=!0),typeof l=="undefined"&&(l=null),typeof o=="undefined"&&(o=!1),typeof c=="undefined"&&(c=!1),u=="integer"?d=p(String(e),o,c)&&p(String(t),o)&&p(String(r),o):d=v(String(e),l,o,a,f,c)&&v(String(t),l,o,a,f)&&v(String(r),l,o,a,f),d?(e=F(e),e=e==""?new n(0):new n(e),t=t==""?new n(0):new n(t),r=r==""?new n(0):new n(r),i&&s&&(e.greaterThanOrEqualTo(t)&&e.lessThanOrEqualTo(r)?h=!0:h=!1),!i&&s&&(e.greaterThan(t)&&e.lessThanOrEqualTo(r)?h=!0:h=!1),i&&!s&&(e.greaterThanOrEqualTo(t)&&e.lessThan(r)?h=!0:h=!1),!i&&!s&&(e.greaterThan(t)&&e.lessThan(r)?h=!0:h=!1),h):h}function b(e){if(!h(e))return!1;var t=require("shared/services/common"),n=t.getCurrentDate();return e=t.toMoment(e),e.isBefore(n)}function w(e){if(!h(e))return!1;var t=require("shared/services/common"),n=t.getCurrentDate();return e=t.toMoment(e),e.isAfter(n)}function E(e){if(!h(e))return!1;var t=require("shared/services/common"),n=t.getCurrentDate().format("DD/MM/YYYY");return S(e,n)}function S(e,t){if(!h(e)||!h(t))return!1;var n=require("shared/services/common");return e=n.toMoment(e),t=n.toMoment(t),e.isSame(t)}function x(e){var t=!1;if(!h(e))return!1;var n=E(e),r=b(e);if(n||r)t=!0;return t}function T(e){var t=!1;if(!h(e))return!1;var n=E(e),r=w(e);if(n||r)t=!0;return t}function N(e,n,r,i){return!h(e)||!h(r)?!1:i&&(!h(i)||n!=="between")?!1:c(i)&&n=="between"?!1:(e=t(e,u),r=t(r,u),i&&(i=t(i,u)),C(e,n,r,i))}function C(e,n,r,i){var s=!0;if(!t.isMoment(e)||!t.isMoment(r)||!e.isValid()||!r.isValid())s=!1;return i&&(!t.isMoment(i)||!i.isValid()||n!="between")&&(s=!1),c(i)&&n=="between"&&(s=!1),s&&(n=="equals"?s=e.isSame(r):n=="lessThan"?s=e.isBefore(r):n=="lessThanOrEqualTo"?s=e.isBefore(r)||e.isSame(r):n=="greaterThan"?s=e.isAfter(r):n=="greaterThanOrEqualTo"?s=e.isAfter(r)||e.isSame(r):n=="between"?s=e.isAfter(r)&&e.isBefore(i)||e.isSame(r)||e.isSame(i):s=!1),s}function k(e){var t=!1;e=e.trim();if(p(e)&&parseInt(e)>0&&e.length>6){var n=parseInt(e.charAt(0))*10+parseInt(e.charAt(1))*7+parseInt(e.charAt(2))*8+parseInt(e.charAt(3))*4+parseInt(e.charAt(4))*6+parseInt(e.charAt(5))*3;e.length>7&&(n+=parseInt(e.charAt(6))*5),e.length>8&&(n+=parseInt(e.charAt(7))*2);var r=11-(n-Math.floor(n/11)*11);r==11&&(r=0);var i=parseInt(e.charAt(e.length-1));r==i&&(t=!0)}return t}function L(e){var t=!1;e=e.trim();if(p(e)&&parseInt(e)>0&&e.length==11){var n=(parseInt(e.charAt(0))-1)*10+parseInt(e.charAt(1))*1+parseInt(e.charAt(2))*3+parseInt(e.charAt(3))*5+parseInt(e.charAt(4))*7+parseInt(e.charAt(5))*9+parseInt(e.charAt(6))*11+parseInt(e.charAt(7))*13+parseInt(e.charAt(8))*15+parseInt(e.charAt(9))*17+parseInt(e.charAt(10))*19;n%89==0&&(t=!0)}return t}function A(e){var t=new RegExp("^[a-zA-Z0-9 ]+$");return t.test(e)?!0:!1}function O(e){var t=new RegExp("^(?![0-9 ()-/]*$)[a-zA-Z0-9 ()-/&'$#@!^~%_=]+$");return t.test(e)?!1:!0}function M(e){var t=new RegExp("^(?=.*[a-zA-Z0-9 ,&'/()-s])[^*$#@!^~%+_=]+$"),n=new RegExp(/([a-zA-Z&/()\-,'\s])\1\1/);return t.test(e)?n.test(e)?!1:!0:!1}function _(e){var t=new RegExp("^[a-zA-Z0-9 ,&'/()-]+$");return t.test(e)?!0:!1}function D(e){var t=!1,n=s.values;return n.some(function(n){return y(e,n[0],n[1],!0,!0)&&(t=!0),t}),t}function P(e){var t=!1,n=require("shared/services/common");if(n.cdnEnabled()){if(o.cdn.generic.subsets.DT_NXT_BANK_DAY.rowItems.length===0)throw"spaRefData.cdn.generic.subsets.DT_NXT_BANK_DAY.rowItems.length = 0";var r=o.cdn.generic.subsets.DT_NXT_BANK_DAY.rowItems,s=e.format("YYYY-MM-DD");r.findIndex(function(e){return e.code===s})>-1&&(t=!0)}else{var r=i.values;r.indexOf(e.format("DD/MM/YYYY"))>-1?t=!0:t=!1}return t}function H(e){return e.isoWeekday()!==6&&e.isoWeekday()!==7&&!P(e)?!0:!1}function B(e){var t=ko.unwrap(e);return Array.isArray(e)}function j(e){var t=new RegExp(/&\S|%\S/gm),n=e.match(/[A-Za-z0-9* '\-\.\,""\?/ !$&_%\+=\\:;\(\)\{\}\[\]@#`|\n\r\t]/gm);return n===null||n.length!==e.length?!1:t.test(e)?!1:!0}function F(e,t){if(typeof e=="string"){typeof t=="undefined"&&(t=!1);var n=/^([0-9]{1,3}(,[0-9]{3})*(\.[0-9]+)?|\d*\.\d+|\d+)$/,r=n.test(e);r&!t?e=e.replace(/[,]+/g,""):t&&(e=e.replace(/[,]+/g,""))}return e}var u=["D/MM/YYYY","DD/MM/YYYY"],a={isEmpty:f,isBlank:c,isValidDate:h,isValidInteger:p,isValidDecimal:v,isValidCurrency:d,integerWithinRange:m,decimalWithinRange:g,compareDate:N,compareDateAsMoment:C,dateFormats:["D/MM/YYYY","DD/MM/YYYY"],isValidTFN:k,isValidABN:L,isAlphaNumeric:A,isOnlyNumbers:O,isValidAddressLine:M,isValidSuburb:_,isValidPostcode:D,isNotEmptyArray:l,isBeforeTodaysDate:b,isAfterTodaysDate:w,isPublicHolidayOrAtoShutdownday:P,isPublicHolidayOrWeekend:H,isArray:B,isValidCharFormat:j,removeThousandSeperator:F,isSameAsTodaysDate:E,isSameDate:S,isOnOrBeforeTodaysDate:x,isOnOrAfterTodaysDate:T};return a}),define("shared/services/blockUI",["require","durandal/app"],function(e,t){"use strict";function i(e){var i="/ui/images/loader-teal.png",s;typeof t.imageLocation!="undefined"?s=t.imageLocation+"/loader-teal.png":s="/misc/SPA/Calculators/images/loader-teal.png",r.isShowingPleaseWait=!0;var o="We are processing your request. Please wait.",u=n("#PleaseWaitMessage");e?u.find("p").text(e):e=o,u.find("p").text(o),n.blockUI({message:'

'+e+"

",css:{font:"small",border:"none",padding:"0px",backgroundColor:"transparent",margin:"0px",top:"30%","-webkit-border-radius":"4px","-moz-border-radius":"4px","border-radius":"4px",opacity:"0.8","-ms-filter":"progid:DXImageTransform.Microsoft.Alpha(Opacity=80)",filter:"alpha(opacity=80)",color:"#000","-webkit-background-clip":"padding-box"},baseZ:5e3,fadeIn:0,showOverlay:!0,overlayCSS:{opacity:.1},defaults:{fadeIn:1e3}})}function s(){r.isShowingPleaseWait=!1,n.unblockUI()}var n=e("jquery"),r={isShowingPleaseWait:!1,showPleaseWait:i,hidePleaseWait:s};return r}),define("shared/services/common",["jquery","moment","knockout","bignumber","q","./validator","./logger","./constants","./blockUI"],function(e,t,n,r,i,s,o,u,a){function c(t,n,r){var i=e(".modal.fade.in");return i&&i.length>0?(i.modal("hide"),!1):!0}function h(e){var t=e.split("-");switch(t[1]){case"1":return"1 January "+t[0]+" to 31 March "+t[0];case"2":return"1 April "+t[0]+" to 30 June "+t[0];case"3":return"1 July "+t[0]+" to 30 September "+t[0];case"4":return"1 October "+t[0]+" to 31 December "+t[0];default:throw"quarter needs to be 1-4"}}function p(e){var t=e.split("-");switch(t[1]){case"1":return"28 April "+t[0];case"2":return"28 July "+t[0];case"3":return"28 October "+t[0];case"4":return"28 January "+t[0];default:throw"quarter needs to be 1-4"}}function d(e){var t=e.split("-");switch(t[1]){case"1":return"28 May "+t[0];case"2":return"28 August "+t[0];case"3":return"28 November "+t[0];case"4":return"28 February "+t[0];default:throw"quarter needs to be 1-4"}}function v(e){var t=[];for(var n=0;n2)throw"currencyFormatter - more than one decimal in passing in number. Passed input:"+e;var u=Math.abs(o[0]),a=o.length==2?"."+o[1]:"";return n?r?i+u.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1")+a:i+u.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1,")+a:r?i+"$"+u.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1")+a:i+"$"+u.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1,")+a}function y(e,t,n,r){var i;if(e==""||typeof e==null||typeof e=="undefined")e=0;return K(t)||(t=2),K(n)||(n=1),K(r)||(r=!1),r?i=A(e).times(100).round(t,n).toNumber().toFixed(t):i=A(e).times(100).round(t,n).toString(),i+"%"}function b(t){e(document).scrollTop(e(t).offset().top),e(t).focus()}function w(e){var t,n,r;return typeof e!="undefined"&&typeof e.date!="undefined"&&(n=lt(e.date)),typeof n!="undefined"?r=parseInt(T(n,"yyyy")):r=parseInt(x("yyyy")),r-=1,t="01/07/"+r,t}function E(e){var t,n;return typeof e!="undefined"?typeof e.year!="undefined"?n=parseInt(e.year):n=parseInt(T(j(),"yyyy")):n=parseInt(T(j(),"yyyy")),t="30/06/"+n,t}function S(e){var t,n,r;return typeof e!="undefined"&&typeof e.date!="undefined"&&(n=lt(e.date)),typeof n!="undefined"?r=parseInt(T(n,"yyyy")):r=parseInt(x("yyyy")),t="30/06/"+r,t}function x(e){var n=t(),r;if(n.month()<6)e=="yyyy"||typeof e=="undefined"?r=Number(n.year()):e=="yyyy - yyyy"?r=Number(n.year())-1+"-"+n.format("YYYY"):e=="yyyy - yy"&&(r=Number(n.year())-1+"-"+n.format("YY"));else{if(e=="yyyy"||typeof e=="undefined")return Number(n.year())+1;if(e=="yyyy - yyyy")return n.year()+"-"+(Number(n.format("YYYY"))+1);if(e=="yyyy - yy")return n.year()+"-"+(Number(n.format("YY"))+1)}return r}function T(e,t){var n;if(e.month()<6)t=="yyyy"||typeof t=="undefined"?n=Number(e.year()):t=="yyyy - yyyy"?n=Number(e.year())-1+"-"+e.format("YYYY"):t=="yyyy - yy"&&(n=Number(e.year())-1+"-"+e.format("YY"));else{if(t=="yyyy"||typeof t=="undefined")return Number(e.year())+1;if(t=="yyyy - yyyy")return e.year()+"-"+(Number(e.format("YYYY"))+1);if(t=="yyyy - yy")return e.year()+"-"+(Number(e.format("YY"))+1)}return n}function N(e,n){var r=t(e.toString()+"-06-30");if(typeof n=="undefined"||n=="yyyy - yy")return r.year()-1+"-"+r.format("YY");if(n=="yyyy - yyyy")return r.year()-1+" - "+r.year();if(n=="yyyy-yyyy")return r.year()-1+"-"+r.year()}function C(e,t){return t=="undefined"?e-1:e-t}function k(e){return e=e.toUpperCase(),e=="YES"?"Yes":e=="NO"?"No":""}function L(e){var t=i.defer(),n=Array.isArray(e)?e:[e];return require(n,function(e){var n=Array.prototype.slice.call(arguments);n.length==1?t.resolve(e):t.resolve(n)}),t.promise}function A(e){try{var t;return e==""||typeof e=="undefined"||e===null?t=new r(0):(e=s.removeThousandSeperator(e),t=new r(e)),t}catch(n){o.logError("error in createBigNumber","createBigNumber",{error:n});return}}function O(e,t,n){var r=i.defer();n||(n=50);var s={timesChecked:0},o=setInterval(function(t){var n=document.getElementById(e);n!==null&&r.resolve(n),typeof e=="undefined"&&r.resolve()}.bind(this,s),n);return i.when(r.promise,function(e){clearInterval(o)}),r.promise}function M(e,n,r){arguments.length==1&&typeof e=="object";var i=[];e=parseInt(e),t(e.toString(),"YYYY").isValid()||(e=x("yyyy"));if(typeof e=="number"){typeof r=="undefined"?r=e-n+1:e=r))break;i.push({key:o,value:N(o)})}}return i}function _(e){var n=parseInt(e);return t([n]).isLeapYear()?366:365}function D(e,n){var r=["D/MM/YYYY","DD/MM/YYYY"];e=t(e,r),n=t(n,r);var i=e.format("D"),s=n.format("D"),o=e.format("M"),u=n.format("M"),a=0,f=0,l=0;i<29&&o<3?f=Number(e.format("YYYY")):f=Number(e.format("YYYY"))+1,s<29&&u<3?(l=Number(n.format("YYYY")),-1):l=Number(n.format("YYYY"));if(f>l)return a;var c=f;for(c;c<=l;c++)t([c]).isLeapYear()&&a++;return a}function P(e,t){var n=e.toString().split(".",2),r=e.toString();return n.length>1?n[1].length>t?r=n[0]+"."+n[1].substring(0,t):r=e.toFixed(t).toString():r=e.toFixed(t).toString(),r}function H(e,n,r,i){typeof r=="undefined"&&(r="days"),typeof i=="undefined"&&(i=!1);var s=0,o=["D/MM/YYYY","DD/MM/YYYY"];return e=t(e,o),n=t(n,o),r=="days"||r=="d"?s=n.diff(e,r)+1:s=n.diff(e,r,i),s}function B(e){return e!=undefined&&!isNaN(e)?e.toString().split(".").length>1?e.toString().split(".")[1].length||0:0:0}function j(){var e=["D/MM/YYYY","DD/MM/YYYY"],n;tt()&&(n=localStorage.getItem("systemDate"));var r;return n===null||n==""?r=t().startOf("day"):r=t(n,e),r}function F(){return t()}function I(e){try{window.location.href="https://www.ato.gov.au/"+e}catch(t){throw"redirectToWrapperPage: "+t}}function q(e){try{if(!e)throw"parameters not provided";if(!e.object)throw"items not provided in parameters";if(!e.properties)throw"properties not provided in parameters";var t=!0;return Object.keys(e.object).forEach(function(n){var r=e.properties.filter(function(e){return e==n});if(r.length==0)throw t=!1,"verifyObjectProperties - provided input "+n+" not found";return!0}),t}catch(n){throw"verifyObjectProperties: "+n}}function R(e,t){try{if(!e||!Array.isArray(e))throw"Check parameter contract value";if(!t)throw"Check parameter inputs value";var n=!1;return e.forEach(function(e){var r=Object.keys(t).some(function(t){return t===e.field});if(!r)throw n=!1,"contract field "+e.field+" not found in inputs";if(e.mandatory&&s.isBlank(t[e.field]))throw n=!1,"contract field "+e.field+" is mandatory but supplied blank";if(!s.isBlank(e.type)&&!s.isBlank(t[e.field])){switch(e.type){case"integer":n=s.isValidInteger(t[e.field],!0,!0);break;case"decimal":n=s.isValidDecimal(t[e.field]);break;case"alphanumeric":n=s.isAlphaNumeric(t[e.field]);break;case"array":n=Array.isArray(t[e.field]);break;case"date":n=s.isValidDate(t[e.field]);break;default:n=!0}if(!n)throw"contract field "+e.field+" with value "+t[e.field]+" is not a valid "+e.type}else n=!0}),n}catch(r){throw"verifyCalculationInputs: "+r}}function U(e,t){function r(e,t){var n=e.indexOf("{"),r=e.indexOf("}");return(n<0||r<0)&&o.log("start or end not found"),e=e.replace(e.substring(n,r+1),t),e}if(Array.isArray(t)){for(var n=0;n"+t+":"+e+'"+r+"":t==u.pill.danger?s=""+t+":"+e+'"+r+"":t==u.pill.success?s=""+t+":"+e+'"+r+"":t==u.pill.info&&(s=""+t+":"+e+'"+r+""),s}function Y(){return navigator.userAgent.indexOf("Mac")>-1}function Z(){return navigator.userAgent.indexOf("Win")>-1}function et(){return navigator.userAgent.match(/(iPhone|iPod|iPad)/i)?!0:!1}function tt(){try{return window.localStorage.setItem("storageWorks",!0),window.localStorage.removeItem("storageWorks"),!0}catch(e){return!1}}function nt(e,t){if(typeof e!="undefined"&&e.length>0){var n=e.filter(function(e){if(e.severity==t)return e});if(n.length>0)return n[0].message}return""}function rt(e){}function it(e){var t={object:"object",array:"array"},n=e.array,r=e.groupingKey,i=typeof e.mode=="undefined"?t.object:e.mode,s={};n.forEach(function(t){var n=t[e.groupingKey];s[n]||(s[n]=[]),s[n].push(t)});if(i===t.array){var o=[];return Object.keys(s).forEach(function(e){o.push(s[e])}),o}return s}function st(e){}function ot(e){if(!Array.isArray(e.array))throw'sortByKey - expected "array" property on options to be array';if(!Array.isArray(e.sortingKeys))throw'sortByKey - expected "sortingKeys" property on options to be array';var t=e.array,n=e.sortingKeys,r=e.sortingProp,i=t.sort(function(e,t){if(typeof r!="undefined")var i=n.indexOf(e[r]);else var i=n.indexOf(e);if(i<0)throw"sortByKey - expected property to exist in sortinKeys array, property value: "+e[r];if(typeof r!="undefined")var s=n.indexOf(t[r]);else var s=n.indexOf(t);if(i<0)throw"sortByKey - expected property to exist in sortinKeys array, property value: "+t[r];return i-s});return i}function ut(e){return e.substr(0,1).toUpperCase()+e.substr(1)}function at(e){return e.textStatus=="timeout"?i.reject(new exceptionViewModel({code:"EM0100",message:"Request timed out",exception:e})):i.reject(new exceptionViewModel({code:"EM0101",message:"Request failed",exception:e}))}function ft(e,r,i){var s=["D/MM/YYYY","DD/MM/YYYY"];return function(o,u){var o=n.unwrap(o[e]),u=n.unwrap(u[e]);switch(r){case"integer":o=parseInt(o),u=parseInt(u);break;case"string":break;case"date":o=t(o,s),u=t(u,s)}return i=="asc"||typeof i=="undefined"?ou?1:0:o>u?-1:o-1&&(i=a.diff(u,"years"),u.add(i,"years")),n.indexOf("m")>-1&&(s=a.diff(u,"months"),u.add(s,"months")),n.indexOf("d")>-1&&(o=a.diff(u,"days")),{years:i,months:s,days:o}}function pt(e){typeof e!="undefined"&&e&&r.config({DECIMAL_PLACES:5,ROUNDING_MODE:r.ROUND_DOWN})}function dt(){var e=null;return tt()&&(e=localStorage.getItem("readOnly")),e===null?"":e==="true"}function vt(e){var t,n="01/04/",r="31/03/";typeof e=="undefined"&&(e=j());if(e.length===4||typeof e=="number")e=r+e;e=lt(e);if(e.isValid()){var i=parseInt(e.format("YYYY")),s=parseInt(e.format("MM")),o,u;s<=3&&(i-=1),o=f.toMoment(n+i).format("DD/MM/YYYY"),u=f.toMoment(r+(i+1)).format("DD/MM/YYYY"),t={FBTStartDate:o,FBTEndDate:u}}return t}function mt(e,t){var n,r=vt(e),i=lt(r.FBTStartDate),s=lt(r.FBTEndDate);return t=="yyyy"||typeof t=="undefined"?n=s.format("YYYY"):t=="yyyy - yyyy"?n=i.format("YYYY")+"-"+s.format("YYYY"):t=="yyyy - yy"&&(n=i.format("YYYY")+"-"+s.format("YY")),n}function gt(e,t,n){return t&&e!==undefined?(a.showPleaseWait(e),n!==undefined?!0:!1):t&&!a.isShowingPleaseWait?a.showPleaseWait(!1):!t&&a.isShowingPleaseWait?a.hidePleaseWait():!1}function yt(t,n,r){var s=i.defer(),o=function(){return r()};if(typeof n=="function"){var u=n;o=function(){return u()},n=!0}return gt(t,n,r)?window.setTimeout(function(){s.resolve(o())},n?e.blockUI.defaults.fadeIn:e.blockUI.defaults.fadeOut):s.resolve(o()),s.promise}function bt(e,t,n){if(t){var r=function(t){if(t===!0)return;typeof t=="object"&&t.then?t.then(r):gt(e,!1)};return yt(e,function(){return n()}).then(r)}return n()}function wt(){return a.hidePleaseWait()}function Et(e,t){return typeof e=="function"?e:n.observable(e!==undefined?e:t)}function St(e){var t=null;return tt()&&(t=localStorage.getItem(e)),t===null?"":t}function xt(e,t){tt()&&window.localStorage.setItem(e,t)}function Tt(e){tt()&&window.localStorage.removeItem(e)}function Nt(e){return["-private"].timeOverwrite!==undefined?["-private"].timeOverwrite:e?window.ServerTimeFull:window.ServerTime}function Ct(){return t(Nt(),u.defaultDateFormat)}function kt(e,t){return!!ko.utils.arrayFirst(e,function(e){return t.indexOf(e)>=0})}function Lt(){return window.ato!==undefined&&window.ato.tac!==undefined&&window.ato.tac.cdn===!0}function At(){window.ato=window.ato||{},window.ato.tac={},window.ato.tac.cdn=!0}function Ot(){window.ato=window.ato||{},window.ato.tac=undefined}function Mt(e,t,n){return n.indexOf(e)===t}function _t(e){var t=[];if(e.listOfYears!==undefined&&e.minimumYear!==undefined&&e.maximumYear!==undefined&&typeof e.listOfYears=="object"&&typeof e.minimumYear=="number"&&typeof e.maximumYear=="number")for(var n=0;n<=e.listOfYears.length;n++)e.listOfYears[n]<=e.maximumYear&&e.listOfYears[n]>=e.minimumYear&&t.push({key:e.listOfYears[n],value:N(e.listOfYears[n])});return t}var f={formatQuarter:h,formatQuarters:v,formatCutOffDate:p,formatDueDate:d,thousandSeperator:m,currencyFormatter:g,percentageFormatter:y,labelScroll:b,finYearStartDate:w,getFinYearEndDateByYear:E,finYearEndDate:S,currentFinYear:x,formatFinYear:N,formatEarlierFinYear:C,cancelNavWhenModalActive:c,dateFormats:["D/MM/YYYY","DD/MM/YYYY"],formatYesNo:k,requirePromise:L,createBigNumber:A,detectInsertDom:O,getFinancialYears:M,daysInYear:_,truncateCurrency:P,countDecimals:B,getCurrentDate:j,getCurrentFinYear:T,getLeapYearcount:D,differenceBetweenTwoDates:H,redirectToWrapperPage:I,verifyObjectProperties:q,stringFormat:U,getParameterByName:z,getCalculatedDate:W,addTimePeriod:X,getMonthName:V,isDefined:K,getMode:Q,pillFormatter:G,filterQueryStringBuilder:J,isMacintosh:Y,isWindows:Z,isIOSDevice:et,supportsLocalStorage:tt,getProcessMessage:nt,defaultPromiseRejectionHandler:at,sum:$,groupByKey:it,sortByKey:ot,firstLetterCapital:ut,array:rt,sortObject:ft,toMoment:lt,dateObjectToMoment:ct,durationBetweenTwoDates:ht,setIntegratedTool:pt,getReadOnly:dt,getFBTDates:vt,getFBTYear:mt,pleaseWait:gt,pleaseWaitFor:bt,pleaseWaitThen:yt,hidePleaseWait:wt,observableFromParam:Et,getDataFromLocalStorage:St,setDataInLocalStorage:xt,removeDataFromLocalStorage:Tt,getCurrentMoment:Ct,hasIntersection:kt,verifyCalculationInputs:R,"-private":{timeOverwrite:undefined},cdnEnabled:Lt,enableCDN:At,disableCDN:Ot,removeDuplicates:Mt,getFinancialYearsAvailable:_t,getCurrentTimestamp:F},l=!1;return f}),define("shared/services/exceptionViewModel",["jquery","./constants"],function(e,t){"use strict";var n=function(e){this.code=undefined,this.message=undefined,this.exception=undefined,e&&typeof e=="object"&&this.mapTo(e)};return n.prototype.mapTo=function(e){var t=this;e.code!==undefined&&(this.code=e.code),e.message!==undefined&&(this.message=e.message),e.exception!==undefined&&(this.exception=e.exception)},n}),define("shared/services/BaseInterfaceEventHandler",["durandal/app","q","module","shared/services/exceptionViewModel"],function(e,t,n,r){function o(){var t=this,n=t.appInterface.app.name;e.on(n+":error",function(e){switch(e.code){case"EM0112":t.handleSave(e);break;case"EM0118":t.handleSave(e);break;case"EM0111":t.handleConcurrency(e)}}),e.on(n+":autoSave",function(e){t.appInterface.app.methods.localSave()})}function u(){var t=this,n=t.appInterface.app.name;e.on(n+":"+t.appInterface.constants.events.calculatorSaveAndExit,function(r){t.appInterface.app.methods.save().then(function(r){e.trigger(n+":"+t.appInterface.constants.events.calculatorSaveAndExitSuccess)}).done()})}function a(t){var n=this,r={heading:"Save",message:"Your tool data could not be saved due to a recent update. Please close the tool and start again.",buttons:[{text:"Cancel",fn:function(){e.trigger(n.errorModalEvent+":modal:close")},buttonType:"secondary"}]};e.trigger(n.errorModalEvent+":modal:open",r)}function f(t){var n=this,r=n.appInterface.getHost().localStorageAvailable();if(t.saveAction==n.appInterface.constants.saveActions.transfer)var s=r?i.messages.localTransfer:i.messages.noLocalTransfer;else var s=r?i.messages.localSave:i.messages.noLocalSave;var o={text:"Cancel",fn:function(){e.trigger(n.errorModalEvent+":modal:close"),e.trigger(n.errorModalEvent+":"+i.events.calculatorSaveFail,n.appInterface.app.private.getException("EM0115"))},buttonType:"secondary"},u={text:"Continue",fn:function(){n.appInterface.app.methods.localSave().then(function(t){e.trigger(n.errorModalEvent+":save:handledSuccess",t),e.trigger(n.errorModalEvent+":modal:close")},function(){n.showFailModal.call(n,t)}).done()},buttonType:"secondary"},a={text:"Try again",fn:function(){var s=r?2:1,o=e.on(n.errorModalEvent+":modal:updateButton:success").then(function(){var r=n.appInterface.app.methods.saveNoUi||n.appInterface.app.methods.save;r.call(n.appInterface.app.methods).then(function(t){e.trigger(n.errorModalEvent+":"+i.events.calculatorSaveSuccess,t),e.trigger(n.errorModalEvent+":modal:close")},function(e){t.code!=="EM0115"&&n.showFailModal.call(n,t)}).done(),o.off()});e.trigger(n.errorModalEvent+":modal:updateButton",{index:s,disabled:!0,text:"Processing"})},buttonType:"primary"};if(r)var f=[u,o,a];else var f=[o,a];var l={heading:"Save",message:s,buttons:f};e.trigger(n.errorModalEvent+":modal:open",l)}function l(t){var n=this,r=t.saveAction==n.appInterface.constants.saveActions.transfer;if(r)var s=i.messages.failTransfer;else var s=i.messages.failSave;var o={heading:"Save",message:s,buttons:[{text:"Exit",fn:function(){e.trigger(n.errorModalEvent+":modal:close"),e.trigger(n.errorModalEvent+":"+i.events.calculatorSaveFail,n.appInterface.app.private.getException("EM0107"))},buttonType:"secondary"},{text:"Back",fn:function(){e.trigger(n.errorModalEvent+":modal:close"),e.trigger(n.errorModalEvent+":"+i.events.calculatorSaveFail,n.appInterface.app.private.getException("EM0115"))},buttonType:"primary"}]};e.trigger(n.errorModalEvent+":modal:open",o)}var i={events:{calculatorSaveSuccess:"save:handledSuccess",calculatorSaveFail:"save:handledFail"},messages:{localSave:"There was a problem with your connection and we were unable to save your tool data. Try again, or select Continue to save a copy on this device.",noLocalSave:"There was a problem with your connection and we were unable to save your tool data. Try again, or select Cancel to return to the tool.",failSave:"Your tool data was unable to be saved. Select Back to return to the tool. Selecting Exit may result in some data being lost.",localTransfer:"There was a problem with your connection and we were unable to transfer your tool data. Try again, or select Continue to save a copy on this device.",noLocalTransfer:"There was a problem with your connection and we were unable to transfer your tool data. Try again, or select Cancel to return to the tool.",failTransfer:"Your tool data was unable to be transferred. Select Back to return to the tool. Selecting Exit may result in some data being lost."}},s=function(e){var t=this;t.appInterface=e,t.errorModalEvent=t.appInterface.app.name+"-error",t.hasTriedAgain=!1,this.initializeErrorEvents(),this.initializeSaveAndExit()};return s.prototype.handleConcurrency=a,s.prototype.handleSave=f,s.prototype.showFailModal=l,s.prototype.initializeErrorEvents=o,s.prototype.initializeSaveAndExit=u,s}),define("shared/services/formService",[],function(){"use strict";function e(e,t,n){n=n||!0;var r={FormTypeCode:t.formTypeCode};return e.listAllYears(r,n)}return{listAllYears:e}}),define("shared/services/BaseInterface",["durandal/app","q","shared/services/logger","shared/services/constants","shared/services/loader","shared/services/common","shared/services/exceptionViewModel","shared/services/BaseInterfaceEventHandler","moment","shared/services/formService","knockout","shared/services/validator"],function(e,t,n,r,i,s,o,u,a,f,l,c){"use strict";function d(n){function L(){try{var e=window.ATOSessionManager.data.DisplayFamilyName+window.ATOSessionManager.data.DisplayGivenName;return e+h.client.clientIdentifierValueId}catch(t){throw t}}function A(e,t){if(!h.localStorageAvailable())return!1;try{var n=JSON.stringify(t);if(typeof sjcl!="undefined")var n=sjcl.encrypt(L(),n);return w.saveQuestionsToStorage(h.client.toKey(),n),e.app.localStorageFallback=!0,k.log("tool interface - write to local storage successful"),!0}catch(r){return k.log("tool interface - write to local storage failed - exception"+r),!1}}function O(e){var t;if(!h.localStorageAvailable())return null;try{t=w.loadQuestionsFromStorage(h.client.toKey()),typeof sjcl!="undefined"&&(t=sjcl.decrypt(L(),t));if(t!=null)return e.app.localStorageFallback=!0,JSON.parse(t)}catch(n){return null}return null}function M(){if(h.localStorageAvailable())return localStorage.removeItem(E.datacontext.namespace+"_"+h.client.toKey()),!0}function _(e){return p.app.methods.raiseEvent("error",e),t.reject(e)}function D(e){var t=require("framework/AtoFramework"),n=require("services/Forms/v1/FormClient"),r=f.listAllYears(n,e).then(function(t){if(!t)throw new Error("service call formService.listAllYears did not return response");return v(t.processMessages)?P(t.forms,e.yearsToCheck):(k.log("service call formService.listAllYears wasServiceRequestSuccessful false"),[])}).fail(t.ErrorHandler.handlePromiseRejection("formService.ListAllYears"));return r}function P(e,t){var n=this,r=[],i={date:s.getCurrentDate()};isNaN(t)&&(t=-5);var o=s.addTimePeriod(s.finYearStartDate(i),"y",t),u=l.utils.arrayFilter(e,function(e){if(c.compareDateAsMoment(s.dateObjectToMoment(e.formPeriodEndDate),"greaterThanOrEqualTo",o)&&e.formStatusCode==="110"||e.formStatusCode==="111"){var t=s.dateObjectToMoment(e.formPeriodEndDate).year();r.indexOf(t)===-1&&r.push(t)}});return r}var p=this,d,m,w,E,S,x,T,N,C=k,k=Object.create(require("shared/services/logger"));k.realLog=k.log,k.log=function(e){this.realLog(d+":"+e)};if(typeof n!="undefined"){if(typeof n.appConfig=="undefined")throw"appConfig object not passed into BaseInterface constructor.";if(typeof n.datacontext=="undefined")throw"datacontext object not passed into BaseInterface constructor.";if(typeof n.ruleEngine=="undefined")throw"ruleEngine object not passed into BaseInterface constructor.";if(typeof n.appConfig.appName=="undefined")throw"appConfig object does not contain the appName property.";if(typeof n.appConfig.appTitle=="undefined")throw"appConfig object does not contain the appTitle property.";d=n.appConfig.appName,m=n.appConfig.appTitle,x=typeof n.appConfig.schemaVersionIdentifier=="undefined"?1:n.appConfig.schemaVersionIdentifier,w=n.datacontext,E=n.appConfig,S=n.ruleEngine,i.setAppConfig(E),w.calculatorItemsLoaded||i.loadCalculatorItems(w)}this.getHost=function(){return h},typeof h.services.atoFramework=="undefined"&&typeof e.HostInterface!="undefined"&&(h.services.atoFramework=e.HostInterface.AtoFramework),typeof h.services.toolDataServiceClient=="undefined"&&typeof e.HostInterface!="undefined"&&(h.services.toolDataServiceClient=e.HostInterface.ToolDataServiceClient),typeof h.services.eTaxDepreciationServiceClient=="undefined"&&typeof e.HostInterface!="undefined"&&(h.services.eTaxDepreciationServiceClient=e.HostInterface.eTaxDepreciationServiceClient),typeof h.services.FormClient=="undefined"&&typeof e.HostInterface!="undefined"&&(h.services.formClient=e.HostInterface.FormClient),typeof h.services.FormBusinessDataClient=="undefined"&&typeof e.HostInterface!="undefined"&&(h.services.formBusinessDataClient=e.HostInterface.FormBusinessDataClient),p.backendServicesAvailable=function(e){var t=!1;if(typeof e=="undefined")throw"no serviceClients specified.";if(!Array.isArray(e))throw"serviceClients is not an array.";return h.initialised&&e.forEach(function(e){if(typeof h.services[e]=="undefined")return t=!1,!1;t=!0}),t},this.constants={events:{initialised:"calculatorinitialised",usage:"usage",error:"error",calculatorCancel:"calculatorcancel",calculatorSave:"calculatorsave",calculatorTogglePageHelp:"togglePageHelp",calculatorOpenPageHelp:"openPageHelp",calculatorClosePageHelp:"closePageHelp",calculatorSaveSuccess:"save:handledSuccess",calculatorSaveFail:"save:handledFail",calculatorSaveAndExit:"saveAndExit",calculatorSaveAndExitSuccess:"saveAndExit:success"},carpLevels:{client:"Client",account:"Account",role:"Role",period:"Period"},saveActions:{transfer:"transfer",save:"save"}},this.app={persistenceLevel:p.constants.carpLevels.period,name:d,title:m,schemaVersionIdentifier:x,readOnly:ko.observable(!1),dataObjectId:0,lastUpdatedDate:null,localStorageFallback:!1,methods:{getTaxReturnData:function(){p.app.private.getTaxReturnData()},getData:function(){return t.fcall(function(){return p.app.private.getData()})},setData:function(e){return typeof e!="undefined"&&Object.keys(e).length>0?t.fcall(function(){return p.app.private.setData(e)}):t.fcall(function(){return!0})},serviceFacade:{setSnapshot:function(e){if(!h.initialised)return k.log("setSnapshot - failed to take a snapshot"),_(y("EM0103"));if(h.initialised&&!p.backendServicesAvailable(["toolDataServiceClient"]))return k.log("setSnapshot - failed to take a snapshot"),_(y("EM0104"));var n={clientIdentifierTypeCode:h.client.clientIdentifierTypeCode,clientIdentifierValueId:h.client.clientIdentifierValueId,clientAccountId:h.client.clientAccountId,roleTypeCode:h.client.roleTypeCode,periodStartDate:h.client.periodStartDate,toolSourceCode:p.app.name,recordStatusCode:"snapshot",toolCategoryCode:"CAT",schemaVersionIdentifier:p.app.schemaVersionIdentifier};return h.services.toolDataServiceClient.createToolDataForPeriod(n,e,null,null,!0).then(function(e){return k.log("setSnapshot - successful: { "+e.dataObjectIdentifier+" }"),t.resolve(e.dataObjectIdentifier)},function(e){return k.log("setSnapshot - failed to take a snapshot"),g.call(this,e)})},getSnapshot:function(e){if(!h.initialised)return k.log("setSnapshot - failed to take a snapshot"),_(y("EM0103"));if(h.initialised&&!p.backendServicesAvailable(["toolDataServiceClient"]))return k.log("setSnapshot - failed to take a snapshot"),_(y("EM0104"));if(typeof e=="undefined")return _(y("EM0105"));var n={dataObjectIdentifier:e,clientIdentifierTypeCode:h.client.clientIdentifierTypeCode,clientIdentifierValueId:h.client.clientIdentifierValueId,clientAccountId:h.client.clientAccountId,roleTypeCode:h.client.roleTypeCode,periodStartDate:h.client.periodStartDate,toolSourceCode:p.app.name,recordStatusCode:"snapshot",toolCategoryCode:"CAT",schemaVersionIdentifier:p.app.schemaVersionIdentifier};return h.services.toolDataServiceClient.getToolDataForPeriod(n,!0).then(function(e){return k.log("getSnapshot - successful {"+e.dataObjectBinary+"}"),t.resolve(e.dataObjectBinary)}).catch(function(e){return k.log("getSnapshot - successful"),g.call(this,e)})},setToolData:function(e,n){if(!h.initialised)return k.log("setSnapshot - failed to take a snapshot"),_(y("EM0103"));if(h.initialised&&!p.backendServicesAvailable(["toolDataServiceClient"]))return k.log("setSnapshot - failed to take a snapshot"),_(y("EM0104"));if(typeof n=="undefined")return _(y("EM0105"));if(typeof e=="undefined")return _(y("EM0106"));try{if(n==0||typeof n=="undefined"){var r={clientIdentifierTypeCode:h.client.clientIdentifierTypeCode,clientIdentifierValueId:h.client.clientIdentifierValueId,clientAccountId:h.client.clientAccountId,roleTypeCode:h.client.roleTypeCode,periodStartDate:h.client.periodStartDate,toolSourceCode:p.app.name,recordStatusCode:"saved",toolCategoryCode:"CAT",schemaVersionIdentifier:p.app.schemaVersionIdentifier};return h.services.toolDataServiceClient["createToolDataFor"+p.app.persistenceLevel](r,e,null,null,!0).then(function(e){return k.log("createToolData - remote create successful. dataObjectId: {"+e.dataObjectIdentifier+"}"),typeof e.lastUpdatedDate!="undefined"&&(p.app.lastUpdatedDate=e.lastUpdatedDate),t.resolve(e.dataObjectIdentifier)}).catch(function(e){return k.log("The createToolData service call failed."),s.isDefined(e,"data.processMessages")?Array.isArray(e.data.processMessages)&&e.data.processMessages.forEach(function(e){k.log(e)}):s.isDefined(e,"exception")&&k.log(e.exception),t.reject(y("EM0118",e))})}var r={dataObjectIdentifier:n,clientIdentifierTypeCode:h.client.clientIdentifierTypeCode,clientIdentifierValueId:h.client.clientIdentifierValueId,clientAccountId:h.client.clientAccountId,roleTypeCode:h.client.roleTypeCode,periodStartDate:h.client.periodStartDate,toolSourceCode:p.app.name,recordStatusCode:"saved",toolCategoryCode:"CAT",schemaVersionIdentifier:p.app.schemaVersionIdentifier,lastUpdatedDate:p.app.lastUpdatedDate};return h.services.toolDataServiceClient.updateToolData(r,e,!0).then(function(e){return k.log("updateToolData - remote update successful. dataObjectId: "+e.dataObjectIdentifier),typeof e.lastUpdatedDate!="undefined"&&(p.app.lastUpdatedDate=e.lastUpdatedDate),t.resolve(e.dataObjectIdentifier)}).catch(function(e){k.log("The update tool data service call failed.");if(s.isDefined(e,"data.processMessages")){var n=e.data.processMessages.some(function(e){return e.id=="6"});if(n)return M(),_(y("EM0111",e));Array.isArray(e.data.processMessages)&&e.data.processMessages.forEach(function(e){k.log(e)})}else s.isDefined(e,"exception")&&k.log(e.exception);return t.reject(y("EM0112",e))})}catch(i){return _(y("EM0107",response.exception))}},getToolData:function(e){if(!h.initialised)return k.log("setSnapshot - failed to take a snapshot"),_(y("EM0103"));if(h.initialised&&!p.backendServicesAvailable(["toolDataServiceClient"]))return k.log("setSnapshot - failed to take a snapshot"),_(y("EM0104"));if(typeof e=="undefined")return _(y("EM0105"));try{var n={clientIdentifierTypeCode:h.client.clientIdentifierTypeCode,clientIdentifierValueId:h.client.clientIdentifierValueId,clientAccountId:h.client.clientAccountId,roleTypeCode:h.client.roleTypeCode,periodStartDate:h.client.periodStartDate,dataObjectIdentifier:e,toolSourceCode:p.app.name,toolCategoryCode:"CAT",recordStatusCode:"saved"};return t.fcall(function(){return e==0?t.reject("get tool data - data object id is from local storage"):h.services.toolDataServiceClient["getToolDataFor"+p.app.persistenceLevel](n,!0)}).then(function(e){return k.log("getToolData - successful: {"+e.dataObjectBinary+" }"),typeof e.lastUpdatedDate!="undefined"&&(p.app.lastUpdatedDate=e.lastUpdatedDate),p.app.private.lastGetData=e,t.resolve({data:e.dataObjectBinary,isLocalStorage:!1,lastUpdatedDate:e.lastUpdatedDate,response:e})}).catch(function(n){e!==0&&k.log("get tool data - service call failed, attempting local resume"),s.isDefined(n,"data.processMessages")&&s.getProcessMessage(n.data.processMessages,"1")&&k.log("The getToolData service call failed. "+s.getProcessMessage(n.data.processMessages,"1"));var r=O(p);return r===null?t.reject(y("EM0108",n)):t.resolve({data:r,isLocalStorage:!0})})}catch(r){return k.log(r),t.reject(y("EM0108",r))}},deleteToolData:function(e){if(!h.initialised)return _(new o({code:r.errorCodes.fatal,message:"host not initialised."}));if(h.initialised&&!p.backendServicesAvailable(["toolDataServiceClient"]))return _(new o({code:r.errorCodes.fatal,message:"backend services and framework modules unavailable"}));if(!e.dataObjectId)var n=p.app.dataObjectId;else var n=e.dataObjectId;var i=p.app.lastUpdatedDate,s=!0;try{M()}catch(u){s=!1}return t.fcall(function(){return n!==0?n:p.app.methods.serviceFacade.list()}).then(function(e){Array.isArray(e)&&e.length>0&&(n=e[0].dataObjectIdentifier,i=e[0].lastUpdatedDate);var t=!1;n>0&&(t=!0);if(t){var r={dataObjectIdentifier:n,clientIdentifierTypeCode:h.client.clientIdentifierTypeCode,clientIdentifierValueId:h.client.clientIdentifierValueId,clientAccountId:h.client.clientAccountId,roleTypeCode:h.client.roleTypeCode,periodStartDate:h.client.periodStartDate,toolSourceCode:p.app.name,lastUpdatedDate:i};return h.services.toolDataServiceClient.deleteToolData(r,!0)}return 0}).then(function(e){return k.log("deleteToolData - successful. dataObjectId: "+e.dataObjectIdentifier),p.app.dataObjectId=0,p.app.lastUpdatedDate=null,t.resolve(e.dataObjectIdentifier)}).catch(function(e){return s?t.reject(y("EM0116",e)):t.reject(y("EM0117",e))})},list:function(){if(!h.initialised)return _(new o({code:r.errorCodes.fatal,message:"host not initialised."}));if(h.initialised&&!p.backendServicesAvailable(["toolDataServiceClient"]))return _(new o({code:r.errorCodes.fatal,message:"backend services and framework modules unavailable"}));try{var e={clientIdentifierTypeCode:h.client.clientIdentifierTypeCode,clientIdentifierValueId:h.client.clientIdentifierValueId,clientAccountId:h.client.clientAccountId,roleTypeCode:h.client.roleTypeCode,periodStartDate:h.client.periodStartDate,toolSourceCode:p.app.name,recordStatusCode:"saved",toolCategoryCode:"CAT"};return h.services.toolDataServiceClient["listToolDataFor"+p.app.persistenceLevel](e,!0).then(function(e){return k.log("The listToolData service call successful"),t.resolve(e.listOfDataRecords)}).catch(function(e){k.log("listToolData service call failed");if(s.isDefined(e,"data.processMessages")){var n=e.data.processMessages.filter(function(e){return e.id=="50"});if(n.length>0)return k.log("listToolData - "+n[0].message),t.resolve([])}return g.call(this,e)})}catch(n){return t.reject(y("EM0101"),n)}}},saveSnapshot:function(){var e=p.app.private.getData();return this.serviceFacade.setSnapshot(e).then(function(e){return p.app.readOnly(!0),t.resolve(e)},function(e){return k.log("saveSnapshot service call failed"),t.reject(e)})},loadSnapshot:function(e){if(typeof e=="undefined")throw"dataObjectId not specified with the loadSnapshot";return this.serviceFacade.getSnapshot(e).then(function(n){return p.app.private.setData(JSON.parse(n)),t.resolve(e)},function(e){return k.log("load Snapshot service call failed"),t.reject(e)})},save:function(e){var n=p.app.private.getData(),r=t.defer();return this.serviceFacade.setToolData(n,p.app.dataObjectId).then(function(e){k.log("Save success data object id : "+e),p.app.dataObjectId=e,r.resolve(e)},function(t){p.app.methods.handleSaveFailUi(e,r,t,n)}),r.promise},handleSaveFailUi:function(t,n,r,i){s.isDefined(t,"saveAction")&&(r.saveAction=t.saveAction),p.app.methods.raiseEvent("error",r),s.isDefined(t,"noUi")&&n.reject(r);var o=e.on(p.app.name+"-error:"+p.constants.events.calculatorSaveSuccess).then(function(e){k.log(p.app.name+"-error:"+p.constants.events.calculatorSaveSuccess+" triggered"),n.resolve(e),o.off(),u.off()}),u=e.on(p.app.name+"-error"+":"+p.constants.events.calculatorSaveFail).then(function(r){k.log(p.app.name+"-error:"+p.constants.events.calculatorSaveFail+" triggered"),e.trigger(p.app.name+"-error"+":modal:close"),n.reject(r),s.isDefined(t,"saveAction")&&t.saveAction==p.constants.saveActions.transfer&&r.code=="EM0107"&&p.app.methods.raiseEvent(p.constants.events.calculatorCancel),o.off(),u.off()})},saveNoUi:function(e){k.log("Starting save without UI handling");var n=p.app.private.getData();return this.serviceFacade.setToolData(n,p.app.dataObjectId).then(function(e){return k.log("save: "+e),p.app.dataObjectId=e,t.resolve(e)},function(e){return t.reject(e)})},load:function(){return this.serviceFacade.getToolData(p.app.dataObjectId).then(function(e){var n=JSON.parse(e.data);return p.app.private.setData(JSON.parse(n)),t.resolve(p.app.dataObjectId)},function(e){return p.app.methods.raiseEvent("error",e),t.reject(e)})},resume:function(e){var n=0,i,s,u;try{var s=O(p);return t.fcall(function(){return p.app.dataObjectId>0?[{dataObjectIdentifier:p.app.dataObjectId}]:p.app.methods.serviceFacade.list()}).then(function(e){return e.length>0?(n=e[0].dataObjectIdentifier,p.app.methods.serviceFacade.getToolData(n)):t.resolve({isLocalStorage:!1,data:null})},function(e){return k.log(p.app.name+" - Resume from remote failed - attempting local resume"),p.app.methods.serviceFacade.getToolData(0)}).then(function(e){var r=typeof e.data=="string"?JSON.parse(e.data):e.data,i=e.isLocalStorage,o=null;i||(o=r);if(o==null&&s==null)return p.app.private.datacontext.resetQuestions(),t.resolve(0);if(o==null&&s!=null)return k.log("Resume - only local tool data available - dataObjectId:"+s.dataObjectId),p.app.localStorageFallback=!0,p.app.private.setData(s),p.app.lastUpdatedDate=s.lastUpdatedDate,p.app.dataObjectId=s.dataObjectId,p.app.methods.updateRemote();if(o!=null&&s==null)return k.log("Resume - only remote tool data available"),p.app.private.setData(o),p.app.localStorageFallback=!1,p.app.dataObjectId=n,t.resolve(n);if(o!=null&&s!=null){k.log("Resume - local and remote data available. \r\nLocal last update date:"+s.lastUpdatedDate+"\r\nRemote update date:"+s.lastUpdatedDate);var u=e.lastUpdatedDate;return typeof s.lastUpdatedDate=="undefined"||s.lastUpdatedDat===null||a(o.lastUpdatedDate).isAfter(a(s.lastUpdatedDate))?(k.log("Resume - using to remote storage"),p.app.private.setData(o),p.app.localStorageFallback=!1,p.app.dataObjectId=n,M(),t.resolve(n)):(k.log("Resume - using local storage"),p.app.localStorageFallback=!0,p.app.private.setData(s),p.app.methods.updateRemote())}}).catch(function(e){return e.code=="EM0112"?(k.log(e.message),t.resolve(0)):t.reject(e)})}catch(f){return _(new o({code:r.errorCodes.unknown,message:"resume serviceFacade function failed with an unexpected exception.",exception:f}))}},updateRemote:function(){var e=O(p);return e!==null?this.serviceFacade.setToolData(e,p.app.dataObjectId).then(function(e){p.app.dataObjectId=e,p.app.localStorageFallback=!1;try{M()}catch(n){k.log("Could not delete localStorage: "+n)}return t.resolve(e)}).catch(function(e){return k.log("updateRemote failed"),t.reject(e)}):(k.log("No data within the localStorage - no need to update remote tool data store."),_(y("EM0109")))},localSave:function(){var e=p.app.private.getData();return t.fcall(function(){return A(p,e)?0:_("localSave failed")})},localRead:function(){return t.fcall(function(){return O(p)!==null?(k.log(d+" toolInterface localRead success"),t.resolve(0)):(k.log(d+" toolInterface localRead failed"),_("localSave failed"))})},remove:function(){return this.serviceFacade.deleteToolData({dataObjectId:p.app.dataObjectId,remote:!0}).then(function(e){return t.resolve(e)},function(e){return k.log(d+" toolInterface remove failed"),t.reject(e)})},raiseEvent:function(t,n){var r=!1;Object.keys(p.constants.events).forEach(function(e){if(t==p.constants.events[e]){r=!0;return}});if(!r)throw"BaseInterface does not recognise the event name: "+t;var i=p.app.name+":"+t;k.log("Child SPA sending "+i),e.trigger(i,n)},getMode:b},"private":{getTaxReturnData:function(){var e=this,t={formTypeCode:"90030",yearsToCheck:-5},n=D(t);n.then(function(t){e.clientAssessmentYearList=t}).fail(function(){k.log("BaseInterface - GetTaxReturnData - ProcessServiceCall failed")})},getData:function(){var e=w.getData();return e.lastUpdatedDate=p.app.lastUpdatedDate,e.dataObjectId=p.app.dataObjectId,e},setData:function(e){w.setData(e)},loadSnapshot:function(e){return p.app.methods.serviceFacade.getSnapshot(e)},saveSnapshot:function(e){return p.app.methods.serviceFacade.setSnapshot(e)},save:function(e,t){return p.app.methods.serviceFacade.setToolData(e,t)},datacontext:w,ruleEngine:S,appConfig:E,getException:y,writeToLocalStorage:A,readFromLocalStorage:O,lastGetData:{},navigation:null,displayAmendmentAlert:!1}},this.baseInterfaceEventHandler=new u(this),typeof n!="undefined"&&(this.app.private.datacontext.appInterface=this,this.app.private.ruleEngine.appInterface=this,this.app.private.appConfig.appInterface=this),this.setNavigation=function(t){this.app.private.navigation=t,this.app.private.navigation.appInterface=this},T=this.app.private,N=this.app}function v(e){var t=this;return Array.isArray(e)?!ko.utils.arrayFirst(e,function(e){var n=e.severity?parseInt(e.severity):parseInt(e.Severity);return n===1||t.includeWarningsAsErrors&&n===2}):!1}function m(e){if(typeof e.exception!="undefined")return n.log("setSnapshot - failed to take a snapshot"),t.reject(new o({code:r.errorCodes.fatal,exception:e.exception}));if(s.getProcessMessage(e.processMessages,"1")){var i=s.getProcessMessage(e.processMessages,"1");return t.reject(new o({code:r.errorCodes.fatal,message:i}))}}function g(e){return e.textStatus=="timeout"?t.reject(new o({code:"EM0100",message:"Request timed out",exception:e})):t.reject(new o({code:"EM0101",message:"Request failed",exception:e}))}function y(e,t){var n,r;if(typeof t=="undefined"){var t=new Error;t.stack&&(t=t.stack)}switch(e){case"EM0100":n="Request timed out";break;case"EM0101":n="Request failed";break;case"EM0102":n="Local storage save failed";break;case"EM0103":n="Host not initialized";break;case"EM0104":n="Tool data service client not available";break;case"EM0105":n="dataObjectId not specified",r="F";break;case"EM0106":n="ToolData parameter not specified";break;case"EM0107":n="Cannot update tool data to remote/local storage.";break;case"EM0108":n="Cannot load tool data from remote/local storage.";break;case"EM0109":n="No local storage save found";break;case"EM0110":n="Could not access local storage";break;case"EM0111":n="Invalid concurrency check";break;case"EM0112":n="Update tool data to remote storage failed";break;case"EM0113":n="Update tool data to remote storage success";break;case"EM0114":n="Update tool data to local storage success";break;case"EM0115":n="Save cancelled";break;case"EM0116":n="Delete remote tool data failed";break;case"EM0117":n="Delete remote and local tool data failed";break;case"EM0118":n="Create new tool data record failed";break;case"EM0119":n="Tool set data success";break;default:n="Unexpected code, passed in code : "+e}var t=new o({code:e,message:n,exception:typeof t=="undefined"?{}:t,severity:r});return t}function b(){var t;return typeof e.HostInterface!="undefined"?t=r.mode.authenticated:typeof window.ATOSessionManager!="undefined"&&window.ATOSessionManager.isUnAuthenticated?t=r.mode.standAlone:window.ATOSessionManager?t=r.mode.integrated:t=r.mode.standAlone,t}var h={initialised:!1,config:{hostArea:""},name:"",localStorageAvailable:ko.observable(!0),services:{toolDataServiceClient:undefined,formClient:undefined,formBusinessDataClient:undefined,eTaxDepreciationServiceClient:undefined,atoFramework:undefined,encryptionFramework:undefined},client:{clientIdentifierTypeCode:undefined,clientIdentifierValueId:undefined,clientInternalId:undefined,clientAccountId:undefined,roleTypeCode:undefined,periodStartDate:undefined,toKey:function(){var e=this,t="",n=undefined,r=undefined;return t="Clients/InternalId/"+this.clientInternalId+"/Accounts/"+this.clientAccountId+"/Roles/"+this.roleTypeCode+"/Periods/"+this.periodStartDate,t}}};if(s.isDefined(window,"ATOSessionManager.data.Subject.Identifiers")||s.isDefined(window,"ATOSessionManager.data.Identifiers")){var p={};s.isDefined(window,"ATOSessionManager.data.Subject.Identifiers")?p=window.ATOSessionManager.data.Subject.Identifiers:p=window.ATOSessionManager.data.Identifiers,["ABN","TFN"].some(function(e){if(p[e])return h.client.clientIdentifierValueId=p[e].toString(),e=="TFN"?h.client.clientIdentifierTypeCode="5":e=="ABN"&&(h.client.clientIdentifierTypeCode="10"),!0}),h.client.clientInternalId=p.ClientInternalId}return b()==r.mode.authenticated&&(h.config.hostArea="mytax16"),d.prototype={constructor:d},d}),define("shared/services/BaseRuleEngine",["jquery","bignumber","moment","shared/services/common","knockout","shared/services/logger"],function(e,t,n,r,i,s){function a(e,t,n,r){var o=this;if(e.data.condition!==undefined){var u=new Function("obs","return ko.utils.unwrapObservable(obs) "+e.data.condition);s.log("BaseRuleEngine - buildComputedRule [options.data.condition: "+e.data.condition+"] "+JSON.stringify(e.data));if(e.data.questionKey!==undefined)return i.computed(function(){return u.call({},this.baseRuleEngine.datacontext.getQuestionValue(e.data.questionKey))},{model:t,baseRuleEngine:o});if(e.data.sectionRelevant!==undefined)return i.computed(function(){if(r[e.data.sectionRelevant]===undefined)throw new Error("Invalid Defered Computed. cvm does not contain a section property named "+e.data.sectionRelevant);if(r[e.data.sectionRelevant].relevant===undefined)throw new Error("Invalid Defered Computed. cvm section "+e.data.sectionRelevant+" does not contain a property relevant");return u.call({},r[e.data.sectionRelevant].relevant)},t,{deferEvaluation:!0});throw new Error("Invalid config of ComputedRule. When evaluting a condition, either a questionKey or a sectionRelevant must be provided for retrival of an observable")}if(e.data.rule!==undefined){s.log("BaseRuleEngine - buildComputedRule [Rule: "+e.data.rule+"] "+JSON.stringify(e.data));if(n[e.data.rule]!==undefined){var a={};return e.data.inputs!==undefined&&e.data.inputs.forEach(function(t){try{if(t.source=="question"){var n=Object.create(o.datacontext.getQuestionByKey(t.key));typeof n===undefined&&s.log("failed to locate record "+t.key+", item : "+JSON.stringify(t)),a[t.key]=n,a.inputSource=t.source}else{if(t.source!="viewmodel")throw new Error("Invalid config of ComputedRule: ' + options.data.rule + ' Input '"+t.source+"' does not exist.");a[t.key]=viewmodel[t.key],a.inputSource=t.source}}catch(r){throw"BaseRuleEngine - error creating inputs object for question group. ComputedRule: "+e.data.rule+", Item Key: "+t.key+", Error: "+r}}),i.computed(function(){try{var t=n[e.data.rule](a);return s.log("RUNNING appRuleEngine rule: "+e.data.rule+", Result:"+t),t}catch(r){throw"Exception at appRuleEngine (ruleEngine.js) rule: "+e.data.rule+", exception : "+r}},{deferEvaluation:!0})}throw new Error("Invalid config of ComputedRule. Rule: "+e.data.rule+" not found in rule engine")}throw new Error("Invalid config of ComputedRule. Must contain either condition or rule property")}function f(){if(this.rules!==undefined&&this.rules!==null)return this.rules.getConfig();throw new Error("Invalid BaseRuleEngine.rule object. Please ensure that the App/services/rule.js module exists and is valid.")}function l(e){var t=this,n=t.getConfig().filter(function(t){return t.node===e?!0:!1});return n[0]}function c(e,t){var n=this,r=this.getConfigByNode(e),i={},s=r.actions.filter(function(e){return e.action===t?!0:!1}),o=s[0];return o.rule?(i.type="route",i.value=this[o.rule]()):o.nav?(i.type="nav",i.value=o.nav):o.dest?(i.type="route",i.value=o.dest):console.log("Invalid config. actionNode does not contain rule, nav or dest"),i}function h(e){var t=!1;return this.datacontext.getQuestionGroupByKey(e).relevant()}function p(e){var t=this.datacontext.getQuestionByKey(e).questiongroup.key(),n=this.isSectionRelevant(t);return n}function d(){}var o=["D/MM/YYYY","DD/MM/YYYY"],u=function(e,t){var n=this;n.rules=t,n.datacontext=e,n.dateFormats=o,n.buildComputedRule=a,n.getConfig=f,n.getConfigByNode=l,n.determineDestination=c,n.isSectionRelevant=h,n.isQuestionRelevant=p,n.prepopulation=d};return u}),define("shared/services/CascadingViewModel",["jquery","knockout","shared/services/logger"],function(e,t,n){return function(e,r,i,s){function p(e,t,n,r){o=e,u=t,a=n,f=this,this.screenKey=r,this.nodeConfig={},this.initialize()}var o,u,a,f,l={questions:{create:function(e){return o.getQuestionByKey(e.data)}},isRelevant:{create:function(e){return u.buildComputedRule(e,this,u,f)}}},c=function(e){Array.isArray(e.questions)||n.logError("Cascading view model - expected questions of section to be an array. Value:"+e.questions+", Type: "+typeof e.options,"SectionModel"),ko.mapping.fromJS(e,l,this);for(var r=0;r0&&e[0]==="/"&&(e=e.substr(1,e.length)),t.logInfo("Requesting taxonomy","TaxonomyService.downloadTaxonomy",{taxonomy:e});var n=v(e);if(n&&p(e,n))return t.logInfo("Taxonomy returned from cache","TaxonomyService.downloadTaxonomy",{taxonomy:e}),Q.fcall(function(){var e=new Taxonomy;return e.TaxonomyItems=g(n),e});n=i.fetching[e];if(n)return t.logInfo("Taxonomy already being fetched","TaxonomyService.downloadTaxonomy",{taxonomy:e}),n;var r,s=window.ato.cdnTaxonomyPath,o=s+e.split("/",2).join("_");return r=$.getJSON(o+".json").then(function(n){return t.logInfo("Downloaded static taxonomy file","TaxonomyService",{taxonomy:e}),n}),i.fetching[e]=r,r}function a(e,t){if(!e)throw new Error("getTaxonomyItem called without a taxonomy parameter");if(!t)throw new Error("getTaxonomyItem called without an item parameter");return downloadTaxonomy(e).then(function(n){e.length>0&&e[0]!=="/"&&(e="/"+e);var r=ko.utils.arrayFirst(n.TaxonomyItems,function(n){return(n.TaxonomyPath||"").toLowerCase()===(e+"/"+t).toLowerCase()});return r}).fail(function(n){throw new Error("TaxonomyService.getTaxonomyItem: [Taxonomy]:"+e+" [Item]:"+t)})}function f(e){if(!e)throw new Error("getTaxonomyCollection called without a taxonomy parameter.");return u(e).then(function(e){return e}).fail(function(t){throw new Error("TaxonomyService.getTaxonomyCollection: [Taxonomy]:"+e)})}function l(e){var t=e.toLowerCase().split("/");return t[0]===""&&t.shift(),t}function c(e,t){var n;ko.utils.arrayForEach(t,function(e){n=l(e.TaxonomyPath),h(i.cache,n,e)});var r=v(e);if(r===null)throw new Error("Cant find taxonomy '"+e+"'");return r._Downloaded=!0,r}function h(e,t,n){var r=t.shift();if(t.length===0)e._TaxonomyItems[r]=n;else{var s=e[r];s||(s=e[r]={_Downloaded:!i.useTaxonomyService(),_TaxonomyItems:{}}),h(s,t,n)}}function p(e){var t=l(e);return d(i.cache,t)}function d(e,t){var n=t.shift();return e.hasOwnProperty(n)?e[n]._Downloaded?!0:t.length===0?!1:d(e[n],t):!1}function v(e){var t=l(e);return m(i.cache,t)}function m(e,t){var n=t.shift();return t.length===0?e.hasOwnProperty(n)?e[n]:e._TaxonomyItems&&e._TaxonomyItems.hasOwnProperty(n)?e._TaxonomyItems[n]:null:e.hasOwnProperty(n)?m(e[n],t):null}function g(e){var t=[];return y(t,e),t}function y(e,t){if(t instanceof TaxonomyItem){e.push(t);return}var n;for(n in t._TaxonomyItems){var r=t._TaxonomyItems[n];e.push(r)}for(n in t){var i=t[n];n.charAt(0)!=="_"&&y(e,i)}}function b(){return window.ato&&window.ato.enableTaxonomyService!==undefined&&window.ato.enableTaxonomyService}var t=e("./logger"),n=e("./common"),r=e("./constants"),i={fetching:{},cache:{}},s={downloadTaxonomyFromCdn:u,getTaxonomyCollection:f,getTaxonomyItem:a,getResponseModels:o};return s}),define("shared/services/Navigation",["jquery","moment"],function(e,t){var n=function(e,t,n,r,i){var s=this;s.ruleEngine=t,s.datacontext=n,s.appConfig=r,s.shell=e,s.childRouter=e.router,s.dataRetention=i,s.appDataRetention=null,s.navRoutes=[],s.activeRoute,s.navigationCount=0;if(typeof r.appName===undefined)throw"The appconfig JSON does not contain the appName property.";s.childRouter.guardRoute=s.guardRouteHandler.bind(s),s.shell.navigationLoadedCallBack(this)};return n.prototype={constructor:n,navigate:function(t,n){var r=this,i=r.ruleEngine.determineDestination(t,n);if(i.type&&i.value){var s;i.type==="nav"?s=r.ruleEngine[i.value]():i.type==="route"&&(s=i.value),r.activeRoute=s;var o=e.grep(r.navRoutes,function(e){return e.node==t}),u=o[0]?o[0].nextNode:s;r.setNavRoutes(t,n,s),r.dataRetention!==null&&(r.navRoutes=r.dataRetention(r.navRoutes,t,u,s,r.getChildApplicationObjects()));if(i.type==="nav")return s;if(i.type==="route")return r.navigateRoute(s)}else console.log("destination.type or destination.value is undefined")},setNavRoutes:function(n,r,i){var s=this;if(r=="restart")s.navRoutes=[];else{var o=e.grep(s.navRoutes,function(e){return e.node==n});if(o.length==0)s.navRoutes.push({node:n,nextNode:i,navigationStep:s.navigationCount,timeStamp:t().valueOf()});else{var u=e.inArray(o[0],s.navRoutes);s.navRoutes[u].nextNode=i,s.navRoutes[u].navigationStep=s.navigationCount,s.navRoutes[u].timeStamp=t().valueOf()}s.navigationCount=s.navigationCount+1}},loadSavedNav:function(e,t){var n=this;n.navRoutes=e,n.activeRoute=t},getChildApplicationObjects:function(){var e=this;return{shell:e.shell,ruleEngine:e.ruleEngine,datacontext:e.datacontext,childRouter:e.childRouter}},getPreviousRoute:function(t){var n=this;try{var r=null;return e.each(n.navRoutes,function(e,n){n.nextNode==t&&(r==null?r=n:n.navigationStep>r.navigationStep&&(r=n))}),r}catch(i){console.log(i)}},getNavRoutes:function(){var e=this,t=e.navRoutes;return t},getActiveRoute:function(){var e=this;return e.activeRoute=e.childRouter.activeInstruction().config.route,e.activeRoute},navigateBack:function(e){var t=this,e=e?e:t.activeRoute,n=t.getPreviousRoute(e);n=n?n.node:t.activeRoute,t.activeRoute=n,n&&t.navigateRoute(n)},navigateRoute:function(e){var t=this,n=t.childRouter.parent.convertRouteToHash(t.appConfig.appName+"/"+e);return t.childRouter.navigate(n,{replace:!0,trigger:!0})},getLastVisitedRoute:function(){var e=this;if(e.navRoutes!==undefined&&e.navRoutes.length>0){var t=e.navRoutes.sort(function(e,t){return t.timeStamp-e.timeStamp});return t[0]}return!1},guardRouteHandler:function(e,t){var n=this,r=t.fragment,i=n.getNavRoutes();if(n.appConfig.screens===undefined)return!0;var s=n.appConfig.screens.some(function(e){return e.ignoreGuard});if(s)return!0;if(typeof e.ignoreGuard!="undefined"&&e.ignoreGuard)return!0;if(typeof t.params!="undefined"&&t.params.length>0)return!0;if(n.appConfig.appName!=t.config.moduleId.split("/")[0])return!0;if(i===undefined||i.length!=0){var u=n.getLastVisitedRoute();return u.nextNode==r||u.node==r?!0:n.childRouter.parent.convertRouteToHash(n.appConfig.appName+"/"+u.node)}var o=n.appConfig.screens.sort(function(e,t){return e.ordinal-t.ordinal})[0].key;return r!=o?n.childRouter.parent.convertRouteToHash(n.appConfig.appName+"/"+o):!0}},n}),define("shared/services/abn",["jquery","q"],function(e,t){function n(n){var r="9825b939-2060-4bfe-88de-9ad38ebc4a3f",i="https://abr.business.gov.au/json/AbnDetails.aspx?&abn="+n+"&guid="+r;return t(e.ajax({url:i,dataType:"jsonp"})).then(function(e){var n=Object.create(e);n.AbnFound=n.Message!="Search text is not a valid ABN or ACN"&&n.Message!="No record found";var r={data:n,errors:[]};return n.AbnFound?r:t.reject(r)},function(e){var n={Abn:"",AbnStatus:"",AddressDate:null,AddressPostcode:"",AddressState:"",BusinessName:[],EntityName:"",EntityTypeCode:"",EntityTypeName:"",Gst:null,Message:"",AbnFound:!1};return t.reject({data:n,errors:[e]})})}return{lookup:n}}),define("shared/services/accessability",["jquery"],function(e){var t={};return t.forceAssertiveOnce=function(e){e.removeAttr("role aria-live aria-atomic aria-relevant"),e.attr({"aria-live":"assertive","aria-atomic":"false","aria-relevant":"additions"}),e.one("focusout",function(t){e.removeAttr("role aria-live aria-atomic aria-relevant")})},t.forcePoliteOnce=function(e){e.removeAttr("role aria-live aria-atomic aria-relevant"),e.attr({"aria-live":"polite","aria-atomic":"false","aria-relevant":"additions"}),e.one("focusout",function(t){e.removeAttr("role aria-live aria-atomic aria-relevant")})},t}),define("shared/services/global",[],function(){var e="";return{appName:function(t){return typeof t=="undefined"?e:(e=t,e)},area:ko.observable()}}),define("shared/services/baseProvider",["plugins/router","shared/services/global"],function(e,t){function i(e,t){return ko.computed(function(){if(e().length>0){var n=ko.utils.arrayFirst(e(),function(e){return e.key()==t});return n}})}function s(e,t){return ko.computed(function(){[e](t)})}function o(e){return typeof e=="undefined"}var n=function(){var e=this;e.appName=function(){return t.appName()},e.getApplicationArea=function(){return t.area()},e.findObjectByKey=i,e.isUndefined=o,e.getComputedRefData=s},r=new n;return r}),define("shared/services/refdataEngine",["jquery","knockout","./logger"],function(e,t,n){function i(e,t){return this.getRefData(e,null,t,!0)}function s(e,t,n){return this.getRefData(e,null,n,!1)}function o(e,t,r,i){typeof i=="undefined"&&(i=!1),typeof r=="undefined"&&n.logError("refDataEngine - appName not provided","getRefData");var s=r+"/appconfig",o=require(s),a=f(e,r),l=o.refdata,h=Q.defer();if(l.length>0){var p=null;for(var d=0;d0?typeof t!="undefined"&&t===!0&&(e(window).width()<768&&e("div[class*='AtoMenuBar_reduced']").length>0?r=e("div[class*='AtoMenuBar_reduced']").height():r=e("header[class*='AtoHeader_sticky']").height()):e(window).width()<768&&(n.area().indexOf("mytax")>=0||n.area().indexOf("atoo")>=0)&&e(".sticky-menu.visible-xs").length>0&&(r=e(".sticky-menu.visible-xs").height()),r}function u(){return"#applicationHost"}function a(t,n){if(typeof t=="string")typeof n=="undefined"&&(n=0),e(document).scrollTop(e(t).offset().top-o()-10-n);else if(typeof t=="object"&&typeof e(t.selector)!="undefined"){var n=t.extraTop?t.extraTop:20,r=t.scrollSpeed?t.scrollSpeed:0,i=t.delay?t.delay:0,s=e(t.container)||e("html, body");if(t.container)if(s.selector==".help-sidebar-outer")var u=e(t.selector).position().top-o()-n;else var u=s.scrollTop()+e(t.selector).position().top-o()-n;else var u=e(t.selector).offset().top-o()-n;s.animate({scrollTop:u},r),t.focus&&e(t.selector).focus()}}function f(t){var n=window.scrollX||pageXOffset,r=window.scrollY||pageYOffset;e(t).focus(),window.scrollTo(n,r)}function l(){var e="";return n.area()!=""?e=n.area():t.applicationArea!==""&&(e=t.applicationArea),e}function c(){return n.appName()}function h(e,t){if(!t)throw"getLabelForControlKey- expect type";var n="",t=t.toUpperCase();switch(t){case"TEXTBOX":n="lbl";break;case"CHECKBOX":case"DROPDOWNLIST":case"VERTICALRADIO":n="lbl-"}return n+e}function p(t){var n=this;this.hasHadFocus&&e(t).find("input").one("blur",function(e){n.hasHadFocus(!0)})}function d(e,t){if(!t)throw"getLabelForControlKey- expect type";var n="",t=t.toUpperCase();switch(t){case"TEXTBOX":n="lbl";break;case"CHECKBOX":case"DROPDOWNLIST":case"VERTICALRADIO":n="vrb-question-name-"}return n+e}function v(t,n){var r=this;typeof n=="undefined"&&(n=!1);var t=e(t);if(typeof t!="undefined"){var i;n?i=t.find(".form-control.error"):i=t.find(".form-control");if(i.length>0){var s=i[0].name,o={selector:"#"+s,focus:!0};r.scrollToTop(o)}}}function m(t){var n=".btn, a, [tabindex], input, .form-control",r=e(t).next(n);if(r.length==0)throw"next focusable item not found for selector "+t;return r}function g(t){var n=".btn, a, [tabindex], input, .form-control",r=e(t).prev(n);if(r.length==0)throw"previous focusable item not found"+t;return r}function y(t){var n=e('[rel="stylesheet"]'),r='',i="";return Array.isArray(t)||(t=[]),n.each(function(e,n){var s=n.getAttribute("href"),o=t.some(function(e){return s.search(e)>-1});o||(i+=r.replace("{href}",s))}),i}function b(e){var t=y(e.sheetExclusions),n="Calculator print"+t+"";return n}function w(t){var n=0,s;t.mode&&(n=t.mode);switch(n){case i.mode.standAlone:s="generalPage";break;case i.mode.authenticated:s="calcs-tools authenticated";break;case i.mode.integrated:s="calcs-tools integrated";break;default:s="generalPage"}var o;typeof t.printHTML!="undefined"?o=e("
").append(e(ko.unwrap(t.printHTML)).clone(!1)):o=e(t.printSelector).clone(!1),o.find(".container-fluid").removeClass("container-fluid"),o.find(".hide-help-aside").remove(),o.find(".hidden-print").remove(),o.find(".visible-print, .visible-print-block").removeClass("visible-print visible-print-block");var u=o.html(),a=window.open();if(window.location.href.toUpperCase().indexOf("EXPERTSYSTEMS")>=0)var f='';else var f=this.getCssHtml();typeof t.printMargin!="undefined"&&(f=f+'");var l="Calculator print"+f+"";a.document.write(l);if(n===i.mode.authenticated||n===i.mode.integrated)var c=e('img[src*="logo_ato_retina.png"]'),h=c.attr("src"),p="";else{var d;typeof r.imageLocation!="undefined"?d=r.imageLocation+"/logo-ato.png":d="/uploadedImages/Content/Images/logo-ato.png";var p=""}p='
'+p+"
";var v='';if(typeof t.customDisclaimerText!="undefined")var m=t.customDisclaimerText;else var m='

Our commitment to you

We are committed to providing you with accurate, consistent and clear information to help you understand your rights and entitlements and meet your obligations.

If you follow our information and it turns out to be incorrect, or it is misleading and you make a mistake as a result, we will take that into account when determining what action, if any, we should take.

Some of the information on this website applies to a specific financial year. This is clearly marked. Make sure you have the information for the right year before making decisions based on that information.

If you feel that our information does not fully cover your circumstances, or you are unsure how it applies to you, contact us or seek professional advice.

Copyright notice

© Australian Taxation Office for the Commonwealth of Australia

You are free to copy, adapt, modify, transmit and distribute this material as you wish (but not in any way that suggests the ATO or the Commonwealth endorses you or any of your services or products).

 
';a.document.write("
"+p);var g="";t.title&&(g="

"+t.title+"

"),a.document.write("
"+v+g+u+m+"
"),a.document.write("
"),a.document.close()}function E(e){var t=!!e.which||!!e.type;if(t)return e.which==13||e.which==32?!0:e.type==="click"?!0:!1;return!1}function S(){var t=c(),n=e('[data-view^="'+t+'"][data-view$="/shell"]'),r=n.parents(".tool-modal");return n.parents(".tool-modal").length>0?r:e(document)}function x(t){var n=e(t),r=n.parents(".modal-body");return n.parents(".modal-body").length>0?r:e("body")}function T(){var e=navigator.userAgent,t=/MSIE\s?(\d+)(?:\.(\d+))?/i,n=e.match(t);return n!=null?{major:n[1],minor:n[2]}:{major:"-1",minor:"-1"}}var s={getTopCompensation:o,scrollToTop:a,focusNoScroll:f,focusFirstFocusableItem:v,getApplicationArea:l,getAppName:c,attachFocusHandler:p,getLabelForControlKey:h,getNameForControlKey:d,getHostContainer:u,getPreviousFocusableItem:g,getNextFocusableItem:m,getCssHtml:y,getHeadHtmlWithSheets:b,printScreen:w,targetIsEnterSpaceOrClick:E,getApplicationContainer:S,getElementContainer:x,getIEVersion:T};return s}),define("shared/services/hyperlinkProvider",["require","jquery","plugins/router","./baseProvider","./refdataEngine","./uiHelper","../refdata/href"],function(e,t,n,r,i,s,o){function f(t){var n=this;typeof t=="undefined"&&(t=n.appName());var r=n.hrefs.filter(function(e){return e.appName==t});return r.length>0?Q.resolve(r[0]):i.getRefData("href",null,t).then(function(t){var r=n.appName(),i=s.getApplicationArea(),u=e(r+"/appconfig"),a;u.settings!==undefined&&typeof u.settings[i]!="undefined"?typeof u.settings[i].useDefaultHrefEventHandler!="undefined"&&(a=u.settings[i].useDefaultHrefEventHandler):a=!0;var f={appName:r,hrefs:t,useDefaultEventHandler:a};return f.hrefs=o.values.concat(t),n.hrefs.push(f),f})}function l(e,n,r){var i=this;if(n.type=="E"||n.type=="A"){t(e).attr("href",n.link+r),t(e).attr("target","_blank");var o=s.getApplicationArea();t(e).find(".icon-external-link").length==0&&t(e).html(t(e).html()+' Link opens in new window')}else n.type=="I"&&(t(e).attr("href",n.link+r),t(e).on("click","",function(e){e.preventDefault(),i.hyperlinkModalAction(n)}),t(e).addClass("modalWindow"))}function c(n){var r=this;if(n.type=="I"){var i=n.link.split("#"),s=i[0],o=i[1],u=s.split(".")[0].toUpperCase(),a="text!../../"+r.appName()+"/help/"+s;if(t("#helpModal").find("#"+u).length)t("#helpModal").hasClass("in")?d(o):h(o,u);else{if(t("#helpModal").length==0)throw"help modal not found for internal hyperlink";e([a],function(e){t("#helpModal").find(".modal-body").empty().html(e),h(o,u),ko.applyBindings({},t("#"+u)[0]),t("#helpLabel").text(t("#helpFileTitle").text()),t("#helpModal").on("hide.bs.modal",function(){t("#applicationHost").removeClass("hidden-print"),t("#printContainer").addClass("hidden-print"),t("#printContainer").hide()})})}}}function h(e,n){t("#helpModal").one("shown.bs.modal",function(){typeof e!="undefined"&&d(e),p(n)}),t("#helpModal").modal("show")}function p(e){t("#printContainer").length==0?t("body").append(""):(t("#printContainer").removeClass("hidden-print"),t("#printContainer").show()),t("#applicationHost").addClass("hidden-print"),t("#printContainer").addClass("visible-print"),t(".modal-backdrop").addClass("hidden-print"),t("#printContent")[0].innerHTML=t("#"+e)[0].innerHTML,t("#printContent *").removeAttr("id")}function d(e){t("#helpModal").scrollTop(0),t("#helpModal").scrollTop(t("#"+e).offset().top-t("#helpModal").offset().top),t("#helpModal .modal-body #"+e).focus()}function v(e,t){try{var n=this,r=typeof t=="undefined"?n.appName():t,i=ko.utils.arrayFirst(n.hrefs,function(e){return e.appName==r}),s=null;return s=ko.utils.arrayFirst(i.hrefs,function(t){return t.key==e}),s!==null?s:(console.log("href "+e+" not found"),{key:e,type:"E",link:"http://www.ato.gov.au"})}catch(o){return console.log("getHrefObjectByKey error: "+o.message),{key:e,type:"E",link:"http://www.ato.gov.au"}}}function m(e){t("#printContent")[0].innerHTML=t("#"+e)[0].innerHTML,window.print(),t("#printContent")[0].innerHTML=t(".modal-body")[0].innerHTML}var u=function(){var e=this;e.hrefs=[],e.hyperlinkModalAction=c,e.getHrefObjectByKey=v,e.defaultEventHandler=l,e.setNewChildAppHref=ko.computed(function(){var n=t.grep(e.hrefs,function(t){return t.appName===e.appName()});n==0&&e.getHyperlinksForTool(e.appName())}),ko.bindingHandlers.href={update:function(t,n,r){var i=n(),s=ko.unwrap(i),o=ko.utils.arrayFirst(e.hrefs,function(t){return t.appName==e.appName()});try{var u=e.getHyperlinksForTool(e.appName()).then(function(n){var i=r.get("appendVal")||"",o=e.getHrefObjectByKey(s);n.useDefaultEventHandler&&e.defaultEventHandler(t,o,i)}).catch(function(e){throw"Hyperlink provider - unexpected error when binding : "+s+" for tool "+o})}catch(a){console.log(a)}}},ko.bindingHandlers.printHelpSection={init:function(e,n,r){var i=n(),s=ko.unwrap(i),o=e.parentElement.parentElement.id;t(e).on("click","",function(e){m(o)},function(e){console.log(e)})}}};u.prototype=r,u.prototype.getHyperlinksForTool=f;var a=new u;return a}),define("shared/services/errorMessageProvider",["jquery","./baseProvider","./refdataEngine","../refdata/errormsgs"],function(e,t,n,r){function o(e){var t=this,i=t.errorMessages.filter(function(t){return t.appName==e});return i.length>0?Q.resolve(i[0]):n.getRefData("errormsgs",null,e).then(function(n){var i={appName:e,errormsgs:[]};return i.errormsgs=r.values.concat(n),t.errorMessages.push(i),i})}function u(e,t){var n=ko.observable({key:"",text:"",type:""}),i=this,s=typeof t=="undefined"?i.appName():t,o=i.getErrorsForTool(s);return o.then(function(t){try{if(t.errormsgs===null||t.errormsgs.length==0)t.errormsgs=r.values;var i=ko.utils.arrayFirst(t.errormsgs,function(t){return t.key==e});i!==null?n(i):logger.log("error key "+e+" not found")}catch(s){logger.log("error in getErrorMessageByKey:"&s)}}),n}var i=function(){var t=this;t.errorMessages=[],t.getErrorMessageByKey=u,t.addNewChildAppErrorMsg=ko.computed(function(){var n=e.grep(t.errorMessages,function(e){return e.appName===t.appName()});n==0&&t.getErrorsForTool(t.appName())})};i.prototype=t,i.prototype.getErrorsForTool=o;var s=new i;return s}),define("shared/services/baseViewModel",["jquery","require","./common","shared/services/global"],function(e,t,n,r){var i={area:r.area()};return i}),define("shared/services/contextSensitiveHelp",["jquery","knockout","shared/services/accessability","./uiHelper"],function(e,t,n,r){var i=function(n){var r=this;r.appName=n.appName;if(typeof r.appName=="undefined")throw"appconfig appName is not defined";r.taxonomies=n.taxonomies;if(typeof r.taxonomies=="undefined")throw"taxonomies is not defined";var i=e("div[data-view='"+r.appName+"/mytax16/shell'][data-active-view='true']:visible");if(i.length!=1)return;i.on("focus","input, select, textarea",function(){var n=e("#"+r.appName+"-help-slideout-container");if(n.length>0){var i=t.contextFor(n[0]).$data,s=a(this),o=f(s),u=undefined;o&&(i.helpType=="sticky"?u=n.find(".panel-title span").filter(function(e){return this.firstChild.nodeValue.trim()==o.OverlayTitle.trim()}):u=n.find("a").filter(function(e){return this.firstChild.nodeValue.trim()==o.OverlayTitle.trim()})),u?(i.currentTaxonomy&&i.currentTaxonomy(o),i.isOpen()&&(i.helpType=="sticky"?(e(u).parent().click(),e(u).parent().focus()):e(u.parent()).hasClass("collapsed")&&(e(u).click(),e(u).focus()))):(i.currentTaxonomy&&i.currentTaxonomy(undefined),e(n).find(".panel-collapse.in").collapse("hide"));function a(e){var n=t.contextFor(e),r=[];if(typeof n!="undefined"){var i;n.$root.hasOwnProperty("settings")&&n.$root.settings.hasOwnProperty("collectionViewModel")&&(i=n.$root.id),n.$data.hasOwnProperty("controlKey")?i?r.push(n.$data.controlKey.replace(i,"")):r.push(n.$data.controlKey):n.$parent.hasOwnProperty("controlKey")&&(i?(r.push(e.id.substring(e.id.indexOf("-")+1).replace(i,"")),r.push(n.$parent.controlKey.replace(i,""))):(r.push(e.id.substring(e.id.indexOf("-")+1)),r.push(n.$parent.controlKey)))}return r}function f(){for(var e=0;e-1)return t}}}})};return i}),define("shared/services/baseQuestionsViewModel",["jquery","durandal/composition","durandal/activator","services/logger","durandal/app","plugins/router","knockout","shared/services/validator","shared/services/common","moment","shared/services/hyperlinkProvider","shared/services/errorMessageProvider","shared/services/refdataEngine","shared/services/baseViewModel","module","shared/services/uiHelper","shared/services/contextSensitiveHelp"],function(e,t,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m){var g=function(t){function d(){if(!S())return l.navigate(u,"next")}function g(){return y(!0),l.navigateBack(u)}function y(){n.childModules.forEach(function(e){var t=require(e.name);t.resetValidation&&t.resetValidation()})}function b(){var e=!1;try{for(var t=0;t=0:!1;typeof e.resetValidation=="function"&&!n?r.relevant.subscribe(function(t){t||typeof e.resetValidation=="function"&&e.resetValidation()}):typeof e.errors!="undefined"&&r.relevant.subscribe(function(t){if(!t){var n=ko.unwrap(e.errors);Array.isArray(n)&&n.forEach(function(e){typeof e.visible!="undefined"&&ko.isObservable(e.visible)&&e.visible(!1)})}})}),e}function E(){var e=[];return this.screenController.sections().forEach(function(t){t.relevant()&&e.push(t.key())}),e}function S(){n.page_error(!1);var e=n.errors(),t=!1;return n.childModules.forEach(function(r,i,s){var o=r.name.substr(r.name.lastIndexOf("/")+1),u=n.screenController[o];if(u.relevant()){var a=require(r.name);if(!r.errorsRetrieved){if(ko.isObservable(a.errors)){var f=a.errors();f=f.map(function(e){return e.moduleId=r.name,e.parentOrdinal=r.ordinal,e}),e=e.concat(f),a.errors.subscribe(function(e){var t=this,i=n.errors(),s;i.some(function(e,n){var r=e.moduleId==t.moduleId;return s=r?n:-1,r}),i=i.filter(function(e){return e.moduleId!==t.moduleId}),e.forEach(function(e){e.moduleId=r.name,i.splice(s,0,e),s+=1}),n.errors(i)},{moduleId:r.name})}else if(Array.isArray(a.errors)&&a.errors.length>0){var f=a.errors;f=f.map(function(e){return e.moduleId=r.name,e.parentOrdinal=r.ordinal,e}),e=e.concat(f)}u.questions().forEach(function(e){e.value.subscribe(function(e){if(n.page_error()){n.computePageErrorFlag=!1;var t=x(this);n.computePageErrorFlag=!0;if(!t)var r=n.anyErrorsActive();n.page_error(t||r)}},a)}),s[i].errorsRetrieved=!0}var l=x(a);!n.page_error()&&l&&(t=!0)}}),n.errors(e),n.sortChildViewErrors==1&&n.errors.sort(a.sortObject("parentOrdinal","integer")),n.page_error(t),n.page_error()}function x(e){var t=!1;return e.isPageValid?t=!e.isPageValid():e.pageHasError&&(t=e.pageHasError()),t}function T(e){var t=e.appName;n.page_error(!1),r.log(this.title+" View Activated",null,this.title,!1)}function N(e,t){return}function C(t,n,i){function l(t,n){var s="";if(typeof t.refdatakey!="undefined"&&t.refdatakey!=="")t.refdatakey=="incomeYears"?s=a.formatFinYear(n):s=h.getRefDataValueByKey({key:n,refDataType:t.refdatakey,appName:i});else if(t.type=="currency")s=a.currencyFormatter(n);else if(t.type=="collection")if(typeof t.settings!="undefined")if(typeof t.settings.schema!="undefined"){var o;typeof n=="string"?o=JSON.parse(n):Array.isArray(n)&&(o=n),s=[],o.forEach(function(n,r){var i=[];t.settings.schema.forEach(function(t,r){var s={};e.extend(s,t),s.value=n[t.key],s.formattedVal=l(s,s.value),i.push(s)}),s.push(i)})}else r.logError("getQuestionExtract - expected settings.schema for collection item type","getQuestionExtract");else r.logError("getQuestionExtract - expected settings for collection item type","getQuestionExtract");else s=n;return s}typeof t=="undefined"&&r.logError("getQuestionExtract expected questionsViewModel","getQuestionExtract"),typeof n=="undefined"?r.logError("getQuestionExtract expected questionsData","getQuestionExtract"):n=n.values,typeof i=="undefined"&&r.logError("getQuestionExtract expected appName","getQuestionExtract");var o=this,u=[],f=t.getRelevantSectionKeys();return f.forEach(function(e,t){var r={},i;n.some(function(t){var n=t.key==e;return n&&(i=t),n}),r.text=i.text;var o=s.getQuestionByKey(e).value();r.formattedVal=l(i,o),r.key=i.key,r.type=i.type,i.settings&&(r.settings=i.settings),u.push(r)}),{type:"questionExtract",extract:u}}function k(e){typeof e.questionsViewModel!="undefined"&&typeof e.questionsData!="undefined"&&typeof e.appName!="undefined"?e=C(e.questionsViewModel,e.questionsData,e.appName):typeof e.extract=="undefined"&&r.logError("createReportInputsHTML expected properties: extract","createReportInputsHTML");var t="

{0}

{1}

",n='

{0}

',i='',s="";return e.extract.forEach(function(e){if(e.type!=="collection")var r=a.stringFormat(t,[e.text,e.formattedVal]);else{var o="";if(e.formattedVal.length>0)var u=e.formattedVal.forEach(function(e){var n="";e.forEach(function(e){var r=a.stringFormat(t,[e.text,e.formattedVal]);n+=r}),o+=a.stringFormat(i,n)});else{var f=typeof e.settings.noItemsText!="undefined"?e.settings.noItemsText:"No entries recorded";o="

"+f+"

"}var r=a.stringFormat(n,[e.text,o])}s+=r}),s}var n=this,i=t.appInterface,s=i?i.app.private.datacontext:t.datacontext,o=t.cascadingViewModel,u=t.screenKey,f=t.nextButtonText,l=t.navigation,c=i?i.app.private.appConfig:t.appConfig;if(typeof t.contextSensitiveHelp!="undefined"){var p=t.contextSensitiveHelp;p.appName=c.appName,n.contextSensitiveHelp=new m(p)}n.type="questionsViewModel",n.activate=T,n.compositionComplete=N,n.next=d,n.previous=g,n.appName=c.appName,n.area=v.getApplicationArea(),n.resetValidation=y,n.pageHasError=S,n.errors=ko.observableArray([]),n.childModules=[],n.page_error=ko.observable(!1),n.anyErrorsActive=b,n.addChildModule=w,n.datacontext=s,n.getRelevantSectionKeys=E,n.subscriptions,n.screenController=new o(this,u),typeof t.displayBottomNav=="undefined"?n.displayBottomNav=!0:n.displayBottomNav=t.displayBottomNav,typeof t.sortChildViewErrors=="undefined"?n.sortChildViewErrors=!1:n.sortChildViewErrors=t.sortChildViewErrors,n.getQuestionExtract=function(){if(arguments.length!=1)return C.apply(this,Array.prototype.slice.call(arguments));if(arguments[0].type=="questions")return C.call(this,this,arguments[0],n.appName);r.logError('getQuestionExtract - expected questions data with with type "questions"',"self.getQuestionExtract")},n.createReportInputsHTML=k,typeof t.displayMandatoryMsg=="undefined"?n.displayMandatoryMsg=!0:n.displayMandatoryMsg=t.displayMandatoryMsg,typeof f=="undefined"||f==""?n.nextButtonText="Submit":n.nextButtonText=f,n.computePageErrorFlag=!0,n.computePageError=ko.computed(function(){b()==0&&n.computePageErrorFlag&&n.page_error(!1)})};return g}),define("shared/services/bindingHandlers",["jquery","moment","shared/services/uiHelper"],function(e,t,n){function r(e){var t={"&":"&","<":"<",">":">",'"':""","'":"'"};return e.replace(/[&<>"']/g,function(e){return t[e]})}var i={},s=require("durandal/composition");return s.addBindingHandler("calculators",{init:function(e,t,n){var r=[].splice.call(arguments,0),s=t(),o=Object.keys(s)[0],u=function(){return s[o]};r[1]=u;if(!(o in i))throw"invalid calculator handler type";i[o].init&&i[o].init.apply(this,r)},update:function(e,t,n){var r=[].splice.call(arguments,0),s=t(),o=Object.keys(s)[0],u=function(){return s[o]};r[1]=u;if(!(o in i))throw"invalid calculator handler type";i[o].update.apply(this,r)}}),i.collapse={init:function(t,n,r,i,s){var o=n(),u=ko.unwrap(o.open),t=e(t);t.attr("class","panel-collapse collapse in").collapse(),o.events&&Object.keys(o.events).forEach(function(n){e(t).on(n,o.events[n])})},update:function(t,n,r,i,s){var o=ko.unwrap(n());console.log(t.id+" : "+o.open()),o.open()?e(t).collapse("show"):e(t).hasClass("in")&&e(t).collapse("hide");var u=e('[data-toggle="collapse"][href="#'+t.id+'"],'+'[data-toggle="collapse"][data-target="#'+t.id+'"]');u.toggleClass("collapsed",!o.open()).attr("aria-expanded",o.open())}},i.modal={init:function(t,n,r){e(t).modal({show:!1})},update:function(t,n,r){var i=ko.unwrap(n()),s=ko.unwrap(i.visible);s?e(t).modal("show"):(e(t).one("hide.bs.modal",function(e){e.stopPropagation()}),e(t).modal("hide")),e(t).on("show.bs.modal",function(n){var r=e(t),i=r.closest("[data-view!=''][data-view]");r.detach().appendTo(i)})}},i.visibleWithEvents={update:function(e,t,n){var r=t(),i=[].splice.call(arguments,0),s=r.toggler();i[1]=r.toggler,ko.bindingHandlers.visible.update.apply(this,i),s?r.events&&r.events.shown&&r.events.shown.call(e):r.events&&r.events.hidden&&r.events.hidden.call(e)}},{}}),define("shared/widgets/sharedWidgets",["jquery","plugins/widget","shared/services/logger"],function(e,t,n){function s(e,t,n){var r=this,n=typeof n=="undefined"?r.defaultWidgetFolder:n;for(var i in e)r.registerWidget(e[i],t,n)}function o(r,i,s){var o=this,u=i!=""?s+"/"+r+"/"+i:s+"/"+r+"/web",a=i!=""?s+"/"+r+"/viewmodel":s+"/"+r+"/viewmodel";e.inArray(r,o.registeredWidgets)==-1?(o.registeredWidgets.push(r),t.registerKind(r),t.mapKind(r,u,a)):(n.log("widget "+r+" already exists"),n.log("viewid :"+u),n.log("moduleId: "+a))}var r=function(){var e=this;e.defaultWidgetFolder="shared/widgets",e.registerWidgets=s,e.registerWidget=o,e.registeredWidgets=[]},i=new r;return i}),define("shared/services/helpProvider",["jquery","q","./baseProvider","./refdataEngine","./common","./logger","./uiHelper","durandal/app","plugins/router","./Client","./validator"],function(e,t,n,r,i,s,o,u,a,f,l){function p(e){return f.downloadTaxonomyFromCdn(e)}function d(e){var t=this;return i.requirePromise(this.appName()+"/refdata/taxonomies").then(function(e){return e.TaxonomyItems.forEach(function(e){var n=t.taxonomies.some(function(t){return e.TaxonomyPath==t.TaxonomyPath});n||(typeof e.ReplaceText!="undefined"&&(e.Content=v(e.ReplaceText,e.Content)),t.taxonomies.push(e))}),e},function(e){s.logError(e,"downloadTaxonomy")})}function v(e,t){for(var n=0;nTooltip "+r+""),t.tooltip(n),i&&t.on("blur",function(t){e(this).tooltip("hide")})}catch(t){s.log("tooltip creation failed:"+t.message)}}function g(e,t,n){var r;e.Content?(r=e.Content,n&&(r=y(r,n))):n?(r=e,r=y(r,n)):r=e,m(t,n,r),t.addClass("icon icon-tooltip tooltip-anchor"),n.readOnly||t.attr("href","javascript:void(0)")}function y(e,t){var n=t.replaceText;if(n)for(var r=0;r0?i[0].TaxonomyItem:i}).fail(function(e){s.logError("getHelpByPath failed","getHelpByPath",{error:e})})}function x(e){var t=this,n=e[0],i=e[1];if(!Array.isArray(n))throw"getHelpByIds - expected array";return r.getRefData("taxonomiesLookup",null,this.appName()).then(function(e){var t=[];return n.forEach(function(n){var r={};e.some(function(e){var i=e.CalculatorHelpId==n.CalculatorHelpId;return i&&(r=e,t.push(r)),i})}),t}).then(function(e){var n=e[0].TaxonomyPath;return t.getTaxonomyCollection(n,e)}).then(function(e){var t=[],n=!0;typeof i=="undefined"?i=["General"]:n=!1;var r,s;return r=-1,i.forEach(function(i){t.push(new Array(i)),r+=1,s=-1,e.forEach(function(e){if(e.Category==i||n)s+=1,t[r][s]=e}),s>=0&&(t[r].Category=i)}),t}).fail(function(e){s.logError("getHelpById failed: ","getHelpById",{error:e})})}function T(e,t){var n=this;if(!e)throw new Error("getTaxonomyItem called without a taxonomy parameter");if(!t)throw new Error("getTaxonomyItem called without an item parameter");return this.downloadTaxonomy(e).then(function(n){var r=ko.utils.arrayFirst(n.TaxonomyItems,function(n){return n.TaxonomyPath===e+"/"+t});return r}).fail(function(e){s.logError("getTaxonomyItem failed ","getTaxonomyItem",{error:e})})}function N(e,t){var n=this;if(!e)throw new Error("getTaxonomyItem called without a taxonomy parameter");if(!t)throw new Error("getTaxonomyItem called without an item parameter");return this.downloadTaxonomyFromCdn(e).then(function(n){var r=ko.utils.arrayFirst(n,function(n){return n.FullTaxonomyPath===e+"/"+t});return r}).fail(function(e){s.logError("getTaxonomyItemFromCdn failed ","getTaxonomyItemFromCdn",{error:e})})}function C(e){var t=this.taxonomies.some(function(t){return e==t.TaxonomyPath});return t}function k(e,t){if(!e)throw new Error("getTaxonomyCollection called without a taxonomy parameter.");return t?this.downloadTaxonomy(e).then(function(e){var n=e.TaxonomyItems.filter(function(e){var n;return t.some(function(t){var r=t.TaxonomyPath+"/"+t.TaxonomyItem==e.TaxonomyPath;return r&&(n=e),r}),typeof n!="undefined"});return n}).fail(function(e){s.logError(e,"getTaxonomyCollection")}):result}function L(e){if(!e)throw new Error("getTaxonomyCollection called without a taxonomy parameter.");var t=this.downloadTaxonomyFromCdn(e).then(function(t){var n=t.TaxonomyItems.filter(function(t){if(t.FullTaxonomyPath===e){t.TaxonomyItem.TaxonomyPath.indexOf("/")===-1&&(t.TaxonomyItem.TaxonomyPath=t.FullTaxonomyPath+"/"+t.TaxonomyItem.TaxonomyPath);var n=D(t.StartDate,t.EndDate);if(n)return t}});return n=n.map(function(e){return e.TaxonomyItem}),n}).fail(function(e){s.logError(e,"getTaxonomyCollection")});return t}function A(e,t,n){var r=this,i=O(e.TaxonomyItems),s=_(i,t.values),o=M(s,n.app.private.appConfig,n.app.methods.getMode());return o}function O(e){var t='Link opens in new window',n='Link opens in new window',r,i=[];return e.forEach(function(e){r=e.Content,r.indexOf(t)>=0&&(r=r.replace(new RegExp(t,"g"),n),e.Content=r),i.push(e)}),i}function M(e,t,n){var r=[],i=t.screens[0].help,s=t.screens[0].helpCategories;return s.forEach(function(t){e.forEach(function(e){if(e.Category===t){var s=!1;for(var o=0;o=0&&r.push(e):s===!0&&r.push(e)}})}),r}function _(e,t){var n,r,i,s,o,u,a=[];for(n=0;n-1||c.indexOf("atoo")>-1)&&e("#navBarTop").length>0){var h=e("#navBarTop").height(),p=e("#navBarTop").offset();u.top>p.top+h+l?f="top":u.top+l?f="top":u.top<+l?f="bottom":u.left/i<.8?f="right":f="left";return f},selector:!1,title:"",trigger:"hover focus",delay:0}}};c.prototype=n;var h=new c;return h}),define("shared/services/baseShell",["jquery","durandal/app","plugins/router","knockout","shared/services/bindingHandlers","shared/services/loader","shared/services/logger","shared/widgets/sharedWidgets","shared/services/helpProvider","durandal/system","shared/services/uiHelper","shared/services/global","shared/services/constants"],function(e,t,n,r,i,s,o,u,a,f,l,c,h){return function(i){function N(){return p+"/"+E+"/"+"shell.html"}if(typeof i=="undefined")throw"options object for shell not provided";var a=i.appInterface;if(typeof a=="undefined")var f=i.appConfig,p=i.appConfig.appName,d=i.datacontext,v=i.ruleEngine;else var f=a.app.private.appConfig,p=a.app.private.appConfig.appName,d=a.app.private.datacontext,v=a.app.private.ruleEngine;o.log(p+" Shell Loaded!!");var m;f.applicationTitle?m=f.applicationTitle:f.appTitle?m=f.appTitle:n.activeInstruction().config&&(m=n.activeInstruction().config.title),s.setAppConfig(f),d.calculatorItemsLoaded||s.loadCalculatorItems(d);var g=s.loadRoutes(),y;if(n.children&&n.children.length>0){console.debug("[baseShell] assigning appRouter from the array.");if(typeof n.children.getRouterByAppName(a.app.name)=="undefined")throw console.debug("[baseShell] cannot obtain childRouter from the router.children array."),"[baseShell] cannot obtain childRouter from the router.children array.";y=n.children.getRouterByAppName(a.app.name)}else{y=n;if(a.app.methods.getMode()==h.mode.standAlone){var b=y.activeInstruction().config.area;b!=a.getHost().config.hostArea&&(a.getHost().config.hostArea=b,c.area(b))}}var w=y.createChildRouter().makeRelative({moduleId:p,fromParent:!0}).map(g).buildNavigationModel(),E=l.getApplicationArea();w.area=r.observable(E);if(f.settings[E])var S=f.settings[E].sharedWidgets,x=f.settings[E].childWidgets,T=f.settings[E].widgets;else if(f.settings.web)var S=f.settings.web.sharedWidgets,x=f.settings.web.childWidgets,T=f.settings.web.widgets;else var S=f.settings.sharedWidgets,x=f.settings.childWidgets,T=f.settings.widgets;Array.isArray(S)&&(S.push("printButton"),S.push("modal")),u.registerWidgets(S,E),typeof x!="undefined"&&x.length>0&&u.registerWidgets(x,E,p+"/widgets"),typeof T!="undefined"&&T.length>0&&T.forEach(function(e,t){if(typeof e.kinds!="undefined")u.registerWidgets(e.kinds,E,e.rootFolder);else{var n=e.slice(e.lastIndexOf("/")+1),r=e.slice(0,e.lastIndexOf("/"));u.registerWidget(n,E,r)}}),w.on("router:route:before-config",function(e,t){console.log(e)}),w.on("router:route:not-found",function(e){o.logError("No Route Found","baseShell:childRouter.on",e)}),w.on("router:navigation:composition-complete",function(t,n,r){var i=require("plugins/router").applicationArea;typeof i!="undefined"&&(i.indexOf("mytax")>-1||i.indexOf("atoo")>-1)&&e(".spa").length>0&&(l.getApplicationContainer().scrollTop(0),e(".spa").focus()),e("#cd-childspa-content").off("show.bs.modal hide.bs.modal"),e("#cd-childspa-content").on("show.bs.modal hide.bs.modal",function(t){e("body .tool-modal-open")&&t.stopPropagation()})}),v.prepopulation&&v.prepopulation();var C=function(){var s=this;this.router=w,this.routes=r.computed(function(){return r.utils.arrayFilter(w.navigationModel(),function(e){return e})}),this.getView=N,this.area=E,this.appModuleId=p,this.errorModalControlKey=this.appModuleId+"-error",this.datacontext=d,this.mode=a.app.methods.getMode(),this.version=f.version.number,this.containerClass=function(){var e,t=l.getIEVersion().major==="9"||l.getIEVersion().major==="10"?"iebelow11":"";switch(a.app.methods.getMode()){case h.mode.integrated:e="calcs-tools integrated";break;case h.mode.standAlone:e="calcs-tools standAlone spa";break;case h.mode.authenticated:e="calcs-tools authenticated"}return e+" "+t}(),this.applicationTitle=r.observable(m),this.nestedAccordions=f.nestedHelpAccordions,this.getTaxomoniesConfig=function(){var e;try{e=f.help.taxonomies}catch(t){o.logError("shell - no taxonomies in app config","getTaxonomiesConfig"),e=[]}return e},this.getHelpFromAppConfig=function(){return typeof f.screens!="undefined"?f.screens:f.questiongroups},this.activeScreenKey=r.computed(function(){try{if(w.activeInstruction()!==null){var e=w.activeInstruction().config.moduleId,t=e.substring(e.lastIndexOf("/")+1);return w.parent.activeItem()!==null?typeof w.parent.activeItem().appModuleId!="undefined"&&c.appName(w.parent.activeItem().appModuleId):console.debug("[baseShell] Cannot determine appName yet."),t}return""}catch(n){return console.log("calculator base shell - error determining active screen key"),""}}),this.showPrint=!1,this.navigationLoadedCallBack=function(e){typeof a!="undefined"&&(a.setNavigation(e),this.applicationInitialized())},this.applicationInitialized=function(){a.getHost().initialised&&(console.debug("[baseShell] Interface module loaded"),t.trigger(a.constants.events.initialised))};var u=i.helpType;u===undefined&&(u="classic");var v=[h.mode.integrated,h.mode.authenticated].indexOf(this.mode)>=0?"sticky":u,g;typeof a.getHost().client.periodStartDate!="undefined"&&(g=parseInt(a.getHost().client.periodStartDate.substring(0,4))+1),this.helpSideBarSettings={appName:this.appModuleId,controlKey:this.appModuleId,pageTitle:this.applicationTitle,screenKey:this.activeScreenKey,taxonomies:this.getTaxomoniesConfig(),screens:this.getHelpFromAppConfig(),appMode:this.mode,nestedAccordions:this.nestedAccordions,helpType:v,helpButtonVisible:v!="sticky",showStickyPanel:this.mode===h.mode.authenticated,currentYear:g},v=="sticky"&&(this.helpSideBarSettings.helpTitle="Help"),i.helpSideBarSettings&&(this.helpSideBarSettings=e.extend(this.helpSideBarSettings,i.helpSideBarSettings)),this.transition=this.mode==h.mode.integrated?"fadeIn":"entrance",this.attached=function(e,t){o.log("baseShell -attached, app: "+this.appModuleId)},this.activate=function(e){var t=!1,r=!!n.activeInstruction();if(r){var i=n.activeInstruction().fragment.indexOf(this.appModuleId)>=0;if(i){var s=!!this.router.parent.activeInstruction();s&&this.router.parent.activeInstruction().fragment.indexOf(this.appModuleId)>=0&&(t=!0)}}return t},this.compositionComplete=function(e){o.log("baseShell - compostionComplete, app:"+this.appModuleId)},this.detached=function(e,t){o.log("baseShell - detached, app:"+this.appModuleId)}};e.extend(this,new C)}}),define("shared/services/errorHandler",["jquery","moment","bignumber","q","./validator","./logger","./common"],function(e,t,n,r,i,s,o){function u(e){var t=new a(e);return t}function a(t){var n=this;if(!Array.isArray(t))throw"create validations - expects array settings";this.fields={},t.forEach(function(t){if(typeof n.fields[t.controlKey]=="undefined"){var r={};r.visible=ko.observable(!1),r.errors=ko.observableArray([]),r.error=ko.observable(!1);if("active"in t){if(ko.isObservable(t.active))t.active.subscribe(function(e){e||this.resetVisibility(t.controlKey)},n);else if(typeof t.active=="boolean"){var i=t.active;t.active=function(){return i}}}else r.active=function(){return!0};n.fields[t.controlKey]=e.extend(r,t)}}),this.errors=f.apply(this,[t,this.fields]),this.anyErrorsNoUpdate=function(e){return this.setVisibility({controlKey:e,onlyValidate:!0,update:!1})},this.validate=function(e){return this.setVisibility({controlKey:e,onlyValidate:!0})},this.setVisibility=function(e,t,r,i,o){var u;if(typeof e=="object")u=e.controlKey,r=typeof e.onlyValidate!="undefined"?e.onlyValidate:!1,o=typeof e.update!="undefined"?e.update:!0;else{u=e;var r=typeof r=="boolean"?r:!1,o=typeof o=="boolean"?o:!0}var a=!1;s.log("errorHandler - setVisibility - start");var f=[];return t===!1?this.resetVisibility(u):n.errors.forEach(function(e){var t=typeof u!="undefined"?u:e.controlKey,i=n.fields[t].active();if(e.controlKey==t&&i){var s=p.call(this,{controlKey:t,item:e.item,type:e.validationItem.type,settings:e.validationItem.settings,preCondition:e.preCondition,preConditions:e.preConditions,active:e.active,errorItem:e});if(!r)if(!s){var f=n.fields[t].errors().some(function(t){var n=e.errorKey==t.errorKey&&t.visible(),r=t.validationItem!==e.validationItem;return n&&r});e.visible(!f)}else e.visible(!1);o&&e.error(!s),s||(a=!0,r||n.fields[t].visible(!0))}}),u&&o&&n.fields[u].visible(a),s.log("errorHandler - setVisibility - end"),a},this.resetVisibility=function(e){n.errors.forEach(function(t){var r=typeof e!="undefined"?e:t.controlKey;t.controlKey==r&&(n.fields[r].visible(!1),t.visible(!1))})},this.anyErrors=function(e){return n.errors.some(function(t){var n=typeof e!="undefined"?e:t.controlKey;if(t.controlKey==n)return t.error()&&t.visible()})}}function f(e,t){var n=this,r=[];return e.forEach(function(e){e.validations.forEach(function(i){var u={};u.controlKey=e.controlKey,e.label&&(u.controlLabelText=e.label),e.labelIdForScroll?typeof e.labelIdForScroll=="object"?u.elementId=v(e.labelIdForScroll.controlKey,e.labelIdForScroll.widget):u.elementId=e.labelIdForScroll:u.elementId=v(e.controlKey,e.widget,e.id),u.errorKey=i.errorKey,u.visible=o.isDefined(i.visible)?i.visible:ko.observable(!1),u.active=o.isDefined(i.active)?i.active:!0,typeof u.active=="boolean"&&(u.active=function(e){return function(){return e}}(u.active)),u.variableText=i.variableText,u.error=ko.observable(!0),u.error.extend({rateLimit:100}),u.validationItem=i,u.item=e.item,u.field=t[e.controlKey],u.autoValidate=o.isDefined(i.autoValidate)?i.autoValidate:!1,typeof e.preCondition!="undefined"&&(u.preCondition=e.preCondition),typeof i.preConditions!="undefined"&&(Array.isArray(i.preConditions)?u.preConditions=i.preConditions:s.logError("error handler - processing preConditions expected undefined or array. got type: "+typeof u.preConditions,"processErrorArray"));if(i.type=="observable"){if(!ko.isObservable(i.settings.item))throw"error handler - expected an observable item for observable type";i.settings.item.subscribe(function(e){this.field.visible()&&u.error(!e)},u)}e.item&&e.item.subscribe(function(e){if(this.active())if(ko.unwrap(this.autoValidate))n.setVisibility(this.controlKey);else if(this.field.visible()){var t=this.validationItem.type,r=this.validationItem.settings,i=p.call(u,{item:this.item,type:t,settings:r,errorItem:u});this.error(!i)}},u),u.error.subscribe(function(e){if(this.active()){var t=this.field.error();!t&&this.field.active()&&e&&this.field.error(!0);var n=this.field.errors().some(function(e){return e.error()&&e.visible()});this.field.visible()&&!n&&this.field.visible(!1),e||this.visible(!1)}},u),t[e.controlKey].errors.push(u),r.push(u)})}),l.call(this),r}function l(){var e=this.fields;Object.keys(e).forEach(function(t){var n=e[t];n.errors().forEach(function(t){ko.isObservable(t.preCondition)&&t.preCondition.subscribe(c,t),Array.isArray(t.preConditions)&&(t.preConditions=t.preConditions.map(function(r){if(typeof r=="string")r=h.call({preCondition:r,field:n,error:t});else if(typeof r=="object"){if("controlKey"in r)if("type"in r)var i=e[r.controlKey].visible.subscribe(c,t);else var i=e[r.controlKey].visible.subscribe(c,t);else if("type"in r){r=h.call({preCondition:r.type,field:n,error:t});var s=r.subscribedItem,i=r.subscription}else if("condition"in r)var i=r.condition.subscribe(c,t),s=r.condition;r={preConditionType:"condition",subscribedItem:s,subscription:i}}return r}))})})}function c(e){e===!1&&this.error(!1)}function h(){var e=this.preCondition,t,n;this.field.errors().forEach(function(r){r.validationItem.condition==e?t=r:r.validationItem.type==e&&(n=r)});var r=t||n,i=r.error.subscribe(function(e){e===!0&&this.error(!1)},this.error);return e={id:e,preConditionType:typeof t!="undefined"?"condition":"error",subscribedItem:r,subscription:i}}function p(t){try{var n=!0;if(typeof t.item=="undefined"&&t.type!=="function")throw"validator - item not passed";if(!t.errorItem.active())return!0;var r=ko.unwrap(t.item),u=ko.toJS(t.settings)||{},a=!0;typeof t.preCondition!="undefined"?a=ko.unwrap(t.preCondition):typeof t.preConditions!="undefined"&&(a=!t.preConditions.some(function(e){return e.subscribedItem.error()}));if(a){if(t.type=="observable")n=ko.unwrap(u.item);else if(t.type=="isBlank")n=i.isBlank(r);else if(t.type=="isNotBlank")n=!i.isBlank(r);else if(t.type=="isValidInteger"){var f=!1;u.thousandSeperated&&(f=u.thousandSeperated);var l=!1;"signed"in u&&(l=u.signed);var c=!0;o.isDefined(u,"validateBlank")&&(c=u.validateBlank),c===!0?n=i.isValidInteger(r,l,f):n=i.isBlank(r)?!0:i.isValidInteger(r,l,f)}else if(t.type=="integerWithinRange"){var f=!1;u.thousandSeperated&&(f=u.thousandSeperated);var h=r,p=u.start,d=u.end,v=u.startInclude,m=u.endInclude,l=u.signed;n=i.integerWithinRange(h,p,d,v,m,l,f)}else if(t.type=="decimalWithinRange"){var f=!1;u.thousandSeperated&&(f=u.thousandSeperated);var h=r,p=u.start,d=u.end,v=u.startInclude,m=u.endInclude,l=u.signed;maxPrecision=u.maxPrecision,g=u.precision,enforceLeadingZero=o.isDefined(u.enforceLeadingZero)?u.enforceLeadingZero:!0;var c=!0;o.isDefined(u,"validateBlank")&&(c=u.validateBlank),c===!0?n=i.decimalWithinRange(h,p,d,v,m,l,maxPrecision,enforceLeadingZero,g,f):n=i.isBlank(r)?!0:i.decimalWithinRange(h,p,d,v,m,l,maxPrecision,enforceLeadingZero,g,f)}else if(t.type=="isValidCurrency"){var f=!1;u.thousandSeperated&&(f=u.thousandSeperated);var h=r,l=o.isDefined(u.signed)?u.signed:!1,c=!0;o.isDefined(u,"validateBlank")&&(c=u.validateBlank),c===!0?n=i.isValidCurrency(h,l,f):n=i.isBlank(r)?!0:i.isValidCurrency(h,l,f)}else if(t.type=="isValidDecimal"){var f=!1;u.thousandSeperated&&(f=u.thousandSeperated);var h=r,g=u.precision,l=u.signed;maxPrecision=u.maxPrecision,enforceLeadingZero=o.isDefined(u.enforceLeadingZero)?u.enforceLeadingZero:!0;var c=!0;o.isDefined(u,"validateBlank")&&(c=u.validateBlank),c===!0?n=i.isValidDecimal(h,g,l,maxPrecision,enforceLeadingZero,f):n=i.isBlank(r)?!0:i.isValidDecimal(h,g,l,maxPrecision,enforceLeadingZero,f)}else if(t.type=="compareDate"){var h=r,y=u.condition,b=ko.unwrap(u.compareAgainstDate)||ko.unwrap(u.startDate),w=ko.unwrap(u.endDate);n=i.compareDate(h,y,b,w)}else if(t.type=="isNotEmptyArray"||t.type=="isValidDate"||t.type=="isValidPostcode"||t.type=="isValidSuburb"||t.type=="isValidAddressLine"||t.type=="isOnlyNumbers"||t.type=="isAlphaNumeric")n=i[t.type](r);else if(t.type=="isNotOnlyNumbers")n=!i.isOnlyNumbers(r);else if(t.type=="isAfterTodaysDate")n=i.isAfterTodaysDate(r);else if(t.type=="isBeforeTodaysDate")n=i.isBeforeTodaysDate(r);else if(t.type=="isOnOrAfterTodaysDate")n=i.isOnOrAfterTodaysDate(r);else if(t.type=="isOnOrBeforeTodaysDate")n=i.isOnOrBeforeTodaysDate(r);else if(t.type=="function"){var E=e.extend({},{item:t.item},u.context);n=u.fn.apply(E)}else s.logError("passed validator: "+t.type+" not found","evaluateValidationRule");u.not&&(n=!n)}var S=o.isDefined(t,"controlKey")?t.controlKey:"no control key passed";return s.log("evaluateValidationRule - key:"+S+", type:"+t.type+", result: "+n),n}catch(x){throw"evaluateValidationRule error: "+x+", options passed in: "+JSON.stringify(t)}}function d(){}function v(e,t,n){if(!t)throw"getLabelForControlKey- expect type";var r="",i="",t=t.toUpperCase();switch(t){case"CURRENCY":case"TEXTBOX":r="lbl";break;case"CHECKBOX":case"CHECKBOXGROUP":case"DROPDOWNLIST":case"VERTICALRADIO":r="lbl-";break;case"ADJODAL":r="btn_",i="_add";break;case"NESTEDADJODAL":r="btn_",typeof n!="undefined"?i=n+"_add":i="_add"}return r+e+i}return{createErrorHandler:u,errorHandler:a,evaluateValidationRule:p}}),define("shared/services/baseVerticalRadioVm",["shared/services/logger","shared/services/refdataEngine","shared/services/errorHandler","shared/services/uiHelper","shared/services/baseViewModel"],function(e,t,n,r,i){"use strict";var s=function(i){var s=this;s.datacontext=i.datacontext,s.appName=r.getAppName(),s.area=r.getApplicationArea(),s.activate=function(t){var n=this;e.log("View Activated - "+i.controlKey,null,n.appName,!1);return},s.detached=function(){this.resetValidation()},s.controlKey=s.datacontext.getQuestionByKey(i.controlKey),s[i.controlKey]=s.datacontext.getQuestionByKey(i.controlKey),s.questionText=s[i.controlKey].text(),typeof i.label=="undefined"?s.label=s.questionText:s.label=i.label,typeof i.errorKey!="undefined"?s.errorKey=setting.errorKey:s.errorKey="EM0008",s.isPageValid=function(){return!this.errorHandler.setVisibility()},s.resetValidation=function(){this.errorHandler.resetVisibility()},s.errorsArraySettings=[{item:s[i.controlKey].value,widget:"verticalRadio",controlKey:i.controlKey,label:s.label,validations:[{type:"isNotBlank",errorKey:s.errorKey}]}],s.errorHandler=n.createErrorHandler(s.errorsArraySettings),s.errors=s.errorHandler.errors,s.refDataOptions=ko.observableArray();var o;i.refData?o=i.refData:o="yesno",t.getRefData(o,s.refDataOptions,s.appName)};return s.prototype=i,s}),define("shared/services/childAreaViewStrategy",["durandal/system","durandal/viewLocator","./logger","shared/services/uiHelper"],function(e,t,n,r){return function(n){var i=e.getModuleId(n.model),s=i.substring(i.lastIndexOf("/")+1,i.length),o,u=r.getApplicationArea();if(u!="")var o=i.substring(0,i.lastIndexOf("/")+1)+u+"/"+s+".html";else if(i.lastIndexOf("/")>=0)var o=i.substring(0,i.lastIndexOf("/")+1)+"/views/"+s+".html";else var o="views/"+s+".html";var a=t.locateView(o,null,n.parent);return a.then(function(e){return e},function(t){e.log(t)})}}),define("shared/services/collectionViewModel",["knockout","shared/services/logger","shared/services/validator","shared/services/common"],function(e,t,n,r){function i(){var e=this,t=e.collection().filter(function(e){return e.relevant()==1});return t.length}return function s(n){function y(){var e=this,t=!1;return e.collection().forEach(function(t){e.validateEdit(t)}),t}function b(t){var n=w(t);return e.toJSON(n)}function w(t){function l(t,n){var r={};if(typeof n=="undefined")var n=!1;return o.forEach(function(i){var s=e.unwrap(t.fields[i.propertyName].relevant);i.collectionViewModel!==undefined?s?r[i.propertyName]=t.fields[i.propertyName].toJS({preserveAdd:n}):r[i.propertyName]=[]:s?i.computedField?r[i.propertyName]=e.utils.unwrapObservable(t[i.propertyName]):r[i.propertyName]=e.utils.unwrapObservable(t.fields[i.propertyName]):r[i.propertyName]=""}),typeof t.id!="undefined"&&(r.id=e.unwrap(t.id)),t.relevant&&(r.relevant=e.unwrap(t.relevant)),r}var n=[],i=r.isDefined(t,"preserveAdd")||r.isDefined(t,"preserveState")?t.preserveAdd||t.preserveState:!1;a().forEach(function(e){var t=l(e);n.push(t)});if(i&&s.activeEditRow()<0){var u=l(v,i);n.unshift(u)}if(i&&s.activeEditRow()>=0){var f=l(g,i);n.unshift(f)}return n}function E(e){var n;try{return n=JSON.parse(e),this.fromJS(n)}catch(r){t.logError('collection view model - fromJSON couldn"t parse JSON string - '+e.toString(),"fromJSON")}}function S(e,t,n){var r=this;r.activeEditRow(-1),r.resetMaxId();var i=[];e.forEach(function(e){try{if(e.id==="add")T(e,s.addObject);else if(e.id==="editState")T(e,s.beforeEditObject);else{var t=O(),n=!e.id&&typeof e.id!="number"?null:e.id,o=r.createItemViewModel(t,n);T(e,o),i.push(o)}}catch(u){throw"collectionViewModel - fromJS - error in mapping collectionJS \r\n error:"+u+"\r\n data:"+JSON.stringify(e)}}),a(i)}function x(e){var t=this;if(typeof e=="undefined")throw"collection view model - addItem expected input";var n=O(),r=!e.id&&typeof e.id!="number"?null:e.id,i=t.createItemViewModel(n,r);return T(e,i),a.push(i),i}function T(e,t){try{var n=t.fields;o.forEach(function(t){var t=t.propertyName;if(t in e){var r=e[t];Array.isArray(r)&&n[t].type==="collectionViewModel"?n[t].fromJS(r):n[t](r)}})}catch(r){console.log(r)}}function N(e,t){try{var n=t.fields;o.forEach(function(t){var t=t.propertyName;if(t in e){var r=e[t];n[t]().toString().length===0&&(Array.isArray(r)&&n[t].type==="collectionViewModel"?n[t].fromJS(r):n[t](r))}})}catch(r){console.log(r)}}function C(){s.fields.forEach(function(e){typeof s.addObject[e.propertyName].subscribe=="function"&&s.addObject[e.propertyName].subscribe(function(e){s.addVisible&&s.canAdd(!0)})})}function k(){return e.computed(function(){if(this.bubbleErrors()){if(this.addVisible())return this.addObject.page_error?this.addObject.page_error():(t.log("collection vm - page_error not on add object"),!1);if(this.activeEditRow()!==-1)return this.collection()[this.activeEditRow()].page_error()}return!1},this)}function L(e){var n=this.errors;if(e)if(typeof this.addObject.errors!="undefined")for(var r=0;r=0||r.addVisible();if(t){var n=s.getActiveEditRowObject(),i=r.getActiveEditRowObject(),o=Array.isArray(n.errors)?e.unwrap(n.errors):[],u=Array.isArray(i.errors)?e.unwrap(i.errors):[],a=o.concat(u);h(a)}})}else n.type==="array"?r=e.observableArray([]):r=e.observable("");c&&(t[n.propertyName]=r),r.relevant=e.observable(!0),t.fields[n.propertyName]=r}),t}function M(){s.addVisible(!1),s.activeEditRow(-1),a.removeAll()}function _(t){return s.collection.indexOf(e.utils.arrayFilter(s.collection(),function(e){return e.id===t.id})[0])}function D(){var e=s.activeEditRow();return e>=0?s.collection()[e]:s.addObject}function P(e){return s.collection()[e]}function H(e){typeof e.addVisible=="boolean"&&s.addVisible()!==e.addVisible&&(s.addVisible(e.addVisible),s.updateActiveEditRow(-1)),typeof e.activeEditRow=="number"?s.updateActiveEditRow(e.activeEditRow):t.log("collectionViewModel - updateState - no known settings (addVisible, activeEditRow) passed, state not changed")}function B(e){e>=0&&s.collection().length>=e+1&&e!==s.activeEditRow()?s.newActiveEditRow(e):t.log("collectionViewModel - updateActiveEditRow - passed index/id does not exist \r\n passed id:"+e+"\r\n")}function j(e,t){if(s.activeEditRow()==_(e)){R(null,null),t.stopPropagation();return}s.activeEditRow()!=-1&&s.activeEditRow.attachInputsToRoot!=_(e)&&R(null,null),s.copyObservableProperties(e,g),s.activeEditRow(_(e)),s.addVisible(!1)}function F(e,t){var r=q(e);typeof n.onCommit=="function"&&n.onCommit.call({item:e,collection:s.collection}),r&&(s.activeEditRow(-1),a.valueHasMutated())}function I(e){if(typeof e=="undefined")throw"collectionViewModel validateEdit expected data";var t=!0;return typeof n.validations.validateEdit!="undefined"&&(t=s.validations.validateEdit(e,s)),t}function q(e){if(typeof e=="undefined"){if(!(s.activeEditRow()>=0))throw"collectionViewModel validateAndShowEdit expected data";var e=s.getActiveEditRowObject()}var t=I(e);return s.bubbleErrors(!t),t}function R(e,t){var n=["relevant","parentItemViewModel","inputs"];typeof l.ignoreFieldsOnCancel!="undefined"&&Array.isArray(l.ignoreFieldsOnCancel)&&(n=n.concat(l.ignoreFieldsOnCancel)),g.resetValidation&&(g.resetValidation(),s.collection()[s.activeEditRow()]!==undefined&&s.collection()[s.activeEditRow()].resetValidation()),s.collection()[s.activeEditRow()]!==undefined&&s.copyObservableProperties(g,s.collection()[s.activeEditRow()]),g.resetValidation?et(g,!0,n):et(g,!0,n),s.activeEditRow(-1),s.bubbleErrors(!1)}function U(e,t){s.activeEditRow()>=0&&s.cancelEdit(),s.addVisible(!0),s.establishCanAdd()}function z(){var e=this,t=V();if(t){s.bubbleErrors(!1);var r=O(),i=e.createItemViewModel(r);return s.copyObservableProperties(v,i),a.push(i),Y(),typeof n.onCommit=="function"&&n.onCommit.call({item:i,collection:a}),this.addVisible(!1),i}return!1}function W(e,t){var n=this,r=!0;if(typeof t!="undefined"){var i=typeof t=="function"?t:t.on;r=i.call({},e,event)}return Q.fcall(function(){return r}).catch(function(e){console.log("commitEdit error: "+e)})}function X(e,t){if("success"in e||"after"in e){var n=e.success||e.after;n.call({},t,event)}}function V(){var e=J();return e||s.bubbleErrors(!0),e}function J(){var e=!0;return typeof n.validations.validateAdd!="undefined"&&(e=s.validations.validateAdd(v,s)),e}function K(){s.addVisible(!1),s.bubbleErrors(!1),Y()}function G(e,t){a.remove(e),s.activeEditRow(-1)}function Y(e,t){var n=["relevant","parentItemViewModel","inputs"];typeof l.ignoreFieldsOnClear!="undefined"&&Array.isArray(l.ignoreFieldsOnClear)&&(n=n.concat(l.ignoreFieldsOnClear)),typeof s.addObject.resetValidation=="function"&&s.addObject.resetValidation(),v.resetValidation?et(v.fields,!0,n):et(v,!0,n)}function Z(n,r){var i=this;try{Object.keys(n.fields).forEach(function(t){var i=n.fields[t],o=r.fields[t];e.isObservable(i)?o(i()):i.type==="collectionViewModel"?o.fromJSON(i.toJSON()):s.copyObservableProperties(n[t],r[t])})}catch(o){t.logError("collection view model - copyObservableProperties","copyObservableProperties",{error:o})}}function et(n,r,i){var s="";n.id&&(s=n.id),t.log("collectionViewModel - running clearObservableProperties on id: "+s),typeof r=="undefined"&&(r=!1),Object.keys(n).forEach(function(t,s){var o=i.some(function(e){return e===t}),u=Object.keys(l).some(function(e){return l[e]==n[t]});if(!o&&!u){var a=n[t];e.isObservable(a)&&!e.isComputed(a)?Array.isArray(a())?n[t]([]):n[t](""):typeof a!="undefined"?a.type==="collectionViewModel"&&a.removeAll():!r&&typeof n[t]=="object"&&et(n[t])}})}function tt(e){var t=this,e=t.getIdPrefix(),n=p+1,r=e+n;return t.updateMaxId(n),r}function nt(e){if(!e){if(!!n.itemViewModelIdPrefix)var e=n.itemViewModelIdPrefix}else var e=e;var t=e?e+"_":"";return t}function rt(e){if(!(e>p))throw"unexpected collectionViewModel - update id failed";p=e}function it(e){p=-1}function st(e){return p}function ot(e,t){return e+"-"+t}function ut(n,r){var i=this;try{if(c)var o=$.extend({},n,l);else var o=n;if(typeof r!="undefined"&&r!==null){o.id=r;var a=i.getIdPrefix(),f=String(o.id).substring(a.length,o.id.length);if(!isNaN(f)&&!!f){var h=Number(f);h===p?t.log("collectionViewModel - duplicate id detected"):h>p&&i.updateMaxId(h)}}else o.id=i.createNewId();o.inputs=l,o.settings={isAdd:r==="add"};var d=new(Function.prototype.bind.call(u,o,o,this));if(typeof d=="undefined")throw"itemVm undefined";typeof d.inputs=="undefined"&&(d.inputs=o),typeof d.relevant=="undefined"&&(d.relevant=e.observable(!0));if(typeof d.errors!="undefined")for(var v=0;v0&&i!=s){var l=u.getQuestionGroupByKey(n[f].node);u.resetSubsequentQuestions(l.ordinal())}return n}}),define("shared/services/eventHandler",["durandal/app","shared/services/uiHelper"],function(e,t){function i(r,i){var s=Object.keys(n.events).some(function(e){return r==n.events[e]});if(!s)throw"BaseInterface does not recognise the event name: "+r;var o=t.getAppName(),u=o+":"+r;e.trigger(u,i)}var n={events:{initialised:"calculatorinitialised",usage:"usage",error:"error",calculatorCancel:"calculatorcancel",calculatorSave:"calculatorsave"}},r={constants:n,raiseEvent:i};return r}),define("shared/services/formattingHelper",["shared/services/validator","shared/services/common"],function(e,t){function r(n,o,u,a){o=ko.unwrap(o),u=ko.unwrap(u);switch(o){case"string":n=s(n);break;case"textField":break;case"financialYr":n=t.formatFinYear(n,"yyyy - yy");break;case"selectedOption":e.isBlank(u)||(u==="yesno"?n=s(n):n=i(a,u,n));break;case"horizontalList":Array.isArray(n)&&(n.sort(),n=n.join(", "));break;case"dollarWithCents":n=t.currencyFormatter(e.removeThousandSeperator(n),!0,!1,!1);break;case"wholeDollar":n=t.currencyFormatter(e.removeThousandSeperator(n),!1,!1,!1);break;case"percentage":t.createBigNumber(n).greaterThan(1)&&(n=t.createBigNumber(n).dividedBy(100).toNumber()),n=t.percentageFormatter(n,2);break;case"percentageWithDecimals":t.createBigNumber(n)&&(n=t.createBigNumber(n).dividedBy(100).toNumber()),n=t.percentageFormatter(n,2);break;case"financialYrList":Array.isArray(n)&&(n=n.map(function(e){return typeof e=="number"?r(e,"financialYr"):e==="nota"?"None of the above":e}),n=r(n,"horizontalList"));break;case"textBoxNum":n=t.currencyFormatter(n,!1,!0,!1);break;case"tfn":n=n.split(""),n.length>6&&(n.splice(3,0," "),n.splice(7,0," ")),n=n.join("");break;case"abn":n=n.split(""),n.length>8&&(n.splice(2,0," "),n.splice(6,0," "),n.splice(10,0," ")),n=n.join("");break;case"iisa":n="IR"+n;break;case"checkBoxTicked":e.isBlank(u)||u==="yesno"&&(n=n===!0?"Yes":"No");break;case"timeInMins":n+=" mins";break;default:}return n}function i(t,n,r){var i=r;try{var s=require.s.contexts._.defined[t+"/refdata/"+n];if(!e.isBlank(s)&&typeof s=="object"){var o=s.values.find(function(e){return e.key===r?!0:!1});i=o.value}}catch(u){}return i}function s(t){var n=t;return!e.isBlank(t)&&typeof t=="string"&&(t.charAt(0).match(/^\d/)||(n=t.charAt(0).toUpperCase()+t.slice(1))),n}var n={formatValue:r,getRefDataValueFromKey:i,capitaliseFirstLetter:s};return n}),define("shared/services/jqmUtil",[],function(){return{triggerCreate:function(e){$(e).trigger("create")}}}),define("shared/services/listViewModel",["knockout","shared/services/logger","shared/services/validator","shared/services/common"],function(e,t,n,r){return function i(n){function c(t,n){var i={};if(typeof n=="undefined")var n=!1;return r.forEach(function(r){var s=e.unwrap(t.fields[r.propertyName].relevant);r.collectionViewModel!==undefined?s?i[r.propertyName]=t.fields[r.propertyName].toJS({preserveAdd:n}):i[r.propertyName]=[]:s?r.computedField?i[r.propertyName]=e.utils.unwrapObservable(t[r.propertyName]):i[r.propertyName]=e.utils.unwrapObservable(t.fields[r.propertyName]):i[r.propertyName]=""}),typeof t.id!="undefined"&&(i.id=e.unwrap(t.id)),typeof t.editState!="undefined"&&(i.editState=e.unwrap(t.editState)),t.relevant&&(i.relevant=e.unwrap(t.relevant)),i}function h(t,n,s){var o=this,u={},a=e.observable();try{n!=undefined&&s!=undefined&&(u={parentItemViewModel:{fields:n,inputs:s}});if(t.id==="add")i.addObject=p(t.addId,n,s),d(t,i.addObject),a=i.addObject;else{var f=b();u.parentItemViewModel!=undefined&&(f.parentItemViewModel=u.parentItemViewModel);var l=!t.id&&typeof t.id!="number"?null:t.id,a=o.createItemViewModel(f,l,!1);d(t,a),r.forEach(function(t){t.computedField&&(a.fields[t.propertyName]=a[t.propertyName],a.fields[t.propertyName].relevant=e.observable(!0))}),i.addVisible(!1)}}catch(c){throw"listViewModel - fromJS - error in mapping itemJS \r\n error:"+c+"\r\n data:"+JSON.stringify(t)}return a}function p(t,n,s){try{var o=this,u={};n!=undefined&&s!=undefined&&(u={parentItemViewModel:{fields:n,inputs:s}});var a=b();u.parentItemViewModel!=undefined&&(a.parentItemViewModel=u.parentItemViewModel);var f=i.createItemViewModel(a,"add",!0);r.forEach(function(t){t.computedField&&(f.fields[t.propertyName]=f[t.propertyName],f.fields[t.propertyName].relevant=e.observable(!0))}),f.addId=t,i.addObject=f,i.addVisible(!0)}catch(l){throw"listViewModel - createAddObject - error creating Add Object \r\n error:"+l+"\r\n"}return f}function d(e,t){try{var n=t.fields;r.forEach(function(t){var t=t.propertyName;if(t in e){var r=e[t];Array.isArray(r)&&n[t].type==="collectionViewModel"?n[t].fromJS(r):n[t](r)}})}catch(i){console.log(i)}}function v(e,t){try{var n=t.fields;r.forEach(function(t){var t=t.propertyName;if(t in e){var r=e[t];Array.isArray(r)&&n[t].type==="collectionViewModel"?n[t].fromJS(r):n[t]().toString().length===0&&n[t](r)}})}catch(i){console.log(i)}}function m(){return e.computed(function(){if(this.bubbleErrors()){if(this.addVisible())return this.addObject.page_error?this.addObject.page_error():(t.log("list vm - page_error not on add object"),!1);if(this.item()!==undefined)return this.item().page_error()}return!1},this)}function g(e){var n=this.errors;if(e)if(typeof this.addObject.errors!="undefined")for(var r=0;r0){var r=e.utils.arrayFilter(t,function(e){return e.id!=="add"&&e.id!=="editState"});r.length>0&&(n=(parseInt(r[r.length-1].id)+1).toString())}self.maxId=n}return n}function D(e,t){e.editState="delete",o(e)}function P(n,r,o){var f=this;try{if(a)var l=$.extend({},n,u);else var l=n;typeof r!="undefined"&&r!==null&&(l.id=r),l.inputs=u,l.settings={isAdd:o};var c=new(Function.prototype.bind.call(s,l,l,this));if(typeof c=="undefined")throw"itemVm undefined";typeof c.inputs=="undefined"&&(c.inputs=l),typeof c.relevant=="undefined"&&(c.relevant=e.observable(!0)),typeof c.editState=="undefined"&&(c.editState="");if(typeof c.errors!="undefined")for(var h=0;h1){var o=s[1].replace(/[ :'"]/g,""),u=e.datacontext.getQuestionByKey(o),a,f=u.value();if(u){if(i.indexOf("textBox")>-1||i.indexOf("currency")>-1)a=$(this).find("span[data-part='questionLabelText']");else if(i.indexOf("verticalRadio")>-1){a=$(this).find("span[data-part='questionText']");var l=$("label[for*="+o+f+"]");l.length>0&&(f=l.html())}else i.indexOf("checkBox")>-1&&(a=$(this).find("span[data-part='label']"),f=f===!0?"Yes":"No");var c=$(a).clone(!0);c.find("span.icon-external-link").each(function(){$(this).remove()}),c.find("a").each(function(){$(this).replaceWith($(this).text())}),a=c.html()}a&&f&&t.push({questionText:a,value:f})}}}}),t}function u(e){var t=this;typeof e=="undefined"&&(e={}),typeof e.reportTag=="undefined"&&(e.reportTag="#report"),typeof e.responseTag=="undefined"&&(e.responseTag="#responses"),typeof e.personaliseResultsTag=="undefined"&&(e.personaliseResultsTag="#personaliseResults");var n=$(e.reportTag).clone(!1);if(n){var r=t.getResponses();if(r&&r.length>0){var i='

Summary of responses

';for(var s=0;s",i=i+""}i+="
QuestionResponse
":i+=">",i=i+r[s].questionText+""+(r[s].value===!0?"Yes":r[s].value)+"
",n.find(e.responseTag).html(i)}var a=n.find(e.personaliseResultsTag);a.length>0&&a.find("input[type=text]").each(function(){$(this).replaceWith("")})}return n}function a(e){var t=this;t.getQuestionTextFunction=l,t.relevancyHelper=!1,typeof e=="undefined"&&(e={}),typeof e.reportTag=="undefined"&&(e.reportTag="#report"),typeof e.responseTag=="undefined"&&(e.responseTag="#responses"),typeof e.personaliseResultsTag=="undefined"&&(e.personaliseResultsTag="#personaliseResults"),typeof e.getQuestionTextFunction=="function"&&(t.getQuestionTextFunction=e.getQuestionTextFunction),typeof e.getQuestionValueFunction=="function"&&(t.getQuestionValueFunction=e.getQuestionValueFunction),typeof e.relevancyHelper!="undefined"&&(t.relevancyHelper=e.relevancyHelper),typeof e.questions!="undefined"&&(t.questions=e.questions),typeof e.preProcessHTMLFunction=="function"&&(t.preProcessHTMLFunction=e.preProcessHTMLFunction),typeof e.postProcessHTMLFunction=="function"&&(t.postProcessHTMLFunction=e.postProcessHTMLFunction);var n=$(e.reportTag).clone(!1);if(n){typeof t.preProcessHTMLFunction!="undefined"&&(n=t.preProcessHTMLFunction(n));var r=p(t.datacontext,t.getQuestionTextFunction,t.relevancyHelper,t.questions,t.getQuestionValueFunction);r&&r.length>0&&(responses=t.formatResponses(r),n.find(e.responseTag).html(responses));var i=n.find(e.personaliseResultsTag);i.length>0&&i.find("input[type=text]").each(function(){$(this).replaceWith("")}),typeof t.postProcessHTMLFunction!="undefined"&&(n=t.postProcessHTMLFunction(n))}return n}function f(e){var t=Date(),n="

Summary of responses

"+t+'
'+"";for(var r=0;r",n=n+""}return n+="
QuestionResponse
":n+=">",n=n+e[r].questionText+""+e[r].value+"
",n}function l(e,t,r){var i="";return e.printFriendly&&(e.printFriendly.questionText?i=n.unwrap(e.printFriendly.questionText):e.name&&(i=e.name)),i}function c(e){typeof e=="undefined"&&(e={}),typeof e.reportTag=="undefined"&&(e.reportTag="#report"),typeof e.personaliseResultsTag=="undefined"&&(e.personaliseResultsTag="#personaliseResults");var t=$(e.reportTag).clone(!1);if(t){var n=t.find(e.personaliseResultsTag);n.length>0&&n.find("input[type=text]").each(function(){$(this).replaceWith("")})}return t}function h(e){return String(e).replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(//g,">")}function p(t,n,i,s,o){var u=[],a=t.appconfig.appName,f=typeof s=="undefined"?t.getQuestions():s,l=[],c=1;return f.forEach(function(h){if(!ko.isObservable(h.printFriendly)&&(t.getQuestionRelevancy(h.key())||typeof s!="undefined"))if(h.type()!=="adjodal"&&h.type()!=="collection"||!ko.isObservable(h.printFriendly.collectionViewModelName))if(h.type()==="checkBoxGroup")checkboxPrint=d(h,a,n),checkboxPrint&&(u=u.concat(checkboxPrint));else if(h.type()==="subHeading"){var g,y=ko.isObservable(h.printFriendly.refdatakey)?h.printFriendly.refdatakey():"",b=ko.isObservable(h.printFriendly.format)?h.printFriendly.format():"",E=h.value();if(!e.isBlank(E)){E=r.formatValue(h.value(),b,y,a),g=E,E=" ";var S={questionText:g,value:E};u.push(S)}}else if(ko.isObservable(h.printFriendly.group)){var x=w(l,h,f,a,n);x!==undefined&&(u=u.concat(x))}else if(h.type()==="textBoxGroup"){var g,b=ko.isObservable(h.printFriendly.format)?h.printFriendly.format():"",E=h.value();e.isBlank(E)||(E=r.formatValue(h.value(),b),g=n(h,a,null));if(g&&E&&typeof i.isFieldRelevant(h.key())!="undefined"&&i.isFieldRelevant(h.key())){var S={questionText:g,value:E};u.push(S)}}else{var g,y=ko.isObservable(h.printFriendly.refdatakey)?h.printFriendly.refdatakey():"",b=ko.isObservable(h.printFriendly.format)?h.printFriendly.format():"",E=h.value();if(!e.isBlank(E)){if(typeof y!="undefined"&&y!==""&&typeof h.printFriendly.refdataType!="undefined"){if(h.printFriendly.refdataType()==="function"){var T=require.s.contexts._.defined[a+"/"+h.questiongroup.key()];T[h.printFriendly.refdatakey()]().forEach(function(e){if(e.key()===h.value())return E=e.value()})}}else E=r.formatValue(h.value(),b,y,a);g=n(h,a,null),h.printFriendly.questionValueReplacement&&h.printFriendly.questionValueReplacement()===!0&&(E=o(h,a,null))}if(g&&E){var S={questionText:g,value:E};u.push(S)}}else{var p;i?p=v(h,a,n,i,null,c,o):p=m(h,a,n,c,o),p&&(u=u.concat(p))}}),u}function d(t,r,i){var s=[];if((Array.isArray(t.value())||t.printFriendly.refdataValue()!=="")&&n.isObservable(t.printFriendly.refdataType)){var o=t.printFriendly.refdatakey(),u=[],a=t.value();if(t.printFriendly.refdataType()==="function"||t.printFriendly.refdataValue()!==""){if(t.key()!==t.questiongroup.key())var f=require.s.contexts._.defined[r+"/"+t.questiongroup.key()];else var f=require.s.contexts._.defined[r+"/"+t.key()];!e.isBlank(f)&&typeof f=="object"&&(typeof f[o]=="function"&&(u=f[o]()),t.printFriendly.refdataValue!=undefined&&t.printFriendly.refdataValue()!==""&&a===""&&(a=n.unwrap(f[t.printFriendly.refdataValue()])))}else if(t.printFriendly.refdataType()==="file"){var l=require.s.contexts._.defined[r+"/refdata/"+o];!e.isBlank(l)&&typeof l=="object"&&(u=l.values)}if(u.length>0){var c={questionText:i(t,r,null),value:""};s.push(c),u.forEach(function(e){var t=a.indexOf(n.unwrap(e.key))!==-1?"Yes":"No",r={questionText:" > "+(n.unwrap(e.printValue)!==undefined&&n.unwrap(e.printValue)!==""?n.unwrap(e.printValue):n.unwrap(e.value)),value:t};s.push(r)})}return s}}function v(t,n,r,s,o,u,a){var f,l=ko.unwrap(t.printFriendly.collectionViewModelName);if(l){var c;if(t.relevantValue){var h=t.relevantValue();c=JSON.parse(h)}else Array.isArray(o)&&(c=o);if(!e.isBlank(c)){var p=require.s.contexts._.defined[n+"/"+l];if(p!==undefined){f=[];var d=0;c.forEach(function(e){var o=y(t,d,n,e,r),l={questionText:""+o+"",value:""};d+=1,u>1&&(l.class=i,l.style="--depth: "+(u-1)),f.push(l),p.fields.forEach(function(t){if(t.printFriendly&&s.isFieldRelevant(t.propertyName,e))if(t.printFriendly.format==="adjodal"){var i=e[t.propertyName];if(Array.isArray(i)&&i.length>0){u+=1;var o=v(t,n,r,s,i,u,a);o.forEach(function(e){e.questionText=e.questionText,e.class=e.class,e.style=e.style}),f=f.concat(o)}}else{var o=b(t,n,e,r,u,a);o&&f.push(o)}})})}}}return f}function m(t,r,s,o,u){var a=[];if(n.isObservable(t.printFriendly.collectionViewModelName)&&!e.isBlank(t.printFriendly.collectionViewModelName())){var f=t.printFriendly.collectionViewModelName();try{var l=require.s.contexts._.defined[r+"/"+f];if(l!==undefined&&l.relevant())for(var c=0;c0){var d={questionText:""+h+"",value:""};o>1&&(d.class=i,d.style="--depth: "+(o-1)),a.push(d),a=a.concat(p)}}}catch(v){}}return a}function g(t,n,r,i,s,o){var u=[];for(var a=0;a0){var f={questionText:t,value:"","class":i,style:"--depth: 1"};o.push(f),o=o.concat(a),addedSubGroups.push(t)}}else{var l=E(e,r,s,1);l!==undefined&&o.push(l)}});if(o.length>0){var f={questionText:u,value:""};o.unshift(f)}return e.push(u),o}function E(t,n,s,o){var u=ko.isObservable(t.printFriendly.refdatakey)?t.printFriendly.refdatakey():"",a=ko.isObservable(t.printFriendly.format)?t.printFriendly.format():"",f,l=t.value();e.isBlank(l)||(l=r.formatValue(t.value(),a,u,n),f=s(t,n,null));var c="--depth: "+o;if(f&&l){var h={questionText:f,value:l,"class":i,style:c};return h}}var i="indent",s=function(e){var t=this;t.datacontext=e,t.getResponses=o,t.printResponses=u,t.printResponsesViaDataContext=a,t.printPersonaliseResults=c,t.formatResponses=f};return s}),define("shared/services/saveservice",["services/logger"],function(e){function n(n,r){$.ajax({url:t+"/SaveForm?id="+n,type:"POST",contentType:"application/json",data:ko.toJSON(r),success:function(t){return e.log("Form saved",null,"saveservice",!1),t},error:function(t,n,r){return e.logError(n,"saveservice",{error:r}),null}})}function r(n,r){return Q($.ajax({url:t+"/SubmitForm?id="+n,type:"POST",contentType:"application/json",data:ko.toJSON(r),success:function(t){return e.log("Form submited",null,"saveservice",!1),t},error:function(t,n,r){return e.logError(n,"saveservice",{error:r}),null}}))}function i(n,r){return Q($.ajax({url:t+"/DeleteForm?id="+n,type:"DELETE",contentType:"application/json",data:ko.toJSON(r),success:function(t){return e.log("Form deleted",null,"saveservice",!1),t},error:function(t,n,r){return e.logError(n,"saveservice",{error:r}),null}}))}function s(n,r){return Q($.ajax({url:t+"/GetForm?id="+n,success:function(t){return e.log("saved form found",null,"saveservice",!1),t},statusCode:{404:function(){return null}}})).then(function(e){return r(e)})}var t="/breeze/save";return{saveForm:n,getForm:s,submitForm:r,deleteForm:i}}),define("shared/services/subViewRuleEngine",[],function(){}),define("shared/services/widgetHelper",["jquery"],function(e){function n(t){var n=this;this.hasHadFocus&&e(t).find("input").one("blur",function(e){n.hasHadFocus(!0)})}function r(e,t){if(!t)throw"getLabelForControlKey- expect type";var n="",t=t.toUpperCase();switch(t){case"TEXTBOX":n="lbl";break;case"CHECKBOX":case"DROPDOWNLIST":case"VERTICALRADIO":n="lbl-"}return n+e}function i(e,t){if(!t)throw"getLabelForControlKey- expect type";var n="",t=t.toUpperCase();switch(t){case"TEXTBOX":n="lbl";break;case"CHECKBOX":case"DROPDOWNLIST":case"VERTICALRADIO":n="vrb-question-name-"}return n+e}var t={attachFocusHandler:n,getLabelForControlKey:r,getNameForControlKey:i};return t}),define("shared/viewmodels/questions",["jquery","durandal/composition","durandal/activator","services/logger","durandal/app","plugins/router","knockout","shared/services/validator","shared/services/common","moment","shared/services/hyperlinkProvider","shared/services/altTextProvider","shared/services/errorMessageProvider","shared/services/refdataEngine","shared/services/baseViewModel","module"],function(e,t,n,r,i,s,o,u,a,f,l,c,h,p,d,v){function S(){T();if(!k())return b.navigate(m,"next")}function x(){return T(!0),b.navigateBack(m)}function T(){E.childModules.forEach(function(e){var t=require(e.name);t.resetValidation&&t.resetValidation()})}function N(){var e=this,t=!1;for(var n=0;n=0){var n=e(n);n.replaceWith(n.children())}},n}),define("shared/widgets/adjodal/viewmodel",["jquery","knockout","durandal/app","shared/services/validator","shared/services/common","shared/services/constants","shared/services/logger","shared/services/uiHelper","module"],function(e,t,n,r,s,o,u,a,f){function c(e,t,n){function f(n){u.log("adjodal - enableAdd - running successHandler function (success)");if(s.isDefined(n,"handlers.enableAdd.success")||s.isDefined(n,"handlers.enableAdd.after")){var r=n.handlers.enableAdd.success||n.handlers.enableAdd.after;r.call({data:e,e:t,collectionViewModel:n.collectionViewModel,item:n.collectionViewModel.addObject,panelId:n.addPanelId,canCommit:o},e,t)}}var r=this,n=typeof n=="undefined"?!1:n;if(this.collectionViewModel.addVisible()&&!n){d.call(this,e);return}this.clearErrorSubscriptions();var i;"enableAdd"in this.handlers&&(typeof this.handlers.enableAdd=="function"?i=this.handlers.enableAdd:typeof this.handlers.enableAdd.on=="function"&&(i=this.handlers.enableAdd.on));var o=Q.fcall(function(){return!0});typeof i=="function"&&(u.log("adjodal - enableAdd - running canCommit function (on)"),o=i.call({data:e,e:t,collectionViewModel:this.collectionViewModel,item:this.collectionViewModel.addObject,panelId:this.addPanelId},e,t),typeof o=="undefined"?o=!0:typeof o=="boolean"&&(o=Q.reject("noCommit")));var a=function(){return this.collectionViewModel.enableAdd(),f(this),!0}.bind(this);Q.when(o).then(a).catch(function(e){e!=="noCommit"})}function h(t,r){function l(e){if("success"in e.handlers.commitAdd||"after"in e.handlers.commitAdd){var n=e.handlers.commitAdd.success||e.handlers.commitAdd.after;n.call({data:t,e:r,collectionViewModel:e.collectionViewModel,item:e.collectionViewModel.addObject,newItem:e.newItem,panelId:e.addPanelId,canCommit:o},t,r)}}var i=this,s=this.collectionViewModel.validateAndShowAdd();if(s){var o=!0,u="commitAdd"in this.handlers;if(u){var f=typeof this.handlers.commitAdd=="function"?this.handlers.commitAdd:this.handlers.commitAdd.on;o=f.call({data:t,e:r,collectionViewModel:this.collectionViewModel,item:this.collectionViewModel.addObject,panelId:this.addPanelId},t,r)}Q.fcall(function(){return o}).then(function(t){var r=i.collectionViewModel.commitAdd();u&&l(e.extend(i,{newItem:r}));var s=a.getAppName();n.trigger(s+":adjodal:update")}).catch(function(e){})}else i.setErrorSubscriptions(i.addPanelId)}function p(e,t){function l(n){if("success"in n.handlers.remove||"after"in n.handlers.remove){var r=n.handlers.remove.success||n.handlers.remove.after;r.call({data:e,e:t,collectionViewModel:n.collectionViewModel,item:e,panelId:n.getCollectionPanelId(e),canCommit:s},e,t)}}var n=this,r,e,i;e.vm?(r=e.vm,i=e.vm.collectionViewModel,e=e.item):(r=ko.contextFor(t.target).$parents[1],i=ko.contextFor(t.target).$parent);var s=Q.fcall(function(){return!0}),o="remove"in r.handlers;if(o){var u=typeof r.handlers.remove=="function"?r.handlers.remove:r.handlers.remove.on;if(typeof u!="undefined"){s=u.call({data:e,e:t,collectionViewModel:i,item:e,panelId:r.getCollectionPanelId(e),canCommit:s},e,t);if(typeof s!="undefined"&&!s.then){var a=s;s=Q.fcall(function(){return a})}}}var f=function(){i.remove(e),l(r)}.bind(n);Q.when(s,f)}function d(e,t){function u(n){if("success"in n.handlers.cancelAdd||"after"in n.handlers.cancelAdd){var r=n.handlers.cancelAdd.success||n.handlers.cancelAdd.after;r.call({data:e,e:t,collectionViewModel:n.collectionViewModel,item:n.collectionViewModel.addObject,panelId:n.addPanelId,canCommit:i},e,t)}}var n=this,r="cancelAdd"in this.handlers,i=Q.fcall(function(){return!0});if(r){var s=typeof this.handlers.cancelAdd=="function"?this.handlers.cancelAdd:this.handlers.cancelAdd.on;typeof s=="function"&&(i=Q.fcall(function(){return i=s.call({data:e,e:t,collectionViewModel:e.collectionViewModel,item:e.collectionViewModel.addObject,panelId:e.addPanelId,canCommit:i},e,t)}).catch(function(e){throw"collectionViewModel - cancelAdd attempting to call canCommit error: "+e}))}var o=function(){var n=this.getPanelError(this.addPanelId);n(!1),this.collectionViewModel.cancelAdd(e,t),this.clearErrorSubscriptions(),r&&u(this)}.bind(this);i.then(o)}function v(e,t){var n=ko.contextFor(t.target).$parents[1],r=n.collectionViewModel;if(r.activeEditRow()==r.getObjectOrdinal(e)){r.cancelEdit(null,null),t.stopPropagation();return}if(r.activeEditRow()!=-1&&r.activeEditRow.attachInputsToRoot!=r.getObjectOrdinal(e)){r.cancelEdit(null,null);return}n.collectionViewModel.activeEditRow()>=0?y.call(this,e,n,t):m.call(this,e,n,t)}function m(t,n,r){function a(e){if("success"in e.handlers.enableEdit||"after"in e.handlers.enableEdit){var n=e.handlers.enableEdit.success||e.handlers.enableEdit.after;n.call({data:t,e:r,collectionViewModel:e.collectionViewModel,item:t,canCommit:o},t,r)}}var i=this;if(!n.handlers)var n=ko.contextFor(r.target).$parents[1];var s="enableEdit"in n.handlers,o=Q.fcall(function(){return!0});if(s){var u=typeof n.handlers.enableEdit=="function"?n.handlers.enableEdit:n.handlers.enableEdit.on;typeof u!="undefined"&&(o=u.call({data:t,e:r,collectionViewModel:n.collectionViewModel,item:t},t,r),typeof o=="undefined"||o==1?o=Q.fcall(function(){return!0}):o==0&&(o=Q.reject("noCommit")))}o.then(function(){n.clearErrorSubscriptions(),n.collectionViewModel.enableEdit(t,r);var i=n.getCollectionPanelId(t),o=e("#"+i),u=e("#"+n.collectionContainerId+" .collapse.in").not(o);if(u.length>0){u.collapse("hide");var f=u[0].id}o.length>0&&o.collapse("show"),s&&a(n)}).catch(function(e){})}function g(e,t){function h(r){n.trigger(":adjodal:save");if("success"in r.handlers.commitEdit||"after"in r.handlers.commitEdit){var i=r.handlers.commitEdit.success||r.handlers.commitEdit.after;i.call({data:e,e:t,collectionViewModel:r.collectionViewModel,panelId:r.getCollectionPanelId(e),item:e,canCommit:o},e,t)}}var r=this,i=ko.contextFor(t.target).$parents[1],s="commitEdit"in i.handlers,o=Q.fcall(function(){return!0});if(s){var u=typeof i.handlers.commitEdit=="function"?i.handlers.commitEdit:i.handlers.commitEdit.on;if(typeof u!="undefined"){o=u.call({data:e,e:t,collectionViewModel:i.collectionViewModel,item:e,panelId:i.getCollectionPanelId(e),canCommit:o},e,t);if(!o.then){var f=o;o=Q.fcall(function(){return f})}}}var l=function(){var r=ko.contextFor(t.target).$parents[1];r.collectionViewModel.commitEdit(e);var i=a.getAppName();n.trigger(i+":adjodal:update"),s&&h(r)}.bind(this),c=i.getCollectionPanelId(e);i.setErrorSubscriptions.call(i,c),o.then(l).catch(function(e){})}function y(e,t){function f(n){if("success"in n.handlers.cancelEdit||"after"in n.handlers.cancelEdit){var r=n.handlers.cancelEdit.success||n.handlers.cancelEdit.after;r.call({data:e,e:t,collectionViewModel:n.collectionViewModel,item:e,panelId:n.getCollectionPanelId(e),canCommit:s},e,t)}}var n=this,r=ko.contextFor(t.target).$parents[1],i="cancelEdit"in r.handlers,s=Q.fcall(function(){return!0});if(i){var o=typeof r.handlers.cancelEdit=="function"?r.handlers.cancelEdit:r.handlers.cancelEdit.on;s=o.call({data:e,e:t,collectionViewModel:r.collectionViewModel,panelId:r.getCollectionPanelId(e),item:e,canCommit:s},e,t);if(!s.then){var u=s;s=Q.fcall(function(){return u})}}var a=function(){var n=ko.contextFor(t.target).$parents[1],r=n.getCollectionPanelId(e),s=n.getPanelError(r);s(!1),n.collectionViewModel.cancelEdit(),n.clearErrorSubscriptions(),i&&f(n)}.bind(this);s.then(a)}function b(e,t){var n={},r=ko.contextFor(t.target).$parents[1]}function w(t){var n=this,r=this.getPanelError(t);r(!1);var i=this.collectionViewModel.page_error(),s=this.collectionViewModel.activeEditRow();!i&&s>-1&&(i=n.collectionViewModel.collection()[s].page_error());if(i){var o=ko.unwrap(this.collectionViewModel.errors);o.forEach(function(e){if(ko.isObservable(e.visible)){var t=e.visible.subscribe(function(e){if(e==0){var t=ko.unwrap(this.vm.collectionViewModel.errors).some(function(e){return ko.toJS(e.visible)});t||this.errorVisible(!1)}},{vm:n,errorVisible:r});n.errorsSubscriptions.push(t)}}),r(this.collectionViewModel.page_error());var u=e("#"+t+" input.error, "+"#"+t+' input[aria-invalid="true"],'+"#"+t+" select.error,"+"#"+t+" button.error, "+"#"+t+" .invalidAdjodalControl");u.length>0&&e(u[0]).focus()}else this.clearErrorSubscriptions(),r(!1)}function E(){this.errorsSubscriptions.forEach(function(e){e.dispose()}),this.errorsSubscriptions=[]}function S(){var e=this,t=[],n=this.collectionViewModel.fields.filter(function(e){return e.summaryField});for(i=0;i!=n.length;i++){var s=n[i],o=s.summaryField;typeof o.fn=="function"&&(o=C(s,this.settings));if(o===!0){var u={name:n[i].name,style:n[i].cssClass!==undefined?n[i].cssClass:""};n[i].width?r.isValidInteger(n[i].width)?u.width=n[i].width.toString()+"%":u.width=n[i].width:u.width="",t.push(u)}}return t}function T(e){var t=this,n,r=this.panelErrors().filter(function(t){return t.id==e});if(r.length>0)n=r[0].visible;else{var i={id:e};i.visible=ko.observable(!1),t.panelErrors.push(i),n=i.visible}return n}function N(n){var o=[],u=this.collectionViewModel.fields.filter(function(e){return e.summaryField});for(i=0;i!=u.length;i++){var a=u[i],f=a.summaryField;typeof f.fn=="function"&&(f=C(a,this.settings));if(f===!0){var l=e(""+t.unwrap(a.name)+"").text();if(a.headerText)var c=n[a.headerText]||n.fields[a.headerText],h=ko.mapping.fromJS(ko.mapping.toJS(c));else var p=n[a.propertyName]||n.fields[a.propertyName],h=ko.mapping.fromJS(ko.mapping.toJS(p));if(a.formatSpecification!==undefined&&a.formatSpecification.type!==undefined){var d=ko.observable(!0);n[a.propertyName].visible!==undefined&&d(n[a.propertyName].visible());if(!r.isBlank(h())&&d()==1){if(a.formatSpecification.type=="refdata"){if(a.formatSpecification.refDataList===undefined)throw"adjodal widget - formatSpecification - refDataList not specified. heading: "+l;if(a.formatSpecification.displayValueField===undefined)throw"adjodal widget - formatSpecification - displayValueField not specified. heading: "+l;var v="",m=ko.toJS(a.formatSpecification.refDataList);m.forEach(function(e){if(e.key==h()){if(e[a.formatSpecification.displayValueField]==undefined)throw"adjodal widget - formatSpecification - displayValueField is not defined in refDataList. Heading: "+l;v=e[a.formatSpecification.displayValueField]}}),h(v)}else if(a.formatSpecification.type=="currency")h(s.currencyFormatter(h()));else if(a.formatSpecification.type=="currencyWithCents")h(s.currencyFormatter(h(),!0));else if(a.formatSpecification.type=="percentage"||a.formatSpecification.type=="percent")h(s.percentageFormatter(h(),a.formatSpecification.places,a.formatSpecification.round));else if(a.formatSpecification.type=="numberAsPercent"){var f=h().toString();h(f+"%")}else if(a.formatSpecification.type=="pill"){var f;f=a.formatSpecification.displayValueField,h()&&(f=h()),f==undefined&&(f=""),h(s.pillFormatter(f,a.formatSpecification.status))}else if(a.formatSpecification.type=="function"){var f=h();typeof a.formatSpecification.fn=="function"&&(f=a.formatSpecification.fn.call({item:n,value:h()})),h(f)}}else a.formatSpecification.displayOnBlank!==undefined&&h(a.formatSpecification.displayOnBlank)}var g="clearfix",y="",b=a.wordBreak===!0,w=a.mobileDisplay===!0;o.push({heading:l,value:h,cssClass:g,style:y,wordBreak:b,mobileDisplay:w})}}return o}function C(e,t){return e.summaryField.fn.call({overrideDefaultSummaryField:t.overrideDefaultSummaryField})}function k(e){if(this.displayMode=="default")var t=[{columns:4,styles:[{style:"col-xs-3"},{style:"col-xs-2"},{style:"col-xs-2"},{style:"col-xs-2"}]},{columns:3,styles:[{style:"col-xs-4"},{style:"col-xs-3"},{style:"col-xs-3"}]},{columns:2,styles:[{style:"col-xs-5"},{style:"col-xs-5"}]},{columns:1,styles:[{style:"col-xs-10"}]}];else if(this.displayMode=="actions")var t=[{columns:4,styles:[{style:"col-xs-2"},{style:"col-xs-2"},{style:"col-xs-2"},{style:"col-xs-2"}]},{columns:3,styles:[{style:"col-xs-3"},{style:"col-xs-3"},{style:"col-xs-2"}]},{columns:2,styles:[{style:"col-xs-4"},{style:"col-xs-4"}]},{columns:1,styles:[{style:"col-xs-8"}]}];return t[this.getSubscript(t)].styles[e].style}function L(e,t){var n=ko.contextFor(t.target).$parents[1];"viewEdit"in n.handlers&&n.handlers.viewEdit.call({data:this,item:this,collectionViewModel:n.collectionViewModel})}function A(e){var t=this.collectionViewModel.fields.filter(function(e){return e.summaryField});for(x=0;x!=e.length;x++)if(e[x].columns==t.length)return x;return e[x].columns.length-1}function O(e,t){return"collapseMethod_"+this.controlKey+ko.unwrap(e.id)}function M(e,t){return"collapseMethod_button_"+this.controlKey+ko.unwrap(e.id)}function _(e,t){var n=ko.contextFor(t.target).$parents[1];n.itemToDelete=this,n.showDeleteModal(!0)}var l=function(){};return l.prototype.activate=function(r){var i=this;i.area=a.getApplicationArea();if(r===undefined)throw"adjodal widget configuration - not configured correctly.";i.settings=r,i.readOnly=s.isDefined(r.readOnly)?r.readOnly:!1,i.readOnlyHeading=s.isDefined(r.readOnlyHeading)?r.readOnlyHeading:r.heading,typeof r.heading===undefined?i.heading="":r.readOnly?i.heading=ko.computed(function(){var e=ko.unwrap(i.readOnly);return e?ko.unwrap(i.readOnlyHeading):ko.unwrap(r.heading)}):i.heading=r.heading;if(r.collectionViewModel===undefined)throw"adjodal widget configuration - collectionViewModel instance not specified.";i.collectionViewModel=r.collectionViewModel;if(r.controlKey===undefined)throw"adjodal widget configuration - controlKey not specified.";i.controlKey=r.controlKey;if(r.addViewHtml===undefined)throw"adjodal widget configuration - addViewHtml not specified.";i.addViewHtml=r.addViewHtml;if(r.editViewHtml===undefined)throw"adjodal widget configuration - editViewHtml not specified.";i.editViewHtml=r.editViewHtml;if(this.collectionViewModel.fields===undefined)throw"adjodal widget configuration - collectionViewModel.fields undefined";r.visible!==undefined?i.visible=r.visible:i.visible=!1,typeof r.hasError!="undefined"?i.hasError=r.hasError:i.hasError=!1,r.alwaysShowSummaryHeadings?i.alwaysShowSummaryHeadings=r.alwaysShowSummaryHeadings:i.alwaysShowSummaryHeadings=!1,r.noItemsText&&(i.noItemsText=r.noItemsText),r.primaryActionText!==undefined?i.primaryActionText=r.primaryActionText:i.primaryActionText="Add",r.saveButtonText!==undefined?i.saveButtonText=r.saveButtonText:i.saveButtonText="Save",r.buttonNamespace!==undefined?i.buttonNamespace=r.buttonNamespace+"_":i.buttonNamespace="",r.button1Text!==undefined?i.button1Text=r.button1Text:i.button1Text="Edit",r.icon1Class!==undefined?i.icon1Class=r.icon1Class:i.icon1Class="icon icon-edit",r.button2Text!==undefined?i.button2Text=r.button2Text:i.button2Text="Print",r.icon2Class!==undefined?i.icon2Class=r.icon2Class:i.icon2Class="icon icon-print",r.button3Text!==undefined?i.button3Text=r.button3Text:i.button3Text="Delete",r.icon3Class!==undefined?i.icon3Class=r.icon3Class:i.icon3Class="icon icon-delete",typeof r.saveDisabled!="undefined"?i.saveDisabled=r.saveDisabled:i.saveDisabled=!1,r.addButtonVisible!==undefined?i.addButtonVisible=r.addButtonVisible:r.readOnly?i.addButtonVisible=ko.computed(function(){return!ko.unwrap(r.readOnly)}):i.addButtonVisible=!0,typeof r.showHeadingsOnEmpty!="undefined"?i.showHeadingsOnEmpty=r.showHeadingsOnEmpty:i.showHeadingsOnEmpty=!0,typeof r.useIndex!="undefined"?i.useIndex=r.useIndex:i.useIndex=!1,s.isDefined(i.settings.showPagination)?(i.showPagination=i.settings.showPagination,s.isDefined(i.settings.paginationPageSize)?i.paginationPageSize=i.settings.paginationPageSize:i.paginationPageSize=o.paginationPageSize,s.isDefined(i.settings.pageSizeStatic)&&(i.pageSizeStatic=i.settings.pageSizeStatic)):i.showPagination=!1,typeof r.headingLevel!="undefined"?i.headingLevel=r.headingLevel:i.headingLevel="2",i.totalValue="",i.totalHeading="",i.showTotalRow=t.observable(!1),s.isDefined(i.settings.hasTotalRow)&&s.isDefined(i.settings.totalValue)&&(i.totalRowId=r.controlKey+"_totalRow",i.showTotalRow(t.unwrap(i.settings.hasTotalRow)),(ko.isObservable(i.settings.hasTotalRow)||ko.isComputed(i.settings.hasTotalRow))&&i.settings.hasTotalRow.subscribe(function(){i.showTotalRow(i.settings.hasTotalRow())}),i.totalHeading=s.isDefined(i.settings.totalHeading)?i.setting.totalHeading:"Total",i.totalValue=t.computed(function(){return s.currencyFormatter(t.unwrap(i.settings.totalValue),!0)})),i.showModal=i.settings.showModal,i.modalHeading=i.settings.modalHeading,i.modalMessage=i.settings.modalMessage,i.showPagination&&(i.currentPage=t.observable(1),i.pageSize=t.observable(i.paginationPageSize.Default),i.pageSizeStatic=t.observable(i.pageSizeStatic),i.pageSizeList=t.observable(i.paginationPageSize.Options),i.pageCount=t.observable(),i.pageStart=ko.observable(),i.pageEnd=ko.observable(),i.relevantRecordCollection=t.computed(function(){var e=[];return i.collectionViewModel.collection().length>0&&(e=i.collectionViewModel.collection().filter(function(e){return e.relevant()===!0})),e}),i.totalRecords=t.computed(function(){return i.relevantRecordCollection().length}),i.displayContent=function(t,n,r){var s=r*(n-1),o=s+r;return o>t.length&&(o=t.length),t.slice(s,o).map(function(e){e.pageId=i.collectionViewModel.getObjectOrdinal(e);if(t.length!=i.collectionViewModel.collection().length){var s=1;typeof r!="undefined"&&(s=Math.ceil(e.pageId/r),s<1&&(s=1)),e.pageNumber=s}else e.pageNumber=n;return e})},i.pageContents=t.computed(function(){return u.log("pageSize:"+i.pageSize()),i.displayContent(i.relevantRecordCollection(),i.currentPage(),i.pageSize())}),i.showPage=function(t,n){i.pageStart(t),i.pageEnd(n),u.log("--pageChange-->"+t)}),i.updateCollectionPage=t.computed(function(){i.showPagination?i.collectionViewModel.collectionPage(i.pageContents()):i.collectionViewModel.collectionPage(i.collectionViewModel.collection())}),i.composeAddView=s.isDefined(r.composeAddView)?r.composeAddView:!0,i.composeEditView=s.isDefined(r.composeEditView)?r.composeEditView:!0,i.cancelOnDetached=s.isDefined(r.cancelOnDetached)?r.cancelOnDetached:!0,s.isDefined(r.infoTooltip)?(i.showHeadingHelpId=!0,i.infoTooltip=r.infoTooltip):s.isDefined(r.headingHelpId)?(i.showHeadingHelpId=!0,i.infoTooltip={helpId:r.headingHelpId}):i.showHeadingHelpId=!1,i.displayMode=r.displayMode?r.displayMode:"default",this.displayMode=="default"?(i.actionClass="col-xs-2",i.actionView="../shared/widgets/adjodal/"+i.area+"/defaultActions.html"):this.displayMode=="actions"&&(i.actionClass="col-xs-4 no-gutters",i.actionView="../shared/widgets/adjodal/"+i.area+"/actions.html"),i.displayDataHeader=r.displayDataHeader!==undefined?r.displayDataHeader:!1;var f=typeof r.onAddHandler;f!=="undefined"&&(f=="function"?i.onAddHandler=r.onAddHandler:u.log("adjodal - onAddHandler passed, expected function got type: "+f)),i.handlers=typeof r.handlers=="object"?r.handlers:{},i.hasViewEditHandler="viewEdit"in i.handlers,i.hasViewEditHandler&&(i.viewEditHandler=L),i.showPanelDelete=typeof r.showPanelDelete!="undefined"?r.showPanelDelete:!0,i.deleteViewPath="../shared/widgets/adjodal/"+a.getApplicationArea()+"/delete.html",i.itemToDelete={},i.showDeleteModal=ko.observable(!1).extend({notify:"always"}),i.deleteText=i.settings.deleteText?i.settings.deleteText:"Delete",i.actionsDeleteClick=_,i.modalDelete=function(t,n){i.remove({item:i.itemToDelete,vm:t},n),i.showDeleteModal(!1),e("#"+i.btnAddId).focus()},i.closeModalDelete=function(){i.showDeleteModal(!1)},i.deleteModalTitle=s.isDefined(r,"deleteModalTitle")?r.deleteModalTitle:"Delete",r.primaryActionSrText!==undefined?i.primaryActionSrText=r.primaryActionSrText:i.primaryActionSrText="Press enter to expand or collapse this panel",r.primaryActionDataIcon!==undefined?i.primaryActionDataIcon=r.primaryActionDataIcon:i.primaryActionDataIcon="⊕",typeof r.recordDescription!="undefined"?i.recordDescription=r.recordDescription:i.recordDescription="";var l=i.getSummaryHeaders(),c=this.display=="actions"?"Actions":"";l.push({name:c,style:""}),i.headers=l,i.headingId="heading_"+i.controlKey+"_collection",i.btnAddId="btn_"+i.controlKey+"_add",i.addPanelId="collapseMethod_"+i.controlKey+"_add",i.collectionContainerId="collapseMethod_"+i.controlKey+"_collection_container",i.btnSaveId="btn_"+i.controlKey+"_save",i.btnCancelId="btn_"+i.controlKey+"_cancel",i.btnDeleteId="btn_"+i.controlKey+"_delete",i.subscriptions=[];var h=i.collectionViewModel.addVisible.subscribe(function(t){t?(e("#"+i.addPanelId).collapse("show"),i.enableAdd(i.collectionViewModel.addObject,null,!0)):(e("#"+i.addPanelId).collapse("hide"),i.cancelAdd(i.collectionViewModel.addObject),e("#"+i.btnAddId).focus())}),p=i.collectionViewModel.newActiveEditRow.subscribe(function(t){try{var n=i.collectionViewModel.getEditRowObject(t),r=i.getCollectionPanelId(n);e("#"+i.collectionContainerId+' a[data-href="'+r+'"]').click()}catch(s){throw"collectionViewModel - new active edit row error:"+s}}),d=i.collectionViewModel.activeEditRow.subscribe(function(t){if(t==-1){var n=e("#"+i.collectionContainerId+" .collapse.in");if(n.length>0){n.collapse("hide");var r=n[0].id,s=e("#"+i.collectionContainerId+' a[data-href="'+r+'"]');s.focus()}else e("#"+i.btnAddId).focus()}});i.subscriptions.push(h),i.subscriptions.push(p),i.subscriptions.push(d),i.panelErrors=ko.observableArray([]),i.errorsSubscriptions=[],n.on(i.controlKey+":adjodal:commitAll",function(){},i);var v={id:i.addPanelId};v.visible=ko.observable(!1),i.panelErrors.push(v)},l.prototype.getSummaryHeaders=S,l.prototype.getAccordionHeaders=N,l.prototype.getSubscript=A,l.prototype.getHeaderClass=k,l.prototype.getCollectionPanelId=O,l.prototype.enableAdd=c,l.prototype.commitAdd=h,l.prototype.cancelAdd=d,l.prototype.editClick=v,l.prototype.enableEdit=m,l.prototype.commitEdit=g,l.prototype.cancelEdit=y,l.prototype.clearErrorSubscriptions=E,l.prototype.setErrorSubscriptions=w,l.prototype.getPanelError=T,l.prototype.remove=p,l.prototype.attached=function(e){var t=this},l.prototype.compositionComplete=function(t,n){var r=this;r.clickHandler=function(e){if(e.which===13||e.which===32||e.type==="click"){var t=ko.contextFor(this);r.enableEdit(t.$data,r,e),e.currentTarget.focus(),e.stopPropagation(),e.preventDefault()}},this.displayMode=="default"&&e(t).on("click keydown","tr.has-details",r.clickHandler)},l.prototype.detached=function(t){ko.unwrap(this.cancelOnDetached)&&(ko.unwrap(this.cancelOnDetached)&&(this.collectionViewModel.addVisible()?this.collectionViewModel.cancelAdd():this.collectionViewModel.cancelEdit(null,null)),this.subscriptions.forEach(function(e){e.dispose()}),this.clearErrorSubscriptions(),this.collectionViewModel.updateState({addVisible:!1}),this.displayMode=="default"&&e(t).off("click keydown","tr.has-details",this.clickHandler))},l}),define("shared/widgets/alert/viewmodel",["jquery","durandal/composition","shared/services/logger","shared/services/uiHelper"],function(e,t,n,r){var i=function(){};return i.prototype.activate=function(e){var t=this;t.settings=e,t.widgetArea=r.getApplicationArea(),t.alertType=e.alertType,t.visible=ko.observable(!1);if(!e.cssClass)switch(t.settings.alertType){case"danger":break;case"result":t.cssClass="alert alert-attention";break;case"info":t.cssClass="alert alert-block alert-info";break;case"success":t.cssClass="alert alert-block alert-success";break;case"warning":t.cssClass="alert alert-block alert-warning";break;case"direction":t.cssClass="alert alert-block alert-direction";break;case"calculator":t.cssClass="alert alert-block alert-info"}else t.cssClass=e.cssClass;if(e.cssHeading||e.hasCssHeading===!0)e.cssHeadingClass?t.cssHeadingClass=e.cssHeadingClass:t.cssHeadingClass="alert-heading";t.icon="",t.srText="";if(!t.settings.icon)switch(t.settings.alertType){case"result":break;case"danger":t.icon="x",t.srText="Danger";break;case"info":t.icon="",t.srText="Information";break;case"success":t.icon="t",t.srText="Complete";break;case"warning":t.icon="w",t.srText="Warning";break;case"direction":t.icon="w",t.srText="Information";break;case"calculator":t.icon="",t.srText="Information";break;case"prefill":t.icon="i",t.srText="Information"}else t.icon=t.settings.icon;t.attrObj={"class":t.cssClass},t.icon!==""&&(t.attrObj["data-icon"]=t.icon)},i.prototype.compositionComplete=function(t,n){this.settings.attr&&e(t).attr(this.settings.attr);var r=e(t).find("[data-part='content']").first();r.replaceWith(r.eq(0).children()),this.visible(!0)},i}),define("shared/widgets/bottomNav/viewmodel",["durandal/composition","require","jquery","knockout","services/logger","shared/services/altTextProvider","shared/services/uiHelper"],function(e,t,n,r,i,s,o){function a(e){var t;switch(e){case"Previous":case"Cancel":case"Back":t="btn btn-default";break;default:t="btn btn-primary"}return t}var u=function(){};return u.prototype.buttondefaults=function(e){var t={buttons:{btn1:{present:!0,text:"Previous",cbName:"previous",alt:"",btnClass:"",btnPresent:!0},btn2:{present:!1,text:"",cbName:"",alt:"",btnClass:"",btnPresent:!0},btn3:{present:!1,text:"",cbName:"",alt:"",btnClass:"",btnPresent:!0},btn4:{present:!0,text:"Next",cbName:"next",alt:"",btnClass:"",btnPresent:!0}}},n=[];for(var s=0;s<4;s++){var o="btn"+(s+1);typeof e[o+"Present"]!="undefined"&&(t.buttons[o].present=r.unwrap(e[o+"Present"])),e[o+"Text"]&&(t.buttons[o].text=e[o+"Text"]),e[o+"CBName"]&&(t.buttons[o].cbName=e[o+"CBName"]),e[o+"CB"]&&(t.buttons[o].cb=e[o+"CB"]),e[o+"Alt"]&&(t.buttons[o].alt=e[o+"Alt"]),typeof e[o+"BtnClass"]!="undefined"&&(t.buttons[o].btnClass=e[o+"BtnClass"]),typeof e[o+"BtnPresent"]!="undefined"&&(t.buttons[o].btnPresent=e[o+"BtnPresent"]),t.buttons[o].btnPresent==0&&(t.buttons[o].present=!1);if(t.buttons[o].present&&t.buttons[o].present==1){if(t.buttons[o].cbName&&t.buttons[o].cbName!=""){var u=r.unwrap(t.buttons[o].cbName),a=u.split(".");if(a.length>1){var f=e.bindingContext;a[0].charAt(0)=="$"&&(f==f[a[0]],a.shift());var l=a.join(".");typeof f[l]=="function"?t.buttons[o].cb=f[l]:i.log("bc[fp] does not refer to a function",f[l],"bottomNav viewmodel",!1)}else a.length==1?typeof e.bindingContext.$data[a[0]]!="function"&&i.log("cbnameParts[0] does not refer to a function",e.bindingContext[a[0]],"bottomNav viewmodel",!1):i.log("cbnameParts length == 0",a,"bottomNav viewmodel",!1)}(!t.buttons[o].cb||typeof t.buttons[o].cb!="function")&&i.log("bottomNav viewmodel","function not found for widget","bottomNav viewmodel",!1),t.buttons[o].id=o,n.push(t.buttons[o])}}return n},u.prototype.activate=function(e){var t=this;t.settings=e,t.controlKey=t.settings.controlKey,t.widgetArea=t.settings.widgetArea?t.settings.widgetArea:o.getApplicationArea(),t.buttons=t.buttondefaults(t.settings);if(t.widgetArea)if(t.widgetArea=="web"){t.controlClass="row-fluid";for(var n=0;n-1||t.widgetArea.indexOf("atoo")>-1))t.buttons.forEach(function(e,t){e.btndivclass="";var n=e.text;e.btnClass=="btn-default"?e.btnClass=a("Cancel"):e.btnClass==""&&(r.isObservable(n)?e.btnClass=r.computed(function(){return a(n())},e):e.btnClass==""&&(e.btnClass=a(n)))});else if(t.widgetArea=="mobile"){t.controlClass="ui-grid-"+["a","b","c","d"][t.buttons.length-2];for(var n=0;n0){var u=[];o.forEach(function(e){i.getTaxonomyCollectionFromCdn(e).then(function(e){e.sort(function(e,t){return e.displayOrder-t.displayOrder}),u=u.concat(e),r.loadedHelpContent(u)})})}}t(window).resize(function(){r.displayClass()===this.showClass&&window.innerWidth<=767?t("body").css("overflow","hidden"):t("body.modal-open").is(":hidden")&&t("body").css("overflow","auto")}),this.taxonomyLookup=[],this.showClass="show-help-aside",this.hideClass="hide-help-aside",this.displayClass=n.observable(this.hideClass),this.displayFilter=n.computed(function(){return r.helpType==="classicCdn"||r.helpType==="sticky"?!0:!1}),this.helpButtonVisible=s.isDefined(e.helpButtonVisible)?e.helpButtonVisible:!0,this.helpFilter=n.observable(),this.helpFilterId=e.controlkey+"-calculator-help-filter",this.helpContent=n.observableArray([]),this.helpCategory=n.observableArray([]),this.helpTitle=s.isDefined(e.helpTitle)?e.helpTitle:"Help with this content",this.setHelpContent=n.computed(function(){r.displayClass(r.hideClass);var o=e.screenKey(),u,a=n.utils.arrayFirst(r.screens,function(e){return e.key==o});if(a==null)r.helpContent([]);else if(typeof a.taxonomy!="undefined")r.helpContent(r.loadedHelpContent());else if(typeof a.help=="undefined")r.helpContent([]);else{var f=[];f[0]=a.help.filter(function(t){return Array.isArray(t.Modes)?t.Modes.indexOf(e.appMode)>=0:!0}),f[1]=a.helpCategories,typeof f[0][0].CalculatorHelpId!="undefined"?i.getHelpByIds(f).then(function(e){r.helpContent(e);if(s.isDefined(window,"ato.numHelpContentItemsToShowSearch")){var n=s.sum(e.map(function(e){return e.length})),i=n>=parseInt(window.ato.numHelpContentItemsToShowSearch);r.displayFilter(i)}else r.displayFilter(!0);var o=r.helpType==="sticky"?".help-aside-close-btn":"a.icon-close",u=r.helpType==="sticky"?'.panel-title [role="button"]':".panel-title a",a=t("#"+r.id+" "+u),f=t("#"+r.id+" .panel-body").last().find("a").last(),l=f.length>0;l&&t(f).keydown(function(e){e.which==9&&!e.shiftKey&&(t("#"+r.id+" "+o).focus(),e.preventDefault())});var c=a[a.length-1];t(c).keydown(function(e){var n=e.currentTarget.parentElement.className.indexOf("collapsed")>=0;e.which==9&&!e.shiftKey&&(n||!l)&&(t("#"+r.id+" "+o).focus(),e.preventDefault())}),t("#"+r.id+" "+o).keydown(function(e){if(e.which==9&&e.shiftKey){var n=c.parentElement.className.indexOf("collapsed")>=0;n||!l?t(c).focus():t(f).focus(),e.preventDefault()}})}):typeof help[0].TaxonomyPath!="undefined"&&i.getTaxonomyCollection(f[0]).then(function(e){r.helpContent(e)})}}),this.displayHelp=n.computed(function(){return e.appMode===2&&e.currentYear<=2018||e.appMode===1?!0:!1}),this.visible=n.computed({read:function(){var e=r.helpContent().length>0&&n.unwrap(r.helpButtonVisible);return e||r.displayClass(r.hideClass),e}}),this.toggleEventName=this.controlKey+":togglePageHelp",this.openEventName=this.controlKey+":openPageHelp",this.closeEventName=this.controlKey+":closePageHelp",this.navigateEventName=this.controlKey+":navigatePageHelp",this.filterEventName=this.controlKey+":filterPageHelp",this.openedFromExternalSource=!1,this.currentTaxonomy=n.observable("")},c.prototype.toggleEventFn=function(){console.debug("EVENT: "+this.toggleEventName),this.toggle()},c.prototype.openEventFn=function(e){console.debug("EVENT: "+this.openEventName),this.isOpen()||this.toggle(e)},c.prototype.isOpen=function(){return this.displayClass()===this.showClass},c.prototype.closeEventFn=function(){console.debug("EVENT: "+this.closeEventName),this.close()},c.prototype.navigatePageHelp=function(e){var r=this;console.debug("EVENT: "+this.navigateEventName),this.closeTarget=e.sourceEl,this.openEventFn(e);if(e.helpId)i.getHelpById(e.helpId).then(function(e){var i=t("#"+r.accordionId);i.find(".panel-title").each(function(i){var s=n.dataFor(this);if(s.TaxonomyPath===e.TaxonomyPath)return r.navigatePostLoadingCallBack=function(){var e=t(this),n=this.getAttribute("data-target"),i=r.helpType==="sticky"?"[tabindex]":"a",s=r.helpType==="sticky"?".help-sidebar-outer":"#"+r.id,o=function(){e.removeClass("collapsed"),e.find(i).focus(),a.scrollToTop({selector:e,container:s})},u=t(n).attr("aria-expanded")=="true";u?o():t(n).collapse("show").on("shown.bs.collapse",o)}.bind(this),r.isOpen()&&r.navigatePostLoadingCallBack(),!1})});else if(e.Path){var s=e.Path+"/"+e.Item,o=t("#"+r.accordionId);o.find(".panel-title").each(function(e){var i=n.dataFor(this);if(i.TaxonomyPath===s)return r.navigatePostLoadingCallBack=function(){var e=t(this),n=this.getAttribute("data-target"),i=r.helpType==="sticky"?"[tabindex]":"a",s=r.helpType==="sticky"?".help-sidebar-outer":"#"+r.id,o=function(){e.removeClass("collapsed"),e.find(i).focus(),a.scrollToTop({selector:e,container:s})},u=t(n).attr("aria-expanded")=="true";u?o():t(n).collapse("show").on("shown.bs.collapse",o)}.bind(this),r.isOpen()&&r.navigatePostLoadingCallBack(),!1})}},c.prototype.navigatePageHelpByTaxonomyPath=function(e){function s(e){var n=r.helpType==="sticky"?"[tabindex]":"a";e.find(n).focus(),o.forceAssertiveOnce(t(e.find(n)))}var r=this;this.openEventFn();if(e){var i=t("#"+r.accordionId);i.find(".panel-title").each(function(i){var o=n.dataFor(this);if(o.TaxonomyPath===e)return r.navigatePostLoadingCallBack=function(){var e=t(this),n=this.getAttribute("data-target");t(n).collapse("show"),s(e)}.bind(this),r.isOpen()&&r.navigatePostLoadingCallBack(),!1})}},c.prototype.collapseAll=function(){t("#"+this.accordionId).find(".panel-collapse.in").collapse("hide")},c.prototype.layoutHelpView=function(){window.innerWidth<=767?(t("body").css("overflow","hidden"),t(".sticky-panel-container").css("background","")):t(".sticky-panel-container").css("background","#000")},c.prototype.attached=function(){var n=this,r=Object.keys(e.callbacks).some(function(e){return e===n.toggleEventName});r||(this.toggleEvent=e.on(this.toggleEventName,this.toggleEventFn,this),this.openEvent=e.on(this.openEventName,this.openEventFn,this),this.closeEvent=e.on(this.closeEventName,this.closeEventFn,this),this.navigateEvent=e.on(this.navigateEventName,this.navigatePageHelp,this)),t("#"+this.id).keydown(function(e){e.which==27&&n.displayClass()===n.showClass&&(n.close(),e.preventDefault())})},c.prototype.click=function(e,t){this.toggle(e,t)},c.prototype.toggle=function(e,n){function u(){var e=r.helpType==="sticky"?'.panel-title [role="tab"]':".panel-title a";t("#"+r.id).find(e).first().focus(),o.forceAssertiveOnce(t("#"+r.id))}var r=this,i="transitionend webkitTransitionEnd oTransitionEnd otransitionend";if(this.displayClass()===this.hideClass){this.displayClass(this.showClass),this.helpType=="sticky"&&e!=undefined&&r.currentTaxonomy()!=undefined&&u();var i="transitionend webkitTransitionEnd oTransitionEnd otransitionend";if(Modernizr.csstransitions){var s=t("#"+this.id);s.one(i,function(e){e.target===e.currentTarget&&(u(),r.layoutHelpView(),r.navigatePostLoadingCallBack&&r.navigatePostLoadingCallBack())})}else r.layoutHelpView()}else this.resetHelp(),t(".sticky-panel-container").css("background","");r.isOpen()&&r.currentTaxonomy()&&(this.helpType=="sticky"&&e==undefined||this.helpType=="classic"&&e!=undefined)&&r.navigatePageHelpByTaxonomyPath(r.currentTaxonomy().TaxonomyPath)},c.prototype.saveAndExit=function(){e.trigger(this.controlKey+":saveAndExit")},c.prototype.itemClick=function(e,t){return this.baseClickEvent(t.target,e,t),!0},c.prototype.itemKeyPress=function(e,n){var r=n.target.parentNode.getAttribute("data-target");if(n.which==13||n.which==32){var i=t('[data-target="'+r+'"]');return i.hasClass("collapsed")?(t(r).collapse("show"),t('[data-target="'+r+'"]').removeClass("collapsed")):(t(r).collapse("hide"),t('[data-target="'+r+'"]').addClass("collapsed")),this.baseClickEvent(n.target,e,n),!1}return!0},c.prototype.baseClickEvent=function(e,n,r){var i=t(e),a=t(i).attr("aria-expanded");if(a==="true")i.attr("aria-expanded","false");else if(a==="false"||!a)i.attr("aria-expanded","true"),o.forceAssertiveOnce(i.parents(".panel.panel-default"));return u.raiseEvent("usage",{action:s.stringFormat("HelpItem:{0}:{1}",[n.OverlayTitle,r.type]),message:"toggle",target:this,route:n.TaxonomyPath}),!0},c.prototype.clearSearchFilter=function(){t("#"+this.accordionId).removeHighlight(),this.helpFilter(undefined);var e=this.accordionId+"-panel-";t("#"+this.accordionId).find(".panel-title").each(function(e){var n=t(this),r=this.getAttribute("data-target");t(r).collapse("hide"),n.addClass("collapsed")})},c.prototype.searchFilter=function(){var e=this.helpFilter().length;if(e>0){var n=t("#"+this.accordionId);n.removeHighlight(),n.highlight(this.helpFilter());var r=this.accordionId+"-panel-";return n.find(".panel-title").each(function(n){var r=t(this);if(r.length>0){var i=this.id,s=this.getAttribute("data-target");(r.find("span.highlight").length>0||t(s).find("span.highlight").length>0)&&e>2?(t(s).collapse("show"),r.removeClass("collapsed")):(t(s).collapse("hide"),r.addClass("collapsed"))}}),!0}this.clearSearchFilter()},c.prototype.close=function(e,n){if(a.targetIsEnterSpaceOrClick(n)){n.preventDefault(),this.resetHelp(),this.displayClass(this.hideClass),t(".sticky-panel-container").css("background","");var r=this.closeTarget||"#"+this.helpButtonId;t(r).focus(),this.closeTarget=null,this.navigatePostLoadingCallBack=null}},c.prototype.resetHelp=function(e,n){this.displayClass(this.hideClass),this.helpType=="sticky"&&this.clearSearchFilter();var r=t("#"+this.accordionId);t("body").css("overflow","auto")},c.prototype.getIdForTitle=function(){return this.id+"-title"},c.prototype.getIdForCategory=function(){return this.id+"-category"},c.prototype.getIdForContent=function(){return this.id+"-body"},c.prototype.getIdForPanel=function(e){return this.accordionId+"-panel-"+e},c.prototype.getHeaderHtml=function(e){if(e.hasOwnProperty(this.headerProperty))return e[this.headerProperty]+' Select link to toggle content';throw new Error("HelpSidebar.getHeaderHtml: help content item does not have property "+this.headerProperty)},c.prototype.getBodyHtml=function(e){if(e.hasOwnProperty(this.bodyProperty))return e[this.bodyProperty];throw new Error("HelpSidebar.getBodyHtml: help content item does not have property "+this.bodyProperty)},c.prototype.compositionComplete=function(e,n){t(e).find("a[data-usageevent]").on("click",function(e){var n={action:"hyperlinkAccess",message:t(e.currentTarget).attr("data-usageevent"),target:this,route:f.id};return u.raiseEvent("usage",n),!0}),t(e).find(".collapse").collapse({parent:"#"+this.accordionId,toggle:!1});var r=t(e).find(".collapse").on("shown.bs.collapse",function(e){t(e.currentTarget).attr("aria-hidden","false")}).on("hidden.bs.collapse",function(e){t(e.currentTarget).attr("aria-hidden","true")})},c.prototype.detached=function(){},c.prototype.getScreenReaderStickyPanelBindings=function(){var e=this,n=t.map(t(".sticky-panel").filter(":visible").find(".sticky-panel-btn"),function(n,r){var i=t(n).find("a").first(),s={associatedId:i.attr("id"),text:t.trim(i.text()),click:function(n,r){this.text.toUpperCase().indexOf("HELP")>=0&&(e.closeTarget=r.currentTarget),t("#"+this.associatedId).click()},focus:function(e,r){t(n).css("border","2px #00C8D2 solid")},blur:function(e,r){t(n).css("border","0px")}};return s});return n},c}),define("shared/widgets/checkBox/viewmodel",["durandal/composition","require","jquery","knockout","services/logger","shared/services/helpProvider"],function(e,t,n,r,i,s){var o=function(){};return o.prototype.activate=function(e){self=this,self.settings=e,self.controlKey=e.controlKey,self.checked=e.checked||e.dataItem,self.label=e.label,self.id="checkbox-"+self.controlKey,e.hasError?self.hasError=e.hasError:self.hasError=!1,e.infoTooltip?this.infoTooltip=e.infoTooltip:e.helpId&&(this.infoTooltip={helpId:e.helpId}),s.setWidgetHelpPropertiesOnActivate(this,e),e.readOnly?self.disabled=e.readOnly:self.disabled=!1},o.prototype.attached=function(e){i.log("checkbox viewmodel","checkbox widget attached function called. ControlKey="+self.controlKey,"checkbox viewmodel",!1),n(e).trigger("create")},o}),define("shared/widgets/checkBoxGroup/viewmodel",["durandal/composition","plugins/router","require","jquery","knockout","services/logger","shared/services/helpProvider","shared/services/widgetHelper"],function(e,t,n,r,i,s,o,u){var a=function(){};return a.prototype.activate=function(e){var t=this;t.settings=e,t.dataItem=t.settings.dataItem,t.controlKey=i.unwrap(t.settings.controlKey),typeof t.controlKey=="undefined"&&(t.controlKey=""),typeof (t.settings.controlId||t.settings.instanceId||t.settings.instanceKey)!="undefined"?t.controlId=i.unwrap(t.settings.controlId||t.settings.instanceId||t.settings.instanceKey):t.controlId="",t.questionId="lbl-"+t.controlKey,t.questionGroupName="vrb-question-name-"+t.controlKey,t.questionText=t.settings.questionText,t.items=i.computed(function(){o.setWidgetListHelpItems(t.settings.items,t.settings.itemsHelp);var e={key:"",heading:""};return i.unwrap(t.settings.items()).forEach(function(n){var r=i.toJS(n).key,s=!1,o=!1;t.sectionHeadings&&t.sectionHeadings.some(function(t){return t.key==r?function(){return e=t,o=!0,!0}():!1});var u=i.unwrap(n);return u.heading=e,u.isFirstHeading=o,u.label=e.heading+" - "+i.unwrap(n.value),n}),i.unwrap(t.settings.items)}),t.itemsHelp=t.settings.itemsHelp,e.readOnly?t.disabled=e.readOnly:t.disabled=!1,t.widgetArea=t.settings.widgetArea,t.other=t.settings.other,e.hasError?t.hasError=e.hasError:t.hasError=!1,e.isMandatory?t.isMandatory=e.isMandatory:t.isMandatory=!1,t.valueToBind=function(e){var t=i.toJS(e);return t.html?t.html:t.value},e.hasHadFocus&&i.isObservable(e.hasHadFocus)&&(this.hasHadFocus=e.hasHadFocus),e.infoTooltip?this.infoTooltip=e.infoTooltip:e.helpId&&(this.infoTooltip={helpId:e.helpId}),o.setWidgetHelpPropertiesOnActivate(this,e)},a.prototype.attached=function(e){s.log("checkBoxGroup viewmodel","checkBoxGroup widget attached function called. ControlKey="+self.controlKey,"checkBoxGroup viewmodel",!1),r(e).trigger("create"),u.attachFocusHandler.call(this,e)},a.prototype.compositionComplete=function(e,t){var n=this;r.each(r(e).find("span[id|='chk-"+n.controlKey+"-span']"),function(e,t){i.applyBindingsToDescendants({},t)})},a}),define("shared/widgets/checkBoxList/viewmodel",["durandal/composition","plugins/router","require","jquery","knockout","services/logger","shared/services/helpProvider"],function(e,t,n,r,i,s,o){var u=function(){};return u.prototype.activate=function(e){var t=this;t.settings=e,t.dataItem=t.settings.dataItem,t.controlKey=i.unwrap(t.settings.controlKey),typeof t.controlKey=="undefined"&&(t.controlKey=""),t.questionId="lbl-"+t.controlKey,t.questionGroupName="vrb-question-name-"+t.controlKey,t.questionText=t.settings.questionText,t.items=i.unwrap(t.settings.items),t.itemsHelp=t.settings.itemsHelp,t.widgetArea=t.settings.widgetArea,t.other=t.settings.other,e.hasError?t.hasError=e.hasError:t.hasError=!1,e.isMandatory?t.isMandatory=e.isMandatory:t.isMandatory=!1,t.valueToBind=function(e){var t=i.toJS(e);return t.html?t.html:t.value},o.setWidgetHelpPropertiesOnActivate(this,e)},u.prototype.attached=function(e){s.log("checkBoxList viewmodel","checkBoxList widget attached function called. ControlKey="+self.controlKey,"checkBoxList viewmodel",!1),r(e).trigger("create")},u.prototype.compositionComplete=function(e,t){var n=this;r.each(r(e).find("span[id|='chk-"+n.controlKey+"-span']"),function(e,t){i.applyBindingsToDescendants({},t)})},u}),define("shared/widgets/currency/viewmodel",["jquery","durandal/composition","shared/services/common"],function(e,t,n){var r=function(){};return r.prototype.activate=function(e){this.settings=e,e.maxLength?this.maxLength=e.maxLength:this.maxLength="11";var t=n.isDefined(e.cents)?e.cents:!1,r=n.isDefined(e.dollarSign)?e.dollarSign:!0,i;n.isDefined(this.settings.readOnly)&&(i=ko.unwrap(this.settings.readOnly)),n.isDefined(this.settings.readonly)&&(i=ko.unwrap(this.settings.readonly));var s;n.isDefined(this.settings.visible)&&(s=ko.unwrap(this.settings.visible)),this.textBoxSettings={area:this.settings.area,labelText:this.settings.labelText,controlKey:this.settings.controlKey,dataItem:this.settings.dataItem,leftAddOnText:r?"$":"",leftAddOnCss:{amount:!0},rightAddOnText:t?"":".00",hasHadFocus:this.settings.hasHadFocus,hasError:this.settings.hasError,helpId:this.settings.helpId,infoTooltip:this.settings.infoTooltip,isMandatory:this.settings.isMandatory,placeHolderText:this.settings.placeHolderText,maxLength:this.maxLength,inputColumnsClass:this.settings.inputColumnsClass||this.settings.columnsClass,inputAlignRight:!0,labelText:this.settings.questionLabelText,questionText:this.settings.questionLabelText||this.settings.questionText,inputAttr:this.settings.inputAttr,readOnly:i,visible:s,setDecimalPlacesOnBlur:this.settings.setDecimalPlacesOnBlur,setThousandSeperatorOnBlur:this.settings.setThousandSeperatorOnBlur};var o="";n.isDefined(this.settings.srContext)&&this.settings.srContext!=""&&(o=" - "+ko.unwrap(this.settings.srContext),this.textBoxSettings.afterLabelSrHtml=''+o+""),t||(this.textBoxSettings.afterLabelSrHtml=''+o+" - enter dollars only")},r.prototype.attached=function(e){var t=this},r}),define("shared/widgets/dateInput/viewmodel",["durandal/composition","require","jquery","knockout","services/logger"],function(e,t,n,r,i){var s=function(){};return s.prototype.activate=function(e){var t=this;t.settings=e,t.dataItem=t.settings.dataItem,t.controlKey=r.unwrap(t.settings.controlKey),t.questionText=r.unwrap(t.settings.questionText),t.items=r.unwrap(t.settings.items),t.widgetArea=t.settings.widgetArea,n("#HR126").length&&n("#HR126").on("click",function(){})},s.prototype.attached=function(e){i.log("questionSlider viewmodel","questionSlider widget attached function called. ControlKey="+self.controlKey,"questionSlider viewmodel",!1),n(e).trigger("create")},s}),define("shared/widgets/dropDownList/viewmodel",["durandal/composition","plugins/router","require","jquery","knockout","services/logger","shared/services/widgetHelper","shared/services/helpProvider"],function(e,t,n,r,i,s,o,u){var a=function(){};return a.prototype.activate=function(e){var t=this;t.settings=e,t.questionText=t.settings.questionText,t.listItems=t.settings.listItems||t.settings.items,t.helpText=e.helpText;var n=t.settings.selectedItem||t.settings.item;t.selectedItem=typeof n.value=="undefined"?n:n.value,t.controlKey=e.controlKey,t.clickHandler=typeof e.click=="function"?e.click:null,t.changeHandler=typeof e.change=="function"?e.change:null,e.disabled||e.readOnly?t.disabled=e.disabled||e.readOnly:t.disabled=!1,typeof t.controlKey=="undefined"&&(t.controlKey=""),t.filteredListItems=i.computed(function(){var n=i.unwrap(t.listItems);return e.emptyValueText&&(n.length>0?n[0].value!=e.emptyValueText&&n.unshift({key:"",value:e.emptyValueText}):n.unshift({key:"",value:e.emptyValueText})),n}),e.inputColumnsClass||e.columnsClass?t.columnsClass=e.inputColumnsClass||e.columnsClass:t.columnsClass="col-xs-12 col-sm-12 col-md-7",e.isMandatory?t.isMandatory=e.isMandatory:t.isMandatory=!1,e.hasError?t.hasError=e.hasError:t.hasError=!1,e.hasHadFocus&&i.isObservable(e.hasHadFocus)&&(this.hasHadFocus=e.hasHadFocus),e.infoTooltip?this.infoTooltip=e.infoTooltip:e.helpId&&(this.infoTooltip={helpId:e.helpId}),u.setWidgetHelpPropertiesOnActivate(this,e)},a.prototype.compositionComplete=function(e){var t=this;o.attachFocusHandler.call(this,e)},a}),define("shared/widgets/fieldContainer/viewmodel",["durandal/composition","require","jquery","knockout","shared/services/errorMessageProvider","shared/services/logger"],function(e,t,n,r,i,s){var o=function(){};return o.prototype.activate=function(e){var t=this;t.model=e.model,t.visible="visible"in e?e.visible:!0},o}),define("shared/widgets/fieldError/viewmodel",["durandal/composition","require","jquery","knockout","shared/services/errorMessageProvider","shared/services/uiHelper"],function(e,t,n,r,i,s){var o=function(){};return o.prototype.activate=function(e){var t=this;t.settings=e,t.visible=t.settings.visible,t.other=t.settings.other,t.controlKey=t.settings.controlKey,t.fieldLabelId=t.settings.fieldLabelId,t.variableText=t.settings.variableText||t.settings.replaceText,t.area=e.area,typeof t.area=="undefined"&&(t.area=s.getApplicationArea()),t.settings.errorKey&&(t.errorKey=t.settings.errorKey,t.errorObj=i.getErrorMessageByKey(t.settings.errorKey)),t.htmlId="err-"+t.controlKey+"-"+t.errorKey,t.widgetArea=t.settings.widgetArea,t.errorText=r.computed(function(){if(typeof t.errorObj!="undefined"){var e=r.unwrap(t.errorObj).text;return t.settings.variableText&&t.variableText.forEach(function(t){var n=r.unwrap(t.oldText),i=r.unwrap(t.newText);e=e.replace(n,i)}),e}}),t.settings.cssClass?t.cssClass=t.settings.cssClass:t.cssClass=r.computed(function(){if(typeof t.errorObj!="undefined")return typeof t.area!="undefined"&&(t.area.indexOf("mytax")>-1||t.area.indexOf("atoo")>-1)?t.errorObj().type=="E"?"error":"error":t.errorObj().type=="E"?"alert alert-danger":"alert alert-warning"}),t.settings.iconClass?t.iconClass=t.settings.iconClass:t.iconClass=r.computed(function(){if(typeof t.errorObj!="undefined")return typeof t.area!="undefined"&&(t.area.indexOf("mytax")>-1||t.area.indexOf("atoo")>-1)?"icon icon-error":t.errorObj().type=="E"?"glyphicon glyphicon-remove":"glyphicon glyphicon-warning-sign"}),t.imageAlt=r.computed(function(){if(typeof t.errorObj!="undefined")return t.errorObj().type=="E"?"Error:":"Warning:"})},o}),define("shared/widgets/fieldErrorOld/viewmodel",["durandal/composition","require","jquery","knockout"],function(e,t,n,r){var i=function(){};return i.prototype.activate=function(e){var t=this;t.settings=e,t.controlKey=t.settings.controlKey,t.errorText=t.settings.errorText,t.variableText=t.settings.variableText,t.errorType=r.unwrap(t.settings.errorType),t.iconClass="",t.cssClass="",t.items=r.unwrap(t.settings.items),t.widgetArea=t.settings.widgetArea,t.errorType=="E"?(t.cssClass="alert alert-danger",t.iconClass="glyphicon glyphicon-remove form-control-feedback"):t.errorType=="W"&&(t.cssClass="alert alert-warning",t.iconClass="glyphicon glyphicon-warning-sign form-control-feedback")},i.prototype.attached=function(e){n(e).trigger("create")},i}),define("shared/widgets/help/viewmodel",["durandal/composition","require","jquery","knockout"],function(e,t,n,r){var i=function(){};return i.prototype.activate=function(e){var t=this;t.settings=e,t.controlKey=t.settings.controlKey,t.widgetArea=t.settings.widgetArea,t.displayFooter=typeof t.settings.displayFooter=="undefined"?!1:t.settings.displayFooter},i.prototype.attached=function(e){n(e).trigger("create")},i}),define("shared/widgets/horizontalPush/viewmodel",["durandal/composition","require","jquery","knockout","services/logger"],function(e,t,n,r,i){var s=function(){};return s.prototype.activate=function(e){var t=this;t.settings=e,t.dataItem=t.settings.dataItem,t.controlKey=r.unwrap(t.settings.controlKey),t.questionText=r.unwrap(t.settings.questionText),t.items=r.unwrap(t.settings.items),t.widgetArea=t.settings.widgetArea},s.prototype.attached=function(e){var t=this;i.log("horizontalPush viewmodel","horizontalPush widget attached function called. ControlKey="+t.controlKey+", widgetArea="+t.widgetArea,"horizontalPush viewmodel",!1),t.widgetArea&&(t.widgetArea=="mobile"?n(e).trigger("create"):t.widgetArea=="web"?(n(e).find('[type="radio"]').hide(),n(e).find(".btn-group").button()):t.widgetArea=="jqui")},s}),define("shared/widgets/horizontalRadio/viewmodel",["durandal/composition","plugins/router","require","jquery","knockout","services/logger","shared/services/helpProvider","shared/services/widgetHelper"],function(e,t,n,r,i,s,o,u){var a=function(){};return a.prototype.activate=function(e){var t=this;t.settings=e,t.dataItem=t.settings.dataItem,t.controlKey=i.unwrap(t.settings.controlKey),typeof t.controlKey=="undefined"&&(t.controlKey=""),t.questionId="lbl-"+t.controlKey,t.questionGroupName="vrb-question-name-"+t.controlKey,t.questionText=t.settings.questionText,t.questionTextId="span-vrb-question-"+t.controlKey,t.itemsHelp=t.settings.itemsHelp,t.itemsTooltip=t.settings.itemsTooltip,t.sectionHeadings=t.settings.sectionHeadings,t.items=i.computed(function(){o.setWidgetListHelpItems(t.settings.items,t.settings.itemsHelp);var e={key:"",heading:""};return i.unwrap(t.settings.items).forEach(function(n){var r=i.toJS(n).key,s=!1,o=!1;t.sectionHeadings&&t.sectionHeadings.some(function(t){return t.key==r?function(){return e=t,o=!0,!0}():!1});var u=i.unwrap(n);return u.heading=e,u.isFirstHeading=o,u.label=e.heading+" - "+i.unwrap(n.value),n}),i.unwrap(t.settings.items)}),e.readOnly?t.disabled=e.readOnly:t.disabled=!1,t.widgetArea=t.settings.widgetArea,t.other=t.settings.other,e.hasError?t.hasError=e.hasError:t.hasError=!1,e.isMandatory?t.isMandatory=e.isMandatory:t.isMandatory=!1,e.infoTooltip&&(this.infoTooltip=e.infoTooltip);if(e.columnsClass)t.columnsClass=e.columnsClass;else if(e.inputMdColumns)isNaN(parseInt(e.inputMdColumns))?s.logError("vertical radio widget - invalid input md columns provided","vertical radio widget"):t.columnsClass="col-xs-12 col-sm-12 col-md-"+String(e.inputMdColumns);else{var n=0;t.items().forEach(function(e){var t=i.unwrap(e.value).length;t>n&&(n=t)}),n<=15?t.columnsClass="col-xs-7 col-sm-5 col-md-3":n<=25?t.columnsClass="col-xs-12 col-sm-7 col-md-5":n<=35?t.columnsClass="col-xs-12 col-sm-8 col-md-6":t.columnsClass="col-xs-12 col-sm-9 col-md-8"}t.valueToBind=function(e){var t=i.toJS(e);return t.html?t.html:t.value},e.hasHadFocus&&i.isObservable(e.hasHadFocus)&&(this.hasHadFocus=e.hasHadFocus),o.setWidgetHelpPropertiesOnActivate(this,e)},a.prototype.compositionComplete=function(e,t){var n=this;r.each(r(e).find("span[id|='vrb-"+n.controlKey+"-span']"),function(e,t){i.applyBindingsToDescendants({},t)}),u.attachFocusHandler.call(this,e)},a}),define("shared/widgets/loadingBar/viewmodel",["durandal/composition","require","jquery","knockout","services/logger"],function(e,t,n,r,i){var s=function(){};return s.prototype.activate=function(e){var t=this;t.settings=e,t.visible=e.visible},s}),define("shared/widgets/modal/viewmodel",["durandal/app","jquery","durandal/composition","shared/services/common","shared/services/uiHelper"],function(e,t,n,r,i){t(document).on("hidden.bs.modal",function(e){t(".modal:visible").length&&t(document.body).addClass("modal-open")});var s=function(){};return s.prototype.activate=function(n){var s=this;this.settings=n,this.controlKey=n.controlKey,this.visible=ko.observable(!1),this.message=ko.observable(""),this.heading=ko.observable(""),this.focusOnShow=ko.observable(!1),this.screenReaderMessage=ko.observable("Start of alert"),this.moveModal=ko.observable(""),this.open=!1,this.id=this.controlKey+"-modal",this.containerId=this.controlKey+"-modal-container",n.closeFn?this.closeFn=n.closeFn:this.closeFn=function(){t("#"+this.id).modal("hide")},this.buttonStorage=ko.observable([]),Array.isArray(ko.unwrap(n.buttons))&&this.buttonStorage(ko.unwrap(n.buttons)),this.openEventName=this.controlKey+":modal:open",this.closeEventName=this.controlKey+":modal:close",this.updateButtonEventName=this.controlKey+":modal:updateButton",e.on(this.openEventName,function(e){if(r.isDefined(e,"buttons")&&Array.isArray(e.buttons)){var n=e.buttons.map(function(e){return e.buttonType==="primary"?e.btnClass="btn btn-primary":e.btnClass="btn btn-default",typeof e.disabled=="undefined"&&(e.disabled=!1),e});this.buttonStorage(n)}r.isDefined(e,"message")&&this.message(ko.unwrap(e.message)),r.isDefined(e,"heading")&&this.heading(e.heading),r.isDefined(e,"focusOnShow")&&this.focusOnShow(e.focusOnShow),r.isDefined(e,"screenReaderMessage")&&this.screenReaderMessage(e.screenReaderMessage),r.isDefined(e,"moveModal")?this.moveModal(e.moveModal):this.moveModal(!0),this.open||(this.open=!0,t("#"+this.id).on("show.bs.modal",function(e){if(this.moveModal()){var n=t("#"+this.id),r=n.closest("[data-view!=''][data-view]");n.detach().appendTo(r)}}.bind(this)),t("#"+this.id).one("shown.bs.modal",function(e){t(".modal-backdrop.fade").last().attr("data-modal-id",this.id);var n="#"+this.id+" .modal-start";this.focusOnShow()&&i.scrollToTop({selector:n,focus:!0})}.bind(this)),t("#"+this.id).modal("show"))},this),e.on(this.closeEventName,function(e){var n=this,i=!0;r.isDefined(e,"hide")&&(i=e.hide),i&&(t("#"+this.id).one("hide.bs.modal",function(e){e.stopPropagation()}),t("#"+this.id).modal("hide")),this.removeBackdrop(),require("durandal/app").trigger(this.controlKey+":modal:closed"),this.open=!1},this),e.on(this.updateButtonEventName,function(e){console.debug(this.controlKey+":modal:updateButton");var t=e.index,n=this.buttonStorage(),r=n[t];e.text&&(r.text=e.text),e.disabled&&(r.disabled=e.disabled),this.buttonStorage([]),this.buttonStorage(n),require("durandal/app").trigger(this.controlKey+":modal:updateButton:success")},this)},s.prototype.attached=function(e){var t=this},s.prototype.detached=function(t){e.off(this.openEventName),e.off(this.closeEventName),e.off(this.updateButtonEventName),require("durandal/app").trigger(this.controlKey+":modal:closed"),this.removeBackdrop()},s.prototype.compositionComplete=function(e,n){t(this.id).modal({backdrop:"static",show:!1})},s.prototype.removeBackdrop=function(){t('.modal-backdrop.fade[data-modal-id="'+this.id+'"]').remove()},s}),define("shared/widgets/pageError/stateManager",["jquery","q","shared/services/accessability","shared/services/uiHelper","plugins/router","shared/services/logger"],function(e,t,n,r,i,s){var o={},u={};return o.onDisplayHandler=function(n,i){function a(){return e("#"+n).filter(function(){return e(this).attr("display")!=="none"})}typeof u.id=="undefined"&&(u["'"+n+"'"]={focusingPromise:{isFulfilled:function(){return!0}}});var o=u["'"+n+"'"];return o.focusingPromise.isFulfilled()?(o.focusingPromise=t.fcall(function(){var n=t.defer(),s=setInterval(function(){var t=a();t.length>0&&(i&&e(r.getApplicationContainer()).scrollTop(t.offset().top-r.getTopCompensation(i)-10),window.clearInterval(s),n.resolve())},50);return n.promise}).then(function(){var e=t.defer();return setTimeout(function(){var t=a();if(i){var n=t.find(".calculator-page-error-start");r.focusNoScroll(n)}s.log("page error loaded promise resolved, time:"+new Date),t.removeAttr("role aria-live aria-atomic aria-relevant"),t.attr({"aria-live":"polite","aria-atomic":"false","aria-relevant":"additions"}),e.resolve()},600),e.promise}),o.focusingPromise):t.resolve()},o}),define("shared/widgets/pageError/viewmodel",["shared/services/errorMessageProvider","shared/services/common","shared/services/uiHelper","shared/services/logger","plugins/router","shared/widgets/pageError/stateManager","module"],function(e,t,n,r,i,s,o){function a(e){return e.controlKey==this.controlKey?!1:!0}function f(e){var n=this;n.router=i,n.settings=e,n.controlKey=n.settings.controlKey,n.items=ko.unwrap(n.settings.items),n.widgetArea=n.settings.widgetArea,n.visible=n.settings.visible,n.settingInputErrors=n.settings.inputErrors,n.headingLevel="2",n.alwaysHide=t.isDefined(n.settings.alwaysHide)?n.settings.alwaysHide:!1,n.subscriptions=[],n.inputErrors=ko.computed(function(){var e=n.processInputErrors.call(n,ko.unwrap(n.settingInputErrors));return e}),n.isVisible=ko.computed(function(){var e=n.inputErrors().some(function(e){return e.visible()});return e?ko.unwrap(n.visible):!1}),n.focusOnError=typeof n.settings.focusOnError=="undefined"?!0:n.settings.focusOnError;var r=n.settings.bindingContext.$parent;n.controlKey=="pageError"&&typeof r!="undefined"&&r.appName=="DCA"?n.id="pageError-"+n.controlKey+r.screenKey.replace(/[^a-z0-9\s]/gi,"").replace(/[_\s]/g,"-"):n.id="pageError-"+n.controlKey,n.noLinks=typeof e.noLinks!="undefined"?e.noLinks:!1,n.currentVisible=!1,n.alreadyFocusing=!1,n.getItemId=p,n.coords,n.subscriptions.push(n.visible.subscribe(function(e){if(e&&!n.currentVisible)return n.currentVisible=!0,s.onDisplayHandler(n.id,n.focusOnError).then(function(e){n.currentVisible=!1}),!0;e||(n.currentVisible=!1)})),n.inputErrors()&&!n.hasActivated,n.getDescription=function(e){return $(e).remove(".sr-only").text()},n.hasActivated=!0}function l(e,t){return t&&t.forEach(function(t){var n=ko.unwrap(t.oldText),r=ko.unwrap(t.newText);e=e.replace(n,r)}),e}function c(){var e="#"+ko.unwrap(this.elementId),t=10,i=$(e);if(i.length>0){$(document).scrollTop(i.offset().top-n.getTopCompensation()-10);var s=$(e)[0],o,u=["for","htmlFor","data-for"],a=u.some(function(e){return e in s.attributes?function(){return o=s.attributes[e].value,!0}():!1}),f;o&&(f=document.getElementById(o)),f==null&&(f=document.getElementsByName(o)[0]),f!==null&&typeof f!="undefined"?$(f).focus():$(e).focus()}else r.log("pageError - label scroll, id : "+e+" couldnt be found")}function h(e){var t=!0;for(var n=0;n"+n.html()+"");r.find(".sr-only").remove(),r.find(".icon-tooltip").remove();var i=r.text().replace("*","");e.controlLabelObservable(i)})}(o));if(o.errorKey&&o.errorKey!=="")o.errorObservable=e.getErrorMessageByKey(o.errorKey),o.errorDescription=ko.computed(function(){var e=ko.unwrap(o.errorObservable),t=i.processTextMessage(e.text,o.variableText);return t});else if(o.errorDescription&&o.errorDescription!==""){var a={text:o.errorDescription};o.errorDescription=ko.computed(function(){var e=i.processTextMessage(a.text,o.variableText);return e})}else typeof o.validationItem!="undefined"&&typeof o.validationItem.group!="undefined"&&o.validationItem.group!==""&&(o.errorDescription="");return o.canDisplay=ko.computed(function(){try{return typeof o.validationItem!="undefined"&&typeof o.validationItem.group!="undefined"&&o.validationItem.group!==""?!1:o.controlLabelText()?o.controlLabelText().length>0&&o.errorDescription().length>0:!1}catch(e){return r.log("pageError view model silent fail at canDisplay "+e),!1}}),o});return u}var u=function(){};return u.prototype.activate=f,u.prototype.canActivate=a,u.prototype.determineFocusElement=h,u.prototype.processInputErrors=d,u.prototype.processTextMessage=l,u.prototype.labelScroll=c,u.prototype.deactivate=function(){this.subscriptions.forEach(function(e){e.dispose()}),this.isVisible.dispose()},u}),define("shared/widgets/pagination/viewmodel",["durandal/app","jquery","durandal/composition","shared/services/common","shared/services/constants","shared/services/errorHandler","knockout","shared/services/uiHelper"],function(e,t,n,r,i,s,o,u){var a=function(){};return a.prototype.activate=function(n){function c(t){var n="pagination-Alert",r={heading:a.modalHeading,message:a.modalMessage,focusOnShow:!0,buttons:[{text:i.saveModalDetails.SecondaryButtonText,fn:function(){e.trigger(n+":modal:close"),t.resolve("no")},buttonType:"secondary"},{text:i.saveModalDetails.PrimaryButtonText,fn:function(){e.trigger(n+":modal:close"),t.resolve("yes")},buttonType:"primary"}]};return e.trigger(n+":modal:open",r),!0}var a=this;a.area=u.getApplicationArea(),a.totalRecords=r.observableFromParam(n.totalRecords);if(isNaN(a.totalRecords()))throw new Error("pagination: settings.totalRecords is required");a.currentPage=r.observableFromParam(n.currentPage,1),a.onPageChange=n.onPageChange,a.pageSizeControlId="pagesize",a.readOnlyPageInput=r.observableFromParam(n.readOnlyPageInput,!1),a.displayPageTotal=r.observableFromParam(n.displayPageTotal,!0),a.pageSizeStatic=o.observable(Number(o.unwrap(n.pageSizeStatic))||undefined),r.isDefined(n.controlKey)?(a.paginationId="textcurrentPage_"+n.controlKey,a.btnPrevious="btn-previous_"+n.controlKey,a.btnNext="btn-next_"+n.controlKey,a.pageSizeInput="ddl-pageSizeInput_"+n.controlKey,a.spnPage="spnPage_"+n.controlKey,a.spnPageTotal="spnPageTotal_"+n.controlKey):(a.paginationId="textcurrentPage",a.btnPrevious="btn-previous",a.btnNext="btn-next",a.pageSizeInput="ddl-pageSizeInput",a.spnPage="spnPage",a.spnPageTotal="spnPageTotal"),r.isDefined(n.showModal)?a.showModal=n.showModal:a.showModal=!1,r.isDefined(n.modalHeading)?a.modalHeading=n.modalHeading:a.modalHeading=i.saveModalDetails.modalHeading,r.isDefined(n.modalMessage)?a.modalMessage=n.modalMessage:a.modalMessage=i.saveModalDetails.modalMessage,a.currentPageText=o.observable(1),a.currentPageText(a.currentPage()),r.isDefined(n.pageSize)?(a.pageSize=n.pageSize,a.minPageSize=o.observable(o.unwrap(n.pageSize))):(a.minPageSize=o.observable(i.paginationPageSize.Default),a.pageSize=o.observable(i.paginationPageSize.Default)),r.isDefined(n.pageSizeList)?a.pageSizeList=n.pageSizeList:a.pageSizeList=o.observableArray(i.paginationPageSize.Options),a.pageSizeSelected=o.observable(1),a.pageSizeSelected(a.pageSize()),a.pageCount=o.computed(function(){var e=Math.ceil(a.totalRecords()/a.pageSize());return e<1&&(e=1),e}),a.instruction=function(){return"Enter number between 1 and "+a.pageCount()},a.paginationVisible=o.computed(function(){return a.totalRecords()>a.minPageSize()}),a.errorsArraySettings=[{item:a.currentPage,widget:"textBox",controlKey:"currentPage",label:"Current Page",validations:[{autoValidate:!0,type:"integerWithinRange",errorKey:"EM0052",variableText:[{oldText:"{pageCount}",newText:a.pageCount}],settings:{start:1,end:a.pageCount}}]}],a.errorHandler=s.createErrorHandler(a.errorsArraySettings),a.errors=a.errorHandler.errors,a.page_error=o.computed(function(){return a.errorHandler.anyErrors()}),a.currentPage.subscribe(function(e){if(!a.page_error()){var t=Number(e)*a.pageSize()-a.pageSize(),n=t+a.pageSize();a.onPageChange(t,n)}});if(!a.page_error()){var f=a.currentPage()*a.pageSize()-a.pageSize(),l=f+a.pageSize();a.onPageChange(f,l)}a.next=function(e,n,r,i){var s="",o;Number(a.currentPage())+1!==a.pageCount()?o=r.currentTarget:o=t("#"+i)[0],a.currentPageText()1&&a.currentPageText(Number(a.currentPage())-1),typeof o!="undefined"&&(s=o.id),a.showMessage(e,n,s)},a.changeCurrentPage=function(e,t,n,r){if(typeof r!="undefined"&&r.type==="keyup"){var i="",s=r.currentTarget;typeof s!="undefined"&&(i=s.id),a.showMessage(t,n,i)}},a.previousDisabled=o.pureComputed(function(){return Number(a.currentPage())===1?!0:a.page_error()}),a.ofPageTotal=o.pureComputed(function(){return" of "+a.pageCount()}),a.changeResultPerPage=function(e,t,n,r){if(typeof t!="undefined"&&t.type==="change"){var i="",s=t.currentTarget,o=a.pageSize();a.currentPageText(1),o!==e.pageSizeSelected()?(typeof s!="undefined"&&(i=s.id),a.showMessage(n,r,i,o)):(a.pageSize(a.pageSizeSelected()),a.currentPage(a.currentPageText()))}},a.showMessage=function(t,n,r,i){if(typeof t!="undefined"&&(a.currentPageText().toString()!==a.currentPage().toString()||a.pageSizeSelected().toString()!==a.pageSize().toString()))if(t.collectionViewModel.collection().length>0&&(t.collectionViewModel.activeEditRow()!==-1||t.collectionViewModel.addVisible()))if(a.showModal){var s=t.collectionViewModel.getActiveEditRowObject(),o=Q.defer();c(o),o.promise.then(function(o){if(o==="yes"){var f=t.collectionViewModel.addVisible()?t.collectionViewModel.validateAndShowAdd():t.collectionViewModel.validateAndShowEdit(s);if(f)if(t.collectionViewModel.addVisible()){var l=t.collectionViewModel.addObject,c="commitAdd"in n.handlers;if(c){var h=t.collectionViewModel.setupCommitHandler(t,n.handlers.commitAdd);h.then(function(i){if(i){t.collectionViewModel.commitAdd(l),t.collectionViewModel.setupSuccessHandler(n.handlers.commitAdd,t);var s=u.getAppName();e.trigger(s+":pagination:update"),a.pageSize(a.pageSizeSelected()),a.currentPage(Number(a.currentPageText()))}u.scrollToTop({selector:"#"+r,focus:!0})})}else t.collectionViewModel.commitAdd(l),a.pageSize(a.pageSizeSelected()),a.currentPage(Number(a.currentPageText())),u.scrollToTop({selector:"#"+r,focus:!0})}else{var l=t.collectionViewModel.getActiveEditRowObject(),p="commitEdit"in n.handlers;if(p){var h=t.collectionViewModel.setupCommitHandler(t,n.handlers.commitEdit);h.then(function(i){if(i){t.collectionViewModel.commitEdit(l),t.collectionViewModel.setupSuccessHandler(n.handlers.commitEdit,t);var s=u.getAppName();e.trigger(s+":pagination:update"),a.pageSize(a.pageSizeSelected()),a.currentPage(Number(a.currentPageText()))}u.scrollToTop({selector:"#"+r,focus:!0})})}else t.collectionViewModel.commitEdit(l),a.pageSize(a.pageSizeSelected()),a.currentPage(Number(a.currentPageText())),u.scrollToTop({selector:"#"+r,focus:!0})}else a.currentPageText(a.currentPage()),typeof i!="undefined"&&a.pageSizeSelected(i),u.focusFirstFocusableItem("#top-of-row",!0)}else a.currentPageText(a.currentPage()),typeof i!="undefined"&&a.pageSizeSelected(i),u.focusFirstFocusableItem("#top-of-row")})}else t.collectionViewModel.addVisible()?t.collectionViewModel.cancelAdd():t.collectionViewModel.cancelEdit(),u.scrollToTop({selector:"#"+r,focus:!0}),a.currentPage(a.currentPageText());else a.pageSize(a.pageSizeSelected()),a.currentPage(a.currentPageText()),u.scrollToTop({selector:"#"+r,focus:!0})},e.on("pagination:changePage").then(function(e){a.currentPageText(e),a.currentPage(a.currentPageText())})},a}),define("shared/widgets/parentTest/viewmodel",["durandal/composition","require","jquery","knockout","services/logger"],function(e,t,n,r,i){var s=function(){};return s.prototype.activate=function(e){var t=this;t.settings=e,t.c1dataItem=t.settings.c1dataItem,t.c1controlKey=r.unwrap(t.settings.c1controlKey),t.c1questionText=r.unwrap(t.settings.c1questionText),t.c1items=r.unwrap(t.settings.c1items),t.c2dataItem=t.settings.c2dataItem,t.c2controlKey=r.unwrap(t.settings.c2controlKey),t.c2questionText=r.unwrap(t.settings.c2questionText),t.c2items=r.unwrap(t.settings.c2items)},s.prototype.attached=function(e){i.log("parentTest viewmodel","parentTest widget attached function called. ControlKey="+self.controlKey,"parentTest viewmodel",!1),n(e).trigger("create")},s}),define("shared/widgets/printButton/viewmodel",["durandal/composition","require","jquery","knockout","services/logger","shared/services/uiHelper"],function(e,t,n,r,i,s){var o=function(){};return o.prototype.activate=function(e){e.settings&&n.extend(e,e.settings),this.printSelector=typeof e.printSelector=="undefined"?'.spa [data-active-view="true"]':e.printSelector,this.printHTML=e.printHTML,this.settings=e,this.visible=e.visible?e.visible:!0,this.customDisclaimerText=e.customDisclaimerText,this.buttonType=e.buttonType||e.printButtonType?e.buttonType||e.printButtonType:"primary",this.buttonText=e.buttonText||e.printButtonText?e.buttonText||e.printButtonText:"Print or Save";if(e.buttonClass)this.buttonClass=e.buttonClass;else if(this.buttonType=="primary")this.buttonClass="btn btn-primary";else{if(this.buttonType!="secondary")throw"Print button - no valid button type provided - provided: "+this.buttonType;this.buttonClass="btn btn-default"}},o.prototype.printScreen=function(){s.printScreen({printHTML:this.printHTML,printSelector:this.printSelector,printMargin:this.settings.printMargin||this.settings.printMargin,title:this.settings.title||this.settings.printTitle,customDisclaimerText:this.customDisclaimerText})},o}),define("shared/widgets/progressBar/viewmodel",["durandal/composition","require","jquery","knockout","plugins/router"],function(e,t,n,r,i,s){var o=function(){};return o.prototype.activate=function(e){var n=this;n.settings=e,n.isVisible=r.computed(function(){var t;return e.isVisible&&(e.percent||e.computedObservablePath)?t=r.unwrap(e.isVisible):t=!1,t}),e.computedObservablePath?(n.setupObservable=Q.defer(),t([e.computedObservablePath],function(e){n.percent=e,n.setupObservable.resolve()})):n.percent=r.computed(function(){var t;return e.percent?t=r.unwrap(e.percent):t=0,t});if(typeof n.setupObservable!="undefined")return n.setupObservable.promise},o.prototype.attached=function(e){n(e).trigger("create")},o}),define("shared/widgets/questionSlider/viewmodel",["durandal/composition","require","jquery","knockout","services/logger"],function(e,t,n,r,i){var s=function(){};return s.prototype.activate=function(e){var t=this;t.settings=e,t.dataItem=t.settings.dataItem,t.controlKey=r.unwrap(t.settings.controlKey),t.questionText=r.unwrap(t.settings.questionText),t.items=r.unwrap(t.settings.items),t.widgetArea=t.settings.widgetArea},s.prototype.attached=function(e){i.log("questionSlider viewmodel","questionSlider widget attached function called. ControlKey="+self.controlKey,"questionSlider viewmodel",!1),n(e).trigger("create")},s}),define("shared/widgets/readMore/viewmodel",["durandal/composition","require","jquery","knockout","services/logger","shared/services/common","shared/services/uiHelper"],function(e,t,n,r,i,s,o){var u=function(){};return u.prototype.activate=function(e){var t=this;t.area=o.getApplicationArea(),t.readText=r.observable("Read more"),t.readChevronClass=r.observable("glyphicon glyphicon-chevron-down");if(e===undefined)throw"readMore widget configuration - not configured correctly.";t.defaultSettings={html:"N/A"},t.settings=e;if(e.controlKey===undefined)throw"readMore widget configuration - controlKey instance not specified.";s.isDefined(e.visible)?t.visible=e.visible:t.visible=!0,t.controlKey=e.controlKey,t.readMoreId="readMore_"+t.controlKey,t.readMoreSpanId="readMoreSpan_"+t.controlKey,t.readMoreChevronId="readMoreChevron_"+t.controlKey,t.html=e.html,t.displayReadMore=r.observable(!0),t.previousItem=r.observable(),t.clickHandler=function(){var e=t.settings.parent.parentElement;if(e!=undefined){var r=e.getElementsByClassName("collapse in"),i=t.settings.parent.getElementsByClassName("collapse")[0];if(i!=undefined)var s=i.id;if(r.length==1){t.previousItem=r[0].id;var o=t.previousItem.replace("readMore","#readMoreSpan"),u=t.previousItem.replace("readMore","#readMoreChevron"),a=s.replace("readMore","#readMoreSpan"),f=s.replace("readMore","#readMoreChevron");t.previousItem!=s?(r[0].className="collapse",n(e).find(o).text()=="Read more"?(n(e).find(o).text("Read less"),n(e).find(a).text("Read more"),t.addRemoveCheveron(e,u,f,!0)):(n(e).find(o).text("Read more"),n(e).find(a).text("Read less"),t.addRemoveCheveron(e,u,f,!1))):(r[0].className="collapse in",t.updateReadMore(e,a),t.updateCheveron(e,f),t.previousItem=s)}else a=s.replace("readMore","#readMoreSpan"),f=s.replace("readMore","#readMoreChevron"),e=t.settings.parent.parentElement,t.updateReadMore(e,a),t.updateCheveron(e,f)}},t.updateReadMore=function(e,t){n(e).find(t).text()=="Read less"?n(e).find(t).text("Read more"):n(e).find(t).text("Read less")},t.addRemoveCheveron=function(e,t,r,i){i?(n(e).find(t).removeClass("glyphicon glyphicon-chevron-down").addClass("glyphicon glyphicon-chevron-up"),n(e).find(r).removeClass("glyphicon glyphicon-chevron-up").addClass("glyphicon glyphicon-chevron-down")):(n(e).find(t).removeClass("glyphicon glyphicon-chevron-up").addClass("glyphicon glyphicon-chevron-down"),n(e).find(r).removeClass("glyphicon glyphicon-chevron-down").addClass("glyphicon glyphicon-chevron-up"))},t.updateCheveron=function(e,t){n(e).find(t).attr("class")=="glyphicon glyphicon-chevron-up"?n(e).find(t).removeClass("glyphicon glyphicon-chevron-up").addClass("glyphicon glyphicon-chevron-down"):n(e).find(t).removeClass("glyphicon glyphicon-chevron-down").addClass("glyphicon glyphicon-chevron-up")},t.displayReadMore(!t.displayReadMore())},u.prototype.attached=function(e){var t=this;i.log("readMore viewmodel","readMore widget attached function called. ControlKey="+t.controlKey,"readMore viewmodel",!1)},u}),define("shared/widgets/reveal/viewmodel",["durandal/composition","plugins/router","require","jquery","knockout","services/logger","shared/services/widgetHelper"],function(e,t,n,r,i,s,o){var u=function(){},a=500;return u.prototype.activate=function(e){var t=this;t.disposables=[],t.settings=e,t.panelId="reveal_pnl_"+e.controlKey,t.btnId="reveal_btn_"+e.controlKey,typeof e.rowClass!="undefined"?t.rowClass=i.observable(e.rowClass):t.rowClass=i.observable("row"),typeof e.groupClass!="undefined"?t.groupClass=i.observable(e.groupClass):t.groupClass=i.observable("col-xs-12"),typeof e.moreText!="undefined"?t.moreText=i.observable(e.moreText):t.moreText=i.observable("More"),typeof e.lessText!="undefined"?t.lessText=i.observable(e.lessText):t.lessText=i.observable("Less"),typeof e.isExpandable!="undefined"?t.isExpandable=i.observable(e.isExpandable):t.isExpandable=i.observable(!0),typeof e.isExpanded!="undefined"?t.isExpanded=i.observable(e.isExpanded):t.isExpanded=i.observable(!1),typeof e.btnClass!="undefined"?t.btnClass=e.btnClass:t.btnClass="",t.toggleCallback=e.toggleCallback,t.isInitiallyHidden=!t.toggleCallback&&!t.isExpanded(),t.panelHasFocus=i.observable(!1),t.text=i.pureComputed(function(){return t.isExpanded()?t.lessText():t.moreText()}),t.questionText=e.questionText,t.animate=function(e){var n=r("#"+t.panelId),i=t.toggleCallback||!e?n.height():0;e?t.originalHeight=i:t.originalHeight||(t.originalHeight=0),n.height(i),n.css("overflow","hidden"),n.css("display","block"),t.toggleCallback&&t.toggleCallback.start(e);var s=e?n.get(0).scrollHeight:t.originalHeight;n.animate({height:s},a,"linear",function(){t.toggleCallback&&t.toggleCallback.end(e),n.height("auto"),n.css("overflow",""),!t.toggleCallback&&!e&&n.css("display","none"),e&&!t.toggleCallback&&t.panelHasFocus(!0)})},t.click=function(){t.isExpanded(!t.isExpanded())},t.disposables.push(t.isExpanded.subscribe(function(){t.animate(t.isExpanded())})),t.dispose=function(){i.utils.arrayForEach(t.disposables,function(e){e.dispose()})}},u.prototype.attached=function(e){var t=this;s.log("reveal viewmodel","reveal widget attached function called. ControlKey="+t.settings.controlKey,"reveal viewmodel",!1)},u}),define("services/jqmutil",[],function(){return{triggerCreate:function(e){$(e).trigger("create")}}}),define("shared/widgets/slidemenu/viewmodel",["durandal/app","plugins/router","services/logger","services/jqmutil"],function(e,t,n,r){function s(){return n.log("Menu Widget Activated",null,"Home",!0),!0}function o(e){r.triggerCreate(e)}var i={activate:s,attached:o};return i}),define("shared/widgets/textArea/viewmodel",["durandal/composition","require","moment","jquery","knockout","services/logger","shared/services/common","shared/services/helpProvider","shared/services/widgetHelper","shared/services/uiHelper"],function(e,t,n,r,i,s,o,u,a,f){function c(){}var l=function(){};return l.prototype.activate=function(e){var t=this;this.settings=e,this.area=e.area,this.editableData=e.editableData,this.labelText=e.labelText||e.questionText,e.infoTooltip?this.infoTooltip=e.infoTooltip:e.helpId&&(this.infoTooltip={helpId:e.helpId}),u.setWidgetHelpPropertiesOnActivate(this,e),this.controlKey=e.controlKey,this.dataItem=e.dataItem,this.altKey=e.altKey,e.readOnly&&(this.readOnly=e.readOnly),this.labelId=e.labelId?e.labelId:"lbl"+e.controlKey,this.inputId=e.inputId?e.inputId:"text"+e.controlKey,e.hasHadFocus&&i.isObservable(e.hasHadFocus)&&(this.hasHadFocus=e.hasHadFocus),e.hasError?this.hasError=e.hasError:this.hasError=!1,o.isDefined(e.visible)?this.visible=e.visible:this.visible=!0,e.isMandatory?this.isMandatory=e.isMandatory:this.isMandatory=!1,this.columnsClass="col-xs-10 col-sm-8";if(e.inputColumnsClass||e.columnsClass)this.columnsClass=e.inputColumnsClass||e.columnsClass;if(e.inputColumnsClass==""||e.columnsClass=="")this.columnsClass="col-xs-12";typeof this.type=="undefined"&&(this.placeHolderText=e.placeHolderText?e.placeHolderText:"",e.maxLength?this.maxLength=e.maxLength.toString():this.maxLength=""),e.cols?this.cols=e.cols.toString():this.cols="",e.rows?this.rows=e.rows.toString():this.rows="",this.inputAttr={id:this.inputId,placeholder:this.placeHolderText,maxlength:this.maxLength,cols:this.cols,rows:this.rows,"aria-invalid":this.hasError,"aria-required":this.isMandatory},this.readOnly&&(this.inputAttr.disabled=this.readOnly),e.inputAttr&&r.extend(this.inputAttr,e.inputAttr)},l.prototype.compositionComplete=function(e){var t=this;this.hasHadFocus&&r(e).find("input").one("blur",function(e){t.hasHadFocus(!0)})},l}),define("shared/widgets/textBox/viewmodel",["durandal/composition","require","moment","jquery","knockout","services/logger","shared/services/validator","shared/services/common","shared/services/helpProvider","shared/services/widgetHelper","shared/services/uiHelper"],function(e,t,n,r,i,s,o,u,a,f,l){var c=function(){};return c.prototype.setPredifinedTypes=function(){this.type=="date"&&!this.readOnly?(this.addDatePicker=!0,this.placeHolderText="dd/mm/yyyy",this.rightAddOnText='',this.maxLength=10,this.columnsClass="col-sm-3 col-md-3"):this.type!="currency"&&this.type=="currencyNoCents"},c.prototype.activate=function(e){var t=this;this.settings=e,this.area=e.area,this.editableData=e.editableData,this.labelText=e.labelText||e.questionText,this.hideLabelText=e.hideLabelText||!1,e.infoTooltip&&(this.infoTooltip=e.infoTooltip),e.infoTooltipCdn?this.infoTooltipCdn=e.infoTooltipCdn:e.helpId&&(this.infoTooltip={helpId:e.helpId}),a.setWidgetHelpPropertiesOnActivate(this,e),this.controlKey=e.controlKey,this.dataItem=e.dataItem,this.altKey=e.altKey,this.leftAddOnText=e.leftAddOnText,this.leftAddOnCss=u.isDefined(e.leftAddOnCss)?e.leftAddOnCss:{},this.rightAddOnText=e.rightAddOnText,e.readOnly&&(this.readOnly=e.readOnly),e.type&&(this.type=e.type,this.setPredifinedTypes()),this.labelId=e.labelId?e.labelId:"lbl"+e.controlKey,this.inputId=e.inputId?e.inputId:"text"+e.controlKey,e.hasHadFocus&&i.isObservable(e.hasHadFocus)&&(this.hasHadFocus=e.hasHadFocus),e.hasError?this.hasError=e.hasError:this.hasError=!1,u.isDefined(e.visible)?this.visible=e.visible:this.visible=!0,e.isMandatory?this.isMandatory=e.isMandatory:this.isMandatory=!1,this.columnsClass="col-xs-10 col-sm-4";if(e.inputColumnsClass||e.columnsClass)this.columnsClass=e.inputColumnsClass||e.columnsClass;if(e.inputColumnsClass==""||e.columnsClass=="")this.columnsClass="col-xs-12";typeof this.type=="undefined"?(this.placeHolderText=e.placeHolderText?e.placeHolderText:"",e.maxLength?this.maxLength=e.maxLength.toString():this.maxLength="",this.addDatePicker=e.addDatePicker&&!this.readOnly?e.addDatePicker:!1,e.dateSettings&&(this.dateSettings=e.dateSettings)):this.type=="date"&&this.readOnly&&(this.addDatePicker=!1),e.inputAlignRight?this.inputAlignRight=e.inputAlignRight:this.inputAlignRight=!1,e.leftAddOnVisible?this.leftAddOnVisible=e.leftAddOnVisible:this.leftAddOnVisible=e.leftAddOnText?!0:!1,e.rightAddOnVisible?this.rightAddOnVisible=e.rightAddOnVisible:this.type=="date"?this.readOnly?this.rightAddOnVisible=!1:this.rightAddOnVisible=!0:this.rightAddOnVisible=e.rightAddOnText?!0:!1,this.inputAttr={id:this.inputId,placeholder:this.placeHolderText,maxlength:this.maxLength,"aria-invalid":this.hasError,"aria-required":this.isMandatory,name:this.inputId,"aria-labelledby":this.labelId},this.readOnly&&(this.inputAttr.disabled=this.readOnly),e.inputAttr&&r.extend(this.inputAttr,e.inputAttr),e.setDecimalPlacesOnBlur?this.setDecimalPlacesOnBlur=e.setDecimalPlacesOnBlur:this.setDecimalPlacesOnBlur=!1,e.setThousandSeperatorOnBlur?this.setThousandSeperatorOnBlur=e.setThousandSeperatorOnBlur:this.setThousandSeperatorOnBlur=!1,this.setFormattingOnBlur=function(e,t){this.settings.setDecimalPlacesOnBlur&&this.setDecimalPlacesOnBlur(e,t),this.settings.setThousandSeperatorOnBlur&&this.setThousandSeperatorOnBlur(e,t)},this.setDecimalPlacesOnBlur=function(e,t){var n=u.countDecimals(e.dataItem()),r=e.dataItem().length,i=0,s=e.dataItem();this.settings.setThousandSeperatorOnBlur&&(s=o.removeThousandSeperator(s),i=s.length);if(s.length>0&&!isNaN(s)&&n<2){if(n==0&&s.length<=e.maxLength-3||n==1&&s.length<=e.maxLength-1)s=parseFloat(s).toFixed(2)}else s.length>0&&!isNaN(s)&&n>2&&(s=u.truncateCurrency(s,2));i>0&&i0&&!isNaN(t)&&e.dataItem(u.thousandSeperator(t))}}},c.prototype.compositionComplete=function(e){var t=this;if(this.addDatePicker){var i={language:"en",weekStart:1,todayBtn:1,autoclose:1,todayHighlight:1,startView:2,minView:2,forceParse:!1,format:"dd/mm/yyyy",pickerPosition:"bottom-right",container:l.getElementContainer(e),keyboardNavigation:!1,inLine:!1,bootcssVer:3};this.dateSettings?r.extend(i,this.dateSettings):this.dateSettings=i;var s=r(e).find(".date");s.datetimepicker(this.dateSettings).find("input").off("focus").on("click keydown",function(e){var t=(e.keyCode||e.which)==9?"hide":"show";s.datetimepicker(t)}),this.focusOutEvent=s.find("input").on("focusout",function(e){var t=["D/MM/YYYY","DD/MM/YYYY","D/M/YYYY","D/MM/YYYY"],r=n(this.dataItem(),t,!0);if(r.isValid()){var i=r.format("DD/MM/YYYY");this.dataItem(i)}}.bind(t)),this.settings.afterLabelSrHtml=' - enter a date in the format dd/mm/yyyy'}this.hasHadFocus&&r(e).find("input").one("blur",function(e){t.hasHadFocus(!0)}),this.maxLength!==""&&r(e).find("input").keydown(function(e){this.value.length==this.maxLength&&(e.value="")});if(this.settings.afterLabelSrHtml||this.settings.beforeLabelSrHtml)if(r(e).find("label .sr-only").length==0){var o=r(e).find('label span[data-part="questionLabelText"]');o.length>0&&(u.isDefined(this.settings.beforeLabelSrHtml)&&(r(o[0].firstChild).hasClass("sr-only")||o.prepend(this.settings.beforeLabelSrHtml)),u.isDefined(this.settings.afterLabelSrHtml)&&(r(o[0].lastChild).hasClass("sr-only")||o.append(this.settings.afterLabelSrHtml)))}},c.prototype.detached=function(e,t){var n=r(e).find(".date");n&&n.datetimepicker("remove"),this.focusOutEvent&&this.focusOutEvent.off()},c}),define("shared/widgets/toggle/viewmodel",["durandal/composition","require","moment","jquery","knockout","services/logger","shared/services/common","shared/services/helpProvider","shared/services/widgetHelper","shared/services/uiHelper"],function(e,t,n,r,i,s,o,u,a,f){var l=function(){};return l.prototype.activate=function(e){var t=this;this.settings=e,this.area=e.area,this.labelText=e.labelText||e.questionText,this.controlKey=e.controlKey,this.dataItem=e.dataItem||e.item,this.altKey=e.altKey,this.questionGroupName="tgl-question-name-"+this.controlKey,this.items=e.listItems||e.items,this.activeItemIndex=e.activeItemIndex,this.labelId=e.labelId?e.labelId:"lbl"+e.controlKey,this.inputId=e.inputId?e.inputId:"text"+e.controlKey,e.hasHadFocus&&i.isObservable(e.hasHadFocus)&&(this.hasHadFocus=e.hasHadFocus),e.hasError?this.hasError=e.hasError:this.hasError=!1,o.isDefined(e.visible)?this.visible=e.visible:this.visible=!0,e.isMandatory?this.isMandatory=e.isMandatory:this.isMandatory=!1,this.columnsClass="col-xs-10 col-sm-4";if(e.inputColumnsClass||e.columnsClass)this.columnsClass=e.inputColumnsClass||e.columnsClass;if(e.inputColumnsClass==""||e.columnsClass=="")this.columnsClass="col-xs-12";this.dataItem()==""&&(o.isDefined(this.activeItemIndex)?this.dataItem(this.items()[this.activeItemIndex-1].key()):this.dataItem(this.items()[0].key())),this.itemsToBind=i.computed(function(){var e=this;return i.unwrap(this.items).map(function(t,n,r){var s="btn btn-default";return i.unwrap(t.key)==e.dataItem()?t.toggleClass=s+" active":t.toggleClass=s,t.tbIndex=n+1,t})},this),this.buttonClass="btn-group btn-group-justified "+this.columnsClass,typeof this.type=="undefined"?(this.placeHolderText=e.placeHolderText?e.placeHolderText:"",e.maxLength?this.maxLength=e.maxLength.toString():this.maxLength="",this.addDatePicker=e.addDatePicker&&!this.readOnly?e.addDatePicker:!1,e.dateSettings&&(this.dateSettings=e.dateSettings)):this.type=="date"&&this.readOnly&&(this.addDatePicker=!1),e.inputAlignRight?this.inputAlignRight=e.inputAlignRight:this.inputAlignRight=!1,this.inputAttr={id:this.inputId,placeholder:this.placeHolderText,maxlength:this.maxLength,"aria-invalid":this.hasError,"aria-required":this.isMandatory},this.readOnly&&(this.inputAttr.disabled=this.readOnly),this.itemClick=function(e,n){t.dataItem(e.key())},e.inputAttr&&r.extend(this.inputAttr,e.inputAttr)},l.prototype.compositionComplete=function(e){var t=this;this.hasHadFocus&&r(e).find("input").one("blur",function(e){t.hasHadFocus(!0)});if(this.settings.afterLabelSrHtml||this.settings.beforeLabelSrHtml)if(r(e).find("label .sr-only").length==0){var n=r(e).find('label span[data-part="questionLabelText"]');n.length>0&&(o.isDefined(this.settings.beforeLabelSrHtml)&&(r(n[0].firstChild).hasClass("sr-only")||n.prepend(this.settings.beforeLabelSrHtml)),o.isDefined(this.settings.afterLabelSrHtml)&&(r(n[0].lastChild).hasClass("sr-only")||n.append(this.settings.afterLabelSrHtml)))}},l}),define("shared/widgets/utilityToolbar/viewmodel",["durandal/composition","require","jquery","knockout","services/logger","shared/services/uiHelper"],function(e,t,n,r,i,s){function u(){var e=this;n("#saveModal").one("hidden.bs.modal",function(t){e.datacontext.saveQuestionsToStorage()})}function a(){var e=this;n("#saveModal").one("hidden.bs.modal",function(t){e.datacontext.loadQuestionsFromStorage()})}function f(){}var o=function(){};return o.prototype.activate=function(e){var t=this;this.settings=e,this.facebook="https://www.facebook.com/sharer/sharer.php?u="+encodeURIComponent(e.url),e.twitterMessage?this.twitterMessage=e.twitterMessage:this.twitterMessage=encodeURIComponent(e.title)+encodeURIComponent(" - ")+encodeURIComponent(e.url)+encodeURIComponent(" - @ato_gov_au"),this.twitter="https://twitter.com/home?status="+this.twitterMessage,this.linkedIn="https://www.linkedin.com/shareArticle?mini=true&url="+encodeURIComponent(e.url)+"&title="+encodeURIComponent(e.title)+"&summary="+encodeURIComponent(e.linkedInSummary),e.mailBody?this.mailBody=encodeURIComponent(e.mailBody):this.mailBody=encodeURIComponent("Below is a link to the "+e.title+" calculator page: \n\n")+encodeURIComponent(e.url),this.mail="mailTo:?subject="+encodeURIComponent(e.title)+"&body="+this.mailBody,this.visible=e.isVisible||e.visible,this.showToolbar=r.computed(function(){var e;return t.visible?e=r.unwrap(t.visible):e=!1,e}),e.datacontext&&(this.datacontext=e.datacontext),this.showSave=r.computed(function(){var t;return e.showSave&&e.datacontext?t=r.unwrap(e.showSave):t=!1,t}),this.saveClick=u,this.loadClick=a,this.deleteClick=f,this.printSelector=typeof e.printSelector=="undefined"?'.spa [data-active-view="true"]':e.printSelector},o.prototype.printScreenWeb=function(){var e=n("i.glyphicon-chevron-down");n("i.glyphicon-chevron-right").removeClass("glyphicon-chevron-right").addClass("glyphicon-chevron-down"),setTimeout(function(){window.print(),n("i").not(e).removeClass("glyphicon-chevron-down").addClass("glyphicon-chevron-right")},100)},o.prototype.printScreen=function(){var e=typeof this.settings.printHTML!="undefined"?n("
").html(r.unwrap(this.settings.printHTML)):n(this.printSelector).clone(!1);e.find("div .hidden-print").remove(),e.find(".visible-print, .visible-print-block").removeClass("visible-print visible-print-block");var t=e.html(),i=window.open();if(window.location.href.toUpperCase().indexOf("EXPERTSYSTEMS")>=0)var o='';else var o=s.getCssHtml();var u="Calculator print"+o+"";i.document.write(u);var a='',f="

",l='

Our commitment to you

We are committed to providing you with accurate, consistent and clear information to help you understand your rights and entitlements and meet your obligations.

If you follow our information and it turns out to be incorrect, or it is misleading and you make a mistake as a result, we will take that into account when determining what action, if any, we should take.

Some of the information on this website applies to a specific financial year. This is clearly marked. Make sure you have the information for the right year before making decisions based on that information.

If you feel that our information does not fully cover your circumstances, or you are unsure how it applies to you, contact us or seek professional advice.

Copyright notice

© Australian Taxation Office for the Commonwealth of Australia

You are free to copy, adapt, modify, transmit and distribute this material as you wish (but not in any way that suggests the ATO or the Commonwealth endorses you or any of your services or products).

 
';typeof this.settings.container!="undefined"?i.document.write("
"+f):i.document.write("
"+f),this.settings.title&&i.document.write("

"+this.settings.title+"

"),i.document.write(a+"
"+t+"
"+l+"
"),i.document.write(""),i.document.close()},o.prototype.attached=function(e){n(e).find("#btnEmail, #btnPrint, #btnShare").click(function(e){e.target.blur()})},o}),define("shared/widgets/verticalQuestionGroups/viewmodel",["durandal/composition","require","jquery","knockout","shared/services/errorMessageProvider"],function(e,t,n,r,i){var s=function(){};return s.prototype.activate=function(e){var t=this},s.prototype.attached=function(e){},s}),define("shared/widgets/verticalRadio/viewmodel",["durandal/composition","plugins/router","require","jquery","knockout","services/logger","shared/services/helpProvider","shared/services/widgetHelper"],function(e,t,n,r,i,s,o,u){var a=function(){};return a.prototype.activate=function(e){var t=this;t.settings=e,t.dataItem=t.settings.dataItem,t.controlKey=i.unwrap(t.settings.controlKey),typeof t.controlKey=="undefined"&&(t.controlKey=""),t.questionId="lbl-"+t.controlKey,t.questionGroupName="vrb-question-name-"+t.controlKey,t.questionText=t.settings.questionText,t.questionTextId="span-vrb-question-"+t.controlKey,t.itemsHelp=t.settings.itemsHelp,t.itemsTooltip=t.settings.itemsTooltip,t.sectionHeadings=t.settings.sectionHeadings,t.items=i.computed(function(){o.setWidgetListHelpItems(t.settings.items,t.settings.itemsHelp);var e={key:"",heading:""};return i.unwrap(t.settings.items).forEach(function(n){var r=i.toJS(n).key,s=!1,o=!1;t.sectionHeadings&&t.sectionHeadings.some(function(t){return t.key==r?function(){return e=t,o=!0,!0}():!1});var u=i.unwrap(n);return u.heading=e,u.isFirstHeading=o,u.label=e.heading+" - "+i.unwrap(n.value),n}),i.unwrap(t.settings.items)}),e.readOnly?t.disabled=e.readOnly:t.disabled=!1,t.widgetArea=t.settings.widgetArea,t.other=t.settings.other,e.hasError?t.hasError=e.hasError:t.hasError=!1,e.isMandatory?t.isMandatory=e.isMandatory:t.isMandatory=!1,e.infoTooltip&&(this.infoTooltip=e.infoTooltip),typeof e.showMandatoryAsterisk!="undefined"?t.showMandatoryAsterisk=e.showMandatoryAsterisk:t.showMandatoryAsterisk=!0;if(e.columnsClass)t.columnsClass=e.columnsClass;else if(e.inputMdColumns)isNaN(parseInt(e.inputMdColumns))?s.logError("vertical radio widget - invalid input md columns provided","vertical radio widget"):t.columnsClass="col-xs-12 col-sm-12 col-md-"+String(e.inputMdColumns);else{var n=0;t.items().forEach(function(e){var t=i.unwrap(e.value).length;t>n&&(n=t)}),n<=15?t.columnsClass="col-xs-7 col-sm-5 col-md-3":n<=25?t.columnsClass="col-xs-12 col-sm-7 col-md-5":n<=35?t.columnsClass="col-xs-12 col-sm-8 col-md-6":t.columnsClass="col-xs-12 col-sm-9 col-md-8"}t.valueToBind=function(e){var t=i.toJS(e);return t.html?t.html:t.value},e.hasHadFocus&&i.isObservable(e.hasHadFocus)&&(this.hasHadFocus=e.hasHadFocus),o.setWidgetHelpPropertiesOnActivate(this,e)},a.prototype.compositionComplete=function(e,t){var n=this;r.each(r(e).find("span[id|='vrb-"+n.controlKey+"-span']"),function(e,t){i.applyBindingsToDescendants({},t)}),u.attachFocusHandler.call(this,e)},a}),define("SharedServices.atogov.min",function(){});