if(!function(e,t){"object"==typeofmodule&&"object"==typeofmodule.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throwError("jQuery requires a window with a document");returnt(e)}:t(e)}("undefined"!=typeofwindow?window:this,function(e,t){functionn(e){vart=e.length,n=at.type(e);return"function"===n||at.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||0===t||"number"==typeoft&&t>0&&t-1ine}functioni(e,t,n){if(at.isFunction(t))returnat.grep(e,function(e,i){return!!t.call(e,i,e)!==n});if(t.nodeType)returnat.grep(e,function(e){returne===t!==n});if("string"==typeoft){if(ht.test(t))returnat.filter(t,e,n);t=at.filter(t,e)}returnat.grep(e,function(e){returnat.inArray(e,t)>=0!==n})}functiona(e,t){doe=e[t];while(e&&1!==e.nodeType);returne}functiono(e){vart=wt[e]={};returnat.each(e.match(bt)||[],function(e,n){t[n]=!0}),t}functionr(){pt.addEventListener?(pt.removeEventListener("DOMContentLoaded",s,!1),e.removeEventListener("load",s,!1)):(pt.detachEvent("onreadystatechange",s),e.detachEvent("onload",s))}functions(){(pt.addEventListener||"load"===event.type||"complete"===pt.readyState)&&(r(),at.ready())}functionl(e,t,n){if(void0===n&&1===e.nodeType){vari="data-"+t.replace(Tt,"-$1").toLowerCase();if(n=e.getAttribute(i),"string"==typeofn){try{n="true"===n?!0:"false"===n?!1:"null"===n?null:+n+""===n?+n:Ct.test(n)?at.parseJSON(n):n}catch(a){}at.data(e,t,n)}elsen=void0}returnn}functionu(e){vart;for(tine)if(("data"!==t||!at.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}functiond(e,t,n,i){if(at.acceptData(e)){vara,o,r=at.expando,s=e.nodeType,l=s?at.cache:e,u=s?e[r]:e[r]&&r;if(u&&l[u]&&(i||l[u].data)||void0!==n||"string"!=typeoft)returnu||(u=s?e[r]=Y.pop()||at.guid++:r),l[u]||(l[u]=s?{}:{toJSON:at.noop}),("object"==typeoft||"function"==typeoft)&&(i?l[u]=at.extend(l[u],t):l[u].data=at.extend(l[u].data,t)),o=l[u],i||(o.data||(o.data={}),o=o.data),void0!==n&&(o[at.camelCase(t)]=n),"string"==typeoft?(a=o[t],null==a&&(a=o[at.camelCase(t)])):a=o,a}}functionc(e,t,n){if(at.acceptData(e)){vari,a,o=e.nodeType,r=o?at.cache:e,s=o?e[at.expando]:at.expando;if(r[s]){if(t&&(i=n?r[s]:r[s].data)){at.isArray(t)?t=t.concat(at.map(t,at.camelCase)):tini?t=[t]:(t=at.camelCase(t),t=tini?[t]:t.split(" ")),a=t.length;for(;a--;)deletei[t[a]];if(n?!u(i):!at.isEmptyObject(i))return}(n||(deleter[s].data,u(r[s])))&&(o?at.cleanData([e],!0):nt.deleteExpando||r!=r.window?deleter[s]:r[s]=null)}}}functionh(){return!0}functionf(){return!1}functionp(){try{returnpt.activeElement}catch(e){}}functionm(e){vart=jt.split("|"),n=e.createDocumentFragment();if(n.createElement)for(;t.length;)n.createElement(t.pop());returnn}functiong(e,t){varn,i,a=0,o=typeofe.getElementsByTagName!==xt?e.getElementsByTagName(t||"*"):typeofe.querySelectorAll!==xt?e.querySelectorAll(t||"*"):void0;if(!o)for(o=[],n=e.childNodes||e;null!=(i=n[a]);a++)!t||at.nodeName(i,t)?o.push(i):at.merge(o,g(i,t));returnvoid0===t||t&&at.nodeName(e,t)?at.merge([e],o):o}functionv(e){St.test(e.type)&&(e.defaultChecked=e.checked)}functiony(e,t){returnat.nodeName(e,"table")&&at.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}functionb(e){returne.type=(null!==at.find.attr(e,"type"))+"/"+e.type,e}functionw(e){vart=Jt.exec(e.type);returnt?e.type=t[1]:e.removeAttribute("type"),e}functionk(e,t){for(varn,i=0;null!=(n=e[i]);i++)at._data(n,"globalEval",!t||at._data(t[i],"globalEval"))}functionD(e,t){if(1===t.nodeType&&at.hasData(e)){varn,i,a,o=at._data(e),r=at._data(t,o),s=o.events;if(s){deleter.handle,r.events={};for(nins)for(i=0,a=s[n].length;a>i;i++)at.event.add(t,n,s[n][i])}r.data&&(r.data=at.extend({},r.data))}}functionx(e,t){varn,i,a;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!nt.noCloneEvent&&t[at.expando]){a=at._data(t);for(iina.events)at.removeEvent(t,i,a.handle);t.removeAttribute(at.expando)}"script"===n&&t.text!==e.text?(b(t).text=e.text,w(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),nt.html5Clone&&e.innerHTM
}functionf(e){vart=M(e),n=t.year||0,i=t.quarter||0,a=t.month||0,o=t.week||0,r=t.day||0,s=t.hour||0,l=t.minute||0,u=t.second||0,d=t.millisecond||0;this._milliseconds=+d+1e3*u+6e4*l+36e5*s,this._days=+r+7*o,this._months=+a+3*i+12*n,this._data={},this._locale=kt.localeData(),this._bubble()}functionp(e,t){for(variint)n(t,i)&&(e[i]=t[i]);returnn(t,"toString")&&(e.toString=t.toString),n(t,"valueOf")&&(e.valueOf=t.valueOf),e}functionm(e,t){varn,i,a;if(t._isAMomentObject!==void0&&(e._isAMomentObject=t._isAMomentObject),t._i!==void0&&(e._i=t._i),t._f!==void0&&(e._f=t._f),t._l!==void0&&(e._l=t._l),t._strict!==void0&&(e._strict=t._strict),t._tzm!==void0&&(e._tzm=t._tzm),t._isUTC!==void0&&(e._isUTC=t._isUTC),t._offset!==void0&&(e._offset=t._offset),t._pf!==void0&&(e._pf=t._pf),t._locale!==void0&&(e._locale=t._locale),jt.length>0)for(ninjt)i=jt[n],a=t[i],a!==void0&&(e[i]=a);returne}functiong(e){return0>e?Math.ceil(e):Math.floor(e)}functionv(e,t,n){for(vari=""+Math.abs(e),a=e>=0;t>i.length;)i="0"+i;return(a?n?"+":"":"-")+i}functiony(e,t){varn={milliseconds:0,months:0};returnn.months=t.month()-e.month()+12*(t.year()-e.year()),e.clone().add(n.months,"M").isAfter(t)&&--n.months,n.milliseconds=+t-+e.clone().add(n.months,"M"),n}functionb(e,t){varn;returnt=A(t,e),e.isBefore(t)?n=y(e,t):(n=y(t,e),n.milliseconds=-n.milliseconds,n.months=-n.months),n}functionw(e,t){returnfunction(n,i){vara,o;returnnull===i||isNaN(+i)||(r(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period)."),o=n,n=i,i=o),n="string"==typeofn?+n:n,a=kt.duration(n,i),k(this,a,e),this}}functionk(e,t,n,i){vara=t._milliseconds,o=t._days,r=t._months;i=null==i?!0:i,a&&e._d.setTime(+e._d+a*n),o&&mt(e,"Date",pt(e,"Date")+o*n),r&&ft(e,pt(e,"Month")+r*n),i&&kt.updateOffset(e,o||r)}functionD(e){return"[object Array]"===Object.prototype.toString.call(e)}functionx(e){return"[object Date]"===Object.prototype.toString.call(e)||einstanceofDate}functionC(e,t,n){vari,a=Math.min(e.length,t.length),o=Math.abs(e.length-t.length),r=0;for(i=0;a>i;i++)(n&&e[i]!==t[i]||!n&&F(e[i])!==F(t[i]))&&r++;returnr+o}functionT(e){if(e){vart=e.toLowerCase().replace(/(.)s$/,"$1");e=hn[e]||fn[t]||t}returne}functionM(e){vart,i,a={};for(iine)n(e,i)&&(t=T(i),t&&(a[t]=e[i]));returna}functionP(t){varn,i;if(0===t.indexOf("week"))n=7,i="day";else{if(0!==t.indexOf("month"))return;n=12,i="month"}kt[t]=function(a,o){varr,s,l=kt._locale[t],u=[];if("number"==typeofa&&(o=a,a=e),s=function(e){vart=kt().utc().set(i,e);returnl.call(kt._locale,t,a||"")},null!=o)returns(o);for(r=0;n>r;r++)u.push(s(r));returnu}}functionF(e){vart=+e,n=0;return0!==t&&isFinite(t)&&(n=t>=0?Math.floor(t):Math.ceil(t)),n}function_(e,t){returnnewDate(Date.UTC(e,t+1,0)).getUTCDate()}functionS(e,t,n){returnut(kt([e,11,31+t-n]),t,n).week}functionE(e){returnN(e)?366:365}functionN(e){return0===e%4&&0!==e%100||0===e%400}functionO(e){vart;e._a&&-2===e._pf.overflow&&(t=0>e._a[_t]||e._a[_t]>11?_t:1>e._a[St]||e._a[St]>_(e._a[Ft],e._a[_t])?St:0>e._a[Et]||e._a[Et]>24||24===e._a[Et]&&(0!==e._a[Nt]||0!==e._a[Ot]||0!==e._a[$t])?Et:0>e._a[Nt]||e._a[Nt]>59?Nt:0>e._a[Ot]||e._a[Ot]>59?Ot:0>e._a[$t]||e._a[$t]>999?$t:-1,e._pf._overflowDayOfYear&&(Ft>t||t>St)&&(t=St),e._pf.overflow=t)}function$(t){returnnull==t._isValid&&(t._isValid=!isNaN(t._d.getTime())&&0>t._pf.overflow&&!t._pf.empty&&!t._pf.invalidMonth&&!t._pf.nullInput&&!t._pf.invalidFormat&&!t._pf.userInvalidated,t._strict&&(t._isValid=t._isValid&&0===t._pf.charsLeftOver&&0===t._pf.unusedTokens.length&&t._pf.bigHour===e)),t._isValid}functionI(e){returne?e.toLowerCase().replace("_","-"):e}functionj(e){for(vart,n,i,a,o=0;e.length>o;){for(a=I(e[o]).split("-"),t=a.length,n=I(e[o+1]),n=n?n.split("-"):null;t>0;){if(i=L(a.slice(0,t).join("-")))returni;if(n&&n.length>=t&&C(a,n,!0)>=t-1)break;t--}o++}returnnull}functionL(e){vart=null;if(!It[e]&&Lt)try{t=kt.locale(),require("./locale/"+e),kt.locale(t)}catch(n){}returnIt[e]}functionA(e,t){varn,i;returnt._isUTC?(n=t.clone(),i=(kt.isMoment(e)||x(e)?+e:+kt(e)
returnthis.asSeconds()?(0>this.asSeconds()?"-":"")+"P"+(e?e+"Y":"")+(t?t+"M":"")+(n?n+"D":"")+(i||a||o?"T":"")+(i?i+"H":"")+(a?a+"M":"")+(o?o+"S":""):"P0D"},localeData:function(){returnthis._locale},toJSON:function(){returnthis.toISOString()}}),kt.duration.fn.toString=kt.duration.fn.toISOString;for(xtincn)n(cn,xt)&&bt(xt.toLowerCase());kt.duration.fn.asMilliseconds=function(){returnthis.as("ms")},kt.duration.fn.asSeconds=function(){returnthis.as("s")},kt.duration.fn.asMinutes=function(){returnthis.as("m")},kt.duration.fn.asHours=function(){returnthis.as("h")},kt.duration.fn.asDays=function(){returnthis.as("d")},kt.duration.fn.asWeeks=function(){returnthis.as("weeks")},kt.duration.fn.asMonths=function(){returnthis.as("M")},kt.duration.fn.asYears=function(){returnthis.as("y")},kt.locale("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){vart=e%10,n=1===F(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th";returne+n}}),Lt?module.exports=kt:"function"==typeofdefine&&define.amd?(define(function(e,t,n){returnn.config&&n.config()&&n.config().noGlobal===!0&&(Tt.moment=Dt),kt}),wt(!0)):wt()}.call(this),function(e){"use strict";if("function"==typeofdefine&&define.amd)define(["jquery","moment"],e);elseif("object"==typeofexports)e(require("jquery"),require("moment"));else{if(!jQuery)throw"bootstrap-datetimepicker requires jQuery to be loaded first";if(!moment)throw"bootstrap-datetimepicker requires Moment.js to be loaded first";e(jQuery,moment)}}(function(e,t){"use strict";if(!t)throwError("bootstrap-datetimepicker requires Moment.js to be loaded first");varn=function(n,i){vara,o,r,s,l,u={},d=t(),c=d.clone(),h=!0,f=!1,p=!1,m=0,g=[{clsName:"days",navFnc:"M",navStep:1},{clsName:"months",navFnc:"y",navStep:1},{clsName:"years",navFnc:"y",navStep:10}],v=["days","months","years"],y=["top","bottom","auto"],b=["left","right","auto"],w=["default","top","bottom"],k=function(e){if("string"!=typeofe||e.length>1)thrownewTypeError("isEnabled expects a single character string parameter");switch(e){case"y":return-1!==r.indexOf("Y");case"M":return-1!==r.indexOf("M");case"d":return-1!==r.toLowerCase().indexOf("d");case"h":case"H":return-1!==r.toLowerCase().indexOf("h");case"m":return-1!==r.indexOf("m");case"s":return-1!==r.indexOf("s");default:return!1}},D=function(){returnk("h")||k("m")||k("s")},x=function(){returnk("y")||k("M")||k("d")},C=function(){vart=e("<thead>").append(e("<tr>").append(e("<th>").addClass("prev").attr("data-action","previous").append(e("<span>").addClass(i.icons.previous))).append(e("<th>").addClass("picker-switch").attr("data-action","pickerSwitch").attr("colspan",i.calendarWeeks?"6":"5")).append(e("<th>").addClass("next").attr("data-action","next").append(e("<span>").addClass(i.icons.next)))),n=e("<tbody>").append(e("<tr>").append(e("<td>").attr("colspan",i.calendarWeeks?"8":"7")));return[e("<div>").addClass("datepicker-days").append(e("<table>").addClass("table-condensed").append(t).append(e("<tbody>"))),e("<div>").addClass("datepicker-months").append(e("<table>").addClass("table-condensed").append(t.clone()).append(n.clone())),e("<div>").addClass("datepicker-years").append(e("<table>").addClass("table-condensed").append(t.clone()).append(n.clone()))]},T=function(){vart=e("<tr>"),n=e("<tr>"),a=e("<tr>");returnk("h")&&(t.append(e("<td>").append(e("<a>").attr("href","#").addClass("btn").attr("data-action","incrementHours").append(e("<span>").addClass(i.icons.up)))),n.append(e("<td>").append(e("<span>").addClass("timepicker-hour").attr("data-time-component","hours").attr("data-action","showHours"))),a.append(e("<td>").append(e("<a>").attr("href","#").addClass("btn").attr("data-action","decrementHours").append(e("<span>").addClass(i.icons.down))))),k("m")&&(k("h")&&(t.append(e("<td>").addClass("separator")),n.append(e("<td>").addClass("separator").html(":")),a.append(e("<td>").addClass("separator"))),t.append(e("<td>").append(e("<a>").attr("href","#").addClass("btn").attr("data-action","incrementMinutes").append(e("<span>").addClass(i.icons.up)))),n.append(e("<td>").append(e("<span>").
}),o},x.union=function(){returnx.uniq(x.flatten(arguments,!0))},x.intersection=function(e){vart=s.call(arguments,1);returnx.filter(x.uniq(e),function(e){returnx.every(t,function(t){returnx.contains(t,e)})})},x.difference=function(e){vart=l.apply(i,s.call(arguments,1));returnx.filter(e,function(e){return!x.contains(t,e)})},x.zip=function(){for(vare=x.max(x.pluck(arguments,"length").concat(0)),t=Array(e),n=0;e>n;n++)t[n]=x.pluck(arguments,""+n);returnt},x.object=function(e,t){if(null==e)return{};for(varn={},i=0,a=e.length;a>i;i++)t?n[e[i]]=t[i]:n[e[i][0]]=e[i][1];returnn},x.indexOf=function(e,t,n){if(null==e)return-1;vari=0,a=e.length;if(n){if("number"!=typeofn)returni=x.sortedIndex(e,t),e[i]===t?i:-1;i=0>n?Math.max(0,a+n):n}if(y&&e.indexOf===y)returne.indexOf(t,n);for(;a>i;i++)if(e[i]===t)returni;return-1},x.lastIndexOf=function(e,t,n){if(null==e)return-1;vari=null!=n;if(b&&e.lastIndexOf===b)returni?e.lastIndexOf(t,n):e.lastIndexOf(t);for(vara=i?n:e.length;a--;)if(e[a]===t)returna;return-1},x.range=function(e,t,n){1>=arguments.length&&(t=e||0,e=0),n=arguments[2]||1;for(vari=Math.max(Math.ceil((t-e)/n),0),a=0,o=Array(i);i>a;)o[a++]=e,e+=n;returno};varS=function(){};x.bind=function(e,t){varn,i;if(D&&e.bind===D)returnD.apply(e,s.call(arguments,1));if(!x.isFunction(e))thrownewTypeError;returnn=s.call(arguments,2),i=function(){if(!(thisinstanceofi))returne.apply(t,n.concat(s.call(arguments)));S.prototype=e.prototype;vara=newS;S.prototype=null;varo=e.apply(a,n.concat(s.call(arguments)));returnObject(o)===o?o:a}},x.partial=function(e){vart=s.call(arguments,1);returnfunction(){for(varn=0,i=t.slice(),a=0,o=i.length;o>a;a++)i[a]===x&&(i[a]=arguments[n++]);for(;arguments.length>n;)i.push(arguments[n++]);returne.apply(this,i)}},x.bindAll=function(e){vart=s.call(arguments,1);if(0===t.length)throwError("bindAll must be passed function names");returnC(t,function(t){e[t]=x.bind(e[t],e)}),e},x.memoize=function(e,t){varn={};returnt||(t=x.identity),function(){vari=t.apply(this,arguments);returnx.has(n,i)?n[i]:n[i]=e.apply(this,arguments)}},x.delay=function(e,t){varn=s.call(arguments,2);returnsetTimeout(function(){returne.apply(null,n)},t)},x.defer=function(e){returnx.delay.apply(x,[e,1].concat(s.call(arguments,1)))},x.throttle=function(e,t,n){vari,a,o,r=null,s=0;n||(n={});varl=function(){s=n.leading===!1?0:x.now(),r=null,o=e.apply(i,a),i=a=null};returnfunction(){varu=x.now();s||n.leading!==!1||(s=u);vard=t-(u-s);returni=this,a=arguments,0>=d?(clearTimeout(r),r=null,s=u,o=e.apply(i,a),i=a=null):r||n.trailing===!1||(r=setTimeout(l,d)),o}},x.debounce=function(e,t,n){vari,a,o,r,s,l=function(){varu=x.now()-r;t>u?i=setTimeout(l,t-u):(i=null,n||(s=e.apply(o,a),o=a=null))};returnfunction(){o=this,a=arguments,r=x.now();varu=n&&!i;returni||(i=setTimeout(l,t)),u&&(s=e.apply(o,a),o=a=null),s}},x.once=function(e){vart,n=!1;returnfunction(){returnn?t:(n=!0,t=e.apply(this,arguments),e=null,t)}},x.wrap=function(e,t){returnx.partial(t,e)},x.compose=function(){vare=arguments;returnfunction(){for(vart=arguments,n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];returnt[0]}},x.after=function(e,t){returnfunction(){return1>--e?t.apply(this,arguments):void0}},x.keys=function(e){if(!x.isObject(e))return[];if(k)returnk(e);vart=[];for(varnine)x.has(e,n)&&t.push(n);returnt},x.values=function(e){for(vart=x.keys(e),n=t.length,i=Array(n),a=0;n>a;a++)i[a]=e[t[a]];returni},x.pairs=function(e){for(vart=x.keys(e),n=t.length,i=Array(n),a=0;n>a;a++)i[a]=[t[a],e[t[a]]];returni},x.invert=function(e){for(vart={},n=x.keys(e),i=0,a=n.length;a>i;i++)t[e[n[i]]]=n[i];returnt},x.functions=x.methods=function(e){vart=[];for(varnine)x.isFunction(e[n])&&t.push(n);returnt.sort()},x.extend=function(e){returnC(s.call(arguments,1),function(t){if(t)for(varnint)e[n]=t[n]}),e},x.pick=function(e){vart={},n=l.apply(i,s.call(arguments,1));returnC(n,function(n){nine&&(t[n]=e[n])}),t},x.omit=function(e){vart={},n=l.apply(i,s.call(arguments,1));for(varaine)x.contains(n,a)||(t[a]=e[a]);returnt},x.defaults=f
},RestClient.prototype.setOAuth2NeedsAuthorization=function(e){return_.isBoolean(e)&&(this.oauth2NeedsAuthorization=e),this},RestClient.prototype.setDataType=function(e){vart={json:"application/json",plain:"text/plain",form:"application/x-www-form-urlencoded",html:"text/html"};returnt[e]&&(this.dataType=e,this.contentType=t[e]),this},RestClient.prototype.setAccessTokenExpiredMessage=function(e){returnthis.expiredAccessTokenMessage=e,this},RestClient.prototype.getVersion=function(){returnthis.VERSION},RestClient.prototype.setClient=function(e,t,n){returnthis.authorization.client_id=e,this.authorization.client_secret=t,this.authorization.client_url="undefined"!==n?n:null,this},RestClient.prototype.setGrantType=function(e,t){returnthis.authorization.grant_type="undefined"!==this.OAUTH2GrantTypes[e]?this.OAUTH2GrantTypes[e]:null,this.authorization=_.extend(this.authorization,t),this},RestClient.prototype.setAuthorizationServer=function(e){vart,n=!0;returne===void0||null===e?n=!1:(t=/(http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/,e.match(t)?this.server.rest_auth_uri=e:n=!1),n},RestClient.prototype.setHeader=function(e,t){varn,i=!0;returne&&t?(n=JSON.parse('{"'+e+'" : "'+t+'"}'),this.headers=_.extend(this.headers,n)):i=!1,i},RestClient.prototype.JSONParse=function(e){vart;try{t=e?""===e?"":JSON.parse(e):""}catch(n){t="ERROR_PARSE"}returnt},RestClient.prototype.setBasicCredentials=function(e,t){returnthis.authorization.basic_user=e,this.authorization.basic_password=t,this},RestClient.prototype.setAccessToken=function(e){return"object"==typeofe&&(this.accessToken=e),this},RestClient.prototype.setRestfulBehavior=function(e){return_.isBoolean(e)&&(this.restfulBehavior=e),this},RestClient.prototype.setBackupAjaxUrl=function(e){returnthis.backupAJAXURL=e,this},RestClient.prototype.toParams=function(e){vart=_.keys(e),n=[];return_.each(t,function(t){n.push(t+"="+e[t])}),n.join("&")},RestClient.prototype.prepareBody=function(e){vart="";return"json"===this.dataType||"jsonp"===this.dataType?"object"==typeofe&&(t=JSON.stringify(e)):t=this.toParams(e),t},RestClient.prototype.createXHR=function(){vare;if(window.XMLHttpRequest)e=newXMLHttpRequest;elsetry{e=newActiveXObject("MSXML2.XMLHTTP")}catch(t){try{e=newActiveXObject("Microsoft.XMLHTTP")}catch(n){}}returne?e:!1},RestClient.prototype.authorize=function(e){vart,n,i,a,o=this,r=!1,s="create",l=this.RESTMethods[s];t=RCBase64.encode(this.authorization.client_id+":"+this.authorization.client_secret),n=this.createXHR();try{n.open(l,this.server.rest_auth_uri,!1)}catch(u){returne.xhrfailure?e.xhrfailure(u,{}):this.XHRFailure(u,{}),r}if(n.onreadystatechange=function(){if(e.ready?e.ready(n):o.AuthorizeReady(n),4===n.readyState){if(a=o.JSONParse(n.responseText),-1!=o.HTTP_SUCCESS.indexOf(n.status+"")&&"ERROR_PARSE"!==a)if(o.autoStoreAccessToken&&(o.accessToken=a.token||{}),r=!0,e.success)try{e.success(n,a)}catch(t){throwError(t.message)}elseo.AuthorizeSuccess(n,a);elseif("ERROR_PARSE"===a&&(a={success:!1,error:{error:o.HTTP_BAD_REQUEST,error_description:"Response is not a valid JSON"}}),e.failure)try{e.failure(n,a)}catch(t){throwError(t.message)}elseo.AuthorizeFailure(n,a);"function"==typeofe.complete&&e.complete(n,a)}},i={},this.authorization.grant_type)switch(i.grant_type=this.authorization.grant_type,this.authorization.grant_type){case"authorization_code":i.code=this.authorization.code;break;case"token":i.token=this.authorization.token;break;case"password":i.username=this.authorization.username,i.password=this.authorization.password;break;case"client_credentials":i.client_id=this.authorization.client_id,i.client_id=this.authorization.client_secret;break;case"refresh_token":i.refresh_token=this.authorization.refresh_token}returnthis.oauth2NeedsAuthorization&&n.setRequestHeader("Authorization","Basic "+t),n.setRequestHeader("Accept",this.acceptType),n.setRequestHeader("Content-Type",this.contentType),_.each(this.headers,function(e,t){n.setRequestHeader(t,e)}),n.send(this.prepareBody(i)),r},RestClient.prototype.prepareReqFields=f
},e.prototype.submitStep=function(e){vart,n=this.project.formsHandler,i=this.project.dataManager,a=this.project;i.addData(e.dataSubmit),i.addDataLocal(e.dataSubmit),e.dataSubmit&&(null==this.project.typeList?(t=n.getIndexForms(),a.caseID?this.submitCase(e):null==a.caseID&&this.submitCase(e)):this.submitCase(e)),a.showNavBar()},e.prototype.submitNew=function(){vare=(this.project.formsHandler,this.project);returninfoCase=this.project.startCase(),"success"==infoCase.state?(this.project.setCaseID(infoCase.caseID),this.project.caseTitle=infoCase.caseTitle,this.project.caseNumber=infoCase.caseNumber,void0):("internetFail"==infoCase.state&&(this.setToastMessage(e.language.ERROR_NETWORK_SUBMIT_NEW),this.internetFailData()),"unautorized"==infoCase.state&&(this.setToastMessage(e.language.ERROR_NETWORK_SUBMIT_NEW),this.internetFailData()),void0)},e.prototype.submitCase=function(e){vart=this.project;this.project.formsHandler,e.dataSubmit&&(caseID=this.project.submitFormCase(e.dataSubmit),"success"==caseID.state&&(this.executeTriggerAfter(),this.sendFormData=e,this.project.sendSubmitInformationDevice(),this.setToastMessage(t.language.INFO_PMDYNAFORM_SUBMIT),t.emptyView(),this.advanceStep()||this.submitRoute()),"internetFail"==caseID.state&&(this.setToastMessage(t.language.ERROR_NETWORK_SUBMIT_CASE),this.internetFailData()),"unautorized"==caseID.state&&(this.setToastMessage(t.language.ERROR_NETWORK_SUBMIT_CASE),this.internetFailData()))},e.prototype.submitRoute=function(){vare,t,n=this.project;returnthis.project.formsHandler,e=this.project.routeCase(),"success"==e.state?(e.data.routing.length>0?(t=e.data.routing[0].userName,t=n.language.INFO_PMDYNAFORM_DERIVATED+"\n Next User:"+t):(t=e.data.routing.message,t="Message:"+t),this.setToastMessage(t),this.closeWebView(),void0):("internetFail"==e.state&&(this.setToastMessage(n.language.ERROR_NETWORK_ROUTE),this.closeWebViewInternetFailed()),"unautorized"==e.state&&(this.setToastMessage(n.language.ERROR_NETWORK_ROUTE),this.closeWebViewInternetFailed()),void0)},e.prototype.loadFormfromJson=function(){vare,t=this.project;if(responseDevice=this.getFormDefinitionDevice(),"success"==responseDevice.state)returnthis.project.loadProject(jsonForm.data),this.project.showNavBar(),void0;switch(e=this.project.getFormDefinition(),e.state){case"success":this.project.loadProject(e.data),this.project.showNavBar();break;case"internetFail":this.setToastMessage(t.language.INFO_PMDYNAFORM_JSON),this.closeWebViewInternetFailed();break;case"unautorized":this.setToastMessage(t.language.INFO_PMDYNAFORM_JSON),this.closeWebViewInternetFailed();break;default:}},e.prototype.closeWebView=function(){switch(this.project.userAgent){case"android":JsInterface.SubmitFinishedCorrectly();break;default:}},e.prototype.closeWebViewInternetFailed=function(){switch(this.project.userAgent){case"android":JsInterface.submitFailedDueNoInternet();break;default:}},e.prototype.closeWebViewDerivated=function(){switch(this.project.userAgent){case"android":JsInterface.SubmitFinishedCorrectly();break;default:}},e.prototype.internetFail=function(){switch(this.project.userAgent){case"android":JsInterface.submitFailedDueNoInternet();break;default:}},e.prototype.internetFailData=function(){vare,t,n,i,a;returnt=this.project.model.attributes,a=this.project.dataManager,i=this.project,a.addDataLocal(i.getDataCustom()),e=a.getDataLocal(),n={json:t,data:e,accessToken:this.project.token.accessToken,refreshToken:this.project.token.refreshToken,formID:this.project.keys.formID},"formslider-android"===navigator.userAgent&&(JsInterface.receiveFormData(JSON.stringify(n)),JsInterface.submitFailedDueNoInternet()),this},e.prototype.getFormDefinitionDevice=function(){vare={state:"internetFail"};switch(this.project.userAgent){case"android":-1==JsInterface.getFormId(this.formID)?e.state="failed":(e.state="success",e.data=JSON.parse(JsInterface.getFormId(this.formID)));break;default:}returne},e.prototype.setToastMessage=function(e){switch(navigator.userAgent){case"formslider-android":JsInterface.showToast(e);break;default:}},e.prototype.setCaseInform
returnthis.createHTMLContainer(),this.model.setPaginationItems(),this.createHTMLPager(),this.createHTMLTotal(),this},on:function(e,t){varn={remove:"setOnRemoveRowCallback",add:"setOnAddRowCallback",pager:"setOnClickPageCallback"};if(!n[e])throwError("The event must be a valid event.\n The events available are remove, add and pager");returnthis[n[e]](t),this},setOnRemoveRowCallback:function(e){if("function"!=typeofe)throwError("The callback must be a function");returnthis.onRemoveRowCallback=e,this},setOnAddRowCallback:function(e){if("function"!=typeofe)throwError("The callback must be a function");returnthis.onAddRowCallback=e,this},setOnClickPageCallback:function(e){if("function"!=typeofe)throwError("The callback must be a function");returnthis.onClickPageCallback=e,this},render:function(){vare,t;returnthis.$el.html(this.template(this.model.toJSON())),this.createHTMLTitle(),this.renderGridTable(),this.enableTooltip(),"static"===this.model.get("layout")&&(e=this.$el.find(".pmdynaform-grid-thead"),t=this.$el.find(".pmdynaform-grid-tbody"),t.css("overflow","auto"),t.scroll(function(n){e.scrollLeft(t.scrollLeft()),n.stopPropagation()})),this.model.get("addRow")||this.$el.find(".pmdynaform-grid-new").hide(),"responsive"===this.model.get("layout")&&$(window).resize(function(){{$(window).width()}}),this},afterRender:function(){},getData2:function(){vare,t,n,i,a,o;for(e={},t=this.gridtable,n=0;t.length>n;n+=1){for(e[n+1]={},a={},i=0;t[n].length>i;i+=1)"function"==typeoft[n][i].getData&&t[n][i]instanceofPMDynaform.view.Field&&(o=t[n][i].model.getData(),a[o.name]=o.value);e[n+1]=a}returne},setData2:function(e){vart,n,i,a,o,r,s,l,u,d,c,h,f,p;n=this.gridtable;for(tine)for(parseInt(t,10)>this.gridtable.length&&(u=this.addRow(),this.renderGridTable(),this.onAddRowCallback(u,this)),i=n[parseInt(t,10)-1].length,a=0;i>a;a+=1){r=n[parseInt(t,10)-1][a],o=n[parseInt(t,10)-1][a].model,s=o.get("mode");for(line[t])if(o.get("columnName")===l){if("edit"===s||"disabled"===s)if("suggest"===o.get("type")){for(c=0;o.get("localOptions").length>c;c+=1)if(h=o.get("localOptions")[c].value,h===e[t][l]){d=o.get("localOptions")[c].label;break}if(d&&!d.length)for(c=0;o.get("options").length>c;c+=1)if(h=o.get("options")[c].value,h===e[t][l]){d=o.get("options")[c].label;break}$(r.el).find(":input").val(d),o.attributes.value=e[t][l]}elseif("checkbox"===o.get("type")){if(f=o.get("options"),"boolean"===o.get("dataType"))e[o.get("name")]===f[0].value?(f[1].selected=!1,f[0].selected=!0):(deletef[0].selected,f[1].selected=!0,f[0].selected=!1);elsefor(p=0;f.length>p;p+=1)deletef[p].selected,e[t][l].indexOf(f[p])>-1&&(f[p].selected=!0);o.set("options",f),o.initControl(),o.set("value",[e[t][l]])}elseo.set("value",e[t][l]);if("view"===s)if("checkbox"===o.get("originalType"))o.set("fullOptions",e[t][l]);elseif("dropdown"===o.get("originalType")){for(d=[],c=0;o.get("localOptions").length>c;c+=1)if(h=o.get("localOptions")[c].value,h===e[t][l]){d.push(o.get("localOptions")[c].label),o.set("fullOptions",d);break}if(!d.length)for(c=0;o.get("options").length>c;c+=1)if(h=o.get("options")[c].value,h===e[t][l]){d.push(o.get("options")[c].label),o.set("fullOptions",d);break}}elsed=[],d.push(e[t][l]),o.set("fullOptions",d)}}returnthis}});PMDynaform.extendNamespace("PMDynaform.view.GridPanel",e)}(),function(){vare=Backbone.View.extend({template:_.template($("#tpl-button").html()),events:{keydown:"preventEvents"},initialize:function(){this.model.on("change",this.render,this)},preventEvents:function(e){return13===e.which&&(e.preventDefault(),e.stopPropagation()),this},on:function(e,t){varn=this;return$(this.$el.find("button")[0]).on(e,function(e){t(e,n),e.stopPropagation()}),this},render:function(){returnthis.$el.html(this.template(this.model.toJSON())),this}});PMDynaform.extendNamespace("PMDynaform.view.Button",e)}(),function(){vare=PMDynaform.view.Field.extend({events:{"change select":"continueDependentFields","blur select":"validate","keydown select":"preventEvents"},clicked:!1,firstLoad:!0,dirty:!1,previousValue:null,triggerCallback:!1,temp
},initControl:function(){vare,t=this.get("options"),n=[],i=[];for(e=0;t.length>e;e+=1){if(!t[e].label)throwError("The label parameter is necessary for the field");t[e].value||"number"==typeoft[e].value||(t[e].value=t[e].label),this.get("data")&&this.get("data").value&&("boolean"===this.get("dataType")?t[e].selected=this.get("data").value.indexOf(t[e].value)>-1?!0:!1:this.get("data").value.indexOf(t[e].value)>-1&&(t[e].selected=!0)),n.push({label:this.checkHTMLtags(t[e].label),value:this.checkHTMLtags(t[e].value),selected:t[e].selected?!0:!1})}this.set("options",n),this.set("selected",i)},setLocalOptions:function(){returnthis.set("localOptions",this.get("options")),this},getData:function(){return"grid"==this.get("group")?{name:this.get("columnName")?this.get("columnName"):"",value:"boolean"===this.get("dataType")?this.get("value")[0]:this.get("value")}:{name:this.get("name")?this.get("name"):"",value:"boolean"===this.get("dataType")?this.get("value")[0]:this.get("value")}},validate:function(e){returnthis.get("validator").set("value",e.selected.length),this.get("options").length&&this.get("validator").set("options",this.attributes.options),this.get("validator").verifyValue(),this.isValid(),this.get("valid")},isValid:function(){returnthis.attributes.valid=this.get("validator").get("valid"),this.get("valid")},setItemChecked:function(e){vart,n=this.get("options"),i=[];if(n){if("boolean"!==this.get("dataType"))for(t=0;n.length>t;t+=1)""+n[t].value==""+e.value&&(n[t].selected=e.checked);elsee.checked?(n[0].selected=!0,n[1].selected=!1):(n[0].selected=!1,n[1].selected=!0);for(this.set("options",n),t=0;n.length>t;t+=1)n[t].selected&&i.push(n[t].value);this.attributes.value=i.length?i:[],this.set("selected",i)}returnthis},updateItemSelected:function(){vare,t,n=this.get("selected"),i=this.get("options");if("string"==typeofthis.attributes.value&&this.attributes.value.length>0&&(n=this.attributes.value.split(/,/g)),$.isArray(this.get("value"))){for(this.set("selected",[]),n=this.get("selected"),e=0;i.length>e;e+=1)i[e].selected=!1;if(this.set("options",i),t=this.get("value"),"boolean"!==this.get("dataType"))for(e=0;t.length>e;e+=1)this.setItemChecked({value:t[e],checked:!0});elsethis.setItemChecked({value:this.get("options")[0],checked:1===parseInt(""+t)?!0:!1})}elsethis.setItemChecked({value:this.attributes.value,checked:!0});for(e=0;n.length>e;e+=1)this.setItemChecked({value:n[e].trim?n[e].trim():n[e],checked:!0});returnthis.attributes.disabled||(this.get("validator").set({valueDomain:this.get("value"),options:this.get("options")}),this.get("validator").set("value",this.get("selected").length),this.get("validator").verifyValue()),this.attributes.data&&(this.attributes.data.value=this.get("value")),this}});PMDynaform.extendNamespace("PMDynaform.model.Checkbox",e)}(),function(){vare=PMDynaform.model.Field.extend({defaults:{colSpan:12,colSpanLabel:3,colSpanControl:9,namespace:"pmdynaform",dataType:"date",group:"form",hint:"",id:"",name:"",placeholder:"",required:!1,validator:null,originalType:null,disabled:!1,format:!1,mode:"edit",data:null,value:"",stepping:1,minDate:!1,maxDate:!1,useCurrent:!1,collapse:!0,defaultDate:!1,disabledDates:[],sideBySide:!1,daysOfWeekDisabled:[],calendarWeeks:!0,viewMode:"days",toolbarPlacement:"default",showTodayButton:!0,showClear:!0,widgetPositioning:{horizontal:"left",vertical:"bottom"},keepOpen:!1,dayViewHeaderFormat:"MMMM YYYY",pickType:"datetime"},getData:function(){return"grid"==this.get("group")?{name:this.get("columnName")?this.get("columnName"):"",value:this.get("value")}:{name:this.get("name")?this.get("name"):"",value:this.get("value")}},initialize:function(e){vart={showClear:!1,useCurrent:!0},n=["year","month","day","hour","minute"],i=["years","months","days"],a={value:"",label:""};return"true"===this.get("useCurrent")&&(this.attributes.useCurrent=JSON.parse(this.get("useCurrent"))),-1===n.indexOf(this.get("useCurrent"))&&(this.attributes.useCurrent=t.useCurrent),"true"===this.get("showClear")&&(this.attributes.showClear=JSON.parse(this.get("showClear"))),"false"===this.get("