!function(t,e){"use strict";t.rails!==e&&t.error("jquery-ujs has already been loaded!");var i,n=t(document);t.rails=i={linkClickSelector:"a[data-confirm], a[data-method], a[data-remote]:not([disabled]), a[data-disable-with], a[data-disable]",buttonClickSelector:"button[data-remote]:not([form]):not(form button), button[data-confirm]:not([form]):not(form button)",inputChangeSelector:"select[data-remote], input[data-remote], textarea[data-remote]",formSubmitSelector:"form",formInputClickSelector:"form input[type=submit], form input[type=image], form button[type=submit], form button:not([type]), input[type=submit][form], input[type=image][form], button[type=submit][form], button[form]:not([type])",disableSelector:"input[data-disable-with]:enabled, button[data-disable-with]:enabled, textarea[data-disable-with]:enabled, input[data-disable]:enabled, button[data-disable]:enabled, textarea[data-disable]:enabled",enableSelector:"input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled, input[data-disable]:disabled, button[data-disable]:disabled, textarea[data-disable]:disabled",requiredInputSelector:"input[name][required]:not([disabled]), textarea[name][required]:not([disabled])",fileInputSelector:"input[type=file]:not([disabled])",linkDisableSelector:"a[data-disable-with], a[data-disable]",buttonDisableSelector:"button[data-remote][data-disable-with], button[data-remote][data-disable]",csrfToken:function(){return t("meta[name=csrf-token]").attr("content")},csrfParam:function(){return t("meta[name=csrf-param]").attr("content")},CSRFProtection:function(t){var e=i.csrfToken();e&&t.setRequestHeader("X-CSRF-Token",e)},refreshCSRFTokens:function(){t('form input[name="'+i.csrfParam()+'"]').val(i.csrfToken())},fire:function(e,i,n){var r=t.Event(i);return e.trigger(r,n),r.result!==!1},confirm:function(t){return confirm(t)},ajax:function(e){return t.ajax(e)},href:function(t){return t[0].href},isRemote:function(t){return t.data("remote")!==e&&t.data("remote")!==!1},handleRemote:function(n){var r,o,s,a,c,l;if(i.fire(n,"ajax:before")){if(a=n.data("with-credentials")||null,c=n.data("type")||t.ajaxSettings&&t.ajaxSettings.dataType,n.is("form")){r=n.data("ujs:submit-button-formmethod")||n.attr("method"),o=n.data("ujs:submit-button-formaction")||n.attr("action"),s=t(n[0]).serializeArray();var u=n.data("ujs:submit-button");u&&(s.push(u),n.data("ujs:submit-button",null)),n.data("ujs:submit-button-formmethod",null),n.data("ujs:submit-button-formaction",null)}else n.is(i.inputChangeSelector)?(r=n.data("method"),o=n.data("url"),s=n.serialize(),n.data("params")&&(s=s+"&"+n.data("params"))):n.is(i.buttonClickSelector)?(r=n.data("method")||"get",o=n.data("url"),s=n.serialize(),n.data("params")&&(s=s+"&"+n.data("params"))):(r=n.data("method"),o=i.href(n),s=n.data("params")||null);return l={type:r||"GET",data:s,dataType:c,beforeSend:function(t,r){return r.dataType===e&&t.setRequestHeader("accept","*/*;q=0.5, "+r.accepts.script),!!i.fire(n,"ajax:beforeSend",[t,r])&&void n.trigger("ajax:send",t)},success:function(t,e,i){n.trigger("ajax:success",[t,e,i])},complete:function(t,e){n.trigger("ajax:complete",[t,e])},error:function(t,e,i){n.trigger("ajax:error",[t,e,i])},crossDomain:i.isCrossDomain(o)},a&&(l.xhrFields={withCredentials:a}),o&&(l.url=o),i.ajax(l)}return!1},isCrossDomain:function(t){var e=document.createElement("a");e.href=location.href;var i=document.createElement("a");try{return i.href=t,i.href=i.href,!((!i.protocol||":"===i.protocol)&&!i.host||e.protocol+"//"+e.host==i.protocol+"//"+i.host)}catch(t){return!0}},handleMethod:function(n){var r=i.href(n),o=n.data("method"),s=n.attr("target"),a=i.csrfToken(),c=i.csrfParam(),l=t('
'),u='';c===e||a===e||i.isCrossDomain(r)||(u+=''),s&&l.attr("target",s),l.hide().append(u).appendTo("body"),l.submit()},formElements:function(e,i){return e.is("form")?t(e[0].elements).filter(i):e.find(i)},disableFormElements:function(e){i.formElements(e,i.disableSelector).each(function(){i.disableFormElement(t(this))})},disableFormElement:function(t){var i,n;i=t.is("button")?"html":"val",n=t.data("disable-with"),n!==e&&(t.data("ujs:enable-with",t[i]()),t[i](n)),t.prop("disabled",!0),t.data("ujs:disabled",!0)},enableFormElements:function(e){i.formElements(e,i.enableSelector).each(function(){i.enableFormElement(t(this))})},enableFormElement:function(t){var i=t.is("button")?"html":"val";t.data("ujs:enable-with")!==e&&(t[i](t.data("ujs:enable-with")),t.removeData("ujs:enable-with")),t.prop("disabled",!1),t.removeData("ujs:disabled")},allowAction:function(t){var e,n=t.data("confirm"),r=!1;if(!n)return!0;if(i.fire(t,"confirm")){try{r=i.confirm(n)}catch(t){(console.error||console.log).call(console,t.stack||t)}e=i.fire(t,"confirm:complete",[r])}return r&&e},blankInputs:function(e,i,n){var r,o,s,a,c=t(),l=i||"input,textarea",u=e.find(l),d={};return u.each(function(){r=t(this),r.is("input[type=radio]")?(a=r.attr("name"),d[a]||(0===e.find('input[type=radio]:checked[name="'+a+'"]').length&&(s=e.find('input[type=radio][name="'+a+'"]'),c=c.add(s)),d[a]=a)):(o=r.is("input[type=checkbox],input[type=radio]")?r.is(":checked"):!!r.val(),o===n&&(c=c.add(r)))}),!!c.length&&c},nonBlankInputs:function(t,e){return i.blankInputs(t,e,!0)},stopEverything:function(e){return t(e.target).trigger("ujs:everythingStopped"),e.stopImmediatePropagation(),!1},disableElement:function(t){var n=t.data("disable-with");n!==e&&(t.data("ujs:enable-with",t.html()),t.html(n)),t.bind("click.railsDisable",function(t){return i.stopEverything(t)}),t.data("ujs:disabled",!0)},enableElement:function(t){t.data("ujs:enable-with")!==e&&(t.html(t.data("ujs:enable-with")),t.removeData("ujs:enable-with")),t.unbind("click.railsDisable"),t.removeData("ujs:disabled")}},i.fire(n,"rails:attachBindings")&&(t.ajaxPrefilter(function(t,e,n){t.crossDomain||i.CSRFProtection(n)}),t(window).on("pageshow.rails",function(){t(t.rails.enableSelector).each(function(){var e=t(this);e.data("ujs:disabled")&&t.rails.enableFormElement(e)}),t(t.rails.linkDisableSelector).each(function(){var e=t(this);e.data("ujs:disabled")&&t.rails.enableElement(e)})}),n.delegate(i.linkDisableSelector,"ajax:complete",function(){i.enableElement(t(this))}),n.delegate(i.buttonDisableSelector,"ajax:complete",function(){i.enableFormElement(t(this))}),n.delegate(i.linkClickSelector,"click.rails",function(e){var n=t(this),r=n.data("method"),o=n.data("params"),s=e.metaKey||e.ctrlKey;if(!i.allowAction(n))return i.stopEverything(e);if(!s&&n.is(i.linkDisableSelector)&&i.disableElement(n),i.isRemote(n)){if(s&&(!r||"GET"===r)&&!o)return!0;var a=i.handleRemote(n);return a===!1?i.enableElement(n):a.fail(function(){i.enableElement(n)}),!1}return r?(i.handleMethod(n),!1):void 0}),n.delegate(i.buttonClickSelector,"click.rails",function(e){var n=t(this);if(!i.allowAction(n)||!i.isRemote(n))return i.stopEverything(e);n.is(i.buttonDisableSelector)&&i.disableFormElement(n);var r=i.handleRemote(n);return r===!1?i.enableFormElement(n):r.fail(function(){i.enableFormElement(n)}),!1}),n.delegate(i.inputChangeSelector,"change.rails",function(e){var n=t(this);return i.allowAction(n)&&i.isRemote(n)?(i.handleRemote(n),!1):i.stopEverything(e)}),n.delegate(i.formSubmitSelector,"submit.rails",function(n){var r,o,s=t(this),a=i.isRemote(s);if(!i.allowAction(s))return i.stopEverything(n);if(s.attr("novalidate")===e)if(s.data("ujs:formnovalidate-button")===e){if(r=i.blankInputs(s,i.requiredInputSelector,!1),r&&i.fire(s,"ajax:aborted:required",[r]))return i.stopEverything(n)}else s.data("ujs:formnovalidate-button",e);if(a){if(o=i.nonBlankInputs(s,i.fileInputSelector)){setTimeout(function(){i.disableFormElements(s)},13);var c=i.fire(s,"ajax:aborted:file",[o]);return c||setTimeout(function(){i.enableFormElements(s)},13),c}return i.handleRemote(s),!1}setTimeout(function(){i.disableFormElements(s)},13)}),n.delegate(i.formInputClickSelector,"click.rails",function(e){var n=t(this);if(!i.allowAction(n))return i.stopEverything(e);var r=n.attr("name"),o=r?{name:r,value:n.val()}:null,s=n.closest("form");0===s.length&&(s=t("#"+n.attr("form"))),s.data("ujs:submit-button",o),s.data("ujs:formnovalidate-button",n.attr("formnovalidate")),s.data("ujs:submit-button-formaction",n.attr("formaction")),s.data("ujs:submit-button-formmethod",n.attr("formmethod"))}),n.delegate(i.formSubmitSelector,"ajax:send.rails",function(e){this===e.target&&i.disableFormElements(t(this))}),n.delegate(i.formSubmitSelector,"ajax:complete.rails",function(e){this===e.target&&i.enableFormElements(t(this))}),t(function(){i.refreshCSRFTokens()}))}(jQuery),+function(t){"use strict";var e=function(e,i){this.options=i,this.$element=t(e),this.$backdrop=this.isShown=null,this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,t.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};e.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},e.prototype.toggle=function(t){return this[this.isShown?"hide":"show"](t)},e.prototype.show=function(e){var i=this,n=t.Event("show.bs.modal",{relatedTarget:e});this.$element.trigger(n),this.isShown||n.isDefaultPrevented()||(this.isShown=!0,this.escape(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',t.proxy(this.hide,this)),this.backdrop(function(){var n=t.support.transition&&i.$element.hasClass("fade");i.$element.parent().length||i.$element.appendTo(document.body),i.$element.show().scrollTop(0),n&&i.$element[0].offsetWidth,i.$element.addClass("in").attr("aria-hidden",!1),i.enforceFocus();var r=t.Event("shown.bs.modal",{relatedTarget:e});n?i.$element.find(".modal-dialog").one(t.support.transition.end,function(){i.$element.focus().trigger(r)}).emulateTransitionEnd(300):i.$element.focus().trigger(r)}))},e.prototype.hide=function(e){e&&e.preventDefault(),e=t.Event("hide.bs.modal"),this.$element.trigger(e),this.isShown&&!e.isDefaultPrevented()&&(this.isShown=!1,this.escape(),t(document).off("focusin.bs.modal"),this.$element.removeClass("in").attr("aria-hidden",!0).off("click.dismiss.bs.modal"),t.support.transition&&this.$element.hasClass("fade")?this.$element.one(t.support.transition.end,t.proxy(this.hideModal,this)).emulateTransitionEnd(300):this.hideModal())},e.prototype.enforceFocus=function(){t(document).off("focusin.bs.modal").on("focusin.bs.modal",t.proxy(function(t){this.$element[0]===t.target||this.$element.has(t.target).length||this.$element.focus()},this))},e.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.bs.modal",t.proxy(function(t){27==t.which&&this.hide()},this)):this.isShown||this.$element.off("keyup.dismiss.bs.modal")},e.prototype.hideModal=function(){var t=this;this.$element.hide(),this.backdrop(function(){t.removeBackdrop(),t.$element.trigger("hidden.bs.modal")})},e.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},e.prototype.backdrop=function(e){var i=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var n=t.support.transition&&i;if(this.$backdrop=t('').appendTo(document.body),this.$element.on("click.dismiss.bs.modal",t.proxy(function(t){t.target===t.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus.call(this.$element[0]):this.hide.call(this))},this)),n&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!e)return;n?this.$backdrop.one(t.support.transition.end,e).emulateTransitionEnd(150):e()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),t.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(t.support.transition.end,e).emulateTransitionEnd(150):e()):e&&e()};var i=t.fn.modal;t.fn.modal=function(i,n){return this.each(function(){var r=t(this),o=r.data("bs.modal"),s=t.extend({},e.DEFAULTS,r.data(),"object"==typeof i&&i);o||r.data("bs.modal",o=new e(this,s)),"string"==typeof i?o[i](n):s.show&&o.show(n)})},t.fn.modal.Constructor=e,t.fn.modal.noConflict=function(){return t.fn.modal=i,this},t(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(e){var i=t(this),n=i.attr("href"),r=t(i.attr("data-target")||n&&n.replace(/.*(?=#[^\s]+$)/,"")),o=r.data("bs.modal")?"toggle":t.extend({remote:!/#/.test(n)&&n},r.data(),i.data());i.is("a")&&e.preventDefault(),r.modal(o,this).one("hide",function(){i.is(":visible")&&i.focus()})}),t(document).on("show.bs.modal",".modal",function(){t(document.body).addClass("modal-open")}).on("hidden.bs.modal",".modal",function(){t(document.body).removeClass("modal-open")})}(jQuery),+function(t){"use strict";var e=function(t,e){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null,this.init("tooltip",t,e)};e.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'',trigger:"hover focus",title:"",delay:0,html:!1,container:!1},e.prototype.init=function(e,i,n){this.enabled=!0,this.type=e,this.$element=t(i),this.options=this.getOptions(n);for(var r=this.options.trigger.split(" "),o=r.length;o--;){var s=r[o];if("click"==s)this.$element.on("click."+this.type,this.options.selector,t.proxy(this.toggle,this));else if("manual"!=s){var a="hover"==s?"mouseenter":"focusin",c="hover"==s?"mouseleave":"focusout";this.$element.on(a+"."+this.type,this.options.selector,t.proxy(this.enter,this)),this.$element.on(c+"."+this.type,this.options.selector,t.proxy(this.leave,this))}}this.options.selector?this._options=t.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},e.prototype.getDefaults=function(){return e.DEFAULTS},e.prototype.getOptions=function(e){return e=t.extend({},this.getDefaults(),this.$element.data(),e),e.delay&&"number"==typeof e.delay&&(e.delay={show:e.delay,hide:e.delay}),e},e.prototype.getDelegateOptions=function(){var e={},i=this.getDefaults();return this._options&&t.each(this._options,function(t,n){i[t]!=n&&(e[t]=n)}),e},e.prototype.enter=function(e){var i=e instanceof this.constructor?e:t(e.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);return clearTimeout(i.timeout),i.hoverState="in",i.options.delay&&i.options.delay.show?void(i.timeout=setTimeout(function(){"in"==i.hoverState&&i.show()},i.options.delay.show)):i.show()},e.prototype.leave=function(e){var i=e instanceof this.constructor?e:t(e.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);return clearTimeout(i.timeout),i.hoverState="out",i.options.delay&&i.options.delay.hide?void(i.timeout=setTimeout(function(){"out"==i.hoverState&&i.hide()},i.options.delay.hide)):i.hide()},e.prototype.show=function(){var e=t.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){if(this.$element.trigger(e),e.isDefaultPrevented())return;var i=this,n=this.tip();this.setContent(),this.options.animation&&n.addClass("fade");var r="function"==typeof this.options.placement?this.options.placement.call(this,n[0],this.$element[0]):this.options.placement,o=/\s?auto?\s?/i,s=o.test(r);s&&(r=r.replace(o,"")||"top"),n.detach().css({top:0,left:0,display:"block"}).addClass(r),this.options.container?n.appendTo(this.options.container):n.insertAfter(this.$element);var a=this.getPosition(),c=n[0].offsetWidth,l=n[0].offsetHeight;if(s){var u=this.$element.parent(),d=r,h=document.documentElement.scrollTop||document.body.scrollTop,p="body"==this.options.container?window.innerWidth:u.outerWidth(),f="body"==this.options.container?window.innerHeight:u.outerHeight(),g="body"==this.options.container?0:u.offset().left;r="bottom"==r&&a.top+a.height+l-h>f?"top":"top"==r&&a.top-h-l<0?"bottom":"right"==r&&a.right+c>p?"left":"left"==r&&a.left-c0)||o.isTime(e)&&e.attr("title")||e.attr("title",i)}return e.data("timeago")}function n(t,e){return o.inWords(r(t),e)}function r(t){return(new Date).getTime()-t.getTime()}t.timeago=function(e){return n(e instanceof Date?e:"string"==typeof e?t.timeago.parse(e):"number"==typeof e?new Date(e):t.timeago.datetime(e))};var o=t.timeago;t.extend(t.timeago,{settings:{refreshMillis:6e4,allowPast:!0,allowFuture:!1,localeTitle:!1,cutoff:0,autoDispose:!0,lang:"en",strings:{en:{prefixAgo:null,prefixFromNow:null,suffixAgo:"ago",suffixFromNow:"from now",inPast:"any moment now",seconds:"less than a minute",minute:"about a minute",minutes:"%d minutes",hour:"about an hour",hours:"about %d hours",day:"a day",days:"%d days",month:"about a month",months:"%d months",year:"about a year",years:"%d years",wordSeparator:" ",numbers:[]}}},inWords:function(e,i){function n(i,n){var o=t.isFunction(i)?i(n,e):i,s=r.numbers&&r.numbers[n]||n;return o.replace(/%d/i,s)}if(!this.settings.allowPast&&!this.settings.allowFuture)throw"timeago allowPast and allowFuture settings can not both be set to false.";var r=this.settings.strings[i]||this.settings.strings[this.settings.lang]||this.settings.strings.en,o=r.prefixAgo,s=r.suffixAgo;if(this.settings.allowFuture&&e<0&&(o=r.prefixFromNow,s=r.suffixFromNow),!this.settings.allowPast&&e>=0)return r.inPast;var a=Math.abs(e)/1e3,c=a/60,l=c/60,u=l/24,d=u/365,h=a<45&&n(r.seconds,Math.round(a))||a<90&&n(r.minute,1)||c<45&&n(r.minutes,Math.round(c))||c<90&&n(r.hour,1)||l<24&&n(r.hours,Math.round(l))||l<42&&n(r.day,1)||u<30&&n(r.days,Math.round(u))||u<45&&n(r.month,1)||u<365&&n(r.months,Math.round(u/30))||d<1.5&&n(r.year,1)||n(r.years,Math.round(d)),p=r.wordSeparator||"";return void 0===r.wordSeparator&&(p=" "),t.trim([o,h,s].join(p))},parse:function(e){var i=t.trim(e);return i=i.replace(/\.\d+/,""),i=i.replace(/-/,"/").replace(/-/,"/"),i=i.replace(/T/," ").replace(/Z/," UTC"),i=i.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"),i=i.replace(/([\+\-]\d\d)$/," $100"),new Date(i)},datetime:function(e){var i=o.isTime(e)?t(e).attr("datetime"):t(e).attr("title");return o.parse(i)},isTime:function(e){return"time"===t(e).get(0).tagName.toLowerCase()}});var s={init:function(){var i=t.proxy(e,this);i();var n=o.settings;n.refreshMillis>0&&(this._timeagoInterval=setInterval(i,n.refreshMillis))},update:function(i){var n=i instanceof Date?i:o.parse(i);t(this).data("timeago",{datetime:n}),o.settings.localeTitle&&t(this).attr("title",n.toLocaleString()),e.apply(this)},updateFromDOM:function(){t(this).data("timeago",{datetime:o.parse(o.isTime(this)?t(this).attr("datetime"):t(this).attr("title"))}),e.apply(this)},dispose:function(){this._timeagoInterval&&(window.clearInterval(this._timeagoInterval),this._timeagoInterval=null)}};t.fn.timeago=function(t,e){var i=t?s[t]:s.init;if(!i)throw new Error("Unknown function name '"+t+"' for timeago");return this.each(function(){i.call(this,e)}),this},document.createElement("abbr"),document.createElement("time")}),function(t){t(document).on("ready turbolinks:load page:load ajax:success",function(){t("time[data-time-ago]").timeago()})}(jQuery),function(){var t,e,i,n,r,o,s,a,c,l,u=[].slice,d=[].indexOf||function(t){for(var e=0,i=this.length;e=0;a=M<=0?++y:--y)v=m[a],v.obj===e&&(n&&v.callback!==n||(o&&o!==v.ev?o&&(s=v.ev.split(" "),d.call(s,o)>=0&&(s=function(){var t,e,i;for(i=[],e=0,t=s.length;e1?this.cloneArray(this.records.slice(0,t)):null!=(e=this.records[0])?e.clone():void 0},n.last=function(t){var e;return"number"==typeof t?this.cloneArray(this.records.slice(-t)):null!=(e=this.records[this.records.length-1])?e.clone():void 0},n.count=function(){return this.records.length},n.deleteAll=function(){return this.records=[],this.irecords={}},n.destroyAll=function(t){var e,i,n,r,o;for(r=this.records,o=[],e=0,i=r.length;e=0&&delete this[t]);return this}},n.prototype.updateAttribute=function(t,e,i){var n;return n={},n[t]=e,this.updateAttributes(n,i)},n.prototype.updateAttributes=function(t,e){return this.load(t),this.save(e)},n.prototype.changeID=function(t){var e;if(t!==this.id)return e=this.constructor.irecords,e[t]=e[this.id],this.cid!==this.id&&delete e[this.id],this.id=t,this.save()},n.prototype.remove=function(t){var e,i,n,r,o;for(null==t&&(t={}),o=this.constructor.records.slice(0),e=i=0,n=o.length;i"},n.prototype.fromForm=function(e){var i,n,r,o,s,a,c,l,u,d,h,p,f,g;for(g={},h=t(e).find("[type=checkbox]:not([value])"),n=0,a=h.length;n-1&&this.queue().splice(i,1),o.rejectWith(h.context||h,[l,e,""]),l)},this.queue(u),l):l},i.prototype.ajaxSettings=function(e,i){return t.extend({},this.defaults,i,e)},i}(),n=function(t){function i(t){this.model=t,this.failResponse=h(this.failResponse,this),this.recordsResponse=h(this.recordsResponse,this)}return p(i,t),i.prototype.find=function(t,i,n){var r;return null==n&&(n={}),r=new this.model({id:t}),this.ajaxQueue(i,{type:n.method||e.config.loadMethod,url:n.url||e.getURL(r),parallel:n.parallel}).done(this.recordsResponse(n)).fail(this.failResponse(n))},i.prototype.all=function(t,i){return null==i&&(i={}),this.ajaxQueue(t,{type:i.method||e.config.loadMethod,url:i.url||e.getURL(this.model),parallel:i.parallel}).done(this.recordsResponse(i)).fail(this.failResponse(i))},i.prototype.fetch=function(t,e){var i;return null==t&&(t={}),null==e&&(e={}),(i=t.id)?(delete t.id,this.find(i,t,e).done(function(t){return function(i){return t.model.refresh(i,e)}}(this))):this.all(t,e).done(function(t){return function(i){return t.model.refresh(i,e)}}(this))},i.prototype.recordsResponse=function(t){return function(e){return function(i,n,r,o){var s;return e.model.trigger("ajaxSuccess",null,n,r,o),null!=(s=t.done)?s.call(e.model,o):void 0}}(this)},i.prototype.failResponse=function(t){return function(e){return function(i,n,r,o){var s;return e.model.trigger("ajaxError",null,i,n,r,o),null!=(s=t.fail)?s.call(e.model,o):void 0}}(this)},i}(i),l=function(t){function i(t){this.record=t,this.failResponse=h(this.failResponse,this),this.recordResponse=h(this.recordResponse,this),this.model=this.record.constructor}return p(i,t),i.prototype.reload=function(t,i){return null==i&&(i={}),this.ajaxQueue(t,{type:i.method||e.config.loadMethod,url:i.url,parallel:i.parallel},this.record).done(this.recordResponse(i)).fail(this.failResponse(i))},i.prototype.create=function(t,i){return null==i&&(i={}),this.ajaxQueue(t,{type:i.method||e.config.createMethod,contentType:"application/json",data:this.record.toJSON(),url:i.url||e.getCollectionURL(this.record),parallel:i.parallel}).done(this.recordResponse(i)).fail(this.failResponse(i))},i.prototype.update=function(t,i){return null==i&&(i={}),this.ajaxQueue(t,{type:i.method||e.config.updateMethod,contentType:"application/json",data:this.record.toJSON(),url:i.url,parallel:i.parallel},this.record).done(this.recordResponse(i)).fail(this.failResponse(i))},i.prototype.destroy=function(t,i){return null==i&&(i={}),this.ajaxQueue(t,{type:i.method||e.config.destroyMethod,url:i.url,parallel:i.parallel},this.record).done(this.recordResponse(i)).fail(this.failResponse(i))},i.prototype.recordResponse=function(t){return function(e){return function(i,n,r,o){var s;return null!=i&&Object.getOwnPropertyNames(i).length&&!e.record.destroyed&&e.record.refresh(i,{ajax:!1}),e.record.trigger("ajaxSuccess",e.record,e.model.fromJSON(i),n,r,o),null!=(s=t.done)?s.call(e.record,o):void 0}}(this)},i.prototype.failResponse=function(t){return function(e){return function(i,n,r,o){var s;switch(o.type){case"POST":e.createFailed();break;case"DELETE":e.destroyFailed()}return e.record.trigger("ajaxError",e.record,i,n,r,o),null!=(s=t.fail)?s.call(e.record,o):void 0}}(this)},i.prototype.createFailed=function(){return this.record.remove({clear:!0})},i.prototype.destroyFailed=function(){return this.record.destroyed=!1,this.record.constructor.refresh(this.record)},i}(i),a.host="",o={include:function(){var t;return t=1<=arguments.length?d.call(arguments,0):[],t.unshift(encodeURIComponent(this.id)),e.generateURL.apply(e,[this].concat(d.call(t)))},extend:function(){var t;return t=1<=arguments.length?d.call(arguments,0):[],e.generateURL.apply(e,[this].concat(d.call(t)))}},s={ajax:function(){return new l(this)},generateURL:o.include,url:o.include},r={ajax:function(){return new n(this)},generateURL:o.extend,url:o.extend},a.Ajax={extended:function(){return this.fetch(this.ajaxFetch),this.change(this.ajaxChange),this.extend(r),this.include(s)},ajaxFetch:function(){var t;return(t=this.ajax()).fetch.apply(t,arguments)},ajaxChange:function(t,e,i){var n;if(null==i&&(i={}),i.ajax!==!1)return"function"==typeof(n=t.ajax())[e]?n[e](i.ajax,i):void 0}},a.Ajax.Methods={extended:function(){return this.extend(r),this.include(s)}},e.defaults=i.prototype.defaults,e.Base=i,e.Singleton=l,e.Collection=n,u.Ajax=e,"undefined"!=typeof module&&null!==module&&(module.exports=e)}.call(this),function(){var t,e;window.MB=window.MB||{},window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame,MB.serverCountry="CN",jQuery.timeago&&(jQuery.timeago.settings.lang=MBLocale),MB.v={},MB.l={},MB.f={mp:{},ga:{},inSharing:/^\/app/.test(window.location.pathname),isDuplicateDemo:!1,isSpaceDown:!1},MB.config={showRuler:!0,showGeneral:!0,screenBg:"#FFFFFF",assetWidth:158,assetHeight:94,SCALES:[50,75,100,150,200],ignoreError:/(Network error|Uncaught InvalidStateError|Uncaught #|Blocked a frame|NPObject)/,rulerWidth:16,lnMinWidth:244,initialScrollTop:722},MB.maxTimestamp=1,MB.checkFA=function(t){var e,i;for(e=i=12;i>=1;e=--i)$("#fontawesome .ah").css("font-size",e+"px"),$("#fontawesome .ah").css("line-height","100%"),$("#fontawesome .ah").text("a").height()===e&&(MB.config.minFS=e);return 0!==$("#fontawesome i").width()?t():setTimeout(function(){return MB.checkFA(t)},10)},MB.trackPageView=function(t){return window.ga&&ga("send","pageview",{page:t})},MB.ga=function(){var t;return t=arguments[arguments.length-1],window.ga&&!this.f.ga[t]&&window.ga.apply(window,arguments),this.f.ga[t]=!0},MB.mp=function(t){return window.mixpanel&&!this.f.mp[t]&&window.mixpanel.track(t),this.f.mp[t]=!0},MB.event=function(t,e){return null==e&&(e="goal"),MB.ga("send","event",e,t),MB.mp(t)},MB.mpIdentify=function(){if(window.mixpanel&&MB.user.id)return mixpanel.identify(MB.user.id),mixpanel.people.set({$name:MB.user.name,$email:MB.user.email,$plan:MB.user.plan,$trial:MB.user.trial,$expired:MB.user.expired,$next_billing_on:MB.user.next_billing_on?new Date(MB.user.next_billing_on):null,$value:MB.user.value,$email_validated:MB.user.email_validated,$referrer:MB.user.referrer,$mobile:MB.user.mobile,$projects_count:Project.count(),$created_at:new Date(MB.user.created_at),$login_times:MB.user.login_times,$role:MB.user.role})},MB.isMac=function(){return/(Macintosh)/i.test(navigator.userAgent)},MB.isWindows=function(){return/(Windows)/i.test(navigator.userAgent)},MB.isElectron=function(){return/Electron/i.test(navigator.userAgent)},MB.isPhantom=function(){return/Phantom/i.test(navigator.userAgent)},MB.isWechat=function(){return/MicroMessenger/i.test(navigator.userAgent)},MB.isEmbedded=function(){return $("body").hasClass("embed")},MB.isLocal=function(){return!!window.MBData},MB.isChrome=function(){return/Chrome/i.test(navigator.userAgent)},MB.isFirefox=function(){return/Firefox/i.test(navigator.userAgent)},MB.isMobile=function(){return/(iPod|iPhone|iPad|Android)/.test(navigator.userAgent)},MB.isAndroid=function(){return/Android/i.test(navigator.userAgent)},MB.isiPad=function(){return/(iPad)/.test(navigator.userAgent)},MB.isIOS=function(){return/(iPod|iPhone|iPad)/.test(navigator.userAgent)},MB.isIOS9=function(){return MB.isIOS()&&window.navigator.standalone&&/(9_0|9_1|11_0)/.test(navigator.userAgent)&&($(window).height()>$(window).width()||MB.isiPad())},MB.validDevice=function(t){return $(window).width()===t.width&&$(window).height()===t.height},MB.pointInRect=function(t,e,i){return t>i.left&&ti.top&&e=MB.user.limitation.projects&&(MB.promptRenew("user_projects",{action:"upgrade",role:"user"}),i=!0)),i},MB.scale=function(){return $("body").data("scale")},MB.preference=function(){return Preference.first()},MB.readDataURL=function(t,e,i){var n,r;if(t)return r=/^image\/(png|jpg|jpeg|gif|svg|tiff|svg\+xml)$/i,r.test(t.type)?t.size>1024e3?i?i(new Error(I18N.file_too_large)):$("#file_too_large").modal():(n=new FileReader,n.onload=function(t){var i,n;return i=t.target.result,n=new Image,n.onload=function(){return e(i,n.width,n.height)},n.src=i},n.readAsDataURL(t)):i?i(new Error(I18N.unsupported)):alert(I18N.unsupported)},MB.supportedBrowser=function(){return/(Webkit|Firefox|Coding_iOS|Trident\/7.0)/i.test(navigator.userAgent)},MB.nextgid=function(t){return t?t.substr(0,21)+"-"+Math.uuid(21,16):null},MB.cloneBuiltin=function(t,e,i){var n;return n="/app/"+t+"/duplicate.json",MB.safeLoading(I18N.load_project),$.getJSON(n,function(){return function(t){var n;if(t.project.combo)n=new Combo;else{if(!t.project.template)return;n=new Template}return n.load(t.project),e&&(n.name=e,n.lsave()),Screen.refresh(t.screens),Widget.refresh(t.widgets),Link.refresh(t.links),Panel.refresh(t.panels),ScreenAlign.refresh(t.screen_aligns),$("#safemode").hide(),i(n)}}(this))},MB.triggerProgress=function(t){var e,i;return $("body").trigger("queue:save"),i=MB.autoSaver.queue.length,e=setInterval(function(){var i;if(i=MB.autoSaver.queue.length,0===i&&(clearInterval(e),"function"==typeof t))return t()},1e3)},MB.checkDupProgress=function(t,e){return setTimeout(function(){return function(){var i,n;return n="/sidekiq/critical/job/"+t+".json",i=$.getJSON(n,function(i){return"complete"===i.result?"function"==typeof e?e():window.location.reload():MB.checkDupProgress(t,e)})}}(this),2e3)},MB.unescape=function(t){var e;return e={"&":"&","<":"<",">":">"},t.replace(/(&|<|>)/g,function(t){return e[t]})},MB.strip=function(t){var e;return e=document.createElement("div"),e.innerHTML=t,e.textContent||e.innerText||""},MB.isEditing=function(t){var e;return!!t&&(e=(t.target||t.srcElement).tagName,"INPUT"===e||"SELECT"===e||"TEXTAREA"===e||MB.f.editing)},MB.hex=function(t){return("0"+parseInt(t).toString(16)).slice(-2)},MB.rgb2hex=function(t){return t&&"rgba(0, 0, 0, 0)"!==t&&"transparent"!==t?(t=t.match(/^rgb[a]*\((\d+),\s*(\d+),\s*(\d+)/),"#"+this.hex(t[1])+this.hex(t[2])+this.hex(t[3])):"transparent"},MB.hex2rgb=function(t){return t=parseInt(t.indexOf("#")>-1?t.substring(1):t,16),{r:t>>16,g:(65280&t)>>8,b:255&t}},MB.atan2=function(t,e){return Math.atan2(e,t)/Math.PI*180},MB.cos=function(t){return Math.cos(t/180*Math.PI)},MB.sin=function(t){return Math.sin(t/180*Math.PI)},MB.hypotenuse=function(t,e){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2))},MB.activePanel=function(){return $("#screens").find(".panel.selected").length},MB.canvasLeft=function(){return MB.activePanel()?document.querySelector(".panel.selected").getBoundingClientRect().left:document.querySelector("#canvas").getBoundingClientRect().left},MB.canvasTop=function(){return MB.activePanel()?document.querySelector(".panel.selected").getBoundingClientRect().top:document.querySelector("#canvas").getBoundingClientRect().top},MB.canvasWidth=function(){return $("#canvas").width()},MB.canvasHeight=function(){return $("#canvas").height()},MB.canvasWidth2=function(){return document.getElementById("canvas").getBoundingClientRect().width-2*MB.scale()/100},MB.canvasHeight2=function(){return document.getElementById("canvas").getBoundingClientRect().height-2*MB.scale()/100},MB.trigger=function(t,e){return $("body").trigger(t,e)},MB.timing=function(t,e){var i,n;return n=new Date,e(),i=new Date,console.log(t+": "+(i-n))},MB.penetrateSelect=function(t,e){var i,n,r,o,s,a,c;for(s=MB.currentScreen,a=t.clientX-MB.canvasLeft(),c=t.clientY-MB.canvasTop(),n=s.citems().sort(function(t,e){return e.z-t.z||e.timestamp-t.timestamp}),r=0,o=n.length;ri.l()&&ai.t()&&c>16)+(e>>16)+(i>>16);return n<<16|65535&i}function i(t,e){return t<>>32-e}function n(t,n,r,o,s,a){return e(i(e(e(n,t),e(o,a)),s),r)}function r(t,e,i,r,o,s,a){return n(e&i|~e&r,t,e,o,s,a)}function o(t,e,i,r,o,s,a){return n(e&r|i&~r,t,e,o,s,a)}function s(t,e,i,r,o,s,a){return n(e^i^r,t,e,o,s,a)}function a(t,e,i,r,o,s,a){return n(i^(e|~r),t,e,o,s,a)}function c(t,i){t[i>>5]|=128<>>9<<4)+14]=i;var n,c,l,u,d,h=1732584193,p=-271733879,f=-1732584194,g=271733878;for(n=0;n>5]>>>e%32&255);return i}function u(t){var e,i=[];for(i[(t.length>>2)-1]=void 0,e=0;e>5]|=(255&t.charCodeAt(e/8))<16&&(r=c(r,8*t.length)),i=0;16>i;i+=1)o[i]=909522486^r[i],s[i]=1549556828^r[i];return n=c(o.concat(u(e)),512+8*e.length),l(c(s.concat(n),640))}function p(t){var e,i,n="0123456789abcdef",r="";for(i=0;i>>4&15)+n.charAt(15&e);return r}function f(t){return unescape(encodeURIComponent(t))}function g(t){return d(f(t))}function m(t){return p(g(t))}function v(t,e){return h(f(t),f(e))}function b(t,e){return p(v(t,e))}function y(t,e,i){return e?i?v(e,t):b(e,t):i?g(t):m(t)}"function"==typeof define&&define.amd?define(function(){return y}):t.md5=y}(this),function(t){t.fn.qrcode=function(e){function i(t){this.mode=a,this.data=t}function n(t,e){this.typeNumber=t,this.errorCorrectLevel=e,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}function r(t,e){if(void 0==t.length)throw Error(t.length+"/"+e);for(var i=0;it||this.moduleCount<=t||0>e||this.moduleCount<=e)throw Error(t+","+e);return this.modules[t][e]},getModuleCount:function(){return this.moduleCount},make:function(){if(1>this.typeNumber){for(var t=1,t=1;40>t;t++){for(var e=o.getRSBlocks(t,this.errorCorrectLevel),i=new s,n=0,r=0;r=i;i++)if(!(-1>=t+i||this.moduleCount<=t+i))for(var n=-1;7>=n;n++)-1>=e+n||this.moduleCount<=e+n||(this.modules[t+i][e+n]=0<=i&&6>=i&&(0==n||6==n)||0<=n&&6>=n&&(0==i||6==i)||2<=i&&4>=i&&2<=n&&4>=n)},getBestMaskPattern:function(){for(var t=0,e=0,i=0;8>i;i++){this.makeImpl(!0,i);var n=c.getLostPoint(this);(0==i||t>n)&&(t=n,e=i)}return e},createMovieClip:function(t,e,i){for(t=t.createEmptyMovieClip(e,i),this.make(),e=0;e=o;o++)for(var s=-2;2>=s;s++)this.modules[n+o][r+s]=-2==o||2==o||-2==s||2==s||0==o&&0==s}},setupTypeNumber:function(t){for(var e=c.getBCHTypeNumber(this.typeNumber),i=0;18>i;i++){var n=!t&&1==(e>>i&1);this.modules[Math.floor(i/3)][i%3+this.moduleCount-8-3]=n}for(i=0;18>i;i++)n=!t&&1==(e>>i&1),this.modules[i%3+this.moduleCount-8-3][Math.floor(i/3)]=n},setupTypeInfo:function(t,e){for(var i=c.getBCHTypeInfo(this.errorCorrectLevel<<3|e),n=0;15>n;n++){var r=!t&&1==(i>>n&1);6>n?this.modules[n][8]=r:8>n?this.modules[n+1][8]=r:this.modules[this.moduleCount-15+n][8]=r}for(n=0;15>n;n++)r=!t&&1==(i>>n&1),8>n?this.modules[8][this.moduleCount-n-1]=r:9>n?this.modules[8][15-n-1+1]=r:this.modules[8][15-n-1]=r;this.modules[this.moduleCount-8][8]=!t},mapData:function(t,e){for(var i=-1,n=this.moduleCount-1,r=7,o=0,s=this.moduleCount-1;0a;a++)if(null==this.modules[n][s-a]){var l=!1;o>>r&1)),c.getMask(e,n,s-a)&&(l=!l),this.modules[n][s-a]=l,r--,-1==r&&(o++,r=7)}if(n+=i,0>n||this.moduleCount<=n){n-=i,i=-i;break}}}},n.PAD0=236,n.PAD1=17,n.createData=function(t,e,i){for(var e=o.getRSBlocks(t,e),r=new s,a=0;a8*t)throw Error("code length overflow. ("+r.getLengthInBits()+">"+8*t+")");for(r.getLengthInBits()+4<=8*t&&r.put(0,4);0!=r.getLengthInBits()%8;)r.putBit(!1);for(;!(r.getLengthInBits()>=8*t)&&(r.put(n.PAD0,8),!(r.getLengthInBits()>=8*t));)r.put(n.PAD1,8);return n.createBytes(r,e)},n.createBytes=function(t,e){for(var i=0,n=0,o=0,s=Array(e.length),a=Array(e.length),l=0;l>>=1;return e},getPatternPosition:function(t){return c.PATTERN_POSITION_TABLE[t-1]},getMask:function(t,e,i){switch(t){case 0:return 0==(e+i)%2;case 1:return 0==e%2;case 2:return 0==i%3;case 3:return 0==(e+i)%3;case 4:return 0==(Math.floor(e/2)+Math.floor(i/3))%2;case 5:return 0==e*i%2+e*i%3;case 6:return 0==(e*i%2+e*i%3)%2;case 7:return 0==(e*i%3+(e+i)%2)%2;default:throw Error("bad maskPattern:"+t)}},getErrorCorrectPolynomial:function(t){for(var e=new r([1],0),i=0;ie)switch(t){case 1:return 10;case 2:return 9;case a:return 8;case 8:return 8;default:throw Error("mode:"+t)}else if(27>e)switch(t){case 1:return 12;case 2:return 11;case a:return 16;case 8:return 10;default:throw Error("mode:"+t)}else{if(!(41>e))throw Error("type:"+e);switch(t){case 1:return 14;case 2:return 13;case a:return 16;case 8:return 12;default:throw Error("mode:"+t)}}},getLostPoint:function(t){for(var e=t.getModuleCount(),i=0,n=0;n=a;a++)if(!(0>n+a||e<=n+a))for(var c=-1;1>=c;c++)0>r+c||e<=r+c||0==a&&0==c||s==t.isDark(n+a,r+c)&&o++;5t)throw Error("glog("+t+")");return l.LOG_TABLE[t]},gexp:function(t){for(;0>t;)t+=255;for(;256<=t;)t-=255;return l.EXP_TABLE[t]},EXP_TABLE:Array(256),LOG_TABLE:Array(256)},u=0;8>u;u++)l.EXP_TABLE[u]=1<u;u++)l.EXP_TABLE[u]=l.EXP_TABLE[u-4]^l.EXP_TABLE[u-5]^l.EXP_TABLE[u-6]^l.EXP_TABLE[u-8];for(u=0;255>u;u++)l.LOG_TABLE[l.EXP_TABLE[u]]=u;return r.prototype={get:function(t){return this.num[t]},getLength:function(){return this.num.length},multiply:function(t){for(var e=Array(this.getLength()+t.getLength()-1),i=0;ithis.getLength()-t.getLength())return this;for(var e=l.glog(this.get(0))-l.glog(t.get(0)),i=Array(this.getLength()),n=0;n>>7-t%8&1)},put:function(t,e){for(var i=0;i>>e-i-1&1))},getLengthInBits:function(){return this.length},putBit:function(t){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}},"string"==typeof e&&(e={text:e}),e=t.extend({},{render:"canvas",width:256,height:256,typeNumber:-1,correctLevel:2,background:"#ffffff",foreground:"#000000"},e),this.each(function(){var i;if("canvas"==e.render){i=new n(e.typeNumber,e.correctLevel),i.addData(e.text),i.make();var r=document.createElement("canvas");r.width=e.width,r.height=e.height;for(var o=r.getContext("2d"),s=e.width/i.getModuleCount(),a=e.height/i.getModuleCount(),c=0;c").css("width",e.width+"px").css("height",e.height+"px").css("border","0px").css("border-collapse","collapse").css("background-color",e.background),o=e.width/i.getModuleCount(),s=e.height/i.getModuleCount(),a=0;a").css("height",s+"px").appendTo(r),l=0;l").css("width",o+"px").css("background-color",i.isDark(a,l)?e.foreground:e.background).appendTo(c);i=r,jQuery(i).appendTo(this)})}}(jQuery),function(){var t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");Math.uuid=function(e,i){var n,r=t,o=[];if(i=i||r.length,e)for(n=0;n>=4,n[o]=i[19==o?3&e|8:e]);return n.join("")},Math.uuidCompact=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=16*Math.random()|0,i="x"==t?e:3&e|8;return i.toString(16)})}}(),$(function(){jQuery.timeago.settings.strings["zh-CN"]={prefixAgo:null,prefixFromNow:"\u4ece\u73b0\u5728\u5f00\u59cb",suffixAgo:"\u4e4b\u524d",suffixFromNow:null,seconds:"\u4e0d\u5230 1 \u5206\u949f",minute:"\u5927\u7ea6 1 \u5206\u949f",minutes:"%d \u5206\u949f",hour:"\u5927\u7ea6 1 \u5c0f\u65f6",hours:"\u5927\u7ea6 %d \u5c0f\u65f6",day:"1 \u5929",days:"%d \u5929",month:"\u5927\u7ea6 1 \u4e2a\u6708",months:"%d \u6708",year:"\u5927\u7ea6 1 \u5e74",years:"%d \u5e74",numbers:[],wordSeparator:""}}),function t(e,i,n){function r(s,a){if(!i[s]){if(!e[s]){var c="function"==typeof require&&require;if(!a&&c)return c(s,!0);if(o)return o(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var u=i[s]={exports:{}};e[s][0].call(u.exports,function(t){var i=e[s][1][t];return r(i?i:t)},u,u.exports,t,e,i,n)}return i[s].exports}for(var o="function"==typeof require&&require,s=0;s=0&&i.splice(n,1),t.className=i.join(" ")}i.add=function(t,e){t.classList?t.classList.add(e):n(t,e)},i.remove=function(t,e){t.classList?t.classList.remove(e):r(t,e)},i.list=function(t){return t.classList?Array.prototype.slice.apply(t.classList):t.className.split(" ")}},{}],3:[function(t,e){"use strict";function i(t,e){return window.getComputedStyle(t)[e]}function n(t,e,i){return"number"==typeof i&&(i=i.toString()+"px"),t.style[e]=i,t}function r(t,e){for(var i in e){var n=e[i];"number"==typeof n&&(n=n.toString()+"px"),t.style[i]=n}return t}var o={};o.e=function(t,e){var i=document.createElement(t);return i.className=e,i},o.appendTo=function(t,e){return e.appendChild(t),t},o.css=function(t,e,o){return"object"==typeof e?r(t,e):"undefined"==typeof o?i(t,e):n(t,e,o)},o.matches=function(t,e){return"undefined"!=typeof t.matches?t.matches(e):"undefined"!=typeof t.matchesSelector?t.matchesSelector(e):"undefined"!=typeof t.webkitMatchesSelector?t.webkitMatchesSelector(e):"undefined"!=typeof t.mozMatchesSelector?t.mozMatchesSelector(e):"undefined"!=typeof t.msMatchesSelector?t.msMatchesSelector(e):void 0},o.remove=function(t){"undefined"!=typeof t.remove?t.remove():t.parentNode&&t.parentNode.removeChild(t)},o.queryChildren=function(t,e){return Array.prototype.filter.call(t.childNodes,function(t){return o.matches(t,e)})},e.exports=o},{}],4:[function(t,e){"use strict";var i=function(t){this.element=t,this.events={}};i.prototype.bind=function(t,e){"undefined"==typeof this.events[t]&&(this.events[t]=[]),this.events[t].push(e),this.element.addEventListener(t,e,!1)},i.prototype.unbind=function(t,e){var i="undefined"!=typeof e;this.events[t]=this.events[t].filter(function(n){return!(!i||n===e)||(this.element.removeEventListener(t,n,!1),!1)},this)},i.prototype.unbindAll=function(){for(var t in this.events)this.unbind(t)};var n=function(){this.eventElements=[]};n.prototype.eventElement=function(t){var e=this.eventElements.filter(function(e){return e.element===t})[0];return"undefined"==typeof e&&(e=new i(t),this.eventElements.push(e)),e},n.prototype.bind=function(t,e,i){this.eventElement(t).bind(e,i)},n.prototype.unbind=function(t,e,i){this.eventElement(t).unbind(e,i)},n.prototype.unbindAll=function(){for(var t=0;t1&&(u=1),s(t,"top",(e.contentHeight-e.containerHeight)*u),o(t),r.stopPropagation()}),e.settings.stopPropagationOnClick&&e.event.bind(e.scrollbarX,"click",r),e.event.bind(e.scrollbarXRail,"click",function(r){var a=n.toInt(e.scrollbarXWidth/2),c=e.railXRatio*(r.pageX-window.pageXOffset-i(e.scrollbarXRail).left-a),l=e.railXRatio*(e.railXWidth-e.scrollbarXWidth),u=c/l;u<0?u=0:u>1&&(u=1),s(t,"left",(e.contentWidth-e.containerWidth)*u-e.negativeScrollAdjustment),o(t),r.stopPropagation()})}var n=t("../../lib/helper"),r=t("../instances"),o=t("../update-geometry"),s=t("../update-scroll");e.exports=function(t){var e=r.get(t);i(t,e)}},{"../../lib/helper":6,"../instances":18,"../update-geometry":19,"../update-scroll":20}],11:[function(t,e){"use strict";function i(t,e){function i(i){var o=n+i*e.railXRatio,s=Math.max(0,e.scrollbarXRail.getBoundingClientRect().left)+e.railXRatio*(e.railXWidth-e.scrollbarXWidth);o<0?e.scrollbarXLeft=0:o>s?e.scrollbarXLeft=s:e.scrollbarXLeft=o;var a=r.toInt(e.scrollbarXLeft*(e.contentWidth-e.containerWidth)/(e.containerWidth-e.railXRatio*e.scrollbarXWidth))-e.negativeScrollAdjustment;c(t,"left",a)}var n=null,s=null,l=function(e){i(e.pageX-s),a(t),e.stopPropagation(),e.preventDefault()},u=function(){r.stopScrolling(t,"x"),e.event.unbind(e.ownerDocument,"mousemove",l)};e.event.bind(e.scrollbarX,"mousedown",function(i){s=i.pageX,n=r.toInt(o.css(e.scrollbarX,"left"))*e.railXRatio,r.startScrolling(t,"x"),e.event.bind(e.ownerDocument,"mousemove",l),e.event.once(e.ownerDocument,"mouseup",u),i.stopPropagation(),i.preventDefault()})}function n(t,e){function i(i){var o=n+i*e.railYRatio,s=Math.max(0,e.scrollbarYRail.getBoundingClientRect().top)+e.railYRatio*(e.railYHeight-e.scrollbarYHeight);o<0?e.scrollbarYTop=0:o>s?e.scrollbarYTop=s:e.scrollbarYTop=o;var a=r.toInt(e.scrollbarYTop*(e.contentHeight-e.containerHeight)/(e.containerHeight-e.railYRatio*e.scrollbarYHeight));c(t,"top",a)}var n=null,s=null,l=function(e){i(e.pageY-s),a(t),e.stopPropagation(),e.preventDefault()},u=function(){r.stopScrolling(t,"y"),e.event.unbind(e.ownerDocument,"mousemove",l)};e.event.bind(e.scrollbarY,"mousedown",function(i){s=i.pageY,n=r.toInt(o.css(e.scrollbarY,"top"))*e.railYRatio,r.startScrolling(t,"y"),e.event.bind(e.ownerDocument,"mousemove",l),e.event.once(e.ownerDocument,"mouseup",u),i.stopPropagation(),i.preventDefault()})}var r=t("../../lib/helper"),o=t("../../lib/dom"),s=t("../instances"),a=t("../update-geometry"),c=t("../update-scroll");e.exports=function(t){var e=s.get(t);i(t,e),n(t,e)}},{"../../lib/dom":3,"../../lib/helper":6,"../instances":18,"../update-geometry":19,"../update-scroll":20}],12:[function(t,e){"use strict";function i(t,e){function i(i,n){var r=t.scrollTop;if(0===i){if(!e.scrollbarYActive)return!1;if(0===r&&n>0||r>=e.contentHeight-e.containerHeight&&n<0)return!e.settings.wheelPropagation}var o=t.scrollLeft;if(0===n){if(!e.scrollbarXActive)return!1;if(0===o&&i<0||o>=e.contentWidth-e.containerWidth&&i>0)return!e.settings.wheelPropagation}return!0}var o=!1;e.event.bind(t,"mouseenter",function(){o=!0}),e.event.bind(t,"mouseleave",function(){o=!1});var c=!1;e.event.bind(e.ownerDocument,"keydown",function(l){if(!l.isDefaultPrevented||!l.isDefaultPrevented()){var u=r.matches(e.scrollbarX,":focus")||r.matches(e.scrollbarY,":focus");if(o||u){var d=document.activeElement?document.activeElement:e.ownerDocument.activeElement;if(d){if("IFRAME"===d.tagName)d=d.contentDocument.activeElement;else for(;d.shadowRoot;)d=d.shadowRoot.activeElement;if(n.isEditable(d))return}var h=0,p=0;switch(l.which){case 37:h=-30;break;case 38:p=30;break;case 39:h=30;break;case 40:p=-30;break;case 33:p=90;break;case 32:p=l.shiftKey?90:-90;break;case 34:p=-90;break;case 35:p=l.ctrlKey?-e.contentHeight:-e.containerHeight;break;case 36:p=l.ctrlKey?t.scrollTop:e.containerHeight;break;default:return}a(t,"top",t.scrollTop-p),a(t,"left",t.scrollLeft+h),s(t),c=i(h,p),c&&l.preventDefault()}}})}var n=t("../../lib/helper"),r=t("../../lib/dom"),o=t("../instances"),s=t("../update-geometry"),a=t("../update-scroll");e.exports=function(t){var e=o.get(t);i(t,e)}},{"../../lib/dom":3,"../../lib/helper":6,"../instances":18,"../update-geometry":19,"../update-scroll":20}],13:[function(t,e){"use strict";function i(t,e){function i(i,n){var r=t.scrollTop;if(0===i){if(!e.scrollbarYActive)return!1;if(0===r&&n>0||r>=e.contentHeight-e.containerHeight&&n<0)return!e.settings.wheelPropagation}var o=t.scrollLeft;if(0===n){if(!e.scrollbarXActive)return!1;if(0===o&&i<0||o>=e.contentWidth-e.containerWidth&&i>0)return!e.settings.wheelPropagation}return!0}function n(t){var e=t.deltaX,i=-1*t.deltaY;return"undefined"!=typeof e&&"undefined"!=typeof i||(e=-1*t.wheelDeltaX/6,i=t.wheelDeltaY/6),t.deltaMode&&1===t.deltaMode&&(e*=10,i*=10),e!==e&&i!==i&&(e=0,i=t.wheelDelta),[e,i]}function s(e,i){var n=t.querySelector("textarea:hover, .ps-child:hover");if(n){if("TEXTAREA"!==n.tagName&&!window.getComputedStyle(n).overflow.match(/(scroll|auto)/))return!1;var r=n.scrollHeight-n.clientHeight;if(r>0&&!(0===n.scrollTop&&i>0||n.scrollTop===r&&i<0))return!0;var o=n.scrollLeft-n.clientWidth;if(o>0&&!(0===n.scrollLeft&&e<0||n.scrollLeft===o&&e>0))return!0}return!1}function a(a){var l=n(a),u=l[0],d=l[1];s(u,d)||(c=!1,e.settings.useBothWheelAxes?e.scrollbarYActive&&!e.scrollbarXActive?(d?o(t,"top",t.scrollTop-d*e.settings.wheelSpeed):o(t,"top",t.scrollTop+u*e.settings.wheelSpeed),c=!0):e.scrollbarXActive&&!e.scrollbarYActive&&(u?o(t,"left",t.scrollLeft+u*e.settings.wheelSpeed):o(t,"left",t.scrollLeft-d*e.settings.wheelSpeed),c=!0):(o(t,"top",t.scrollTop-d*e.settings.wheelSpeed),o(t,"left",t.scrollLeft+u*e.settings.wheelSpeed)),r(t),c=c||i(u,d),c&&(a.stopPropagation(),a.preventDefault()))}var c=!1;"undefined"!=typeof window.onwheel?e.event.bind(t,"wheel",a):"undefined"!=typeof window.onmousewheel&&e.event.bind(t,"mousewheel",a)}var n=t("../instances"),r=t("../update-geometry"),o=t("../update-scroll");e.exports=function(t){var e=n.get(t);i(t,e)}},{"../instances":18,"../update-geometry":19,"../update-scroll":20}],14:[function(t,e){"use strict";function i(t,e){e.event.bind(t,"scroll",function(){r(t)})}var n=t("../instances"),r=t("../update-geometry");e.exports=function(t){var e=n.get(t);i(t,e)}},{"../instances":18,"../update-geometry":19}],15:[function(t,e){"use strict";function i(t,e){function i(){var t=window.getSelection?window.getSelection():document.getSelection?document.getSelection():"";return 0===t.toString().length?null:t.getRangeAt(0).commonAncestorContainer}function a(){l||(l=setInterval(function(){return r.get(t)?(s(t,"top",t.scrollTop+u.top),s(t,"left",t.scrollLeft+u.left),void o(t)):void clearInterval(l)},50))}function c(){l&&(clearInterval(l),l=null),n.stopScrolling(t)}var l=null,u={top:0,left:0},d=!1;e.event.bind(e.ownerDocument,"selectionchange",function(){
t.contains(i())?d=!0:(d=!1,c())}),e.event.bind(window,"mouseup",function(){d&&(d=!1,c())}),e.event.bind(window,"mousemove",function(e){if(d){var i={x:e.pageX,y:e.pageY},r={left:t.offsetLeft,right:t.offsetLeft+t.offsetWidth,top:t.offsetTop,bottom:t.offsetTop+t.offsetHeight};i.xr.right-3?(u.left=5,n.startScrolling(t,"x")):u.left=0,i.yr.bottom-3?(i.y-r.bottom+3<5?u.top=5:u.top=20,n.startScrolling(t,"y")):u.top=0,0===u.top&&0===u.left?c():a()}})}var n=t("../../lib/helper"),r=t("../instances"),o=t("../update-geometry"),s=t("../update-scroll");e.exports=function(t){var e=r.get(t);i(t,e)}},{"../../lib/helper":6,"../instances":18,"../update-geometry":19,"../update-scroll":20}],16:[function(t,e){"use strict";function i(t,e,i,n){function a(i,n){var r=t.scrollTop,o=t.scrollLeft,s=Math.abs(i),a=Math.abs(n);if(a>s){if(n<0&&r===e.contentHeight-e.containerHeight||n>0&&0===r)return!e.settings.swipePropagation}else if(s>a&&(i<0&&o===e.contentWidth-e.containerWidth||i>0&&0===o))return!e.settings.swipePropagation;return!0}function c(e,i){s(t,"top",t.scrollTop-i),s(t,"left",t.scrollLeft-e),o(t)}function l(){_=!0}function u(){_=!1}function d(t){return t.targetTouches?t.targetTouches[0]:t}function h(t){return!(!t.targetTouches||1!==t.targetTouches.length)||!(!t.pointerType||"mouse"===t.pointerType||t.pointerType===t.MSPOINTER_TYPE_MOUSE)}function p(t){if(h(t)){w=!0;var e=d(t);m.pageX=e.pageX,m.pageY=e.pageY,v=(new Date).getTime(),null!==y&&clearInterval(y),t.stopPropagation()}}function f(t){if(!w&&e.settings.swipePropagation&&p(t),!_&&w&&h(t)){var i=d(t),n={pageX:i.pageX,pageY:i.pageY},r=n.pageX-m.pageX,o=n.pageY-m.pageY;c(r,o),m=n;var s=(new Date).getTime(),l=s-v;l>0&&(b.x=r/l,b.y=o/l,v=s),a(r,o)&&(t.stopPropagation(),t.preventDefault())}}function g(){!_&&w&&(w=!1,clearInterval(y),y=setInterval(function(){return r.get(t)?Math.abs(b.x)<.01&&Math.abs(b.y)<.01?void clearInterval(y):(c(30*b.x,30*b.y),b.x*=.8,void(b.y*=.8)):void clearInterval(y)},10))}var m={},v=0,b={},y=null,_=!1,w=!1;i&&(e.event.bind(window,"touchstart",l),e.event.bind(window,"touchend",u),e.event.bind(t,"touchstart",p),e.event.bind(t,"touchmove",f),e.event.bind(t,"touchend",g)),n&&(window.PointerEvent?(e.event.bind(window,"pointerdown",l),e.event.bind(window,"pointerup",u),e.event.bind(t,"pointerdown",p),e.event.bind(t,"pointermove",f),e.event.bind(t,"pointerup",g)):window.MSPointerEvent&&(e.event.bind(window,"MSPointerDown",l),e.event.bind(window,"MSPointerUp",u),e.event.bind(t,"MSPointerDown",p),e.event.bind(t,"MSPointerMove",f),e.event.bind(t,"MSPointerUp",g)))}var n=t("../../lib/helper"),r=t("../instances"),o=t("../update-geometry"),s=t("../update-scroll");e.exports=function(t){if(n.env.supportsTouch||n.env.supportsIePointer){var e=r.get(t);i(t,e,n.env.supportsTouch,n.env.supportsIePointer)}}},{"../../lib/helper":6,"../instances":18,"../update-geometry":19,"../update-scroll":20}],17:[function(t,e){"use strict";var i=t("../lib/helper"),n=t("../lib/class"),r=t("./instances"),o=t("./update-geometry"),s={"click-rail":t("./handler/click-rail"),"drag-scrollbar":t("./handler/drag-scrollbar"),keyboard:t("./handler/keyboard"),wheel:t("./handler/mouse-wheel"),touch:t("./handler/touch"),selection:t("./handler/selection")},a=t("./handler/native-scroll");e.exports=function(t,e){e="object"==typeof e?e:{},n.add(t,"ps-container");var c=r.add(t);c.settings=i.extend(c.settings,e),n.add(t,"ps-theme-"+c.settings.theme),c.settings.handlers.forEach(function(e){s[e](t)}),a(t),o(t)}},{"../lib/class":2,"../lib/helper":6,"./handler/click-rail":10,"./handler/drag-scrollbar":11,"./handler/keyboard":12,"./handler/mouse-wheel":13,"./handler/native-scroll":14,"./handler/selection":15,"./handler/touch":16,"./instances":18,"./update-geometry":19}],18:[function(t,e,i){"use strict";function n(t){function e(){c.add(t,"ps-focus")}function i(){c.remove(t,"ps-focus")}var n=this;n.settings=a.clone(l),n.containerWidth=null,n.containerHeight=null,n.contentWidth=null,n.contentHeight=null,n.isRtl="rtl"===u.css(t,"direction"),n.isNegativeScroll=function(){var e=t.scrollLeft,i=null;return t.scrollLeft=-1,i=t.scrollLeft<0,t.scrollLeft=e,i}(),n.negativeScrollAdjustment=n.isNegativeScroll?t.scrollWidth-t.clientWidth:0,n.event=new d,n.ownerDocument=t.ownerDocument||document,n.scrollbarXRail=u.appendTo(u.e("div","ps-scrollbar-x-rail"),t),n.scrollbarX=u.appendTo(u.e("div","ps-scrollbar-x"),n.scrollbarXRail),n.scrollbarX.setAttribute("tabindex",0),n.event.bind(n.scrollbarX,"focus",e),n.event.bind(n.scrollbarX,"blur",i),n.scrollbarXActive=null,n.scrollbarXWidth=null,n.scrollbarXLeft=null,n.scrollbarXBottom=a.toInt(u.css(n.scrollbarXRail,"bottom")),n.isScrollbarXUsingBottom=n.scrollbarXBottom===n.scrollbarXBottom,n.scrollbarXTop=n.isScrollbarXUsingBottom?null:a.toInt(u.css(n.scrollbarXRail,"top")),n.railBorderXWidth=a.toInt(u.css(n.scrollbarXRail,"borderLeftWidth"))+a.toInt(u.css(n.scrollbarXRail,"borderRightWidth")),u.css(n.scrollbarXRail,"display","block"),n.railXMarginWidth=a.toInt(u.css(n.scrollbarXRail,"marginLeft"))+a.toInt(u.css(n.scrollbarXRail,"marginRight")),u.css(n.scrollbarXRail,"display",""),n.railXWidth=null,n.railXRatio=null,n.scrollbarYRail=u.appendTo(u.e("div","ps-scrollbar-y-rail"),t),n.scrollbarY=u.appendTo(u.e("div","ps-scrollbar-y"),n.scrollbarYRail),n.scrollbarY.setAttribute("tabindex",0),n.event.bind(n.scrollbarY,"focus",e),n.event.bind(n.scrollbarY,"blur",i),n.scrollbarYActive=null,n.scrollbarYHeight=null,n.scrollbarYTop=null,n.scrollbarYRight=a.toInt(u.css(n.scrollbarYRail,"right")),n.isScrollbarYUsingRight=n.scrollbarYRight===n.scrollbarYRight,n.scrollbarYLeft=n.isScrollbarYUsingRight?null:a.toInt(u.css(n.scrollbarYRail,"left")),n.scrollbarYOuterWidth=n.isRtl?a.outerWidth(n.scrollbarY):null,n.railBorderYWidth=a.toInt(u.css(n.scrollbarYRail,"borderTopWidth"))+a.toInt(u.css(n.scrollbarYRail,"borderBottomWidth")),u.css(n.scrollbarYRail,"display","block"),n.railYMarginHeight=a.toInt(u.css(n.scrollbarYRail,"marginTop"))+a.toInt(u.css(n.scrollbarYRail,"marginBottom")),u.css(n.scrollbarYRail,"display",""),n.railYHeight=null,n.railYRatio=null}function r(t){return t.getAttribute("data-ps-id")}function o(t,e){t.setAttribute("data-ps-id",e)}function s(t){t.removeAttribute("data-ps-id")}var a=t("../lib/helper"),c=t("../lib/class"),l=t("./default-setting"),u=t("../lib/dom"),d=t("../lib/event-manager"),h=t("../lib/guid"),p={};i.add=function(t){var e=h();return o(t,e),p[e]=new n(t),p[e]},i.remove=function(t){delete p[r(t)],s(t)},i.get=function(t){return p[r(t)]}},{"../lib/class":2,"../lib/dom":3,"../lib/event-manager":4,"../lib/guid":5,"../lib/helper":6,"./default-setting":8}],19:[function(t,e){"use strict";function i(t,e){return t.settings.minScrollbarLength&&(e=Math.max(e,t.settings.minScrollbarLength)),t.settings.maxScrollbarLength&&(e=Math.min(e,t.settings.maxScrollbarLength)),e}function n(t,e){var i={width:e.railXWidth};e.isRtl?i.left=e.negativeScrollAdjustment+t.scrollLeft+e.containerWidth-e.contentWidth:i.left=t.scrollLeft,e.isScrollbarXUsingBottom?i.bottom=e.scrollbarXBottom-t.scrollTop:i.top=e.scrollbarXTop+t.scrollTop,s.css(e.scrollbarXRail,i);var n={top:t.scrollTop,height:e.railYHeight};e.isScrollbarYUsingRight?e.isRtl?n.right=e.contentWidth-(e.negativeScrollAdjustment+t.scrollLeft)-e.scrollbarYRight-e.scrollbarYOuterWidth:n.right=e.scrollbarYRight-t.scrollLeft:e.isRtl?n.left=e.negativeScrollAdjustment+t.scrollLeft+2*e.containerWidth-e.contentWidth-e.scrollbarYLeft-e.scrollbarYOuterWidth:n.left=e.scrollbarYLeft+t.scrollLeft,s.css(e.scrollbarYRail,n),s.css(e.scrollbarX,{left:e.scrollbarXLeft,width:e.scrollbarXWidth-e.railBorderXWidth}),s.css(e.scrollbarY,{top:e.scrollbarYTop,height:e.scrollbarYHeight-e.railBorderYWidth})}var r=t("../lib/helper"),o=t("../lib/class"),s=t("../lib/dom"),a=t("./instances"),c=t("./update-scroll");e.exports=function(t){var e=a.get(t);e.containerWidth=t.clientWidth,e.containerHeight=t.clientHeight,e.contentWidth=t.scrollWidth,e.contentHeight=t.scrollHeight;var l;t.contains(e.scrollbarXRail)||(l=s.queryChildren(t,".ps-scrollbar-x-rail"),l.length>0&&l.forEach(function(t){s.remove(t)}),s.appendTo(e.scrollbarXRail,t)),t.contains(e.scrollbarYRail)||(l=s.queryChildren(t,".ps-scrollbar-y-rail"),l.length>0&&l.forEach(function(t){s.remove(t)}),s.appendTo(e.scrollbarYRail,t)),!e.settings.suppressScrollX&&e.containerWidth+e.settings.scrollXMarginOffset=e.railXWidth-e.scrollbarXWidth&&(e.scrollbarXLeft=e.railXWidth-e.scrollbarXWidth),e.scrollbarYTop>=e.railYHeight-e.scrollbarYHeight&&(e.scrollbarYTop=e.railYHeight-e.scrollbarYHeight),n(t,e),e.scrollbarXActive?o.add(t,"ps-active-x"):(o.remove(t,"ps-active-x"),e.scrollbarXWidth=0,e.scrollbarXLeft=0,c(t,"left",0)),e.scrollbarYActive?o.add(t,"ps-active-y"):(o.remove(t,"ps-active-y"),e.scrollbarYHeight=0,e.scrollbarYTop=0,c(t,"top",0))}},{"../lib/class":2,"../lib/dom":3,"../lib/helper":6,"./instances":18,"./update-scroll":20}],20:[function(t,e){"use strict";var i,n,r=t("./instances"),o=document.createEvent("Event"),s=document.createEvent("Event"),a=document.createEvent("Event"),c=document.createEvent("Event"),l=document.createEvent("Event"),u=document.createEvent("Event"),d=document.createEvent("Event"),h=document.createEvent("Event"),p=document.createEvent("Event"),f=document.createEvent("Event");o.initEvent("ps-scroll-up",!0,!0),s.initEvent("ps-scroll-down",!0,!0),a.initEvent("ps-scroll-left",!0,!0),c.initEvent("ps-scroll-right",!0,!0),l.initEvent("ps-scroll-y",!0,!0),u.initEvent("ps-scroll-x",!0,!0),d.initEvent("ps-x-reach-start",!0,!0),h.initEvent("ps-x-reach-end",!0,!0),p.initEvent("ps-y-reach-start",!0,!0),f.initEvent("ps-y-reach-end",!0,!0),e.exports=function(t,e,g){if("undefined"==typeof t)throw"You must provide an element to the update-scroll function";if("undefined"==typeof e)throw"You must provide an axis to the update-scroll function";if("undefined"==typeof g)throw"You must provide a value to the update-scroll function";"top"===e&&g<=0&&(t.scrollTop=g=0,t.dispatchEvent(p)),"left"===e&&g<=0&&(t.scrollLeft=g=0,t.dispatchEvent(d));var m=r.get(t);"top"===e&&g>=m.contentHeight-m.containerHeight&&(g=m.contentHeight-m.containerHeight,g-t.scrollTop<=1?g=t.scrollTop:t.scrollTop=g,t.dispatchEvent(f)),"left"===e&&g>=m.contentWidth-m.containerWidth&&(g=m.contentWidth-m.containerWidth,g-t.scrollLeft<=1?g=t.scrollLeft:t.scrollLeft=g,t.dispatchEvent(h)),i||(i=t.scrollTop),n||(n=t.scrollLeft),"top"===e&&gi&&t.dispatchEvent(s),"left"===e&&gn&&t.dispatchEvent(c),"top"===e&&(t.scrollTop=i=g,t.dispatchEvent(l)),"left"===e&&(t.scrollLeft=n=g,t.dispatchEvent(u))}},{"./instances":18}],21:[function(t,e){"use strict";var i=t("../lib/helper"),n=t("../lib/dom"),r=t("./instances"),o=t("./update-geometry"),s=t("./update-scroll");e.exports=function(t){var e=r.get(t);e&&(e.negativeScrollAdjustment=e.isNegativeScroll?t.scrollWidth-t.clientWidth:0,n.css(e.scrollbarXRail,"display","block"),n.css(e.scrollbarYRail,"display","block"),e.railXMarginWidth=i.toInt(n.css(e.scrollbarXRail,"marginLeft"))+i.toInt(n.css(e.scrollbarXRail,"marginRight")),e.railYMarginHeight=i.toInt(n.css(e.scrollbarYRail,"marginTop"))+i.toInt(n.css(e.scrollbarYRail,"marginBottom")),n.css(e.scrollbarXRail,"display","none"),n.css(e.scrollbarYRail,"display","none"),o(t),s(t,"top",t.scrollTop),s(t,"left",t.scrollLeft),n.css(e.scrollbarXRail,"display",""),n.css(e.scrollbarYRail,"display",""))}},{"../lib/dom":3,"../lib/helper":6,"./instances":18,"./update-geometry":19,"./update-scroll":20}]},{},[1]),function(t,e){"function"==typeof define&&define.amd?define(function(){return e(t,t.document)}):"undefined"!=typeof module&&module.exports?module.exports=e(t,t.document):t.Shake=e(t,t.document)}("undefined"!=typeof window?window:this,function(t,e){"use strict";function i(i){if(this.hasDeviceMotion="ondevicemotion"in t,this.options={threshold:15,timeout:1e3},"object"==typeof i)for(var n in i)i.hasOwnProperty(n)&&(this.options[n]=i[n]);if(this.lastTime=new Date,this.lastX=null,this.lastY=null,this.lastZ=null,"function"==typeof e.CustomEvent)this.event=new e.CustomEvent("shake",{bubbles:!0,cancelable:!0});else{if("function"!=typeof e.createEvent)return!1;this.event=e.createEvent("Event"),this.event.initEvent("shake",!0,!0)}}return i.prototype.reset=function(){this.lastTime=new Date,this.lastX=null,this.lastY=null,this.lastZ=null},i.prototype.start=function(){this.reset(),this.hasDeviceMotion&&t.addEventListener("devicemotion",this,!1)},i.prototype.stop=function(){this.hasDeviceMotion&&t.removeEventListener("devicemotion",this,!1),this.reset()},i.prototype.devicemotion=function(e){var i,n,r=e.accelerationIncludingGravity,o=0,s=0,a=0;return null===this.lastX&&null===this.lastY&&null===this.lastZ?(this.lastX=r.x,this.lastY=r.y,void(this.lastZ=r.z)):(o=Math.abs(this.lastX-r.x),s=Math.abs(this.lastY-r.y),a=Math.abs(this.lastZ-r.z),(o>this.options.threshold&&s>this.options.threshold||o>this.options.threshold&&a>this.options.threshold||s>this.options.threshold&&a>this.options.threshold)&&(i=new Date,n=i.getTime()-this.lastTime.getTime(),n>this.options.timeout&&(t.dispatchEvent(this.event),this.lastTime=new Date)),this.lastX=r.x,this.lastY=r.y,void(this.lastZ=r.z))},i.prototype.handleEvent=function(t){if("function"==typeof this[t.type])return this[t.type](t)},i}),void function(t){var e="2.0.4",i=t.AV||{};t.AV=i,"function"==typeof define&&define.amd&&define("AV",[],function(){return i});var n={heartbeatsTime:3e4},r={},o={},s={open:"open",close:"close",message:"message",reuse:"reuse",error:"error"},a=function(){var e={options:void 0,ws:void 0,heartbeatsTimer:void 0,ec:void 0,closeFlag:!1,reuseTimer:void 0},i=function(){r.log("WebSocket opened."),o.loginPush(e.options),o.heartbeats(),o.guard(),e.ec.emit(s.open)},a=function(){r.log("WebSocket closed."),e.ec.emit(s.close)},c=function(t){var i=JSON.parse(t.data);if("data"===i.cmd){o.ackPush(i.ids);var n,r=i.msg.length;for(n=0;n=200&&r.status<300?e(JSON.parse(r.responseText)):e(null,JSON.parse(r.responseText))},r.onerror=function(t){throw e(null,t),"Network error."},r.send(JSON.stringify(t.data))},r.now=function(){return Date.now()},r.storage=function(e,i){if(!i){var n=t.localStorage.getItem(e);return/^[\{|\[]/.test(n)&&/[\}|\]]$/.test(n)&&(n=JSON.parse(n)),n}"object"==typeof i&&(i=JSON.stringify(i)),t.localStorage.setItem(e,i)},r.eventCenter=function(){function t(t){var e=[],i=0,n=t.length;if(n){for(;ithis.height?"landscape":"portrait"},n.prototype.isPrivate=function(){return"private"===this.access},n.prototype.isPublic=function(){return"public"===this.access},n.prototype.isWeb=function(){return"web"===this.device},n.prototype.isAndroid=function(){return"android"===this.device&&("customize"!==this.model||this.width<=720)},n.prototype.swidth=function(t){return t===this.orient()?this.width:this.height},n.prototype.sheight=function(t){return t===this.orient()?this.height:this.width},n.prototype.deviceShell=function(){var t;return["customize","Meizu"].indexOf(this.model)!==-1||"device"!==this._shell_type?null:MB.SHELLS[this.model]||MB.SHELLS[this.device]?t=$.extend({},MB.SHELLS[this.model]||MB.SHELLS[this.device]):null},n.prototype.defaultShell=function(){var t,e,i,n,r,o;return r="none"===this._shell_type?0:12,o=this.width+2*r,n=this.height+2*r,i=this.template||this.combo||"customize"===this.model||"web"===this.device?o:Math.min(o,n),e=this.template||this.combo||"customize"===this.model||"web"===this.device?n:Math.max(o,n),t={device:"default",width:i,height:e,top:r,left:r}},n.prototype.icon_size=function(){return MB.DEVICES[this.device][this.model].icon_size},n.prototype.splash_width=function(){return MB.DEVICES[this.device][this.model].width},n.prototype.splash_height=function(){return"android"===this.device?MB.DEVICES[this.device][this.model].height:MB.DEVICES[this.device][this.model].height-20},n.prototype.shell=function(){var t,e,i,n;return n=this.deviceShell()||this.defaultShell(),e=this.homeScreen(),e&&"landscape"===e.orientation&&(t=n.height,i=n.left,n.height=n.width,n.width=t,n.left=n.top,n.top=i),n},n.prototype.device_model=function(){var t,e,i,n,r;r=Math.min(this.width,this.height),t=Math.max(this.width,this.height),i=MB.DEVICES[this.device];for(e in i)if(n=i[e],r===n.width&&t===n.height)return e},n.prototype.device_name=function(){switch(this.device){case"android":return"Android";case"web":return I18N.w.webpage;default:return MB.DEVICES[this.device][this.model].name}},n.prototype.setResolution=function(t,e){var i;if(this.width!==t||this.height!==e)return i=this.width,this.width=t,this.height=e,i?this.download(function(i){return function(){var n,r,o,s;for(o=i.cscreens(),n=0,r=o.length;n=0))return n.left=null,n.top=null,n.width=t,"status_bar"===n.name&&(n.height=MB.COMPONENTS[n.name].height),"keyboard"===n.name&&(n.height=n.cs().kbDH()),n.lsave()}}(this))},n.prototype.setDevice=function(t){return this.device=t,this.setup()},n.prototype.setup=function(){return"android"===this.device?this.setupAndroid():this.setupiOS()},n.prototype.setupAndroid=function(){var t;return MB.COMPONENTS.status_bar.height=23,MB.COMPONENTS.navigation_bar.top=23,MB.COMPONENTS.navigation_bar.height=55,t=document.getElementById("fontawesome"),t.style.fontFamily='"Roboto", "Noto Sans CJK SC", "Nato Sans CJK TC", "Nato Sans CJK JP", "Nato Sans CJK KR", -apple-system,".SFNSText-Regular", "Helvetica Neue","PingFang SC","Hiragino Sans GB","Microsoft YaHei","WenQuanYi Zen Hei",Arial,sans-serif'},n.prototype.setupiOS=function(){var t;return MB.COMPONENTS.status_bar.height=20,MB.COMPONENTS.navigation_bar.top=20,MB.COMPONENTS.navigation_bar.height=45,t=document.getElementById("fontawesome"),t.style.fontFamily=""},n.prototype.isTeam=function(){return!1},n.prototype.collaborators=function(){return Collaborator.select(function(t){return function(e){return"MOCK"!==e.email&&(e.project_cid===t.cid||t.team_cid&&e.team_cid===t.team_cid)}}(this))},n.prototype.collaboratorByUid=function(t){var e,i,n,r;for(r=this.collaborators(),i=0,n=r.length;i1},n.prototype.leftPanelMode=function(){return localStorage[this.cid+"_leftPanelMode"]},n.prototype.rightPanelMode=function(){return localStorage[this.cid+"_rightPanelMode"]},n.prototype.setLeftPanelMode=function(t){return localStorage[this.cid+"_leftPanelMode"]=t},n.prototype.fixBadScreens=function(){return Screen.each(function(t){return function(e){var i;if(e.project_cid===t.cid&&e.parent_cid)return i=e.parent(),(!i||i&&i.project_cid!==t.cid)&&(MB.ga("send","event","bug","\u53d1\u73b0\u4e00\u4e2a\u6ca1\u6709\u7236\u9875\u9762\u7684\u9875\u9762: "+e.cid),e.parent_cid=null,e.lsave()),ScreenManager.fixBadScreen(e)}}(this))},n.prototype.download=function(t,e){return this.cscreens().length>0?t():(MB.safeLoading(I18N.load_project),MB.pusher.subscribe(this.cid),$.getJSON("/templates.json",function(i){return function(n){return Template.refresh(n.templates),Combo.refresh(n.combos),Screen.refresh(n.screens),Widget.refresh(n.widgets),Link.refresh(n.links),$.ajax({type:"GET",url:"/app/"+i.access_token+".json?password="+md5(i.password),timeout:18e4,success:function(e){var n,r,o,s,a,c,l;for(a=e.templates,n=0,o=a.length;nMB.maxTimestamp&&(MB.maxTimestamp=this.timestamp),this.zoomable="e,w,n,s",0!==this.z&&(this.z||(this.z=5)),this.ro=0,this.v!==!1&&(this.v||(this.v=!0)),this.locked||(this.locked=!1),this.fixed||(this.fixed=!1),this.fixed_type||(this.fixed_type=1),this.o||(this.o=100),this.main_state_cid||(this.main_state_cid=null),this.screenstate_cid||(this.screenstate_cid="default")},i.prototype.getState=function(t){var e;return e=Panelstate.find(t+this.cid),e||new Panelstate({cid:t+this.cid,screenstate_cid:t,panel_cid:this.cid}).restore(this)},i.ATTRS=["top","left","width","height","v","fixed","fixed_type","z","gid","behavior","template_cid","timestamp","main_state_cid","locked"],i.prototype.restore=function(t){var e,n,r,o;for(t.screen_cid&&(this.screen_cid=t.screen_cid),o=i.ATTRS,n=0,r=o.length;ne)return this[t]-=1},i.prototype.setL=function(t){return this._setAttr("left",t,"l")},i.prototype.setT=function(t){return this._setAttr("top",t,"t")},i.prototype.setW=function(t){return this._setAttr("width",t,"w")},i.prototype.setH=function(t){return this._setAttr("height",t,"h")},i.prototype.rect=function(){return{top:this.top,left:this.left,width:this.width,height:this.height,right:this.left+this.width,bottom:this.top+this.height}},i.prototype.s=function(){return $("body").data("scale")},i.prototype.inspectables=function(){return["states","left","top","width","height","fixed","fixed_type","v","main_state_cid","locked"]},i.prototype.cs=function(){return this._cs||(this._cs=Screen.find(this.screen_cid))},i.prototype.isFooter=function(){return!1},i.prototype.inScreen=function(){return this.r()>0&&this.l()=this.cs().footerTop()&&this.t()<=this.cs().h()},i.prototype.isContainer=function(){return!1},i.prototype.valid=function(){var t;return t=Template.find(this.template_cid),!(!t||!t.cscreens().length)||(MB.ga("send","event","bug","\u53d1\u73b0\u4e00\u4e2a\u9875\u9762\u6ca1\u6709\u4e0b\u8f7d\u7684\u6bcd\u7248"),this.ldestroy(),!1)},i.prototype.minWidthS=function(){return 0},i.prototype.minHeightS=function(){return 0},i.prototype.isBottomFixed=function(t){return parseInt(this.fixed_type)===Widget.FIX_TYPE.bottom||this.fixed_type===Widget.FIX_TYPE.auto&&this.t()>t.h()-t.dH()/2},i}(Spine.Model)}.call(this),function(){var t=function(t,i){function n(){this.constructor=t}for(var r in i)e.call(i,r)&&(t[r]=i[r]);return n.prototype=i.prototype,t.prototype=new n,t.__super__=i.prototype,t},e={}.hasOwnProperty;this.Panelstate=function(e){function i(){return i.__super__.constructor.apply(this,arguments)}return t(i,e),i.configure("Panelstate","screen_cid","cid","template_cid","top","left","width","height","name","gid","behavior","z","timestamp","v","fixed","fixed_type","main_state_cid","screenstate_cid","panel_cid","locked"),i.include(Spine.Model.Dirty),i.extend(Spine.Model.Ajax),i.prototype.load=function(t){if(i.__super__.load.call(this,t),"default"!==this.screenstate_cid)return this.screen_cid=null},i}(Panel)}.call(this),function(){var t=function(t,i){function n(){this.constructor=t}for(var r in i)e.call(i,r)&&(t[r]=i[r]);return n.prototype=i.prototype,t.prototype=new n,t.__super__=i.prototype,t},e={}.hasOwnProperty;this.Preference=function(e){function i(){return i.__super__.constructor.apply(this,arguments)}return t(i,e),i.configure("Preference","cid","gt","gl","asset","at","al","rt","rl","link_line","grid","ct","cl","pt","pl","ruler","guide","app_order"),i.include(Spine.Model.Dirty),i.extend(Spine.Model.Ajax),i.prototype.load=function(t){return i.__super__.load.call(this,t),this.states=!0},i}(Spine.Model)}.call(this),function(){var t=function(t,i){function n(){this.constructor=t}for(var r in i)e.call(i,r)&&(t[r]=i[r]);return n.prototype=i.prototype,t.prototype=new n,t.__super__=i.prototype,t},e={}.hasOwnProperty;this.Projectasset=function(e){function i(){return i.__super__.constructor.apply(this,arguments)}return t(i,e),i.configure("Projectasset","project_cid","asset_id"),i.findByProjectAndAsset=function(t,e){return this.select(function(i){return i.project_cid===t.cid&&(i.asset_id===e.sid||i.asset_id===e.cid)})},i}(Spine.Model)}.call(this),function(){var t=function(t,i){function n(){this.constructor=t}for(var r in i)e.call(i,r)&&(t[r]=i[r]);return n.prototype=i.prototype,t.prototype=new n,t.__super__=i.prototype,t},e={}.hasOwnProperty,i=[].indexOf||function(t){for(var e=0,i=this.length;e=0?(r.parent_cid=null,r.lsave()):(r=e,t.push(r.cid));return t.length<4},n.prototype.siblings=function(){var t;return this.parent_cid?t=this.parent().children():(t=n.select(function(t){return function(e){return e.project_cid===t.cid&&!e.parent_cid}}(this)),t.sort(function(t,e){return t.position-e.position})),t},n.prototype.isLastChild=function(){var t,e;return e=this.siblings(),t=e.findIndex(function(t){return function(e){return e.cid===t.cid}}(this)),t===e.length-1},n.prototype.children=function(){var t,e;return t=this.cid,e=n.select(function(e){return e.parent_cid===t}),e.sort(function(t,e){return t.position-e.position})},n.prototype.getState=function(t){return Screenstate.find(t)||new Screenstate({cid:t})},n.prototype.setState=function(t,e){var i,n;if(t!==this.state_cid)return i=this.getState(this.cid+"default"),"default"===this.state_cid&&(i.hh=this.hh,i.fh=this.fh,i.lsave(!1)),this.state_cid=t,n=this.getState(t),this.hh=n.hh||0===n.hh?n.hh:i.hh,this.fh=n.fh||0===n.fh?n.fh:i.fh,e?this.lsave(!1):void 0},n.prototype.setOrientation=function(t){return this.orientation=t,this.height=this.cp().sheight(t),this.width=this.cp().swidth(t)},n.prototype.setup=function(t){var e;if(!("none"===this.cp().shell_type&&this.width>720))return e=new Widget({name:"status_bar",text:MB.COMPONENTS.status_bar.text,left:null,top:null,width:this.width,height:MB.COMPONENTS.status_bar.height,screen_cid:this.cid,cid:"w"+Math.uuid(10,16)+(new Date).valueOf()}),e.lsave(),t?(e=new Widget({name:"navigation_bar",left:null,top:null,height:MB.COMPONENTS.navigation_bar.height,text:t,width:this.width,screen_cid:this.cid,cid:"w"+Math.uuid(10,16)+(new Date).valueOf()}),e.lsave()):void 0},n.prototype.maxWidgetHeight=function(){var t,e,i,n,r;for(t=0,n=this.citems(),e=0,i=n.length;ethis.dH()?($(t).css("top",0-this.dW()),$(t).width(this.dH()),$(t).height(this.dW())):($(t).css("top",0),$(t).width(this.dW()),$(t).height("101%"))},n.prototype.setImage=function(t){return this.bgimage=t.cid,this.bgcolor=this.dBg(),this.lsave(),MB.renderFEScreen()},n.prototype.getImage=function(){return this.bgimage},n.prototype.getAsset=function(){return Asset.find(this.bgimage)||Asset.findAllByAttribute("image",this.bgimage)[0]},n.prototype.getRealBgImage=function(){var t;return t=Asset.find(this.bgimage),t?t.image||t.raw:this.bgimage},n.prototype.detectConflict=function(t){var e,i,n,r,o,s,a,c;for(s=t?[t]:this.clinks(),e=0,r=s.length;ethis.dH())return $("#gesture_conflict .horizontal").hide(),$("#gesture_conflict .vertical").show(),void $("#gesture_conflict").modal()}else if(["left","right"].indexOf(n.gesture)!==-1)for(c=this.cpanels(),i=0,o=c.length;iMB.maxTimestamp&&(MB.maxTimestamp=this.timestamp),this.padding||(this.padding=0),this.checked!==!1&&(this.checked||(this.checked=!0)),this.numeric||(this.numeric=!1),this.v!==!1&&(this.v||(this.v=!0)),this.locked||(this.locked=!1),this.fixed||(this.fixed=!1),this.fixed_type=parseInt(this.fixed_type||1),this.tt_placement||(this.tt_placement="left"),this.tt_offset||(this.tt_offset=10),this.tt_arrow_size||(this.tt_arrow_size=10),this.screenstate_cid||(this.screenstate_cid="default"),this.ani_name||(this.ani_name="none"),this.slt||(this.slt=20),this.slw||(this.slw=50),void 0===this.p?this.p=1:this.p=this.p?1:0,"sticky"===this.name&&(this.z=i.MAXZ),"label"===this.name&&/\n/.test(this.text))return this.name="text_view",this.lsave()},i.prototype.cs=function(){return this._cs||(this._cs=Screen.find(this.screen_cid))},i.prototype.isContainer=function(){return["navigation_bar","rectangle","rounded_rect"].indexOf(this.name)!==-1},i.prototype.isFullWidth=function(){return["navigation_bar","status_bar","tab_bar","keyboard"].indexOf(this.name)!==-1},i.prototype.isFooter=function(){return["tab_bar","keyboard"].indexOf(this.name)!==-1},i.prototype.themeable=function(){return["status_bar","navigation_bar","tab_bar","search_bar","image_view","keyboard"].indexOf(this.name)!==-1},i.prototype.inScreen=function(){return this.r()>0&&this.l()=i.footerTop()&&this.t()<=i.h(),!this.isFooter()&&0!==t&&e},i.prototype.getState=function(t){var e;return e=Widgetstate.find(t+this.cid),e||new Widgetstate({cid:t+this.cid,screenstate_cid:t,widget_cid:this.cid}).restore(this)},i.prototype.restore=function(t){var e,n,r,o;for(t.screen_cid&&(this.screen_cid=t.screen_cid),o=i.ATTRS,n=0,r=o.length;na&&(a=o),c>t)return t=c}),p=a-s,n=t-h,{top:h,left:s,width:p,height:n,right:a,bottom:t}},i.prototype.s=function(){return $("body").data("scale")},i.prototype.fS=function(){var t;return t=(this.fs*this.s()/100).toFixed(1),!MB.f.inSharing&&!MB.f.minFSWarned&&!MB.isMobile()&&!MB.isPhantom()&&t0&&(MB.f.minFSWarned=!0,$("#chrome-warning").modal()),t},i.prototype.bS=function(){return this.bs?Math.floor(this.bs*this.s()/100)||1:0},i.prototype.iS=function(){return Math.round(this.is*this.s()/100)},i.prototype.bR=function(){return Math.round(this.br*this.s()/100)},i.prototype.lH=function(){return Math.round(this.lh*this.s()/100)},i.prototype.paddingS=function(){return Math.round(this.padding*this.s()/100)},i.prototype.lineStyle=function(){return["solid","dotted","dashed"][this.ls]},i.prototype.arrowSize=function(){return Math.round(this.tt_arrow_size*this.s()/100)},i.prototype.ttOffset=function(){return Math.round(this.tt_offset*this.s()/100)},i.prototype.inspectables=function(){return MB.INSPECTABLES[this.name]},i.prototype.textWidth=function(){var t;return $("#fontawesome .aw").css("font-size",this.fs),$("#fontawesome .aw").css("font-weight",this.bo?"bold":"normal"),t=$("#fontawesome .aw").html(this.text).width()+1+2*this.padding+2*this.bs,t<20&&(t=20),t},i.prototype.textHeightS=function(){return this._textHeight(this.text)*this.s()/100},i.prototype.textHeight=function(){return this._textHeight(this.text)},i.prototype._textHeight=function(t){var e,i,n,r,o;return o=this.width-2*this.padding-2*this.bs,"mtooltip"===this.name&&["left","right"].indexOf(this.tt_placement)!==-1&&(o-=10),n=this.bo?"bold":"normal",i=document.getElementById("fontawesome"),e=i.getElementsByClassName("ah")[0],e.style.fontSize!==this.fs+"px"&&(e.style.fontSize=this.fs+"px"),e.style.width!==o+"px"&&(e.style.width=o+"px"),e.style.lineHeight!==this.lh+"px"&&(e.style.lineHeight=this.lh+"px"),e.style.fontWeight!==n&&(e.style.fontWeight=n),e.innerHTML=MB.v.multiline(t),r=e.offsetHeight+2*this.padding+2*this.bs,r<10&&(r=10),r},i.prototype.minWidthS=function(){return Math.round(this.minWidth()*this.s()/100)},i.prototype.minHeightS=function(){return Math.round(this.minHeight()*this.s()/100)},i.prototype.minWidth=function(){return["label","button"].indexOf(this.name)!==-1?this.textWidth():10},i.prototype.minHeight=function(){return["label","button"].indexOf(this.name)!==-1?this.lh+2*this.padding+2*this.bs:["mtooltip","text_view","sticky"].indexOf(this.name)!==-1?this.textHeight():10},i.prototype.initialWidth=function(){return["label"].indexOf(this.name)!==-1?this.textWidth():null},i.prototype.initialHeight=function(){return["mtooltip","text_view"].indexOf(this.name)!==-1?this.textHeight():null},i.prototype.updateSideline=function(t,e){if(20!==this.slt||50!==this.slw)return this.slt=this.initialSlt-e,this.slw=this.initialSlw+(this.initialL>160?t:0-t),this.slw<20?this.slw=20:void 0},i.prototype.clipType=function(){var t;return this.clip?(t=/(.*?)\(/.exec(this.clip)[1],t.charAt(0).toUpperCase()+t.slice(1)):null},i.prototype.clipPolygonPoints=function(){var t,e,i,n,r;for(n=this.clip.split(","),r=[],t=0,e=n.length;t100-n&&(t.top=100-n),t.top100-i&&(t.left=100-i),t.leftt.h()-t.dH()/2},i.prototype.get_icon=function(t,e){var i,n,r,o,s,a,c;return c=/^(fa|md|mb|ci)\-/,n=c.test(this.icon),r=(this.icon||"").replace(c,""),s=n?this.icon.split("-")[0]:"fa",a="mb"===s?"icon":s,o=a+"-"+r,i=s+" "+o,!MB.isPhantom()&&t&&"fa-spinner"===o&&(i+=" is-spinning"),''+("md"===s?r:"")+""},i.additionalSize=function(t,e,i){var n,r,o;return o=100,n=i+e,r=200,this.each(function(o){var s,a,c;if("sticky"===o.name&&(a=o.l(),c=o.r(),i=o.b(),s=c>0?c-t:a,Math.abs(s)>r&&(r=Math.abs(s)),i+2*e>n))return n=i+2*e}),r+=o,r*=2,[n,r]},i}(Spine.Model)}.call(this),function(){var t=function(t,i){function n(){this.constructor=t}for(var r in i)e.call(i,r)&&(t[r]=i[r]);return n.prototype=i.prototype,t.prototype=new n,t.__super__=i.prototype,t},e={}.hasOwnProperty;this.Widgetstate=function(e){function i(){return i.__super__.constructor.apply(this,arguments)}return t(i,e),i.configure("Widgetstate","screen_cid","name","text","icon","top","left","width","height","cid","fs","br","bs","is","ha","va","image","z","th","lh","o","ds","sc","bg","tc","bc","bo","i","td","f","ts","tsc","p","destroyed","ro","gid","timestamp","padding","ls","checked","numeric","tt_placement","tt_offset","tt_arrow_size","v","fixed","fixed_type","ani_name","ani_delay","ani_count","ani_duration","screenstate_cid","widget_cid","input_type","slt","slw","clip","filter","locked"),i.include(Spine.Model.Dirty),i.extend(Spine.Model.Ajax),i.serverCount=function(){return this.records.reduce(function(t,e){return t+="d"!==e.screenstate_cid[0]?1:0},0)},i.prototype.load=function(t){if(i.__super__.load.call(this,t),"default"!==this.screenstate_cid&&(this.screen_cid=null),"label"===this.name&&/\n/.test(this.text))return this.name="text_view",this.lsave()},i}(Widget)}.call(this),function(){var t,e,i;t={},MB.v.multiline=function(t){var e,i,n,r,o;if(/^\/.test(t))return e=t;for(e="",r=t.split(/\n/),i=0,n=r.length;i"+o+"
";return e},t.text_field=t.navigation_bar=function(t){return''+t.text+""},t.mtext_input=function(t,e){var i;return i=/p$/.test(e)?"":'readonly="readonly"','"},t.mtextarea=function(t,e){var i,n,r,o;return i=/p$/.test(e)?"":'readonly="readonly"',n=Math.round(t.padding*MB.scale()/100),o=Math.round(n-(t.lh-t.fs)/2),o<0&&(o=0),r="padding:"+o+"px "+n+"px;",'"},t.mcheckbox2=function(t){var e;return e=t.checked?'checked="true"':"",'"},t.mfile_input=function(t,e){var i;return i=/p$/.test(e)?"onclick='MB.config.fileSelecting = true;'":"",'"},t.mradiobutton=function(t){var e;return e=t.checked?'checked="true"':"",'"},t.mselect=function(t){var e,i;return i=function(){var i,n,r,o;for(r=t.text.split(/\n/),o=[],i=0,n=r.length;i"+e+"");return o}().join(""),""},t.button=function(t){return"\n "+(t.icon?t.get_icon(!0,"font-size:"+t.iS()+"px;"):"")+'\n '+t.text+"\n
"},t.hr=function(t){var e;return e=t.h()-10*MB.scale()/100,e<1&&(e=1),''},t.ve=function(t){var e;return e=t.w()-10*MB.scale()/100,e<1&&(e=1),''},t.triangleb=function(t){var e;return e="border-left-width:"+t.w()/2+"px;border-right-width:"+t.w()/2+"px;border-bottom-width:"+t.h()+"px;border-bottom-color:"+(t.tc||"#e5e5e5")+";",''},t.triangletl=function(t){var e;return e="border-top-width:"+t.h()+"px;border-right-width:"+t.w()+"px;border-top-color:"+(t.tc||"#e5e5e5")+";",''},t.lr=t.tab_bar=t.rectangle=function(){return""},t.image_view=function(t){var e,i,n,r,o,s;return n=t.p?"auto":"100%",o="",t.image&&("i"===t.image[0]&&t.image.indexOf("images")===-1?(e=Asset.find(t.image),e&&(e.raw||e.image)&&(o="src='"+(e.image||e.raw)+"'")):o="src='"+t.image+"'"),o?(r="none",i="block"):(i="none",r="flex"),s="height:"+n+";display:"+i+";",t.filter.trim()&&(s+="filter:"+t.filter.trim()+";-webkit-filter:"+t.filter.trim()+";"),'\n'},t.webpage=function(t){return''+t.text+'\n'+I18N.https_only+'
\n'},t.video_view=function(){return''},t.keyboard=function(t){var e,i,n,r;return e=MB.project().device,r=t.numeric?"n":"r",i=t.cs().orientation,n="images/keyboards/"+e+"_"+r+"_"+i+".png",'
'},t.map_view=function(){return'\n
+')
\n
'},t.search_bar=function(t,e){var i,n;return n=t.th&&"light"!==t.th?"style='background-color:"+MB.themes[t.th][2]+";'":"",i=/p$/.test(e)?"":'readonly="readonly"','\n \n
\n'},t.status_bar=function(t){var e,i;return t.tc?(i="background-color:"+t.tc+";",e="border-color:"+t.tc+";"):i=e="",'\n\n '+t.text+'\n
\n\n 12:00 AM\n
\n\n'},t["switch"]=function(){return'\n'},t.tab_item=function(e){return'\n '+t.icon_button(e)+'\n '+e.text+"\n
"},t.pg=function(t){var e,i;return i=Link.find(t.gid),e=i?i.gesture:"tap",''},t.icon_button=function(t,e){var i;return i="font-size:"+t.iS()+"px;",t.get_icon(e,i)},t.label=function(t){var e;return e=t.text,//.test(t.text)||(e="
"+e+"
"),e},t.circle_rect=t.rounded_rect=t.text_view=function(t){var e;return e="padding: "+t.paddingS()+"px;",t.text&&"middle"===t.va&&(e+="margin-top: "+(0-t.textHeightS()/2)+"px;"),''+MB.v.multiline(t.text)+"
"},i=function(t){var e,i,n;i="";for(e in t)n=t[e],i+=e+":"+n+";";return i},t.sticky=function(t){var e,n,r,o,s,a,c,l,u;return o=t.l()<160,r=t.bg,l=t.slt,t.slt<20?l=20:t.slt>t.height-20&&(l=t.height-20),a=(t.slt-l)*t.s()/100,n={top:(t.slt<=t.top-20?a:"")+"px",height:Math.abs(a)+"px"},s={top:a+"px"},c={top:l*t.s()/100+"px",width:t.slw*t.s()/100+"px","border-color":r},e={left:(o?"100%":"")+"px",right:(o?"":"100%")+"px","background-color":r,cursor:"pointer"},u={"background-image":"linear-gradient(135deg, "+r+" 25%, transparent 25%, transparent 100%), linear-gradient(45deg, transparent 75%, "+r+" 75%, "+r+" 100%)"},''+MB.v.multiline(t.text)+'
\n\n'},MB.stickyHTML=t.sticky,t.mtooltip=function(t){var e,i,n,r;return e={top:"border-bottom-color",bottom:"border-top-color",left:"border-right-color",right:"border-left-color"},i=e[t.tt_placement],n="top"===t.tt_placement||"bottom"===t.tt_placement?"left:"+t.ttOffset()+"px":"top:"+t.ttOffset()+"px",r="padding: "+t.paddingS()+"px;",t.text&&"middle"===t.va&&(r+="margin-top: "+(0-t.textHeightS()/2)+"px;"),'\n\n'+MB.v.multiline(t.text)+"
"},MB.l.getMaterialShadow=function(t,e){var i,n,r;return i=t>15?(15+t)/100:(12+3*t)/100,n=(23+t)/100,r="0 "+t+"px "+2*t+"px rgba("+e.r+","+e.g+","+e.b+","+i+"), 0 "+2*t+"px "+2*t+"px rgba("+e.r+","+e.g+","+e.b+","+n+")"},MB.widgetStyle=function(t,e){var i,n,r,o,s,a,c,l,u,d,h,p;return null==e&&(e=""),n=t.inspectables(),d=[]," "!==t.zoomable&&(h=t.w(),o=t.h(),"mtooltip"===t.name&&("top"===t.tt_placement||"bottom"===t.tt_placement?o-=t.arrowSize():h-=t.arrowSize()),t.isFullWidth()||d.push("width:"+h+"px"),d.push("height:"+o+"px")),"mtooltip"===t.name&&(a=function(){var e,i,n,o;for(n=["top","right","bottom","left"],o=[],e=0,i=n.length;e0&&(u=MB.currentProject.isAndroid()?MB.l.getMaterialShadow(t.ds,MB.hex2rgb(t.sc)):"0 0 "+t.ds+"px "+t.sc,"icon_button"===t.name?d.push("text-shadow: "+u):d.push("box-shadow: "+u)),t.ts>0&&d.push("text-shadow: 0 0 "+t.ts+"px "+t.tsc),n.indexOf("ro")!==-1&&(d.push("transform: rotate("+t.ro+"deg)"),d.push("-webkit-transform: rotate("+t.ro+"deg)")),t.clip&&n.indexOf("clip")!==-1&&(d.push("clip-path: "+t.clip),d.push("-webkit-clip-path: "+t.clip)),n.indexOf("fs")!==-1&&t.fS()>0&&d.push("font-size:"+t.fS()+"px"),n.indexOf("padding")!==-1&&"mtextarea"!==t.name&&d.push("padding:"+t.paddingS()+"px"),n.indexOf("br")!==-1&&d.push("border-radius:"+t.bR()+"px"),n.indexOf("bs")!==-1&&d.push("border-width:"+t.bS()+"px"),n.indexOf("ls")!==-1&&d.push("border-style:"+t.lineStyle()),n.indexOf("ha")!==-1&&"label"!==t.name&&d.push("text-align:"+t.ha),n.indexOf("lh")!==-1&&d.push("line-height:"+t.lH()+"px"),d.push("font-weight:"+(t.bo?"bold":"normal")),d.push("font-style:"+(t.i?"italic":"normal")),"label"===t.name&&(s={left:"flex-start",center:"center",right:"flex-end"}[t.ha],i={top:"flex-start",middle:"center",bottom:"flex-end"}[t.va],d.push("justify-content: "+s),d.push("align-items: "+i)),!MB.isPhantom()&&"none"!==t.ani_name&&e&&(t.ani_delay&&"0"!==t.ani_delay&&d.push("animation-delay: "+t.ani_delay),d.push("animation-iteration-count: "+t.ani_count),t.ani_duration&&"0"!==t.ani_duration&&d.push("animation-duration: "+t.ani_duration)),p=t.fixed&&t.v?Widget.MAXZ+t.z:t.z,t.v?(l="auto",c=n.indexOf("o")!==-1?t.o/100:"",t.fixed&&/(p|pgh|pgf)$/.test(e)&&(c=0)):e?(l="none",c=0):c=.4,d.push("z-index:"+p),""!==c&&d.push("opacity:"+c),d.push("pointer-events:"+l),d},MB.widgetClassName=function(t,e){var i,n;return null==e&&(e=""),i="widget "+t.name,t.inspectables().indexOf("va")!==-1&&(i+=" v"+t.va),"normal"!==t.td&&(i+=" td"+t.td),"pg"===t.name&&(i+=" s"+t.icon),"switch"===t.name&&t.checked&&(i+=" checked"),e&&(n=Link.find(t.gid))&&t.v&&(i+=" clickable"),!MB.isPhantom()&&"none"!==t.ani_name&&e&&t.v&&(i+=" animated "+t.ani_name),i},MB.widget=function(e,i){var n,r,o,s,a,c;return null==i&&(i=""),n=MB.widgetClassName(e,i),c=MB.widgetStyle(e,i),i&&(o=Link.find(e.gid))&&e.v&&(s=o.cid,r="tap"!==o.gesture?o.gesture:"",a=""),'\n '+t[e.name](e,i)+"\n "+(a||"")+"\n
"},MB.PanelState=function(t,e,i){var n,r,o,s,a,c,l,u,d;for(s=e?"state"+t.panel_cid+t.cid+"p":"state"+t.panel_cid+t.cid,r=e?"pstate state":"state",i&&(r+=" active"),n=t.bgimage?"background-image:url("+t.getRealBgImage()+");":"",l=e?"p":"",o="",u=t.cwidgets(),a=0,c=u.length;a"},e=function(t,e){var i,n,r,o;return o=t.fixed&&t.v?Widget.MAXZ+t.z:t.z,n=t.v?t.fixed&&e?0:1:e?0:.4,r="top:"+t.t()+"px;left:"+t.l()+"px;width:"+t.w()+"px;height:"+t.h()+"px;z-index:"+o+";opacity:"+n+";",!MB.isPhantom()&&e||(r+="overflow:hidden;"),e&&(i=t.mainState(),(t.w()\n '+I18N.dblclick_to_edit+"
\n "+function(){var e,n,r,o;for(r=t.states(),o=[],e=0,n=r.length;e"},MB.PanelPreview=function(t){var i,n,r,o,s,a,c,l;return l=e(t,!0),i="ppanel panel",(o=Link.find(t.gid))&&t.v?(i+=" clickable",s=o.cid,r="tap"!==o.gesture?o.gesture:"",a=""):(n="",s=null,a=""),c=t.mainState(),c.panel_cid=t.cid,'\n
\n '+MB.PanelState(c,!0,!0)+"\n "+a+"\n
"},MB.PanelProjectFlow=function(t){return'\n '+MB.PanelState(t.mainState(),!0,!0)+"\n
"}}.call(this),function(){this.AutoSaver=function(){function t(){$("body").on("queue:add",function(t){return function(e,i,n){return t.add(i,n)}}(this)),$("body").on("queue:save",function(t){return function(){return t.save()}}(this)),this.queue=[],this.setup(),setInterval(function(t){return function(){return t.save(),MB.refreshCoWorkers&&MB.refreshCoWorkers()}}(this),2e4)}return t.prototype.add=function(t,e){var i,n,r,o;for(o=this.queue,n=0,r=o.length;n0&&(t.constructor===Widget?(s="Widget",e=Widget.find(t.cid)?"update":"destroy"):t.constructor===Widgetstate?"default"===t.screenstate_cid?(s="Widget",t=Widget.find(t.widget_cid),t&&(e="update")):(s="Widgetstate",e="update"):t.constructor===Link?(s="Link",e=Link.find(t.cid)?"update":"destroy"):t.constructor===Screen?(s="Screen",e=Screen.find(t.cid)?"update":"destroy"):t.constructor===Screenstate?(s="Screenstate",e=Screenstate.find(t.cid)?"update":"destroy"):t.constructor===Panel?(s="Panel",e=Panel.find(t.cid)?"update":"destroy"):t.constructor===Panelstate&&("default"===t.screenstate_cid?(s="Panel",t=Panel.find(t.panel_cid),t&&(e="update")):(s="Panelstate",e="update")),e))))return"Panel"===s&&(o=Template.find(t.template_cid),o&&(n={template_token:o.access_token})),MB.pusher.pusher.send({data:{event:"collaboration",action:e,t:s,from:{id:MB.user.id,name:MB.user.name,avatar:MB.user.avatar},to:r.cid,object:t,extras:n},expiration_interval:60,channels:i})},t.prototype.setup=function(){return MB.myXhr=$.ajaxSettings.xhr(),MB.myXhr.upload&&MB.myXhr.upload.addEventListener("progress",function(t){return function(e){var i,n;if(i=Math.floor(100*e.loaded/e.total),100!==i)return n="("+i+"% "+t.queue.length+" "+I18N.unsaved+")",$("#last_saved .progress").text(n)}}(this),!1),$.ajaxSettings.xhr=function(){return MB.myXhr},$.ajaxSetup({timeout:6e4}),window.onbeforeunload=function(t){return function(){var e;if(t.queue.length)return MB.isElectron()?(e=MB.confirm({title:I18N.warning,desc:I18N.data_lost_warning}),!e||void 0):I18N.data_lost_warning}}(this),window.onerror=function(t,e,i,n,r){var o,s;if(!MB.config.ignoreError.test(t)&&r&&r.stack)return o=(MB.currentProject||{cid:"none"}).cid,s=(MB.currentScreen||{cid:"none"}).cid,console.error(r)},$(document).on("ajaxComplete",function(t){return function(e,i,n){var r,o;if(t.resetReloadTimer(),200===i.status||422===i.status){if(!i.responseJSON||!i.responseJSON.cid)return;return(o=MB.currentProject)&&(o.updated_at=(new Date).toISOString(),o.lsave(!1)),t.queue[0]&&(t.queue[0].saving=!1,r=t.queue.shift(),t.pushObject(r),MB.setSaveQueue&&MB.setSaveQueue()),t.save()}if(0===i.status?($.fn.modal&&$("#timeout_modal").modal({backdrop:"static"}),$.ajaxSettings.timeout<12e4&&$.ajaxSetup({timeout:2*$.ajaxSettings.timeout}),MB.ga("send","event","saving","saving timeout",n.url+"("+n.type+")("+n.data+")("+MB.user.email+")")):(MB.alert({desc:I18N.unknown_error.replace(/%s/i,i.status),isHTML:!0}).then(function(){return location.reload()}),MB.ga("send","event","saving","saving error: "+i.status,i.status+": "+n.url+"("+n.type+")("+n.data+")("+MB.user.email+")")),t.queue[0])return MB.setSaving&&MB.setSaving(!1),t.queue[0].saving=!1}}(this))},t.prototype.resetReloadTimer=function(){return this.timer&&clearTimeout(this.timer),this.timer=setTimeout(function(){return MB.alert({desc:I18N.new_version_detected,isHTML:!0}).then(function(){return location.reload()})},216e5)},t}()}.call(this),function(){this.WidgetManager=function(){function t(){var t;t=$("#design"),t.on("mousedown","#canvas input",function(t){return t.preventDefault()}),t.on("click","#canvas input",function(t){return t.preventDefault()}),t.on("mousedown","#canvas select",function(t){return t.preventDefault()}),t.on("mousedown","#canvas textarea",function(t){return t.preventDefault()}),$(document).on("selectionchange",function(){if(MB.selection.editing&&MB.selection.editing.richedit)return MB.renderNewDesign()})}return t.select=function(t){var e,i;if(!$("#text_editor").length)return t.preventDefault(),t.stopPropagation(),e=$(t.target).closest(".widget").attr("data-cid"),i=Widget.find(e),t.shiftKey?$("body").trigger("selection:append",[i]):t.ctrlKey||t.metaKey?MB.penetrateSelect(t,i.cid):($("body").trigger("selection:clear"),$("body").trigger("selection:select",[[i]]))},t.remove=function(t){var e;return $("#widget"+t).remove(),Widget.exists(t)&&(e=Widget.find(t),e.ldestroy()),$("#design").trigger("slider:update")},t.update=function(t,e){var i;if(null==e&&(e=""),i=document.getElementById("widget"+t.cid+e))return i.outerHTML=MB.widget(t,e),i=document.getElementById("widget"+t.cid+e),"sticky"===t.name?this.renderSticky(t,i,e):void 0},t.updateClipPath=function(t){var e;return e=document.getElementById("widget"+t.cid),e.style.clipPath=e.style.webkitClipPath=t.clip},t.renderOutline=function(t){var e;if(e=document.getElementById("widget"+t.cid))return"number"==typeof t.left&&(e.style.left=t.l()+"px"),"number"==typeof t.top?e.style.top=t.t()+"px":void 0},t.newImageView=function(t,e,i,n){var r,o,s,a;return a=t.width,r=t.height,a>n.width&&(r=Math.round(r*(n.width/a)),a=n.width),o="image_view",s=new Widget({name:o,width:a,height:r,bs:MB.COMPONENTS[o].bs,br:MB.COMPONENTS[o].br,image:t.cid,screen_cid:n.cid,cid:"w"+Math.uuid(10,16)+(new Date).valueOf(),z:Math.max(n.maxZ(),MB.COMPONENTS.image_view.z)}),s.setL(e),s.setT(i),$("#canvas").append(MB.widget(s)),s.lsave(),s},t.renderText=function(t,e){var i;if(e&&(i=e.getElementsByClassName("text")[0]))return t.richedit?i.innerHTML=MB.v.multiline(t.text):i.innerHTML=""+t.text},t.renderExtras=function(t,e,i){var n;if(e)return n="_render_"+t.name,"function"==typeof this[n]?this[n](t,e,i):void 0},t._render_label=function(t,e){var i;return i=t.text,//.test(t.text)||(i="
"+i+"
"),e.innerHTML=i},t._render_text_align=function(t,e){var i;return e.className=e.className.replace(/v(middle|top|bottom)/,"v"+t.va),i=e.getElementsByClassName("text")[0],"middle"===t.va?i.style.marginTop=0-t.textHeightS()/2+"px":i.style.marginTop="0px"},t._render_text_view=function(t,e){var i;return e.style.clipPath=t.clip,e.style.webkitClipPath=t.clip,i=e.getElementsByClassName("text")[0],i.style.padding=t.paddingS()+"px",this._render_text_align(t,e)},t._render_rounded_rect=function(t,e){if(t.text)return this._render_text_align(t,e)},t._render_circle_rect=function(t,e){if(t.text)return this._render_text_align(t,e)},t._render_hr=function(t,e){var i,n;return n=e.getElementsByTagName("span")[0],i=t.h()-10*MB.scale()/100,i<1&&(i=1),n.style.borderTopWidth=i+"px"},t._render_ve=function(t,e){var i,n;return n=e.getElementsByTagName("span")[0],i=t.w()-10*MB.scale()/100,i<1&&(i=1),n.style.borderLeftWidth=i+"px"},t._render_triangleb=function(t,e){var i;return i=e.getElementsByTagName("span")[0],i.style.borderLeftWidth=t.w()/2+"px",i.style.borderRightWidth=t.w()/2+"px",i.style.borderBottomWidth=t.h()+"px",i.style.borderBottomColor=t.tc||$(e).css("color")},t._render_triangletl=function(t,e){var i;return i=e.getElementsByTagName("span")[0],i.style.borderTopWidth=t.h()+"px",i.style.borderRightWidth=t.w()+"px",i.style.borderTopColor=t.tc||$(e).css("color")},t._render_status_bar=function(t,e){var i,n,r,o,s,a,c;for(n=e.getElementsByClassName("body")[0],s=e.getElementsByClassName("inner")[0],r=e.getElementsByClassName("head")[0],c=e.getElementsByClassName("ball"),o=0,a=c.length;o"+i+"");return o}().join(""),e.innerHTML=""},t._render_sticky=function(e,i){return t.renderSticky(e,i,"p")},t.design=function(t,e){var i;if(null==e&&(e=""),i=document.getElementById("widget"+t.cid+e))return"sticky"===t.name?this.renderSticky(t,i,e):void 0},t.renderSticky=function(e,i,n){var r,o,s,a,c,l,u,d;if(o=i.className.replace(/(t|b|l|r)sticky/g,""),s=e.l()>160?" rsticky":" lsticky",e.slt<20?s+=" tsticky":e.slt>e.height-20&&(s+=" bsticky"),i.className=o.replace("sticky","sticky"+s),i.innerHTML=MB.stickyHTML(e),"p"===n&&20===e.slt&&50===e.slw&&$(i).find(".sideline").css("display","none"),!/p$/.test(n)&&(a=$(i).find(".sideline"),r=$(i).find(".arrow"),!r.hasClass("ui-draggable")))return r.on("click",function(t){return t.stopPropagation()}),c=l=null,u=d=0,r.draggable({scroll:!1,start:function(t){return a.css("opacity","1"),e=Widget.find(e.cid),c=e.slt,l=e.slw,u=t.pageX,d=t.pageY},drag:function(n){var r,o;return o=(n.pageY-d)/MB.scale()*100,r=(n.pageX-u)/MB.scale()*100,e.slt=c+o+6,e.l()>160?e.slw=l-r:e.slw=l+r,e.slw<20&&(e.slw=20),t.renderSticky(e,i)},stop:function(){return a.css("opacity",""),c=e.slt,l=e.slw,e.lsave()}})},t.transform=function(t,e,i,n){var r,o;if(n.className=MB.widgetClassName(i,"p").replace("animated",""),o=n.style,e.fs!==i.fs&&(o.fontSize=i.fS()+"px"),e.bs!==i.bs&&(o.borderWidth=i.bs+"px"),e.br!==i.br&&(o.borderRadius=i.bR()+"px"),e.lh!==i.lh&&(o.lineHeight=i.lH()+"px"),e.padding!==i.padding&&(o.padding=i.paddingS()+"px"),i.bg!==e.bg&&(o.backgroundColor=i.bg),i.tc!==e.tc&&(o.color=i.tc),i.bc!==e.bc&&(o.borderColor=i.bc),i.ls!==e.ls&&(o.borderStyle=i.lineStyle()),i.bo!==e.bo&&(o.fontWeight=i.bo?"bold":"normal"),i.i!==e.i&&(o.fontStyle=i.i?"italic":"normal"),i.ds===e.ds&&i.sc===e.sc||(r=MB.currentProject.isAndroid()?MB.l.getMaterialShadow(i.ds,MB.hex2rgb(i.sc)):"0 0 "+i.ds+"px "+i.sc,"icon_button"!==i.name?o.boxShadow=r:o.textShadow=r),i.ts===e.ts&&i.tsc===e.tsc||(o.textShadow="0 0 "+i.ts+"px "+i.tsc),"label"===i.name&&(i.ha!==e.ha&&(o.justifyContent={left:"flex-start",center:"center",right:"flex-end"}[i.ha]),i.va!==e.va&&(o.alignItems={top:"flex-start",middle:"center",bottom:"flex-end"}[i.va])),MB.isPhantom()||"none"===i.ani_name||("0"!==i.ani_delay&&(o.animationDelay=i.ani_delay),o.animationIterationCount=i.ani_count,"0"!==i.ani_duration&&(o.animationDuration=i.ani_duration)),i.ro!==e.ro)return o.transform="rotate("+i.ro+"deg)"},t}()}.call(this),function(){var t=[].indexOf||function(t){for(var e=0,i=this.length;e=0?(e.parent_cid=null,o.push(e.lsave())):(e=n,o.push(i.push(e.cid)));return o},e.append=function(t,e){var i,n,r,o,s;if(s=MB.currentScreen){for(o=s.citems(),n=0,r=o.length;ne)return void("panel"===i.name?$("#panel"+i.cid).before(t):$("#widget"+i.cid).before(t));return $("#canvas").append(t)}},e.appendPanel=function(t){return this.append(MB.Panel(t),t.timestamp)},e.appendWidget=function(t){return this.append(MB.widget(t),t.timestamp)},e.activate=function(t){return MB.action("rightnav:activate:screen",{cid:t.cid}),MB.currentScreen=t,MB.selection.clear(),MB.renderFEScreen(),$("#canvas").html(""),t.setState("default"),this.render(t),$("#text_editor").remove(),e.resetPosition(),setTimeout(function(){return MB.linkCaches={},MB.renderLinks()})},e.render=function(t){var e,i,n,r,o,s,a,c,l,u;for(i="",e=[],c=t.citems(),r=0,s=c.length;rn&&$("#simulator-wrapper").outerHeight(a),t+s>r?($("#simulator-wrapper").outerWidth(t+s),c=(t-r+s)/2):($("#simulator-wrapper").css("width",""),s=r-t,c=0),$("#simulator-container")[0].scrollLeft=c,s/2},t.prototype.setOrientation=function(t,e,i){var n,r,o;if(Screen.exists(t))return o=Screen.find(t),r=o.orient(),n=$("#simulator"),n.hasClass(r)&&"immersive"!==this.mode||(n.removeClass("portrait landscape"),n.addClass(r),this.prepareOrientation(o),this.hideActive(),this.clearCanvas(),e="none"),i&&"default"!==o.state_cid&&this.resetScreen(t),e},t.prototype.hideActive=function(){var t;return t=$(".pcanvas.active").data("cid"),$(".pcanvas.active").hide()},t.prototype.resetScreen=function(t){return $("#pscreen"+t+" .scontainer").html(''),$("#pscreen"+t+" .stickies").html(""),setTimeout(function(){return $("#pscreen"+t+" .widgets")[0].scrollTop=0},100)},t.prototype.clearCanvas=function(){var t,e,i,n,r;for($(".scontainer").html(''),$(".stickies").html(""),$("#gh").html(""),$("#gf").html(""),$("#gs").html(""),n=$(".pcanvas .widgets"),r=[],e=0,i=n.length;e=s&&u .sheader").css("height",u)),e!==c&&($("#gf").css("height",c),$(".pcanvas.active .scontainer > .sfooter").css("height",c)),s=d.sort(function(t,e){return t[1].timestamp-e[1].timestamp}),p=0,m=s.length;p0)||g.targetstate_cid&&g.sourcestate_cid!==b.screenstate_cid?M.push(void 0):M.push(t.pageTimer(g))):M.push($(n).removeClass("clickable"));return M}}(this),0),l=1e3*(parseFloat(t.ani_duration)+parseFloat(t.ani_delay||"0")),this.timeoutBucket.setTimeout("stateTimer2",function(e){return function(){var i,n,a,c,l,u,d,h,p,f,g,m,v;for(d=r.headerHeight(),c=r.footerHeight(),v=s.concat(o),p=0,f=v.length;p=d&&u&&(u.remove(),u=null,$(n).show()),i=g.t()+g.h(),l=0===r.footerHeight()?Number.MAX_VALUE:Math.floor(r.h()-r.footerHeight()),i>=l?(a||(a=$(n).clone()[0],a.id=a.id+"gf",$("#gf")[0].appendChild(a)),$(a).disableTransition(function(){return $(a).enableTransition(),a.style.top=g.t()-l+"px"})):i"))},t.prototype.setupPanelLinks=function(t){var e,i,n,r,o,s,a,c,l,u,d,h,p,f;for(u=Link.findAllByAttribute("screen_cid",t.data("cid")),i=0,o=u.length;i .sheader").css("height",h),$(".pcanvas.active .scontainer > .sfooter").css("height",a),$("#gs").html(this.pages[t.cid].sbHTML),this.pages[t.cid].sbHTML&&$("#gh, #gf").addClass("sb"),c=0===a?Number.MAX_VALUE:Math.floor(t.h()-a),d=document.createDocumentFragment(),u=document.createDocumentFragment(),l=document.createDocumentFragment(),g=function(){var e,i,n,r;for(n=t.citems(),r=[],e=0,i=n.length;e=c&&B$(window).width()?($("#gs .status_bar").addClass("standalone"),e=t.sb(),!e||e.th&&"light"!==e.th||$("#gs .status_bar").addClass("light")):($("#gs .status_bar").removeClass("standalone"),$("#gs .status_bar").removeClass("light")),MB.isIOS9()&&this.runnerUtil.deviceOrient()===t.orient())?(this.scale<1&&(this.scale=1),i=MB.COMPONENTS.status_bar.height,$("#app").css({position:"absolute",height:($(window).height()+i)/this.scale,top:0-i/this.scale,bottom:0})):void 0},t.prototype.setupPG=function(){var t;return this.hammertime=new i.Hammer($("#app")[0],{touchAction:"auto",inputClass:MB.isMobile()?i.Hammer.TouchInput:null}),this.hammertime.get("swipe").set({direction:i.Hammer.DIRECTION_ALL,velocity:.05,threshold:50}),this.hammertime.on("swipeleft",function(t){return function(e){return setTimeout(function(){return t.pj(e,"left")})}}(this)),this.hammertime.on("swiperight",function(t){return function(e){return setTimeout(function(){return t.pj(e,"right")})}}(this)),this.hammertime.on("swipeup",function(t){return function(e){return setTimeout(function(){return t.pj(e,"up")})}}(this)),this.hammertime.on("swipedown",function(t){return function(e){return setTimeout(function(){return t.pj(e,"down")})}}(this)),this.hammertime.on("press",function(t){return function(e){return setTimeout(function(){return t.pj(e,"hold")})}}(this)),this.hammertime.on("tap",function(t){return function(e){var i;if(1===e.tapCount){if(i=$(e.target).closest(".widget"),i.hasClass("switch"))return i.toggleClass("checked"),void setTimeout(function(){if(i.hasClass("clickable"))return t.pj(e,"tap")},250);setTimeout(function(){return t.pj(e,"tap")})}if(2===e.tapCount)return t.eventBucket.resetCoolDown(),t.hightTimer&&clearTimeout(t.hightTimer),setTimeout(function(){return t.pj(e,"dtap")})}}(this)),t=new Shake({threshold:15}),t.start(),window.addEventListener("shake",function(t){return function(e){return setTimeout(function(){return t.pj(e,"shake")})}}(this),!1),$("#sticky-container").on("click",".sticky",function(t){return function(e){return t.pj(e,"tap")}}(this))},t.prototype.setupPageGesture=function(t){var e,i,n,r,o,s;for(e=[],o=t.clinks(),i=0,r=o.length;i0&&this.panelTimer(a,t);for(l=Link.findAllByAttribute("state_cid",e.cid),u=[],r=0,s=l.length;r0&&u.push(this.pageTimer(a));return u}},t.prototype.setupPageTimers=function(t,e){var i,n,r,o,s,a,c,l,u,d;if(null==e&&(e="default"),!MB.isPhantom()){for(this.timeoutBucket.clear(),l=t.cwidgets(),n=0,s=l.length;n0&&(!o.targetstate_cid||o.sourcestate_cid===e)&&this.pageTimer(o);for(u=t.cpanels(),d=[],r=0,a=u.length;r500?MB.ga("send","event","performance","render("+(r-m)+")("+t.cid+")("+MB.project().model+")("+navigator.userAgent+")"):void 0}},t}(),this.DesignerRunner=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return r(e,t),e.prototype.render=function(t,e){return this.project=Project.find(t)||Template.find(t)||Combo.find(t),this.project?($("body").data("scale",this.project.scale),this.home=Screen.find(e),this.home.setState("default",!0),this.project.orientation=this.home.orientation,this.init()):MB.webpackInterface.navigateTo("/workspace/apps")},e}(e),this.SharingRunner=function(t){function e(t){this.project=t,e.__super__.constructor.apply(this,arguments),MB.isIOS()&&this.disableRubberBand()}return r(e,t),e.prototype.disableRubberBand=function(){return document.body.ontouchstart=function(t){return function(e){return t.touchStartY=e.touches[0].screenY}}(this),document.body.ontouchmove=function(t){return function(e){var i;if(!$(e.target).closest(".ppanel").length)return i=$(e.target).closest(".widgets")[0],!i||e.touches[0].screenY>t.touchStartY&&0===i.scrollTop||e.touches[0].screenY