You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

8 lines
235 KiB

!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('<form method="post" action="'+r+'"></form>'),u='<input name="_method" value="'+o+'" type="hidden" />';c===e||a===e||i.isCrossDomain(r)||(u+='<input name="'+c+'" value="'+a+'" type="hidden" />'),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('<div class="modal-backdrop '+i+'" />').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:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',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-c<g?"right":r,n.removeClass(d).addClass(r)}var m=this.getCalculatedOffset(r,a,c,l);this.applyPlacement(m,r),this.hoverState=null;var v=function(){i.$element.trigger("shown.bs."+i.type)};t.support.transition&&this.$tip.hasClass("fade")?n.one(t.support.transition.end,v).emulateTransitionEnd(150):v()}},e.prototype.applyPlacement=function(e,i){var n,r=this.tip(),o=r[0].offsetWidth,s=r[0].offsetHeight,a=parseInt(r.css("margin-top"),10),c=parseInt(r.css("margin-left"),10);isNaN(a)&&(a=0),isNaN(c)&&(c=0),e.top=e.top+a,e.left=e.left+c,t.offset.setOffset(r[0],t.extend({using:function(t){r.css({top:Math.round(t.top),left:Math.round(t.left)})}},e),0),r.addClass("in");var l=r[0].offsetWidth,u=r[0].offsetHeight;if("top"==i&&u!=s&&(n=!0,e.top=e.top+s-u),/bottom|top/.test(i)){var d=0;e.left<0&&(d=e.left*-2,e.left=0,r.offset(e),l=r[0].offsetWidth,u=r[0].offsetHeight),this.replaceArrow(d-o+l,l,"left")}else this.replaceArrow(u-s,u,"top");n&&r.offset(e)},e.prototype.replaceArrow=function(t,e,i){this.arrow().css(i,t?50*(1-t/e)+"%":"")},e.prototype.setContent=function(){var t=this.tip(),e=this.getTitle();t.find(".tooltip-inner")[this.options.html?"html":"text"](e),t.removeClass("fade in top bottom left right")},e.prototype.hide=function(){function e(){"in"!=i.hoverState&&n.detach(),i.$element.trigger("hidden.bs."+i.type)}var i=this,n=this.tip(),r=t.Event("hide.bs."+this.type);if(this.$element.trigger(r),!r.isDefaultPrevented())return n.removeClass("in"),t.support.transition&&this.$tip.hasClass("fade")?n.one(t.support.transition.end,e).emulateTransitionEnd(150):e(),this.hoverState=null,this},e.prototype.fixTitle=function(){var t=this.$element;(t.attr("title")||"string"!=typeof t.attr("data-original-title"))&&t.attr("data-original-title",t.attr("title")||"").attr("title","")},e.prototype.hasContent=function(){return this.getTitle()},e.prototype.getPosition=function(){var e=this.$element[0];return t.extend({},"function"==typeof e.getBoundingClientRect?e.getBoundingClientRect():{width:e.offsetWidth,height:e.offsetHeight},this.$element.offset())},e.prototype.getCalculatedOffset=function(t,e,i,n){return"bottom"==t?{top:e.top+e.height,left:e.left+e.width/2-i/2}:"top"==t?{top:e.top-n,left:e.left+e.width/2-i/2}:"left"==t?{top:e.top+e.height/2-n/2,left:e.left-i}:{top:e.top+e.height/2-n/2,left:e.left+e.width}},e.prototype.getTitle=function(){var t,e=this.$element,i=this.options;return t=e.attr("data-original-title")||("function"==typeof i.title?i.title.call(e[0]):i.title)},e.prototype.tip=function(){return this.$tip=this.$tip||t(this.options.template)},e.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},e.prototype.validate=function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},e.prototype.enable=function(){this.enabled=!0},e.prototype.disable=function(){this.enabled=!1},e.prototype.toggleEnabled=function(){this.enabled=!this.enabled},e.prototype.toggle=function(e){var i=e?t(e.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type):this;i.tip().hasClass("in")?i.leave(i):i.enter(i)},e.prototype.destroy=function(){clearTimeout(this.timeout),this.hide().$element.off("."+this.type).removeData("bs."+this.type)};var i=t.fn.tooltip;t.fn.tooltip=function(i){return this.each(function(){var n=t(this),r=n.data("bs.tooltip"),o="object"==typeof i&&i;(r||"destroy"!=i)&&(r||n.data("bs.tooltip",r=new e(this,o)),"string"==typeof i&&r[i]())})},t.fn.tooltip.Constructor=e,t.fn.tooltip.noConflict=function(){return t.fn.tooltip=i,this}}(jQuery),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t("object"==typeof module&&"object"==typeof module.exports?require("jquery"):jQuery)}(function(t){function e(){var e=o.settings;if(e.autoDispose&&!t.contains(document.documentElement,this))return t(this).timeago("dispose"),this;var s=i(this);return isNaN(s.datetime)||(0==e.cutoff||Math.abs(r(s.datetime))<e.cutoff)&&t(this).text(n(s.datetime,t(this).attr("lang")?t(this).attr("lang"):o.settings.lang)),this}function i(e){if(e=t(e),!e.data("timeago")){e.data("timeago",{datetime:o.datetime(e)});var i=t.trim(e.text());o.settings.localeTitle?e.attr("title",e.data("timeago").datetime.toLocaleString()):!(i.length>0)||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<i;e++)if(e in this&&this[e]===t)return e;return-1},h=function(t,e){function i(){this.constructor=t}for(var n in e)p.call(e,n)&&(t[n]=e[n]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},p={}.hasOwnProperty,f=function(t,e){return function(){return t.apply(e,arguments)}};i={bind:function(t,e){var i,n,r,o,s;for(n=t.split(" "),this.hasOwnProperty("_callbacks")||this._callbacks||(this._callbacks={}),r=0,o=n.length;r<o;r++)s=n[r],(i=this._callbacks)[s]||(i[s]=[]),this._callbacks[s].push(e);return this},one:function(t,e){var i;return this.bind(t,i=function(){return this.unbind(t,i),e.apply(this,arguments)})},trigger:function(){var t,e,i,n,r,o,s;if(t=1<=arguments.length?u.call(arguments,0):[],i=t.shift(),o=null!=(s=this._callbacks)?s[i]:void 0){for(n=0,r=o.length;n<r&&(e=o[n],e.apply(this,t)!==!1);n++);return!0}},listenTo:function(t,e,i){return t.bind(e,i),this.listeningTo||(this.listeningTo=[]),this.listeningTo.push({obj:t,ev:e,callback:i}),this},listenToOnce:function(t,e,i){var n,r;return r=this.listeningToOnce||(this.listeningToOnce=[]),t.bind(e,n=function(){var o,s,a,c,l;for(s=-1,o=a=0,c=r.length;a<c;o=++a)l=r[o],l.obj===t&&l.ev===e&&l.callback===n&&(s=o);return t.unbind(e,n),s!==-1&&r.splice(s,1),i.apply(this,arguments)}),r.push({obj:t,ev:e,callback:n}),this},stopListening:function(e,i,n){var r,o,s,a,c,l,u,h,p,f,g,m,v,b,y,_,w,M;if(0===arguments.length){for(_=[this.listeningTo,this.listeningToOnce],c=0,h=_.length;c<h;c++)if(m=_[c],null!=m?m.length:void 0)for(l=0,p=m.length;l<p;l++)v=m[l],v.obj.unbind(v.ev,v.callback);this.listeningTo=void 0,this.listeningToOnce=void 0}else if(e)for(i=i?i.split(" "):[void 0],w=[this.listeningTo,this.listeningToOnce],u=0,f=w.length;u<f;u++)if(m=w[u])for(b=0,g=i.length;b<g;b++)for(o=i[b],a=y=M=m.length-1;M<=0?y<=0:y>=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;e<t;e++)r=s[e],r!==o&&i.push(r);return i}(),v.ev=t.trim(s.join(" ")),v.obj.unbind(o,v.callback))):(v.obj.unbind(v.ev,v.callback),a!==-1&&m.splice(a,1))));return this},unbind:function(t,e){var i,n,r,o,s,a,c,l,u,d;if(0===arguments.length)return this._callbacks={},this;if(!t)return this;for(n=t.split(" "),o=0,a=n.length;o<a;o++)if(u=n[o],l=null!=(d=this._callbacks)?d[u]:void 0)if(e){for(r=s=0,c=l.length;s<c;r=++s)if(i=l[r],i===e){l=l.slice(),l.splice(r,1),this._callbacks[u]=l;break}}else delete this._callbacks[u];return this}},i.on=i.bind,i.off=i.unbind,n={trace:!0,logPrefix:"(App)",log:function(){var t;if(t=1<=arguments.length?u.call(arguments,0):[],this.trace)return this.logPrefix&&t.unshift(this.logPrefix),"undefined"!=typeof console&&null!==console&&"function"==typeof console.log&&console.log.apply(console,t),this}},l=["included","extended"],o=function(){function t(){"function"==typeof this.init&&this.init.apply(this,arguments)}return t.include=function(t){var e,i,n;if(!t)throw new Error("include(obj) requires obj");for(e in t)n=t[e],d.call(l,e)<0&&(this.prototype[e]=n);return null!=(i=t.included)&&i.apply(this),this},t.extend=function(t){var e,i,n;if(!t)throw new Error("extend(obj) requires obj");for(e in t)n=t[e],d.call(l,e)<0&&(this[e]=n);return null!=(i=t.extended)&&i.apply(this),this},t.proxy=function(t){return function(e){return function(){return t.apply(e,arguments)}}(this)},t.prototype.proxy=function(t){return function(e){return function(){return t.apply(e,arguments)}}(this)},t}(),r=function(e){function n(t){n.__super__.constructor.apply(this,arguments),null!=this.constructor.uuid&&"function"==typeof this.constructor.uuid?(this.cid=this.constructor.uuid(),this.id||(this.id=this.cid)):this.cid=(null!=t?t.cid:void 0)||this.constructor.uid("c-"),t&&this.load(t)}return h(n,e),n.extend(i),n.include(i),n.records=[],n.irecords={},n.attributes=[],n.configure=function(){var t,e;return e=arguments[0],t=2<=arguments.length?u.call(arguments,1):[],this.className=e,this.deleteAll(),t.length&&(this.attributes=t),this.attributes&&(this.attributes=c(this.attributes)),this.attributes||(this.attributes=[]),this.unbind(),this},n.toString=function(){return this.className+"("+this.attributes.join(", ")+")"},n.find=function(t,e){var i;return null==e&&(e=this.notFound),(null!=(i=this.irecords[t])?i.clone():void 0)||("function"==typeof e?e(t):void 0)},n.findAll=function(t,e){var i,n,r,o;for(o=[],n=0,r=t.length;n<r;n++)i=t[n],this.find(i,e)&&o.push(this.find(i));return o},n.notFound=function(){return null},n.exists=function(t){return Boolean(this.irecords[t])},n.addRecord=function(t,e){var i;return(i=this.irecords[t.id||t.cid])?i.refresh(t):(t.id||(t.id=t.cid),this.irecords[t.id]=this.irecords[t.cid]=t,void 0!==e?this.records.splice(e,0,t):this.records.push(t)),t},n.refresh=function(t,e){var i,n,r,o,s;for(null==e&&(e={}),e.clear&&this.deleteAll(),o=this.fromJSON(t),Array.isArray(o)||(o=[o]),i=0,n=o.length;i<n;i++)r=o[i],this.addRecord(r);return this.sort(),s=this.cloneArray(o),this.trigger("refresh",s,e),s},n.select=function(t){var e,i,n,r,o;for(r=this.records,o=[],e=0,i=r.length;e<i;e++)n=r[e],t(n)&&o.push(n.clone());return o},n.findByAttribute=function(t,e){var i,n,r,o;for(o=this.records,i=0,n=o.length;i<n;i++)if(r=o[i],r[t]===e)return r.clone();return null},n.findAllByAttribute=function(t,e){return this.select(function(i){return i[t]===e})},n.each=function(t){var e,i,n,r,o;for(r=this.records,o=[],e=0,i=r.length;e<i;e++)n=r[e],o.push(t(n.clone()));return o},n.all=function(){return this.cloneArray(this.records)},n.slice=function(t,e){return null==t&&(t=0),this.cloneArray(this.records.slice(t,e))},n.first=function(t){var e;return null==t&&(t=1),t>1?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<i;e++)n=r[e],o.push(n.destroy(t));return o},n.update=function(t,e,i){return this.find(t).updateAttributes(e,i)},n.create=function(t,e){var i;return i=new this(t),i.save(e)},n.destroy=function(t,e){return this.find(t).destroy(e)},n.change=function(t){return"function"==typeof t?this.bind("change",t):this.trigger.apply(this,["change"].concat(u.call(arguments)))},n.fetch=function(t){return"function"==typeof t?this.bind("fetch",t):this.trigger.apply(this,["fetch"].concat(u.call(arguments)))},n.toJSON=function(){return this.records},n.beforeFromJSON=function(t){return t},n.fromJSON=function(t){var e,i,n,r;if(t){if("string"==typeof t&&(t=JSON.parse(t)),t=this.beforeFromJSON(t),Array.isArray(t)){for(n=[],e=0,i=t.length;e<i;e++)r=t[e],r instanceof this?n.push(r):n.push(new this(r));return n}return t instanceof this?t:new this(t)}},n.fromForm=function(){var t;return(t=new this).fromForm.apply(t,arguments)},n.sort=function(){return this.comparator&&this.records.sort(this.comparator),this},n.cloneArray=function(t){var e,i,n,r;for(n=[],e=0,i=t.length;e<i;e++)r=t[e],n.push(r.clone());return n},n.idCounter=0,n.uid=function(t){var e;return null==t&&(t=""),e=t+this.idCounter++,this.exists(e)&&(e=this.uid(t)),e},n.prototype.isNew=function(){return!this.exists()},n.prototype.isValid=function(){return!this.validate()},n.prototype.validate=function(){},n.prototype.load=function(t){var e,i;t.id&&(this.id=t.id);for(e in t)if(i=t[e],"function"==typeof this[e]){if("function"==typeof i)continue;this[e](i)}else this[e]=i;return this},n.prototype.attributes=function(){var t,e,i,n,r;for(r={},n=this.constructor.attributes,t=0,i=n.length;t<i;t++)e=n[t],e in this&&("function"==typeof this[e]?r[e]=this[e]():r[e]=this[e]);return this.id&&(r.id=this.id),r},n.prototype.eql=function(t){return t&&t.constructor===this.constructor&&(t.cid===this.cid||t.id&&t.id===this.id)},n.prototype.save=function(t){var e,i;return null==t&&(t={}),t.validate!==!1&&(e=this.validate())?(this.trigger("error",this,e),!1):(this.trigger("beforeSave",this,t),i=this.isNew()?this.create(t):this.update(t),this.stripCloneAttrs(),this.trigger("save",i,t),i)},n.prototype.stripCloneAttrs=function(){var t,e;if(!this.hasOwnProperty("cid")){for(t in this)p.call(this,t)&&(e=this[t],d.call(this.constructor.attributes,t)>=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;e=++i)if(r=o[e],this.eql(r)){o.splice(e,1);break}if(this.constructor.records=o,t.clear)return delete this.constructor.irecords[this.id],delete this.constructor.irecords[this.cid]},n.prototype.destroy=function(t){return null==t&&(t={}),null==t.clear&&(t.clear=!0),this.trigger("beforeDestroy",this,t),this.remove(t),this.destroyed=!0,this.trigger("destroy",this,t),this.trigger("change",this,"destroy",t),this.listeningTo&&this.stopListening(),this.unbind(),this},n.prototype.dup=function(t){var e,i;return null==t&&(t=!0),e=this.attributes(),t?delete e.id:e.cid=this.cid,i=new this.constructor(e),t||this._callbacks&&(i._callbacks=this._callbacks),i},
n.prototype.clone=function(){return a(this)},n.prototype.reload=function(){var t;return this.isNew()?this:(t=this.constructor.find(this.id),this.load(t.attributes()),t)},n.prototype.refresh=function(t){return t=this.constructor.fromJSON(t),t.id&&this.id!==t.id&&this.changeID(t.id),this.constructor.irecords[this.id].load(t),this.trigger("refresh",this),this.trigger("change",this,"refresh"),this},n.prototype.toJSON=function(){return this.attributes()},n.prototype.toString=function(){return"<"+this.constructor.className+" ("+JSON.stringify(this)+")>"},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<a;n++)i=h[n],g[i.name]=t(i).prop("checked");for(p=t(e).find('[type=checkbox][name$="[]"]'),r=0,c=p.length;r<c;r++)i=p[r],u=i.name.replace(/\[\]$/,""),g[u]||(g[u]=[]),t(i).prop("checked")&&g[u].push(i.value);for(f=t(e).serializeArray(),s=0,l=f.length;s<l;s++)o=f[s],g[d=o.name]||(g[d]=o.value);return this.load(g)},n.prototype.exists=function(){return this.constructor.exists(this.id)},n.prototype.update=function(t){var e,i;return this.trigger("beforeUpdate",this,t),i=this.constructor.irecords,i[this.id].load(this.attributes()),this.constructor.sort(),e=i[this.id].clone(),e.trigger("update",e,t),e.trigger("change",e,"update",t),e},n.prototype.create=function(t){var e,i;return this.trigger("beforeCreate",this,t),this.id||(this.id=this.cid),i=this.dup(!1),this.constructor.addRecord(i,t.idx),this.constructor.sort(),e=i.clone(),e.trigger("create",e,t),e.trigger("change",e,"create",t),e},n.prototype.bind=function(){var t;return t=this.constructor.irecords[this.id]||this,i.bind.apply(t,arguments)},n.prototype.one=function(){var t;return t=this.constructor.irecords[this.id]||this,i.one.apply(t,arguments)},n.prototype.unbind=function(){var t;return t=this.constructor.irecords[this.id]||this,i.unbind.apply(t,arguments)},n.prototype.trigger=function(){var t;return i.trigger.apply(this,arguments),"refresh"===arguments[0]||(t=this.constructor).trigger.apply(t,arguments)},n}(o),r.prototype.on=r.prototype.bind,r.prototype.off=r.prototype.unbind,e=function(e){function r(e){this.release=f(this.release,this);var i,n,o,s,a;this.options=e,s=this.options;for(n in s)a=s[n],this[n]=a;for(this.el||(this.el=document.createElement(this.tag)),this.el=t(this.el),this.className&&this.el.addClass(this.className),this.attributes&&this.el.attr(this.attributes),this.events||(this.events=this.constructor.events),this.elements||(this.elements=this.constructor.elements),i=this;o=i.constructor.__super__;)o.events&&(this.events=t.extend({},o.events,this.events)),o.elements&&(this.elements=t.extend({},o.elements,this.elements)),i=o;this.events&&this.delegateEvents(this.events),this.elements&&this.refreshElements(),r.__super__.constructor.apply(this,arguments)}return h(r,e),r.include(i),r.include(n),r.prototype.eventSplitter=/^(\S+)\s*(.*)$/,r.prototype.tag="div",r.prototype.release=function(){return this.trigger("release",this),this.el.remove(),this.unbind(),this.stopListening()},r.prototype.$=function(t){return this.el.find(t)},r.prototype.delegateEvents=function(t){var e,i,n,r,o,s;o=[];for(i in t){if(r=t[i],"function"==typeof r)r=function(t){return function(e){return function(){return e.apply(t,arguments),!0}}}(this)(r);else{if(!this[r])throw new Error(r+" doesn't exist");r=function(t){return function(e){return function(){return t[e].apply(t,arguments),!0}}}(this)(r)}n=i.match(this.eventSplitter),e=n[1],s=n[2],""===s?o.push(this.el.bind(e,r)):o.push(this.el.on(e,s,r))}return o},r.prototype.refreshElements=function(){var t,e,i,n;e=this.elements,i=[];for(t in e)n=e[t],i.push(this[n]=this.$(t));return i},r.prototype.delay=function(t,e){return setTimeout(this.proxy(t),e||0)},r.prototype.html=function(t){return this.el.html(t.el||t),this.refreshElements(),this.el},r.prototype.append=function(){var t,e,i;return e=1<=arguments.length?u.call(arguments,0):[],e=function(){var i,n,r;for(r=[],i=0,n=e.length;i<n;i++)t=e[i],r.push(t.el||t);return r}(),(i=this.el).append.apply(i,e),this.refreshElements(),this.el},r.prototype.appendTo=function(t){return this.el.appendTo(t.el||t),this.refreshElements(),this.el},r.prototype.prepend=function(){var t,e,i;return e=1<=arguments.length?u.call(arguments,0):[],e=function(){var i,n,r;for(r=[],i=0,n=e.length;i<n;i++)t=e[i],r.push(t.el||t);return r}(),(i=this.el).prepend.apply(i,e),this.refreshElements(),this.el},r.prototype.replace=function(e){var i,n,r;return e=e.el||e,"string"==typeof e&&(e=t.trim(e)),r=[this.el,t((null!=(n=t.parseHTML(e))?n[0]:void 0)||e)],i=r[0],this.el=r[1],i.replaceWith(this.el),this.delegateEvents(this.events),this.refreshElements(),this.el},r}(o),t=("undefined"!=typeof window&&null!==window?window.jQuery:void 0)||("undefined"!=typeof window&&null!==window?window.Zepto:void 0)||function(t){return t},a=Object.create||function(t){var e;return e=function(){},e.prototype=t,new e},c=function(t){return Array.prototype.slice.call(t,0)},s=this.Spine={},"undefined"!=typeof module&&null!==module&&(module.exports=s),s.version="1.6.0",s.$=t,s.Events=i,s.Log=n,s.Module=o,s.Controller=e,s.Model=r,o.extend.call(s,i),o.create=o.sub=e.create=e.sub=r.sub=function(t,e){var i;return i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return h(e,t),e}(this),t&&i.include(t),e&&i.extend(e),"function"==typeof i.unbind&&i.unbind(),i},r.setup=function(t,e){var i;return null==e&&(e=[]),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return h(e,t),e}(this),i.configure.apply(i,[t].concat(u.call(e))),i},s.Class=o}.call(this),function(){var t,e,i=function(t,e){function i(){this.constructor=t}for(var r in e)n.call(e,r)&&(t[r]=e[r]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty,r=[].slice,o=function(t,e){return function(){return t.apply(e,arguments)}};e=this.Spine||require("spine"),t=e.$,e.Manager=function(t){function n(){this.controllers=[],this.bind("change",this.change),this.add.apply(this,arguments)}return i(n,t),n.include(e.Events),n.prototype.add=function(){var t,e,i,n,o;for(e=1<=arguments.length?r.call(arguments,0):[],o=[],i=0,n=e.length;i<n;i++)t=e[i],o.push(this.addOne(t));return o},n.prototype.addOne=function(t){return t.bind("active",function(e){return function(){var i;return i=1<=arguments.length?r.call(arguments,0):[],e.trigger.apply(e,["change",t].concat(r.call(i)))}}(this)),t.bind("release",function(e){return function(){var i;return e.controllers=function(){var e,n,r,o;for(r=this.controllers,o=[],e=0,n=r.length;e<n;e++)i=r[e],i!==t&&o.push(i);return o}.call(e)}}(this)),this.controllers.push(t)},n.prototype.deactivate=function(){return this.trigger.apply(this,["change",!1].concat(r.call(arguments)))},n.prototype.change=function(){var t,e,i,n,o,s;for(i=arguments[0],t=2<=arguments.length?r.call(arguments,1):[],s=this.controllers,n=0,o=s.length;n<o;n++)e=s[n],e!==i&&e.deactivate.apply(e,t);if(i)return i.activate.apply(i,t)},n}(e.Module),e.Controller.include({active:function(){var t;return t=1<=arguments.length?r.call(arguments,0):[],"function"==typeof t[0]?this.bind("active",t[0]):(t.unshift("active"),this.trigger.apply(this,t)),this},isActive:function(){return this.el.hasClass("active")},activate:function(){return this.el.addClass("active"),this},deactivate:function(){return this.el.removeClass("active"),this}}),e.Stack=function(t){function n(){this.release=o(this.release,this);var t,i,r,s,a,c;n.__super__.constructor.apply(this,arguments),this.manager=new e.Manager,this.router=null!=(r=e.Route)?r.create():void 0,s=this.controllers;for(i in s){if(c=s[i],null!=this[i])throw Error("'@"+i+"' already assigned");this[i]=new c({stack:this}),this.add(this[i])}a=this.routes,t=function(t){return function(e,i){var n;return"function"==typeof i&&(n=i),n||(n=function(){var e;return(e=t[i]).active.apply(e,arguments)}),t.route(e,n)}}(this);for(i in a)c=a[i],t(i,c);this["default"]&&this[this["default"]].active()}return i(n,t),n.prototype.controllers={},n.prototype.routes={},n.prototype.className="spine stack",n.prototype.add=function(t){return this.manager.add(t),this.append(t)},n.prototype.release=function(){var t;return null!=(t=this.router)&&t.destroy(),n.__super__.release.apply(this,arguments)},n}(e.Controller),"undefined"!=typeof module&&null!==module&&(module.exports=e.Manager),"undefined"!=typeof module&&null!==module&&(module.exports.Stack=e.Stack)}.call(this),function(){var t,e,i,n,r,o,s,a,c,l,u,d=[].slice,h=function(t,e){return function(){return t.apply(e,arguments)}},p=function(t,e){function i(){this.constructor=t}for(var n in e)f.call(e,n)&&(t[n]=e[n]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},f={}.hasOwnProperty;u=this.Spine||require("spine"),t=u.$,a=u.Model,c=t({}),e={getURL:function(t){return null!=t.className?this.generateURL(t):this.generateURL(t,encodeURIComponent(t.id))},getCollectionURL:function(t){return this.generateURL(t)},getScope:function(t){return("function"==typeof t.scope?t.scope():void 0)||t.scope},getCollection:function(t){return t.url!==t.generateURL?"function"==typeof t.url?t.url():t.url:null!=t.className?t.className.toLowerCase()+"s":void 0},generateURL:function(){var t,i,n,r,o;return n=arguments[0],t=2<=arguments.length?d.call(arguments,1):[],i=e.getCollection(n)||e.getCollection(n.constructor),o=e.getScope(n)||e.getScope(n.constructor),t.unshift(i),t.unshift(o),r=t.join("/"),r=r.replace(/(\/\/)/g,"/"),r=r.replace(/^\/|\/$/g,""),0!==r.indexOf("../")?a.host+"/"+r:r},enabled:!0,disable:function(t){var e;if(!this.enabled)return t();this.enabled=!1;try{return t()}catch(t){throw e=t}finally{this.enabled=!0}},queue:function(t){return t?c.queue(t):c.queue()},clearQueue:function(){return this.queue([])},config:{loadMethod:"GET",updateMethod:"PUT",createMethod:"POST",destroyMethod:"DELETE"}},i=function(){function i(){}return i.prototype.defaults={dataType:"json",processData:!1,headers:{"X-Requested-With":"XMLHttpRequest"}},i.prototype.queue=e.queue,i.prototype.ajax=function(e,i){return t.ajax(this.ajaxSettings(e,i))},i.prototype.ajaxQueue=function(i,n,r){var o,s,a,l,u,h;return s=null,o=t.Deferred(),l=o.promise(),e.enabled?(h=this.ajaxSettings(i,n),a=void 0!==h.parallel?h.parallel:"GET"===h.type,u=function(i){var n,l,u;if(null!=(null!=r?r.id:void 0)&&(null==h.url&&(h.url=e.getURL(r)),null!=(n=h.data)&&(n.id=r.id)),"string"!=typeof h.data&&h.processData!==!0&&(h.data=JSON.stringify(h.data)),u=function(){return o.resolve.apply(this,d.call(arguments).concat([h]))},l=function(){return o.reject.apply(this,d.call(arguments).concat([h]))},s=t.ajax(h),s.done(u),s.fail(l),s.then(i,i),a)return c.dequeue()},l.abort=function(e){var i;return s?s.abort(e):(i=t.inArray(u,this.queue()),i>-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=window.MBLocale),MB.v={},MB.l={},MB.f={ga:{},inSharing:/^\/app/.test(window.location.pathname),isDuplicateDemo:!1,minFSWarned:!1},MB.config={showRuler:!0,showGeneral:!0,screenBg:"#FFFFFF",assetWidth:158,SCALES:[50,75,100,150,200],ignoreError:/(Network error|Uncaught InvalidStateError|Uncaught #<Event>|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.event=function(t,e){return null==e&&(e="goal"),MB.ga("send","event",e,t)},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.isChrome=function(){return/Chrome/i.test(navigator.userAgent)},MB.isChrome63=function(){return/Chrome\/63/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.isStandAlone=function(){return navigator.standalone},MB.isIOS9=function(){return/(9_0|9_1)/.test(navigator.userAgent)},MB.isIOS11=function(){return/11_\d/.test(navigator.userAgent)},MB.isOddIOS=function(){return MB.isStandAlone()&&MB.isIOS9()&&(window.innerHeight>window.innerWidth||MB.isiPad())},MB.pointInRect=function(t,e,i){return t>i.left&&t<i.left+i.width&&e>i.top&&e<i.top+i.height},MB.project=function(){return MB.currentProject},MB.staticMap=function(){return"/images/workspace/staticmap_"+window.MBLocale+".png"},MB.viewOnly=function(t){return t.isCollaborated()&&t.limitation.collaborators<1},MB.exceedProjectQuota=function(t,e){var i,n,r;return i=!1,t&&(t.expired||t.limitation.collaborators<1)&&(r=t.owner_id===MB.user.id?"user":"team",MB.promptRenew(e+"_team_project",{action:"renew",role:r,plan:t.owner_plan}),i=!0),!t&&MB.user.expired&&(n=Project.select(function(t){return t.owner_id===MB.user.id&&!t.team_cid}),n.length>=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)):MB.alert({title:I18N.file_too_large,desc:I18N.optimize_your_image,isHTML:!0}):(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={"&amp;":"&","&lt;":"<","&gt;":">"},t.replace(/(&amp;|&lt;|&gt;)/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.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.lastTimestamp=function(){return MB.maxTimestamp+1},MB.safeLoading=function(t){return t===!1?$("#safemode").hide():"number"==typeof t?$("#safemode .progress").text(""):($("#safemode .text").html(t),$("#safemode .progress").text(""),$("#safemode").show())},MB.globalStateAlert=function(){return!(!MB.currentScreen.cscreenstates().length||$("#ssliglobal").hasClass("active"))&&(MB.alert({title:I18N.warning,desc:I18N.global_state_alert,isHTML:!0}),!0)},MB.minFontSizeIssue=function(){if(!(MB.f.inSharing||MB.f.minFSWarned||MB.isMobile()||MB.isPhantom()))return MB.f.minFSWarned=!0,MB.alert({title:I18N.warning,desc:I18N.font_size_issue,confirmText:I18N.know_how}).then(function(){return function(t){if(t)return window.open("https://modao.cc/posts/63")}}(this))},MB.clearPasteBoard=function(){return $("#clipboard").focus().select(),document.execCommand("copy"),setTimeout(function(){return $("#clipboard").blur()},100)},MB.refreshWorkspaceRoute=function(){if(window.parent&&window.parent!==window)try{return window.parent.history.replaceState({},"",location.pathname+location.search)}catch(t){}},MB.supportsPassive=!1;try{e=Object.defineProperty({},"passive",{get:function(){return MB.supportsPassive=!0}}),window.addEventListener("test",null,e)}catch(t){}t=function(){var t,e;return t={getItem:function(){},setItem:function(){},removeItem:function(){},clear:function(){}},e=function(){var t;try{return localStorage.setItem("localStorage",1),localStorage.removeItem("localStorage"),!0}catch(e){return t=e,!1}},e()?localStorage:t},MB.localStorageDelegate=t()}.call(this),function(){var t,e,i;MB.SHELLS={ipad_3_4:{device:"ipad",bg:"ipad",width:881,height:1247,top:111,left:56.5},ipad_pro:{device:"ipad",bg:"ipad_pro",width:1224,height:1716,top:175,left:100},web:{device:"web",bg:"desktop",width:960,height:1200,top:0,left:0},iphone_5:{device:"iphone_5",bg:"iphone_se",width:384,height:798,top:119,left:32},iphone_6:{device:"iphone_6",bg:"iphone_7",width:435,height:888,top:114,left:30},iphone_6_plus:{device:"iphone_6_plus",bg:"iphone_7_plus",width:482,height:983,top:127,left:34},iphone_x:{device:"iphone_x",bg:"iphone_x",width:431,height:862,top:25,left:28},Huawei:{device:"huawei",bg:"huawei_p9",width:400,height:800,top:77,left:20},samsung:{device:"samsung",bg:"samsung_s7",width:398,height:804,top:85,left:19},android:{device:"android",bg:"google_pixel",width:408,height:820,top:84.6,left:24}},MB.INSPECTABLES={label:["locked","text","fs","br","bs","ha","va","width","height","top","left","z","th","lh","td","bo","i","bg","bc","tc","o","ts","tsc","ds","sc","ro","padding","ls","fixed","fixed_type","ani_name","ani_delay","ani_count","ani_duration"],text_view:["locked","text","fs","br","bs","ha","va","width","height","top","left","z","th","lh","td","bo","i","bg","bc","tc","o","ts","tsc","ds","sc","ro","padding","ls","fixed","fixed_type","ani_name","ani_delay","ani_count","ani_duration","clip"],sticky:["locked","text","fs","ha","lh","bo","i","td","width","height","top","left","bg","tc","th","slw","slt","padding"],button:["locked","text","fs","br","bs","ha","va","width","height","top","left","z","th","td","bo","i","bg","bc","tc","o","ts","tsc","ds","sc","ro","ls","icon","is","fixed","fixed_type","ani_name","ani_delay","ani_count","ani_duration"],icon_button:["locked","is","icon","br","bs","top","left","width","height","z","th","bg","bc","tc","o","ds","sc","ro","ls","fixed","fixed_type","ani_name","ani_delay","ani_count","ani_duration"],text_field:["locked","text","fs","br","bs","ha","va","width","height","top","left","z","th","bg","bc","tc","o","ds","sc","ro","td","bo","i","ls","fixed","fixed_type","ani_name","ani_delay","ani_count","ani_duration"],mtext_input:["locked","text","fs","br","bs","ha","width","height","top","left","z","th","bg","bc","tc","o","ds","sc","td","bo","i","ls","fixed","fixed_type","input_type"],mtextarea:["locked","text","fs","br","bs","ha","width","height","top","left","z","th","lh","bg","bc","tc","o","ds","sc","td","bo","i","ls","fixed","fixed_type","padding"],mselect:["locked","text","fs","bs","width","height","top","left","z","th","lh","bg","bc","tc","o","ds","sc","td","bo","i","ls","fixed","fixed_type"],"switch":["locked","top","left","z","checked","fixed","fixed_type","ani_name","ani_delay","ani_count","ani_duration"],mcheckbox2:["locked","top","left","width","height","z","o","checked","fixed","fixed_type"],mradiobutton:["locked","top","left","width","height","z","o","checked","fixed","fixed_type"],mfile_input:["locked","top","left","width","height","z","o","fixed","fixed_type"],image_view:["locked","bs","br","width","height","top","left","image","z","th","bg","bc","tc","o","p","ds","sc","ro","ls","fixed","fixed_type","ani_name","ani_delay","ani_count","ani_duration","clip","filter"],map_view:["locked","width","height","top","left","z","fixed","fixed_type"],navigation_bar:["locked","text","fs","z","height","th","td","bo","i","bg","tc","bc","o","ts","tsc","ds","sc"],search_bar:["locked","text","fs","top","left","width","ha","z","th","bg","tc","bc","o","ds","sc","ro","fixed","fixed_type","ani_name","ani_delay","ani_count","ani_duration"],tab_item:["locked","text","is","icon","width","left","top","fs","z","th","bg","tc","o","ds","sc","fixed","fixed_type","ani_name","ani_delay","ani_count","ani_duration"],tab_bar:["locked","height","z","th","bg","bc","o","ds","sc","ani_name","ani_delay","ani_count","ani_duration"],hr:["locked","width","height","top","left","o","z","th","bc","ls","ro","fixed","fixed_type","ani_name","ani_delay","ani_count","ani_duration"],ve:["locked","width","height","top","left","o","z","th","bc","ls","ro","fixed","fixed_type","ani_name","ani_delay","ani_count","ani_duration"],keyboard:["locked","z","numeric"],status_bar:["locked","text","th","bg","tc","bc","o","z"],rectangle:["locked","height","top","left","z","th","bg","bc","o","ds","sc","ro","fixed","fixed_type","ani_name","ani_delay","ani_count","ani_duration"],rounded_rect:["locked","text","fs","br","bs","ha","va","width","height","top","left","z","lh","th","td","bo","i","bg","bc","tc","o","ts","tsc","ds","sc","ro","padding","ls","fixed","fixed_type","ani_name","ani_delay","ani_count","ani_duration"],circle_rect:["locked","text","fs","bs","ha","va","width","height","top","left","z","lh","th","td","bo","i","bg","bc","tc","o","ts","tsc","ds","sc","ro","padding","ls","fixed","fixed_type","ani_name","ani_delay","ani_count","ani_duration"],triangleb:["locked","width","height","top","left","z","th","tc","o","ro","fixed","fixed_type","ani_name","ani_delay","ani_count","ani_duration"],triangletl:["locked","width","height","top","left","z","th","tc","o","ro","fixed","fixed_type","ani_name","ani_delay","ani_count","ani_duration"],lr:["locked","width","height","top","left","z","fixed","fixed_type"],webpage:["locked","width","height","top","left","z","text"],pg:["locked","icon"],mtooltip:["locked","text","fs","br","ha","va","width","height","top","left","z","th","lh","td","bo","i","bg","tc","o","ts","tsc","ds","sc","bs","bc","ro","padding","tt_placement","tt_offset","tt_arrow_size","fixed","fixed_type","ani_name","ani_delay","ani_count","ani_duration"]},MB.INSPECTABLES.pg=["left","top"],e=MB.INSPECTABLES;for(t in e)i=e[t],i.push("v");window.Spine&&(Spine.Model.prototype.refresh=function(t){var e;return e=this.constructor.irecords[this.id],e&&e.load(t),this.trigger("refresh"),this},Spine.Model.State={lsave:function(t,e){var i,n,r,o,s,a,c,l,u,d;if(null==t&&(t=!0),null==e&&(e=!0),Spine.Ajax.disable(function(t){return function(){return t.save()}}(this)),!t)return!0;if(n=this.getState("default").dup(),u=this.getState(this.screenstate_cid),u.restore(this),u.lsave(),o=$("#ssliglobal").hasClass("active"),!o&&"default"!==this.screenstate_cid)return!0;if(i=this.cs(),!i||!e)return!0;for(l=i.cscreenstates(),s=0,a=l.length;s<a;s++)d=l[s],d.cid!==this.screenstate_cid&&(c=this.getState(d.cid),c.exists()||"default"!==this.screenstate_cid?c.exists()&&o&&(r=c.gid,c.restore(this),c.gid=r,c.lsave(!0,!1)):(c.restore(n),c.lsave(!0,!1)));return"default"!==this.screenstate_cid&&o&&(c=this.getState("default"),r=c.gid,c.restore(this),c.gid=r,c.lsave(!0,!1)),!0},setState:function(t,e){var i,n,r,o;if(t||(t="default"),o=this.screenstate_cid||"default",o!==t)return i=this.getState("default"),i.exists()||i.lsave(!1,!1),r=this.getState(o),r.exists()&&r.restore(this),n=this.getState(t),n.exists()?this.restore(n):this.restore(i),e?(this.screenstate_cid=t,this.lsave(!1,!1)):void 0}},Spine.Model.Dirty={lsave:function(t){return null==t&&(t=!0),Spine.Ajax.disable(function(t){return function(){return t.save()}}(this)),t&&$("body").trigger("queue:add",[this,!1]),!0},ldestroy:function(t){if(null==t&&(t=!0),Spine.Ajax.disable(function(t){return function(){return t.destroy()}}(this)),t)return $("body").trigger("queue:add",[this,!0])}})}.call(this),function(){MB.themes={light:[],dark:["#444","#555","#666"],indigo:["#3949ab","#3f51b5","#5c6bc0"],pink:["#d81b60","#ff4081","#ff6091"],red:["#dd191d","#e51c23","#e84e40"],blue:["#4e6cef","#5677fc","#738ffe"],lblue:["#039be5","#03a9f4","#29b6f6"],cyan:["#00acc1","#00bcd4","#26c6da"],teal:["#00897b","#009688","#26a69a"],green:["#0a8f08","#259b24","#2baf2b"],lgreen:["#7cb342","#8bc34a","#9ccc65"],orange:["#f4511e","#ff5722","#ff7043"],lorange:["#fb8c00","#ff9800","#ffa726"],purple:["#8e24aa","#9c27b0","#ab47bc"],dpurple:["#5e35b1","#673ab7","#7e57c2"],grey:["#546e7a","#607d8b","#78909c"]}}.call(this),function(){$.extend({nextTick:function(t){return window.requestAnimationFrame(function(){return window.requestAnimationFrame(function(){return window.requestAnimationFrame(function(){return t()})})})}}),$.fn.extend({transitionEnd:function(t){return this.one("transitionend",t)},disableTransition:function(){return this.css("transition","none").css("transition")},enableTransition:function(t){return this.css("transition","all "+t+" ease-in-out").css("transition")},zindex:function(t){return this.css("z-index",t)},translateX:function(t){return this.css("transform","translateX("+t+"px)")},translateY:function(t){return this.css("transform","translateY("+t+"px)")},translate:function(t,e){return this.css("transform","translate("+t+"px, "+e+"px)")},onScroll:function(t){var e;return e=!!MB.supportsPassive&&{passive:!0},this[0].removeEventListener("scroll",t,e),this[0].addEventListener("scroll",t,e)}})}.call(this),!function(t){"use strict";function e(t,e){var i=(65535&t)+(65535&e),n=(t>>16)+(e>>16)+(i>>16);return n<<16|65535&i}function i(t,e){return t<<e|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<<i%32,t[(i+64>>>9<<4)+14]=i;var n,c,l,u,d,h=1732584193,p=-271733879,f=-1732584194,g=271733878;for(n=0;n<t.length;n+=16)c=h,l=p,u=f,d=g,h=r(h,p,f,g,t[n],7,-680876936),g=r(g,h,p,f,t[n+1],12,-389564586),f=r(f,g,h,p,t[n+2],17,606105819),p=r(p,f,g,h,t[n+3],22,-1044525330),h=r(h,p,f,g,t[n+4],7,-176418897),
g=r(g,h,p,f,t[n+5],12,1200080426),f=r(f,g,h,p,t[n+6],17,-1473231341),p=r(p,f,g,h,t[n+7],22,-45705983),h=r(h,p,f,g,t[n+8],7,1770035416),g=r(g,h,p,f,t[n+9],12,-1958414417),f=r(f,g,h,p,t[n+10],17,-42063),p=r(p,f,g,h,t[n+11],22,-1990404162),h=r(h,p,f,g,t[n+12],7,1804603682),g=r(g,h,p,f,t[n+13],12,-40341101),f=r(f,g,h,p,t[n+14],17,-1502002290),p=r(p,f,g,h,t[n+15],22,1236535329),h=o(h,p,f,g,t[n+1],5,-165796510),g=o(g,h,p,f,t[n+6],9,-1069501632),f=o(f,g,h,p,t[n+11],14,643717713),p=o(p,f,g,h,t[n],20,-373897302),h=o(h,p,f,g,t[n+5],5,-701558691),g=o(g,h,p,f,t[n+10],9,38016083),f=o(f,g,h,p,t[n+15],14,-660478335),p=o(p,f,g,h,t[n+4],20,-405537848),h=o(h,p,f,g,t[n+9],5,568446438),g=o(g,h,p,f,t[n+14],9,-1019803690),f=o(f,g,h,p,t[n+3],14,-187363961),p=o(p,f,g,h,t[n+8],20,1163531501),h=o(h,p,f,g,t[n+13],5,-1444681467),g=o(g,h,p,f,t[n+2],9,-51403784),f=o(f,g,h,p,t[n+7],14,1735328473),p=o(p,f,g,h,t[n+12],20,-1926607734),h=s(h,p,f,g,t[n+5],4,-378558),g=s(g,h,p,f,t[n+8],11,-2022574463),f=s(f,g,h,p,t[n+11],16,1839030562),p=s(p,f,g,h,t[n+14],23,-35309556),h=s(h,p,f,g,t[n+1],4,-1530992060),g=s(g,h,p,f,t[n+4],11,1272893353),f=s(f,g,h,p,t[n+7],16,-155497632),p=s(p,f,g,h,t[n+10],23,-1094730640),h=s(h,p,f,g,t[n+13],4,681279174),g=s(g,h,p,f,t[n],11,-358537222),f=s(f,g,h,p,t[n+3],16,-722521979),p=s(p,f,g,h,t[n+6],23,76029189),h=s(h,p,f,g,t[n+9],4,-640364487),g=s(g,h,p,f,t[n+12],11,-421815835),f=s(f,g,h,p,t[n+15],16,530742520),p=s(p,f,g,h,t[n+2],23,-995338651),h=a(h,p,f,g,t[n],6,-198630844),g=a(g,h,p,f,t[n+7],10,1126891415),f=a(f,g,h,p,t[n+14],15,-1416354905),p=a(p,f,g,h,t[n+5],21,-57434055),h=a(h,p,f,g,t[n+12],6,1700485571),g=a(g,h,p,f,t[n+3],10,-1894986606),f=a(f,g,h,p,t[n+10],15,-1051523),p=a(p,f,g,h,t[n+1],21,-2054922799),h=a(h,p,f,g,t[n+8],6,1873313359),g=a(g,h,p,f,t[n+15],10,-30611744),f=a(f,g,h,p,t[n+6],15,-1560198380),p=a(p,f,g,h,t[n+13],21,1309151649),h=a(h,p,f,g,t[n+4],6,-145523070),g=a(g,h,p,f,t[n+11],10,-1120210379),f=a(f,g,h,p,t[n+2],15,718787259),p=a(p,f,g,h,t[n+9],21,-343485551),h=e(h,c),p=e(p,l),f=e(f,u),g=e(g,d);return[h,p,f,g]}function l(t){var e,i="";for(e=0;e<32*t.length;e+=8)i+=String.fromCharCode(t[e>>5]>>>e%32&255);return i}function u(t){var e,i=[];for(i[(t.length>>2)-1]=void 0,e=0;e<i.length;e+=1)i[e]=0;for(e=0;e<8*t.length;e+=8)i[e>>5]|=(255&t.charCodeAt(e/8))<<e%32;return i}function d(t){return l(c(u(t),8*t.length))}function h(t,e){var i,n,r=u(t),o=[],s=[];for(o[15]=s[15]=void 0,r.length>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<t.length;i+=1)e=t.charCodeAt(i),r+=n.charAt(e>>>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;i<t.length&&0==t[i];)i++;this.num=Array(t.length-i+e);for(var n=0;n<t.length-i;n++)this.num[n]=t[n+i]}function o(t,e){this.totalCount=t,this.dataCount=e}function s(){this.buffer=[],this.length=0}var a;i.prototype={getLength:function(){return this.data.length},write:function(t){for(var e=0;e<this.data.length;e++)t.put(this.data.charCodeAt(e),8)}},n.prototype={addData:function(t){this.dataList.push(new i(t)),this.dataCache=null},isDark:function(t,e){if(0>t||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<e.length;r++)n+=e[r].dataCount;for(r=0;r<this.dataList.length;r++)e=this.dataList[r],i.put(e.mode,4),i.put(e.getLength(),c.getLengthInBits(e.mode,t)),e.write(i);if(i.getLengthInBits()<=8*n)break}this.typeNumber=t}this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(t,e){this.moduleCount=4*this.typeNumber+17,this.modules=Array(this.moduleCount);for(var i=0;i<this.moduleCount;i++){this.modules[i]=Array(this.moduleCount);for(var r=0;r<this.moduleCount;r++)this.modules[i][r]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(t,e),7<=this.typeNumber&&this.setupTypeNumber(t),null==this.dataCache&&(this.dataCache=n.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,e)},setupPositionProbePattern:function(t,e){for(var i=-1;7>=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<this.modules.length;e++)for(var i=1*e,n=0;n<this.modules[e].length;n++){var r=1*n;this.modules[e][n]&&(t.beginFill(0,100),t.moveTo(r,i),t.lineTo(r+1,i),t.lineTo(r+1,i+1),t.lineTo(r,i+1),t.endFill())}return t},setupTimingPattern:function(){for(var t=8;t<this.moduleCount-8;t++)null==this.modules[t][6]&&(this.modules[t][6]=0==t%2);for(t=8;t<this.moduleCount-8;t++)null==this.modules[6][t]&&(this.modules[6][t]=0==t%2)},setupPositionAdjustPattern:function(){for(var t=c.getPatternPosition(this.typeNumber),e=0;e<t.length;e++)for(var i=0;i<t.length;i++){var n=t[e],r=t[i];if(null==this.modules[n][r])for(var o=-2;2>=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;0<s;s-=2)for(6==s&&s--;;){for(var a=0;2>a;a++)if(null==this.modules[n][s-a]){var l=!1;o<t.length&&(l=1==(t[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;a<i.length;a++){var l=i[a];r.put(l.mode,4),r.put(l.getLength(),c.getLengthInBits(l.mode,t)),l.write(r)}for(a=t=0;a<e.length;a++)t+=e[a].dataCount;if(r.getLengthInBits()>8*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<e.length;l++){var u=e[l].dataCount,d=e[l].totalCount-u,n=Math.max(n,u),o=Math.max(o,d);s[l]=Array(u);for(var h=0;h<s[l].length;h++)s[l][h]=255&t.buffer[h+i];for(i+=u,h=c.getErrorCorrectPolynomial(d),u=new r(s[l],h.getLength()-1).mod(h),a[l]=Array(h.getLength()-1),h=0;h<a[l].length;h++)d=h+u.getLength()-a[l].length,a[l][h]=0<=d?u.get(d):0}for(h=l=0;h<e.length;h++)l+=e[h].totalCount;for(i=Array(l),h=u=0;h<n;h++)for(l=0;l<e.length;l++)h<s[l].length&&(i[u++]=s[l][h]);for(h=0;h<o;h++)for(l=0;l<e.length;l++)h<a[l].length&&(i[u++]=a[l][h]);return i},a=4;for(var c={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(t){for(var e=t<<10;0<=c.getBCHDigit(e)-c.getBCHDigit(c.G15);)e^=c.G15<<c.getBCHDigit(e)-c.getBCHDigit(c.G15);return(t<<10|e)^c.G15_MASK},getBCHTypeNumber:function(t){for(var e=t<<12;0<=c.getBCHDigit(e)-c.getBCHDigit(c.G18);)e^=c.G18<<c.getBCHDigit(e)-c.getBCHDigit(c.G18);return t<<12|e},getBCHDigit:function(t){for(var e=0;0!=t;)e++,t>>>=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;i<t;i++)e=e.multiply(new r([1,l.gexp(i)],0));return e},getLengthInBits:function(t,e){if(1<=e&&10>e)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<e;n++)for(var r=0;r<e;r++){for(var o=0,s=t.isDark(n,r),a=-1;1>=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++;5<o&&(i+=3+o-5)}for(n=0;n<e-1;n++)for(r=0;r<e-1;r++)o=0,t.isDark(n,r)&&o++,t.isDark(n+1,r)&&o++,t.isDark(n,r+1)&&o++,t.isDark(n+1,r+1)&&o++,(0==o||4==o)&&(i+=3);for(n=0;n<e;n++)for(r=0;r<e-6;r++)t.isDark(n,r)&&!t.isDark(n,r+1)&&t.isDark(n,r+2)&&t.isDark(n,r+3)&&t.isDark(n,r+4)&&!t.isDark(n,r+5)&&t.isDark(n,r+6)&&(i+=40);for(r=0;r<e;r++)for(n=0;n<e-6;n++)t.isDark(n,r)&&!t.isDark(n+1,r)&&t.isDark(n+2,r)&&t.isDark(n+3,r)&&t.isDark(n+4,r)&&!t.isDark(n+5,r)&&t.isDark(n+6,r)&&(i+=40);for(r=o=0;r<e;r++)for(n=0;n<e;n++)t.isDark(n,r)&&o++;return t=Math.abs(100*o/e/e-50)/5,i+10*t}},l={glog:function(t){if(1>t)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;for(u=8;256>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;i<this.getLength();i++)for(var n=0;n<t.getLength();n++)e[i+n]^=l.gexp(l.glog(this.get(i))+l.glog(t.get(n)));return new r(e,0)},mod:function(t){if(0>this.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<this.getLength();n++)i[n]=this.get(n);for(n=0;n<t.getLength();n++)i[n]^=l.gexp(l.glog(t.get(n))+e);return new r(i,0).mod(t)}},o.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],o.getRSBlocks=function(t,e){var i=o.getRsBlockTable(t,e);if(void 0==i)throw Error("bad rs block @ typeNumber:"+t+"/errorCorrectLevel:"+e);for(var n=i.length/3,r=[],s=0;s<n;s++)for(var a=i[3*s+0],c=i[3*s+1],l=i[3*s+2],u=0;u<a;u++)r.push(new o(c,l));return r},o.getRsBlockTable=function(t,e){switch(e){case 1:return o.RS_BLOCK_TABLE[4*(t-1)+0];case 0:return o.RS_BLOCK_TABLE[4*(t-1)+1];case 3:return o.RS_BLOCK_TABLE[4*(t-1)+2];case 2:return o.RS_BLOCK_TABLE[4*(t-1)+3]}},s.prototype={get:function(t){return 1==(this.buffer[Math.floor(t/8)]>>>7-t%8&1)},put:function(t,e){for(var i=0;i<e;i++)this.putBit(1==(t>>>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<i.getModuleCount();c++)for(var l=0;l<i.getModuleCount();l++){o.fillStyle=i.isDark(c,l)?e.foreground:e.background;var u=Math.ceil((l+1)*s)-Math.floor(l*s),d=Math.ceil((c+1)*s)-Math.floor(c*s);o.fillRect(Math.round(l*s),Math.round(c*a),u,d)}}else for(i=new n(e.typeNumber,e.correctLevel),i.addData(e.text),i.make(),r=t("<table></table>").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<i.getModuleCount();a++)for(c=t("<tr></tr>").css("height",s+"px").appendTo(r),l=0;l<i.getModuleCount();l++)t("<td></td>").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<e;n++)o[n]=r[0|Math.random()*i];else{var s;for(o[8]=o[13]=o[18]=o[23]="-",o[14]="4",n=0;n<36;n++)o[n]||(s=0|16*Math.random(),o[n]=r[19==n?3&s|8:s])}return o.join("")},Math.uuidFast=function(){for(var e,i=t,n=new Array(36),r=0,o=0;o<36;o++)8==o||13==o||18==o||23==o?n[o]="-":14==o?n[o]="4":(r<=2&&(r=33554432+16777216*Math.random()|0),e=15&r,r>>=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<n.length;s++)r(n[s]);return r}({1:[function(t,e){"use strict";function i(t){t.fn.perfectScrollbar=function(t){return this.each(function(){if("object"==typeof t||"undefined"==typeof t){var e=t;r.get(this)||n.initialize(this,e)}else{var i=t;"update"===i?n.update(this):"destroy"===i&&n.destroy(this)}})}}var n=t("../main"),r=t("../plugin/instances");if("function"==typeof define&&define.amd)define(["jquery"],i);else{var o=window.jQuery?window.jQuery:window.$;"undefined"!=typeof o&&i(o)}e.exports=i},{"../main":7,"../plugin/instances":18}],2:[function(t,e,i){"use strict";function n(t,e){var i=t.className.split(" ");i.indexOf(e)<0&&i.push(e),t.className=i.join(" ")}function r(t,e){var i=t.className.split(" "),n=i.indexOf(e);n>=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;t<this.eventElements.length;t++)this.eventElements[t].unbindAll()},n.prototype.once=function(t,e,i){var n=this.eventElement(t),r=function(t){n.unbind(e,r),i(t)};n.bind(e,r)},e.exports=n},{}],5:[function(t,e){"use strict";e.exports=function(){function t(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return function(){return t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()}}()},{}],6:[function(t,e,i){"use strict";var n=t("./class"),r=t("./dom"),o=i.toInt=function(t){return parseInt(t,10)||0},s=i.clone=function(t){if(null===t)return null;if(t.constructor===Array)return t.map(s);if("object"==typeof t){var e={};for(var i in t)e[i]=s(t[i]);return e}return t};i.extend=function(t,e){var i=s(t);for(var n in e)i[n]=s(e[n]);return i},i.isEditable=function(t){return r.matches(t,"input,[contenteditable]")||r.matches(t,"select,[contenteditable]")||r.matches(t,"textarea,[contenteditable]")||r.matches(t,"button,[contenteditable]")},i.removePsClasses=function(t){for(var e=n.list(t),i=0;i<e.length;i++){var r=e[i];0===r.indexOf("ps-")&&n.remove(t,r)}},i.outerWidth=function(t){return o(r.css(t,"width"))+o(r.css(t,"paddingLeft"))+o(r.css(t,"paddingRight"))+o(r.css(t,"borderLeftWidth"))+o(r.css(t,"borderRightWidth"))},i.startScrolling=function(t,e){n.add(t,"ps-in-scrolling"),"undefined"!=typeof e?n.add(t,"ps-"+e):(n.add(t,"ps-x"),n.add(t,"ps-y"))},i.stopScrolling=function(t,e){n.remove(t,"ps-in-scrolling"),"undefined"!=typeof e?n.remove(t,"ps-"+e):(n.remove(t,"ps-x"),n.remove(t,"ps-y"))},i.env={isWebKit:"WebkitAppearance"in document.documentElement.style,supportsTouch:"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch,supportsIePointer:null!==window.navigator.msMaxTouchPoints}},{"./class":2,"./dom":3}],7:[function(t,e){"use strict";var i=t("./plugin/destroy"),n=t("./plugin/initialize"),r=t("./plugin/update");e.exports={initialize:n,update:r,destroy:i}},{"./plugin/destroy":9,"./plugin/initialize":17,"./plugin/update":21}],8:[function(t,e){"use strict";e.exports={handlers:["click-rail","drag-scrollbar","keyboard","wheel","touch"],maxScrollbarLength:null,minScrollbarLength:null,scrollXMarginOffset:0,scrollYMarginOffset:0,stopPropagationOnClick:!0,suppressScrollX:!1,suppressScrollY:!1,swipePropagation:!0,useBothWheelAxes:!1,wheelPropagation:!1,wheelSpeed:1,theme:"default"}},{}],9:[function(t,e){"use strict";var i=t("../lib/helper"),n=t("../lib/dom"),r=t("./instances");e.exports=function(t){var e=r.get(t);e&&(e.event.unbindAll(),n.remove(e.scrollbarX),n.remove(e.scrollbarY),n.remove(e.scrollbarXRail),n.remove(e.scrollbarYRail),i.removePsClasses(t),r.remove(t))}},{"../lib/dom":3,"../lib/helper":6,"./instances":18}],10:[function(t,e){"use strict";function i(t,e){function i(t){return t.getBoundingClientRect()}var r=function(t){t.stopPropagation()};e.settings.stopPropagationOnClick&&e.event.bind(e.scrollbarY,"click",r),e.event.bind(e.scrollbarYRail,"click",function(r){var a=n.toInt(e.scrollbarYHeight/2),c=e.railYRatio*(r.pageY-window.pageYOffset-i(e.scrollbarYRail).top-a),l=e.railYRatio*(e.railYHeight-e.scrollbarYHeight),u=c/l;u<0?u=0:u>1&&(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.x<r.left+3?(u.left=-5,n.startScrolling(t,"x")):i.x>r.right-3?(u.left=5,n.startScrolling(t,"x")):u.left=0,i.y<r.top+3?(r.top+3-i.y<5?u.top=-5:u.top=-20,n.startScrolling(t,"y")):i.y>r.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.contentWidth?(e.scrollbarXActive=!0,e.railXWidth=e.containerWidth-e.railXMarginWidth,e.railXRatio=e.containerWidth/e.railXWidth,e.scrollbarXWidth=i(e,r.toInt(e.railXWidth*e.containerWidth/e.contentWidth)),e.scrollbarXLeft=r.toInt((e.negativeScrollAdjustment+t.scrollLeft)*(e.railXWidth-e.scrollbarXWidth)/(e.contentWidth-e.containerWidth))):e.scrollbarXActive=!1,!e.settings.suppressScrollY&&e.containerHeight+e.settings.scrollYMarginOffset<e.contentHeight?(e.scrollbarYActive=!0,e.railYHeight=e.containerHeight-e.railYMarginHeight,e.railYRatio=e.containerHeight/e.railYHeight,e.scrollbarYHeight=i(e,r.toInt(e.railYHeight*e.containerHeight/e.contentHeight)),e.scrollbarYTop=r.toInt(t.scrollTop*(e.railYHeight-e.scrollbarYHeight)/(e.contentHeight-e.containerHeight))):e.scrollbarYActive=!1,e.scrollbarXLeft>=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&&g<i&&t.dispatchEvent(o),"top"===e&&g>i&&t.dispatchEvent(s),"left"===e&&g<n&&t.dispatchEvent(a),"left"===e&&g>n&&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<r;n++)e.ec.emit(s.message,i.msg[n])}},l=function(t){throw t},u=function(t){e.ws.send(JSON.stringify(t))},d=function(t,e,i){var n=[];"string"==typeof t?n.push(t):n=t,o.channels(n,e,i)};return o.getId=function(t){var e="AV/"+t.appId+"/installationId",i=r.storage(e);return i?i:(id=r.getId(),t.id=id,o.sendId(t,function(){r.storage(e,id)}),id)},o.sendId=function(t,i){r.ajax({url:"https://"+e.options.host+"/1.1/installations",method:"post",appId:t.appId,appKey:t.appKey,data:{deviceType:t.deviceType,installationId:t.id,channels:t.channels}},function(n){n?i&&(i(n),e.ec.emit("leancloud-send-id-ok")):setTimeout(function(){o.sendId(t)},5e3)})},o.sendPush=function(t,i){r.ajax({url:"https://"+e.options.host+"/1.1/push",method:"post",appId:t.appId,appKey:t.appKey,data:t},function(e,n){if(e)i&&i(e);else{if(403===n.code||404===n.code)throw n.error;setTimeout(function(){o.sendPush(t,i)},5e3)}})},o.channels=function(t,i,n){var o={installationId:e.options.id,deviceType:e.options.deviceType};n?o.channels={__op:"Remove",objects:t}:o.channels=t,r.ajax({url:"https://"+e.options.host+"/1.1/installations",method:"post",appId:e.options.appId,appKey:e.options.appKey,data:o},function(t){i&&i(t)})},o.createSocket=function(t){var n=new WebSocket(t);e.ws=n,n.addEventListener("open",i),n.addEventListener("close",a),n.addEventListener("message",c),n.addEventListener("error",l)},o.heartbeats=function(){u({}),e.ws.addEventListener("message",function(){e.heartbeatsTimer&&clearTimeout(e.heartbeatsTimer),e.heartbeatsTimer=setTimeout(function(){u({})},n.heartbeatsTime)})},o.guard=function(){e.ec.on(s.close,function(){e.closeFlag||e.ec.emit(s.reuse)})},o.connect=function(t){var i=t.server;if(!(i&&r.now()<i.expires))throw e.ec.emit(s.error),"WebSocket connet failed.";o.createSocket(i.server)},o.ackPush=function(t){u({cmd:"ack",appId:e.options.appId,installationId:e.options.id,ids:t})},o.loginPush=function(t){u({cmd:"login",appId:t.appId,installationId:t.id})},o.getServer=function(i,n){var o=i.appId,a=i.secure,c="",l="http://";t&&"https:"===t.location.protocol&&(l="https://");var u="";switch(i.region){case"cn":u="g0";break;case"us":u="a0";break;default:throw"There is no this region."}c=l+"router-"+u+"-push.leancloud.cn/v1/route?appId="+o,a&&(c+="&secure=1"),r.ajax({url:c},function(t,i){if(t)t.expires=r.now()+1e3*t.ttl,e.server=t,n(t);else{if(403===i.code||404===i.code)throw i.error;e.ec.emit(s.error)}})},{installationId:"",cache:e,open:function(t){var i=this;return o.getServer(e.options,function(t){t&&o.connect({server:e.server})}),t&&e.ec.on(s.open,t),e.ec.once(s.reuse+" "+s.error,function(){e.reuseTimer&&clearTimeout(e.reuseTimer),e.reuseTimer=setTimeout(function(){i.open()},5e3)}),this},close:function(){return e.closeFlag=!0,e.ws.close(),this},on:function(t,i){return e.ec.on(t,i),this},once:function(t,i){return e.ec.once(t,i),this},off:function(t,i){return e.ec.off(t,i),this},emit:function(t,i){return e.ec.emit(t,i),this},send:function(t,i){var n={appId:e.options.appId,appKey:e.options.appKey};if(t.channels||t.where||t.expiration_time||t.expiration_interval||t.push_time||t.prod){for(var r in t)n[r]=t[r];o.sendPush(n,i)}else n.data=t,o.sendPush(n,i);return this},subscribe:function(t,e){return d(t,e),this},unsubscribe:function(t,e){return d(t,e,!0),this},receive:function(t){if(!t)throw"Receive must hava callback.";return e.ec.on(s.message,function(e){t(e)}),this}}};i.push=function(e){if("object"!=typeof e)throw"AV.push need a argument at least.";if(e.appId){if(e.appKey){var i=!t.WebSocket.loadFlashPolicyFile;switch(e={appId:e.appId,appKey:e.appKey,peerId:e.clientId,secure:"undefined"==typeof e.secure?i:e.secure,region:e.region||"cn",channels:e.channels||[],deviceType:"web"},e.region){case"cn":e.host="leancloud.cn";break;case"us":e.host="us-api.leancloud.cn"}var n=a();return n.cache.options=e,e.id=o.getId(e),n.installationId=e.id,n.cache.ec=r.eventCenter(),n}throw"Options must have appKey."}throw"Options must have appId."},i.push.version=e,i.push._tool=r,i.push._engine=o,r.noop=function(){},r.getId=function(){var t=function(){return Date.now().toString(36)+Math.random().toString(36).substring(2,3)};return"AV-"+t()+"-"+t()+"-"+t()},r.log=function(t){console.log(t)},r.ajax=function(t,e){var i=t.url,n=t.method||"get",r=new XMLHttpRequest;r.open(n,i),"post"!==n&&"put"!==n||r.setRequestHeader("Content-Type","application/json"),t.appId&&r.setRequestHeader("X-AVOSCloud-Application-Id",t.appId),t.appKey&&r.setRequestHeader("X-AVOSCloud-Application-Key",t.appKey),r.onprogress=function(){},r.ontimeout=function(){},r.timeout=0,r.onload=function(){r.status>=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(;i<n;i++)t[i]&&e.push(t[i]);return e}return null}var e={},i={},n=function(t,n,r){if(!t)throw"No event name.";if(!n)throw"No callback function.";var o,s=t.split(/\s+/);o=r?i:e;for(var a=0,c=s.length;a<c;a++)s[a]&&(o[s[a]]||(o[s[a]]=[]),o[s[a]].push(n))},r=function(t,n,r){var o;if(o=r?i:e,o[t])for(var s=0,a=o[t].length;s<a;s++)if(o[t][s]===n)return void(o[t][s]=null)};return{on:function(t,e){return n(t,e),this},once:function(t,e){return n(t,e,!0),this},emit:function(n,o){if(!n)throw"No emit event name.";var s=0,a=0;if(e[n]){for(s=0,a=e[n].length;s<a;s++)e[n][s]&&e[n][s].call(this,o);e[n]=t(e[n])}if(i[n]){for(s=0,a=i[n].length;s<a;s++)i[n][s]&&(i[n][s].call(this,o),r(n,i[n][s],!0));i[n]=t(i[n])}return this},off:function(t,e){return r(t,e),this}}}}(window),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<i;e++)if(e in this&&this[e]===t)return e;return-1};this.Project=function(e){function n(){n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("Project","cid","created_at","updated_at","password","access","access_token","name","icon","splash","screens_count","width","height","scale","device","model","shell_type","_shell_type","archived","deleted","destroyed","highlight","_highlight","combo","template","wechat","duplicating","owner_id","owner_email","owner_name","owner_avatar","owner_plan","owner_paid","expired","validated","parent_cid","auto_scale","description","version","team_cid","slack_web_hook_url","channels","png_scale","pngs_scale","limitation"),n.include(Spine.Model.Dirty),n.extend(Spine.Model.Ajax),n.prototype.load=function(t){var e;return this.id=t.cid,n.__super__.load.call(this,t),this.access_token||(this.access_token=Math.uuid(33)),this.model||(this.model=this.device_model()),void 0===this._highlight&&(this._highlight=t.highlight),this._shell_type||(this._shell_type=t.shell_type),e="web"===this.device?100:200,this.png_scale||(this.png_scale=e),this.pngs_scale||(this.pngs_scale=e)},n.prototype.cscreens=function(){return Screen.findAllByAttribute("project_cid",this.cid)},n.prototype.cteam=function(){return Team.find(this.team_cid)},n.prototype.type=function(){return this.template?"template":this.combo?"combo":"project"},n.prototype.instanceScale=function(){return 100},n.prototype.rootScreens=function(){var t;return t=Screen.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})},n.prototype.homeScreen=function(){return this.rootScreens()[0]},n.prototype.orient=function(){return"customize"===this.model||"web"===this.device?"portrait":this.width>this.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,n;if(this.width!==t||this.height!==e)return n=this.width,i=this.height,this.width=t,this.height=e,i?this.download(function(r){return function(){var o,s,a,c;for(a=r.cscreens(),o=0,s=a.length;o<s;o++)c=a[o],"portrait"===c.orientation?(c.width=t,e>i&&(c.height=e+(c.height-i))):(c.width=e,t>n&&(c.height=t+(c.height-n))),c.lsave();return r.setComponentWidth(r.width),MB.safeLoading(I18N.in_progress),MB.triggerProgress(function(){return $("#safemode").hide()})}}(this)):this.setComponentWidth(this.width)},n.prototype.setComponentWidth=function(t){var e;return e=this.cscreens().map(function(t){return t.cid}),Widget.select(function(){return function(n){var r,o;if(("status_bar"===(r=n.name)||"navigation_bar"===r||"tab_bar"===r||"keyboard"===r)&&(o=n.screen_cid,i.call(e,o)>=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.setup=function(){return"android"===this.device?this.setupAndroid():this.setupiOS()},n.prototype.setDevice=function(){return!0},n.prototype.setupAndroid=function(){return MB.COMPONENTS.status_bar.height=23,MB.COMPONENTS.navigation_bar.top=23,MB.COMPONENTS.navigation_bar.height=55},n.prototype.setupiOS=function(){return"iphone_x"===this.model?(MB.COMPONENTS.status_bar.height=44,MB.COMPONENTS.navigation_bar.top=44,MB.COMPONENTS.navigation_bar.height=45):(MB.COMPONENTS.status_bar.height=20,MB.COMPONENTS.navigation_bar.top=20,MB.COMPONENTS.navigation_bar.height=45)},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;i<n;i++)if(e=r[i],e.user_id===t)return e;return null},n.prototype.roleByUid=function(t){var e;return t===this.owner_id?"admin":(e=this.collaboratorByUid(t),e?e.role:"none")},n.prototype.canEdit=function(){var t;return"admin"===(t=this.roleByUid(MB.user.id))||"editor"===t},n.prototype.canAdmin=function(){return"admin"===this.roleByUid(MB.user.id)},n.prototype.isCollaborated=function(){return this.collaborators().length>1},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;n<o;n++)l=a[n],l.host_cid=i.cid;for(Template.refresh(e.templates),Screen.refresh(e.screens),i.fixBadScreens(),Widget.refresh(e.widgets),Link.refresh(e.links),Link.migrateWidgetCids(),Panel.refresh(e.panels),ScreenAlign.refresh(e.screen_aligns),Screenstate.refresh(e.screenstates),Widgetstate.refresh(e.widgetstates),Panelstate.refresh(e.panelstates),CommentThread.refresh(e.threads),Comment.refresh(e.comments),c=e.templates,r=0,s=c.length;r<s;r++)l=c[r],MB.pusher.subscribe(l.cid);return MB.pusher.open||!i.isCollaborated()||/.dev$/.test(location.host)?($("#safemode").hide(),t()):($("#safemode .text").text(I18N.connect_to_push_server),MB.pusher.onOpen=function(){return $("#safemode").hide(),t()},MB.pusher.pusher.open())},error:e})}}(this)))},n.prototype.duplicate=function(t,e,i){var r,o,s,a,c,l,u,d,h,p,f,g,m,v,b,y,_,w,M,x,S,B,k,T,C,P,E,j,A,$,L,W,O,I,N,R,D,H,X,z,F,Y,q,U,J;for(null==t&&(t=!0),null==e&&(e=!1),null==i&&(i={}),E=this.template?"t":this.combo?"c":"p",o=E+Math.uuid(10,16)+(new Date).valueOf(),d=this.template?Template:this.combo?Combo:n,k="break_away"===this.behavior?this.name:this.name+I18N.name_copy,P=new d({name:k,access_token:Math.uuid(31),scale:this.scale,width:this.width,height:this.height,device:this.device,access:this.access,cid:o,icon:"/images/icon_normal.png",splash:this.splash,password:this.password,template:this.template,combo:this.combo,builtin:!1,master:!!t&&this.master,behavior:this.behavior,created_at:(new Date).toISOString(),updated_at:(new Date).toISOString(),model:this.model,archived:!1,auto_scale:this.auto_scale,parent_cid:e?this.cid:null,shell_type:this.shell_type,team_cid:this.team_cid,owner_id:MB.user.id,owner_email:MB.user.email,owner_name:MB.user.name,owner_avatar:MB.user.avatar,limitation:this.limitation}),this.team_cid&&(P.owner_id=this.owner_id,P.owner_email=this.owner_email,P.owner_name=this.owner_name,P.owner_avatar=this.owner_avatar),P.template&&(P.host_cid=MB.project().cid),P.lsave(),X={},p={},U={},C={},z={"default":"default"},$=this.cscreens(),l=0,f=$.length;l<f;l++)H=$[l],H.parent_cid||(a=new Screen({name:H.name,project_cid:P.cid,cid:"s"+Math.uuid(10,16)+(new Date).valueOf(),orientation:H.orientation,position:H.position,expanded:H.expanded,width:H.width,height:H.height,hh:H.hh,fh:H.fh,bgcolor:H.bgcolor,bgimage:H.bgimage}),a.lsave(),X[H.cid]=a.cid);for(L=this.cscreens(),u=0,g=L.length;u<g;u++)r=L[u],r.parent_cid&&(s=new Screen({name:r.name,project_cid:P.cid,parent_cid:X[r.parent_cid],cid:"s"+Math.uuid(10,16)+(new Date).valueOf(),orientation:r.orientation,position:r.position,expanded:r.expanded,width:r.width,height:r.height,hh:r.hh,fh:r.fh,bgcolor:r.bgcolor,bgimage:r.bgimage}),s.lsave(),X[r.cid]=s.cid);for(W=this.cscreens(),x=0,m=W.length;x<m;x++)for(H=W[x],O=H.clinks(),S=0,v=O.length;S<v;S++)M=O[S],F="prev"===M.target_cid?M.target_cid:X[M.target_cid],h=new Link,h.restore(M),h.load({screen_cid:X[H.cid],target_cid:F,cid:"l"+Math.uuid(10,16)+(new Date).valueOf(),widget_cids:null,sourcestate_cid:z[M.sourcestate_cid],targetstate_cid:z[M.targetstate_cid]}),h.lsave(),p[M.cid]=h.cid;for(I=this.cscreens(),j=0,b=I.length;j<b;j++)for(H=I[j],N=H.cwidgets(),A=0,y=N.length;A<y;A++)q=N[A],T=null,T=Link.exists(q.gid)?p[q.gid]:C[B=q.gid]||(C[B]=MB.nextgid(q.gid)),c=new Widget,c.restore(q),c.load({screen_cid:X[H.cid],cid:"w"+Math.uuid(10,16)+(new Date).valueOf(),gid:T}),c.lsave(),this.template&&(U[q.cid]=c.cid);if(this.template)for(R=this.cscreens(),Y=0,_=R.length;Y<_;Y++)for(H=R[Y],D=Link.findAllByAttribute("state_cid",H.cid),J=0,w=D.length;J<w;J++)M=D[J],F="prev"===M.target_cid?M.target_cid:i[M.target_cid]||M.target_cid,h=new Link,h.restore(M),h.load({screen_cid:null,state_cid:X[M.state_cid],target_cid:F,cid:"l"+Math.uuid(10,16)+(new Date).valueOf(),widget_cids:function(){var t,e,i,n;for(e=M.widget_cids.split(","),i=[],n=0,t=e.length;n<t;n++)o=e[n],i.push(U[o]);return i}().join(",")}),h.lsave();return MB.pusher.subscribe(this.cid),P},n}(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.Asset=function(e){function i(){return i.__super__.constructor.apply(this,arguments)}return t(i,e),i.configure("Asset","cid","sid","user_id","width","height","image","raw","name","deleted","destroyed","uri","project_cid","timestamp","size","thumb"),i.include(Spine.Model.Dirty),i.extend(Spine.Model.Ajax),i.prototype.load=function(t){return this.id=t.cid,i.__super__.load.call(this,t),this.sid||(this.sid=this.cid)},i.prototype.properSrc=function(){return/svg$/.test(this.image)?this.image:this.thumb||this.raw||this.image},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.Assettag=function(e){function i(){return i.__super__.constructor.apply(this,arguments)}return t(i,e),i.configure("Assettag","cid","tag","asset_cids"),i.include(Spine.Model.Dirty),i.extend(Spine.Model.Ajax),i.prototype.load=function(t){return this.id=t.cid,i.__super__.load.call(this,t),this.asset_cids||(this.asset_cids=""),this.assets_count=this.cids().length},i.prototype.cids=function(){var t,e,i,n,r;for(n=this.asset_cids.split(","),r=[],e=0,i=n.length;e<i;e++)t=n[e],t&&r.push(t);return r},i.prototype.addAsset=function(t){var e;return e=this.cids(),e.push(t),this.asset_cids=e.join(","),this.lsave()},i.prototype.removeAsset=function(t){var e,i;return e=this.cids(),i=e.indexOf(t),e.splice(i,1),this.asset_cids=e.join(","),this.lsave()},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.CoWorker=function(e){
function i(){return i.__super__.constructor.apply(this,arguments)}return t(i,e),i.configure("CoWorker","name","avatar","screen_cid","last_seen"),i.prototype.load=function(t){return i.__super__.load.call(this,t)},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.Collaborator=function(e){function i(){return i.__super__.constructor.apply(this,arguments)}return t(i,e),i.configure("Collaborator","name","email","role","project_cid","avatar","cid","team_cid","user_id","channel"),i.include(Spine.Model.Dirty),i.extend(Spine.Model.Ajax),i.prototype.load=function(t){return this.id=t.cid,i.__super__.load.call(this,t)},i.prototype.updateHostChannel=function(t){var e,i;if(this.channel&&(e=Project.find(this.project_cid)||Team.find(this.team_cid),e&&e.channels))return i=e.channels.indexOf(this.channel),i===-1&&"update"===t?e.channels.push(this.channel):i!==-1&&"destroy"===t&&e.channels.splice(i,1),e.lsave(!1)},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.Colorset=function(e){function i(){return i.__super__.constructor.apply(this,arguments)}return t(i,e),i.configure("Colorset","cid","name","index","tc","sc","bg","ds","bc","o","ls","bs","fs","is","br","ro","lh","ha","va","ts","tsc","bo","i","td","clip"),i.include(Spine.Model.Dirty),i.extend(Spine.Model.Ajax),i.attrs=["bg","tc","bc","sc","ds","o","ls","bs","fs","ha","va","is","lh","ro","ts","tsc","bo","i","td","clip"],i.prototype.load=function(t){return this.id=t.cid,i.__super__.load.call(this,t)},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.Combo=function(e){function i(){i.__super__.constructor.apply(this,arguments)}return t(i,e),i.configure("Project","cid","created_at","updated_at","password","access","access_token","name","icon","splash","screens_count","width","height","scale","device","model","shell_type","archived","deleted","destroyed","highlight","combo","template","wechat","owner_id","owner_email","owner_name","owner_avatar","owner_plan","expired","validated","parent_cid","auto_scale","description","version","builtin","limitation"),i.include(Spine.Model.Dirty),i.extend(Spine.Model.Ajax),i.prototype.load=function(t){return this.id=t.cid,i.__super__.load.call(this,t),this.access_token||(this.access_token=Math.uuid(33)),this.model||(this.model=this.device_model())},i.prototype.swidth=function(){return this.width},i.prototype.sheight=function(){return this.height},i.prototype.instanceScale=function(t){var e,i,n;return(i=MB.DEVICES[this.device][this.model])?(e=i.width,n=this.auto_scale?100*t/e:100):100},i.prototype.orient=function(){return"portrait"},i.prototype.updatePanelSize=function(t,e){return this.height=e,this.width=t,this.lsave()},i}(Project)}.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.CommentThread=function(e){function i(){return i.__super__.constructor.apply(this,arguments)}return t(i,e),i.configure("CommentThread","cid","screen_cid","user_id","created_at","updated_at","left","top"),i.include(Spine.Model.Dirty),i.extend(Spine.Model.Ajax),i.prototype.load=function(t){return this.id=t.cid,i.__super__.load.call(this,t)},i.prototype.s=function(){return $("body").data("scale")},i.prototype.getLeft=function(){return(this.left||0)*this.s()/100},i.prototype.getTop=function(){return(this.top||0)*this.s()/100},i.prototype.setLeft=function(t){return this.left=Math.round(100*t/this.s())},i.prototype.setTop=function(t){return this.top=Math.round(100*t/this.s())},i}(Spine.Model),this.Comment=function(e){function i(){return i.__super__.constructor.apply(this,arguments)}return t(i,e),i.configure("Comment","cid","thread_cid","user_id","created_at","updated_at","message"),i.include(Spine.Model.Dirty),i.extend(Spine.Model.Ajax),i.prototype.load=function(t){return this.id=t.cid,i.__super__.load.call(this,t)},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.Link=function(e){function i(){return i.__super__.constructor.apply(this,arguments)}return t(i,e),i.configure("Link","cid","target_cid","screen_cid","transition","gesture","destroyed","timer","left","right","top","bottom","width","height","state_cid","widget_cids","menu_offset","timestamp","targetstate_cid","sourcestate_cid","ani_duration","easing","ani_delay","reset"),i.include(Spine.Model.Dirty),i.extend(Spine.Model.Ajax),i.prototype.load=function(t){var e;return this.id=t.cid,i.__super__.load.call(this,t),this.panel_cid="",this.widget_cids||(this.widget_cids=""),this.menu_offset||(this.menu_offset=75),this.ani_duration||(this.ani_duration=this.targetstate_cid?"0.4s":"0.2s"),this.ani_delay||(this.ani_delay=""),this.easing||(this.easing="linear"),this.sourcestate_cid||(this.sourcestate_cid="default"),this.targetstate_cid||(this.targetstate_cid=null),e=Screen.find(this.target_cid),e&&e.cp()?this.template=e.cp().template:this.template=!1},i.prototype.cs=function(){return Screen.find(this.screen_cid)},i.prototype.ts=function(){return this.target_cid?Screen.find(this.target_cid):this.targetstate_cid?Screen.find(this.screen_cid):void 0},i.prototype.cwidgets=function(){var t,e,i,n,r,o,s;if(MB.linkCaches||(MB.linkCaches={}),i=this.cs()?this.cid+this.cs().state_cid:this.cid,MB.linkCaches[i])return MB.linkCaches[i];if(s=[],this.widget_cids)for(r=this.widget_cids.split(","),e=0,n=r.length;e<n;e++)t=r[e],o=Widget.find(t)||Panel.find(t),o&&s.push(o);else s=Widget.findAllByAttribute("gid",this.cid),s=s.concat(Panel.findAllByAttribute("gid",this.cid));return MB.linkCaches[i]=s,s},i.prototype.delay=function(){return this.ani_duration},i.prototype.restore=function(t){return this.transition=t.transition,this.timer=t.timer,this.menu_offset=t.menu_offset,this.gesture=t.gesture,this.ani_duration=t.ani_duration,this.ani_delay=t.ani_delay,this.target_cid=t.target_cid,this.targetstate_cid=t.targetstate_cid},i.migrateWidgetCids=function(){return this.select(function(t){var e,i,n,r,o;if(t.widget_cids){for(r=t.widget_cids.split(","),i=0,n=r.length;i<n;i++)e=r[i],(o=Widget.find(e))&&(o.gid=t.cid,o.lsave());t.widget_cids="",t.lsave()}return!1})},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.Panel=function(e){function i(){return i.__super__.constructor.apply(this,arguments)}return t(i,e),i.configure("Panel","cid","screen_cid","template_cid","top","left","width","height","name","gid","behavior","z","timestamp","v","fixed","fixed_type","main_state_cid","screenstate_cid","locked","timerFired"),i.include(Spine.Model.Dirty),i.include(Spine.Model.State),i.extend(Spine.Model.Ajax),i.prototype.load=function(t){return this.id=t.cid,this.moveable=!0,this.gestureable=!0,this.name="panel",i.__super__.load.call(this,t),this.timestamp||(this.timestamp=MB.lastTimestamp()),this.timestamp>MB.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;n<r;n++)e=o[n],this[e]=t[e];return this},i.prototype.equals=function(t){var e,n,r,o;for(o=i.ATTRS,n=0,r=o.length;n<r;n++)if(e=o[n],this[e]!==t[e])return!1;return!0},i.prototype.ct=function(){return Template.find(this.template_cid)},i.prototype.states=function(){var t,e,i,n,r;for(i=this.ct().cscreens(),n=[],t=0,e=i.length;t<e;t++)r=i[t],r.panel_cid=this.cid,n.push(r);return n},i.prototype.mainState=function(){var t;return t=Screen.find(this.main_state_cid),t&&t.project_cid===this.template_cid?t:this.ct().homeScreen()},i.prototype.l=function(){return this.left*this.s()/100},i.prototype.t=function(){return this.top*this.s()/100},i.prototype.w=function(){return Math.round(this.width*this.s()/100)},i.prototype.h=function(){return Math.round(this.height*this.s()/100)},i.prototype.r=function(){return this.l()+this.w()},i.prototype.b=function(){return this.t()+this.h()},i.prototype.bR=function(){return 0},i.prototype._setAttr=function(t,e,i){if(this[t]=100*e/this.s(),this[i]()<e&&(this[t]+=1),this[i]()>e)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().w()},i.prototype.inHeader=function(){return this.b()<=this.cs().headerHeight()},i.prototype.inFooter=function(){return this.t()>=this.cs().footerTop()&&this.t()<=this.cs().h()},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.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<i;e++)if(e in this&&this[e]===t)return e;return-1};this.Screen=function(e){function n(){n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("Screen","cid","name","orientation","position","project_cid","parent_cid","expanded","height","hh","fh","bgcolor","bgimage","width","artboard_id","artboard_asset_id","state_cid","_widgetsByName"),n.include(Spine.Model.Dirty),n.extend(Spine.Model.Ajax),n.prototype.load=function(t){if(this.id=t.cid,n.__super__.load.call(this,t),this.project_cid||(this.project_cid=t.Project_cid),this.project_cid)return this.height||(this.height=this.cp().sheight(this.orientation||this.orient())),this.width||(this.width=this.cp().swidth(this.orientation||this.orient())),this.bgcolor||(this.bgcolor=this.dBg()),this.state_cid||(this.state_cid="default")},n.prototype.device=function(){return this.cp().device},n.prototype.scale=function(){return this.cp().scale},n.prototype.orient=function(){return"customize"===this.cp().model?this.width&&this.cp().width!==this.width?"landscape":"portrait":this.orientation.toLowerCase()},n.prototype.h=function(){return Math.round(this.height*MB.scale()/100)},n.prototype.w=function(){return Math.round(this.width*MB.scale()/100)},n.prototype.cp=function(){return Project.find(this.project_cid)||Template.find(this.project_cid)||Combo.find(this.project_cid)},n.prototype.cwidgets=function(){return Widget.findAllByAttribute("screen_cid",this.cid).sort(function(t,e){return t.timestamp-e.timestamp})},n.prototype.cpanels=function(){return Panel.findAllByAttribute("screen_cid",this.cid).sort(function(t,e){return t.timestamp-e.timestamp})},n.prototype.cscreenstates=function(){return Screenstate.findAllByAttribute("screen_cid",this.cid).sort(function(t,e){return t.timestamp-e.timestamp})},n.prototype.citems=function(){var t,e;return e=Widget.findAllByAttribute("screen_cid",this.cid),t=Panel.findAllByAttribute("screen_cid",this.cid),e.concat(t).sort(function(t,e){return t.z!==e.z?t.z-e.z:t.timestamp-e.timestamp})},n.prototype.citemsByTop=function(){var t,e;return e=Widget.findAllByAttribute("screen_cid",this.cid),t=Panel.findAllByAttribute("screen_cid",this.cid),e.concat(t).sort(function(t,e){return t.t()-e.t()||t.z-e.z||t.timestamp-e.timestamp})},n.prototype.clinks=function(){return Link.select(function(t){return function(e){return e.screen_cid===t.cid&&!e.state_cid}}(this))},n.prototype.parent=function(){return n.find(this.parent_cid)},n.prototype.expandable=function(){var t,e,n,r;for(r=this,t=[r.cid];e=r.parent();)n=e.cid,i.call(t,n)>=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,this.lsave(!1),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,i,n,r,o,s,a;if("web"!==this.cp().device)return a=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()}),a.lsave(),t&&(a=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()}),a.lsave()),"iphone_x"===this.cp().model?(s=new Widget({cid:"w"+Math.uuid(10,16)+(new Date).valueOf(),screen_cid:this.cid,name:"tab_bar",width:this.width,height:34,bc:"transparent"}),s.lsave(),o="portrait"===this.orientation?[799,121,134]:[364,299,214],n=o[0],i=o[1],r=o[2],e=new Widget({cid:"w"+Math.uuid(10,16)+(new Date).valueOf(),screen_cid:this.cid,name:"rounded_rect",bs:0,br:3,bg:"#000000",top:n,left:i,width:r,height:5}),e.lsave()):void 0},n.prototype.maxZ=function(){var t,e;return e=-(1/0),t=!0,Widget.select(function(i){return function(n){return n.screen_cid===i.cid&&"sticky"!==n.name&&(e=Math.max(e,n.z),t=!1),!1}}(this)),Panel.select(function(i){return function(n){return n.screen_cid===i.cid&&"sticky"!==n.name&&(e=Math.max(e,n.z),t=!1),!1}}(this)),t?5:e},n.prototype.minZ=function(){var t,e;return e=1/0,t=!0,Widget.select(function(i){return function(n){return n.screen_cid===i.cid&&"sticky"!==n.name&&(t=!1,e=Math.min(e,n.z)),!1}}(this)),Panel.select(function(i){return function(n){return n.screen_cid===i.cid&&"sticky"!==n.name&&(t=!1,e=Math.min(e,n.z)),!1}}(this)),t?5:e},n.prototype.widgetsByName=function(){var t,e,i,n;if(!this._widgetsByName){for(this._widgetsByName={},i=this.cwidgets(),t=0,e=i.length;t<e;t++)n=i[t],this._widgetsByName[n.name]=n;this.lsave(!1)}return this._widgetsByName},n.prototype.sb=function(){return this.widgetsByName().status_bar},n.prototype.tb=function(){return this.widgetsByName().tab_bar},n.prototype.nb=function(){return this.widgetsByName().navigation_bar},n.prototype.kb=function(){return this.widgetsByName().keyboard},n.prototype.sbH=function(){return this.sb()?this.sb().height:0},n.prototype.tbH=function(){return this.tb()?this.tb().height:0},n.prototype.nbH=function(){return this.nb()?this.nb().height:0},n.prototype.kbH=function(){return"web"!==this.cp().device&&this.kb()?this.kbDH():0},n.KEYBOARDS={ipad:{portrait:[1536,526],landscape:[2048,704]},iphone:{portrait:[640,348],landscape:[1136,252]},android:{portrait:[574,354],landscape:[956,278]}},n.prototype.kbDH=function(){var t,e,i,r;return t=this.cp().device,i=n.KEYBOARDS[t][this.orient()],r=i[0],e=i[1],Math.round(e*this.width/r)},n.prototype.headerHeight=function(){var t,e;return this.cp().template||0===this.hh?0:(e=this.sbH(),t=(this.hh||e+this.nbH())*MB.scale()/100,e&&t===e&&(t+=1),t)},n.prototype.footerHeight=function(){return this.cp().template||0===this.fh?0:(this.fh||Math.max(this.kbH(),this.tbH()))*MB.scale()/100},n.prototype.footerTop=function(){return this.h()-this.footerHeight()},n.prototype.dW=function(){return Math.round(this.cp().swidth(this.orient())*MB.scale()/100)},n.prototype.dH=function(){return Math.round(this.cp().sheight(this.orient())*MB.scale()/100)},n.prototype.dBg=function(){return"project"===this.cp().type()?MB.config.screenBg:"transparent"},n.prototype.bg=function(){return this.bgcolor&&"transparent"!==this.bgcolor?this.bgcolor:MB.config.screenBg},n.prototype.eH=function(){return this.h()-this.dH()},n.prototype.splash=function(){return this.cp().splash||""},n.prototype.sa=function(){return ScreenAlign.find(this.cid)||new ScreenAlign({cid:this.cid})},n.prototype.halignLines=function(){var t,e,i,n,r;for(n=this.sa().h.split(","),r=[],t=0,i=n.length;t<i;t++)e=n[t],e&&r.push(Number(e));return r},n.prototype.valignLines=function(){var t,e,i,n,r;for(n=this.sa().v.split(","),r=[],t=0,i=n.length;t<i;t++)e=n[t],e&&r.push(Number(e));return r},n.prototype.duplicate=function(){var t,e,i,r,o,s,a,c,l,u,d,h,p,f,g,m,v,b,y,_,w,M,x,S,B,k,T,C,P,E,j,A,$,L,W,O,I,N,R,D,H,X;for(e=new n({name:this.name+" Copy",project_cid:this.project_cid,orientation:this.orientation,cid:"s"+Math.uuid(10,16)+(new Date).valueOf(),parent_cid:this.parent_cid,width:this.width,height:this.height,hh:this.hh,fh:this.fh,bgcolor:this.bgcolor,bgimage:this.bgimage,state_cid:"default",position:this.position+1,artboard_id:this.artboard_id,artboard_asset_id:this.artboard_asset_id}),e.lsave(),(I=ScreenAlign.find(this.cid))&&(i=new ScreenAlign({cid:e.cid,h:I.h,v:I.v}),i.lsave()),l={},T={},R={"default":"default"},j=this.cscreenstates(),o=0,u=j.length;o<u;o++)N=j[o],S=new Screenstate({screen_cid:e.cid,name:N.name,timestamp:N.timestamp,cid:"ss"+Math.uuid(10,16)+(new Date).valueOf()}),S.lsave(),R[N.cid]=S.cid;for(A=this.clinks(),s=0,d=A.length;s<d;s++)m=A[s],c=new Link,c.restore(m),c.load({screen_cid:e.cid,widget_cids:null,cid:"l"+Math.uuid(10,16)+(new Date).valueOf(),sourcestate_cid:R[m.sourcestate_cid],targetstate_cid:R[m.targetstate_cid]}),c.lsave(),l[m.cid]=c.cid;for($=this.cwidgets(),a=0,h=$.length;a<h;a++)for(H=$[a],H.setState("default",!1),k=null,k=Link.exists(H.gid)?l[H.gid]:T[y=H.gid]||(T[y]=MB.nextgid(H.gid)),r=new Widget,r.restore(H),r.load({screen_cid:e.cid,cid:"w"+Math.uuid(10,16)+(new Date).valueOf(),gid:k}),r.lsave(),L=Widgetstate.findAllByAttribute("widget_cid",H.cid),v=0,p=L.length;v<p;v++)X=L[v],R[X.screenstate_cid]&&"default"!==X.screenstate_cid&&(k=Link.exists(X.gid)?l[X.gid]:T[_=X.gid]||(T[_]=MB.nextgid(X.gid)),B=new Widgetstate,B.restore(X),B.load({cid:R[X.screenstate_cid]+r.cid,screenstate_cid:R[X.screenstate_cid],widget_cid:r.cid,gid:k}),B.lsave());for(W=this.cpanels(),b=0,f=W.length;b<f;b++)for(C=W[b],C.setState("default",!1),k=null,k=Link.exists(C.gid)?l[C.gid]:T[w=C.gid]||(T[w]=MB.nextgid(C.gid)),D=Template.find(C.template_cid),"break_away"===D.behavior&&(D=D.duplicate(!1)),t=new Panel,t.restore(C),t.load({screen_cid:e.cid,cid:"p"+Math.uuid(10,16)+(new Date).valueOf(),template_cid:D.cid,gid:k}),t.lsave(),O=Panelstate.findAllByAttribute("panel_cid",C.cid),E=0,g=O.length;E<g;E++)P=O[E],R[P.screenstate_cid]&&"default"!==P.screenstate_cid&&(x=new Panelstate,x.restore(P),k=Link.exists(P.gid)?l[P.gid]:T[M=P.gid]||(T[M]=MB.nextgid(P.gid)),x.load({cid:R[P.screenstate_cid]+t.cid,template_cid:t.template_cid,screenstate_cid:R[P.screenstate_cid],panel_cid:t.cid,gid:k}),x.lsave());return e},n.prototype.setupSplash=function(t){return this.w()>this.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;e<r;e++)if(n=s[e],["up","down"].indexOf(n.gesture)!==-1){if(this.height>this.dH())return void MB.alert({title:I18N.gesture_conflict,desc:I18N.vertical_conflict})}else if(["left","right"].indexOf(n.gesture)!==-1)for(c=this.cpanels(),i=0,o=c.length;i<o;i++)if(a=c[i],a.width<a.ct().width)return void MB.alert({title:I18N.gesture_conflict,desc:I18N.horizontal_conflict})},n}(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.ScreenAlign=function(e){function i(){return i.__super__.constructor.apply(this,arguments)}return t(i,e),i.configure("screen_align","cid","h","v"),i.include(Spine.Model.Dirty),i.extend(Spine.Model.Ajax),i.prototype.load=function(t){return i.__super__.load.call(this,t),this.h||(this.h=""),this.v||(this.v="")},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.Screenstate=function(e){function i(){return i.__super__.constructor.apply(this,arguments)}return t(i,e),i.configure("Screenstate","cid","name","screen_cid","timestamp","hh","fh"),i.include(Spine.Model.Dirty),i.extend(Spine.Model.Ajax),i.prototype.load=function(t){return this.id=t.cid,i.__super__.load.call(this,t)},i.prototype.cs=function(){return Screen.find(this.screen_cid)},i.prototype.widgetStates=function(){return Widgetstate.findAllByAttribute("screenstate_cid",this.cid)},i.prototype.panelStates=function(){return Panelstate.findAllByAttribute("screenstate_cid",this.cid)},i.prototype.stateLinks=function(){return Link.select(function(t){return function(e){return e.sourcestate_cid===t.cid||e.targetstate_cid===t.cid}}(this))},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.Team=function(e){function i(){return i.__super__.constructor.apply(this,arguments)}return t(i,e),i.configure("Team","name","icon","cid","owner_id","owner_email","owner_name","owner_avatar","color","updated_at","created_at","channels","limitation"),i.include(Spine.Model.Dirty),i.extend(Spine.Model.Ajax),i.prototype.load=function(t){return this.id=t.cid,i.__super__.load.call(this,t)},i.prototype.cprojects=function(){return Project.select(function(t){return function(e){return e.team_cid===t.cid&&!e.deleted&&!e.template&&!e.combo&&e.screens_count}}(this))},i.prototype.collaborators=function(){return Collaborator.select(function(t){return function(e){return"MOCK"!==e.email&&e.team_cid===t.cid}}(this))},i.prototype.collaboratorByUid=function(t){var e,i,n,r;for(r=this.collaborators(),i=0,n=r.length;i<n;i++)if(e=r[i],e.user_id===t)return e;return null},i.prototype.roleByUid=function(t){var e;return t===this.owner_id?"admin":(e=this.collaboratorByUid(t),e?e.role:"none")},i.prototype.canAdmin=function(){return"admin"===this.roleByUid(MB.user.id)},i.prototype.isTeam=function(){return!0},i.prototype.colorO=function(t){return this.color.replace("RGB","RGBA").replace(")",","+t+")")},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.Template=function(e){function i(){i.__super__.constructor.apply(this,arguments)}return t(i,e),i.configure("Project","cid","created_at","updated_at","password","access","access_token","name","icon","splash","screens_count","width","height","scale","device","model","shell_type","archived","deleted","destroyed","highlight","combo","template","wechat","owner_id","owner_email","owner_name","owner_avatar","owner_plan","expired","validated","parent_cid","auto_scale","description","version","team_cid","builtin","master","behavior","host_cid","limitation"),i.include(Spine.Model.Dirty),i.extend(Spine.Model.Ajax),i.masters=function(){return this.select(function(t){return t.master&&!t.deleted})},i.prototype.load=function(t){return this.id=t.cid,i.__super__.load.call(this,t),this.access_token||(this.access_token=Math.uuid(33)),this.model||(this.model=this.device_model())},i.prototype.swidth=function(){return this.width},i.prototype.sheight=function(){return this.height},i.prototype.orient=function(){return"portrait"},i.prototype.updatePanelSize=function(t,e){var i,n,r,o,s,a,c,l;for(a=Panel.findAllByAttribute("template_cid",this.cid),i=0,r=a.length;i<r;i++)s=a[i],s.height=e,s.width===this.width&&(s.width=t),s.lsave();for(c=this.cscreens(),n=0,o=c.length;n<o;n++)l=c[n],l.height=e,l.width=t,l.lsave();return this.height=e,this.width=t,this.lsave()},i}(Project)}.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<i;e++)if(e in this&&this[e]===t)return e;return-1};this.Widget=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.configure("Widget","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","input_type","slw","slt","clip","filter","locked","_ratio","_isPanelWidget"),n.include(Spine.Model.Dirty),n.include(Spine.Model.State),n.extend(Spine.Model.Ajax),n.ATTRS=["name","text","icon","width","height","left","top","gid","timestamp","fs","is","bs","br","va","ha","lh","z","th","image","bg","tc","bc","ds","sc","ts","tsc","o","bo","i","td","p","ro","ls","padding","checked","numeric","v","fixed","fixed_type","tt_placement","tt_offset","tt_arrow_size","ani_name","ani_delay","ani_count","ani_duration","input_type","slw","slt","clip","filter","locked"],n.FIX_TYPE={auto:1,top:2,bottom:3},n.MAXZ=Math.pow(2,30)-1,n.prototype.load=function(t){var e;if(this.id=t.cid,n.__super__.load.call(this,t),this.multiline=["text_view","sticky","rounded_rect","circle_rect","mtooltip","mselect"].indexOf(this.name)!==-1,this.richedit=["label","text_view","sticky","rounded_rect","circle_rect","mtooltip"].indexOf(this.name)!==-1,this.iconic=["icon_button","tab_item"].includes(this.name)||"button"===this.name&&!!this.icon,this.moveable=["status_bar","tab_bar","keyboard","navigation_bar"].indexOf(this.name)===-1,this.gestureable=["pg","lr","image_view","rectangle","rounded_rect","circle_rect"].indexOf(this.name)!==-1,"mcheckbox"===this.name&&(this.name="mcheckbox2"),MB.COMPONENTS[this.name]?this.zoomable=MB.COMPONENTS[this.name].zoomable||"n,s,e,w,ne,nw,se,sw":this.zoomable=" ",["text_field"].indexOf(this.name)!==-1&&(this.zoomable="n,s,e,w,ne,nw,se,sw"),e=MB.COMPONENTS[this.name],e&&("number"!=typeof this.fs&&(this.fs=e.fs),"number"!=typeof this.is&&(this.is=e.is),"number"!=typeof this.br&&(this.br=e.br),"number"!=typeof this.bs&&(this.bs=e.bs),this.ha||(this.ha=e.ha),this.va||(this.va=e.va),0!==this.z&&(this.z||(this.z=e.z)),e.lh&&(this.lh||(this.lh=Math.floor(this.fs*e.lh))),this.padding||(this.padding=e.padding)),this.text||(this.text=""),"label"===this.name&&(this.text=this.text.replace(/\n$/,"")),this.autoWidth="label"===this.name,this.autoHeight=["mtooltip","text_view","sticky"].indexOf(this.name)!==-1,this.th||(this.th="status_bar"===this.name?"light":""),0!==this.o&&(this.o||(this.o=100)),this.ds||(this.ds=0),this.bs||(this.bs=0),this.br||(this.br=0),this.sc||(this.sc=MB.currentProject&&MB.currentProject.isAndroid()?"#222222":"#aaaaaa"),this.ts||(this.ts=0),this.tsc||(this.tsc="#aaaaaa"),this.bo||(this.bo=0),this.i||(this.i=0),this.td||(this.td="normal"),this.bg||(this.bg=""),this.tc||(this.tc=""),this.bc||(this.bc=""),0!==this.z&&(this.z||(this.z=5)),this.ro||(this.ro=0),this.ls||(this.ls=0),this.filter||(this.filter=""),this.input_type||(this.input_type="text"),this.timestamp||(this.timestamp=MB.lastTimestamp()),this.timestamp>MB.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.p!==!1&&(this.p||(this.p=!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),"sticky"===this.name&&(this.z=n.MAXZ),
"label"===this.name&&/\n/.test(this.text))return this.name="text_view",this.lsave()},n.prototype.cs=function(){return this._cs||(this._cs=Screen.find(this.screen_cid))},n.prototype.isFullWidth=function(){return["navigation_bar","status_bar","tab_bar","keyboard"].indexOf(this.name)!==-1},n.prototype.isFooter=function(){return["tab_bar","keyboard"].indexOf(this.name)!==-1},n.prototype.themeable=function(){return["status_bar","navigation_bar","tab_bar","search_bar","image_view","keyboard"].indexOf(this.name)!==-1},n.prototype.inScreen=function(){return this.r()>0&&this.l()<this.cs().w()},n.prototype.inHeader=function(){return this.b()<=this.cs().headerHeight()},n.prototype.inFooter=function(){var t,e,i;return i=this.cs(),t=i.footerHeight(),e=this.t()>=i.footerTop()&&this.t()<=i.h(),!this.isFooter()&&0!==t&&e},n.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)},n.prototype.restore=function(t){var e,i,r,o;for(t.screen_cid&&(this.screen_cid=t.screen_cid),o=n.ATTRS,i=0,r=o.length;i<r;i++)e=o[i],this[e]=t[e];return this},n.prototype.equals=function(t){var e,i,r,o;for(o=n.ATTRS,i=0,r=o.length;i<r;i++)if(e=o[i],this[e]!==t[e])return!1;return!0},n.prototype.styleEquals=function(t){var e,r,o,s,a;for(r="sticky"===t.name?[]:["top","left"],a=n.ATTRS,o=0,s=a.length;o<s;o++)if(e=a[o],i.call(r,e)<0&&this[e]!==t[e])return!1;return!0},n.prototype.status_bar_t=function(){return 0},n.prototype.keyboard_t=function(){return this.cs().height-this.height},n.prototype.tab_bar_t=function(){return this.cs().height-this.height},n.prototype.navigation_bar_t=function(){return this.cs().sbH()},n.prototype.l=function(){return(this.left||0)*this.s()/100},n.prototype.t=function(){var t;return t=this.moveable?this.top:this[this.name+"_t"](),t*this.s()/100},n.prototype.w=function(){return"pg"===this.name?MB.COMPONENTS.pg.width:this.isFullWidth()?this.cs().width*this.s()/100:this.width*this.s()/100},n.prototype.h=function(){return"pg"===this.name?MB.COMPONENTS.pg.height:this.height*this.s()/100},n.prototype.r=function(){return this.l()+this.w()},n.prototype.b=function(){return this.t()+this.h()},n.prototype._setAttr=function(t,e){return this[t]=Math.round(100*e/this.s())},n.prototype.setL=function(t){return this._setAttr("left",t)},n.prototype.setT=function(t){return this._setAttr("top",t)},n.prototype.setW=function(t){return this._setAttr("width",t)},n.prototype.setH=function(t){return this._setAttr("height",t)},n.prototype.rect=function(){var t,e;return this.ro?this.rotateRect():(e=this.moveable?this.top:this[this.name+"_t"](),t=this.left||0,{top:e,left:t,width:this.isFullWidth()?this.cs().width:this.width,height:this.height,right:t+this.width,bottom:e+this.height})},n.prototype.rotateRect=function(){var t,e,i,n,r,o,s,a,c,l,u,d,h,p;return o=MB.atan2(this.width,this.height),c=o-this.ro,l=c-2*o,u=c+180,d=l+180,e=this.left+this.width/2,i=this.top+this.height/2,r=MB.hypotenuse(this.width/2,this.height/2),s=h=1/0,a=t=-(1/0),[c,l,u,d].forEach(function(n){var o,c;if(o=Math.round(e+r*MB.cos(n)),c=Math.round(i+r*MB.sin(n)),o<s&&(s=o),c<h&&(h=c),o>a&&(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}},n.prototype.s=function(){return $("body").data("scale")},n.prototype.fS=function(){var t;return t=(this.fs*this.s()/100).toFixed(1),t<MB.config.minFS&&t>0&&MB.minFontSizeIssue(),t},n.prototype.bS=function(){return this.bs?Math.floor(this.bs*this.s()/100)||1:0},n.prototype.iS=function(){return Math.round(this.is*this.s()/100)},n.prototype.bR=function(){return Math.round(this.br*this.s()/100)},n.prototype.lH=function(){return Math.round(this.lh*this.s()/100)},n.prototype.paddingS=function(){return Math.round(this.padding*this.s()/100)},n.prototype.lineStyle=function(){return["solid","dotted","dashed"][this.ls]},n.prototype.arrowSize=function(){return Math.round(this.tt_arrow_size*this.s()/100)},n.prototype.ttOffset=function(){return Math.round(this.tt_offset*this.s()/100)},n.prototype.inspectables=function(){return MB.INSPECTABLES[this.name]},n.prototype.textWidth=function(){var t,e;return e=document.getElementById("fontawesome"),MB.currentProject&&(e.className=MB.currentProject.device),$("#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},n.prototype.textHeightS=function(){return this._textHeight(this.text)*this.s()/100},n.prototype.textHeight=function(){return this._textHeight(this.text)},n.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"),MB.currentProject&&(i.className=MB.currentProject.device),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},n.prototype.minWidth=function(){return["label","button"].indexOf(this.name)!==-1?this.textWidth():10},n.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},n.prototype.initialWidth=function(){return["label"].indexOf(this.name)!==-1?this.textWidth():null},n.prototype.initialHeight=function(){return["mtooltip","text_view"].indexOf(this.name)!==-1?this.textHeight():null},n.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},n.prototype.clipType=function(){var t;return this.clip?(t=/(.*?)\(/.exec(this.clip)[1],t.charAt(0).toUpperCase()+t.slice(1)):null},n.prototype.clipPolygonPoints=function(){var t,e,i,n,r;for(n=this.clip.split(","),r=[],t=0,e=n.length;t<e;t++)i=n[t],r.push(i.replace(/[^\d\s\%]/g,""));return r},n.prototype.clipInsetPoints=function(){var t,e,i,n,r;for(n=this.clip.split(/\s/),r=[],t=0,e=n.length;t<e;t++)i=n[t],r.push(parseInt(i.replace(/[^\d]/g,"")));return r},n.prototype.clipCenter=function(){var t;return t=/at (\d*?)\% (\d*?)\%/.exec(this.clip)||[50,50],{x:parseInt(t[1]),y:parseInt(t[2])}},n.prototype.clipCRadius=function(){return parseInt(/(\d*?)\% at/.exec(this.clip)[1])},n.prototype.clipXRadius=function(){return parseInt(/(\d*?)\% (\d*?)\% at/.exec(this.clip)[1])},n.prototype.clipYRadius=function(){return parseInt(/(\d*?)\% (\d*?)\% at/.exec(this.clip)[2])},n.prototype.setClipPoint=function(t,e,i){return"number"==typeof t?this.set_poly_point(t,e):this["set_clip_"+t](e,i)},n.prototype.set_clip_xradius=function(t){var e,i;return e=this.clipCenter(),i=Math.round(Math.abs(e.x-t.left)),this.clip="ellipse("+i+"% "+this.clipYRadius()+"% at "+e.x+"% "+e.y+"%)"},n.prototype.set_clip_yradius=function(t){var e,i;return e=this.clipCenter(),i=Math.round(Math.abs(e.y-t.top)),this.clip="ellipse("+this.clipXRadius()+"% "+i+"% at "+e.x+"% "+e.y+"%)"},n.prototype.set_clip_cradius=function(t,e){var i,n,r,o,s,a,c;return i=this.clipCenter(),r=this.w()*i.x/100,o=this.h()*i.y/100,a=e.position.left-r,c=e.position.top-o,s=Math.sqrt(Math.pow(a,2)+Math.pow(c,2)),n=Math.round(s/(this.w()+this.h())*200),this.clip="circle("+n+"% at "+i.x+"% "+i.y+"%)"},n.prototype.set_clip_ccenter=function(t){return this.clip="circle("+this.clipCRadius()+"% at "+t.left+"% "+t.top+"%)"},n.prototype.set_clip_ecenter=function(t){return this.clip="ellipse("+this.clipXRadius()+"% "+this.clipYRadius()+"% at "+t.left+"% "+t.top+"%)"},n.prototype.set_clip_linset=function(t){var e;return e=this.clipInsetPoints(),this.clip="inset("+e[0]+"% "+e[1]+"% "+e[2]+"% "+t.left+"%)"},n.prototype.set_clip_tinset=function(t){var e;return e=this.clipInsetPoints(),this.clip="inset("+t.top+"% "+e[1]+"% "+e[2]+"% "+e[3]+"%)"},n.prototype.set_clip_rinset=function(t){var e;return e=this.clipInsetPoints(),this.clip="inset("+e[0]+"% "+(100-t.left)+"% "+e[2]+"% "+e[3]+"%)"},n.prototype.set_clip_binset=function(t){var e;return e=this.clipInsetPoints(),this.clip="inset("+e[0]+"% "+e[1]+"% "+(100-t.top)+"% "+e[3]+"%)"},n.prototype.set_clip_cinset=function(t){var e,i,n;return e=this.clipInsetPoints(),i=(100-e[1]-e[3])/2,n=(100-e[0]-e[2])/2,t.top>100-n&&(t.top=100-n),t.top<n&&(t.top=n),t.left>100-i&&(t.left=100-i),t.left<i&&(t.left=i),this.clip="inset("+(t.top-n)+"% "+(100-t.left-i)+"% "+(100-t.top-n)+"% "+(t.left-i)+"%)"},n.prototype.set_poly_point=function(t,e){var i;return i=this.clipPolygonPoints(),i[t]=e.left+"% "+e.top+"%",this.clip="polygon("+i.join(",")+")"},n.prototype.isBottomFixed=function(t){return parseInt(this.fixed_type)===n.FIX_TYPE.bottom||this.fixed_type===n.FIX_TYPE.auto&&this.t()>t.h()-t.dH()/2},n.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"),'<span class="icon '+i+'" style="'+e+'">'+("md"===s?r:"")+"</span>"},n.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]},n}(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(/^<p>/.test(t))return e=t.replace(/\n/g,"");for(e="",r=t.split(/\n/),i=0,n=r.length;i<n;i++)o=r[i],o||(o="&nbsp;"),e+="<p>"+o+"</p>";return e},t.text_field=t.navigation_bar=function(t){return'<span class="text">'+t.text+"</span>"},t.mtext_input=function(t,e){var i;return i=/p$/.test(e)?"":'readonly="readonly"','<input type="'+t.input_type+'" placeholder="'+t.text+'" '+i+"></input>"},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;",'<textarea style="'+r+'" placeholder="'+t.text+'" '+i+"></textarea>"},t.mcheckbox2=function(t){var e;return e=t.checked?'checked="true"':"",'<input type="checkbox" '+e+"></input>"},t.mfile_input=function(t,e){var i;return i=/p$/.test(e)?"onclick='MB.config.fileSelecting = true;'":"",'<input type="file" '+i+"></input>"},t.mradiobutton=function(t){var e;return e=t.checked?'checked="true"':"",'<input type="radio" name="'+t.gid+'" '+e+"></input>"},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<n;i++)e=r[i],o.push("<option>"+e+"</option>");return o}().join(""),"<select>"+i+"</select>"},t.button=function(t){return'<div class="button-wrapper">\n '+(t.icon?t.get_icon(!0,"font-size:"+t.iS()+"px;"):"")+'\n <span class="text">'+t.text+"</span>\n</div>"},t.hr=function(t){var e;return e=t.h()-10*MB.scale()/100,e<1&&(e=1),'<span style="border-top-width: '+e+'px;"></span>'},t.ve=function(t){var e;return e=t.w()-10*MB.scale()/100,e<1&&(e=1),'<span style="border-left-width: '+e+'px;"></span>'},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")+";",'<span style="'+e+'"></span>'},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")+";",'<span style="'+e+'"></span>'},t.lr=t.tab_bar=t.rectangle=function(){return"<span></span>"},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()+";"),'<span style="background-color:'+t.bg+";display:"+r+';"><i class="icon-widget-img"></i></span>\n<div class="wrapper"><img draggable="false" '+o+' style="'+s+'"/></div>'},t.webpage=function(t){return'<div class="webpage-wrapper">\n <span class="text">'+t.text+'</span>\n <p class="notice">'+I18N.https_only+'</p>\n <object class="iframe" type="text/html"></object>\n</div>'},t.video_view=function(){return'<span><i class="fa fa-play-circle-o"></i></span>'},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",'<img draggable="false" src=\''+n+'\' class="keyboard-img" alt="keyboard"/>'},t.map_view=function(){return'<div class="image design">\n <img draggable="false" src="'+MB.staticMap()+'"/>\n</div>'},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"','<div class="text_edit" '+n+'>\n <input type="text" '+i+' placeholder="'+t.text+'"></input>\n</div>\n<i class="fa fa-search"></i>'},t.status_bar=function(t){var e,i,n;return t.tc?(i="background-color:"+t.tc+";",e="border-color:"+t.tc+";",n="color:"+t.tc):i=e=n="",'<div class="signal" style="'+n+'">\n <div class="ball"></div>\n <div class="ball"></div>\n <div class="ball"></div>\n <div class="ball"></div>\n <div class="ball"></div>\n</div>\n<div class="carrier">\n <span class="text">'+t.text+'</span>\n</div>\n<div class="time">\n 12:00<span class="meridian"> AM</span>\n</div>\n<div class="wifi md">wifi</div>\n<div class="battery">\n <div class="body" style="'+e+'">\n <div class="inner" style="'+i+'"></div>\n </div>\n <div class="head" style="'+i+'"></div>\n</div>'},t["switch"]=function(){return'<div class="wrapper"></div>\n<div class="circle"></div>'},t.tab_item=function(e){return'<div class="wrapper">\n '+t.icon_button(e)+'\n <span class="text">'+e.text+"</span>\n</div>"},t.pg=function(t){var e,i;return i=Link.find(t.gid),e=i?i.gesture:"tap",'<i class="icon-gesture-'+e+'"></i>'},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,/<p>/.test(t.text)||(e="<p>"+e+"</p>"),e},t.circle_rect=t.rounded_rect=t.text_view=function(t){var e;return e="padding: "+t.paddingS()+"px;",'<div class="text" style="'+e+'">'+MB.v.multiline(t.text)+"</div>"},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%)"},'<div class="text">'+MB.v.multiline(t.text)+'</div>\n<div class="sideline" style="'+i(c)+'">\n <div class="box" style="'+i(n)+'"></div>\n <div class="line" style="'+i(s)+'">\n <div class="arrow" style="'+i(e)+'"></div>\n </div>\n</div>\n<div class="sawtooth" style="'+i(u)+'"></div>'},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;"),'<div class="arrow1 arrow '+t.tt_placement+'" style="border-width:'+t.arrowSize()+"px;"+t.tt_placement+":"+(0-t.arrowSize())+"px;"+i+":"+(t.bc||"#aaa")+";"+n+';"></div>\n<div class="arrow2 arrow '+t.tt_placement+'" style="border-width:'+t.arrowSize()+"px;"+t.tt_placement+":"+(0-t.arrowSize()+t.bS())+"px;"+i+":"+(t.bg||"white")+";"+n+';"></div>\n<div class="text" style="'+r+'">'+MB.v.multiline(t.text)+"</div>"},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;return null==e&&(e=""),i=t.inspectables(),l=[]," "!==t.zoomable&&(u=t.w(),r=t.h(),"mtooltip"===t.name&&("top"===t.tt_placement||"bottom"===t.tt_placement?r-=t.arrowSize():u-=t.arrowSize()),t.isFullWidth()||l.push("width:"+u+"px"),l.push("height:"+r+"px")),"mtooltip"===t.name&&(o=function(){var e,i,r,o;for(r=["top","right","bottom","left"],o=[],e=0,i=r.length;e<i;e++)n=r[e],n===t.tt_placement?o.push(t.arrowSize()+"px"):o.push("0");return o}(),l.push("margin: "+o.join(" "))),l.push("left:"+t.l()+"px"),l.push("top:"+t.t()+"px"),t.tc&&i.indexOf("tc")!==-1&&l.push("color:"+t.tc),t.bg&&i.indexOf("bg")!==-1&&l.push("background-color:"+t.bg),t.bc&&i.indexOf("bc")!==-1&&l.push("border-color:"+t.bc),t.ds>0&&(c=MB.currentProject.isAndroid()?MB.l.getMaterialShadow(t.ds,MB.hex2rgb(t.sc)):"0 0 "+t.ds+"px "+t.sc,"icon_button"===t.name?l.push("text-shadow: "+c):l.push("box-shadow: "+c)),t.ts>0&&l.push("text-shadow: 0 0 "+t.ts+"px "+t.tsc),i.indexOf("ro")!==-1&&(l.push("transform: rotate("+t.ro+"deg)"),l.push("-webkit-transform: rotate("+t.ro+"deg)")),t.clip&&i.indexOf("clip")!==-1&&(l.push("clip-path: "+t.clip),l.push("-webkit-clip-path: "+t.clip)),i.indexOf("fs")!==-1&&t.fS()>0&&l.push("font-size:"+t.fS()+"px"),i.indexOf("padding")!==-1&&"mtextarea"!==t.name&&l.push("padding:"+t.paddingS()+"px"),i.indexOf("br")!==-1&&l.push("border-radius:"+t.bR()+"px"),i.indexOf("bs")!==-1&&l.push("border-width:"+t.bS()+"px"),i.indexOf("ls")!==-1&&l.push("border-style:"+t.lineStyle()),i.indexOf("ha")!==-1&&"label"!==t.name&&l.push("text-align:"+t.ha),i.indexOf("lh")!==-1&&l.push("line-height:"+t.lH()+"px"),l.push("font-weight:"+(t.bo?"bold":"normal")),l.push("font-style:"+(t.i?"italic":"normal")),!MB.isPhantom()&&"none"!==t.ani_name&&e&&(t.ani_delay&&"0"!==t.ani_delay&&l.push("animation-delay: "+t.ani_delay),l.push("animation-iteration-count: "+t.ani_count),t.ani_duration&&"0"!==t.ani_duration&&l.push("animation-duration: "+t.ani_duration)),d=t.fixed&&t.v?Widget.MAXZ+t.z:t.z,t.v?(a="auto",s=i.indexOf("o")!==-1?t.o/100:"",t.fixed&&/(p|pgh|pgf)$/.test(e)&&(s=0)):e?(a="none",s=0):s=.4,l.push("z-index:"+d),""!==s&&l.push("opacity:"+s),l.push("pointer-events:"+a),l},MB.widgetClassName=function(t,e){var i,n;return null==e&&(e=""),i="widget "+t.name,t.inspectables().indexOf("ha")!==-1&&(i+=" h"+t.ha),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),"sticky"===t.name&&(i+=t.l()>160?" rsticky":" lsticky",t.slt<20?i+=" tsticky":t.slt>t.height-20&&(i+=" bsticky")),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="<div class='region gesture "+r+"'></div>"),'<div class="'+n+'" id="widget'+e.cid+i+'" data-cid="'+e.cid+'" data-link_cid="'+(s||"")+'" style="'+c.join(";")+'">\n '+t[e.name](e,i)+"\n "+(a||"")+"\n</div>"},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<c;a++)d=u[a],"sticky"!==d.name&&("pg"===d.name&&(d.top=d.left=null),o+=MB.widget(d,t.panel_cid+l));return'<div id="'+s+'" class="'+r+'" data-cid="'+t.cid+'" style="background-color:'+t.bgcolor+";width:"+t.w()+"px;height:"+t.h()+"px;"+n+'"><div class="pwidgets"><div class="pscontainer">'+o+"</div></div></div>"},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()<i.w()||t.h()<i.h())&&(r+="pointer-events:auto;")),r},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="<div class='region gesture "+r+"'></div>"):(n="",s=null,a=""),c=t.mainState(),c.panel_cid=t.cid,'<div id="panel'+t.cid+'p" class="'+i+'" data-cid="'+t.cid+'" data-link_cid="'+s+'" style="'+l+'">\n <div class="fixed"></div>\n '+MB.PanelState(c,!0,!0)+"\n "+a+"\n</div>"},MB.PanelProjectFlow=function(t){var i;return i=t.mainState(),i.panel_cid=t.cid,'<div id="panel'+t.cid+'p" class="panel" data-cid="'+t.cid+'" style="'+e(t,!0)+'">\n '+MB.PanelState(i,!0,!0)+"\n</div>"}}.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;n<r;n++)if(i=o[n],i.cid===t.cid&&!i.saving&&i.constructor===t.constructor)return void(i.destroyed=e);return this.queue.push(t),MB.setSaveQueue&&MB.setSaveQueue()},t.prototype.save=function(){var t,e,i,n;if(0===this.queue.length)return void(MB.setSaving&&MB.setSaving(!1));if(n=this.queue[0],!(n.saving&&(i=n.saveAt+$.ajaxSettings.timeout+6e4,new Date<i))){n.saving=!0,n.saveAt=(new Date).valueOf(),MB.setSaving&&MB.setSaving();try{return n.constructor.exists(n.cid)?n.constructor===Asset?(t=n.constructor.find(n.cid),t.id=null,t.save()):n.constructor.find(n.cid).save():n.destroyed&&n.constructor!==Asset?n.destroy():n.save()}catch(t){return e=t,this.queue.shift(),this.save()}}},t.prototype.pushObject=function(t){var e,i,n,r,o,s;if(r=MB.project(),r&&!r.combo&&(r.template&&(r=Project.find(r.host_cid)),r&&r.channels&&(i=r.channels.filter(function(t){return t!==MB.user.channel}),i.length>0&&(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?(MB.alert({title:I18N.error_happened,desc:I18N.network_error}),$.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()})}return t.remove=function(t){var e;if(Widget.exists(t))return e=Widget.find(t),e.ldestroy()},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),s.lsave(),ScreenManager.updateWidgetList(),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,/<p>/.test(t.text)||(i="<p>"+i+"</p>"),e.innerHTML=i},t._render_text_align=function(t,e){return e.className=e.className.replace(/v(middle|top|bottom)/,"v"+t.va)},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<a;o++)i=c[o],i.style.backgroundColor=t.tc;return n.style.borderColor=t.tc,s.style.backgroundColor=t.tc,r.style.backgroundColor=t.tc},t._render_search_bar=function(t,e){var i;if(t.th&&"light"!==t.th)return i=e.getElementsByClassName("text_edit")[0],i.style.background=MB.themes[t.th][2]||""},t._render_icon_button=function(t,e){var i;if(i=e.querySelector(".icon"))return i.insertAdjacentHTML("afterend",t.get_icon(!0,"font-size:"+t.iS()+"px;")),i.remove()},t._render_button=function(t,e){return this._render_icon_button(t,e)},t._render_tab_item=function(t,e){return this._render_icon_button(t,e)},t._render_image_view=function(t,e){var i,n,r,o;return e.style.clipPath=t.clip,e.style.webkitClipPath=t.clip,t.image?("i"===t.image[0]&&t.image.indexOf("images")===-1?(i=Asset.find(t.image),i&&(o=i.raw||i.image)):o=t.image,n=e.getElementsByTagName("img")[0],o&&n.src!==o&&(n.src=o),n.style.filter=t.filter.trim(),n.style.webkitFilter=t.filter.trim(),n.style.display=null,r=e.getElementsByTagName("span")[0],r.style.display="none"):(n=e.getElementsByTagName("img")[0],n.style.display="none",r=e.getElementsByTagName("span")[0],r.style.display=null)},t._render_webpage=function(t,e){var i;if(i=$(e).find(".iframe"),i[0]&&i.attr("data")!==t.text)return i.attr("data",MB.unescape(t.text))},t._render_switch=function(t,e){return t.checked?e.classList.add("checked"):e.classList.remove("checked")},t._render_mtooltip=function(t,e){var i,n,r,o,s,a,c,l,u,d;for(r=e.querySelectorAll(".arrow"),c=0,l=r.length;c<l;c++)o=r[c],o.classList.remove("top","right","bottom","left"),o.classList.add(t.tt_placement),o.style.borderWidth=t.arrowSize()+"px",o.style.borderColor="transparent",o.style.left=o.style.top=o.style.bottom=o.style.right=null;return i=e.querySelector(".arrow1"),n=e.querySelector(".arrow2"),i.style[t.tt_placement]=0-t.arrowSize()+"px",n.style[t.tt_placement]=0-t.arrowSize()+t.bS()+"px",s={top:"borderBottomColor",bottom:"borderTopColor",left:"borderRightColor",right:"borderLeftColor"},a=s[t.tt_placement],i.style[a]=t.bc||"#aaa",n.style[a]=t.bg||"white","top"===t.tt_placement||"bottom"===t.tt_placement?(e.style.height=t.h()-t.arrowSize()+"px",i.style.left=n.style.left=t.ttOffset()+"px"):(e.style.width=t.w()-t.arrowSize()+"px",i.style.top=n.style.top=t.ttOffset()+"px"),u=function(){var e,i,n,r;for(n=["top","right","bottom","left"],r=[],e=0,i=n.length;e<i;e++)a=n[e],a===t.tt_placement?r.push(t.tt_arrow_size+"px"):r.push("0");return r}(),e.style.margin=u.join(" "),d=e.getElementsByClassName("text")[0],d.style.padding=t.paddingS()+"px",this._render_text_align(t,e),"middle"===t.va?d.style.marginTop=0-t.textHeightS()/2+"px":d.style.marginTop="0px"},t._render_mtext_input=function(t,e){var i;return i=e.getElementsByTagName("input")[0],i.placeholder=t.text},t._render_mtextarea=function(t,e){var i,n,r;return i=e.getElementsByTagName("textarea")[0],n=Math.round(t.padding*MB.scale()/100),r=Math.round(n-(t.lh-t.fs)/2),r<0&&(r=0),i.placeholder=t.text,i.style.padding=r+"px "+n+"px"},t._render_mcheckbox2=function(t,e){var i;return i=e.getElementsByTagName("input")[0],i.checked=t.checked},t._render_mradiobutton=function(t,e){var i;return i=e.getElementsByTagName("input")[0],i.checked=t.checked},t._render_mselect=function(t,e){var i,n;return n=function(){var e,n,r,o;for(r=t.text.split(/\n/),o=[],e=0,n=r.length;e<n;e++)i=r[e],o.push("<option>"+i+"</option>");
return o}().join(""),e.innerHTML="<select>"+n+"</select>"},t._render_sticky=function(e,i){return t.renderSticky(e,i,"p")},t.renderSticky=function(t,e,i){var n,r;if(n=e.className.replace(/(t|b|l|r)sticky/g,""),r=t.l()>160?" rsticky":" lsticky",t.slt<20?r+=" tsticky":t.slt>t.height-20&&(r+=" bsticky"),e.className=n.replace("sticky","sticky"+r),e.innerHTML=MB.stickyHTML(t),"p"===i&&20===t.slt&&50===t.slw)return $(e).find(".sideline").css("display","none")},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<i;e++)if(e in this&&this[e]===t)return e;return-1};this.ScreenManager=function(){function e(){var t;t=$("#design"),t.on("slider:update",function(){return MB.renderFixedSlider&&MB.renderFixedSlider()}),this.initCanvasDnd()}return e.resetPosition=function(){var t;return t=document.getElementById("screens"),t.scrollTop=MB.config.initialScrollTop,t.scrollLeft=(t.scrollWidth-t.clientWidth)/2},e.sortScreens=function(){var t;return t=function(e){return e.children().forEach(function(e,i){return e.position!==i+1&&(e.position=i+1,e.lsave()),t(e)})},MB.currentProject.rootScreens().forEach(function(e,i){return e.position!==i+1&&(e.position=i+1,e.lsave()),t(e)})},e.fixBadScreen=function(e){var i,n,r,o;for(i=[e.cid],o=[];n=Screen.find(e.parent_cid);)r=n.cid,t.call(i,r)>=0?(e.parent_cid=null,o.push(e.lsave())):(e=n,o.push(i.push(e.cid)));return o},e.activate=function(t){return MB.currentScreen=t,MB.action("entry:clear:selection"),t.setState("default"),MB.action("entry:activate:screen",{screen:t}),MB.action("rightnav:set:global",{isGlobalActive:!0}),this.updateWidgetList(),this.resetPosition()},e.updateWidgetList=function(){var t,e,i,n,r,o;for(r=Screen.find(MB.currentScreen.cid),r._widgetsByName=null,r.lsave(!1),o=[],n=r.citems(),e=0,i=n.length;e<i;e++)t=n[e],t._isPanelWidget=!1,t.setState(r.state_cid,!0),"panel"===t.name?t.valid()&&(o.push(t.dup()),t.ct().cscreens().forEach(function(t){return t.cwidgets().forEach(function(t){var e;return e=t.dup(),e._isPanelWidget=!0,o.push(e)})})):o.push(t.dup());return MB.renderLinks(),MB.action("update:widget:all",{widgetList:o})},e.updateStateHeight=function(t){var e,i,n,r;return i=Screen.find(t),e=i.cid+"default",$("#ssliglobal").hasClass("active")?(r=i.cscreenstates(),r.push(Screenstate.find(e))):(n="default"===i.state_cid?e:i.state_cid,r=[Screenstate.find(n)]),r.forEach(function(t){if(t)return t.hh=i.hh,t.fh=i.fh,t.lsave(t.cid!==e)})},e.removeFromHistory=function(t){var i,n;return MB.action("rightnav:remove:screen",{cid:t.cid}),t.cid===MB.currentScreen.cid?(n=Screen.find(MB.getCurrentScreen()),i=n?n:t.parent_cid?Screen.find(t.parent_cid):MB.project().homeScreen(),e.activate(i)):(MB.renderScreenList(),MB.renderLinks())},e.newScreen=function(t,e,i,n,r,o){var s,a;return null==o&&(o=!0),s=MB.project().template?"transparent":MB.config.screenBg,a=new Screen({name:t,project_cid:MB.project().cid,parent_cid:i,orientation:n,cid:"s"+Math.uuid(10,16)+(new Date).valueOf(),bgcolor:s,position:e}),a.lsave(),r&&!MB.project().template&&a.setup(null),this.activate(a),o&&MB.action("rightnav:edit:screen",{cid:a.cid}),MB.renderScreenList(),a},e.updateOrientation=function(){var t,e,i,n,r,o;for(r=Screen.find(MB.currentScreen.cid),i="portrait"===r.orient()?"landscape":"portrait",r.setOrientation(i),r.lsave(),n=r.cwidgets(),t=0,e=n.length;t<e;t++)o=n[t],o.isFullWidth()&&(o.setW(r.width),"keyboard"===o.name&&(o.height=r.kbDH()),o.lsave());return this.updateWidgetList(),MB.renderToolbar()},e.prototype.initCanvasDnd=function(){return $("#design").on("dragleave","#screens",function(){return $(".canvas").removeClass("hover")}),$("#design").on("dragover","#screens",function(t){return t.stopPropagation(),t.preventDefault(),$("#canvas").addClass("hover"),t.originalEvent.dataTransfer.dropEffect="copy"}),$("#design").on("drop","#screens",function(t){var e,i,n,r,o;if(t.stopPropagation(),t.preventDefault(),$("#canvas").removeClass("hover"),!MB.globalStateAlert())return MB.action("entry:clear:selection"),r=MB.scale()/100,i=t.originalEvent.pageX-MB.canvasLeft(),o=t.originalEvent.pageY-MB.canvasTop(),e=t.originalEvent.dataTransfer.files,n=Screen.find(MB.currentScreen.cid),MB.createAssetFromFiles(e,function(t){var e;return e=WidgetManager.newImageView(t,i,o,n),o+=t.height*r,MB.trigger("undoStack:add",[null,[e.dup()]]),MB.action("selection:select:items",{cids:[e.cid]})})})},e.updateSize=function(t,e,i){var n,r,o,s,a,c,l,u,d;if(u=Screen.find(MB.currentScreen.cid),n=[u.dup()],a=u.height,u.height+=e,s=Math.round(100*u.dH()/MB.scale()),MB.project().template||MB.project().combo)u.width+=t,u.height<10&&(u.height=10),u.width<10&&(u.width=10);else for(u.height<s&&(e=s-a,u.height=s),l=u.cwidgets(),r=0,o=l.length;r<o;r++)d=l[r],d.inFooter()&&d.top&&(d.top+=e,d.lsave());return u.lsave(),c=MB.project(),"project"!==c.type()&&c.updatePanelSize(u.width,u.height),i&&$("body").trigger("undoStack:add",[n,[u.dup()]]),this.updateWidgetList(),MB.renderFEScreen()},e}()}.call(this),function(){this.PanelManager=function(){function t(){}return t.remove=function(t,e){var i;if(null==e&&(e=!0),i=Panel.find(t))return i.ldestroy(e)},t}()}.call(this),function(){var t,e,i=function(t,e){function i(){this.constructor=t}for(var r in e)n.call(e,r)&&(t[r]=e[r]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;e={},t=function(){function t(){MB.setRunnerExtra(e),this.scrollSync=new e.ScrollSync,this.timeoutBucket=new e.TimeoutBucket,this.eventBucket=new e.EventBucket,this.runnerUtil=new e.RunnerUtil,this.transitionUtil=new e.TransitionUtil,this.clearCallbackBucket={},this.mode="default",MB.isMobile()?this.eventBucket.bindMobile({onOrientationChange:function(t){return function(){return setTimeout(function(){return t.reload()},100)}}(this)}):this.eventBucket.bindDesktop({onAppMouseDown:function(t){return function(e,i){var n,r,o,s;return"immersive"===t.mode||(!!$(e.target).closest(".sticky, .webpage, #ui-comment-marker-panel").length||(n=$(e.target).closest(".map_view .image"),!(!n.length&&(n=$(e.target).closest(".ppanel"),o=Panel.find(n.data("cid")),o&&o.timerFired))&&(n.length?r=s=n[0]:(r=$(e.target).closest(".widgets")[0],r&&"web"!==MB.currentProject.device||(r=$("#simulator-container")[0]),s=$(e.target).closest(".widgets")[0]||r,"web"===MB.currentProject.device&&(s=$("#simulator-container")[0])),!r&&!s||(!($(r).width()<r.scrollWidth||$(s).height()<s.scrollHeight)||(i.vScrollTarget=s,i.hScrollTarget=r,i.top=s.scrollTop,i.left=r.scrollLeft,!1)))))}}(this),onAppMouseMove:function(){return function(t,e,i){var n,r,o,s,a,c;return n=e.hScrollTarget,s=e.vScrollTarget,o=e.top,r=e.left,a=e.x,c=e.y,!i.down||(t.preventDefault(),n&&(n.scrollLeft=Math.min(r-t.clientX+a,n.scrollWidth-$(n).width())),s?s.scrollTop=Math.min(o-t.clientY+c,s.scrollHeight-$(s).height()):void 0)}}(this)}),window.addEventListener("message",function(t){return function(e){var i;try{if(i=JSON.parse(e.data),"back"===i.event)return t.backPrev()}catch(t){}}}(this),!1)}return t.prototype.init=function(){var t;return MB.trackPageView("/workspace/app/preview"),$("#simulator .splash").css("background-color",this.home.bg()),$("#app").show(),this.home.setupSplash("#simulator .splash img"),this.project.setup(),this.pages={},this.setupPG(),this.currentScreen=this.currentMenu=null,this.renderScreen(),t=setTimeout(function(t){return function(){if($("#gs").show(),$("#simulator .splash").hide(),$("#splash").hide(),t.reload(),"function"==typeof MB.onload&&MB.onload(),MB.messageBucket)return MB.messageBucket.send("ready",JSON.stringify(MB.currentProject.cscreens()))}}(this),1e3),MB.webpackInterface.checkLocationHash(),this.clearCallbackBucket.init=function(){return clearTimeout(t)}},t.prototype.clear=function(){var t,e,i;i=this.clearCallbackBucket;for(e in i)(t=i[e])();return this.timeoutBucket.clear(),this.pages={}},t.prototype.loadScreen=function(t){var e,i,n,r;if(this.currentMenu)return void this.closeMenu(function(e){return function(){return e.loadScreen(t)}}(this));if($(".pcanvas.active").data("cid")!==t&&(this.currentScreen=this.currentMenu=null,n=Screen.find(t)))return this.timeoutBucket.clear(),r=this.setOrientation(n.cid,"none",!0),this.prepareTransition(n.cid,r),$(".pcanvas.menu").removeClass("lmenu rmenu menu"),e=$(".pcanvas.active"),i=$("#pscreen"+n.cid),this.transitionUtil.doTransition("none",e,i,new Link)},t.prototype.backPrev=function(){var t;return this.home.cid===$(".pcanvas.active").data("cid")&&MB.messageBucket?void MB.messageBucket.send("exit"):(t=new Link({target_cid:"prev",transition:"none"}),this.j(t))},t.prototype.closeMenu=function(t){var e,i,n;return i=$("#pscreen"+this.currentScreen),e=$("#pscreen"+this.currentMenu),n=function(n){return function(){return n.transitionUtil.hideScreen(e),e.removeClass("drawer ldrawer rdrawer"),i.removeClass("menu lmenu rmenu"),n.doneTransition(i),n.currentScreen=n.currentMenu=null,$.nextTick(function(){if("function"==typeof t)return t()})}}(this),i.hasClass("menu")?(i.transitionEnd(n),i.enableTransition("0.3s"),i.translateX(0)):e.hasClass("drawer")?(e.transitionEnd(n),e.enableTransition("0.3s"),e.hasClass("ldrawer")?e.translateX(0-this.transitionUtil.activeWidth()):e.translateX(this.transitionUtil.activeWidth())):void 0},t.prototype.pj=function(t,e){var i,n,r,o,s,a,c,l,u,d,h;if("immersive"!==this.mode&&this.eventBucket.isCoolDown()&&!this.timerFired){if(i=$(t.target).closest(".clickable"),r=$(t.target).closest(".ppanel"),n=$(t.target).closest(".pcanvas"),"shake"===e&&(n=this.currentMenu?$("#pscreen"+this.currentMenu):$(".pcanvas.active")),this.currentMenu&&n.data("cid")!==this.currentMenu&&!$(t.target).closest("#gh, #gf").length)return this.closeMenu();if(r.length){if(this.panelEventHandler(t,e))return}else if(i.length&&(c=Link.find(i.attr("data-link_cid")),c&&c.gesture===e))return this.j(c);if(o=n.data("cid"),u=Screen.find(o)){for(l=Widget.records,s=0,a=l.length;s<a;s++)if(d=l[s],d.screen_cid===u.cid&&"pg"===d.name&&(h=d.getState(u.state_cid),h.gid&&(c=Link.find(h.gid))&&c.gesture===e))return this.j(c);if(!this.eventBucket.mouseState.moved){if("hold"===e&&MB.messageBucket)return void MB.messageBucket.send("settings");if(!$(t.target).closest(".widget").hasClass("sticky"))return MB.project()._highlight?this.highlightClickables(t):void 0}}}},t.prototype.panelEventHandler=function(t,e){var i,n,r,o,s,a,c,l,u,d,h,p;if(n=$(t.target).closest(".clickable"),i=$(t.target).closest(".ppanel"),r=i.find(".pstate.active"),o=i.data("cid"),l=Panel.find(o),n.length){if(c=Link.find(n.attr("data-link_cid")),!c)return!1;if("prev"===c.target_cid)return this.j(c),!0;if(c.gesture===e){if(i[0]===n[0])this.j(c);else if($("#pscreen"+c.target_cid).length)this.j(c);else{if(l.timerFired)return!1;h="#"+i.attr("id").replace(/pg[h|f]$/,"p"),this.panelWJ(c,$(h)),$("#panel"+o+"pgh").length&&this.panelWJ(c,$("#panel"+o+"pgh")),$("#panel"+o+"pgf").length&&this.panelWJ(c,$("#panel"+o+"pgf"))}return!0}}if(d=Screen.find(r.data("cid")),!d)return!1;for(u=d.cwidgets(),s=0,a=u.length;s<a;s++)if(p=u[s],"pg"===p.name&&(c=Link.find(p.gid),p.icon===e&&c))return!l.timerFired&&(h="#"+i.attr("id").replace(/pg[h|f]$/,"p"),this.panelWJ(c,$(h)),$("#panel"+o+"pgh").length&&this.panelWJ(c,$("#panel"+o+"pgh")),$("#panel"+o+"pgf").length&&this.panelWJ(c,$("#panel"+o+"pgf")),!0);return!1},t.prototype.highlightClickables=function(){var t;return t=$(".pcanvas.active .region, #gs .region, #gh .region, #gf .region"),t.show(),$(".pcanvas.active .pg").css({display:"flex",opacity:.8}),this.hightTimer=setTimeout(function(){return t.hide(),$(".pcanvas.active .pg").css("opacity","0").hide()},400)},t.prototype.j=function(t){var e,i,n,r,o,s;if(t){if(this.timeoutBucket.clear(),o=t.screen_cid,i=t.target_cid,s=t.transition,this.currentMenu)return void(i===$(".pcanvas.active").data("cid")?this.closeMenu():t.targetstate_cid?this.stateTransition(t):this.closeMenu(function(e){return function(){return e.j(t)}}(this)));if(t.targetstate_cid)return this.stateTransition(t);if(i&&("prev"===i||$("#pscreen"+i).length)){if("prev"===i){if(r=$(".pcanvas.active").data("prev"),!r)return;if(i=r.pop(),!i)return;$(".pcanvas.active").data("prev",r)}else r=$("#pscreen"+i).data("prev"),r||(r=[]),r.push($(".pcanvas.active").data("cid")),$("#pscreen"+i).data("prev",r);return e=$(".pcanvas.active"),n=$("#pscreen"+i),s=this.setOrientation(i,s,t.reset),this.prepareTransition(i,s),this.transitionUtil.doTransition(s,e,n,t)}}},t.prototype.panelWJ=function(t,e){var i,n,r;if(t&&(i=t.target_cid,r=t.transition,n=e.data("cid"),i))return this.preparePanelTransition(i,r,e,function(o){return function(){var s,a;return s=e.find(".pstate.active"),a=e.find("#state"+n+i+"p"),o.transitionUtil.doTransition(r,s,a,t)}}(this))},t.prototype.prepareTransition=function(t,e){var i,n,r,o,s,a,c,l,u;if(this.timerFired=!0,i=$(".pcanvas.active").removeClass("top drawer ldrawer rdrawer"),i.find(".pstate").css("transition","none"),n=$("#pscreen"+t),n.show(),u=Screen.find(t),this.renderWidgets(u),"leftmenu"!==e&&"rightmenu"!==e&&"leftdrawer"!==e&&"rightdrawer"!==e||(this.currentScreen=i.data("cid"),this.currentMenu=t,e.indexOf("menu")!==-1&&($(".pcanvas.active .widgets")[0].scrollTop=0)),"slideleft"!==e&&"slideright2"!==e&&"slideright"!==e&&"slideleft2"!==e&&this.runnerUtil.setScreenBg(i),"slideright"!==e&&"slideleft"!==e&&"slidebottom"!==e&&"slidetop"!==e&&this.runnerUtil.setScreenBg(n),this.transitionUtil.transitionHandler(e,i,n,this.transitionUtil.activeWidth()-1,this.transitionUtil.activeHeight()-1),$("#gf .keyboard").hide(),$(".pcanvas.active .sheader").css("height",0),$(".pcanvas.active .sfooter").css("height",0),"slideright"!==e&&"slideleft"!==e&&"none"!==e&&($("#gh").css("top",0-$("#gh").height()),$("#gf").css("bottom",0-$("#gf").height())),$("#pscreen"+u.cid+" .panel").length){for(c=u.cpanels(),l=[],o=0,s=c.length;o<s;o++)a=c[o],(r=$("#panel"+a.cid+"p")[0])&&this.activatePanelMainState(a,r,"p"),(r=$("#panel"+a.cid+"pgh")[0])&&this.activatePanelMainState(a,r,"pgh"),(r=$("#panel"+a.cid+"pgf")[0])?l.push(this.activatePanelMainState(a,r,"pgf")):l.push(void 0);return l}},t.prototype.preparePanelTransition=function(t,e,i,n){var r,o,s,a,c;return null==n&&(n=null),"leftmenu"!==e&&"rightmenu"!==e&&"leftdrawer"!==e&&"rightdrawer"!==e||(e="none"),a=i.data("cid"),s=Panel.find(a),c=Screen.find(t),o=i.find("#state"+a+t+"p"),o.length||(c.panel_cid=s.cid,i[0].innerHTML+=MB.PanelState(c,!0,!1),o=i.find("#state"+a+t+"p")),r=i.find(".pstate.active"),o.show(),o.enableTransition("10ms"),n&&"function"==typeof n&&("popin"===e||"slidebottom"===e||"topin"===e||"slidetop"===e||"slideright"===e||"slideleft2"===e||"slideleft"===e||"slideright2"===e?o.transitionEnd(function(){return n()}):setTimeout(function(){return n()},10)),setTimeout(function(t){return function(){return t.transitionUtil.transitionHandler(e,r,o,i.width()-1,i.height()-1)}}(this))},t.prototype.doneTransition=function(t){var e,i,n,r;return t.removeClass("menu lmenu rmenu"),t.zindex(""),t.disableTransition(),t.hasClass("state")?(this.setupPanelLinks(t),this.setupPanelAnimationAndFixed(t),i=Panel.find(t.closest(".ppanel").data("cid")),n=Screen.find(t.data("cid")),this.setupPanelTimers(i,n),i.timerFired=!1,void i.lsave(!1)):(r=Screen.find(t.data("cid")),this.setupBackground(t,r),this.setupPageTimers(r),this.setupFixedWidgets(r),MB.isStandAlone()&&this.setupStatusBar(r),MB.isAndroid()&&this.setupPageGesture(r),this.timerFired=!1,MB.currentScreen=r,MB.webpackInterface.updateCurrentScreenRunner(r),MB.isMobile()?(e=t.find(".animated"),e.css({animationName:"noop",visibility:"hidden"}),setTimeout(function(){return e.css({animationName:"",visibility:""})})):(this.updateBackButton(t),$("#sticky-container #stickies").html($(".pcanvas.active .stickies").html()),this.scrollSync.init($(".pcanvas.active .widgets")[0],$("#sticky-container")[0])),"function"==typeof MB.screenLoaded&&MB.screenLoaded(r.cid),setTimeout(function(t){return function(){var e,i,n,o,s,a;for(o=r.clinks(),s=[],e=0,n=o.length;e<n;e++)i=o[e],i.target_cid&&"prev"!==i.target_cid&&(a=Screen.find(i.target_cid),a&&a.project_cid===r.project_cid?(t.renderWidgets(a),s.push($("#pscreen"+a.cid).enableTransition("10ms"))):s.push(void 0));return s}}(this),10))},t.prototype.updateBackButton=function(t){var e;return e=t.data("cid")!==this.project.homeScreen().cid,MB.updateBackButton&&MB.updateBackButton(e)},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.hideActive(),this.clearCanvas(),e="none"),i&&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('<div class="sheader"></div><div class="sfooter"></div>'),$("#pscreen"+t+" .stickies").html(""),setTimeout(function(){return $("#pscreen"+t).find(".widgets, .pwidgets")[0].scrollTop=0},100)},t.prototype.clearCanvas=function(){var t,e,i,n,r;for($(".scontainer").html('<div class="sheader"></div><div class="sfooter"></div>'),$(".stickies").html(""),$("#gh").html(""),$("#gf").html(""),$("#gs").html(""),n=$(".pcanvas .widgets"),r=[],e=0,i=n.length;e<i;e++)t=n[e],r.push(t.scrollTop=0);return r},t.prototype.reload=function(){var t,e;return this.timerFired?void $.nextTick(function(t){return function(){return t.reload()}}(this)):this.currentMenu?void this.closeMenu(function(t){return function(){return t.reload()}}(this)):(t=$(".pcanvas.active").data("cid"),Screen.exists(t)?(e=Screen.find(t),this.clearCanvas(),this.prepareTransition(t,"none"),this.doneTransition($(".pcanvas.active"))):void 0)},t.prototype.transformItem=function(t,e,i,n,r){var o,s,a,c,l,u,d;return l=n.style,l.transition=r,e.width!==i.width&&(l.width=i.w()+"px"),e.height!==i.height&&(l.height=i.h()+"px"),u=i.t(),i.fixed?i.isBottomFixed(t)&&(u=MB.isOddIOS()&&this.runnerUtil.deviceOrient()===t.orient()?$("#simulator").height()-(t.h()-u)+MB.COMPONENTS.status_bar.height:$("#simulator").height()-(t.h()-u)):/gf$/.test(n.id)&&(o=i.t()+i.h(),s=0===t.footerHeight()?Number.MAX_VALUE:Math.floor(t.h()-t.footerHeight()),o>=s&&u<t.h()&&(u-=s)),!i.fixed||e.fixed||/gh$/.test(n.id)?!i.fixed&&e.fixed&&/gh$/.test(n.id)&&(u-=$(".pcanvas.active .widgets")[0].scrollTop):u+=$(".pcanvas.active .widgets")[0].scrollTop,u!==e.t()&&(l.top=u+"px"),e.l()!==i.l()&&(l.left=i.l()+"px"),i.v?(c="auto",a=i.o/100,d=i.fixed?Widget.MAXZ+i.z:i.z):(a=0,d=i.z,c="none"),l.zIndex=d,l.opacity=a,l.pointerEvents=c},t.prototype.transformWidget=function(t,e,i,n,r){return this.transformItem(t,e,i,n,r),WidgetManager.transform(t,e,i,n,r)},t.prototype.activatePanelMainState=function(t,e,i){var n,r,o;return this.timeoutBucket.clearTimeoutByKey(t.cid),o=t.mainState(),$("#panel"+t.cid+i+" .state").disableTransition(),r=$(e).find("#state"+t.cid+o.cid+"p"),r.length||(o.panel_cid=t.cid,e.innerHTML+=MB.PanelState(o,!0,!1),r=$(e).find("#state"+t.cid+o.cid+"p"),MB.runner.setupPanelLinks(r)),n=$(e).find(".state.active"),n.css("transform",""),n.removeClass("active top"),MB.runner.transitionUtil.hideScreen(n),MB.runner.setupPanelAnimationAndFixed(r),r.css("transform",""),r.addClass("active top"),r.show()},t.prototype.transformPanel=function(t,e,i,n,r,o){if(this.transformItem(t,e,i,n,r),i.mainState().cid!==e.mainState().cid)return this.activatePanelMainState(i,n,o),this.setupPanelTimers(i,i.mainState())},t.prototype.stateTransition=function(t){var e,i,n,r,o,s,a,c,l,u,d;if(r=Screen.find(t.screen_cid),r.state_cid!==t.targetstate_cid)return c=t.targetstate_cid,u=t.ani_duration+" "+(t.ani_delay||"0s")+" "+(t.ani_easing||"linear"),a=Screenstate.find(c),d=[],Widget.select(function(t){var e,i,n,o,s;return t.screen_cid===r.cid&&(s=Widgetstate.find(r.state_cid+t.cid),o=Widgetstate.find(c+t.cid),s||o?(s&&(s.screen_cid=r.cid),o&&(o.screen_cid=r.cid),s||(s=t),o||(o=t),(e=$("#widget"+t.cid+"p")[0])&&MB.runner.transformWidget(r,s,o,e,u),(i=$("#widget"+t.cid+"pgf")[0])&&MB.runner.transformWidget(r,s,o,i,u),(n=$("#widget"+t.cid+"pgh")[0])&&MB.runner.transformWidget(r,s,o,n,u),d.push([s,o,e,n,i]),!1):void 0)}),n=[],Panel.select(function(t){var e,i,o,s,a;if(t.screen_cid===r.cid&&(a=Panelstate.find(r.state_cid+t.cid),s=Panelstate.find(c+t.cid),a||s))return s&&(s.cid=t.cid),a||(a=t),s||(s=t),(e=$("#panel"+t.cid+"p")[0])&&MB.runner.transformPanel(r,a,s,e,u,"p"),(o=$("#panel"+t.cid+"pgh")[0])&&MB.runner.transformPanel(r,a,s,o,u,"pgh"),(i=$("#panel"+t.cid+"pgf")[0])&&MB.runner.transformPanel(r,a,s,i,u,"pgf"),n.push([a,s,e,o,i]),!1}),i=r.headerHeight(),e=r.footerHeight(),r.setState(c,!0),this.timerFired=!1,s=d.sort(function(t,e){return t[1].timestamp-e[1].timestamp}),o=n.sort(function(t,e){return t[1].timestamp-e[1].timestamp}),this.timeoutBucket.setTimeout("stateTimer",function(t){return function(){var n,a,c,l,u,h,p,f,g,m,v,b,y,_,w,M,x;for(u=r.headerHeight(),c=r.footerHeight(),i!==u&&($("#gh").css("height",u),$(".pcanvas.active .scontainer > .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;p<m;p++)h=s[p],_=h[0],x=h[1],n=h[2],l=h[3],a=h[4],"none"!==x.ani_name&&(n&&(n.className+=" animated"),l&&(l.className+=" animated"),a&&(a.className+=" animated")),_.text!==x.text&&(WidgetManager.renderText(x,n),WidgetManager.renderText(x,a),WidgetManager.renderText(x,l)),WidgetManager.renderExtras(x,n,"p"),WidgetManager.renderExtras(x,l,"p"),WidgetManager.renderExtras(x,a,"p");for(w=s.concat(o),M=[],f=0,v=w.length;f<v;f++)h=w[f],y=h[0],b=h[1],n=h[2],l=h[3],a=h[4],g=Link.find(b.gid),g&&(g.targetstate_cid&&g.sourcestate_cid===b.screenstate_cid||g.target_cid)?(b.v&&(n&&t.setupWidgetLink($(n),g),l&&t.setupWidgetLink($(l),g),a&&t.setupWidgetLink($(a),g)),g.timer>0&&(!g.targetstate_cid||g.sourcestate_cid===b.screenstate_cid)?M.push(t.pageTimer(g)):M.push(void 0)):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<f;p++)h=v[p],m=h[0],g=h[1],n=h[2],u=h[3],a=h[4],!m.fixed&&g.fixed?(u&&u.remove(),u=e.runnerUtil.cloneFixed(r,g,$(n))[0],$("#gs")[0].appendChild(u)):m.fixed&&!g.fixed&&($(n).show(),u&&u.remove(),u=null),!g.fixed&&n&&(g.t()<d&&!u?(u=$(n).clone()[0],u.id=n.id+"gh",$("#gh")[0].appendChild(u)):g.t()>=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(),$(a).enableTransition(),a.style.top=g.t()-l+"px"):i<l&&a&&($(n).show(),a.remove(),a=null));if(!MB.isMobile())return $("#sticky-container #stickies").html($("#pscreen"+t.screen_cid+" .stickies").html())}}(this),l)},t.prototype.setupWidgetLink=function(t,e){var i,n;if(n=this.currentMenu?Screen.find(this.currentMenu):Screen.find($(".pcanvas.active").data("cid")),!(e.target_cid===n.cid||e.targetstate_cid&&e.targetstate_cid===n.state_cid))return t.addClass("clickable"),t.attr("data-link_cid",e.cid),t.find(".region").length?void 0:(i="tap"!==e.gesture?e.gesture:"",t.append("<div class='region gesture "+i+"'></div>"))},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<o;i++)r=u[i],h=t[0].id.replace(t.data("cid"),r.target_cid),$("#"+h).enableTransition("10ms");for(l=t[0].parentElement.dataset.cid,p=Link.findAllByAttribute("state_cid",t.data("cid")),n=0,s=p.length;n<s;n++)for(r=p[n],d=r.cwidgets(),c=0,a=d.length;c<a;c++)f=d[c],f.v&&(e=t.find("#widget"+f.cid+l+"p"),this.setupWidgetLink(e,r));return setTimeout(function(t){return function(){var e,i,n,o;for(n=[],i=0,e=p.length;i<e;i++)r=p[i],o=Screen.find(r.target_cid),o?(t.renderWidgets(o),n.push($("#pscreen"+o.cid).enableTransition("10ms"))):n.push(void 0);return n}}(this),100)},t.prototype.setupPanelAnimationAndFixed=function(t){var e,i,n,r,o,s,a,c,l,u;for(o=t[0].parentElement,i=o.getElementsByClassName("fixed")[0],s=o.dataset.cid,l=Screen.find(t.data("cid")),i.innerHTML="",a=l.cwidgets(),c=[],n=0,r=a.length;n<r;n++)u=a[n],e=t.find("#widget"+u.cid+s+"p"),u.fixed&&(e=this.runnerUtil.cloneFixed(l,u,e,!1),i.appendChild(e[0])),"webpage"===u.name&&u.text?c.push(this.runnerUtil.setObjectUrl(e.find(".iframe")[0],u.text.replace(/&amp;/g,"&"))):c.push(void 0);return c},t.prototype.setupFixedWidgets=function(t){var e,i,n,r,o,s,a,c,l,u,d,h,p,f,g,m,v,b,y,_,w,M,x,S,B,k,T,C,P,E,j,A;for(p=t.headerHeight(),c=t.footerHeight(),$("#gh").css("height",p).css("top",0).html("").removeClass("sb"),$("#gf").css("height",c).css("bottom",0).html("").removeClass("sb"),$(".pcanvas.active .scontainer > .sheader").css("height",p),$(".pcanvas.active .scontainer > .sfooter").css("height",c),$("#gs").html(this.pages[t.cid].sbHTML),this.pages[t.cid].sbHTML&&$("#gh, #gf").addClass("sb"),l=0===c?Number.MAX_VALUE:Math.floor(t.h()-c),h=document.createDocumentFragment(),d=document.createDocumentFragment(),u=document.createDocumentFragment(),m=function(){var e,i,n,r;for(n=t.citems(),r=[],e=0,i=n.length;e<i;e++)f=n[e],["sticky","pg"].indexOf(f.name)===-1&&r.push(f);return r}(),k=[],A=[],v=0,y=m.length;v<y;v++)f=m[v],"status_bar"!==f.name&&("panel"===f.name&&k.push(f),"webpage"===f.name&&A.push(f),P=f.t(),n="panel"===f.name?$("#panel"+f.cid+"p"):$("#widget"+f.cid+"p"),s=Math.floor(P+n.outerHeight()),"image_view"===f.name&&(/.gif$/.test(f.image)||(r=Asset.find(f.image))&&/.gif$/.test(r.image))&&(g=n.find("img")[0],g.src=g.src),f.fixed?(n.removeClass("animated"),h.appendChild(this.runnerUtil.cloneFixed(t,f,n)[0])):(P<p&&(e=n.clone(),e.attr("id",e.attr("id")+"gh"),d.appendChild(e[0])),s>=l&&P<t.h()&&(e=n.clone(),e.attr("id",e.attr("id")+"gf"),e.css("top",P-l),u.appendChild(e[0]))));for($("#gs")[0].appendChild(h),$("#gh")[0].appendChild(d),$("#gf")[0].appendChild(u),C=["p","pgh","pgf"],b=0,_=C.length;b<_;b++){for(T=C[b],x=0,w=k.length;x<w;x++)B=k[x],(a=document.getElementById("panel"+B.cid+T))&&(o=$(a).find(".state.active"),this.setupPanelLinks(o),this.setupPanelAnimationAndFixed(o));for(S=0,M=A.length;S<M;S++)j=A[S],(a=document.getElementById("widget"+j.cid+T))&&(i=$(a).find(".iframe")[0],E=j.text?j.text.replace(/&amp;/g,"&"):"about:blank",this.runnerUtil.setObjectUrl(i,E))}return $("#gf .keyboard").show()},t.prototype.setupStatusBar=function(t){var e,i,n;if(e=$("#gs .status_bar").removeClass("standalone light"),window.innerHeight>window.innerWidth&&(e.addClass("standalone"),!(i=t.sb())||i.th&&"light"!==i.th||e.addClass("light")),MB.isIOS9()&&this.runnerUtil.deviceOrient()===t.orient())return n=MB.COMPONENTS.status_bar.height,$("#app").css({top:0-n,height:window.innerHeight+n})},t.prototype.setupPG=function(){var t;return this.hammertime=new e.Hammer($("#app")[0],{touchAction:"auto",inputClass:MB.isMobile()?e.Hammer.TouchInput:null}),this.hammertime.get("swipe").set({direction:e.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;i<r;i++)n=o[i],"left"!==n.gesture&&"right"!==n.gesture||e.indexOf("pan-y")===-1&&e.push("pan-y"),"up"!==n.gesture&&"down"!==n.gesture||e.indexOf("pan-x")===-1&&e.push("pan-x");return s=e.length?e.join(" "):"auto",this.hammertime.touchAction.actions=s,$(".pcanvas.active .widgets").css("touch-action",s)},t.prototype.pageTimer=function(t){return this.timeoutBucket.setTimeout(t.cid,function(e){return function(){if(!e.timerFired)return e.timerFired=!0,e.j(t)}}(this),1e3*t.timer)},t.prototype.panelTimer=function(t,e){if(Screen.find(t.target_cid))return this.timeoutBucket.setTimeout(e.cid,function(i){return function(){if(!e.timerFired&&!i.timerFired)return e.timerFired=!0,e.lsave(!1),i.panelWJ(t,$("#panel"+e.cid+"p")),$("#panel"+e.cid+"pgh").length&&i.panelWJ(t,$("#panel"+e.cid+"pgh")),$("#panel"+e.cid+"pgf").length?i.panelWJ(t,$("#panel"+e.cid+"pgf")):void 0}}(this),1e3*t.timer)},t.prototype.setupPanelTimers=function(t,e){var i,n,r,o,s,a,c,l,u;if(e||(i=$("#panel"+t.cid+"p .pstate.active").data("cid"),e=Screen.find(i)),e){for(this.timeoutBucket.clearTimeoutByKey(t.cid),t.timerFired=!1,t.lsave(!1),c=e.clinks(),n=0,o=c.length;n<o;n++)a=c[n],a.timer>0&&this.panelTimer(a,t);for(l=Link.findAllByAttribute("state_cid",e.cid),u=[],r=0,s=l.length;r<s;r++)a=l[r],a.timer>0&&u.push(this.pageTimer(a));return u}},t.prototype.setupPageTimers=function(t,e){var i,n,r,o,s,a,c,l,u,d;for(null==e&&(e="default"),this.timeoutBucket.clear(),l=t.cwidgets(),n=0,s=l.length;n<s;n++)i=l[n],e&&i.setState(e,!1),o=Link.find(i.gid),o&&o.timer>0&&(!o.targetstate_cid||o.sourcestate_cid===e)&&this.pageTimer(o);for(u=t.cpanels(),d=[],r=0,a=u.length;r<a;r++)c=u[r],d.push(this.setupPanelTimers(c));return d},t.prototype.setupBackground=function(t,e){var i;if(i=e.bg(),$("#app").css({"background-color":i,"background-image":e.bgimage?"url("+e.getRealBgImage()+")":""}),$(".pcanvas.active .sheader, .pcanvas.active .sfooter").css("background-color",i),e.bgimage&&$(".pcanvas.active .sheader").css("background-image","url("+e.getRealBgImage()+")"),!t.hasClass("drawer"))return t.css({"background-image":"","background-color":"transparent"})},t.prototype.renderScreen=function(){var t,e,i,n,r,o,s,a;for(a="",r=this.project.cscreens(),t=0,i=r.length;t<i;t++)s=r[t],a+=this.runnerUtil.screenPreview(s);for($("#app").append(a),o=this.project.cscreens(),e=0,n=o.length;e<n;e++)s=o[e],s.cid!==this.home.cid&&this.transitionUtil.hideScreen("#pscreen"+s.cid);return $("#pscreen"+this.home.cid).addClass("active"),this.renderWidgets(this.home)},t.prototype.renderWidgets=function(t){var e,i,n,r,o,s,a,c,l,u,d,h,p,f,g,m,v,b,y,_;if(!$("#pscreen"+t.cid+" .widget").length){for(v=new Date,t.setState("default",!0),g=t.citems(),c=0,u=g.length;c<u;c++)a=g[c],a.setState("default",!0);for(f=document.getElementById("pscreen"+t.cid),e=f.getElementsByClassName("scontainer")[0],b=f.getElementsByClassName("stickies")[0],i="",y="",n=[],this.pages[t.cid]={sbHTML:""},m=t.citems(),
l=0,d=m.length;l<d;l++)if(a=m[l],"panel"===a.name)a.valid()&&(i+=MB.PanelPreview(a));else{if(_=a,"sticky"===_.name){MB.isMobile()||(n.push(_),y+=MB.widget(_,"p"));continue}s="",("pg"!==_.name||/^l/.test(_.gid))&&("pg"===_.name&&(_.top=_.left=null),s=MB.widget(_,"p")),"status_bar"===_.name&&(f.className.indexOf("sb")===-1&&(f.className+=" sb"),this.pages[t.cid].sbHTML=s),i+=s}for(e.innerHTML+=i,b.innerHTML+=y,e.style.height=t.h()+"px",p=0,h=n.length;p<h;p++)_=n[p],r=document.getElementById("widget"+_.cid+"p"),WidgetManager.renderSticky(_,r,"p");return MB.isMobile()||(this.scrollSync.init($(".pcanvas.active .widgets")[0],$("#sticky-container")[0]),$("#pscreen"+t.cid+" .widgets").onScroll(this.scrollSync.delaySync),$("#pscreen"+t.cid+" .widgets").perfectScrollbar({suppressScrollX:!0})),o=new Date,o-v>500?MB.ga("send","event","performance","render("+(o-v)+")("+t.cid+")("+MB.project().model+")("+navigator.userAgent+")"):void 0}},t}(),this.DesignerRunner=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return i(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",100),this.home=Screen.find(e),this.home.setState("default",!0),this.init()):MB.webpackInterface.navigateTo("/workspace/apps")},e}(t),this.SharingRunner=function(t){function e(t){this.project=t,e.__super__.constructor.apply(this,arguments),MB.isIOS()&&this.disableRubberBand()}return i(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<t.touchStartY&&i.scrollTop===i.scrollHeight-$(i).height()?e.preventDefault():void 0}}(this)},e.prototype.render=function(){return MB.currentScreen=this.home=this.project.homeScreen(),$("body").data("scale",100),(MB.isMobile()||MB.isEmbedded())&&(this.project.scale=100,this.project.lsave(!1)),MB.webpackInterface.renderPreview(this.project,document.querySelector("#workspace")),setTimeout(function(t){return function(){return $("#workspace").show(),t.init()}}(this),100)},e}(t)}.call(this),function(){this.Pusher=function(){function t(){var t,e,i,n;/modao.cc/.test(window.MBServer)?(e="zr0zakpglowydpzdfm9biewf3e1mv43ykz24ieu20vb8s3bl",i="0qbkbb3sxie08vnnac8ns2bz86lu9m8oam4wlvynh3mu3n08",n="cn"):(e="mw2fpdz5dqyge9ag4u9oxj6bvmx6fs1m3zq6po8dy36zkl8v",i="b3jezh7100lhusvjy7mzktticqzkrx7yj7y7j04lon7ct9c9",n="us"),this.open=!1,this.subscribed=[],this.pusher=AV.push({appId:e,appKey:i,region:n});try{this.pusher.open(function(t){return function(){return t.open=!0}}(this)),this.pusher.subscribe([MB.user.channel],function(){return console.log("\u8ba2\u9605\u6210\u529f\uff01")})}catch(t){}this.pusher.on("close",function(t){return function(){return t.open=!1}}(this)),this.pusher.on("open",function(t){return function(){return t.open=!0,t.onOpen&&t.onOpen(),t.onOpen=null}}(this)),this.pusher.on("message",function(t){return function(e){return t.onReceive(e)}}(this)),this.pusher.on("error",function(t){return function(){return t.open=!1}}(this)),t=$("#notification"),t.on("click",".icon-times, .ask_later",function(){return t.removeClass("active"),t.find(".request_permission").remove(),$("body").removeClass("notification-show")})}return t.prototype.subscribe=function(t){if(this.subscribed.indexOf(t)===-1)return this.subscribed.push(t)},t.prototype.onReceive=function(t){var e,i,n;if(t._channel===MB.user.channel)switch(t.event){case"notification":return MB.notifier&&this.handleNotification(t);case"collaboration":if("Project"===t.t)return this.updateProject(t.action,t.object);if("Team"===t.t)return this.updateTeam(t.action,t.object);if("Collaborator"===t.t)return this.updateCollaborator(t.action,t.object);if(t.from.id===MB.user.id)return;switch(t.t){case"Asset":return this.updateAsset(t.action,t.object);case"PointComments::Thread":return MB.webpackInterface&&MB.webpackInterface.pushData("comment-threads",t.action,t.object);case"PointComments::Comment":return MB.webpackInterface&&MB.webpackInterface.pushData("comments",t.action,t.object);default:if(MB.pusher.subscribed.indexOf(t.to)===-1)return;if(MB.f.inSharing)return;switch(t.t){case"Widget":this.updateWidget(t.action,t.object);break;case"Link":this.updateLink(t.action,t.object);break;case"Screen":this.updateScreen(t.action,t.object);break;case"Panel":this.updatePanel(t.action,t.object,t.extras);break;case"Screenstate":this.updateScreenstate(t.action,t.object);break;case"Widgetstate":this.updateWidgetstate(t.action,t.object);break;case"Panelstate":this.updatePanelstate(t.action,t.object)}if(i="Screen"===t.t?t.object.cid:t.object.screen_cid,!i&&t.object.screenstate_cid&&(n=Screenstate.find(t.object.screenstate_cid),n&&(i=n.screen_cid)),!t.from.id)return;return e=CoWorker.find(t.from.id),e||(e=new CoWorker({cid:t.from.id,name:t.from.name,avatar:t.from.avatar})),e.screen_cid=i,e.last_seen=new Date,e.save(),MB.renderCoWorkers&&MB.renderCoWorkers()}}},t.prototype.handleNotification=function(t){var e,i;if(!(t._channel!==MB.user.channel||t._expired||"new_thread_comment"===t.event_type&&MB.commentModeOn))return i={body:t.message},MB.isElectron()||(i.icon="/images/mockingbot-logo80x80.png"),MB.notifier.notify(I18N.got_message,i,1e4,function(e){var i;return e.preventDefault(),i=window,i.focus(),MB.notification.markRead(t.id,function(){return MB.notification.gotoDataUrl(t.url,i,t.need_reload,t.need_new_win)}),this.close()},void 0,function(e){return function(){return e.notifyFallback(t)}}(this)),e=$("#header .notifications-dropdown")[0],e?(ReactDOM.unmountComponentAtNode(e),MB.renderNotifications(e)):void 0},t.prototype.notifyFallback=function(t){if($("#notification").addClass("active"),$("#notification .request_permission_message").hide(),$("#notification .message").text(t.message),setTimeout(function(){return $("#notification").removeClass("active")},1e4),t.url)return $("#notification .message").off("click"),$("#notification .message").on("click",function(e){return e.preventDefault(),MB.notification.markRead(t.id,function(){return MB.notification.gotoDataUrl(t.url,window,t.need_reload,t.need_new_win)})})},t.prototype.updateWidget=function(t,e){var i,n;if(i=MB.getCurrentScreen(),"update"===t){if(n=Widget.find(e.cid),n?n.refresh(e):(n=new Widget,n.load(e),n.lsave(!1)),i===n.screen_cid)return ScreenManager.updateWidgetList()}else if("destroy"===t){if(n=Widget.find(e.cid),!n)return;if(n.ldestroy(!1),i===n.screen_cid)return ScreenManager.updateWidgetList(),MB.action("selection:unselect:items",{cids:[n.cid]})}},t.prototype.updatePanel=function(t,e,i){var n,r;if(n=MB.getCurrentScreen(),"update"===t){if(r=Panel.find(e.cid),!r)return $.ajax({type:"GET",url:"/app/"+i.template_token+".json",success:function(t){if(Template.refresh([t.project]),Screen.refresh(t.screens),Widget.refresh(t.widgets),Link.refresh(t.links),MB.pusher.subscribe(t.project.cid),r=new Panel,r.load(e),r.lsave(!1),MB.renderTemplateList(),n===r.screen_cid)return ScreenManager.updateWidgetList()}});if(r.refresh(e),n===r.screen_cid)return ScreenManager.updateWidgetList()}else if("destroy"===t){if(r=Panel.find(e.cid),!r)return;return n===r.screen_cid?(PanelManager.remove(r.cid,!1),MB.action("selection:unselect:items",{cids:[r.cid]}),ScreenManager.updateWidgetList()):r.ldestroy(!1)}},t.prototype.updateLink=function(t,e){var i,n;if(i=MB.getCurrentScreen(),"update"===t)n=Link.find(e.cid),n?n.refresh(e):(n=new Link,n.load(e),n.lsave(!1));else if("destroy"===t){if(n=Link.find(e.cid),!n)return;n.ldestroy(!1)}if(n&&i===n.screen_cid)return MB.renderLinks()},t.prototype.updateScreen=function(t,e){var i;if("update"===t){if(i=Screen.find(e.cid),i?(i.refresh(e),MB.currentScreen.cid===i.cid&&(MB.renderFEScreen(),$("#design").trigger("slider:update"))):(i=new Screen,i.load(e),i.lsave(!1)),MB.currentProject&&MB.currentProject.cid===i.project_cid)return MB.renderScreenList()}else if("destroy"===t){if(i=Screen.find(e.cid),!i)return;if(i.ldestroy(!1),MB.currentProject&&MB.currentProject.cid===i.project_cid)return ScreenManager.removeFromHistory(i)}},t.prototype.updateProject=function(t,e){var i,n,r;if(!MB.f.inSharing)return"update"===t&&((i=Project.find(e.cid))?i.duplicating&&(n=i.screens_count,i.refresh(e),i.screens_count=n):(i=new Project,i.load(e),i.screens_count||(i.screens_count=2),i.lsave(!1)),MB.webpackInterface.refreshAll(),i.duplicating||$("#notification").removeClass("active"),MB.f.isDuplicatingDemo&&!i.duplicating&&(MB.f.isDuplicatingDemo=!1,MB.webpackInterface.navigateTo("/workspace/apps/"+i.cid))),"destroy"===t&&((i=Project.find(e.cid))?MB.webpackInterface.deleteProjectByCid(i.cid):(r=Template.find(e.cid))&&(r.ldestroy(!1),MB.renderTemplateList())),$(".timeago").timeago()},t.prototype.updateTeam=function(t,e){var i;if(!MB.f.inSharing)return"update"===t&&(i=Team.find(e.cid),i?i.refresh(e):(i=new Team,i.load(e),i.lsave(!1)),MB.webpackInterface.refreshAll()),"destroy"===t&&(i=Team.find(e.cid))?MB.webpackInterface.deleteTeamByCid(i.cid):void 0},t.prototype.updateCollaborator=function(t,e){var i,n,r;if(!MB.f.inSharing&&("update"===t&&(i=Collaborator.find(e.cid),i?i.refresh(e):(i=new Collaborator,i.load(e),i.lsave(!1)),i.updateHostChannel(t),MB.webpackInterface.refreshAll()),"destroy"===t)){if(i=Collaborator.find(e.cid),!i)return;if(i.updateHostChannel(t),i.ldestroy(!1),i.user_id===MB.user.id&&(i.project_cid&&(n=Project.find(i.project_cid)),n&&MB.webpackInterface.deleteProjectByCid(n.cid),i.team_cid&&(r=Team.find(i.team_cid)),r))return MB.webpackInterface.deleteTeamByCid(r.cid)}},t.prototype.updateScreenstate=function(t,e){var i,n;if(i=Screen.find(MB.currentScreen.cid),"update"===t){if(n=Screenstate.find(e.cid),n?n.refresh(e):(n=new Screenstate,n.load(e),n.lsave(!1)),i&&i.cid===n.screen_cid)return MB.renderStateList()}else if("destroy"===t){if(n=Screenstate.find(e.cid),!n)return;if(n.ldestroy(!1),i&&i.cid===n.screen_cid)return i.state_cid===n.cid&&(i.setState("default",!0),MB.action("set:current:screen",{screen:i}),ScreenManager.updateWidgetList()),MB.renderStateList()}},t.prototype.updateWidgetstate=function(t,e){var i,n,r;if(i=Screen.find(MB.currentScreen.cid),"update"===t&&(r=Widgetstate.find(e.cid),r?r.refresh(e):(r=new Widgetstate,r.load(e),r.lsave(!1)),i&&i.state_cid===r.screenstate_cid&&(n=Widget.find(r.widget_cid),n.screenstate_cid===r.screenstate_cid)))return n.restore(r),n.lsave(!1),ScreenManager.updateWidgetList()},t.prototype.updateAsset=function(t,e){var i;if(!MB.f.inSharing)return"create"===t?(i=new Asset,i.load(e),i.lsave(!1)):void 0},t.prototype.updatePanelstate=function(t,e){var i,n,r;if(r=Screen.find(MB.currentScreen.cid),"update"===t&&(n=Panelstate.find(e.cid),n?n.refresh(e):(n=new Panelstate,n.load(e),n.lsave(!1)),r&&r.state_cid===n.screenstate_cid&&(i=Panel.find(n.panel_cid),i.screenstate_cid===n.screenstate_cid)))return i.restore(n),i.lsave(!1),ScreenManager.updateWidgetList()},t}()}.call(this),function(){}.call(this);