zazzy-browser
Advanced tools
Comparing version 1.3.11 to 1.3.13
//! zzb.js | ||
//! version: 1.3.11 | ||
//! version: 1.3.13 | ||
//! author(s): Jaret Pfluger | ||
//! license: MIT | ||
//! https://github.com/jpfluger/zazzy-browser | ||
!function i(o,a,l){function d(e,t){if(!a[e]){if(!o[e]){var s="function"==typeof require&&require;if(!t&&s)return s(e,!0);if(u)return u(e,!0);var r=new Error("Cannot find module '"+e+"'");throw r.code="MODULE_NOT_FOUND",r}var n=a[e]={exports:{}};o[e][0].call(n.exports,function(t){return d(o[e][1][t]||t)},n,n.exports,i,o,a,l)}return a[e].exports}for(var u="function"==typeof require&&require,t=0;t<l.length;t++)d(l[t]);return d}({1:[function(t,e,s){var r=window.$;function n(){this.ajax=function(a){return a=_.merge({SKIPREDIRECT:!1,SKIPFLASH:!1,NOFAILLOG:!1,NOFAILFLASH:!1,FAILFLASHMESSAGE:""},a),new Promise(function(i,o){r.ajax(a).done(function(e,t,s){if(a.RAWRETURN)return i(e);if(!e)return o(new Error("Data returned is empty when at minimum a status is required"));var r=!1,n=zzb.rob.newROB();if(s.responseJSON){if(!0!==a.SKIPREDIRECT&&e.redirect&&0<e.redirect.length)return zzb.types.isFunction(a.onRedirect)?void a.onRedirect(e,function(t){t||(window.location.href=e.redirect)}):void(zzb.types.isNonEmptyString(e.message)?zzb.dialogs.showMessage({className:"zzb-dialog-flash-message zzb-dialog-flash-redirect",dataBackdrop:"static",body:e.message,onHide:function(t){window.location.href=e.redirect}}):window.location.href=e.redirect);e.ISROBERRORS||(e.err?(e.errs=zzb.rob.sanitizeErrors(e.err),e.err=null):e.error?(e.errs=zzb.rob.sanitizeErrors(e.error),e.err=null):e.errs&&(e.errs=zzb.rob.sanitizeErrors(e.errs),e.err=null)),e.ISROBRECS||(e.recs?e.recs=zzb.rob.sanitizeRecords(e.recs):e.rec?(e.recs=zzb.rob.sanitizeRecords(e.rec),e.rec=null):Array.isArray(e.errs)&&0!==e.errs.length||(e.recs=zzb.rob.sanitizeRecords(e))),e.paginate&&(n.paginate=e.paginate),n.errs=e.errs,n.recs=e.recs,n.columns=e.columns,n.listErrs=zzb.rob.toListErrs(n.errs),!0!==a.SKIPFLASH&&zzb.types.isNonEmptyString(e.message)&&(r=!0,zzb.dialogs.showMessage({className:"zzb-dialog-flash-message "+zzb.format.strings("zzb-dialog-flash-status-",n.hasErrors()?"error":"okay"),dataBackdrop:"static",body:e.message,onHide:function(t){i(n)}})),zzb.types.isFunction(a.onFinish)&&(r=!0,a.onFinish(n,function(t){!0!==t&&i(n)}))}else n.recs=[e];!0!==r&&i(n)}).fail(function(t,e,s){o(s),!0===a.NOFAILLOG&&s&&console.log(s),!0!==a.NOFAILFLASH&&(zzb.types.isNonEmptyString(a.FAILFLASHMESSAGE)?zzb.ajax.showMessageFailedAction({message:a.FAILFLASHMESSAGE}):zzb.ajax.showMessageFailedAction({message:l.MSG_FAILED_ACTION_UNEXPECTED_NETWORK}))})})}}function l(t){}l.MSG_FAILED_ACTION_UNEXPECTED="Submission failed unexpectedly. ",l.MSG_FAILED_ACTION_UNEXPECTED_NETWORK="Submission failed unexpectedly. This is likely a broken network connection and will resolve itself once reconnected.",l.MSG_FAILED_ACTION_UNEXPECTED_NETWORK_VERBOSE="Submission failed unexpectedly. This is likely a broken network connection and will resolve itself once reconnected. Either your network is down or our server is down",l.MSG_FAILED_ACTION_UNEXPECTED_WITHADMIN="Submission failed unexpectedly. Contact the administrator should the problem persist.",l.MSG_FAILED_ACTION_UNEXPECTED_NETWORK_WITHADMIN="Submission failed unexpectedly. This is likely a broken network connection and will resolve itself once reconnected. Contact the administrator should the problem persist.",n.prototype.showMessageFailedAction=function(t){t=_.merge({err:null,number:null,message:l.MSG_FAILED_ACTION_UNEXPECTED},t),zzb.types.isNumber(t.number)&&(t.number=" ("+t.number+")"),t.err&&console.log(t.err),zzb.dialogs.showMessage({className:"zzb-dialog-flash-message zzb-flash-invalid",dataBackdrop:"static",body:t.message+t.number})},n.prototype.get=function(t){return(t=_.merge({contentType:"application/json; charset=UTF-8",data:{}},t)).type="GET",zzb.types.isNonEmptyString(t.data)||(t.data=JSON.stringify(t.data)),this.ajax(t)},n.prototype.getJSON=function(t){return(t=_.merge({dataType:"json",contentType:"application/json; charset=UTF-8",data:{}},t)).type="GET",zzb.types.isNonEmptyString(t.data)||(t.data=JSON.stringify(t.data)),this.ajax(t)},n.prototype.postJSON=function(t){return(t=_.merge({dataType:"json",contentType:"application/json; charset=UTF-8",data:{}},t)).type="POST",zzb.types.isNonEmptyString(t.data)||(t.data=JSON.stringify(t.data)),this.ajax(t)},s.ajax=n},{}],2:[function(t,e,s){var o=window._,a=function(t){this.defaultOptions=a.getDialogDefaults(t),this.defaultOptions.onShow="function"==typeof t.onShow?t.onShow:function(){},this.defaultOptions.onShown="function"==typeof t.onShown?t.onShown:function(){},this.defaultOptions.onHide="function"==typeof t.onHide?t.onHide:function(){},this.defaultOptions.onHidden="function"==typeof t.onHidden?t.onHidden:function(){}};a.getButtonDefaults=function(t){var e={id:null,type:a.TYPE_NONE,label:"",className:"",action:null,isDismiss:!1,isOutline:!1};return zzb.types.isObject(t)?o.merge(e,t):e},a.getDialogDefaults=function(t){var e={id:zzb.uuid.newV4(),type:a.TYPE_NONE,className:"",extraAttributes:"",noFade:!1,title:"",body:"",buttons:[],onShow:null,onShown:null,onHide:null,onHidden:null,doVerticalCenter:!0,doAutoDestroy:!0,underlay:{isOn:!1,id:null,className:"",bg:"#838383",opacity:.5}};return zzb.types.isObject(t)?o.merge(e,t):e},a.BUTTON_CLOSE="button-close",a.BUTTON_OK="button-ok",a.BUTTON_YES="button-yes",a.BUTTON_NO="button-no",a.BUTTON_CANCEL="button-cancel",a.TYPE_NONE="none",a.TYPE_PRIMARY="primary",a.TYPE_SECONDARY="secondary",a.TYPE_SUCCESS="success",a.TYPE_DANGER="danger",a.TYPE_WARNING="warning",a.TYPE_INFO="info",a.TYPE_LIGHT="light",a.TYPE_DARK="dark",a.TYPE_LINK="link",a.getButtonPreset=function(t,e,s){var r=a.getButtonDefaults();switch(r.isDismiss=!0,e===s-1?r.type=a.TYPE_PRIMARY:e===s-2&&(r.type=a.TYPE_SECONDARY),t){case"button-close":r.label="Close";break;case"button-ok":r.label="Ok";break;case"button-accept":r.label="Accept";break;case"button-yes":r.label="Yes";break;case"button-no":r.label="No";break;case"button-cancel":r.label="Cancel";break;default:r=null}return r},a.validateType=function(t){if(!t)return a.TYPE_NONE;switch(t){case a.TYPE_PRIMARY:case a.TYPE_SECONDARY:case a.TYPE_SUCCESS:case a.TYPE_DANGER:case a.TYPE_WARNING:case a.TYPE_INFO:case a.TYPE_LIGHT:case a.TYPE_DARK:case a.TYPE_LINK:return t;default:return a.TYPE_NONE}},a.isTypeNone=function(t){return a.validateType(t)===a.TYPE_NONE},a.prototype.getId=function(){return zzb.types.isNonEmptyString(this.defaultOptions.id)||(this.defaultOptions.id=zzb.uuid.newV4()),this.defaultOptions.id},a.prototype.getClassName=function(){return zzb.types.isNonEmptyString(this.defaultOptions.className)||(this.defaultOptions.className=""),this.defaultOptions.className},a.prototype.getTitle=function(){return zzb.types.isNonEmptyString(this.defaultOptions.title)||(this.defaultOptions.title=""),this.defaultOptions.title},a.prototype.getBody=function(){return zzb.types.isNonEmptyString(this.defaultOptions.body)||(this.defaultOptions.body=""),this.defaultOptions.body},a.prototype.create$Modal=function(){var t=o.merge({id:this.getId(),arialabel:"arialabel"+this.getId(),className:this.getClassName(),title:this.getTitle(),body:this.getBody(),classVerticalCenter:this.defaultOptions.doVerticalCenter?" modal-dialog-centered":"",classModalHeader:"",noHeaderCloseButton:!1,noHeaderCloseButtonButton:""},this.defaultOptions);t.classFade="fade",zzb.types.isBoolean(t.noFade)&&!0===t.noFade&&(t.classFade=""),a.isTypeNone(this.defaultOptions.type)||(t.classModalHeader+=" alert-"+this.defaultOptions.type),zzb.types.isNonEmptyString(t.dataBackdrop)&&(t.extraAttributes+=' data-backdrop="'+t.dataBackdrop+'"'),zzb.types.isBoolean(t.dataKeyboard)&&(t.extraAttributes+=' data-keyboard="'+t.dataKeyboard+'"'),!0!==t.noHeaderCloseButton&&(t.noHeaderCloseButtonButton='<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>');var r=$(zzb.strings.format('<div class="modal {classFade} modal-fullscreen {className}" {extraAttributes} id="{id}" tabindex="-1" role="dialog" aria-labelledby="{arialabel}" aria-hidden="true"><div class="modal-dialog{classVerticalCenter}" role="document"><div class="modal-content"><div class="modal-header{classModalHeader}"><h5 class="modal-title" id="{arialabel}">{title}</h5>{noHeaderCloseButtonButton}</div><div class="modal-body">{body}</div><div class="modal-footer"></div></div></div></div>',t));Array.isArray(this.defaultOptions.buttons)||(this.defaultOptions.buttons=[]);var n=this,i=this.defaultOptions.buttons.length;return o.each(this.defaultOptions.buttons,function(t,e){if(zzb.types.isNonEmptyString(t)&&(t=a.getButtonPreset(t,e,i)),zzb.types.isObject(t)){zzb.types.isNonEmptyString(t.id)||(t.id="button-"+e+"-"+n.getId()),t.isDismiss&&(zzb.types.isFunction(t.action)||(t.action=function(t,e){t.close()}),r.find(".modal-header button.close").attr("aria-label",t.label)),a.isTypeNone(t.type)||(t.isOutline?t.className+=" btn-outline-"+t.type:t.className+=" btn-"+t.type);var s=$(zzb.strings.format('<button id="{id}" type="button" class="btn {className}">{label}</button>',t));s.data("button",t),s.on("click",{dialog:n,$button:s,button:t},function(t){var e=t.data.dialog,s=t.data.$button,r=s.data("button");if("function"==typeof r.action)return r.action.call(s,e,t)}),0<r.find(".modal-footer > button").length?s.insertAfter(r.find(".modal-footer > button").last()):r.find(".modal-footer").append(s)}}),r},a.prototype.open=function(){if(!this.$modal){this.$modal=this.create$Modal();var e=this;this.$modal.on("show.bs.modal",function(t){e.onShow(t)}),this.$modal.on("shown.bs.modal",function(t){e.onShown(t)}),this.$modal.on("hide.bs.modal",function(t){e.onHide(t)}),this.$modal.on("hidden.bs.modal",function(t){e.onHidden(t)})}if(zzb.types.isObject(this.defaultOptions.underlay)&&!0===this.defaultOptions.underlay.isOn){zzb.types.isNonEmptyString(this.defaultOptions.underlay.id)||(this.defaultOptions.underlay.id="zzbModalUnderlay");var t=t=$("#"+this.defaultOptions.underlay.id);if(0===t.length){var s=[];zzb.types.isNonEmptyString(this.defaultOptions.underlay.className)?s.push(' class="'+this.defaultOptions.underlay.className+'"'):(s.push(' style="'),s.push("position:absolute;top:0;left:0;width:100%;height:100%;display:none;"),zzb.types.isNonEmptyString(this.defaultOptions.underlay.bg)&&(s.push("background-color:"+this.defaultOptions.underlay.bg+";"),zzb.types.isNumber(this.defaultOptions.underlay.opacity)&&s.push("opacity:"+this.defaultOptions.underlay.opacity+";")),s.push('"')),$('<div id="'+this.defaultOptions.underlay.id+'" '+s.join("")+"></div>").appendTo("body"),t=$("#"+this.defaultOptions.underlay.id)}t.show()}this.$modal.modal("show"),this.$modal.appendTo("body")},a.prototype.onShow=function(t){this.defaultOptions.onShow(t,this,this.$modal)},a.prototype.onShown=function(t){this.defaultOptions.onShown(t,this,this.$modal)},a.prototype.onHide=function(t){this.defaultOptions.onHide(t,this,this.$modal)},a.prototype.onHidden=function(t){this.defaultOptions.onHidden(t,this,this.$modal),this.defaultOptions.doAutoDestroy&&this.$modal.remove()},a.prototype.close=function(){if(this.$modal.modal("hide"),zzb.types.isObject(this.defaultOptions.underlay)&&!0===this.defaultOptions.underlay.isOn&&zzb.types.isNonEmptyString(this.defaultOptions.underlay.id)){var t=t=$("#"+this.defaultOptions.underlay.id);0<t.length&&t.hide()}},a.prototype.destroy=function(){if(this.$modal.modal("hide"),this.$modal.modal("dispose"),0<$("#"+this.getId()).length&&$("#"+this.getId()).remove(),zzb.types.isObject(this.defaultOptions.underlay)&&!0===this.defaultOptions.underlay.isOn&&zzb.types.isNonEmptyString(this.defaultOptions.underlay.id)){var t=t=$("#"+this.defaultOptions.underlay.id);0<t.length&&t.remove()}this.$modal=null};function r(){}r.prototype.ZazzyDialog=a,r.prototype.modal=function(t){return new a(t)},r.prototype.showMessage=function(t){zzb.dialogs.modal(o.merge({type:a.TYPE_NONE,buttons:[a.BUTTON_OK]},t)).open()},r.prototype.showMessageChoice=function(t){zzb.dialogs.modal(o.merge({type:a.TYPE_NONE,buttons:[a.BUTTON_CANCEL,a.getButtonDefaults({type:a.TYPE_PRIMARY,label:"Accept",action:function(t,e){t.close()}})]},t)).open()},r.prototype.handleError=function(t){if((t=o.merge({log:null,type:a.TYPE_DANGER,title:"",body:'<div class="zzb-dialog-errors">{errors}</div><div class="zzb-dialog-message">{message}</div>',message:"",errs:null,errors:"",buttons:[a.getButtonDefaults({type:a.TYPE_DANGER,label:"Ok",action:function(t,e){t.close()}})]},t)).log&&console.log(t.log),!zzb.types.isNonEmptyString(t.errors)&&zzb.types.isArray(t.errs)){var s=[];o.each(t.errs,function(t,e){t.message&&zzb.types.isNonEmptyString(t.message)&&s.push(zzb.strings.format('<div class="zzb-dialog-error-item">{0}</div>',t.message))}),t.errors=s.join("\n")}t.body=zzb.strings.format(t.body,t),this.showMessage(t)},s.dialogs=r},{}],3:[function(t,e,s){function r(){}var c=window.$,f=window._;function h(t,e){zzb.types.isObject(t)&&0<t.length&&(!0===e?(t.removeClass("is-valid"),t.removeClass("is-invalid")):(t.removeClass("valid-feedback"),t.removeClass("invalid-feedback"),t.removeClass("valid-tooltip"),t.removeClass("invalid-tooltip")))}r.prototype.findForm=function(t){return zzb.types.isString(t)?0<t.length&&"."===t[0]?c(t):c(zzb.types.escapeJqueryId(t)):c(t).closest("form")},r.prototype.displayUIErrors=function(a,t){if(a=f.merge({$form:null,selector:null,attrFormFieldname:"name",selectorField:".zzb-field",attrFieldname:"zzb-fieldname",selectorValidateMessage:".zzb-field-validate",selectorValidateMessageContent:".zzb-field-validate-content",isTooltip:!1,addClassFieldIsValid:!1,addClassFieldIsInvalid:!1,doFlashSystemErrors:!0,selectorInlineSystemFieldname:"_system",listSystemErrsFormatType:"text-punctuated",skipHideFields:!1,listErrs:null,errs:null,rob:null,fnSystemErrorContent:null,fnDialogSystemErrors:null,fnDialogErrors:null,fnDialogSuccess:null},a),zzb.types.isObject(a.$form)&&0!==a.$form.length||zzb.types.isNonEmptyString(a.selector)&&0<c(a.selector).length&&(a.$form=c(a.selector)),!zzb.types.isObject(a.$form)||0===a.$form.length)return t&&t(!1,new Error("could not select the form"));var l=null;if(a.listErrs)l=a.listErrs;else if(a.rob&&a.rob.listErrs)l=a.rob.listErrs;else{if(!a.errs)return t&&t(!1,new Error("could not find the list of errors"));l=zzb.rob.toListErrs(a.errs)}a.$form.removeClass("was-validated");function e(){t&&t(!l.hasErrors(),null)}var d="valid-feedback",u="invalid-feedback";a.isTooltip&&(d="valid-tooltip",u="invalid-tooltip");var p=l.hasFieldErrors();if(!0!==a.skipHideFields&&zzb.forms.hideValidateFields(a),a.$form.find(a.selectorField).each(function(t,e){var s=c(e),r=s.attr(a.attrFormFieldname),n=null;if(zzb.types.isNonEmptyString(r)){if(zzb.types.isNonEmptyString(r)){p&&f.each(l.fields,function(t){if(t.field===r)return n=t,!1});var i=a.$form.find(a.selectorValidateMessage+"["+a.attrFieldname+"='"+r+"']");if(zzb.types.isObject(i)&&0<i.length){var o=i.find(a.selectorValidateMessageContent);zzb.types.isObject(o)&&0!==o.length||(o=i),i.addClass("d-none"),h(o,!1),n&&(o.html(zzb.strings.toFirstCapitalEndPeriod(n.message)),!1===n.isErr?o.addClass(d):o.addClass(u),o.show(),i.removeClass("d-none"))}}h(s,!0),n?a.addClassFieldIsInvalid&&s.addClass("is-invalid"):a.addClassFieldIsValid&&s.addClass("is-valid ")}}),l.hasSystemErrors()){var s="";if(a.fnDialogSystemErrors&&zzb.types.isFunction(a.fnDialogSystemErrors))return void a.fnDialogSystemErrors(zzb.rob.renderListErrs({errs:l.system,format:a.listSystemErrsFormatType}),function(){e()});if(!1!==a.doFlashSystemErrors)return s=zzb.rob.renderListErrs({errs:l.system,format:a.listSystemErrsFormatType}),void(zzb.types.isNonEmptyString(s)&&(a.fnSystemErrorContent&&zzb.types.isFunction(a.fnSystemErrorContent)&&(s=a.fnSystemErrorContent(s)),zzb.dialogs.showMessage({className:"zzb-dialog-flash-message zzb-flash-invalid",dataBackdrop:"static",body:s,onHide:function(){e()}})));if(zzb.types.isNonEmptyString(a.selectorInlineSystemFieldname)){var r=a.$form.find(a.selectorValidateMessage+"["+a.attrFieldname+"='"+a.selectorInlineSystemFieldname+"']");if(zzb.types.isObject(r)&&0<r.length){var n=r.find(a.selectorValidateMessageContent);zzb.types.isObject(n)&&0!==n.length||(n=r),r.addClass("d-none"),h(n,!1),s=zzb.rob.renderListErrs({errs:l.system,format:a.listSystemErrsFormatType}),zzb.types.isNonEmptyString(s)&&(a.fnSystemErrorContent&&zzb.types.isFunction(a.fnSystemErrorContent)&&(s=a.fnSystemErrorContent(s)),n.html(s),n.addClass(u),n.show(),r.removeClass("d-none"))}}}l.hasErrors()?a.fnDialogErrors&&zzb.types.isFunction(a.fnDialogErrors)?a.fnDialogErrors(function(){e()}):e():a.fnDialogSuccess&&zzb.types.isFunction(a.fnDialogSuccess)?a.fnDialogSuccess(function(){e()}):e()},r.prototype.hideValidateFields=function(e){if(e=f.merge({$form:null,selectorField:".zzb-field",selectorValidateMessage:".zzb-field-validate",selectorValidateMessageContent:".zzb-field-validate-content"},e),!zzb.types.isObject(e))throw new Error("displayFormSubmitResults: options not defined");var t=null;t=zzb.types.isObject(e.$form)&&0!==e.$form.length?e.$form.find(e.selectorField):c(e.selectorField),zzb.types.isObject(t)&&0<t.length&&t.each(function(){h(c(this),!0)}),t=zzb.types.isObject(e.$form)&&0!==e.$form.length?e.$form.find(e.selectorValidateMessage):c(e.selectorValidateMessage),zzb.types.isObject(t)&&0<t.length&&t.each(function(){c(this).addClass("d-none");var t=c(this).find(e.selectorValidateMessageContent);zzb.types.isObject(t)&&0!==t.length||(t=c(this)),h(t,!1)})},r.prototype.serializeFormData=function(t){if((t=f.merge({formSelector:null,$form:null,action:null},t)).$form=zzb.forms.findForm(t.$form),!(zzb.types.isObject(t.$form)&&0!==t.$form.length||(t.$form=zzb.forms.findForm(t.formSelector),zzb.types.isObject(t.$form)&&0!==t.$form.length)))throw new Error("serializeFormData: $form not found");var e=t.$form.serializeToJSON();return zzb.types.isNonEmptyString(t.action)&&(e.submit=t.action),t.data=e,t},r.prototype.submitForm=function(e,s){if(!zzb.types.isObject(e))throw new Error("submitForm: options param not defined");if(zzb.types.isObject(e.$form)&&0<e.$form.length&&!zzb.types.isNonEmptyString(e.url)&&(e.url=e.$form.attr("action")),!zzb.types.isNonEmptyString(e.url))throw new Error("submitForm: options.url is unknown");if(!zzb.types.isObject(e.data))throw new Error("submitForm: options.data not defined");zzb.forms.hideValidateFields(e),zzb.ajax.postJSON({url:e.url,data:e.data}).then(function(t){(e.rob=t).hasErrors()?zzb.forms.displayUIErrors(e,function(){s&&s(e)}):(zzb.forms.hideValidateFields(e),s&&s(e))}).catch(function(t){zzb.dialogs.handleError({log:"failed to post login form: "+t,title:"Unknown error",message:"An unknown communications error occurred while retrieving the login form. Please check your connection settings and try again."})})},r.prototype.flashSystemErrors=function(t,e){if((t=f.merge({listSystemErrsFormatType:"text-punctuated",rob:null},t)).rob&&t.rob.listErrs&&t.rob.listErrs.hasSystemErrors()){var s=zzb.rob.renderListErrs({errs:t.rob.listErrs.system,format:t.listSystemErrsFormatType});zzb.types.isNonEmptyString(s)&&zzb.dialogs.showMessage({className:"zzb-dialog-flash-message zzb-dialog-flash-status-error",dataBackdrop:"static",body:s,onHide:function(){e&&e(t.rob)}})}else e&&e(t.rob)},s.forms=r},{}],4:[function(t,e,s){function r(){}var o=window._;r.prototype.getPO=function(t,e){var s=t[e];return s||this.getPermObject(e+":")},r.prototype.getPermObjectFromPermkeys=function(t){var r={},n=this;return Array.isArray(t)?o.each(t,function(t){var e=n.getPermObject(t);e.key&&(r[e.key]=e)}):zzb.types.isObject(t)&&o.forOwn(t,function(t,e){var s=null;(s=(t=t||"").indexOf(":")<0?n.getPermObject(e+":"+t):n.getPermObject(t))&&s.key&&(r[s.key]=s)}),r},r.prototype.mergePermkey=function(t,e){if(!e||!zzb.types.isNonEmptyString(e))return t;if(!t||!zzb.types.isNonEmptyString(t))return e;var s=null,r={},n={};if(t.indexOf(":")<=0?(r.key=t.trim(),r.perm=""):(s=t.split(":"),r.key=s[0].trim(),r.perm=s[1].trim().toUpperCase()),e.indexOf(":")<=0?(n.key=e.trim().toUpperCase(),n.perm=""):(s=e.split(":"),n.key=s[0].trim(),n.perm=s[1].trim().toUpperCase()),r.key!==n.key||r.perm===n.perm||0===n.perm.length)return t;if(0===r.key.length)return e;for(var i=0;i<n.perm.length;i++)r.perm.indexOf(n.perm[i])<0&&(r.perm+=n.perm[i]);return r.key+":"+r.perm},r.prototype.getPermObject=function(t,e,s){var r={key:null,perm:null,attr:{},toPermkey:function(){return this.key+":"+this.perm}};if((s||zzb.types.isNonEmptyString(s))&&(t=this.mergePermkey(t,s)),!t||!zzb.types.isNonEmptyString(t))return r.attr=this.getPermAttributes(),r;if(t.indexOf(":")<=0)return r.key=t,r.perm="",r.attr=this.getPermAttributes(),r;var n=t.split(":");if(r.key=n[0],r.perm=n[1],r.perm=r.perm.trim().toUpperCase(),0<r.perm.length&&e&&zzb.types.isNonEmptyString(e)){e=e.trim().toUpperCase();for(var i=r.perm.length-1;0<=i;i--)e.indexOf(r.perm[i])<0&&(r.perm=r.perm.replace(r.perm[i],""))}return r.attr=this.getPermAttributes(r.toPermkey(),e),r};var n=new RegExp("^[CRUDX]*$");r.prototype.getPermAttributes=function(t){var e={canRead:!1,canCreate:!1,canUpdate:!1,canDelete:!1,canExecute:!1};return t&&zzb.types.isNonEmptyString(t)?(0<=t.indexOf(":")&&(t=t.split(":")[1]),0===(t=t.trim().toUpperCase()).length||n.test(t)&&(e.canRead=0<=t.indexOf("C"),e.canCreate=0<=t.indexOf("R"),e.canUpdate=0<=t.indexOf("U"),e.canDelete=0<=t.indexOf("D"),e.canExecute=0<=t.indexOf("X")),e):e},r.prototype.hasMatch=function(t,e){if(!t||!e)return!1;var s=t;if(zzb.types.isNonEmptyString(t)&&(s=this.getPermObject(t)),!zzb.types.isObject(s)||!s.key||!s.perm||0===s.perm.length)return!1;var r=null;if(zzb.types.isNonEmptyString(e))r=this.getPermObject(e);else if(Array.isArray(e)){var n=this;o.each(e,function(t){if(zzb.types.isNonEmptyString(t)&&(t=n.getPermObject(t)),t.key===s.key)return r=t,!1})}else{if(!zzb.types.isObject(e))return!1;if(e.key)r=e;else{if(!e[s.key])return!1;r=zzb.types.isNonEmptyString(e[s.key])?this.getPermObject(s.key+":"+e[s.key]):e[s.key]}}if(!r||!r.key||!r.perm||0===!r.perm.length)return!1;for(var i=0;i<r.perm.length;i++)if(0<=s.perm.indexOf(r.perm[i]))return!0;return!1},s.perms=r},{}],5:[function(t,e,s){function r(){}var i=window._;function n(t){if((t=i.merge({type:"error",message:null,field:"_system",stack:null,isErr:!0,title:null},t)).isErr)switch("warn"===t.type?t.type="warning":"err"===t.type?t.type="error":"crit"===t.type?t.type="critical":"emerg"===t.type&&(t.type="emergency"),t.type){case"warning":case"notice":case"info":case"debug":t.isErr=!1;break;default:t.isErr=!0}return t}r.prototype.newROB=function(t){return i.merge({errs:null,recs:[],columns:[],paginate:{page:0,limit:0,count:0},hasErrors:function(){return this.errs&&Array.isArray(this.errs)&&0<this.errs.length},hasColumns:function(){return this.columns&&Array.isArray(this.columns)&&0<this.columns.length},hasRecords:function(){return this.recs&&Array.isArray(this.recs)&&0<this.recs.length},isEmpty:function(){return!this.hasRecords()||this.hasRecords()&&null===this.first()},first:function(){return this.recs&&Array.isArray(this.recs)&&0<this.recs.length?this.recs[0]:null},find:function(e,s){var r=null;return i.each(this.recs,function(t){if(t&&zzb.types.isObject(t)&&!Array.isArray(t)&&t[e]===s)return r=t,!1}),r},length:function(){return this.recs&&Array.isArray(this.recs)?this.recs.length:0}},t)},r.prototype.toObject=function(t){if(!t||!Array.isArray(t))return{_system:[t]};var e={};return i.each(t,function(t){t&&(t.field||(t.field="_system"),e[t.field]||(e[t.field]=[]),e[t.field].push(t))}),e};function o(t,e){if(!t)return n();if(zzb.types.isNonEmptyString(t))return n(i.merge({message:t},e));if(!Array.isArray(t)&&zzb.types.isObject(t))return n(t);throw new Error("bad input in createError - unrecognized err datatype")}r.prototype.createError=o,r.prototype.sanitizeErrors=function(t){var e=null;return t&&(Array.isArray(t)?0<t.length&&(e=[],i.each(t,function(t){e.push(o(t))})):e=[o(t)]),e},r.prototype.sanitizeRecords=function(t){return t?Array.isArray(t)?t:[t]:[]},r.prototype.toListErrs=function(t){var e=[],s=[],r=[],n=[];return t&&Array.isArray(t)&&0<t.length&&i.each(t,function(t){!0===t.isErr?"_system"===t.system?s.push(t):zzb.types.isNonEmptyString(t.field)?"_system"===t.field?s.push(t):e.push(t):s.push(t):"_system"===t.system?r.push(t):zzb.types.isNonEmptyString(t.field)?"_system"===t.field?r.push(t):n.push(t):r.push(t)}),{system:s,fields:e,systemMessages:r,fieldMessages:n,hasSystemErrors:function(){return this.system&&0<this.system.length},hasFieldErrors:function(){return this.fields&&0<this.fields.length},combinedErrors:function(){return this.system.concat(this.fields)},hasErrors:function(){return this.hasSystemErrors()||this.hasFieldErrors()},hasSystemMessages:function(){return this.systemMessages&&0<this.systemMessages.length},hasFieldMessages:function(){return this.fieldMessages&&0<this.fieldMessages.length},combinedMessages:function(){return this.systemMessages.concat(this.fieldMessages)},hasMessages:function(){return this.hasSystemMessages()||this.hasFieldMessages()}}},r.prototype.renderListErrs=function(s){s=i.merge({errs:[],format:"text",defaultTitle:"",template:null},s);var r=[];return zzb.types.isArrayHasRecords(s.errs)&&i.each(s.errs,function(t){var e="";zzb.types.isNonEmptyString(s.defaultTitle)?e=s.defaultTitle:zzb.types.isNonEmptyString(t.field)&&(e=t.field),s.template?r.push(zzb.strings.format(s.template,e,t.message)):"html"===s.format||"html-list"===s.format?r.push(zzb.strings.format('<li class="zzb-rob-list-error-item">{0}</li>',t.message)):"html-list-label"===s.format?r.push(zzb.strings.format('<li class="zzb-rob-list-error-item"><span>{0}:</span> {1}</li>',e,t.message)):"label"===s.format?r.push(zzb.strings.format("{0}: {1}",e,t.message)):"text-punctuated"===s.format?r.push(zzb.strings.toFirstCapitalEndPeriod(t.message)+" "):r.push(zzb.strings.format(t.message))}),r.join("")},s.rob=r},{}],6:[function(t,e,s){function r(){this.zzbStatus=null}var i=window.$,o=window._;r.prototype.get=function(t,e){var s=(t=o.merge({path:window.location.path,role:null})).path===window.location.path&&!t.role;if(s){if(this.zzbStatus)return e&&e(null,this.zzbStatus);var r=null;if("undefined"!=typeof Storage&&sessionStorage.zzbStatus){try{r=JSON.parse(sessionStorage.getItem("zzbStatus"))}catch(t){console.log("unable to parse zzbStatus from sessionStorage: "+t)}if(sessionStorage.setItem("zzbStatus",null),r)return this.zzbStatus=r,e&&e(null,this.zzbStatus)}if(0<i("#zzbStatus").length&&zzb.types.isNonEmptyString(i("#zzbStatus").attr("status"))){try{r=JSON.parse(i("#zzbStatus").attr("status"))}catch(t){console.log("unable to parse zzbStatus from embedded attribute in #zzbStatus: "+t)}if(r)return this.zzbStatus=r,e&&e(null,this.zzbStatus)}}r={user:{isLoggedIn:!1,username:null},page:{path:window.location.pathname}};var n=this;zzb.ajax.postJSON({url:"/zzb/status",data:t}).then(function(t){t.errs?e&&e(t.errs,r):(s&&(n.zzbStatus=t.one()),e&&e(null,t.one()))}).catch(function(t){console.log("failed to retrieve zzbStatus: using defaults"),e&&e(zzb.types.sanitizeErrors(t),r)})},s.status=r},{}],7:[function(t,e,s){function r(){}var u=window._;function p(t){var e=new Error(t);return e.name="ValueError",e}var c;r.prototype.format=(c={},function(t){var a=Array.prototype.slice.call(arguments,1),l=0,d="UNDEFINED";return Array.isArray(a)&&0<a.length&&Array.isArray(a[0])&&(a=a[0].map(function(t){return t})),t.replace(/([{}])\1|[{](.*?)(?:!(.+?))?[}]/g,function(t,e,s,r){if(null!=e)return e;var n=s;if(0<n.length){if("IMPLICIT"===d)throw p("cannot switch from implicit to explicit numbering");d="EXPLICIT"}else{if("EXPLICIT"===d)throw p("cannot switch from explicit to implicit numbering");d="IMPLICIT",n=String(l),l+=1}var i=n.split("."),o=(/^\d+$/.test(i[0])?i:["0"].concat(i)).reduce(function(t,s){return t.reduce(function(t,e){return null!=e&&s in Object(e)?["function"==typeof e[s]?e[s]():e[s]]:[]},[])},[a]).reduce(function(t,e){return e},"");if(null==r)return o;if(Object.prototype.hasOwnProperty.call(c,r))return c[r](o);throw p('no transformer named "'+r+'"')})}),r.prototype.formatEmpty=function(t){var s=Array.prototype.slice.call(arguments,1);return Array.isArray(s)?t.replace(/{(\d+)}/g,function(t,e){return void 0!==s[e]?s[e]:""}):t.replace(/{((?:(?=([^{}]+|{{[^}]*}}))\2)*)}/g,function(t,e){return 0<s.length&&s[0][e]?s[0][e]:""})},r.prototype.appendIfMoreThan=function(t,e,s){return t&&t.length>s?t.substring(0,s)+e:t},r.prototype.joinArrToCommas=function(r,n){return r&&Array.isArray(r)&&0!==r.length?r.map(r,function(t,e){var s="";return e<r.index-1&&(s=""),n?t[n]+s:t+s}).join(""):""},r.prototype.toPlural=function(t,e,s){return s=u.merge({forcePlural:!1,suffix:null},s),1!==e&&-1!==e||s.forcePlural?s.suffix?t+s.suffix:t+"s":t},r.prototype.toFirstCapitalEndPeriod=function(t){return zzb.types.isNonEmptyString(t)&&(t=u.trim(t),t=u.capitalize(t),u.endsWith(t,".")||(t+=".")),t};var f=["K","M","G","T","P","E","Z","Y"],h=["KB","MB","GB","TB","PB","EB","ZB","YB"],m=["Kilobyte","Megabyte","Gigabyte","Terabyte","Petabyte","Exabyte","Zettabyte","Yottabyte"],y=["KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"];r.prototype.sizeToHumanReadable=function(t,e,s,r){zzb.types.isNonEmptyString(e)||(e="single");var n=" ";!0===s&&(n=""),r=r||1;var i,o="B";switch(e.toLowerCase()){case"full":i=m,o="Bytes";break;case"double":i=h;break;case"eic":i=y;break;default:i=f}if(Math.abs(t)<1024)return t+n+o;for(var a=-1,l=Math.pow(r,10);t/=1024,++a,1024<=Math.round(Math.abs(t)*l)/l&&a<i.length-1;);var d=t.toFixed(r)+"";return d=u.trimEnd(d,".00"),(d=u.trimEnd(d,".0"))+n+i[a]},r.prototype.millisecondsTimeToHumanReadable=function(t){var e=t/1e3,s=Math.floor(e/31536e3),r=Math.floor((e%=31536e3)/86400),n=Math.floor((e%=86400)/3600),i=Math.floor((e%=3600)/60),o=e%60;return r||n||o||i?(s?s+"y ":"")+(r?r+"d ":"")+(n?n+"h ":"")+(i?i+"m ":"")+Number.parseFloat(o).toFixed(2)+"s":"< 1s"},s.strings=r},{}],8:[function(t,e,s){function r(){}r.prototype.escapeJqueryId=function(t,e){return(e=null==e?"#":e)+t.replace(/(:|\.|\[|\]|,)/g,"\\$1")},r.prototype.escapeHtml=function(t){return t?t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"):""},r.prototype.isArray=function(t){return t&&void 0!==t&&"[object Array]"===Object.prototype.toString.call(t)},r.prototype.isArrayHasRecords=function(t){return this.isArray(t)&&0<t.length},r.prototype.isObject=function(t){return t&&"object"==typeof t},r.prototype.isNumber=function(t){return!isNaN(t-0)&&null!==t&&""!==t&&!1!==t},r.prototype.isNonEmptyString=function(t){return t&&"string"==typeof t&&0<t.trim().length},r.prototype.isEmptyString=function(t){return t&&"string"==typeof t&&0===t.trim().length},r.prototype.isString=function(t){return t&&"string"==typeof t},r.prototype.isFunction=function(t){return t&&"[object Function]"==={}.toString.call(t)},r.prototype.isBoolean=function(t){return"boolean"==typeof t},r.prototype.compare=function(t,e,s){return t===e?0:s?e<t?-1:1:e<t?1:-1},s.types=r},{}],9:[function(t,e,s){function r(){}var n=window._;r.prototype.createPanelGroup=function(t){t=n.merge({id:zzb.uuid.newV4(),classPanelGroup:"",innerHtml:""},t);return zzb.strings.format('<div id="panelGroup_{id}" class="panel-group {classPanelGroup}">{innerHtml}</div>',t)},r.prototype.createPanelBody=function(t){t=n.merge({id:zzb.uuid.newV4(),classPanelBody:"",innerHtml:""},t);return zzb.strings.format('<div id="panelBody_{id}" class="panel-body {classPanelBody}">{innerHtml}</div>',t)},r.prototype.createPanel=function(t){t=n.merge({id:zzb.uuid.newV4(),className:"",attributesExtra:"",classPanelHeading:"",name:"",classPanelBody:"",innerHtml:""},t);var e='<div id="panel_{id}" class="panel panel-default {className}" {attributesExtra}><div class="panel-heading {classPanelHeading}>">{name}</div><div id="panelBody_{id}" class="panel-body {classPanelBody}">'+this.createPanelBody(t)+"</div></div>";return zzb.strings.format(e,t)},r.prototype.createPanelCollapsible=function(t){(t=n.merge({id:zzb.uuid.newV4(),className:"",attributesExtra:"",name:"",classPanelBody:"",innerHtml:"",isPanelCollapsed:!1,classNamePanelCollapsed:"",titleHtmlExtra:"",titleHtmlExtraRight:""},t)).isPanelCollapsed?(t._panelCollapsedClass1="collapsed",t._panelCollapsedClass2=""):(t._panelCollapsedClass1="",t._panelCollapsedClass2="in");var e='<div id="panel_{id}" class="panel panel-default {className}" {attributesExtra}><div class="panel-heading"><h4 class="panel-title">{titleHtmlExtra}<a data-toggle="collapse" data-target="#panelCollapse_{id}" href="#panelCollapse_{id}" class="{_panelCollapsedClass1}{classNamePanelCollapsed}">{name}</a> {titleHtmlExtraRight}</h4></div><div id="panelCollapse_{id}" class="panel-collapse collapse {_panelCollapsedClass2}">'+this.createPanelBody(t)+"</div></div>";return zzb.strings.format(e,t)},r.prototype.createPanelCollapsibleBegin=function(t){(t=n.merge({id:zzb.uuid.newV4(),className:"",attributesExtra:"",name:"",classPanelBody:"",innerHtml:"",isPanelCollapsed:!1,classNamePanelCollapsed:"",titleHtmlExtra:"",titleHtmlExtraRight:""},t)).isPanelCollapsed?(t._panelCollapsedClass1="collapsed",t._panelCollapsedClass2=""):(t._panelCollapsedClass1="",t._panelCollapsedClass2="in");return zzb.strings.format('<div class="panel panel-default {className}" id="panel_{id}" {attributesExtra}><div class="panel-heading"><h4 class="panel-title">{titleHtmlExtra}<a data-toggle="collapse" data-target="#panelCollapse_{id}" href="#panelCollapse_{id}" class="{_panelCollapsedClass1}{classNamePanelCollapsed}">{name}</a> {titleHtmlExtraRight}</h4></div><div id="panelCollapse_{id}" class="panel-collapse collapse {_panelCollapsedClass2}"><div class="panel-body" id="panelBody_{id}">',t)},r.prototype.createPanelCollapsibleEnd=function(){return"</div></div></div>"},s.uib=r},{}],10:[function(t,e,s){function r(){}var n=window._;r.prototype.newV4=function(){var s=n.now();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=(s+n.random(16))%16|0;return s=Math.floor(s/16),("x"===t?e:3&e|8).toString(16)})},r.prototype.isV4=function(t){return/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(t)},r.prototype.isValid=function(t){return/^([a-f\d]{8}(-[a-f\d]{4}){3}-[a-f\d]{12}?)$/i.test(t)},s.uuid=r},{}],11:[function(t,e,s){var i=window._;function n(t,e,s,r){return new o(t,e,s,r)}function o(t,e,s,r){this.parent=t,this.data=e,this.pkField=s,this.parentField=r,this.nodeConstructor=n,this.nodeItemConstructor=n,this.isDirty=!1,this.data[s]||(this.data[s]=null),this.data[r]||(this.data[r]=null),this.parent?this.parent.getId()!==this.data[r]&&(this.data[r]=this.parent.getId(),this.isDirty=!0):this.parent=null,this.children=[],this.getData=function(){return this.data},this.getId=function(){return this.data[s]},this.getParent=function(){return this.parent},this.getRoot=function(){return null===this.parent?this:this.parent.getRoot()},this.removeChild=function(e){if(0<this.children.length){var t=i.findIndex(this.children,function(t){return t.getId()===e});-1<t&&this.children.splice(t,1)}},this.addChild=function(e,t,s){var r=this,n=i.find(this.children,function(t){return t.getId()===e[r.pkField]});return n||(n=this.nodeConstructor(this,e,t||this.pkField,s||this.parentField),this.children.push(n)),n},this.findChild=function(e,s){var r=null;return this.getId()===e?r=this:(s&&0<this.items.length&&i.each(this.items,function(t){if(t.getId()===e)return r=t,!1}),!r&&0<this.children.length&&i.each(this.children,function(t){if(r=t.findChild(e,s))return!1})),r},this.items=[],this.itemOwner=null,this.getItemOwner=function(){return this.itemOwner},this.addItem=function(e,t,s){var r=this,n=i.find(this.items,function(t){return t.getId()===e[r.pkField]});return n||((n=this.nodeItemConstructor(null,e,t,s)).itemOwner=this).items.push(n),n},this.removeItem=function(e){if(0<this.items.length){var t=i.findIndex(this.items,function(t){return t.getId()===e});-1<t&&this.items.splice(t,1)}},this.findItem=function(e){var s=null;return 0<this.items.length&&i.each(this.items,function(t){if(t.getId()===e)return s=t,!1}),!s&&0<this.children.length&&i.each(this.children,function(t){if(s=t.findItem(e))return!1}),s},this.sortChildren=function(e,t){e&&0<this.children.length&&(this.children.sort(e),t||i.each(this.children,function(t){t.sortChildren(e)}))},this.sortItems=function(t,e,s){t&&0<this.items.length&&(this.items.sort(t),e&&i.each(this.items,function(t){s||t.sortChildren(e,s)}))},this.getLevelDeep=function(){var t=0;return this.parent&&(t=1,t+=this.parent.getLevelDeep()),t},this.branchCallFunction=function(t,e,s){e||t&&t(this),this.parent&&this.parent.branchCallfunction(t,e,s),s&&this.itemOwner&&this.itemOwner.branchCallfunction(t,e,s),e&&t&&t(this)},this.branchCallFunctionChildren=function(e,s){e&&e(this),0<this.children.length&&i.each(this.children,function(t){t.branchCallFunctionChildren(e,s)}),s&&0<this.items.length&&i.each(this.items,function(t){t.branchCallFunctionChildren(e,s)})}}e.exports.zzNode=o},{}],12:[function(c,s,t){if("undefined"==typeof jQuery)throw new Error("zazzy-browser's JavaScript requires jQuery. jQuery must be included before zazzy-browser's JavaScript.");if("undefined"==typeof _)throw new Error("zazzy-browser's JavaScript requires lodash. lodash must be included before zazzy-browser's JavaScript.");!function(t,e){if("undefined"!=typeof window)window.zzb=e();else if(void 0!==t)t.zzb=e();else if("function"==typeof define&&define.amd)define(e);else{if("object"!=typeof s||!s.exports)throw new Error("could not locate global cache object in which to create zzb");s.exports=e()}}(this,function(){"use strict";var t=c("./zzNode.js"),e=c("./types.js").types,s=c("./uuid.js").uuid,r=c("./strings.js").strings,n=c("./uib.js").uib,i=c("./forms.js").forms,o=c("./dialogs.js").dialogs,a=c("./perms.js").perms,l=c("./rob.js").rob,d=c("./ajax.js").ajax,u=c("./status.js").status;function p(){}return p.prototype.zzNode=t,p.prototype.types=new e,p.prototype.uuid=new s,p.prototype.strings=new r,p.prototype.uib=new n,p.prototype.forms=new i,p.prototype.dialogs=new o,p.prototype.perms=new a,p.prototype.rob=new l,p.prototype.ajax=new d,p.prototype.status=new u,new p})},{"./ajax.js":1,"./dialogs.js":2,"./forms.js":3,"./perms.js":4,"./rob.js":5,"./status.js":6,"./strings.js":7,"./types.js":8,"./uib.js":9,"./uuid.js":10,"./zzNode.js":11}]},{},[12]); | ||
!function i(o,a,l){function d(e,t){if(!a[e]){if(!o[e]){var s="function"==typeof require&&require;if(!t&&s)return s(e,!0);if(u)return u(e,!0);var r=new Error("Cannot find module '"+e+"'");throw r.code="MODULE_NOT_FOUND",r}var n=a[e]={exports:{}};o[e][0].call(n.exports,function(t){return d(o[e][1][t]||t)},n,n.exports,i,o,a,l)}return a[e].exports}for(var u="function"==typeof require&&require,t=0;t<l.length;t++)d(l[t]);return d}({1:[function(t,e,s){var r=window.$;function n(){this.ajax=function(a){return a=_.merge({SKIPREDIRECT:!1,SKIPFLASH:!1,NOFAILLOG:!1,NOFAILFLASH:!1,FAILFLASHMESSAGE:""},a),new Promise(function(i,o){r.ajax(a).done(function(e,t,s){if(a.RAWRETURN)return i(e);if(!e)return o(new Error("Data returned is empty when at minimum a status is required"));var r=!1,n=zzb.rob.newROB();if(s.responseJSON){if(!0!==a.SKIPREDIRECT&&e.redirect&&0<e.redirect.length)return zzb.types.isFunction(a.onRedirect)?void a.onRedirect(e,function(t){t||(window.location.href=e.redirect)}):void(zzb.types.isNonEmptyString(e.message)?zzb.dialogs.showMessage({className:"zzb-dialog-flash-message zzb-dialog-flash-redirect",dataBackdrop:"static",body:e.message,onHide:function(t){window.location.href=e.redirect}}):window.location.href=e.redirect);e.ISROBERRORS||(e.err?(e.errs=zzb.rob.sanitizeErrors(e.err),e.err=null):e.error?(e.errs=zzb.rob.sanitizeErrors(e.error),e.err=null):e.errs&&(e.errs=zzb.rob.sanitizeErrors(e.errs),e.err=null)),e.ISROBRECS||(e.recs?e.recs=zzb.rob.sanitizeRecords(e.recs):e.rec?(e.recs=zzb.rob.sanitizeRecords(e.rec),e.rec=null):Array.isArray(e.errs)&&0!==e.errs.length||(e.recs=zzb.rob.sanitizeRecords(e))),e.paginate&&(n.paginate=e.paginate),n.errs=e.errs,n.recs=e.recs,n.columns=e.columns,n.listErrs=zzb.rob.toListErrs(n.errs),!0!==a.SKIPFLASH&&zzb.types.isNonEmptyString(e.message)&&(r=!0,zzb.dialogs.showMessage({className:"zzb-dialog-flash-message "+zzb.strings.format("zzb-dialog-flash-status-{0}",n.hasErrors()?"error":"okay"),dataBackdrop:"static",body:e.message,onHide:function(t){i(n)}})),zzb.types.isFunction(a.onFinish)&&(r=!0,a.onFinish(n,function(t){!0!==t&&i(n)}))}else n.recs=[e];!0!==r&&i(n)}).fail(function(t,e,s){o(s),!0===a.NOFAILLOG&&s&&console.log(s),!0!==a.NOFAILFLASH&&(zzb.types.isNonEmptyString(a.FAILFLASHMESSAGE)?zzb.ajax.showMessageFailedAction({message:a.FAILFLASHMESSAGE}):zzb.ajax.showMessageFailedAction({message:l.MSG_FAILED_ACTION_UNEXPECTED_NETWORK}))})})}}function l(t){}l.MSG_FAILED_ACTION_UNEXPECTED="Submission failed unexpectedly. ",l.MSG_FAILED_ACTION_UNEXPECTED_NETWORK="Submission failed unexpectedly. This is likely a broken network connection and will resolve itself once reconnected.",l.MSG_FAILED_ACTION_UNEXPECTED_NETWORK_VERBOSE="Submission failed unexpectedly. This is likely a broken network connection and will resolve itself once reconnected. Either your network is down or our server is down",l.MSG_FAILED_ACTION_UNEXPECTED_WITHADMIN="Submission failed unexpectedly. Contact the administrator should the problem persist.",l.MSG_FAILED_ACTION_UNEXPECTED_NETWORK_WITHADMIN="Submission failed unexpectedly. This is likely a broken network connection and will resolve itself once reconnected. Contact the administrator should the problem persist.",n.prototype.showMessageFailedAction=function(t){t=_.merge({err:null,number:null,message:l.MSG_FAILED_ACTION_UNEXPECTED},t),zzb.types.isNumber(t.number)&&(t.number=" ("+t.number+")"),t.err&&console.log(t.err),zzb.dialogs.showMessage({className:"zzb-dialog-flash-message zzb-flash-invalid",dataBackdrop:"static",body:t.message+t.number})},n.prototype.get=function(t){return(t=_.merge({contentType:"application/json; charset=UTF-8",data:{}},t)).type="GET",zzb.types.isNonEmptyString(t.data)||(t.data=JSON.stringify(t.data)),this.ajax(t)},n.prototype.getJSON=function(t){return(t=_.merge({dataType:"json",contentType:"application/json; charset=UTF-8",data:{}},t)).type="GET",zzb.types.isNonEmptyString(t.data)||(t.data=JSON.stringify(t.data)),this.ajax(t)},n.prototype.postJSON=function(t){return(t=_.merge({dataType:"json",contentType:"application/json; charset=UTF-8",data:{}},t)).type="POST",zzb.types.isNonEmptyString(t.data)||(t.data=JSON.stringify(t.data)),this.ajax(t)},s.ajax=n},{}],2:[function(t,e,s){var o=window._,a=function(t){this.defaultOptions=a.getDialogDefaults(t),this.defaultOptions.onShow="function"==typeof t.onShow?t.onShow:function(){},this.defaultOptions.onShown="function"==typeof t.onShown?t.onShown:function(){},this.defaultOptions.onHide="function"==typeof t.onHide?t.onHide:function(){},this.defaultOptions.onHidden="function"==typeof t.onHidden?t.onHidden:function(){}};a.getButtonDefaults=function(t){var e={id:null,type:a.TYPE_NONE,label:"",className:"",action:null,isDismiss:!1,isOutline:!1};return zzb.types.isObject(t)?o.merge(e,t):e},a.getDialogDefaults=function(t){var e={id:zzb.uuid.newV4(),type:a.TYPE_NONE,className:"",extraAttributes:"",noFade:!1,title:"",body:"",buttons:[],onShow:null,onShown:null,onHide:null,onHidden:null,doVerticalCenter:!0,doAutoDestroy:!0,underlay:{isOn:!1,id:null,className:"",bg:"#838383",opacity:.5}};return zzb.types.isObject(t)?o.merge(e,t):e},a.BUTTON_CLOSE="button-close",a.BUTTON_OK="button-ok",a.BUTTON_YES="button-yes",a.BUTTON_NO="button-no",a.BUTTON_CANCEL="button-cancel",a.TYPE_NONE="none",a.TYPE_PRIMARY="primary",a.TYPE_SECONDARY="secondary",a.TYPE_SUCCESS="success",a.TYPE_DANGER="danger",a.TYPE_WARNING="warning",a.TYPE_INFO="info",a.TYPE_LIGHT="light",a.TYPE_DARK="dark",a.TYPE_LINK="link",a.getButtonPreset=function(t,e,s){var r=a.getButtonDefaults();switch(r.isDismiss=!0,e===s-1?r.type=a.TYPE_PRIMARY:e===s-2&&(r.type=a.TYPE_SECONDARY),t){case"button-close":r.label="Close";break;case"button-ok":r.label="Ok";break;case"button-accept":r.label="Accept";break;case"button-yes":r.label="Yes";break;case"button-no":r.label="No";break;case"button-cancel":r.label="Cancel";break;default:r=null}return r},a.validateType=function(t){if(!t)return a.TYPE_NONE;switch(t){case a.TYPE_PRIMARY:case a.TYPE_SECONDARY:case a.TYPE_SUCCESS:case a.TYPE_DANGER:case a.TYPE_WARNING:case a.TYPE_INFO:case a.TYPE_LIGHT:case a.TYPE_DARK:case a.TYPE_LINK:return t;default:return a.TYPE_NONE}},a.isTypeNone=function(t){return a.validateType(t)===a.TYPE_NONE},a.prototype.getId=function(){return zzb.types.isNonEmptyString(this.defaultOptions.id)||(this.defaultOptions.id=zzb.uuid.newV4()),this.defaultOptions.id},a.prototype.getClassName=function(){return zzb.types.isNonEmptyString(this.defaultOptions.className)||(this.defaultOptions.className=""),this.defaultOptions.className},a.prototype.getTitle=function(){return zzb.types.isNonEmptyString(this.defaultOptions.title)||(this.defaultOptions.title=""),this.defaultOptions.title},a.prototype.getBody=function(){return zzb.types.isNonEmptyString(this.defaultOptions.body)||(this.defaultOptions.body=""),this.defaultOptions.body},a.prototype.create$Modal=function(){var t=o.merge({id:this.getId(),arialabel:"arialabel"+this.getId(),className:this.getClassName(),title:this.getTitle(),body:this.getBody(),classVerticalCenter:this.defaultOptions.doVerticalCenter?" modal-dialog-centered":"",classModalHeader:"",noHeaderCloseButton:!1,noHeaderCloseButtonButton:""},this.defaultOptions);t.classFade="fade",zzb.types.isBoolean(t.noFade)&&!0===t.noFade&&(t.classFade=""),a.isTypeNone(this.defaultOptions.type)||(t.classModalHeader+=" alert-"+this.defaultOptions.type),zzb.types.isNonEmptyString(t.dataBackdrop)&&(t.extraAttributes+=' data-backdrop="'+t.dataBackdrop+'"'),zzb.types.isBoolean(t.dataKeyboard)&&(t.extraAttributes+=' data-keyboard="'+t.dataKeyboard+'"'),!0!==t.noHeaderCloseButton&&(t.noHeaderCloseButtonButton='<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>');var r=$(zzb.strings.format('<div class="modal {classFade} modal-fullscreen {className}" {extraAttributes} id="{id}" tabindex="-1" role="dialog" aria-labelledby="{arialabel}" aria-hidden="true"><div class="modal-dialog{classVerticalCenter}" role="document"><div class="modal-content"><div class="modal-header{classModalHeader}"><h5 class="modal-title" id="{arialabel}">{title}</h5>{noHeaderCloseButtonButton}</div><div class="modal-body">{body}</div><div class="modal-footer"></div></div></div></div>',t));Array.isArray(this.defaultOptions.buttons)||(this.defaultOptions.buttons=[]);var n=this,i=this.defaultOptions.buttons.length;return o.each(this.defaultOptions.buttons,function(t,e){if(zzb.types.isNonEmptyString(t)&&(t=a.getButtonPreset(t,e,i)),zzb.types.isObject(t)){zzb.types.isNonEmptyString(t.id)||(t.id="button-"+e+"-"+n.getId()),t.isDismiss&&(zzb.types.isFunction(t.action)||(t.action=function(t,e){t.close()}),r.find(".modal-header button.close").attr("aria-label",t.label)),a.isTypeNone(t.type)||(t.isOutline?t.className+=" btn-outline-"+t.type:t.className+=" btn-"+t.type);var s=$(zzb.strings.format('<button id="{id}" type="button" class="btn {className}">{label}</button>',t));s.data("button",t),s.on("click",{dialog:n,$button:s,button:t},function(t){var e=t.data.dialog,s=t.data.$button,r=s.data("button");if("function"==typeof r.action)return r.action.call(s,e,t)}),0<r.find(".modal-footer > button").length?s.insertAfter(r.find(".modal-footer > button").last()):r.find(".modal-footer").append(s)}}),r},a.prototype.open=function(){if(!this.$modal){this.$modal=this.create$Modal();var e=this;this.$modal.on("show.bs.modal",function(t){e.onShow(t)}),this.$modal.on("shown.bs.modal",function(t){e.onShown(t)}),this.$modal.on("hide.bs.modal",function(t){e.onHide(t)}),this.$modal.on("hidden.bs.modal",function(t){e.onHidden(t)})}if(zzb.types.isObject(this.defaultOptions.underlay)&&!0===this.defaultOptions.underlay.isOn){zzb.types.isNonEmptyString(this.defaultOptions.underlay.id)||(this.defaultOptions.underlay.id="zzbModalUnderlay");var t=t=$("#"+this.defaultOptions.underlay.id);if(0===t.length){var s=[];zzb.types.isNonEmptyString(this.defaultOptions.underlay.className)?s.push(' class="'+this.defaultOptions.underlay.className+'"'):(s.push(' style="'),s.push("position:absolute;top:0;left:0;width:100%;height:100%;display:none;"),zzb.types.isNonEmptyString(this.defaultOptions.underlay.bg)&&(s.push("background-color:"+this.defaultOptions.underlay.bg+";"),zzb.types.isNumber(this.defaultOptions.underlay.opacity)&&s.push("opacity:"+this.defaultOptions.underlay.opacity+";")),s.push('"')),$('<div id="'+this.defaultOptions.underlay.id+'" '+s.join("")+"></div>").appendTo("body"),t=$("#"+this.defaultOptions.underlay.id)}t.show()}this.$modal.modal("show"),this.$modal.appendTo("body")},a.prototype.onShow=function(t){this.defaultOptions.onShow(t,this,this.$modal)},a.prototype.onShown=function(t){this.defaultOptions.onShown(t,this,this.$modal)},a.prototype.onHide=function(t){this.defaultOptions.onHide(t,this,this.$modal)},a.prototype.onHidden=function(t){this.defaultOptions.onHidden(t,this,this.$modal),this.defaultOptions.doAutoDestroy&&this.$modal.remove()},a.prototype.close=function(){if(this.$modal.modal("hide"),zzb.types.isObject(this.defaultOptions.underlay)&&!0===this.defaultOptions.underlay.isOn&&zzb.types.isNonEmptyString(this.defaultOptions.underlay.id)){var t=t=$("#"+this.defaultOptions.underlay.id);0<t.length&&t.hide()}},a.prototype.destroy=function(){if(this.$modal.modal("hide"),this.$modal.modal("dispose"),0<$("#"+this.getId()).length&&$("#"+this.getId()).remove(),zzb.types.isObject(this.defaultOptions.underlay)&&!0===this.defaultOptions.underlay.isOn&&zzb.types.isNonEmptyString(this.defaultOptions.underlay.id)){var t=t=$("#"+this.defaultOptions.underlay.id);0<t.length&&t.remove()}this.$modal=null};function r(){}r.prototype.ZazzyDialog=a,r.prototype.modal=function(t){return new a(t)},r.prototype.showMessage=function(t){zzb.dialogs.modal(o.merge({type:a.TYPE_NONE,buttons:[a.BUTTON_OK]},t)).open()},r.prototype.showMessageChoice=function(t){zzb.dialogs.modal(o.merge({type:a.TYPE_NONE,buttons:[a.BUTTON_CANCEL,a.getButtonDefaults({type:a.TYPE_PRIMARY,label:"Accept",action:function(t,e){t.close()}})]},t)).open()},r.prototype.handleError=function(t){if((t=o.merge({log:null,type:a.TYPE_DANGER,title:"",body:'<div class="zzb-dialog-errors">{errors}</div><div class="zzb-dialog-message">{message}</div>',message:"",errs:null,errors:"",buttons:[a.getButtonDefaults({type:a.TYPE_DANGER,label:"Ok",action:function(t,e){t.close()}})]},t)).log&&console.log(t.log),!zzb.types.isNonEmptyString(t.errors)&&zzb.types.isArray(t.errs)){var s=[];o.each(t.errs,function(t,e){t.message&&zzb.types.isNonEmptyString(t.message)&&s.push(zzb.strings.format('<div class="zzb-dialog-error-item">{0}</div>',t.message))}),t.errors=s.join("\n")}t.body=zzb.strings.format(t.body,t),this.showMessage(t)},s.dialogs=r},{}],3:[function(t,e,s){function r(){}var c=window.$,f=window._;function h(t,e){zzb.types.isObject(t)&&0<t.length&&(!0===e?(t.removeClass("is-valid"),t.removeClass("is-invalid")):(t.removeClass("valid-feedback"),t.removeClass("invalid-feedback"),t.removeClass("valid-tooltip"),t.removeClass("invalid-tooltip")))}r.prototype.findForm=function(t){return zzb.types.isString(t)?0<t.length&&"."===t[0]?c(t):c(zzb.types.escapeJqueryId(t)):c(t).closest("form")},r.prototype.displayUIErrors=function(a,t){if(a=f.merge({$form:null,selector:null,attrFormFieldname:"name",selectorField:".zzb-field",attrFieldname:"zzb-fieldname",selectorValidateMessage:".zzb-field-validate",selectorValidateMessageContent:".zzb-field-validate-content",isTooltip:!1,addClassFieldIsValid:!1,addClassFieldIsInvalid:!1,doFlashSystemErrors:!0,selectorInlineSystemFieldname:"_system",listSystemErrsFormatType:"text-punctuated",skipHideFields:!1,listErrs:null,errs:null,rob:null,fnSystemErrorContent:null,fnDialogSystemErrors:null,fnDialogErrors:null,fnDialogSuccess:null},a),zzb.types.isObject(a.$form)&&0!==a.$form.length||zzb.types.isNonEmptyString(a.selector)&&0<c(a.selector).length&&(a.$form=c(a.selector)),!zzb.types.isObject(a.$form)||0===a.$form.length)return t&&t(!1,new Error("could not select the form"));var l=null;if(a.listErrs)l=a.listErrs;else if(a.rob&&a.rob.listErrs)l=a.rob.listErrs;else{if(!a.errs)return t&&t(!1,new Error("could not find the list of errors"));l=zzb.rob.toListErrs(a.errs)}a.$form.removeClass("was-validated");function e(){t&&t(!l.hasErrors(),null)}var d="valid-feedback",u="invalid-feedback";a.isTooltip&&(d="valid-tooltip",u="invalid-tooltip");var p=l.hasFieldErrors();if(!0!==a.skipHideFields&&zzb.forms.hideValidateFields(a),a.$form.find(a.selectorField).each(function(t,e){var s=c(e),r=s.attr(a.attrFormFieldname),n=null;if(zzb.types.isNonEmptyString(r)){if(zzb.types.isNonEmptyString(r)){p&&f.each(l.fields,function(t){if(t.field===r)return n=t,!1});var i=a.$form.find(a.selectorValidateMessage+"["+a.attrFieldname+"='"+r+"']");if(zzb.types.isObject(i)&&0<i.length){var o=i.find(a.selectorValidateMessageContent);zzb.types.isObject(o)&&0!==o.length||(o=i),i.addClass("d-none"),h(o,!1),n&&(o.html(zzb.strings.toFirstCapitalEndPeriod(n.message)),!1===n.isErr?o.addClass(d):o.addClass(u),o.show(),i.removeClass("d-none"))}}h(s,!0),n?a.addClassFieldIsInvalid&&s.addClass("is-invalid"):a.addClassFieldIsValid&&s.addClass("is-valid ")}}),l.hasSystemErrors()){var s="";if(a.fnDialogSystemErrors&&zzb.types.isFunction(a.fnDialogSystemErrors))return void a.fnDialogSystemErrors(zzb.rob.renderListErrs({errs:l.system,format:a.listSystemErrsFormatType}),function(){e()});if(!1!==a.doFlashSystemErrors)return s=zzb.rob.renderListErrs({errs:l.system,format:a.listSystemErrsFormatType}),void(zzb.types.isNonEmptyString(s)&&(a.fnSystemErrorContent&&zzb.types.isFunction(a.fnSystemErrorContent)&&(s=a.fnSystemErrorContent(s)),zzb.dialogs.showMessage({className:"zzb-dialog-flash-message zzb-flash-invalid",dataBackdrop:"static",body:s,onHide:function(){e()}})));if(zzb.types.isNonEmptyString(a.selectorInlineSystemFieldname)){var r=a.$form.find(a.selectorValidateMessage+"["+a.attrFieldname+"='"+a.selectorInlineSystemFieldname+"']");if(zzb.types.isObject(r)&&0<r.length){var n=r.find(a.selectorValidateMessageContent);zzb.types.isObject(n)&&0!==n.length||(n=r),r.addClass("d-none"),h(n,!1),s=zzb.rob.renderListErrs({errs:l.system,format:a.listSystemErrsFormatType}),zzb.types.isNonEmptyString(s)&&(a.fnSystemErrorContent&&zzb.types.isFunction(a.fnSystemErrorContent)&&(s=a.fnSystemErrorContent(s)),n.html(s),n.addClass(u),n.show(),r.removeClass("d-none"))}}}l.hasErrors()?a.fnDialogErrors&&zzb.types.isFunction(a.fnDialogErrors)?a.fnDialogErrors(function(){e()}):e():a.fnDialogSuccess&&zzb.types.isFunction(a.fnDialogSuccess)?a.fnDialogSuccess(function(){e()}):e()},r.prototype.hideValidateFields=function(e){if(e=f.merge({$form:null,selectorField:".zzb-field",selectorValidateMessage:".zzb-field-validate",selectorValidateMessageContent:".zzb-field-validate-content"},e),!zzb.types.isObject(e))throw new Error("displayFormSubmitResults: options not defined");var t=null;t=zzb.types.isObject(e.$form)&&0!==e.$form.length?e.$form.find(e.selectorField):c(e.selectorField),zzb.types.isObject(t)&&0<t.length&&t.each(function(){h(c(this),!0)}),t=zzb.types.isObject(e.$form)&&0!==e.$form.length?e.$form.find(e.selectorValidateMessage):c(e.selectorValidateMessage),zzb.types.isObject(t)&&0<t.length&&t.each(function(){c(this).addClass("d-none");var t=c(this).find(e.selectorValidateMessageContent);zzb.types.isObject(t)&&0!==t.length||(t=c(this)),h(t,!1)})},r.prototype.serializeFormData=function(t){if((t=f.merge({formSelector:null,$form:null,action:null},t)).$form=zzb.forms.findForm(t.$form),!(zzb.types.isObject(t.$form)&&0!==t.$form.length||(t.$form=zzb.forms.findForm(t.formSelector),zzb.types.isObject(t.$form)&&0!==t.$form.length)))throw new Error("serializeFormData: $form not found");var e=t.$form.serializeToJSON({parseFloat:{condition:".zzb-number,.zzb-money"}});return zzb.types.isNonEmptyString(t.action)&&(e.submit=t.action),t.data=e,t},r.prototype.submitForm=function(e,s){if(!zzb.types.isObject(e))throw new Error("submitForm: options param not defined");if(zzb.types.isObject(e.$form)&&0<e.$form.length&&!zzb.types.isNonEmptyString(e.url)&&(e.url=e.$form.attr("action")),!zzb.types.isNonEmptyString(e.url))throw new Error("submitForm: options.url is unknown");if(!zzb.types.isObject(e.data))throw new Error("submitForm: options.data not defined");zzb.forms.hideValidateFields(e),zzb.ajax.postJSON({url:e.url,data:e.data}).then(function(t){(e.rob=t).hasErrors()?zzb.forms.displayUIErrors(e,function(){s&&s(e)}):(zzb.forms.hideValidateFields(e),s&&s(e))}).catch(function(t){zzb.dialogs.handleError({log:"failed to post login form: "+t,title:"Unknown error",message:"An unknown communications error occurred while retrieving the login form. Please check your connection settings and try again."})})},r.prototype.flashSystemErrors=function(t,e){if((t=f.merge({listSystemErrsFormatType:"text-punctuated",rob:null},t)).rob&&t.rob.listErrs&&t.rob.listErrs.hasSystemErrors()){var s=zzb.rob.renderListErrs({errs:t.rob.listErrs.system,format:t.listSystemErrsFormatType});zzb.types.isNonEmptyString(s)&&zzb.dialogs.showMessage({className:"zzb-dialog-flash-message zzb-dialog-flash-status-error",dataBackdrop:"static",body:s,onHide:function(){e&&e(t.rob)}})}else e&&e(t.rob)},s.forms=r},{}],4:[function(t,e,s){function r(){}var o=window._;r.prototype.getPO=function(t,e){var s=t[e];return s||this.getPermObject(e+":")},r.prototype.getPermObjectFromPermkeys=function(t){var r={},n=this;return Array.isArray(t)?o.each(t,function(t){var e=n.getPermObject(t);e.key&&(r[e.key]=e)}):zzb.types.isObject(t)&&o.forOwn(t,function(t,e){var s=null;(s=(t=t||"").indexOf(":")<0?n.getPermObject(e+":"+t):n.getPermObject(t))&&s.key&&(r[s.key]=s)}),r},r.prototype.mergePermkey=function(t,e){if(!e||!zzb.types.isNonEmptyString(e))return t;if(!t||!zzb.types.isNonEmptyString(t))return e;var s=null,r={},n={};if(t.indexOf(":")<=0?(r.key=t.trim(),r.perm=""):(s=t.split(":"),r.key=s[0].trim(),r.perm=s[1].trim().toUpperCase()),e.indexOf(":")<=0?(n.key=e.trim().toUpperCase(),n.perm=""):(s=e.split(":"),n.key=s[0].trim(),n.perm=s[1].trim().toUpperCase()),r.key!==n.key||r.perm===n.perm||0===n.perm.length)return t;if(0===r.key.length)return e;for(var i=0;i<n.perm.length;i++)r.perm.indexOf(n.perm[i])<0&&(r.perm+=n.perm[i]);return r.key+":"+r.perm},r.prototype.getPermObject=function(t,e,s){var r={key:null,perm:null,attr:{},toPermkey:function(){return this.key+":"+this.perm}};if((s||zzb.types.isNonEmptyString(s))&&(t=this.mergePermkey(t,s)),!t||!zzb.types.isNonEmptyString(t))return r.attr=this.getPermAttributes(),r;if(t.indexOf(":")<=0)return r.key=t,r.perm="",r.attr=this.getPermAttributes(),r;var n=t.split(":");if(r.key=n[0],r.perm=n[1],r.perm=r.perm.trim().toUpperCase(),0<r.perm.length&&e&&zzb.types.isNonEmptyString(e)){e=e.trim().toUpperCase();for(var i=r.perm.length-1;0<=i;i--)e.indexOf(r.perm[i])<0&&(r.perm=r.perm.replace(r.perm[i],""))}return r.attr=this.getPermAttributes(r.toPermkey(),e),r};var n=new RegExp("^[CRUDX]*$");r.prototype.getPermAttributes=function(t){var e={canRead:!1,canCreate:!1,canUpdate:!1,canDelete:!1,canExecute:!1};return t&&zzb.types.isNonEmptyString(t)?(0<=t.indexOf(":")&&(t=t.split(":")[1]),0===(t=t.trim().toUpperCase()).length||n.test(t)&&(e.canRead=0<=t.indexOf("C"),e.canCreate=0<=t.indexOf("R"),e.canUpdate=0<=t.indexOf("U"),e.canDelete=0<=t.indexOf("D"),e.canExecute=0<=t.indexOf("X")),e):e},r.prototype.hasMatch=function(t,e){if(!t||!e)return!1;var s=t;if(zzb.types.isNonEmptyString(t)&&(s=this.getPermObject(t)),!zzb.types.isObject(s)||!s.key||!s.perm||0===s.perm.length)return!1;var r=null;if(zzb.types.isNonEmptyString(e))r=this.getPermObject(e);else if(Array.isArray(e)){var n=this;o.each(e,function(t){if(zzb.types.isNonEmptyString(t)&&(t=n.getPermObject(t)),t.key===s.key)return r=t,!1})}else{if(!zzb.types.isObject(e))return!1;if(e.key)r=e;else{if(!e[s.key])return!1;r=zzb.types.isNonEmptyString(e[s.key])?this.getPermObject(s.key+":"+e[s.key]):e[s.key]}}if(!r||!r.key||!r.perm||0===!r.perm.length)return!1;for(var i=0;i<r.perm.length;i++)if(0<=s.perm.indexOf(r.perm[i]))return!0;return!1},s.perms=r},{}],5:[function(t,e,s){function r(){}var i=window._;function n(t){if((t=i.merge({type:"error",message:null,field:"_system",stack:null,isErr:!0,title:null},t)).isErr)switch("warn"===t.type?t.type="warning":"err"===t.type?t.type="error":"crit"===t.type?t.type="critical":"emerg"===t.type&&(t.type="emergency"),t.type){case"warning":case"notice":case"info":case"debug":t.isErr=!1;break;default:t.isErr=!0}return t}r.prototype.newROB=function(t){return i.merge({errs:null,recs:[],columns:[],paginate:{page:0,limit:0,count:0},hasErrors:function(){return this.errs&&Array.isArray(this.errs)&&0<this.errs.length},hasColumns:function(){return this.columns&&Array.isArray(this.columns)&&0<this.columns.length},hasRecords:function(){return this.recs&&Array.isArray(this.recs)&&0<this.recs.length},isEmpty:function(){return!this.hasRecords()||this.hasRecords()&&null===this.first()},first:function(){return this.recs&&Array.isArray(this.recs)&&0<this.recs.length?this.recs[0]:null},find:function(e,s){var r=null;return i.each(this.recs,function(t){if(t&&zzb.types.isObject(t)&&!Array.isArray(t)&&t[e]===s)return r=t,!1}),r},length:function(){return this.recs&&Array.isArray(this.recs)?this.recs.length:0}},t)},r.prototype.toObject=function(t){if(!t||!Array.isArray(t))return{_system:[t]};var e={};return i.each(t,function(t){t&&(t.field||(t.field="_system"),e[t.field]||(e[t.field]=[]),e[t.field].push(t))}),e};function o(t,e){if(!t)return n();if(zzb.types.isNonEmptyString(t))return n(i.merge({message:t},e));if(!Array.isArray(t)&&zzb.types.isObject(t))return n(t);throw new Error("bad input in createError - unrecognized err datatype")}r.prototype.createError=o,r.prototype.sanitizeErrors=function(t){var e=null;return t&&(Array.isArray(t)?0<t.length&&(e=[],i.each(t,function(t){e.push(o(t))})):e=[o(t)]),e},r.prototype.sanitizeRecords=function(t){return t?Array.isArray(t)?t:[t]:[]},r.prototype.toListErrs=function(t){var e=[],s=[],r=[],n=[];return t&&Array.isArray(t)&&0<t.length&&i.each(t,function(t){!0===t.isErr?"_system"===t.system?s.push(t):zzb.types.isNonEmptyString(t.field)?"_system"===t.field?s.push(t):e.push(t):s.push(t):"_system"===t.system?r.push(t):zzb.types.isNonEmptyString(t.field)?"_system"===t.field?r.push(t):n.push(t):r.push(t)}),{system:s,fields:e,systemMessages:r,fieldMessages:n,hasSystemErrors:function(){return this.system&&0<this.system.length},hasFieldErrors:function(){return this.fields&&0<this.fields.length},combinedErrors:function(){return this.system.concat(this.fields)},hasErrors:function(){return this.hasSystemErrors()||this.hasFieldErrors()},hasSystemMessages:function(){return this.systemMessages&&0<this.systemMessages.length},hasFieldMessages:function(){return this.fieldMessages&&0<this.fieldMessages.length},combinedMessages:function(){return this.systemMessages.concat(this.fieldMessages)},hasMessages:function(){return this.hasSystemMessages()||this.hasFieldMessages()}}},r.prototype.renderListErrs=function(s){s=i.merge({errs:[],format:"text",defaultTitle:"",template:null},s);var r=[];return zzb.types.isArrayHasRecords(s.errs)&&i.each(s.errs,function(t){var e="";zzb.types.isNonEmptyString(s.defaultTitle)?e=s.defaultTitle:zzb.types.isNonEmptyString(t.field)&&(e=t.field),s.template?r.push(zzb.strings.format(s.template,e,t.message)):"html"===s.format||"html-list"===s.format?r.push(zzb.strings.format('<li class="zzb-rob-list-error-item">{0}</li>',t.message)):"html-list-label"===s.format?r.push(zzb.strings.format('<li class="zzb-rob-list-error-item"><span>{0}:</span> {1}</li>',e,t.message)):"label"===s.format?r.push(zzb.strings.format("{0}: {1}",e,t.message)):"text-punctuated"===s.format?r.push(zzb.strings.toFirstCapitalEndPeriod(t.message)+" "):r.push(zzb.strings.format(t.message))}),r.join("")},s.rob=r},{}],6:[function(t,e,s){function r(){this.zzbStatus=null}var i=window.$,o=window._;r.prototype.get=function(t,e){var s=(t=o.merge({path:window.location.path,role:null})).path===window.location.path&&!t.role;if(s){if(this.zzbStatus)return e&&e(null,this.zzbStatus);var r=null;if("undefined"!=typeof Storage&&sessionStorage.zzbStatus){try{r=JSON.parse(sessionStorage.getItem("zzbStatus"))}catch(t){console.log("unable to parse zzbStatus from sessionStorage: "+t)}if(sessionStorage.setItem("zzbStatus",null),r)return this.zzbStatus=r,e&&e(null,this.zzbStatus)}if(0<i("#zzbStatus").length&&zzb.types.isNonEmptyString(i("#zzbStatus").attr("status"))){try{r=JSON.parse(i("#zzbStatus").attr("status"))}catch(t){console.log("unable to parse zzbStatus from embedded attribute in #zzbStatus: "+t)}if(r)return this.zzbStatus=r,e&&e(null,this.zzbStatus)}}r={user:{isLoggedIn:!1,username:null},page:{path:window.location.pathname}};var n=this;zzb.ajax.postJSON({url:"/zzb/status",data:t}).then(function(t){t.errs?e&&e(t.errs,r):(s&&(n.zzbStatus=t.one()),e&&e(null,t.one()))}).catch(function(t){console.log("failed to retrieve zzbStatus: using defaults"),e&&e(zzb.types.sanitizeErrors(t),r)})},s.status=r},{}],7:[function(t,e,s){function r(){}var u=window._;function p(t){var e=new Error(t);return e.name="ValueError",e}var c;r.prototype.format=(c={},function(t){var a=Array.prototype.slice.call(arguments,1),l=0,d="UNDEFINED";return Array.isArray(a)&&0<a.length&&Array.isArray(a[0])&&(a=a[0].map(function(t){return t})),t.replace(/([{}])\1|[{](.*?)(?:!(.+?))?[}]/g,function(t,e,s,r){if(null!=e)return e;var n=s;if(0<n.length){if("IMPLICIT"===d)throw p("cannot switch from implicit to explicit numbering");d="EXPLICIT"}else{if("EXPLICIT"===d)throw p("cannot switch from explicit to implicit numbering");d="IMPLICIT",n=String(l),l+=1}var i=n.split("."),o=(/^\d+$/.test(i[0])?i:["0"].concat(i)).reduce(function(t,s){return t.reduce(function(t,e){return null!=e&&s in Object(e)?["function"==typeof e[s]?e[s]():e[s]]:[]},[])},[a]).reduce(function(t,e){return e},"");if(null==r)return o;if(Object.prototype.hasOwnProperty.call(c,r))return c[r](o);throw p('no transformer named "'+r+'"')})}),r.prototype.formatEmpty=function(t){var s=Array.prototype.slice.call(arguments,1);return Array.isArray(s)?t.replace(/{(\d+)}/g,function(t,e){return void 0!==s[e]?s[e]:""}):t.replace(/{((?:(?=([^{}]+|{{[^}]*}}))\2)*)}/g,function(t,e){return 0<s.length&&s[0][e]?s[0][e]:""})},r.prototype.appendIfMoreThan=function(t,e,s){return t&&t.length>s?t.substring(0,s)+e:t},r.prototype.joinArrToCommas=function(r,n){return r&&Array.isArray(r)&&0!==r.length?r.map(r,function(t,e){var s="";return e<r.index-1&&(s=""),n?t[n]+s:t+s}).join(""):""},r.prototype.toPlural=function(t,e,s){return s=u.merge({forcePlural:!1,suffix:null},s),1!==e&&-1!==e||s.forcePlural?s.suffix?t+s.suffix:t+"s":t},r.prototype.toFirstCapitalEndPeriod=function(t){return zzb.types.isNonEmptyString(t)&&(t=u.trim(t),t=u.capitalize(t),u.endsWith(t,".")||(t+=".")),t};var f=["K","M","G","T","P","E","Z","Y"],h=["KB","MB","GB","TB","PB","EB","ZB","YB"],m=["Kilobyte","Megabyte","Gigabyte","Terabyte","Petabyte","Exabyte","Zettabyte","Yottabyte"],y=["KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"];r.prototype.sizeToHumanReadable=function(t,e,s,r){zzb.types.isNonEmptyString(e)||(e="single");var n=" ";!0===s&&(n=""),r=r||1;var i,o="B";switch(e.toLowerCase()){case"full":i=m,o="Bytes";break;case"double":i=h;break;case"eic":i=y;break;default:i=f}if(Math.abs(t)<1024)return t+n+o;for(var a=-1,l=Math.pow(r,10);t/=1024,++a,1024<=Math.round(Math.abs(t)*l)/l&&a<i.length-1;);var d=t.toFixed(r)+"";return d=u.trimEnd(d,".00"),(d=u.trimEnd(d,".0"))+n+i[a]},r.prototype.millisecondsTimeToHumanReadable=function(t){var e=t/1e3,s=Math.floor(e/31536e3),r=Math.floor((e%=31536e3)/86400),n=Math.floor((e%=86400)/3600),i=Math.floor((e%=3600)/60),o=e%60;return r||n||o||i?(s?s+"y ":"")+(r?r+"d ":"")+(n?n+"h ":"")+(i?i+"m ":"")+Number.parseFloat(o).toFixed(2)+"s":"< 1s"},s.strings=r},{}],8:[function(t,e,s){function r(){}r.prototype.escapeJqueryId=function(t,e){return(e=null==e?"#":e)+t.replace(/(:|\.|\[|\]|,)/g,"\\$1")},r.prototype.escapeHtml=function(t){return t?t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"):""},r.prototype.isArray=function(t){return t&&void 0!==t&&"[object Array]"===Object.prototype.toString.call(t)},r.prototype.isArrayHasRecords=function(t){return this.isArray(t)&&0<t.length},r.prototype.isObject=function(t){return t&&"object"==typeof t},r.prototype.isNumber=function(t){return!isNaN(t-0)&&null!==t&&""!==t&&!1!==t},r.prototype.isNonEmptyString=function(t){return t&&"string"==typeof t&&0<t.trim().length},r.prototype.isEmptyString=function(t){return t&&"string"==typeof t&&0===t.trim().length},r.prototype.isString=function(t){return t&&"string"==typeof t},r.prototype.isFunction=function(t){return t&&"[object Function]"==={}.toString.call(t)},r.prototype.isBoolean=function(t){return"boolean"==typeof t},r.prototype.compare=function(t,e,s){return t===e?0:s?e<t?-1:1:e<t?1:-1},s.types=r},{}],9:[function(t,e,s){function r(){}var n=window._;r.prototype.createPanelGroup=function(t){t=n.merge({id:zzb.uuid.newV4(),classPanelGroup:"",innerHtml:""},t);return zzb.strings.format('<div id="panelGroup_{id}" class="panel-group {classPanelGroup}">{innerHtml}</div>',t)},r.prototype.createPanelBody=function(t){t=n.merge({id:zzb.uuid.newV4(),classPanelBody:"",innerHtml:""},t);return zzb.strings.format('<div id="panelBody_{id}" class="panel-body {classPanelBody}">{innerHtml}</div>',t)},r.prototype.createPanel=function(t){t=n.merge({id:zzb.uuid.newV4(),className:"",attributesExtra:"",classPanelHeading:"",name:"",classPanelBody:"",innerHtml:""},t);var e='<div id="panel_{id}" class="panel panel-default {className}" {attributesExtra}><div class="panel-heading {classPanelHeading}>">{name}</div><div id="panelBody_{id}" class="panel-body {classPanelBody}">'+this.createPanelBody(t)+"</div></div>";return zzb.strings.format(e,t)},r.prototype.createPanelCollapsible=function(t){(t=n.merge({id:zzb.uuid.newV4(),className:"",attributesExtra:"",name:"",classPanelBody:"",innerHtml:"",isPanelCollapsed:!1,classNamePanelCollapsed:"",titleHtmlExtra:"",titleHtmlExtraRight:""},t)).isPanelCollapsed?(t._panelCollapsedClass1="collapsed",t._panelCollapsedClass2=""):(t._panelCollapsedClass1="",t._panelCollapsedClass2="in");var e='<div id="panel_{id}" class="panel panel-default {className}" {attributesExtra}><div class="panel-heading"><h4 class="panel-title">{titleHtmlExtra}<a data-toggle="collapse" data-target="#panelCollapse_{id}" href="#panelCollapse_{id}" class="{_panelCollapsedClass1}{classNamePanelCollapsed}">{name}</a> {titleHtmlExtraRight}</h4></div><div id="panelCollapse_{id}" class="panel-collapse collapse {_panelCollapsedClass2}">'+this.createPanelBody(t)+"</div></div>";return zzb.strings.format(e,t)},r.prototype.createPanelCollapsibleBegin=function(t){(t=n.merge({id:zzb.uuid.newV4(),className:"",attributesExtra:"",name:"",classPanelBody:"",innerHtml:"",isPanelCollapsed:!1,classNamePanelCollapsed:"",titleHtmlExtra:"",titleHtmlExtraRight:""},t)).isPanelCollapsed?(t._panelCollapsedClass1="collapsed",t._panelCollapsedClass2=""):(t._panelCollapsedClass1="",t._panelCollapsedClass2="in");return zzb.strings.format('<div class="panel panel-default {className}" id="panel_{id}" {attributesExtra}><div class="panel-heading"><h4 class="panel-title">{titleHtmlExtra}<a data-toggle="collapse" data-target="#panelCollapse_{id}" href="#panelCollapse_{id}" class="{_panelCollapsedClass1}{classNamePanelCollapsed}">{name}</a> {titleHtmlExtraRight}</h4></div><div id="panelCollapse_{id}" class="panel-collapse collapse {_panelCollapsedClass2}"><div class="panel-body" id="panelBody_{id}">',t)},r.prototype.createPanelCollapsibleEnd=function(){return"</div></div></div>"},s.uib=r},{}],10:[function(t,e,s){function r(){}var n=window._;r.prototype.newV4=function(){var s=n.now();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=(s+n.random(16))%16|0;return s=Math.floor(s/16),("x"===t?e:3&e|8).toString(16)})},r.prototype.isV4=function(t){return/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(t)},r.prototype.isValid=function(t){return/^([a-f\d]{8}(-[a-f\d]{4}){3}-[a-f\d]{12}?)$/i.test(t)},s.uuid=r},{}],11:[function(t,e,s){var i=window._;function n(t,e,s,r){return new o(t,e,s,r)}function o(t,e,s,r){this.parent=t,this.data=e,this.pkField=s,this.parentField=r,this.nodeConstructor=n,this.nodeItemConstructor=n,this.isDirty=!1,this.data[s]||(this.data[s]=null),this.data[r]||(this.data[r]=null),this.parent?this.parent.getId()!==this.data[r]&&(this.data[r]=this.parent.getId(),this.isDirty=!0):this.parent=null,this.children=[],this.getData=function(){return this.data},this.getId=function(){return this.data[s]},this.getParent=function(){return this.parent},this.getRoot=function(){return null===this.parent?this:this.parent.getRoot()},this.removeChild=function(e){if(0<this.children.length){var t=i.findIndex(this.children,function(t){return t.getId()===e});-1<t&&this.children.splice(t,1)}},this.addChild=function(e,t,s){var r=this,n=i.find(this.children,function(t){return t.getId()===e[r.pkField]});return n||(n=this.nodeConstructor(this,e,t||this.pkField,s||this.parentField),this.children.push(n)),n},this.findChild=function(e,s){var r=null;return this.getId()===e?r=this:(s&&0<this.items.length&&i.each(this.items,function(t){if(t.getId()===e)return r=t,!1}),!r&&0<this.children.length&&i.each(this.children,function(t){if(r=t.findChild(e,s))return!1})),r},this.items=[],this.itemOwner=null,this.getItemOwner=function(){return this.itemOwner},this.addItem=function(e,t,s){var r=this,n=i.find(this.items,function(t){return t.getId()===e[r.pkField]});return n||((n=this.nodeItemConstructor(null,e,t,s)).itemOwner=this).items.push(n),n},this.removeItem=function(e){if(0<this.items.length){var t=i.findIndex(this.items,function(t){return t.getId()===e});-1<t&&this.items.splice(t,1)}},this.findItem=function(e){var s=null;return 0<this.items.length&&i.each(this.items,function(t){if(t.getId()===e)return s=t,!1}),!s&&0<this.children.length&&i.each(this.children,function(t){if(s=t.findItem(e))return!1}),s},this.sortChildren=function(e,t){e&&0<this.children.length&&(this.children.sort(e),t||i.each(this.children,function(t){t.sortChildren(e)}))},this.sortItems=function(t,e,s){t&&0<this.items.length&&(this.items.sort(t),e&&i.each(this.items,function(t){s||t.sortChildren(e,s)}))},this.getLevelDeep=function(){var t=0;return this.parent&&(t=1,t+=this.parent.getLevelDeep()),t},this.branchCallFunction=function(t,e,s){e||t&&t(this),this.parent&&this.parent.branchCallfunction(t,e,s),s&&this.itemOwner&&this.itemOwner.branchCallfunction(t,e,s),e&&t&&t(this)},this.branchCallFunctionChildren=function(e,s){e&&e(this),0<this.children.length&&i.each(this.children,function(t){t.branchCallFunctionChildren(e,s)}),s&&0<this.items.length&&i.each(this.items,function(t){t.branchCallFunctionChildren(e,s)})}}e.exports.zzNode=o},{}],12:[function(c,s,t){if("undefined"==typeof jQuery)throw new Error("zazzy-browser's JavaScript requires jQuery. jQuery must be included before zazzy-browser's JavaScript.");if("undefined"==typeof _)throw new Error("zazzy-browser's JavaScript requires lodash. lodash must be included before zazzy-browser's JavaScript.");!function(t,e){if("undefined"!=typeof window)window.zzb=e();else if(void 0!==t)t.zzb=e();else if("function"==typeof define&&define.amd)define(e);else{if("object"!=typeof s||!s.exports)throw new Error("could not locate global cache object in which to create zzb");s.exports=e()}}(this,function(){"use strict";var t=c("./zzNode.js"),e=c("./types.js").types,s=c("./uuid.js").uuid,r=c("./strings.js").strings,n=c("./uib.js").uib,i=c("./forms.js").forms,o=c("./dialogs.js").dialogs,a=c("./perms.js").perms,l=c("./rob.js").rob,d=c("./ajax.js").ajax,u=c("./status.js").status;function p(){}return p.prototype.zzNode=t,p.prototype.types=new e,p.prototype.uuid=new s,p.prototype.strings=new r,p.prototype.uib=new n,p.prototype.forms=new i,p.prototype.dialogs=new o,p.prototype.perms=new a,p.prototype.rob=new l,p.prototype.ajax=new d,p.prototype.status=new u,new p})},{"./ajax.js":1,"./dialogs.js":2,"./forms.js":3,"./perms.js":4,"./rob.js":5,"./status.js":6,"./strings.js":7,"./types.js":8,"./uib.js":9,"./uuid.js":10,"./zzNode.js":11}]},{},[12]); |
{ | ||
"name": "zazzy-browser", | ||
"version": "1.3.11", | ||
"version": "1.3.13", | ||
"description": "A collection of general-purpose browser utilities used as higher-level building-blocks to create Bootstrap v4 websites and assist in client-server communications.", | ||
@@ -5,0 +5,0 @@ "engines": { |
@@ -108,3 +108,3 @@ // client only | ||
zzb.dialogs.showMessage({ | ||
className: 'zzb-dialog-flash-message ' + zzb.format.strings('zzb-dialog-flash-status-', rob.hasErrors() ? 'error' : 'okay'), | ||
className: 'zzb-dialog-flash-message ' + zzb.strings.format('zzb-dialog-flash-status-{0}', rob.hasErrors() ? 'error' : 'okay'), | ||
dataBackdrop: 'static', | ||
@@ -111,0 +111,0 @@ body: data.message, |
@@ -333,3 +333,7 @@ // client only | ||
// Does not require the type, but output is a hierarchy with parent-child relationships | ||
var data = options.$form.serializeToJSON() | ||
var data = options.$form.serializeToJSON({ | ||
parseFloat: { | ||
condition: '.zzb-number,.zzb-money' | ||
} | ||
}) | ||
// using https://github.com/rc1021/serialize-json | ||
@@ -336,0 +340,0 @@ // Does not require the type, but output is a hierarchy with parent-child relationships - doesn't convert string to bool by default |
Sorry, the diff of this file is too big to display
272135
5634